浏览代码

解决依据不回显等问题

yuhan 1 年之前
父节点
当前提交
840baf1fd3

+ 34 - 6
itdmWeb/src/views/module-iTDM/weituo/modules/ItdmWeituoInfoModal.vue

@@ -52,8 +52,8 @@ import { postAction  } from '@api/manage'
         sessionStorage.removeItem("count1")
 
         this.$store.commit('SET_BASEINFO', {});
-            this.$store.commit('SET_YANGPININFO', []);
-            this.$store.commit('SET_SHIYANINFO', []);
+        this.$store.commit('SET_YANGPININFO', []);
+        this.$store.commit('SET_SHIYANINFO', []);
 
 
         this.visible=true
@@ -68,8 +68,8 @@ import { postAction  } from '@api/manage'
         sessionStorage.removeItem("count")
         sessionStorage.removeItem("count1")
         this.$store.commit('SET_BASEINFO', {});
-            this.$store.commit('SET_YANGPININFO', []);
-            this.$store.commit('SET_SHIYANINFO', []);
+        this.$store.commit('SET_YANGPININFO', []);
+        this.$store.commit('SET_SHIYANINFO', []);
         this.visible=true
         this.$nextTick(()=>{
           this.$refs.realForm.edit(record);
@@ -93,18 +93,45 @@ import { postAction  } from '@api/manage'
         // console.log(this.$refs.realForm.model.id)
         var weituoId = this.$refs.realForm.model.id
 
-        // this.weituomodel.yangpins = this.shiyanInfos
+        // weituoInfo.baseInfos = this.baseInfos
+        // weituoInfo.yangpins = this.yangpinInfos
+        
+        // var pinShiYans = this.shiyanInfos
+        // if(this.shiyanInfos.length > 0){
+        //   weituoInfo.pinShiYans = pinShiYans.map(item => {
+        //     item.standardRequirement = item.standardRequirementQ.toString()
+        //     return item
+        //   })
+        // }
 
         switch (this.$refs.realForm.currentTab) {
           case 0:
             // console.log(this.$refs.realForm.$refs.data001.model)
             weituoInfo = this.$refs.realForm.$refs.data001.model
+            weituoInfo.yangpins = this.yangpinInfos
+        
+            if(this.shiyanInfos.length > 0){
+              weituoInfo.pinShiYans = this.shiyanInfos.map(item => {
+                item.standardRequirement = item.standardRequirement.toString()
+                return item
+              })
+            } else {
+              weituoInfo.pinShiYans = this.shiyanInfos
+            }
             break;
           case 1:
             // console.log(this.$refs.realForm.$refs.ypxx.model)
             // weituoInfo = JSON.parse(sessionStorage.getItem('data'))
             weituoInfo = this.baseInfos
             weituoInfo.yangpins = this.$refs.realForm.$refs.ypxx.model.data
+            if(this.shiyanInfos.length > 0){
+              weituoInfo.pinShiYans = this.shiyanInfos.map(item => {
+                item.standardRequirement = item.standardRequirement.toString()
+                return item
+              })
+            } else {
+              weituoInfo.pinShiYans = this.shiyanInfos
+            }
             break;
           case 2:
             // console.log(this.$refs.realForm.$refs.syxx.model)
@@ -114,7 +141,8 @@ import { postAction  } from '@api/manage'
             weituoInfo.yangpins = this.yangpinInfos
             var pinShiYans = this.$refs.realForm.$refs.syxx.model.list
             weituoInfo.pinShiYans = pinShiYans.map(item => {
-              item.standardRequirement = item.standardRequirementQ.toString()
+              item.standardRequirement = item.standardRequirementQ.join(',')
+              // item.standardRequirement = JSON.stringify(item.standardRequirementQ)
               return item
             })
             break;

+ 25 - 28
itdmWeb/src/views/module-iTDM/weituo/modules/step/Step3.vue

@@ -13,7 +13,7 @@
 
       <template slot="yangpinKeyId" slot-scope="text, record,index">
         <a-form-model-item :prop="'list.'+index+'.yangpinKeyId'" :rules="validatorRules.yangpinKeyId">
-          <a-select :disabled="formDisabled" v-model="record.yangpinKeyId" allowClear :dropdownMatchSelectWidth="false" option-label-prop="label" @change="handleChange2">
+          <a-select :disabled="formDisabled" v-model="record.yangpinKeyId" allowClear :dropdownMatchSelectWidth="false" option-label-prop="label" @change="handleChange">
             <!-- 针对样品名称有相同的情况,做以下更改 -->
             <!-- <a-select-option v-for="d in yangpins" :key="d.sampleName"> -->
             <a-select-option v-for="d in yangpins" :key="d.key" :label="d.sampleName" :channel="d">
@@ -40,8 +40,8 @@
       </template>
 
 
-      <template slot="standardRequirement" slot-scope="text, record,index">
-        <a-form-model-item :prop="'list.'+index+'.standardRequirement'" :rules="validatorRules.standardRequirement">
+      <template slot="standardRequirementQ" slot-scope="text, record,index">
+        <a-form-model-item :prop="'list.'+index+'.standardRequirementQ'" :rules="validatorRules.standardRequirementQ">
           <!-- <j-multi-select-tag :disabled="formDisabled" v-model="record.standardRequirement" :dropdownMatchSelectWidth="false" dictCode="itdm_weituo_yiju,name,name" /> -->
           <!-- 为了解决下拉框显示不全的问题,原来的没有对应参数配置 -->
           <a-select
@@ -53,8 +53,8 @@
             @change="handleDescCate"
             mode="multiple"
           >
-            <a-select-option v-for="(item) in yijuLists" :key="item.name">
-              {{ item.name }}
+            <a-select-option v-for="yj in yijuLists" :key="yj.name" :label="yj.name">
+              {{ yj.name }}
             </a-select-option>
           </a-select>
         </a-form-model-item>
@@ -175,11 +175,11 @@ export default {
         },
         {
           title: '检测依据',
-          dataIndex: 'standardRequirement',
-          key: 'standardRequirement',
+          dataIndex: 'standardRequirementQ',
+          key: 'standardRequirementQ',
           align: 'center',
           width: '15%',
-          scopedSlots: { customRender: 'standardRequirement' }
+          scopedSlots: { customRender: 'standardRequirementQ' }
         },
         {
           title: '判定依据',
@@ -285,19 +285,27 @@ export default {
     },
 
     // 获得选中项信息
-    handleChange2(value,optipn) {
+    handleChange(value,optipn) {
       console.log(777,value,optipn);
       if(value){
         const a = optipn.data.attrs.channel
         // console.log(a)
+        // 解决下拉选择后多个输入框显示-用$set,估计设置中间变量也能解决
         this.$set(this.model.list[this.clickIndex], 'sampleModelSpecification', a.sampleModelSpecification )
         this.$set(this.model.list[this.clickIndex], 'yangpinKeyId', a.sampleName )
       }
     },
 
     // 多选依据
-    handleDescCate(item) {
-      console.log(item)
+    handleDescCate(value,optipn) {
+      // console.log(value, optipn)
+      // 这里用$set不好使
+      // this.$set(this.model.list[this.clickIndex], 'standardRequirementQ', value)
+      // 解决多选数据选择不回显--设置中间变量
+      const newData = [...this.model.list];
+      const target = newData[this.clickIndex];
+      target.standardRequirementQ = value;
+      this.model.list = newData;
     },
 
     newMember() {
@@ -322,32 +330,21 @@ export default {
       const newData = this.model.list.filter(item => item.key !== key)
       this.model.list = newData
     },
-    saveRow(key) {
-      let target = this.model.list.filter(item => item.key === key)[0]
-      target.editable = false
-      target.isNew = false
-
-    },
+    // saveRow(key) {
+    //   let target = this.model.list.filter(item => item.key === key)[0]
+    //   target.editable = false
+    //   target.isNew = false
+    // },
 
-    handleChange(value, key, column) {
-      const newData = [...this.model.list]
-      const target = newData.filter(item => key === item.key)[0]
-      if (target) {
-        target[column] = value
-        this.model.list = newData
-      }
-    },
     submitForm() {
       // sessionStorage.setItem('yangpinkz', JSON.stringify(this.model.list))
       this.$store.commit('SET_SHIYANINFO', this.model.list);
       
       this.$refs.form.validate(valid => {
-        if (valid) {
-          
+        if (valid) {  
           this.$emit('submitForm')
         }
       })
-      
     },
     prevStep() {
       // sessionStorage.setItem('yangpinkz', JSON.stringify(this.model.list))