Bladeren bron

临时提交

jiawuxian 1 jaar geleden
bovenliggende
commit
5111ea449a

+ 10 - 10
src/api/resumption/plan.js

@@ -23,17 +23,17 @@ export function cheHui(id) {
     method: 'get'
   })
 }
-// 查询【请填写功能名称】详细
-export function distributeCheHui(id) {
+// 下发所属机构为行社的计划
+export function distributeHS(id,immediateEffect) {
   return request({
-    url: '/core/api/plan/distributeCheHui/' + id,
+    url: `/core/api/plan/distributehs/${id}/${immediateEffect}`,
     method: 'get'
   })
 }
 // 查询【请填写功能名称】详细
-export function distribute(query) {
+export function distribute(query,immediateEffect) {
   return request({
-    url: '/core/api/plan/distribute' ,
+    url: '/core/api/plan/distribute/'+immediateEffect ,
     method: 'post',
     data: query
   })
@@ -51,19 +51,19 @@ export function get(id) {
     method: 'get'
   })
 }
-// 修改【请填写功能名称】
-export function update(data) {
+// immediateEffect:使用中、停用状态下编辑时有效
+export function update(data,immediateEffect) {
   return request({
-    url: '/core/api/plan/edit',
+    url: '/core/api/plan/edit/'+immediateEffect,
     method: 'post',
     data: data
   })
 }
 
 // 删除【请填写功能名称】
-export function delelte(id) {
+export function del(id) {
   return request({
     url: '/core/api/plan/delete/' + id,
-    method: 'get'
+    method: 'delete'
   })
 }

+ 67 - 0
src/components/message/threeStateMessageBox.vue

@@ -0,0 +1,67 @@
+<template>
+  <DialogCom
+    @closed="onClose"
+    class="elDialog"
+    :title="title"
+    :visible.sync="isShow"
+    width="500px"
+  >
+    <div>{{ message }}</div>
+    <div slot="footer" class="dialog-footer">
+      <el-button type="primary" @click="onYes">是</el-button>
+      <el-button @click="onNo">否</el-button>
+      <el-button @click="onCanel">取消</el-button>
+    </div>
+  </DialogCom>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      isShow: false,
+      message: "",
+      title: "提示",
+      callback: null,
+      state: null, //0否,1:是,2取消
+    };
+  },
+  methods: {
+    /**
+     * option:扩展
+     */
+    show(message, callback, option) {
+      this.isShow = true;
+      this.message = message;
+      this.callback = callback;
+    },
+    onYes() {
+      this.state = 1;
+      this.isShow = false;
+    },
+    onNo() {
+      this.state = 0;
+      this.isShow = false;
+    },
+    onCanel() {
+      this.state = 2;
+      this.isShow = false;
+    },
+    onClose() {
+      this.callback && this.callback(this.state);
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.elDialog {
+  ::v-deep .el-dialog {
+    display: flex;
+    flex-direction: column;
+    margin: 0 !important;
+    top: 40%;
+    left: 50% !important;
+    transform: translate(-50%, -50%);
+  }
+}
+</style>

+ 17 - 8
src/plugins/modal.js

@@ -52,21 +52,30 @@ export default {
     Notification.warning(content)
   },
   // 确认窗体
-  confirm(content) {
+  confirm(content,option) {
     return MessageBox.confirm(content, "系统提示", {
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      type: "warning",
+      confirmButtonText:(option && option.confirmButtonText)?option.confirmButtonText: '确定',
+      cancelButtonText: (option && option.cancelButtonText)?option.cancelButtonText: '取消',
+      type: (option && option.type)?option.type:  "warning",
     })
   },
   // 提交内容
-  prompt(content) {
+  prompt(content,option) {
     return MessageBox.prompt(content, "系统提示", {
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      type: "warning",
+      confirmButtonText:(option && option.confirmButtonText)?option.confirmButtonText: '确定',
+      cancelButtonText:(option && option.confirmButtonText)?option.confirmButtonText: '取消',
+      type:(option && option.type)?option.type:  "warning",
     })
   },
+  // prompt(content){
+  //   return MessageBox.prompt(content, "提示", {
+  //     confirmButtonText: '是',
+
+  //     cancelButtonText: '取消',
+
+  //     type: "info",
+  //   })
+  // },
   // 打开遮罩层
   loading(content) {
     loadingInstance = Loading.service({

+ 48 - 36
src/views/resumption/plan/dialog.edit.vue

@@ -176,7 +176,7 @@
                 ></el-input-number>
               </el-form-item>
             </el-col>
-            <el-col :span="6">
+            <!-- <el-col :span="6">
               <el-form-item
                 prop="tempBuildTaskNow"
                 label="立即生效:"
@@ -192,7 +192,7 @@
                   >
                 </div>
               </el-form-item>
-            </el-col>
+            </el-col> -->
           </el-row>
           <el-form-item prop="note" label="备注">
             <el-input
@@ -217,9 +217,7 @@
             :selectable="handleSelectable"
           ></el-table-column>
 
-
-          <el-table-column prop="ruleName" label="履职手册">
-          </el-table-column>
+          <el-table-column prop="ruleName" label="履职手册"> </el-table-column>
           <el-table-column prop="itemName" label="履职项"> </el-table-column>
           <el-table-column prop="pointName" label="履职内容" width="300px">
             <template slot-scope="scope">
@@ -277,6 +275,7 @@
       :orgType="formData.execOrgType"
       @select="onSelect"
     ></DialogSelect>
+    <DialogThreeState ref="DialogThreeState"> </DialogThreeState>
   </div>
 </template>
 
@@ -287,6 +286,7 @@ import * as api from "@/api/resumption/plan";
 import { statusOptions } from "./../../commonOption";
 import { findAllRole } from "@/api/system/role";
 import DialogSelect from "@/views/resumption/ruleManager/dialog.select.point.vue";
+import DialogThreeState from "@/components/message/threeStateMessageBox.vue";
 export default {
   dicts: [
     "resumption_plan_type",
@@ -363,16 +363,16 @@ export default {
       isShow: false,
       formData: {},
       formDataRules: {
-        planName: [{ required: true, message: "请输入计划名称" }],
-        planType: [{ required: true, message: "请选择计划类型" }],
-        planCycle: [{ required: true, message: "请选择履职周期" }],
-        planStatus: [{ required: true, message: "请选择计划状态" }],
-        execOrgType: [{ required: true, message: "请选择履职机构类型" }],
+        planName: [{ required: true, message: "请输入任务名称" }],
+        planType: [{ required: true, message: "请选择任务类型" }],
+        planCycle: [{ required: true, message: "请选择任务周期" }],
+        // planStatus: [{ required: true, message: "请选择计划状态" }],
+        execOrgType: [{ required: true, message: "请选择机构类型" }],
         roleList: [
-          { required: true, message: "请选择履职角色", trigger: "change" },
+          { required: true, message: "请选择履职人员", trigger: "change" },
         ],
-        planExec: [{ required: true, message: "请选择履职时间" }],
-        count: [{ required: true, message: "请选择履职次数" }],
+        planExec: [{ required: true, message: "请选择任务时间" }],
+        count: [{ required: true, message: "请选择任务次数" }],
       },
       statusOptions: statusOptions,
     };
@@ -410,10 +410,7 @@ export default {
       //   this.id == undefined ||
       //   (this.defbuildTaskNow && this.formData.planStatus == 0)
       // )
-      if (this.isShow && (
-        !this.id ||
-        ( this.formData.planStatus == 0))
-      )
+      if (this.isShow && (!this.id || this.formData.planStatus == 0))
         return true;
       else return false;
     },
@@ -437,8 +434,8 @@ export default {
       this.selectedRows = [];
     },
     changeBuildTime() {
-      if(this.formData.planCycle==null){
-        this.buildTime=null;
+      if (this.formData.planCycle == null) {
+        this.buildTime = null;
         return;
       }
       // console.log(this.formData.planCycle, "this.formData.planCycle");
@@ -779,9 +776,9 @@ export default {
     },
     // 事件
     onHide() {
-      this.isShow = false;     
+      this.isShow = false;
     },
-    onClose(){
+    onClose() {
       this.formData = this.reset();
       this.$refs.form.resetFields();
     },
@@ -812,7 +809,7 @@ export default {
         // this.formData.note = this.formData.description;
         this.formData.planCreateOrgId = this.orgId;
         this.formData.planCreateOrgName = this.orgName;
-      
+
         this.formData.itemList = this.tableData == null ? [] : this.tableData;
         //新需求,自动填充角色
         if (
@@ -827,21 +824,36 @@ export default {
         this.formData.roleList =
           this.selectedValues.length == 0 ? null : this.selectedValues;
 
-        await api.update(this.formData).then((data) => {
-          this.isSubmitting = false;
-            this.loading = false;
-            this.$emit("success");
-            this.onHide();
-          })
-          .catch((err) => {
-            this.loading = false;
-            // console.log(err,"err")
-          });
-        
-        // this.$emit("success");
-        // this.onHide();
+        //停用、使用中编辑
+        if (this.formData.status > 0) {
+          this.refs["DialogThreeState"].show(
+            true,
+            "本周期未完成任务是否使用新的任务内容)?",
+            (state) => {
+              if (state == 0 || state == 1) {
+                this.update(this.formData, state == 1);
+              }
+            }
+          );
+        } else {
+          this.update(this.formData, false);
+        }
       });
     },
+    async update(data, immediateEffect) {
+      await api
+        .update(data, immediateEffect)
+        .then((data) => {
+          this.isSubmitting = false;
+          this.loading = false;
+          this.$emit("success");
+          this.onHide();
+        })
+        .catch((err) => {
+          this.loading = false;
+          // console.log(err,"err")
+        });
+    },
     handleRolesChange(val) {
       this.selectedValues = val.toString().split(",");
     },
@@ -849,7 +861,7 @@ export default {
     //apimark//
   },
   mounted() {},
-  components: { DialogSelect },
+  components: { DialogSelect, DialogThreeState },
 };
 </script>
 

+ 3 - 1
src/views/resumption/plan/distribute.vue

@@ -76,6 +76,7 @@ export default {
       info: this.emptyInfo(),
       tableData: [],
       filterName: null,
+      plan:null
     };
   },
   computed: {},
@@ -90,6 +91,7 @@ export default {
   },
   methods: {
     show(plan) {
+      this.plan=plan
       this.isShow = true;
       this.loading=true;
       this.info.id = plan.id;
@@ -126,7 +128,7 @@ export default {
     },
     onSubmit() {
       console.info(this.info);
-      this.$emit("select", this.info);
+      this.$emit("select", this.info,this.plan);
       this.onHide();
     },
     emptyInfo() {

+ 95 - 56
src/views/resumption/plan/index.vue

@@ -330,7 +330,7 @@
                   size="mini"
                   type="text"
                   icon="el-icon-delete"
-                  @click="onDel(r.row.id, r.row.planName)"
+                  @click="onDel(r.row)"
                   v-hasPermi="['system:user:remove']"
                   >删除</el-button
                 >
@@ -355,6 +355,7 @@
       :ruleTypeOptions="dict.type.rule_type"
     ></dialog-edit>
     <DialogDistribute ref="dialogDistribute" @select="sel"></DialogDistribute>
+    <DialogThreeState ref="DialogThreeState"> </DialogThreeState>
   </div>
 </template>
 
@@ -366,6 +367,7 @@ import DialogEdit from "./dialog.edit";
 import * as api from "@/api/resumption/plan";
 import { statusOptions, getLabel } from "./../../commonOption";
 import { allRole } from "@/api/system/role";
+import DialogThreeState from "@/components/message/threeStateMessageBox.vue";
 export default {
   name: "resumptionplan",
   dicts: [
@@ -380,6 +382,7 @@ export default {
     DialogEdit,
     OrgTree,
     DialogDistribute,
+    DialogThreeState,
   },
   data() {
     const { params, query } = this.$route;
@@ -462,24 +465,22 @@ export default {
     //   return false;
     // },
     showPublish(row) {
-      //可以下发:本机构创建+所属机构是自己+状态为草稿、停用的计划
-      //可以下发:所属机构是自己,创建机构不是自己,状态为草稿、停用且上级计划下发时,本计划设置为禁用
+      //可以下发:本机构创建+状态为草稿、停用的计划
       if (
         row.planCreateOrgId == this.orgId &&
-        row.planOfOrgId == this.orgId &&
         (row.planStatus == 0 || row.planStatus == 2)
       ) {
         return true;
       }
 
-      if (
-        row.planOfOrgId == this.orgId &&
-        row.planCreateOrgId != this.orgId &&
-        (row.planStatus == 0 || row.planStatus == 2) &&
-        row.distributePlanStatus == 0
-      ) {
-        return true;
-      }
+      // if (
+      //   row.planOfOrgId == this.orgId &&
+      //   row.planCreateOrgId != this.orgId &&
+      //   (row.planStatus == 0 || row.planStatus == 2) &&
+      //   row.distributePlanStatus == 0
+      // ) {
+      //   return true;
+      // }
 
       return false;
     },
@@ -488,25 +489,21 @@ export default {
       return row.planCreateOrgId == this.orgId;
     },
     showWithDraw(row) {
-      //本机构创建+所属机构是自己+状态为使用中
-      //不是本机构创建+所属机构是自己+状态为使用中+上级下发时状态默认为禁用
-      if (
-        row.planCreateOrgId == this.orgId &&
-        row.planOfOrgId == this.orgId &&
-        row.planStatus == 1
-      ) {
-        return true;
-      }
+      //本机构创建是自己+状态为使用中
 
-      if (
-        row.planOfOrgId == this.orgId &&
-        row.planCreateOrgId != this.orgId &&
-        row.planStatus == 1 &&
-        row.distributePlanStatus == 0
-      ) {
+      if (row.planCreateOrgId == this.orgId && row.planStatus == 1) {
         return true;
       }
 
+      // if (
+      //   row.planOfOrgId == this.orgId &&
+      //   row.planCreateOrgId != this.orgId &&
+      //   row.planStatus == 1 &&
+      //   row.distributePlanStatus == 0
+      // ) {
+      //   return true;
+      // }
+
       return false;
     },
     // //已完成下发的计划不显示下发按钮
@@ -532,8 +529,16 @@ export default {
     // },
     //开始撤回
     chhuile(row) {
+      let msg = "";
+      if (row.taskHasCompleted == 1) {
+        msg =
+          "本次操作将对下周期及以后任务生效,对当前及历史任务不造成影响,是否确认提交?";
+      } else {
+        msg =
+          "本次操作将对当前轮次及以后任务生效,并删除所有历史未完成任务,是否确认提交?";
+      }
       this.$modal
-        .confirm("确认撤回?", "提示")
+        .confirm(msg, "提示")
         .then(() => {
           // 用户点击了确认按钮
           // console.log("执行操作...");
@@ -555,10 +560,21 @@ export default {
     //   }
     //   return false;
     // },
-    sel(selectList) {
+    sel(selectList, row) {
       this.loading = true;
-      api.distribute(selectList).then((response) => {
-        this.getList();
+      let msg = "";
+      if (row.planStatus == 0) {
+        msg = "是否立即生成任务?";
+      } else {
+        msg = "任务内容是否从当前周期生效";
+      }
+      this.$refs["DialogThreeState"].show(msg, async (state) => {
+        if (state == 0 || state == 1) {
+          await api.distribute(selectList, state == 1).then((response) => {
+            this.getList();
+          });
+        }
+
         this.loading = false;
       });
     },
@@ -600,38 +616,48 @@ export default {
     onEdit(id, other = {}) {
       this.$refs.editDialog.show(id, other);
     },
-    onChildPlanDistribute(row) {
+    onHSPlanDistribute(row) {
+      let msg = "";
+      if (row.planStatus == 0) {
+        msg = "是否立即生成任务?";
+      } else {
+        msg = "是否立即生效";
+      }
       this.$modal
-        .confirm("是否下发!", "提示")
+        .confirm(msg, "提示")
         .then(() => {
           // 用户点击了确认按钮
           console.log("执行操作...");
-          this.loading = true;
-          api
-            .distributeCheHui(row.id)
-            .then((response) => {
-              // console.log(response, "then");
-              if (response.data == 0) {
-                this.loading = false;
-              } else {
-                this.getList();
-                this.loading = false;
-              }
-            })
-            .catch((response) => {
-              // console.log(response, "catch");
-              this.getList();
-              this.loading = false;
-            });
+          distributeHS(row.id, true);
         })
         .catch(() => {
           // 用户点击了取消按钮
-          console.log("取消操作...");
+          // console.log("取消操作...");
+          distributeHS(row.id, false);
+        });
+    },
+    distributeHS(id, immediateEffect) {
+      this.loading = true;
+      api
+        .distributeHS(row.id, true)
+        .then((response) => {
+          // console.log(response, "then");
+          if (response.data == 0) {
+            this.loading = false;
+          } else {
+            this.getList();
+            this.loading = false;
+          }
+        })
+        .catch((response) => {
+          // console.log(response, "catch");
+          this.getList();
+          this.loading = false;
         });
     },
     showDialogDistribute(row) {
       if (row.planOfOrgType == 3) {
-        this.onChildPlanDistribute(row);
+        this.onHSPlanDistribute(row);
       } else {
         this.$refs.dialogDistribute.show(row);
       }
@@ -655,15 +681,27 @@ export default {
       //     this.$refs.dialogDistribute.show(row);
       //   });
     },
-    async onDel(id, name) {
+    async onDel(row) {
+      let msg = "";
+      if (row.planStatus == 0) {
+        msg = '是否确认删除名称为"' + row.planName + '"的任务?';
+      } else {
+        if (row.taskHasCompleted == 1) {
+          msg =
+            "本次操作将对下周期及以后任务生效,对当前及历史任务不造成影响,是否确认提交?";
+        } else {
+          msg =
+            "本次操作将对当前轮次及以后任务生效,并删除所有历史未完成任务,是否确认提交?";
+        }
+      }
       this.$modal
-        .confirm('是否确认删除名称为"' + name + '"的数据项?')
+        .confirm(msg)
         .then(() => {
           // 用户点击了确认按钮
           console.log("执行操作...");
           this.loading = true;
           api
-            .delelte(id)
+            .del(row.id)
             .then(() => {
               this.getList();
               this.loading = false;
@@ -676,6 +714,7 @@ export default {
         .catch(() => {
           // 用户点击了取消按钮
           console.log("取消操作...");
+          this.loading = false;
         });
     },
     // 多选框选中数据
@@ -689,7 +728,7 @@ export default {
       this.resetForm("search");
       this.queryParams.orgId = this.orgId;
       this.queryParams.checkSub = false;
-      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
+      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);
       // this.$refs.tree.setCurrentKey(null);
       this.getList();
     },