This commit is contained in:
xiezhijun 2021-03-05 20:17:35 +08:00
commit c507057f63
14 changed files with 1028 additions and 373 deletions

View File

@ -9,8 +9,8 @@ stdiet:
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
#profile: /Users/wonder/Documents/Workspaces/java/ShengtangManage/running/uploadPath profile: /Users/wonder/Documents/Workspaces/java/ShengtangManage/running/uploadPath
profile: D:/ruoyi/uploadPath # profile: D:/ruoyi/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证 # 验证码类型 math 数组计算 char 字符验证

View File

@ -20,8 +20,8 @@ public class MyApplicationRunner implements ApplicationRunner {
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
/* System.out.println("项目启动调用方法"); System.out.println("项目启动调用方法");
String path = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix,"ceshi.png",new File("D:\\ceshi.png")); // String path = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix,"ceshi.png",new File("D:\\ceshi.png"));
System.out.println(path);*/ // System.out.println(path);
} }
} }

View File

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

View File

@ -50,21 +50,27 @@
width="200" width="200"
/> />
<el-table-column <el-table-column label="合同地址" align="center" prop="path">
label="合同地址"
align="center"
prop="path"
width="80"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
type="text" type="text"
style="margin-right: 8px"
icon="el-icon-copy-document" icon="el-icon-copy-document"
@click="handleCopy(scope.row.path)" @click="handleCopy(scope.row.path)"
class="copyBtn" class="copyBtn"
:data-clipboard-text="copyValue" :data-clipboard-text="copyValue"
>复制 >复制
</el-button> </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> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="180"> <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 ContractDetail from "@/components/ContractDetail";
import Clipboard from "clipboard"; import Clipboard from "clipboard";
import ContractAdd from "@/components/ContractAdd"; import ContractAdd from "@/components/ContractAdd";
import VueQr from "vue-qr";
const logo = require("@/assets/logo/logo_b.png");
export default { export default {
name: "CustomerContractDrawer", name: "CustomerContractDrawer",
components: { components: {
"contract-detail": ContractDetail, "contract-detail": ContractDetail,
"add-contract": ContractAdd, "add-contract": ContractAdd,
VueQr,
}, },
data() { data() {
return { return {
logo,
visible: false, visible: false,
title: "", title: "",
data: undefined, data: undefined,

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,9 @@ const oriState = {
startNum: 0, startNum: 0,
endNum: 0, endNum: 0,
reviewStatus: 0, reviewStatus: 0,
templateInfo: undefined templateInfo: undefined,
copyData: undefined,
fontSize: 12
}; };
const mutations = { const mutations = {
@ -37,7 +39,10 @@ const mutations = {
obj => obj.id === payload.id obj => obj.id === payload.id
); );
if (tarDishes) { if (tarDishes) {
if (tarDishes.dishesId !== payload.dishesId) { if (
payload.dishesId !== tarDishes.dishesId ||
payload.type !== undefined
) {
// 替换菜品 // 替换菜品
Object.keys(payload).forEach(key => { Object.keys(payload).forEach(key => {
if (key === "num") { if (key === "num") {
@ -55,6 +60,9 @@ const mutations = {
} }
} }
}, },
updateFontSize(state, payload) {
state.fontSize = payload.fontSize;
},
addRecipesDishes(state, payload) { addRecipesDishes(state, payload) {
state.recipesData[payload.num].dishes.push(payload.data); state.recipesData[payload.num].dishes.push(payload.data);
}, },
@ -282,6 +290,7 @@ const actions = {
// console.log(params); // console.log(params);
}, },
async addDishes({ commit, state }, payload) { async addDishes({ commit, state }, payload) {
console.log(payload);
const tarDishesList = state.recipesData[payload.num].dishes.filter( const tarDishesList = state.recipesData[payload.num].dishes.filter(
obj => obj.type === payload.data.type obj => obj.type === payload.data.type
); );
@ -367,26 +376,34 @@ const actions = {
); );
if (tarDishes) { if (tarDishes) {
const mTarDishes = JSON.parse(JSON.stringify(tarDishes)); const mTarDishes = JSON.parse(JSON.stringify(tarDishes));
const tarIgd = mTarDishes.igdList.find(obj => obj.id === payload.igdId); let params = {
if (tarIgd) { id: mTarDishes.id
payload.weight && (tarIgd.weight = payload.weight); };
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight); if (payload.type !== undefined) {
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit); // 修改餐类
params.type = payload.type;
} else {
// 修改食材
const tarIgd = mTarDishes.igdList.find(
obj => obj.id === payload.igdId
);
if (tarIgd) {
payload.weight && (tarIgd.weight = payload.weight);
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
const params = { params.detail = mTarDishes.igdList.map(igd => ({
id: mTarDishes.id,
detail: mTarDishes.igdList.map(igd => ({
id: igd.id, id: igd.id,
weight: igd.weight, weight: igd.weight,
cus_unit: igd.cusUnit, cus_unit: igd.cusUnit,
cus_weight: igd.cusWeight cus_weight: igd.cusWeight
})) }));
};
const result = await updateDishesDetailApi(params);
if (result.code === 200) {
commit("updateRecipesDishesDetail", payload);
} }
} }
const result = await updateDishesDetailApi(params);
if (result.code === 200) {
commit("updateRecipesDishesDetail", payload);
}
} }
} else { } else {
commit("updateRecipesDishesDetail", payload); commit("updateRecipesDishesDetail", payload);
@ -408,7 +425,21 @@ const actions = {
commit("deleteSomeDayDishes", payload); commit("deleteSomeDayDishes", payload);
} }
}, },
async deleteMenu({ commit }, payload) {} async deleteMenu({ commit }, payload) {},
async setCopyData({ commit, state }, payload) {
return new Promise((res, rej) => {
const tarDishes = state.recipesData[payload.num].dishes.find(
obj => obj.id === payload.id
);
if (tarDishes) {
commit("updateStateData", { copyData: tarDishes });
res("复制成功");
} else {
rej("复制失败");
}
});
}
}; };
const getters = { const getters = {

View File

@ -187,7 +187,7 @@
prop="updateTime" prop="updateTime"
width="180" width="180"
/> />
<el-table-column label="合同地址" align="center" prop="path" width="80"> <el-table-column label="合同地址" align="center" prop="path">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
type="text" type="text"
@ -197,6 +197,16 @@
:data-clipboard-text="copyValue" :data-clipboard-text="copyValue"
>复制 >复制
</el-button> </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> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="120" /> <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 Clipboard from "clipboard";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import VueQr from "vue-qr";
const logo = require("@/assets/logo/logo_b.png");
export default { export default {
name: "Contract", name: "Contract",
components: {
VueQr,
},
data() { data() {
const checkServePromise = (rule, value, callback) => { const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) { if (this.form.projectId == 0 && !value) {
@ -331,6 +346,7 @@ export default {
callback(); callback();
}; };
return { return {
logo,
// //
loading: true, loading: true,
// //

View File

@ -4,6 +4,22 @@
:style="`height: ${collapse ? 30 : 200}px`" :style="`height: ${collapse ? 30 : 200}px`"
> >
<div class="header"> <div class="header">
<span class="font_size_style">
字体大小
<el-select
v-model="mFontSize"
size="mini"
style="width: 80px"
@change="handleOnSizeChange"
>
<el-option
v-for="size in fontSizeOpts"
:key="size.value"
:label="size.label"
:value="size.value"
/>
</el-select>
</span>
<el-button size="mini" v-if="!recipesId" @click="handleOnBack" <el-button size="mini" v-if="!recipesId" @click="handleOnBack"
>返回</el-button >返回</el-button
> >
@ -91,16 +107,32 @@ export default {
PieChart, PieChart,
}, },
data() { data() {
return {}; return {
mFontSize: 12,
fontSizeOpts: [
{ value: 12, label: "12" },
{ value: 14, label: "14" },
{ value: 16, label: "16" },
{ value: 18, label: "18" },
],
};
}, },
updated() { updated() {
// console.log(this.data); // console.log(this.data);
}, },
props: ["collapse", "data"], props: ["collapse", "data"],
computed: { computed: {
...mapState(["recipesId", "reviewStatus", "healthyData"]), ...mapState(["recipesId", "reviewStatus", "healthyData", "fontSize"]),
},
watch: {
fontSize(val) {
this.mFontSize = val;
},
}, },
methods: { methods: {
handleOnSizeChange(fontSize) {
this.updateFontSize({ fontSize });
},
handleCollapseClick() { handleCollapseClick() {
this.$emit("update:collapse", !this.collapse); this.$emit("update:collapse", !this.collapse);
}, },
@ -121,7 +153,7 @@ export default {
this.updateStateData({ recipesData: [] }); this.updateStateData({ recipesData: [] });
}, },
...mapActions(["saveRecipes", "updateReviewStatus"]), ...mapActions(["saveRecipes", "updateReviewStatus"]),
...mapMutations(["updateStateData"]), ...mapMutations(["updateStateData", "updateFontSize"]),
}, },
}; };
</script> </script>
@ -138,6 +170,13 @@ export default {
transition: all 0.3s; transition: all 0.3s;
transform-origin: center center; transform-origin: center center;
} }
.font_size_style {
display: inline-flex;
align-items: center;
font-size: 12px;
margin-right: 12px;
}
} }
.content { .content {

View File

@ -92,13 +92,14 @@ export default {
data.name data.name
}`; }`;
this.id = data.id; this.id = data.id;
this.type = data.type;
} else if (type) { } else if (type) {
this.title = `添加第${numDay}${this.typeDict[type]}菜品`; this.title = `添加第${numDay}${this.typeDict[type]}菜品`;
this.type = type; this.type = type;
} }
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dishesRef.getList({ type }); this.$refs.dishesRef.getList({ type: this.type });
}); });
}, },
handleOnClosed(done) { handleOnClosed(done) {
@ -114,6 +115,7 @@ export default {
this.active = 1; this.active = 1;
this.dishesTypeOptions = (this.type || data.type) this.dishesTypeOptions = (this.type || data.type)
.split(",") .split(",")
.sort((a, b) => a - b)
.reduce((arr, cur, idx) => { .reduce((arr, cur, idx) => {
if (idx === 0) { if (idx === 0) {
this.selDishes.type = cur; this.selDishes.type = cur;

View File

@ -0,0 +1,98 @@
<template>
<el-dialog
:title="title"
:visible.sync="visible"
width="320px"
:close-on-click-modal="false"
>
<div v-loading="loading" @click="handleClick" class="reuse_dialog_wrapper">
<div style="margin-bottom: 12px">餐类</div>
<el-radio-group v-model="type">
<el-radio
style="padding: 8px 0"
v-for="item in menuTypeOptions"
:key="item.dictValue"
:label="item.dictValue"
>
{{ item.dictLabel }}
</el-radio>
</el-radio-group>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { createNamespacedHelpers } from "vuex";
const { mapState } = createNamespacedHelpers("recipes");
import { getDishes } from "@/api/custom/dishes";
export default {
name: "DishesSettingDialog",
data() {
return {
visible: false,
loading: false,
data: undefined,
type: "",
menuTypeOptions: [],
title: "",
};
},
methods: {
handleClick(e) {
e.stopPropagation();
},
showDialog({ numDay, data }) {
if (!data) {
return;
}
this.data = data;
this.visible = true;
this.loading = true;
this.type = data.type;
this.title = `修改第${numDay}天「${data.name}」菜品`;
getDishes(data.dishesId).then((res) => {
if (res.code === 200) {
this.loading = false;
this.menuTypeOptions = res.data.type
.split(",")
.sort((a, b) => a - b)
.reduce((arr, cur) => {
const tarOpt = this.typeOptions.find(
(obj) => obj.dictValue === cur
);
if (tarOpt) {
arr.push(tarOpt);
}
return arr;
}, []);
}
});
},
cancel() {
this.visible = false;
this.data = undefined;
},
submit() {
this.visible = false;
this.$emit("onConfirm", { type: this.type, id: this.data.id });
},
},
computed: {
...mapState(["typeOptions"]),
},
};
</script>
<style lang="scss" scoped>
.reuse_dialog_wrapper {
.item {
margin-bottom: 12px;
}
.menu_type {
padding: 8px 16px;
}
}
</style>

View File

@ -95,6 +95,14 @@ export default {
this.mUnit = value; this.mUnit = value;
}, },
}, },
watch: {
weight(val) {
this.mWeight = val;
},
unit(val) {
this.mUnit = val;
},
},
computed: { computed: {
unitWeight() { unitWeight() {
return ( return (

View File

@ -1,20 +0,0 @@
<template>
<el-dialog>
</el-dialog>
</template>
<script>
export default {
name: 'ReuseDialog',
data() {
return {
visible: false,
data: undefined
}
},
methods: {
showDialog() {
this.visible = true;
}
}
}
</script>

View File

@ -7,12 +7,28 @@
:cell-style="{ padding: '2px 0' }" :cell-style="{ padding: '2px 0' }"
:header-cell-style="{ padding: '4px 0', height: 'unset' }" :header-cell-style="{ padding: '4px 0', height: 'unset' }"
size="mini" size="mini"
:style="`outline: ${currentDay === num ? '1px solid #d96969' : 'none'}`" header-row-class-name="recipes_header"
:cell-class-name="cellClassName"
:style="`outline: ${currentDay === num ? '1px solid #d53950' : 'none'}`"
> >
<el-table-column prop="type" :width="100" align="center"> <el-table-column prop="type" :width="100" align="center">
<template slot="header"> <template slot="header">
<div class="num_day" @click="handleOnResetCurrentDay"> <el-popover placement="top" trigger="hover" v-if="!!copyData">
<div>{{ `${numDay}` }}</div> <div>
<el-button size="mini" type="primary" @click="handleOnPaste"
>粘贴</el-button
>
</div>
<div
slot="reference"
class="num_day"
@click="handleOnResetCurrentDay"
>
{{ `${numDay}` }}
</div>
</el-popover>
<div v-else>
{{ `${numDay}` }}
</div> </div>
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
@ -44,23 +60,42 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover placement="right" trigger="hover" :title="scope.row.name"> <el-popover placement="right" trigger="hover" :title="scope.row.name">
<div> <div>
<el-button <div style="margin-bottom: 8px">
type="primary" <el-button
size="mini" type="primary"
icon="el-icon-refresh" size="mini"
class="fun_button" icon="el-icon-refresh"
@click="handleOnReplace(scope.row)" class="fun_button"
> @click="handleOnReplace(scope.row)"
替换 >
</el-button> 替换
<el-button </el-button>
type="danger" <el-button
size="mini" type="danger"
icon="el-icon-delete" size="mini"
class="fun_button" icon="el-icon-delete"
@click="handleOnDelete(scope.row)" class="fun_button"
>删除</el-button @click="handleOnDelete(scope.row)"
> >删除</el-button
>
</div>
<div>
<el-button
type="primary"
size="mini"
icon="el-icon-document-copy"
class="fun_button"
@click="handleOnCopy(scope.row)"
>复制</el-button
>
<el-button
size="mini"
icon="el-icon-document-copy"
class="fun_button"
@click="handleOnSetting(scope.row)"
>修改餐类</el-button
>
</div>
</div> </div>
<span class="num_day" slot="reference">{{ scope.row.name }}</span> <span class="num_day" slot="reference">{{ scope.row.name }}</span>
</el-popover> </el-popover>
@ -172,7 +207,13 @@
</el-table-column> </el-table-column>
<el-table-column label="做法" prop="methods" /> <el-table-column label="做法" prop="methods" />
</el-table> </el-table>
<!-- 添加菜品抽屉 -->
<AddDishesDrawer ref="drawerRef" @onConfirm="handleOnDishesConfirm" /> <AddDishesDrawer ref="drawerRef" @onConfirm="handleOnDishesConfirm" />
<!-- 菜品复用菜单 -->
<DishesSettingDialog
ref="settingDialogRef"
@onConfirm="handleOnSettingConfirm"
/>
</div> </div>
</template> </template>
<script> <script>
@ -187,6 +228,8 @@ const {
import EditableText from "./EditableText"; import EditableText from "./EditableText";
import EditableUnit from "./EditableUnit"; import EditableUnit from "./EditableUnit";
import AddDishesDrawer from "./AddDishesDrawer"; import AddDishesDrawer from "./AddDishesDrawer";
import DishesSettingDialog from "./DishesSettingDialog";
import VueScrollTo from "vue-scrollto";
export default { export default {
name: "RecipesCom", name: "RecipesCom",
@ -213,6 +256,7 @@ export default {
EditableText, EditableText,
EditableUnit, EditableUnit,
AddDishesDrawer, AddDishesDrawer,
DishesSettingDialog,
}, },
mounted() { mounted() {
// console.log(this.data); // console.log(this.data);
@ -313,12 +357,23 @@ export default {
return mData; return mData;
}, },
...mapGetters(["typeDict"]), ...mapGetters(["typeDict"]),
...mapState(["currentDay"]), ...mapState(["currentDay", "copyData", "fontSize"]),
}, },
methods: { methods: {
cellClassName({ row, column, rowIndex, columnIndex }) {
// console.log({ row, column, rowIndex, columnIndex });
if (!columnIndex) {
return "recipes_first_col";
} else {
return `recipes_cell recipes_cell_${this.fontSize}`;
}
},
handleParentClick(e) { handleParentClick(e) {
// //
this.setCurrentDay({ currentDay: this.num }); this.setCurrentDay({ currentDay: this.num });
VueScrollTo.scrollTo(`#recipes${this.num}`, 500, {
container: "#recipes_content",
});
}, },
spanMethod({ row, column, rowIndex, columnIndex }) { spanMethod({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 0) { if (columnIndex === 0) {
@ -351,6 +406,27 @@ export default {
// console.log(data); // console.log(data);
this.deleteDishes({ num: this.num, id: data.id }); this.deleteDishes({ num: this.num, id: data.id });
}, },
handleOnCopy(data) {
// console.log(data);
this.setCopyData({ num: this.num, id: data.id })
.then((msg) => {
this.$message.success(msg);
})
.catch((err) => {
this.$message.error(err);
});
},
handleOnPaste() {
// console.log(this.copyData);
if (this.copyData) {
this.addDishes({
num: this.num,
data: this.copyData,
}).catch((err) => {
this.$message.error(err);
});
}
},
handleOnWeightChange(data, weight) { handleOnWeightChange(data, weight) {
// console.log({ data, weight }); // console.log({ data, weight });
this.updateDishes({ this.updateDishes({
@ -390,6 +466,16 @@ export default {
}); });
} }
}, },
handleOnSetting(data) {
this.$refs.settingDialogRef.showDialog({ numDay: this.numDay, data });
},
handleOnSettingConfirm({ type, id }) {
this.updateDishes({
num: this.num,
id,
type,
});
},
handleOnMenuTypeClick(data) { handleOnMenuTypeClick(data) {
this.$refs.drawerRef.showDrawer({ type: data.type, numDay: this.numDay }); this.$refs.drawerRef.showDrawer({ type: data.type, numDay: this.numDay });
}, },
@ -398,6 +484,7 @@ export default {
"addDishes", "addDishes",
"deleteDishes", "deleteDishes",
"replaceDishes", "replaceDishes",
"setCopyData",
]), ]),
...mapMutations(["setCurrentDay", "resetCurrentDay"]), ...mapMutations(["setCurrentDay", "resetCurrentDay"]),
}, },
@ -419,4 +506,36 @@ export default {
font-size: 12px; font-size: 12px;
padding: 4px 8px; padding: 4px 8px;
} }
.recipes_header {
& > th {
background: #d53950 !important;
color: white !important;
font-weight: bold;
}
}
.recipes_first_col {
background: #d53950 !important;
color: white !important;
font-weight: bold;
}
.recipes_cell {
font-weight: bold;
color: #595959;
}
.recipes_cell_12 {
font-size: 12px;
}
.recipes_cell_14 {
font-size: 14px;
}
.recipes_cell_16 {
font-size: 16px;
}
.recipes_cell_18 {
font-size: 18px;
}
</style> </style>