增加二维码功能

This commit is contained in:
huangdeliang 2021-03-05 17:19:18 +08:00
parent 17b7c04f6d
commit a50c6afa49
5 changed files with 685 additions and 307 deletions
stdiet-ui
package.json
src
components
ContractDrawer
HeatStatisticsDrawer
PhysicalSignsDialog
views/custom/contract

@ -64,6 +64,7 @@
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"vue-cropper": "0.4.9",
"vue-qr": "^2.3.0",
"vue-router": "3.0.2",
"vue-scrollto": "^2.20.0",
"vue-splitpane": "1.0.4",

@ -50,21 +50,27 @@
width="200"
/>
<el-table-column
label="合同地址"
align="center"
prop="path"
width="80"
>
<el-table-column label="合同地址" align="center" prop="path">
<template slot-scope="scope">
<el-button
type="text"
style="margin-right: 8px"
icon="el-icon-copy-document"
@click="handleCopy(scope.row.path)"
class="copyBtn"
:data-clipboard-text="copyValue"
>复制
</el-button>
<el-popover placement="top" trigger="click">
<VueQr :text="copyValue" :logoSrc="logo" />
<el-button
slot="reference"
icon="el-icon-picture-outline"
type="text"
@click="handleCopy(scope.row.path)"
>二维码</el-button
>
</el-popover>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
@ -108,15 +114,18 @@ import { delContract, listContract } from "@/api/custom/contract";
import ContractDetail from "@/components/ContractDetail";
import Clipboard from "clipboard";
import ContractAdd from "@/components/ContractAdd";
import VueQr from "vue-qr";
const logo = require("@/assets/logo/logo_b.png");
export default {
name: "CustomerContractDrawer",
components: {
"contract-detail": ContractDetail,
"add-contract": ContractAdd,
VueQr,
},
data() {
return {
logo,
visible: false,
title: "",
data: undefined,

@ -10,16 +10,34 @@
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button icon="el-icon-share" size="small" title="点击复制链接" class="copyBtn" type="primary" :data-clipboard-text="copyValue" @click="handleCopy()">外食计算器</el-button>
<el-button
icon="el-icon-share"
size="small"
title="点击复制链接"
class="copyBtn"
type="primary"
:data-clipboard-text="copyValue"
@click="handleCopy()"
>外食计算器</el-button
>
</el-col>
<el-popover :placement="bottom" trigger="click">
<VueQr :text="copyValue" :logoSrc="logo" />
<el-button slot="reference">二维码</el-button>
</el-popover>
</el-row>
<el-table :data="foodHeatStatisticsList" >
<el-table-column label="日期" align="center" prop="edibleDate" width="120">
<el-table :data="foodHeatStatisticsList">
<el-table-column
label="日期"
align="center"
prop="edibleDate"
width="120"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.edibleDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.edibleDate, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="食材" align="center" prop="ingredient" />
<!-- <el-table-column label="食材" align="center" prop="ingredient" />
<el-table-column label="通俗计量" align="center" prop="unitName">
<template slot-scope="scope">
{{ scope.row.number ? (scope.row.number + "" + (scope.row.unitName != null ? scope.row.unitName : "")) : "" }}
@ -27,62 +45,87 @@
</el-table-column>
<el-table-column label="质量(克)" align="center" prop="quantity" />-->
<el-table-column label="可摄入量" align="center" prop="maxHeatValue" />
<el-table-column
label="可摄入量"
align="center"
prop="maxHeatValue"
/>
<el-table-column label="食材热量" align="center" prop="heatValue" />
<el-table-column label="热量缺口" align="center" prop="heatGap" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleDetail(scope.row)"
v-hasPermi="['custom:foodHeatStatistics:query']"
>详情</el-button>
>详情</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCalculate(scope.row)"
>计算</el-button>
>计算</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleOnDeleteClick(scope.row)"
v-hasPermi="['custom:foodHeatStatistics:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="fetchHeatList"
/>
<heatStatisticsCalculate ref="heatStatisticsCalculateRef"></heatStatisticsCalculate>
<heatStatisticsDetail ref="heatStatisticsDetailRef"></heatStatisticsDetail>
<heatStatisticsCalculate
ref="heatStatisticsCalculateRef"
></heatStatisticsCalculate>
<heatStatisticsDetail
ref="heatStatisticsDetailRef"
></heatStatisticsDetail>
</div>
</el-drawer>
</div>
</template>
<script>
import { listFoodHeatStatistics, getFoodHeatStatistics, delFoodHeatStatistics, addFoodHeatStatistics, updateFoodHeatStatistics, exportFoodHeatStatistics } from "@/api/custom/foodHeatStatistics";
import Clipboard from 'clipboard';
import HeatStatisticsCalculate from "@/components/HeatStatisticsCalculate";
import HeatStatisticsDetail from "@/components/HeatStatisticsDetail";
import {
listFoodHeatStatistics,
getFoodHeatStatistics,
delFoodHeatStatistics,
addFoodHeatStatistics,
updateFoodHeatStatistics,
exportFoodHeatStatistics,
} from "@/api/custom/foodHeatStatistics";
import Clipboard from "clipboard";
import HeatStatisticsCalculate from "@/components/HeatStatisticsCalculate";
import HeatStatisticsDetail from "@/components/HeatStatisticsDetail";
import VueQr from "vue-qr";
const logo = require("@/assets/logo/logo_b.png");
export default {
name: "HeatStatisticsDrawer",
components: {
'heatStatisticsCalculate':HeatStatisticsCalculate,
'heatStatisticsDetail': HeatStatisticsDetail
heatStatisticsCalculate: HeatStatisticsCalculate,
heatStatisticsDetail: HeatStatisticsDetail,
VueQr,
},
data() {
return {
logo,
visible: false,
title: "",
data: undefined,
@ -94,7 +137,7 @@ export default {
pageNum: 1,
pageSize: 10,
},
copyValue: ""
copyValue: "",
};
},
methods: {
@ -106,33 +149,31 @@ export default {
}
this.title = `${this.data.name}」热量统计列表`;
this.queryParams.customerId = data.id;
this.copyValue =
window.location.origin.replace("manage", "sign") +
"/foodHeatCalculator/" +
this.data.encId;
this.fetchHeatList();
},
fetchHeatList() {
listFoodHeatStatistics(this.queryParams).then(response => {
listFoodHeatStatistics(this.queryParams).then((response) => {
this.foodHeatStatisticsList = response.rows;
this.total = response.total;
this.visible = true;
});
},
handleAdd() {
},
handleAdd() {},
handleOnClosed() {
this.data = undefined;
this.copyValue = "";
},
handleOnDeleteClick(data) {
const ids = data.id || this.ids;
this.$confirm(
'是否确认删除该数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
this.$confirm("是否确认删除该数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delFoodHeatStatistics(ids);
})
@ -143,21 +184,20 @@ export default {
.catch(function () {});
},
handleCopy() {
this.copyValue = window.location.origin.replace('manage', 'sign') + "/foodHeatCalculator/"+this.data.encId;
const btnCopy = new Clipboard('.copyBtn');
new Clipboard(".copyBtn");
this.$message({
message: '拷贝成功',
type: 'success'
message: "拷贝成功",
type: "success",
});
},
handleCalculate(data){
this.$refs.heatStatisticsCalculateRef.showDialog(data,() => {
handleCalculate(data) {
this.$refs.heatStatisticsCalculateRef.showDialog(data, () => {
this.fetchHeatList();
});
},
handleDetail(data){
this.$refs.heatStatisticsDetailRef.showDialog(data, this.data.name);
}
handleDetail(data) {
this.$refs.heatStatisticsDetailRef.showDialog(data, this.data.name);
},
},
};
</script>

File diff suppressed because it is too large Load Diff

@ -187,7 +187,7 @@
prop="updateTime"
width="180"
/>
<el-table-column label="合同地址" align="center" prop="path" width="80">
<el-table-column label="合同地址" align="center" prop="path" >
<template slot-scope="scope">
<el-button
type="text"
@ -197,6 +197,16 @@
:data-clipboard-text="copyValue"
>复制
</el-button>
<el-popover placement="top" trigger="click">
<VueQr :text="copyValue" :logoSrc="logo" />
<el-button
slot="reference"
icon="el-icon-picture-outline"
type="text"
@click="handleCopy(scope.row.path)"
>二维码</el-button
>
</el-popover>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="120" />
@ -320,9 +330,14 @@ import { addContract, delContract, listContract } from "@/api/custom/contract";
import Clipboard from "clipboard";
import { mapGetters } from "vuex";
import VueQr from "vue-qr";
const logo = require("@/assets/logo/logo_b.png");
export default {
name: "Contract",
components: {
VueQr,
},
data() {
const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) {
@ -331,6 +346,7 @@ export default {
callback();
};
return {
logo,
//
loading: true,
//