Kaynağa Gözat

委托登记

yuhan 2 yıl önce
ebeveyn
işleme
09bbd83e7a

+ 1 - 1
itdmWeb/src/views/module-iTDM/weituo/modules/step/Step1.vue

@@ -8,7 +8,7 @@
           <a-auto-complete
             :disabled="formDisabled"
             v-model="model.weituoClient"
-            placeholder="input here"
+            placeholder="请输入委托单位名称"
             @change="handleSelect"
             @search="querySearch"
           >

+ 41 - 16
itdmWeb/src/views/module-iTDM/weituo/modules/step/Step2.vue

@@ -2,10 +2,11 @@
   <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
     <a-table
       :columns="columns"
-      :dataSource="data"
+      :dataSource="model.data"
       :pagination="false"
+      :rowKey="(record, index) => { return index }"
     >
-      <template
+      <!-- <template
         v-for="(col, i) in ['sampleName', 'sampleModelSpecification', 'sampleQuantities','sampleManufacturer']"
         :slot="col" slot-scope="text, record">
         <a-input
@@ -16,7 +17,28 @@
           :placeholder="columns[i].title"
           @change="e => handleChange(e.target.value, record.key, col)"
         />
+      </template> -->
+      <template slot="sampleName" slot-scope="text, record,index">
+        <a-form-model-item :prop="'data.'+index+'.sampleName'" :rules="validatorRules.sampleName">
+          <a-input v-model="record.sampleName"></a-input>
+        </a-form-model-item>
       </template>
+      <template slot="sampleModelSpecification" slot-scope="text, record,index">
+        <a-form-model-item :prop="'data.'+index+'.sampleModelSpecification'" :rules="validatorRules.sampleModelSpecification">
+          <a-input v-model="record.sampleModelSpecification"></a-input>
+        </a-form-model-item>
+      </template>
+      <template slot="sampleQuantities" slot-scope="text, record,index">
+        <a-form-model-item :prop="'data.'+index+'.sampleQuantities'" :rules="validatorRules.sampleQuantities">
+          <a-input v-model="record.sampleQuantities"></a-input>
+        </a-form-model-item>
+      </template>
+      <template slot="sampleManufacturer" slot-scope="text, record,index">
+        <a-form-model-item :prop="'data.'+index+'.sampleManufacturer'" :rules="validatorRules.sampleManufacturer">
+          <a-input v-model="record.sampleManufacturer"></a-input>
+        </a-form-model-item>
+      </template>
+
 
       <template slot="operation" slot-scope="text, record">
           <span>
@@ -73,7 +95,9 @@ export default {
           { required: true, message: '请输入生产厂家!' }
         ]
       },
-      model: {},
+      model: {
+        data: [{}]
+      },
       description: '高级表单常见于一次性输入和提交大批量数据的场景。',
       loading: false,
 
@@ -114,7 +138,9 @@ export default {
           scopedSlots: { customRender: 'operation' }
         }
       ],
-      data: []
+      data: [
+        {}
+      ]
     }
   },
   computed: {
@@ -136,16 +162,14 @@ export default {
             isNew: true
           })
         }
-
-
     }
     this.count = sessionStorage.getItem('count') != null ? Number(sessionStorage.getItem('count')) : 1
 
   },
   methods: {
-
+    // 新增样品
     newMember() {
-      this.data.push({
+      this.model.data.push({
         key: this.count + '',
         sampleQuantities: 0,
         sampleModelSpecification: '',
@@ -177,15 +201,16 @@ export default {
         this.data = newData
       }
     },
+    // 下一步
     nextStep() {
-      sessionStorage.setItem('yangpin', JSON.stringify(this.data))
-
-
-      // this.$refs.form.validate(valid => {
-      //   if (valid) {
-      this.$emit('nextStep')
-      //   }
-      // })
+      
+      
+      this.$refs.form.validate(valid => {
+        if (valid) {
+          this.$emit('nextStep')
+          // sessionStorage.setItem('yangpin', JSON.stringify(this.data))
+        }
+      })
 
     },
     prevStep() {