Browse Source

修改bug

chenrui 2 years ago
parent
commit
1a5d7080ef
1 changed files with 14 additions and 11 deletions
  1. 14 11
      src/views/productManagement/productInfo/offlineImportModal.vue

+ 14 - 11
src/views/productManagement/productInfo/offlineImportModal.vue

@@ -11,7 +11,7 @@
     <div class="chooseImport-con">
       <!-- 可导入数据 -->
       <p style="font-weight:bold;">可导入数据{{ loadData.length }}条,确认要批量下线吗?</p>
-      <a-form-model :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
+      <a-form-model :model="form" ref="ruleForm" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
         <a-form-model-item label="下线选项" prop="offlineReasonType">
           <v-select
             code="OFFLINE_REASON_TYPE"
@@ -145,12 +145,7 @@ export default {
   },
   methods: {
     productCodeChange (val, row) {
-      row.commonSn = []
-      if (val.length > 0) {
-        val.map(item => {
-          row.commonSn.push(item.key)
-        })
-      }
+      row.commonSn = val.key
     },
     getData () {
       const _this = this
@@ -182,10 +177,17 @@ export default {
       if (this.loadData.length == 0) {
         this.$message.warning('无可导入产品!')
       } else {
-        this.form.type = 'offline'
-        this.form.offlineProductList = this.loadData
-        this.$emit('ok', this.form)
-        this.isShow = false
+        const _this = this
+        this.$refs.ruleForm.validate(valid => {
+          if (valid) {
+            _this.form.type = 'offline'
+            _this.form.offlineProductList = _this.loadData
+            _this.$emit('ok', _this.form)
+            _this.isShow = false
+          } else {
+            return false
+          }
+        })
       }
     },
     // 导出
@@ -216,6 +218,7 @@ export default {
           offlineReasonType: '',
           offlineRemark: ''
         }
+        this.$refs.ruleForm.resetFields()
       } else {
         this.getData()
       }