Browse Source

Merge remote-tracking branch 'origin/V0.0.5' into V0.0.5

jingyuanchao 1 year ago
parent
commit
066ea26f76
2 changed files with 65 additions and 11 deletions
  1. 1 1
      src/api/core/accessPlan.js
  2. 64 10
      src/views/core/accessPlan/index.vue

+ 1 - 1
src/api/core/accessPlan.js

@@ -21,7 +21,7 @@ export function getPlan(id) {
 export function distribute(id,immediateEffect) {
   return request({
     url: `/core/accessPlan/distribute/${id}/${immediateEffect}`,
-    showLoading:true,
+
     method: 'get'
   })
 }

+ 64 - 10
src/views/core/accessPlan/index.vue

@@ -730,8 +730,8 @@ export default {
           let request = {...this.form};
           if (request.id != null) {
             let msg = "";
-            if (this.form.planStatus == 1) {
-              if(this.form.isComplete){
+            if (request.planStatus == 1) {
+              if(request.isComplete==true){
                 msg =  "因不存在已完成任务,本次修改内容将立即生效,是否确认提交?";
               }else{
                 msg = "因存在已完成任务,本次修改内容将下周期生效,是否确认提交?";
@@ -773,16 +773,48 @@ export default {
     handleDelete(row) {
       const ids = row.id || this.ids;
       const names = row.planName || this.names;
+      let msg = "";
+      if (row.planStatus == 1) {
+    if(row.planCycle==1){
+      msg = "本次删除将强制删除今日所有任务?";
+    }else{
+      msg = "本次删除将强制删除当前任务时间及以后所有任务";
+    }
+      }else {
+        msg = '是否确认删除名称为"' + row.planName + '"的任务?';
+      }
+      // this.$modal
+      //   .confirm("删除计划会清除本周期所有任务,确定执行?")
+      //   .then(function () {
+      //     return delPlan(ids);
+      //   })
+      //   .then(() => {
+      //     this.getList();
+      //     this.$modal.msgSuccess("删除成功");
+      //   })
+      //   .catch(() => {});
       this.$modal
-        .confirm("删除计划会清除本周期所有任务,确定执行?")
-        .then(function () {
-          return delPlan(ids);
-        })
+        .confirm(msg)
         .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
+          // 用户点击了确认按钮
+          console.log("执行操作...");
+          this.loading = true;
+          api
+            .delPlan(row.id)
+            .then(() => {
+              this.getList();
+              this.loading = false;
+              this.$modal.msgSuccess("删除成功");
+            })
+            .catch(() => {
+              this.loading = false;
+            });
         })
-        .catch(() => {});
+        .catch(() => {
+          // 用户点击了取消按钮
+          console.log("取消操作...");
+          this.loading = false;
+        });
     },
     // handDistribute(row) {
     //   let msg = "";
@@ -804,7 +836,14 @@ export default {
     handDistribute(row) {
       let msg = "";
       if(row.planStatus==0){
-        let   msg = "请选择下发后立即生成或下周期生成任务?";
+        if (row.planCycle==0) {
+          this.$modal
+          .confirm("确定下发任务并立即生成任务?")
+          .then(() => {
+            this.distribute(row.id, true);
+          });
+        }else{
+          let   msg = "请选择下发后立即生成或下周期生成任务?";
         this.$refs["DialogThreeState"].show(
           msg,
           (state) => {
@@ -818,6 +857,21 @@ export default {
             cancelText: "取消",
           }
         );
+        }
+    
+      }else if(row.planCycle==0 &&row.planStatus==2){
+        this.distribute(row.id, true);
+        // this.$modal
+        // .confirm("确定下发任务并立即生成任务?")
+        //   .then(() => {
+        //     this.distribute(row.id, true);
+        //   });
+      } else{
+        this.$modal
+          .confirm("因存在已完成任务,是否确定从下周期生成任务?")
+          .then(() => {
+            this.distribute(row.id, false);
+          });
       }
  
     },