Kaynağa Gözat

履职计划下发提示框优化

jiawuxian 1 yıl önce
ebeveyn
işleme
9c2e049aef

+ 5 - 3
src/components/message/threeStateMessageBox.vue

@@ -8,9 +8,9 @@
   >
     <div>{{ message }}</div>
     <div slot="footer" class="dialog-footer">
-      <el-button size="small" type="primary" @click="onYes">是</el-button>
-      <el-button size="small" @click="onNo">否</el-button>
-      <el-button size="small" @click="onCanel">取消</el-button>
+      <el-button size="small" @click="onCanel">{{option && option.cancelText?option.cancelText:'取消'}}</el-button>
+      <el-button size="small" @click="onNo">{{option && option.noText?option.noText:''}}</el-button>
+      <el-button size="small" type="primary" @click="onYes">{{option && option.yesText?option.yesText:'是'}}</el-button>
     </div>
   </DialogCom>
 </template>
@@ -24,6 +24,7 @@ export default {
       title: "提示",
       callback: null,
       state: null, //0否,1:是,2取消
+      option:{}
     };
   },
   methods: {
@@ -32,6 +33,7 @@ export default {
      */
     show(message, callback, option) {
       this.isShow = true;
+      this.option=option
       this.message = message;
       this.callback = callback;
     },

+ 34 - 23
src/views/resumption/plan/index.vue

@@ -563,34 +563,45 @@ export default {
     sel(selectList, row) {
       let msg = "";
       if (row.planStatus == 0) {
-        msg = "是否立即生成任务?";
-        this.$refs["DialogThreeState"].show(msg, (state) => {
-          if (state == 0 || state == 1) {
-            this.loading = true;
-            api
-              .distribute(selectList, state == 1)
-              .then((response) => {
-                this.getList();
-                this.loading = false;
-              })
-              .catch(() => {
-                this.loading = false;
-              });
+        msg = "请选择从当前轮次或周期开始生成任务?";
+        this.$refs["DialogThreeState"].show(
+          msg,
+          (state) => {
+            if (state == 0 || state == 1) {
+              this.distributeInner(selectList, state == 1);
+            }
+          },
+          {
+            yesText: "当前轮次",
+            noText: "下周期",
+            cancelText: "取消下发",
           }
-        });
-      } else {
-        this.loading = true;
-        api
-          .distribute(selectList, false)
-          .then((response) => {
-            this.getList();
-            this.loading = false;
+        );
+      } else if (row.planStatus == 2) {
+        this.$modal
+          .confirm("因存在已完成任务,本次任务下发仅支持下周期生成任务", {
+            confirmButtonText: "下周期",
+            canelButtonText: "取消下发",
           })
-          .catch(() => {
-            this.loading = false;
+          .then(() => {
+            this.distributeInner(selectList, false);
           });
+      } else {
+        this.distributeInner(selectList, false);
       }
     },
+    distributeInner(selectList, imme) {
+      this.loading = true;
+      api
+        .distribute(selectList, imme)
+        .then((response) => {
+          this.getList();
+          this.loading = false;
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
     async getRolesByOrg() {
       await allRole().then((res) => {
         // console.info(res);