Răsfoiți Sursa

解决基本信息label值反显,参照弹窗选择之后数值反显问题

002390 2 ani în urmă
părinte
comite
6dfd647a40
1 a modificat fișierele cu 83 adăugiri și 71 ștergeri
  1. 83 71
      src/views/material/basicFile/details.vue

+ 83 - 71
src/views/material/basicFile/details.vue

@@ -29,7 +29,7 @@
               </el-dropdown-menu>
             </el-dropdown>
 
-                                                                                                  <el-button size="small" @click="handleQuery">查询</el-button> -->
+                                                                                                                                  <el-button size="small" @click="handleQuery">查询</el-button> -->
             <el-button size="small" @click="handleRefresh">刷新</el-button>
 
           </el-button-group>
@@ -49,7 +49,7 @@
                 <el-dropdown-item :command="isInvoke(true)">启用</el-dropdown-item>
                 <el-dropdown-item :command="isInvoke(false)">停用</el-dropdown-item>
               </el-dropdown-menu>
-                                                                                                                                                 </el-dropdown> -->
+                                                                                                                                                                                 </el-dropdown> -->
           </el-button-group>
         </el-col>
 
@@ -58,7 +58,7 @@
           <el-button-group>
             <el-button size="small" @click="handleQueryForm">申请单查询</el-button>
           </el-button-group>
-                                                                                          </el-col> -->
+                                                                                                                          </el-col> -->
 
         <!-- 导入导出 -->
       <!-- <el-col :span="1.5">
@@ -66,7 +66,7 @@
             <el-button size="small" @click="handleImport">批量导入</el-button>
             <el-button size="small" @click="handleExport">批量导出</el-button>
           </el-button-group>
-                                                                                            </el-col> -->
+                                                                                                                            </el-col> -->
 
       </el-row>
 
@@ -112,7 +112,7 @@
           <!-- 附件管理 -->
         <!-- <el-button-group>
             <el-button size="small" icon="el-icon-paperclip" @click="handleFile"></el-button>
-                                                                                          </el-button-group> -->
+                                                                                                                          </el-button-group> -->
 
           <!-- 切换 -->
         <!-- <el-button-group>
@@ -124,7 +124,7 @@
               @click="handleChangePage('next')" />
             <el-button size="small" icon="el-icon-d-arrow-right" :disabled="!handleBasicEdit"
               @click="handleChangePage('end')" />
-                                                                                          </el-button-group> -->
+                                                                                                                          </el-button-group> -->
         </el-col>
       </el-row>
 
@@ -170,7 +170,7 @@
                         <el-form-item v-else-if="f.attribute == 'select'" :label="f.name"
                           :id="(updateButtonGroup && f.apiUrl) ? 'selected' : ''">
 
-                          <el-select v-model="basicData.value[`${f.prop}Label`]" :placeholder="f.name"
+                          <el-select v-model="basicData.value[`${f.prop}Name`]" :placeholder="f.name"
                             :key="basicData.value[f.prop]" :disabled="!(updateButtonGroup && f.edit)"
                             @focus="f.apiUrl && handleQueryMore(f, '', { name: 'basicData', prop: f.prop })">
                             <el-option v-if="f.dictId" v-for="d in f.dictValue" :key="d.dictCode" :label="d.dictLabel"
@@ -236,7 +236,7 @@
                             <!-- 下拉框 -->
                             <el-form-item v-else-if="m.attribute == 'select'" :label="m.name">
 
-                              <el-select v-model="medcineData.value[`${m.prop}Label`]" :placeholder="m.name"
+                              <el-select v-model="medcineData.value[`${m.prop}Name`]" :placeholder="m.name"
                                 :key="medcineData.value[m.prop]" :disabled="!updateButtonGroup"
                                 @focus="m.apiUrl && handleQueryMore(m, '', { name: 'medcineData', prop: m.prop })">
 
@@ -411,7 +411,7 @@
             <el-form :inline="true" label-position="right" :model="basicData.value">
             <!-- <el-form-item label="所属组织">
                   <el-input v-model="basicData.value.orgName" placeholder="所属组织"></el-input>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               </el-form-item> -->
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               </el-form-item> -->
               <el-form-item label="物料编码">
                 <el-input v-model="basicData.value.code" size="small" readonly placeholder="物料编码"></el-input>
               </el-form-item>
@@ -423,7 +423,7 @@
               </el-form-item>
             <!-- <el-form-item label="版本号">
                 <el-input v-model="basicData.value.version"  placeholder="版本号"></el-input>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               </el-form-item> -->
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               </el-form-item> -->
 
             </el-form>
           </el-collapse-item>
@@ -447,7 +447,7 @@
                       <!-- 下拉框 -->
                       <el-form-item v-else-if="f.attribute == 'select'" :label="f.name">
 
-                        <el-select v-model="otherDeatils.value[`${f.prop}Label`]" :placeholder="f.name"
+                        <el-select v-model="otherDeatils.value[`${f.prop}Name`]" :placeholder="f.name"
                           :key="otherDeatils.value[f.prop]" :disabled="!(otherDeatils.isEdit && f.edit)"
                           @focus="f.apiUrl && handleQueryMore(f, '', { name: 'otherDeatils', prop: f.prop })">
 
@@ -873,6 +873,7 @@ export default {
         id,
         templateCode,
       ).then(res => {
+        this.loading = false;
         console.log(res, '物料基本信息');
         let { code, data } = res;
         if (code == 200) {
@@ -880,59 +881,59 @@ export default {
           _this.basicData.value = data.data;
           // this.basicData.form = data.form;
 
-          _this.handleAddReferLabel('basicData');
+          // _this.handleAddReferLabel('basicData');
 
         }
       })
     },
     // 添加参照中的label
-    handleAddReferLabel(dataName) {
-      let _this = this;
-      this[dataName].form.map(item => {
-        // 查参照
-        if (item.apiUrl && item.apiUrl != '') {
+    // handleAddReferLabel(dataName) {
+    //   let _this = this;
+    //   this[dataName].form.map(item => {
+    //     // 查参照
+    //     if (item.apiUrl && item.apiUrl != '') {
 
-          let param = {};
+    //       let param = {};
 
-          if (item.relevance && item.relevance != '') {
-            let reList = item.relevance.split(',');
-            console.log(reList, 'reList-------------------');
-            reList.forEach(i => {
-              param[i] = this.basicData.value[i]
-            })
-            console.log(param, 'param/////////////////////////');
-          }
+    //       if (item.relevance && item.relevance != '') {
+    //         let reList = item.relevance.split(',');
+    //         console.log(reList, 'reList-------------------');
+    //         reList.forEach(i => {
+    //           param[i] = this.basicData.value[i]
+    //         })
+    //         console.log(param, 'param/////////////////////////');
+    //       }
 
-          _this.getExecuteMethods(item.apiUrl, param, (data) => {
-            let { tableBody } = data;
+    //       _this.getExecuteMethods(item.apiUrl, param, (data) => {
+    //         let { tableBody } = data;
 
-            // 维护物料类别  --- 属于列表中获取label
-            if (dataName == 'materialType') {
+    //         // 维护物料类别  --- 属于列表中获取label
+    //         if (dataName == 'materialType') {
 
-              _this[dataName].value.length && (_this[dataName].value = _this[dataName].value.map(d => {
+    //           _this[dataName].value.length && (_this[dataName].value = _this[dataName].value.map(d => {
 
-                let Blabel = tableBody.filter((t) => t.id == d[item.prop])[0];
-                console.log(Blabel, 'Blabel``````````````````````````');
-                d[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
-                return d;
-              }))
+    //             let Blabel = tableBody.filter((t) => t.id == d[item.prop])[0];
+    //             console.log(Blabel, 'Blabel``````````````````````````');
+    //             d[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
+    //             return d;
+    //           }))
 
-            } else {
+    //         } else {
 
-              let Blabel = tableBody.filter((t) => t.id == _this[dataName].value[item.prop])[0];
-              console.log(Blabel, 'Blabel``````````````````````````');
-              _this[dataName].value[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
-            }
+    //           let Blabel = tableBody.filter((t) => t.id == _this[dataName].value[item.prop])[0];
+    //           console.log(Blabel, 'Blabel``````````````````````````');
+    //           _this[dataName].value[`${item.prop}Label`] = (Blabel && Blabel.name) || Blabel || '';
+    //         }
 
-            // this.count++;
-            this.loading = false;
-            console.log(_this[dataName].value, `${dataName}//////////////////////`);
-          })
-        }
-      })
-      this.materialType.loading = false;
+    //         // this.count++;
+    //         this.loading = false;
+    //         console.log(_this[dataName].value, `${dataName}//////////////////////`);
+    //       })
+    //     }
+    //   })
+    //   this.materialType.loading = false;
 
-    },
+    // },
 
 
     // 查询财务信息列表
@@ -1032,7 +1033,7 @@ export default {
         console.log('查询财务信息详情', res);
         if (res.code == 200) {
           this.otherDeatils.value = res.data.data;
-          _this.handleAddReferLabel('otherDeatils');
+          // _this.handleAddReferLabel('otherDeatils');
         }
       })
     },
@@ -1044,7 +1045,7 @@ export default {
         console.log(res, '获取利润中心详情');
         if (res.code == 200) {
           this.otherDeatils.value = res.data.data;
-          _this.handleAddReferLabel('otherDeatils');
+          // _this.handleAddReferLabel('otherDeatils');
         }
       })
     },
@@ -1056,7 +1057,7 @@ export default {
         console.log(res, '获取采购详细信息详情');
         if (res.code == 200) {
           this.otherDeatils.value = res.data.data;
-          _this.handleAddReferLabel('otherDeatils');
+          // _this.handleAddReferLabel('otherDeatils');
         }
       })
     },
@@ -1068,7 +1069,7 @@ export default {
         console.log(res, '获取成本信息详情');
         if (res.code == 200) {
           this.otherDeatils.value = res.data.data;
-          _this.handleAddReferLabel('otherDeatils');
+          // _this.handleAddReferLabel('otherDeatils');
         }
       })
     },
@@ -1080,7 +1081,7 @@ export default {
         console.log(res, '获取计划信息详情');
         if (res.code == 200) {
           this.otherDeatils.value = res.data.data;
-          _this.handleAddReferLabel('otherDeatils');
+          // _this.handleAddReferLabel('otherDeatils');
         }
       })
     },
@@ -1092,7 +1093,7 @@ export default {
         console.log(res, '获取库存详细信息详情');
         if (res.code == 200) {
           this.otherDeatils.value = res.data.data;
-          _this.handleAddReferLabel('otherDeatils');
+          // _this.handleAddReferLabel('otherDeatils');
         }
       })
     },
@@ -1106,13 +1107,13 @@ export default {
       let _this = this;
       console.log(id);
       materialApi.medcineDetailsInfo(id).then((res) => {
-
+        this.loading = false;
         console.log(res, '医药行业');
         let { code, data } = res;
         if (code == 200) {
           _this.medcineData.value = data.data || {};
           // this.medcineData.form = data.form;
-          _this.handleAddReferLabel('medcineData');
+          // _this.handleAddReferLabel('medcineData');
           console.log(' _this.medcineData', _this.medcineData, res);
         }
       })
@@ -1198,7 +1199,7 @@ export default {
         console.log(res, '根据物料id获取物料类别维护列表');
         if (res.code == 200) {
           _this.materialType.value = res.data.tableBody.rows;
-          _this.handleAddReferLabel('materialType');
+          // _this.handleAddReferLabel('materialType');
         }
       })
     },
@@ -1329,7 +1330,8 @@ export default {
     handleSave() {
       console.log('保存修改');
       this.handleSaveMaterial(() => {
-        this.$router.go(0)
+        this.updateButtonGroup = false;
+        this.handleRefresh();
       });
     },
     // 物料类别列表选中
@@ -1551,33 +1553,42 @@ export default {
         //  基本信息
         this.basicData.value[this.MoreDataDialog.target.prop] = this.MoreDataDialog.value.id;
 
-        this.basicData.value[`${this.MoreDataDialog.target.prop}Label`] = this.MoreDataDialog.value.name;
-        console.log(this.basicData.value[`${this.MoreDataDialog.target.prop}Label`], '//////////基本信息///////////');
+        // this.basicData.value[`${this.MoreDataDialog.target.prop}Label`] = this.MoreDataDialog.value.name;
+        this.basicData.value[`${this.MoreDataDialog.target.prop}Name`] = this.MoreDataDialog.value.name;
+
+        console.log(this.MoreDataDialog.target.prop, 'props-----------------', this.MoreDataDialog.value);
+
+        console.log(this.basicData.value[`${this.MoreDataDialog.target.prop}`], '值', this.basicData.value[`${this.MoreDataDialog.target.prop}Name`], '//////////基本信息///////////');
 
       } else if (this.MoreDataDialog.target.name == 'medcineData') {
-        console.log('this.MoreDataDialog.value', this.MoreDataDialog.value, this.MoreDataDialog.target.prop, this.medcineData);
-        if (this.MoreDataDialog.target.prop === 'dosageFrom')
-          this.medcineData.form = this.medcineData.form.map((item) => {
-            if (item.prop === "dosageFrom") item.dictValue = [{ dictLabel: this.MoreDataDialog.value.name, dictValue: this.MoreDataDialog.value.id }]
-            return item
-          })
+        // console.log('this.MoreDataDialog.value', this.MoreDataDialog.value, this.MoreDataDialog.target.prop, this.medcineData);
+        // if (this.MoreDataDialog.target.prop === 'dosageFrom')
+        //   this.medcineData.form = this.medcineData.form.map((item) => {
+        //     if (item.prop === "dosageFrom") item.dictValue = [{ dictLabel: this.MoreDataDialog.value.name, dictValue: this.MoreDataDialog.value.id }]
+        //     return item
+        //   })
         //  医药信息
         this.medcineData.value[this.MoreDataDialog.target.prop] = this.MoreDataDialog.value.id;
 
-        this.medcineData.value[`${this.MoreDataDialog.target.prop}Label`] = this.MoreDataDialog.value.name;
+        // this.medcineData.value[`${this.MoreDataDialog.target.prop}Label`] = this.MoreDataDialog.value.name;
+        this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`] = this.MoreDataDialog.value.name;
+
+        console.log(this.MoreDataDialog.target.prop, 'props-----------------', this.MoreDataDialog.value);
 
-        console.log(this.medcineData.value[`${this.MoreDataDialog.target.prop}Label`], '//////医药信息//////////');
+        console.log(this.medcineData.value[`${this.MoreDataDialog.target.prop}Name`], '//////医药信息//////////');
 
       } else if (this.MoreDataDialog.target.name == 'otherDeatils') {
 
         //  其他页签
         this.otherDeatils.value[this.MoreDataDialog.target.prop] = this.MoreDataDialog.value.id;
 
-        this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Label`] = this.MoreDataDialog.value.name;
+        // this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Label`] = this.MoreDataDialog.value.name;
+        this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`] = this.MoreDataDialog.value.name;
 
-        console.log(this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Label`], '/////////其他页签///////');
+        console.log(this.otherDeatils.value[`${this.MoreDataDialog.target.prop}Name`], '/////////其他页签///////');
 
       }
+      this.count++;
       this.MoreDataDialog.show = false;
     },
     // 取消-关闭参照弹窗
@@ -1680,6 +1691,7 @@ export default {
         this.medcineData.form = form;
         this.getMedcineDetails(this.materialId, 'material_medcine');
       })
+
     },
   },
   created() {