En route 1 年間 前
コミット
829f2e641c

+ 4 - 1
src/views/Marketing/goods/commodityManageMent/add/makeUpExam/index.vue

@@ -2,7 +2,7 @@
   <div id="makeUpExam">
     <el-form-item label="关联商品" prop="makeGoodsId">
       <div>
-        <el-button @click="goToActiveGoods">选择商品</el-button>
+        <el-button @click="goToActiveGoods">选择商品</el-button><el-button type="danger" @click="clearAllGoods" v-if="listData.makeGoodsVoList && listData.makeGoodsVoList.length > 0">全部清空</el-button>
         <ul>
           <li v-for="(item, index) in listData.makeGoodsVoList" :key="index">
             <span>{{ item.makeGoodsCode }} - {{ item.makeGoodsName }}</span>
@@ -51,6 +51,9 @@ export default {
       let ary = this.listData.makeGoodsVoList.concat(activeArray)
       this.$set(this.listData,'makeGoodsVoList',ary)
     },
+    clearAllGoods() {
+      this.$set(this.listData,'makeGoodsVoList',[])
+    },
     clearGoods(index) {
       this.listData.makeGoodsVoList.splice(index,1)
     },

+ 5 - 2
src/views/Marketing/goods/commodityManageMent/edit/index.vue

@@ -947,12 +947,15 @@ export default {
       }
 
       if (
-        (data.goodsType == 3 || data.goodsType == 4) &&
-        data.makeGoodsVoList?.length > 0
+        data.goodsType == 3 || data.goodsType == 4
       ) {
+        if(data.makeGoodsVoList?.length > 0){
         data.makeGoodsIds = data.makeGoodsVoList
           .map((i) => i.makeGoodsId)
           .toString() || "";
+        }else{
+          data.makeGoodsIds = null
+        }
       }
       //商品标准价格明细表
       data.standPriceJson = JSON.stringify(data.standPriceJson);

+ 4 - 1
src/views/Marketing/goods/commodityManageMent/edit/makeUpExam/index.vue

@@ -2,7 +2,7 @@
   <div id="makeUpExam">
     <el-form-item label="关联商品" prop="makeGoodsId">
       <div>
-        <el-button @click="goToActiveGoods">选择商品</el-button>
+        <el-button @click="goToActiveGoods">选择商品</el-button><el-button type="danger" @click="clearAllGoods" v-if="listData.makeGoodsVoList && listData.makeGoodsVoList.length > 0">全部清空</el-button>
         <ul>
           <li v-for="(item, index) in listData.makeGoodsVoList" :key="index">
             <span>{{ item.makeGoodsCode }} - {{ item.makeGoodsName }}</span>
@@ -51,6 +51,9 @@ export default {
       let ary = this.listData.makeGoodsVoList.concat(activeArray)
       this.$set(this.listData,'makeGoodsVoList',ary)
     },
+    clearAllGoods() {
+      this.$set(this.listData,'makeGoodsVoList',[])
+    },
     clearGoods(index) {
       this.listData.makeGoodsVoList.splice(index,1)
     },