En route 1 rok pred
rodič
commit
b302e93f60

+ 15 - 17
src/views/Marketing/goods/commodityManageMent/add/index.vue

@@ -46,7 +46,7 @@
                 : ""
             }}
           </h5>
-          <make-up-exam ref="makeUpExam" :listData="listData" />
+          <make-up-exam ref="makeUpExam" :listData.sync="listData" />
         </div>
         <div v-if="listData.goodsType === 8 && listData.businessId">
           <h5 class="segmentationStyle">关联讲义资料</h5>
@@ -212,12 +212,12 @@ export default {
         coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697",
         goodsType: "",
         status: 1,
-        moreCertificateStatus:1,
+        moreCertificateStatus: 1,
         certificateTypeId: "",
         showStatus: 1,
         externalLinkStatus: 0,
-        mailSign:0,
-        firstChoiceStatus:0,
+        mailSign: 0,
+        firstChoiceStatus: 0,
         commitPeriodStatus: 0,
         sevenYear: "",
       },
@@ -415,13 +415,6 @@ export default {
             trigger: "change",
           },
         ],
-        makeGoodsId: [
-          {
-            required: true,
-            message: "请选择关联商品",
-            trigger: "blur",
-          },
-        ],
         // handoutsId: [
         //   {
         //     required: true,
@@ -553,9 +546,6 @@ export default {
         this.$refs["listData"].clearValidate();
       });
     });
-    this.$bus.$on("validateMakeId", () => {
-      this.$refs["listData"].validateField("makeGoodsId");
-    });
     this.$bus.$on("validateHandoutsId", () => {
       this.$refs["listData"].validateField("handoutsId");
     });
@@ -738,10 +728,18 @@ export default {
       //商品是否上架
       data.goodsStatus = int;
       data.subjectIds = data.subjectIds.toString();
+      if (
+        (data.goodsType == 3 || data.goodsType == 4) &&
+        data.makeGoodsVoList?.length > 0
+      ) {
+        data.makeGoodsIds = data.makeGoodsVoList
+          .map((i) => i.makeGoodsId)
+          .toString() || "";
+      }
       if (data.goodsType == 9) {
         data.examLimitClient = data.examLimitClient.toString();
       }
-        data.questionRelIds = data.questionRelIds.toString() || "";
+      data.questionRelIds = data.questionRelIds.toString() || "";
       data.projectId = await this.getProjectId(data.businessId);
       //--------------------------通用处理END------------------------------
       if (this.listData.goodsType === 1 || this.listData.goodsType === 6) {
@@ -872,7 +870,8 @@ export default {
         //课程排序问题检查
         for (let i = 0; i < this.$refs.courseContent.tableData.length; i++) {
           if (
-            this.$refs.courseContent.tableData[i].viewSign != this.listData.viewSign
+            this.$refs.courseContent.tableData[i].viewSign !=
+            this.listData.viewSign
           ) {
             this.$message.warning(`课程列表数据请与商品视频类型保持一致`);
             this.disabledBtn = false;
@@ -1004,7 +1003,6 @@ export default {
    */
   beforeDestroy() {
     this.$bus.$off("clearValidateFuncAdd");
-    this.$bus.$off("validateMakeId");
     this.$bus.$off("validateHandoutsId");
     this.$bus.$off("validateCoverUrl");
     this.$bus.$off("initTimeVal");

+ 19 - 27
src/views/Marketing/goods/commodityManageMent/add/makeUpExam/index.vue

@@ -3,16 +3,17 @@
     <el-form-item label="关联商品" prop="makeGoodsId">
       <div>
         <el-button @click="goToActiveGoods">选择商品</el-button>
-        <span v-if="listData.makeGoodsId" style="margin-left: 12px"
-          >{{ listData.makeGoodsCode }} - {{ listData.makeGoodsName }}</span
-        >
-        <el-button
-          style="margin-left: 12px"
-          v-if="listData.makeGoodsId"
-          type="text"
-          @click="clearGoods"
-          >删除</el-button
-        >
+        <ul>
+          <li v-for="(item, index) in listData.makeGoodsVoList" :key="index">
+            <span>{{ item.makeGoodsCode }} - {{ item.makeGoodsName }}</span>
+            <el-button
+              style="margin-left: 12px"
+              type="text"
+              @click="clearGoods(index)"
+              >删除</el-button
+            >
+          </li>
+        </ul>
       </div>
     </el-form-item>
     <make-check ref="makeCheck" @backData="backMakeData" />
@@ -43,27 +44,18 @@ export default {
             : "",
       };
       //打开选择补考/前培组件
-      this.$refs.makeCheck.openBox(data, {
-        makeGoodsId: this.listData.makeGoodsId,
-        makeGoodsName: this.listData.makeGoodsName,
-        makeGoodsCode: this.listData.makeGoodsCode,
-      });
+      let ary = this.listData.makeGoodsVoList.map((i) => i.makeGoodsId) || [];
+      this.$refs.makeCheck.openBox(data, ary);
     },
-    backMakeData(activeObj) {
-      this.$set(this.listData, "makeGoodsId", activeObj.makeGoodsId);
-      this.$set(this.listData, "makeGoodsName", activeObj.makeGoodsName);
-      this.$set(this.listData, "makeGoodsCode", activeObj.makeGoodsCode);
-      this.$bus.$emit("validateMakeId");
+    backMakeData(activeArray) {
+      let ary = this.listData.makeGoodsVoList.concat(activeArray)
+      this.$set(this.listData,'makeGoodsVoList',ary)
     },
-    clearGoods() {
-      this.$set(this.listData, "makeGoodsId", "");
-      this.$set(this.listData, "makeGoodsName", "");
-      this.$set(this.listData, "makeGoodsCode", "");
-      this.$bus.$emit("validateMakeId");
+    clearGoods(index) {
+      this.listData.makeGoodsVoList.splice(index,1)
     },
   },
 };
 </script>
 
-<style lang="less" scoped>
-</style>
+<style lang="less" scoped></style>

+ 32 - 33
src/views/Marketing/goods/commodityManageMent/add/makeUpExam/makeCheck.vue

@@ -32,6 +32,7 @@
       <el-table
         ref="multipleTable"
         :data="tableData"
+        row-key="goodsId"
         border
         :header-cell-style="{
           'background-color': '#eee',
@@ -39,16 +40,12 @@
           color: '#333',
         }"
       >
-        <el-table-column label="" width="45" align="center">
-          <template scope="scope">
-            <el-radio
-              :disabled="scope.row.selectStatus === 0"
-              :label="scope.row.goodsId"
-              v-model="activeObj.makeGoodsId"
-              @change.native="getGoodsId(scope.row)"
-              >{{ "" }}</el-radio
-            >
-          </template>
+        <el-table-column
+          type="selection"
+          width="55"
+          :reserve-selection="true"
+          :selectable="selectableFunc"
+        >
         </el-table-column>
         <el-table-column
           v-for="(item, index) in tableSet"
@@ -83,10 +80,7 @@
       />
       <span slot="footer" class="dialog-footer">
         <el-button @click="dialogVisibleTableBoxs = false">取 消</el-button>
-        <el-button
-          type="primary"
-          :disabled="!activeObj.makeGoodsId"
-          @click="submitTab"
+        <el-button type="primary" @click="submitTab" :loading="loading"
           >确 定</el-button
         >
       </span>
@@ -100,6 +94,7 @@ export default {
   components: { pagination },
   data() {
     return {
+      loading: false,
       size: "small",
       dialogVisibleTableBoxs: false,
       tableData: [],
@@ -141,33 +136,27 @@ export default {
       ],
       formData: {},
       total: 0,
-      activeObj: {
-        makeGoodsId: "",
-        makeGoodsName: "",
-        makeGoodsCode: "",
-      },
+      activeArray: [],
     };
   },
   methods: {
-    /**
-     * 选中补考/前培商品
-     */
-    getGoodsId(row) {
-      this.activeObj = {
-        makeGoodsId: row.goodsId,
-        makeGoodsName: row.goodsName,
-        makeGoodsCode: row.code,
-      };
+    /**是否允许选中 */
+    selectableFunc(row) {
+      return !this.activeArray.includes(row.goodsId);
     },
     /**
      * 初始
      */
     openBox(obj, active) {
-      this.activeObj = JSON.parse(JSON.stringify(active));
+      this.activeArray = JSON.parse(JSON.stringify(active)) || [];
       this.formData = JSON.parse(JSON.stringify(obj));
       //获取业务层次-课程
       this.getInfos();
       this.dialogVisibleTableBoxs = true;
+      this.loading = false;
+      this.$nextTick(() => {
+        this.$refs.multipleTable.clearSelection();
+      });
     },
     /**
      * 搜索数据
@@ -191,9 +180,20 @@ export default {
      * 提交回调数据
      */
     submitTab() {
-      this.$message.success("添加成功");
+      this.loading = true;
+      let ary = [];
+      if (this.$refs.multipleTable.selection.length > 0) {
+        ary = this.$refs.multipleTable.selection.map((i) => {
+          return {
+            makeGoodsCode: i.code,
+            makeGoodsId: i.goodsId,
+            makeGoodsName: i.goodsName,
+          };
+        });
+        this.$message.success("添加成功");
+        this.$emit("backData", ary);
+      }
       this.dialogVisibleTableBoxs = false;
-      this.$emit("backData", this.activeObj);
     },
     handleSizeChange(v) {
       this.formData.pageSize = v;
@@ -208,5 +208,4 @@ export default {
 };
 </script>
 
-<style lang="less" scoped>
-</style>
+<style lang="less" scoped></style>

+ 1 - 3
src/views/Marketing/goods/commodityManageMent/add/productInformation.vue

@@ -434,9 +434,7 @@ export default {
       this.$set(this.listData, "serviceTimeType", ""); //学习服务期类型
       this.$set(this.listData, "serviceTimeNum", ""); //学习服务期年月日
       this.$set(this.listData, "studyTimeArrays", []); //学习服务期具体时间
-      this.$set(this.listData, "makeGoodsId", ""); //补考/前培参数
-      this.$set(this.listData, "makeGoodsName", ""); //补考/前培参数
-      this.$set(this.listData, "makeGoodsCode", ""); //补考/前培参数
+      this.$set(this.listData, "makeGoodsVoList", []); //补考/前培参数
       this.$set(this.listData, "certificateTypeId", ""); //证书类型
       this.$set(this.listData, "certificateId", ""); //证书名称
       this.$set(this.listData, "certificateTpId", ""); //证书模板

+ 8 - 20
src/views/Marketing/goods/commodityManageMent/edit/index.vue

@@ -442,13 +442,6 @@ export default {
             trigger: "change",
           },
         ],
-        makeGoodsId: [
-          {
-            required: true,
-            message: "请选择关联商品",
-            trigger: "blur",
-          },
-        ],
         // handoutsId: [
         //   {
         //     required: true,
@@ -591,13 +584,6 @@ export default {
         this.$refs.listData.clearValidate();
       });
     });
-    this.$bus.$on("validateMakeId", () => {
-      this.$nextTick(() => {
-        if (this.$refs["listData"]) {
-          this.$refs["listData"].validateField("makeGoodsId");
-        }
-      });
-    });
     this.$bus.$on("validateHandoutsId", () => {
       this.$nextTick(() => {
         if (this.$refs["listData"]) {
@@ -847,10 +833,6 @@ export default {
             return ast;
           });
         }
-        //拷贝补考/前培ID 解决无法选中当前ID问题
-        if (res.data.goodsType == 3 || res.data.goodsType == 4) {
-          res.data.copyMakeGoodsId = res.data.makeGoodsId;
-        }
         //学习服务期转换
         if (
           (res.data.goodsType === 1 ||
@@ -964,6 +946,14 @@ export default {
         );
       }
 
+      if (
+        (data.goodsType == 3 || data.goodsType == 4) &&
+        data.makeGoodsVoList?.length > 0
+      ) {
+        data.makeGoodsIds = data.makeGoodsVoList
+          .map((i) => i.makeGoodsId)
+          .toString() || "";
+      }
       //商品标准价格明细表
       data.standPriceJson = JSON.stringify(data.standPriceJson);
       //商品是否上架
@@ -1245,9 +1235,7 @@ export default {
    * 销毁公交
    */
   beforeDestroy() {
-    console.log(2);
     this.$bus.$off("clearValidateFuncAdd");
-    this.$bus.$off("validateMakeId");
     this.$bus.$off("validateHandoutsId");
     this.$bus.$off("validateCoverUrl");
     this.$bus.$off("initTimeVal");

+ 18 - 29
src/views/Marketing/goods/commodityManageMent/edit/makeUpExam/index.vue

@@ -3,16 +3,17 @@
     <el-form-item label="关联商品" prop="makeGoodsId">
       <div>
         <el-button @click="goToActiveGoods">选择商品</el-button>
-        <span v-if="listData.makeGoodsId" style="margin-left: 12px"
-          >{{ listData.makeGoodsCode }} - {{ listData.makeGoodsName }}</span
-        >
-        <el-button
-          style="margin-left: 12px"
-          v-if="listData.makeGoodsId"
-          type="text"
-          @click="clearGoods"
-          >删除</el-button
-        >
+        <ul>
+          <li v-for="(item, index) in listData.makeGoodsVoList" :key="index">
+            <span>{{ item.makeGoodsCode }} - {{ item.makeGoodsName }}</span>
+            <el-button
+              style="margin-left: 12px"
+              type="text"
+              @click="clearGoods(index)"
+              >删除</el-button
+            >
+          </li>
+        </ul>
       </div>
     </el-form-item>
     <make-check ref="makeCheck" @backData="backMakeData" />
@@ -43,27 +44,15 @@ export default {
             : "",
       };
       //打开选择补考/前培组件
-      this.$refs.makeCheck.openBox(
-        data,
-        {
-          makeGoodsId: this.listData.makeGoodsId,
-          makeGoodsName: this.listData.makeGoodsName,
-          makeGoodsCode: this.listData.makeGoodsCode,
-        },
-        this.listData.copyMakeGoodsId
-      );
+      let ary = this.listData.makeGoodsVoList.map((i) => i.makeGoodsId) || [];
+      this.$refs.makeCheck.openBox(data, ary);
     },
-    backMakeData(activeObj) {
-      this.$set(this.listData, "makeGoodsId", activeObj.makeGoodsId);
-      this.$set(this.listData, "makeGoodsName", activeObj.makeGoodsName);
-      this.$set(this.listData, "makeGoodsCode", activeObj.makeGoodsCode);
-      this.$bus.$emit("validateMakeId");
+    backMakeData(activeArray) {
+      let ary = this.listData.makeGoodsVoList.concat(activeArray)
+      this.$set(this.listData,'makeGoodsVoList',ary)
     },
-    clearGoods() {
-      this.$set(this.listData, "makeGoodsId", "");
-      this.$set(this.listData, "makeGoodsName", "");
-      this.$set(this.listData, "makeGoodsCode", "");
-      this.$bus.$emit("validateMakeId");
+    clearGoods(index) {
+      this.listData.makeGoodsVoList.splice(index,1)
     },
   },
 };

+ 32 - 31
src/views/Marketing/goods/commodityManageMent/edit/makeUpExam/makeCheck.vue

@@ -32,6 +32,7 @@
       <el-table
         ref="multipleTable"
         :data="tableData"
+        row-key="goodsId"
         border
         :header-cell-style="{
           'background-color': '#eee',
@@ -39,16 +40,12 @@
           color: '#333',
         }"
       >
-        <el-table-column label="" width="45" align="center">
-          <template scope="scope">
-            <el-radio
-              :disabled="scope.row.selectStatus === 0"
-              :label="scope.row.goodsId"
-              v-model="activeObj.makeGoodsId"
-              @change.native="getGoodsId(scope.row)"
-              >{{ "" }}</el-radio
-            >
-          </template>
+        <el-table-column
+          type="selection"
+          width="55"
+          :reserve-selection="true"
+          :selectable="selectableFunc"
+        >
         </el-table-column>
         <el-table-column
           v-for="(item, index) in tableSet"
@@ -85,8 +82,8 @@
         <el-button @click="dialogVisibleTableBoxs = false">取 消</el-button>
         <el-button
           type="primary"
-          :disabled="!activeObj.makeGoodsId"
           @click="submitTab"
+          :loading="loading"
           >确 定</el-button
         >
       </span>
@@ -100,6 +97,7 @@ export default {
   components: { pagination },
   data() {
     return {
+      loading:false,
       size: "small",
       dialogVisibleTableBoxs: false,
       tableData: [],
@@ -141,35 +139,27 @@ export default {
       ],
       formData: {},
       total: 0,
-      activeObj: {
-        makeGoodsId: "",
-        makeGoodsName: "",
-        makeGoodsCode: "",
-      },
-      initId: "", //解决无法选中初始ID问题
+      activeArray: [],
     };
   },
   methods: {
-    /**
-     * 选中补考/前培商品
-     */
-    getGoodsId(row) {
-      this.activeObj = {
-        makeGoodsId: row.goodsId,
-        makeGoodsName: row.goodsName,
-        makeGoodsCode: row.code,
-      };
+    /**是否允许选中 */
+    selectableFunc(row) {
+      return !this.activeArray.includes(row.goodsId);
     },
     /**
      * 初始
      */
-    openBox(obj, active, initId) {
-      this.initId = initId;
-      this.activeObj = JSON.parse(JSON.stringify(active));
+    openBox(obj, active) {
+      this.activeArray = JSON.parse(JSON.stringify(active)) || [];
       this.formData = JSON.parse(JSON.stringify(obj));
       //获取业务层次-课程
       this.getInfos();
       this.dialogVisibleTableBoxs = true;
+      this.loading = false;
+      this.$nextTick(() => {
+        this.$refs.multipleTable.clearSelection();
+      });
     },
     /**
      * 搜索数据
@@ -200,9 +190,20 @@ export default {
      * 提交回调数据
      */
     submitTab() {
-      this.$message.success("添加成功");
+      this.loading = true;
+      let ary = [];
+      if (this.$refs.multipleTable.selection.length > 0) {
+        ary = this.$refs.multipleTable.selection.map((i) => {
+          return {
+            makeGoodsCode: i.code,
+            makeGoodsId: i.goodsId,
+            makeGoodsName: i.goodsName,
+          };
+        });
+        this.$message.success("添加成功");
+        this.$emit("backData", ary);
+      }
       this.dialogVisibleTableBoxs = false;
-      this.$emit("backData", this.activeObj);
     },
     handleSizeChange(v) {
       this.formData.pageSize = v;

+ 1 - 3
src/views/Marketing/goods/commodityManageMent/edit/productInformation.vue

@@ -381,9 +381,7 @@ export default {
       // this.$set(this.listData, "serviceTimeType", ""); //学习服务期类型
       // this.$set(this.listData, "serviceTimeNum", ""); //学习服务期年月日
       // this.$set(this.listData, "studyTimeArrays", []); //学习服务期具体时间
-      // this.$set(this.listData, "makeGoodsId", ""); //补考/前培参数
-      // this.$set(this.listData, "makeGoodsName", ""); //补考/前培参数
-      // this.$set(this.listData, "makeGoodsCode", ""); //补考/前培参数
+      // this.$set(this.listData, "makeGoodsVoList", []); //补考/前培参数
       // this.$set(this.listData, "timeArrays", [
       //   new Date().getTime(),
       //   new Date().getTime() + 365 * 1 * 24 * 3600 * 1000,