Browse Source

bug 修复

lilei 2 years ago
parent
commit
0b53cef678

+ 23 - 22
src/views/allocationManagement/transferOut/basicInfoModal.vue

@@ -66,7 +66,6 @@
                 v-model="form.time"
                 v-model="form.time"
                 :format="dateFormat"
                 :format="dateFormat"
                 @change="dateChange"
                 @change="dateChange"
-                @calendarChange="dateCalendarChange"
                 :placeholder="['开始时间', '结束时间']" />
                 :placeholder="['开始时间', '结束时间']" />
             </a-form-model-item>
             </a-form-model-item>
           </a-col>
           </a-col>
@@ -144,7 +143,6 @@ export default {
       targetTypeList: [], //  调往对象类型
       targetTypeList: [], //  调往对象类型
       allocateTypeVal: [],
       allocateTypeVal: [],
       dateFormat: 'YYYY-MM-DD',
       dateFormat: 'YYYY-MM-DD',
-      selectPriceDate: '',
       isEdit: false
       isEdit: false
     }
     }
   },
   },
@@ -157,41 +155,38 @@ export default {
   methods: {
   methods: {
     // 日期  change
     // 日期  change
     dateChange (date, dateStrings) {
     dateChange (date, dateStrings) {
-      this.selectPriceDate = ''
+      console.log(date, dateStrings)
       this.form.time = dateStrings
       this.form.time = dateStrings
-      this.form.promoStartDate = dateStrings[0] || ''
-      this.form.promoEndDate = dateStrings[1] || ''
-    },
-    dateCalendarChange (date, dateStrings) {
-      this.selectPriceDate = date[0]
+      this.form.promoStartDate = date.length ? dateStrings[0] : ''
+      this.form.promoEndDate = date.length ? dateStrings[1] : ''
     },
     },
     // 调拨类别 change
     // 调拨类别 change
     allocateTypeChange (val, opt) {
     allocateTypeChange (val, opt) {
       console.log(val, opt, '------------')
       console.log(val, opt, '------------')
-      this.allocateTypeVal = val
-      this.form.costTypeSn = val[0] ? val[0] : ''
-      this.form.allocateSortSn = val[1] ? val[1] : ''
-      this.form.allocateTypeSn = val[2] ? val[2] : ''
+      this.allocateTypeVal = val || ''
+      this.form.costTypeSn = val && val[0] ? val[0] : ''
+      this.form.allocateSortSn = val && val[1] ? val[1] : ''
+      this.form.allocateTypeSn = val && val[2] ? val[2] : ''
       // 名称
       // 名称
-      this.form.costTypeName = opt[0] ? opt[0].name : ''
-      this.form.allocateSortName = opt[1] ? opt[1].name : ''
-      this.form.allocateTypeName = opt[2] ? opt[2].name : ''
+      this.form.costTypeName = opt && opt[0] ? opt[0].name : ''
+      this.form.allocateSortName = opt && opt[1] ? opt[1].name : ''
+      this.form.allocateTypeName = opt && opt[2] ? opt[2].name : ''
     },
     },
     //  产品分类  change
     //  产品分类  change
     changeProductType (val, id, opt) {
     changeProductType (val, id, opt) {
       console.log(val, opt, '------------')
       console.log(val, opt, '------------')
-      this.form.productTypeSn1 = val[0] ? val[0] : ''
-      this.form.productTypeSn2 = val[1] ? val[1] : ''
-      this.form.productTypeSn3 = val[2] ? val[2] : ''
+      this.form.productTypeSn1 = val && val[0] ? val[0] : ''
+      this.form.productTypeSn2 = val && val[1] ? val[1] : ''
+      this.form.productTypeSn3 = val && val[2] ? val[2] : ''
       // 名称
       // 名称
-      this.form.productTypeName1 = opt[0] ? opt[0].productTypeName : ''
-      this.form.productTypeName2 = opt[1] ? opt[1].productTypeName : ''
-      this.form.productTypeName3 = opt[2] ? opt[2].productTypeName : ''
+      this.form.productTypeName1 = opt && opt[0] ? opt[0].productTypeName : ''
+      this.form.productTypeName2 = opt && opt[1] ? opt[1].productTypeName : ''
+      this.form.productTypeName3 = opt && opt[2] ? opt[2].productTypeName : ''
     },
     },
     // 品牌
     // 品牌
     changeBrand (val, id, opt) {
     changeBrand (val, id, opt) {
       console.log(val, opt, '------------')
       console.log(val, opt, '------------')
-      this.form.productBrandName = opt.brandName
+      this.form.productBrandName = opt ? opt.brandName : ''
     },
     },
     // 搜索经销商
     // 搜索经销商
     fetchUser (value) {
     fetchUser (value) {
@@ -218,6 +213,9 @@ export default {
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
           const form = JSON.parse(JSON.stringify(_this.form))
+          if (!form.productBrandName) {
+            form.productBrandSn = ''
+          }
           _this.spinning = true
           _this.spinning = true
           allocateBillSave(form).then(res => {
           allocateBillSave(form).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
@@ -298,6 +296,9 @@ export default {
           if (this.form.promoStartDate && this.form.promoEndDate) {
           if (this.form.promoStartDate && this.form.promoEndDate) {
             this.form.time = [this.form.promoStartDate, this.form.promoEndDate]
             this.form.time = [this.form.promoStartDate, this.form.promoEndDate]
           }
           }
+          if (!this.form.productBrandSn) {
+            this.form.productBrandSn = undefined
+          }
         }
         }
       }
       }
     }
     }

+ 1 - 1
src/views/allocationManagement/transferOut/edit.vue

@@ -81,7 +81,7 @@
                 <span v-else>--</span>
                 <span v-else>--</span>
               </a-descriptions-item>
               </a-descriptions-item>
               <a-descriptions-item label="备注">
               <a-descriptions-item label="备注">
-                {{ (basicInfoData&&basicInfoData.remark) }}
+                {{ (basicInfoData&&basicInfoData.remark||'--') }}
               </a-descriptions-item>
               </a-descriptions-item>
             </a-descriptions>
             </a-descriptions>
           </a-collapse-panel>
           </a-collapse-panel>

+ 1 - 1
src/views/common/productBrand.js

@@ -67,8 +67,8 @@ const ProductBrand = {
     handleChange(value) {
     handleChange(value) {
       this.defaultVal = value;
       this.defaultVal = value;
       const row = this.productBrandList.find(item => item.brandSn == value)
       const row = this.productBrandList.find(item => item.brandSn == value)
-      this.$emit('change', value, this.id, row);
       this.$emit('input', value);
       this.$emit('input', value);
+      this.$emit('change', value, this.id, row);
     },
     },
     //  产品品牌列表, sysFlag: 1 箭冠 0 自建
     //  产品品牌列表, sysFlag: 1 箭冠 0 自建
     getProductBrand () {
     getProductBrand () {