From f2946fea5943e2fb3aa7d9e855333b87e0c1ffbf Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Tue, 6 Apr 2021 19:13:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8F=9C=E8=B0=B1=E6=88=AA?= =?UTF-8?q?=E5=8F=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/custom/SysOrderMapper.xml | 2 +- stdiet-ui/src/store/modules/recipes.js | 7 ++-- .../InfoView/ShortCutCom/index.vue | 32 +++++++++++++++---- .../RecipesView/RecipesCom/index.vue | 16 ++++++++-- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index 6962cad0b..ca57a9eff 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -480,7 +480,7 @@ <!-- 根据客户ID查询该客户下所有订单 --> <select id="getAllOrderByCusId" parameterType="Long" resultMap="SysOrderResult"> - select * from sys_order where del_flag = 0 and cus_id = #{cusId} order by order_id asc + select * from sys_order where del_flag = 0 and cus_id = #{cusId} order by order_time asc </select> </mapper> \ No newline at end of file diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 9a5f10ae1..1d7c7f307 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -242,9 +242,9 @@ const actions = { if (recipesDataResult.code === 200) { const { endNum, startNum, recipesId } = state; // 计算 - let length = endNum - startNum; + const length = endNum - startNum; recipesData = recipesDataResult.data.reduce((outArr, dayData, idx) => { - if (!recipesId || length >= idx) { + if (length >= idx) { outArr.push({ id: dayData.id, numDay: !recipesId ? startNum + idx : dayData.numDay, @@ -531,7 +531,8 @@ const actions = { }).then(() => { window.postMessage( { - type: messageTypes.UPDATE_SHORTCUT + type: messageTypes.UPDATE_SHORTCUT, + setCurrent: true }, "*" ); diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue index 60485a3da..3693aa495 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/ShortCutCom/index.vue @@ -50,8 +50,13 @@ /> <!-- 菜品预览 --> <el-table border :data="scope.row.data.igdList" v-else size="mini"> - <el-table-column align="center" label="食材" prop="name" /> - <el-table-column align="center" label="分量估算"> + <el-table-column + align="center" + label="食材" + prop="name" + width="100" + /> + <el-table-column align="center" label="分量估算" width="100"> <template slot-scope="scope"> <span>{{ `${cusWeightDict[scope.row.cusWeight]}${ @@ -60,7 +65,12 @@ }}</span> </template> </el-table-column> - <el-table-column align="center" label="重量(g)" prop="weight" /> + <el-table-column + align="center" + label="重量(g)" + prop="weight" + width="100" + /> </el-table> <el-button type="text" size="mini" slot="reference">预览</el-button> </el-popover> @@ -68,7 +78,11 @@ </el-table-column> <el-table-column label="操作" :width="60" align="center"> <template slot-scope="scope"> - <el-button type="text" size="mini" @click="handleOnDelete(scope.row)"> + <el-button + type="text" + size="mini" + @click="handleOnDelete(scope.row)" + > 删除 </el-button> </template> @@ -129,18 +143,24 @@ export default { messageListener(e) { const { data } = e; if (data.type === messageTypes.UPDATE_SHORTCUT) { - this.getList(); + this.getList(data.setCurrent); } }, - getList() { + getList(setCurrent) { getShortCut().then((data) => { this.dataList = data; // console.log(this.dataList); + if (setCurrent) { + this.$refs.shortCutTable.setCurrentRow(data[0]); + } }); }, handleOnDelete(data) { removeShortCut(data.id).then((res) => { this.getList(); + if (this.curShortCutObj.id === data.id) { + this.setCurShortCutObj({}); + } }); }, handleOnCurrentChange(data) { diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue index 5a7fb7b82..615791faf 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/index.vue @@ -39,7 +39,10 @@ @click="handleOnMenuPasteClick" >快捷替换</el-button > - <div v-else-if="curShortCutObj.type" style="margin-top: 8px"> + <div + v-else-if="curShortCutObj && curShortCutObj.type" + style="margin-top: 8px" + > <el-button icon="el-icon-right" size="mini" @@ -411,6 +414,13 @@ export default { } const mData = processMenuData(this.data.dishes); // console.log(mData); + // mData.forEach((obj, idx) => + // console.log({ + // num: this.num, + // type: obj.type, + // idx: idx + 1, + // }) + // ); return mData; }, @@ -478,7 +488,9 @@ export default { }, shouldPasteShow(type) { return ( - this.curShortCutObj.type && this.curShortCutObj.type.includes(type) + this.curShortCutObj && + this.curShortCutObj.type && + this.curShortCutObj.type.includes(type) ); }, cellClassName({ row, column, rowIndex, columnIndex }) {