diff --git a/stdiet-ui/src/views/custom/dishes/index.vue b/stdiet-ui/src/views/custom/dishes/index.vue index 474a43547..51719e3b9 100644 --- a/stdiet-ui/src/views/custom/dishes/index.vue +++ b/stdiet-ui/src/views/custom/dishes/index.vue @@ -11,7 +11,7 @@ /> - + --> + + + + + + + + + @@ -245,6 +287,10 @@ ingDataList: [], // 选中的食材列表 selIngList: [], + // + selRec: [], + // + selNotRec: [], // 选中的食材id selIngIds: [], // 选中的食材分量列表 @@ -283,7 +329,31 @@ getList() { this.loading = true; listDishes(this.queryParams).then(response => { - this.dishesList = response.rows; + this.dishesList = response.rows.map(d => { + const recTags = [], notRecTags = []; + d.igdList.forEach(igd => { + if (igd.rec) { + igd.rec.split(',').forEach(rec => { + if (!recTags.includes(rec)) { + recTags.push(rec) + } + }) + } + if (igd.notRec) { + igd.notRec.split(',').forEach(notRec => { + if (!notRecTags.includes(notRec)) { + notRecTags.push(notRec) + } + }) + } + }) + return { + ...d, + recTags, + notRecTags + } + }); + console.log(this.dishesList) this.total = response.total; this.loading = false; }); @@ -317,6 +387,8 @@ this.selIngList = []; this.selTableData = []; this.oriDataList = []; + this.selRec = []; + this.selNotRec = []; this.ingType = '1'; this.resetForm("form"); }, @@ -362,6 +434,20 @@ label: obj.name }); this.selTableData.push(obj) + if (obj.rec) { + obj.rec.split(',').forEach(rec => { + if (!this.selRec.includes(rec)) { + this.selRec.push(rec) + } + }) + } + if (obj.notRec) { + obj.notRec.split(',').forEach(notRec => { + if (!this.selNotRec.includes(notRec)) { + this.selNotRec.push(notRec) + } + }) + } }) listAllIngredient({type: this.ingType}).then(res => { this.open = true; @@ -436,6 +522,8 @@ handleChange(value, direction, movedKeys) { // console.log({oriIgdList: this.oriDataList, selIgdList: this.form.igdList}); const newTableData = []; + this.selRec = []; + this.selNotRec = []; this.selIngList = value.map(id => { // 搜索table中的数据 let tmpTableObj = this.selTableData.find(obj => obj.id === id); @@ -448,6 +536,22 @@ newTableData.push({...tmpTableObj, weight: 100, cusWeight: 1, cusUnit: 1}) } } + if (tmpTableObj) { + if (tmpTableObj.rec) { + tmpTableObj.rec.split(',').forEach(rec => { + if (!this.selRec.includes(rec)) { + this.selRec.push(rec) + } + }) + } + if (tmpTableObj.notRec) { + tmpTableObj.notRec.split(',').forEach(notRec => { + if (!this.selNotRec.includes(notRec)) { + this.selNotRec.push(notRec) + } + }) + } + } const tarObj = this.ingDataList.find(({key}) => key === id); return tarObj }); @@ -536,4 +640,25 @@ .weight .el-input .el-input__inner { padding: 0 32px 0 4px; } + + .drawer_content { + height: 100%; + display: flex; + flex-direction: column; + } + + .drawer_content .el-form { + /*height: calc(100% - 45px);*/ + flex: 1 1 0; + padding: 12px; + overflow: auto; + } + + .drawer_content > div { + flex: 0 0 45px; + display: inline-flex; + align-items: center; + justify-content: flex-end; + padding: 0 12px; + }