Bladeren bron

文件收集

daiqisheng 3 jaren geleden
bovenliggende
commit
7ff6c41a35
1 gewijzigde bestanden met toevoegingen van 260 en 72 verwijderingen
  1. 260 72
      src/pages/main/performance/department.vue

+ 260 - 72
src/pages/main/performance/department.vue

@@ -34,21 +34,30 @@
         <div class="flex-justify-between padding-right-20 padding-left-20">
           <div>
             <template v-if="edit_visible">
+              <!-- 转派按钮 科室经理、分管副总、总经理可见   -->
               <el-button
                 type="primary"
-                v-if="edit_form.status === '0'"
+                v-if="
+                  edit_form.status === '0' && (duty === '7' || duty === '10')
+                "
                 @click="handleTransfer"
                 >转派</el-button
               >
+              <!-- 提交按钮 科员可见  -->
               <el-button
                 type="primary"
-                v-if="edit_form.status === '0'"
+                v-if="
+                  edit_form.status === '0' && (duty === '1' || duty === '10')
+                "
                 @click="handleSubmit"
                 >提交</el-button
               >
+              <!-- 审批按钮 科室经理、分管副总、总经理可见  -->
               <el-button
                 type="primary"
-                v-if="edit_form.status === '2'"
+                v-if="
+                  edit_form.status === '2' && (duty === '7' || duty === '10')
+                "
                 @click="handleApprove"
                 >审批</el-button
               >
@@ -63,8 +72,7 @@
           </div> -->
         </div>
         <!-- 主体部分 -->
-        <simple-sheet v-if="isCheck" :id="edit_form.id" />
-        <simple-sheet v-else :id="edit_form.id" :type="edit" />
+        <simple-sheet :id="edit_form.id" />
         <!-- <analysis
           :edit="edit_form.department_status === '待处理' && edit_visible"
         /> -->
@@ -76,7 +84,6 @@
       :visible="approve_visible"
       :reload="reload"
       width="500px"
-      props="approve_visible"
       @cancel="handleCancel('approve_visible')"
     >
       <el-form :model="approveForm" ref="approveForm"
@@ -89,25 +96,56 @@
       <template v-slot:footer
         ><div>
           <div v-if="type === '1'">
-            <el-button @click="handleCancel('approve_visible')">结束</el-button>
-            <el-button @click="handleTurn(type)" type="primary"
+            <el-button @click="handleTurn('finish')">结束</el-button>
+            <el-button @click="handleTurn('transfer')" type="primary"
               >转副总审批</el-button
             >
           </div>
           <div v-else-if="type === '2'">
-            <el-button @click="handleCancel('approve_visible')">结束</el-button>
-            <el-button @click="handleCancel('approve_visible')">打回</el-button>
-            <el-button @click="handleTurn(type)" type="primary"
+            <el-button @click="handleTurn('finish')">结束</el-button>
+            <el-button @click="handleTurn('back')">打回</el-button>
+            <el-button @click="handleTurn('transfer')" type="primary"
               >转总经理审批</el-button
             >
           </div>
           <div v-else>
-            <el-button @click="handleBack">打回</el-button>
-            <el-button @click="handleAgree" type="primary">同意</el-button>
+            <el-button @click="handleTurn('back')">打回</el-button>
+            <el-button @click="handleTurn('agree')" type="primary"
+              >同意</el-button
+            >
           </div>
         </div>
       </template>
     </simple-dialog>
+    <simple-dialog
+      title="转派"
+      :visible="transfer_visible"
+      :reload="reload"
+      width="500px"
+      @confirm="transferConfirm"
+      @cancel="handleCancel('transfer_visible')"
+    >
+      <el-form
+        :model="transfer_form"
+        :rules="transfer_rules"
+        ref="transfer_form"
+      >
+        <el-form-item label="转派人员" prop="personnel">
+          <el-select
+            v-model="transfer_form.personnel"
+            placeholder="请选择转派人员"
+          >
+            <el-option
+              v-for="item in transfer_list"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+    </simple-dialog>
     <!-- <simple-dialog
       title="流程跟踪"
       :visible="track_visible"
@@ -159,18 +197,21 @@ export default {
       page: 1,
       rows: 10,
       total: 0,
-      isCheck:false,
+      isCheck: false,
       // 职位判断转派用
       duty: "",
       //   搜索参数
       table_search: {},
       //   dialog 参数
+      transfer_visible: false,
       visible: false,
       edit_visible: false,
       approve_visible: false,
       track_visible: false,
-      edit_form: {
-        id:12
+      edit_form: {},
+      transfer_list: [],
+      transfer_form: {
+        personnel: "", // 转派人员
       },
       reload: 0,
       // 判断类型
@@ -184,6 +225,16 @@ export default {
           },
         ],
       },
+      // 转派规则
+      transfer_rules: {
+        personnel: [
+          {
+            required: true,
+            message: "请选择转派人员",
+            trigger: "change",
+          },
+        ],
+      },
       // 审批意见
       approveForm: { comments: "" },
       trackList: [],
@@ -277,11 +328,24 @@ export default {
     this.handleInit({
       ...this.table_search,
       page: this.page,
-      pagesize: this.rows,
+      pageSize: this.rows,
     });
     // 职位
     this.duty = JSON.parse(sessionStorage.userInfo).duty;
+    // 根据职位判定  科室经理7、分管副总 5 、总经理 10 、职员 1  3,4
     console.log(this.duty, "duty");
+    switch (this.duty) {
+      // 科室经理
+      case "7":
+        this.type = "1";
+        break;
+      case "3":
+        this.type = "2";
+        break;
+      case "4":
+        this.type = "2";
+        break;
+    }
   },
   methods: {
     //   初始化
@@ -296,6 +360,44 @@ export default {
       }).then(({ data: { data } }) => {
         console.log(data);
         this.table_list = data;
+        // this.table_list = [
+        //   {
+        //     id: 10,
+        //     templateName: "模板名称",
+        //     loginNameStr: "发起人",
+        //     status: "0",
+        //     reason: "填报事由",
+        //     precautions: "填报注意事项",
+        //     endTime: new Date(),
+        //   },
+        //   {
+        //     id: 11,
+        //     templateName: "模板名称",
+        //     loginNameStr: "发起人",
+        //     status: "1",
+        //     reason: "填报事由",
+        //     precautions: "填报注意事项",
+        //     endTime: new Date(),
+        //   },
+        //   {
+        //     id: 12,
+        //     templateName: "模板名称",
+        //     loginNameStr: "发起人",
+        //     status: "2",
+        //     reason: "填报事由",
+        //     precautions: "填报注意事项",
+        //     endTime: new Date(),
+        //   },
+        //   {
+        //     id: 13,
+        //     templateName: "模板名称",
+        //     loginNameStr: "发起人",
+        //     status: "3",
+        //     reason: "填报事由",
+        //     precautions: "填报注意事项",
+        //     endTime: new Date(),
+        //   },
+        // ];
       });
     },
     handleChange(page) {
@@ -303,14 +405,14 @@ export default {
       this.handleInit({
         ...this.table_search,
         page: this.page,
-        pagesize: this.rows,
+        pageSize: this.rows,
       });
     },
     // 搜索事件
     handleSearch(data) {
       this.table_search = data;
       this.page = 1;
-      this.handleInit({ ...data, page: this.page, pagesize: this.rows });
+      this.handleInit({ ...data, page: this.page, pageSize: this.rows });
     },
     // 编辑按钮
     handleEdit(row) {
@@ -324,6 +426,7 @@ export default {
       console.log(row, "row");
       this.visible = true;
       this.edit_visible = false;
+      this.edit_form = row;
     },
     handleDelete() {},
     // dialog事件
@@ -334,28 +437,108 @@ export default {
     handleTrack() {
       this.track_visible = true;
     },
+    // 转派的同意事件
+    transferConfirm() {
+      this.$refs["transfer_form"].validate((valid) => {
+        if (valid) {
+          this.transfer_visible = false;
+          // this.$http({
+          //   url: "/market/CMKIssued/CMKIssuedTransfer",
+          //   method: "post",
+          //   headers: {
+          //     "Content-Type": "application/json",
+          //   },
+          //   data: {
+          //     issuedId:Number(this.transfer_form.personnel),
+          //   },
+          // }).then((res) => {
+          //   console.log(res, "res");
+          // });
+        }
+      });
+    },
     handleTransfer() {
       console.log(this.edit_form, "prams");
-      // const object = {
-      //   ...JSON.parse(sessionStorage.global_data)[0],
-      //   department_status: "待审批",
-      // };
-      // sessionStorage.setItem("global_data", JSON.stringify([object]));
-      // const process_array = JSON.parse(sessionStorage.global_process);
-      // process_array.push({
-      //   link: "转派工单",
-      //   creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
-      //   explain: "",
-      // });
-      // sessionStorage.setItem("global_process", JSON.stringify(process_array));
-      // this.handleInit();
-      // this.handleCancel("visible");
-      // this.$message.success("转派成功");
+      this.transfer_visible = true;
+      let groupId = JSON.parse(sessionStorage.userInfo).groupId;
+      console.log(groupId, "groupId");
+      this.$http({
+        url: "/spfm/sysmgr/sysuserinfo/queryList",
+        method: "post",
+        headers: {
+          "Content-Type": "application/json",
+        },
+        data: {
+          groupId,
+        },
+      }).then((res) => {
+        console.log(res, "res");
+      });
     },
     handleTurn(type) {
+      // finish 结束 transfer 转派 back //打回 // agree 同意
+      let request = 0;
+      let reqdata = {
+        id: this.edit_form.id,
+        reviewOpinion: this.approveForm.comments,
+      };
+      switch (type) {
+        case "finish":
+          // 0.打回 3.结束
+          reqdata.status = "3";
+          break;
+        case "transfer":
+          if (this.duty === "7") {
+            reqdata.reviewType = 2;
+          } else {
+            reqdata.reviewType = 3;
+          }
+          break;
+        case "back":
+          reqdata.status = "0";
+          break;
+        case "agree":
+          reqdata.status = "3";
+          break;
+      }
+      console.log(reqdata, "reqdata");
+      this.handleInit({
+        ...this.table_search,
+        page: this.page,
+        pageSize: this.rows,
+      });
+      this.handleCancel("visible");
       this.handleCancel("approve_visible");
-      console.log(type);
+      if (request) {
+        // 这里调接口
+        this.$http({
+          url: "/market/CMKIssued/CMKIssuedCheck",
+          method: "post",
+          headers: {
+            "Content-Type": "application/json",
+          },
+          data: reqdata,
+        }).then((res) => {
+          console.log(res, "res");
+        });
+      }
+      // this.$http({
+      //   url: "/market/CMKIssued/CMKIssuedCheck",
+      //   method: "post",
+      //   headers: {
+      //     "Content-Type": "application/json",
+      //   },
+      //   data: {
+      //     groupId,
+      //   },
+      // }).then((res) => {
+      //   console.log(res, "res");
+      //  this.handleInit()
+      // this.handleCancel("visible");
+      // this.handleCancel("approve_visible");
+      // });
     },
+
     handleConfirm(visible) {
       console.log(visible);
       this.track_visible = visible;
@@ -373,51 +556,56 @@ export default {
         case "track_visible":
           this.track_visible = false;
           break;
+        case "transfer_visible":
+          this.transfer_visible = false;
+          break;
       }
     },
-    handleBack() {
-      const object = {
-        ...JSON.parse(sessionStorage.global_data)[0],
-        department_status: "待处理",
-      };
-      sessionStorage.setItem("global_data", JSON.stringify([object]));
-      const process_array = JSON.parse(sessionStorage.global_process);
-      process_array.push({
-        link: "审批驳回",
-        creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
-        explain: this.approveForm.comments,
-      });
-      sessionStorage.setItem("global_process", JSON.stringify(process_array));
-      this.handleInit();
-      this.$message.success("打回成功");
-      this.handleCancel("visible");
-      this.handleCancel("approve_visible");
-    },
-    handleAgree() {
-      const object = {
-        ...JSON.parse(sessionStorage.global_data)[0],
-        department_status: "已完成",
-      };
-      sessionStorage.setItem("global_data", JSON.stringify([object]));
-      const process_array = JSON.parse(sessionStorage.global_process);
-      process_array.push({
-        link: "审批通过",
-        creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
-        explain: this.approveForm.comments,
-      });
-      sessionStorage.setItem("global_process", JSON.stringify(process_array));
-      this.handleInit();
-      this.$message.success("审批成功");
-      this.handleCancel("visible");
-      this.handleCancel("approve_visible");
-    },
+    // handleBack() {
+    //   const object = {
+    //     ...JSON.parse(sessionStorage.global_data)[0],
+    //     department_status: "待处理",
+    //   };
+    //   sessionStorage.setItem("global_data", JSON.stringify([object]));
+    //   const process_array = JSON.parse(sessionStorage.global_process);
+    //   process_array.push({
+    //     link: "审批驳回",
+    //     creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
+    //     explain: this.approveForm.comments,
+    //   });
+    //   sessionStorage.setItem("global_process", JSON.stringify(process_array));
+
+    //   // this.handleInit();
+    //   // this.$message.success("打回成功");
+    //   // this.handleCancel("visible");
+    //   // this.handleCancel("approve_visible");
+    // },
+    // handleAgree() {
+    //   const object = {
+    //     ...JSON.parse(sessionStorage.global_data)[0],
+    //     department_status: "已完成",
+    //   };
+    //   sessionStorage.setItem("global_data", JSON.stringify([object]));
+    //   const process_array = JSON.parse(sessionStorage.global_process);
+    //   process_array.push({
+    //     link: "审批通过",
+    //     creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
+    //     explain: this.approveForm.comments,
+    //   });
+    //   sessionStorage.setItem("global_process", JSON.stringify(process_array));
+    //   this.handleInit();
+    //   this.$message.success("审批成功");
+    //   this.handleCancel("visible");
+    //   this.handleCancel("approve_visible");
+    // },
     handleSubmit() {
+      // 提交好了
       let reqdata = {
         id: this.edit_form.id,
         templateContent: this.edit_form.templateContent,
       };
       console.log(reqdata, "reqdata");
-      // 提交好了
+
       // this.$http({
       //   url: "/CMKIssued/CMKIssuedSubmit",
       //   method: "post",