MONSTER-ygh 2 kuukautta sitten
vanhempi
commit
f3fa05e223

+ 13 - 6
src/views/ticket/InventoryTemplate/dialog/addAndEdit.vue

@@ -217,6 +217,7 @@ export default {
         this.model = mode
         this.loading = true
         this.loadingText = '获取数据中...'
+        this.title = title
         this.chennelAtion = null
         this.open = true
         this.activeName = '01';
@@ -225,10 +226,8 @@ export default {
           await this.channelTypeFun()
         }
         if (obj){
-          this.title = "编辑库存模板";
           await this.getSelectByIdApi(obj)
         }else{
-          this.title = "添加库存模板";
           this.form = {
             chennelListForm: this.setDataTree({})
           }
@@ -338,11 +337,15 @@ export default {
           if(obj.channelType == data.chennelList[i].channelType) {
             if(data.chennelList[i].chennelSeatList) {
               let srt = 'seat_'+ data.chennelList[i].seatTypeId
-              seat[srt] ? seat[srt].push(...data.chennelList[i].chennelSeatList): seat[srt] = [...data.chennelList[i].chennelSeatList]
-              console.log("seat_",seat,data.chennelList[i].chennelSeatList)
+              if(seat[srt]) {
+                seat[srt] = seat[srt].concat(data.chennelList[i].chennelSeatList)
+              }else {
+                seat[srt] = [...data.chennelList[i].chennelSeatList]
+              }
+              console.log("seat_",srt,seat,data.chennelList[i].chennelSeatList)
             }
             //list = data.chennelList[i].chennelSeatList ? JSON.parse(JSON.stringify(data.chennelList[i].chennelSeatList)):[]
-            break;
+           // break;
           }
         }
       }
@@ -415,6 +418,10 @@ export default {
             }
             delete postMap.chennelListForm
             console.log("postMap=====",postMap)
+            if(!postMap.chennelList || postMap.chennelList.length==0) {
+              this.loading = false
+              return
+            }
             let res = await saveAndEdit(postMap)
             this.loading = false
             if(res.code) {
@@ -517,7 +524,7 @@ export default {
       let list1 = []
       if(this.form.chennelListForm[this.chennelAtion].chennelSeatList) {
         Object.keys(this.form.chennelListForm[this.chennelAtion].chennelSeatList).forEach((item)=>{
-          list1.push(...this.form.chennelListForm[this.chennelAtion].chennelSeatList[item])
+          list1 = list1.concat(this.form.chennelListForm[this.chennelAtion].chennelSeatList[item])
         })
         list = this.dataList.filter((item,index)=>{
           if(list1.includes(item.id)){

+ 24 - 7
src/views/ticket/InventoryTemplate/index.vue

@@ -191,15 +191,15 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.$refs["addAndEdit"].openDialog("新增数据", null, "ADD");
+      this.$refs["addAndEdit"].openDialog("添加库存模板", null, "ADD");
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.$refs["addAndEdit"].openDialog("修改数据", row, "EDIT");
+      this.$refs["addAndEdit"].openDialog("编辑库存模板", row, "EDIT");
     },
     /** 详情按钮操作 */
     openDetails(row) {
-      this.$refs["addAndEdit"].openDialog("详情", row, "DETAILS");
+      this.$refs["addAndEdit"].openDialog("库存模板详情", row, "DETAILS");
     },
 
     // 修改是否启用
@@ -208,14 +208,31 @@ export default {
     },
     // 发布
     handleRelease(row) {
-      this.$modal.confirm(`是否确认${row.status == 1 ? '取消发布' : '发布'}"${row.name} "?`).then(function() {
+      let srt = row.status == 1 ? `取消发布后,该模板将在已绑定的排期中失效,确认要取消发布"${row.name}"吗?`: `是否确认发布"${row.name} "?`
+      this.$modal.confirm(srt).then(function() {
         return releaseById({
           id:row.id,
           status: row.status == 1 ? 0 : 1
         });
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("发布成功");
+      }).then((res) => {
+        if(res.code == 200) {
+          if(row.status == 0) {
+            this.$confirm('模板发布成功后,可前往排期中进行绑定!','模板发布成功!',{
+              type: 'success',
+              confirmButtonText: '前往排期设置',
+              cancelButtonText: '取消',
+              center: true
+            }).then(()=> {
+              //this.getList();
+              this.$router.push('/ticketMr/schedulingConfiguration')
+            }).catch(() => {
+              this.getList();
+            });
+          }else {
+            this.$modal.msgSuccess("取消发布成功");
+            this.getList();
+          }
+        }
       }).catch(() => {});
     },
     /** 删除按钮操作 */