Browse Source

商品管理商品分类必填

lhch2015 1 month ago
parent
commit
df886ee388
1 changed files with 9 additions and 3 deletions
  1. 9 3
      admin-ui/src/views/goods/commonGoods/index.vue

+ 9 - 3
admin-ui/src/views/goods/commonGoods/index.vue

@@ -443,7 +443,12 @@ export default {
             message: '现金金额不能为空',
             trigger: 'blur'
           }
-        ]
+        ],
+        goodsCategoryId: [{
+          required: true,
+          message: '请选择商品分类',
+          trigger: 'blur'
+        }]
       },
       categoryList: [],
       brandList: [],
@@ -557,8 +562,8 @@ export default {
       const id = row.id || this.ids
       getGoods(id).then((response) => {
         this.form = response.data
-        this.form.brandId = Number(this.form.brandId)
-        this.form.goodsCategoryId = Number(this.form.goodsCategoryId)
+        this.form.brandId = this.form.brandId ? Number(this.form.brandId) : ''
+        this.form.goodsCategoryId = this.form.goodsCategoryId ? Number(this.form.goodsCategoryId) : ''
         if (this.form.goodsImgs != null && this.form.goodsImgs != '') {
           this.form.goodsImgs.split(',').forEach((item) => {
             const vo = {
@@ -568,6 +573,7 @@ export default {
             this.imgsList.push(vo)
           })
         }
+        this.form = JSON.parse(JSON.stringify(this.form))
         this.open = true
         this.title = '修改商品管理'
       })