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 @@ \ 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 @@ /> - - + + - + 预览 @@ -68,7 +78,11 @@ @@ -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" >快捷替换 -
+
+ // 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 }) {