Przeglądaj źródła

Merge branch 'V0.0.5' of http://10.87.21.221:8000/jzyd_yyds/soc_web into V0.0.5

jiawuxian 1 rok temu
rodzic
commit
42a2251031

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

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

+ 102 - 16
src/views/core/accessPlan/index.vue

@@ -378,7 +378,7 @@
             :disabled="form.isComplete"
           />
         </el-form-item>
-        <el-form-item
+        <!-- <el-form-item
           label="立即生效"
           prop="immediately"
           v-if="form.planCycle != 0 && this.issue == null"
@@ -391,7 +391,7 @@
             <br />
             勾选后从当前周期立即生成任务
           </el-checkbox>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item
           prop="startTime"
           v-if="form.planCycle == 0"
@@ -441,6 +441,7 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </DialogCom>
+    <DialogThreeState ref="DialogThreeState"> </DialogThreeState>
   </div>
 </template>
 
@@ -460,6 +461,8 @@ import orgTree from "@/components/orgTree/orgQuerySelector.vue";
 import { deptTreeSelect } from "@/api/system/public";
 import KFileUpload from "@/components/K-FileUpload/index.vue";
 import { mapGetters } from "vuex";
+import DialogThreeState from "@/components/message/threeStateMessageBox.vue";
+import * as api from "@/api/core/accessPlan";
 export default {
   name: "Plan",
   dicts: [
@@ -472,6 +475,7 @@ export default {
   ],
   components: {
     orgTree,
+    DialogThreeState,
   },
   computed: {
     ...mapGetters(["orgId"]),
@@ -723,12 +727,38 @@ export default {
     submitForm() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          if (this.form.id != null) {
-            updatePlan(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+          let request = {...this.form};
+          if (request.id != null) {
+            let msg = "";
+            if (this.form.planStatus == 1) {
+              if(this.form.isComplete){
+                msg =  "因不存在已完成任务,本次修改内容将立即生效,是否确认提交?";
+              }else{
+                msg = "因存在已完成任务,本次修改内容将下周期生效,是否确认提交?";
+              }
+            }else{
+              msg = "是否确认修改?";
+            }
+            this.$modal
+              .confirm(msg)
+              .then(function () {
+                return updatePlan(request);
+              })
+              .then(() => {
+                this.$modal.msgSuccess("编辑成功");
+                this.open = false;
+                this.getList();
+            
+              })
+              .catch(() => {
+              });
+
+
+            // updatePlan(this.form).then((response) => {
+            //   this.$modal.msgSuccess("修改成功");
+            //   this.open = false;
+            //   this.getList();
+            // });
           } else {
             addPlan(this.form).then((response) => {
               this.$modal.msgSuccess("新增成功");
@@ -754,21 +784,75 @@ export default {
         })
         .catch(() => {});
     },
+    // handDistribute(row) {
+    //   let msg = "";
+    //   if(row.planStatus==0){
+    //     this.$modal
+    //     .confirm("请选择下发后立即生成或下周期生成任务")
+    //     .then(function () {
+    //       return distribute(row.id);
+    //     })
+    //     .then(() => {
+    //       this.getList();
+    //       this.$modal.msgSuccess("下发成功");
+    //     })
+    //     .catch(() => {});
+    //   }
+ 
+    // },
+
     handDistribute(row) {
-      this.$modal
-        .confirm("下发计划会生成本周期所有任务,确定执行?")
+      let msg = "";
+      if(row.planStatus==0){
+        let   msg = "请选择下发后立即生成或下周期生成任务?";
+        this.$refs["DialogThreeState"].show(
+          msg,
+          (state) => {
+            if (state == 0 || state == 1) {
+              this.distribute(row.id, state == 1);
+            }
+          },
+          {
+            yesText: "立即生成",
+            noText: "下周期",
+            cancelText: "取消",
+          }
+        );
+      }
+ 
+    },
+    distribute(id, immediateEffect) {
+      this.loading = true;
+      api
+        .distribute(id, immediateEffect)
+        .then((response) => {
+          if (response.data == 0) {
+            this.loading = false;
+          } else {
+            this.getList();
+            this.loading = false;
+          }
+        })
+        .catch((response) => {
+          this.getList();
+          this.loading = false;
+        });
+    },
+    handWithdraw(row) {
+      if (row.isComplete) {
+        this.$modal
+        .confirm("因不存在已完成任务,撤回后将删除所有生成任务")
         .then(function () {
-          return distribute(row.id);
+          return withdraw(row.id);
         })
         .then(() => {
           this.getList();
-          this.$modal.msgSuccess("下发成功");
+          this.$modal.msgSuccess("撤回成功");
         })
         .catch(() => {});
-    },
-    handWithdraw(row) {
-      this.$modal
-        .confirm("撤回计划会清除本周期所有任务,确定执行?")
+      }else{
+        this.$modal
+        .confirm("因存在已完成任务,撤回后下周期起将不再生成任务")
         .then(function () {
           return withdraw(row.id);
         })
@@ -777,6 +861,8 @@ export default {
           this.$modal.msgSuccess("撤回成功");
         })
         .catch(() => {});
+      }
+
     },
     /** 导出按钮操作 */
     handleExport() {

+ 1 - 1
src/views/resumptionEvaluate/evaluate/index.vue

@@ -114,7 +114,7 @@
                   icon="el-icon-plus"
                   size="mini"
                   @click="handleAdd"
-                  v-hasPermi="['system:user:add']"
+                  v-hasPermi="['core:evaluatePlan:add']"
                   >新增</el-button
                 >
               </el-col>