Преглед изворни кода

履职计划按钮使用完善

jiawuxian пре 1 година
родитељ
комит
adea6472e8
1 измењених фајлова са 72 додато и 37 уклоњено
  1. 72 37
      src/views/resumption/plan/index.vue

+ 72 - 37
src/views/resumption/plan/index.vue

@@ -289,13 +289,13 @@
                   size="mini"
                   type="text"
                   icon="el-icon-arrow-down"
-                  v-if="checkCanPublish(r.row)"
+                  v-if="showPublish(r.row)"
                   @click="showDialogDistribute(r.row)"
                   v-hasPermi="['system:user:remove']"
                   >下发</el-button
                 >
 
-                <el-button
+                <!-- <el-button
                   size="mini"
                   type="text"
                   icon="el-icon-arrow-down"
@@ -303,13 +303,13 @@
                   @click="newshowDialogDistribute(r.row)"
                   v-hasPermi="['system:user:remove']"
                   >下发</el-button
-                >
+                > -->
 
                 <el-button
                   size="mini"
                   type="text"
                   icon="el-icon-top-left"
-                  v-if="chehui(r.row)"
+                  v-if="showWithDraw(r.row)"
                   @click="chhuile(r.row)"
                   v-hasPermi="['system:user:remove']"
                   >撤回</el-button
@@ -324,7 +324,7 @@
                   >编辑</el-button
                 >
                 <el-button
-                  v-if="eqOrg2(r.row)"
+                  v-if="showDelete(r.row)"
                   size="mini"
                   type="text"
                   icon="el-icon-delete"
@@ -447,40 +447,70 @@ export default {
       }
       return false;
     },
-    eqOrg2(row) {
-      // console.log(row.planCreateOrgId,"row.planCreateOrgId");
-      // console.log(this.orgId,"this.orgId");
-      if (
-        row != null &&
-        row != undefined &&
-        row.planCreateOrgId == this.orgId &&
-        row.planOfOrgId == this.orgId
-      ) {
+    // eqOrg2(row) {
+    //   // console.log(row.planCreateOrgId,"row.planCreateOrgId");
+    //   // console.log(this.orgId,"this.orgId");
+    //   if (
+    //     row != null &&
+    //     row != undefined &&
+    //     row.planCreateOrgId == this.orgId &&
+    //     row.planOfOrgId == this.orgId
+    //   ) {
+    //     return true;
+    //   }
+    //   return false;
+    // },
+    showPublish(row){
+      //可以下发:本机构创建+所属机构是自己+状态为草稿、停用的计划
+      //可以下发:所属机构是自己,创建机构不是自己,状态为草稿、停用且上级计划下发时,本计划设置为禁用
+      if(row.planCreateOrgId==this.orgId && row.planOfOrgId==this.orgId && (row.planStatus==0 || row.planStatus==2)){
         return true;
       }
-      return false;
-    },
-    //已完成下发的计划不显示下发按钮
-    checkCanPublish(row) {
-      // console.log(row.planStatus,"row.planStatus")
-      if (row.planOfOrgType == "1" && row.distribute == 0) {
+
+      if(row.planOfOrgId==this.orgId && row.planCreateOrgId!=this.orgId  && (row.planStatus==0 || row.planStatus==2) && row.distributePlanStatus==0){
         return true;
       }
+
       return false;
     },
-    newcheckCanPublish(row) {
-      //如果计划所属机构类型为行社并且计划不为进行中并且计划创建机构为当前机构或者
-      //计划状态为停用并且不属于子计划并且计划所属机构类型为省联社
-      if (
-        (row.planOfOrgType == 3 &&
-          row.planStatus != 1 &&
-          row.planCreateOrgId == this.orgId) ||
-        (row.planStatus == 2 && row.parentId != -1 && row.planOfOrgType == 1)
-      ) {
+    showDelete(row){
+      //本机构创建的计划,才能删除
+      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){
         return true;
       }
+
       return false;
     },
+    // //已完成下发的计划不显示下发按钮
+    // checkCanPublish(row) {
+    //   // console.log(row.planStatus,"row.planStatus")
+    //   if (row.planOfOrgType == "1" && row.distribute == 0) {
+    //     return true;
+    //   }
+    //   return false;
+    // },
+    // newcheckCanPublish(row) {
+    //   //如果计划所属机构类型为行社并且计划不为进行中并且计划创建机构为当前机构或者
+    //   //计划状态为停用并且不属于子计划并且计划所属机构类型为省联社
+    //   if (
+    //     (row.planOfOrgType == 3 &&
+    //       row.planStatus != 1 &&
+    //       row.planCreateOrgId == this.orgId) ||
+    //     (row.planStatus == 2 && row.parentId != -1 && row.planOfOrgType == 1)
+    //   ) {
+    //     return true;
+    //   }
+    //   return false;
+    // },
     //开始撤回
     chhuile(row) {
       this.$modal
@@ -500,12 +530,12 @@ export default {
         });
     },
     //已下发的显示撤回
-    chehui(row) {
-      if (row.distribute == 1 && row.planCreateOrgId == this.orgId) {
-        return true;
-      }
-      return false;
-    },
+    // chehui(row) {
+    //   if (row.distribute == 1 && row.planCreateOrgId == this.orgId) {
+    //     return true;
+    //   }
+    //   return false;
+    // },
     sel(selectList) {
       this.loading = true;
       api.distribute(selectList).then((response) => {
@@ -551,7 +581,7 @@ export default {
     onEdit(id, other = {}) {
       this.$refs.editDialog.show(id, other);
     },
-    newshowDialogDistribute(row) {
+    onChildPlanDistribute(row) {
       this.$modal
         .confirm("是否下发!", "提示")
         .then(() => {
@@ -581,6 +611,11 @@ export default {
         });
     },
     showDialogDistribute(row) {
+      if(row.planOfOrgType==3){
+        this.onChildPlanDistribute(row);
+      }else{
+        this.$refs.dialogDistribute.show(row);
+      }
       // this.loading = true;
       // api
       //   .distributeCheHui(row.id)
@@ -600,7 +635,7 @@ export default {
       //     this.loading = false;
       //     this.$refs.dialogDistribute.show(row);
       //   });
-      this.$refs.dialogDistribute.show(row);
+      
     },
     async onDel(id, name) {
       this.$modal