daiqisheng 3 gadi atpakaļ
vecāks
revīzija
efbdcc5940

+ 114 - 20
src/pages/main/performance/components/sheet.vue

@@ -2,7 +2,7 @@
  * @Author       : yuanrunwei
  * @Date         : 2021-12-04 14:23:58
  * @LastEditors: Please set LastEditors
- * @LastEditTime: 2022-01-23 19:41:44
+ * @LastEditTime: 2022-02-10 14:09:54
  * @FilePath     : \spfm-market-front\src\pages\main\performance\components\sheet.vue
 -->
 
@@ -140,7 +140,7 @@
       title="提交"
       :visible="manager_approve"
       :modal="false"
-      @cancel="handleApprove"
+      @cancel="handleApprove(0)"
     >
       <el-form :model="approveForm" label-width="120px">
         <el-form-item
@@ -287,11 +287,11 @@ export default {
     //     console.log(e,'e');
     // },
     handleAllow({ row, column }) {
-      return (
-        (!this.form.permission_type && this.type === "edit") ||
-        (this.row_list.includes(row) && this.column_list.includes(column)) ||
-        (this.status === "2" && this.type === "edit")
-      );
+      let public_permisson = (!this.form.permission_type && this.type === "edit")
+      let editable =  this.row_list.includes(row) && this.column_list.includes(column)
+      let isId = !this.id 
+      let totalBoolean = (public_permisson || editable) && !isId
+      return  totalBoolean
     },
     async handleQuery() {
       let url = "";
@@ -337,7 +337,7 @@ export default {
       this.template_id = templateId;
       this.issued_id = issuedId;
       this.addFlag = addFlag;
-      console.log(addFlag, "addFlag");
+      console.log(JSON.parse(templateContent), "123123");
       if (list && list.length) {
         const { type } = list[0];
         if (type === "1") {
@@ -587,10 +587,44 @@ export default {
       } else {
         // 职位
         let duty = JSON.parse(sessionStorage.userInfo).duty;
+        let { permission_type, charge } = this.form;
+        let reqdata = {};
+        if (permission_type) {
+          // 特殊权限
+          reqdata = {
+            ...reqdata,
+            rowIndex: this.paramsArr(
+              charge[0].row_start - 1,
+              charge[0].row_end - 1
+            ),
+            rowContent: this.paramsArr(
+              charge[0].row_start - 1,
+              charge[0].row_end - 1
+            )
+              .split(",")
+              .map((el) => {
+                return data.data[el];
+              }),
+          };
+        } else {
+          // 公共权限
+          const RowList = [];
+          const RowContent = [];
+          data.data.forEach((item, rowIndex) => {
+            if (this.confirmArrayData(item)) {
+              RowList.push(rowIndex);
+              RowContent.push(item);
+            }
+          });
+          reqdata = {
+            ...reqdata,
+            rowIndex: RowList.join(","),
+            rowContent: RowContent,
+          };
+        }
         if (duty === "7") {
           this.manager_approve = true;
         } else {
-          // 员工提交
           if (type === "2") {
             // 暂存
             await this.$http({
@@ -609,8 +643,9 @@ export default {
             this.$emit("save");
             return;
           }
+          // 员工提交
           await this.$http({
-            url: edit_url, // 新增
+            url: edit_url, //提交
             method: "post",
             headers: {
               "Content-Type": "application/json",
@@ -620,12 +655,35 @@ export default {
               templateContent: JSON.stringify(data),
               templateName: workbook_name,
               issuedId: this.issued_id,
+              rowJson: JSON.stringify(reqdata),
             },
           });
           this.$emit("save");
         }
       }
     },
+    // 判断数组是否有值
+    confirmArrayData(data) {
+      if (data instanceof Array) {
+        let flag = 0;
+        if (data.length) {
+          data.forEach((el) => {
+            if (el instanceof Object) {
+              flag = flag + 1;
+            }
+          });
+          if (flag) {
+            return true;
+          } else {
+            return false;
+          }
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    },
     handleAuth() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
@@ -673,21 +731,56 @@ export default {
       this.visible = !this.visible;
     },
     async handleApprove(type) {
-      if (this.approveForm.type) {
-        if (this.approveForm.type === "3" && !this.approveForm.comments) {
-          this.$message.error("请输入其他审批意见");
+      if (type) {
+        if (this.approveForm.type) {
+          if (this.approveForm.type === "3" && !this.approveForm.comments) {
+            this.$message.error("请输入其他审批意见");
+            return;
+          }
+        } else {
+          this.$message.error("请选择审批意见");
           return;
         }
-      } else {
-        this.$message.error("请选择审批意见");
-        return;
-      }
-      if (type) {
         const sheet_name = window.luckysheet.getSheet().name;
         const data = window.luckysheet.getSheet(sheet_name);
         const workbook_name = window.luckysheet.getWorkbookName();
+        let { permission_type, charge } = this.form;
+        let reqdata = {};
+        if (permission_type) {
+          // 特殊权限
+          reqdata = {
+            ...reqdata,
+            rowIndex: this.paramsArr(
+              charge[0].row_start - 1,
+              charge[0].row_end - 1
+            ),
+            rowContent: this.paramsArr(
+              charge[0].row_start - 1,
+              charge[0].row_end - 1
+            )
+              .split(",")
+              .map((el) => {
+                return data.data[el];
+              }),
+          };
+        } else {
+          // 公共权限
+          const RowList = [];
+          const RowContent = [];
+          data.data.forEach((item, rowIndex) => {
+            if (this.confirmArrayData(item)) {
+              RowList.push(rowIndex);
+              RowContent.push(item);
+            }
+          });
+          reqdata = {
+            ...reqdata,
+            rowIndex: RowList.join(","),
+            rowContent: RowContent,
+          };
+        }
         await this.$http({
-          url: "/market/CMKIssued/CMKIssuedSubmit", // 新增
+          url: "/market/CMKIssued/CMKIssuedSubmit", // 提交
           method: "post",
           headers: {
             "Content-Type": "application/json",
@@ -697,6 +790,7 @@ export default {
             templateContent: JSON.stringify(data),
             templateName: workbook_name,
             issuedId: this.issued_id,
+            rowJson: JSON.stringify(reqdata),
           },
         });
         let params = {
@@ -730,7 +824,7 @@ export default {
             break;
         }
         await this.$http({
-          url: "/market/CMKIssued/CMKIssuedCheck", // 新增
+          url: "/market/CMKIssued/CMKIssuedCheck", // 审批
           method: "post",
           headers: {
             "Content-Type": "application/json",

+ 15 - 13
src/pages/main/performance/department.vue

@@ -690,19 +690,21 @@ export default {
       console.log(row, "row");
       this.edit_form = row;
       this.edit_visible = false;
-      if (row.receiverId && row.receiverId.split(",").length > 1) {
-        this.menager_visible = true;
+      this.id = row.id;
+      this.visible = true;
+      // if (row.receiverId && row.receiverId.split(",").length > 1) {
+      //   this.menager_visible = true;
 
-        this.receiverList = row.receiverName
-          ? row.receiverId.split(",").map((el, index) => ({
-              label: row.receiverName.split(",")[index],
-              value: el,
-            }))
-          : [];
-      } else {
-        this.id = row.id;
-        this.visible = true;
-      }
+      //   this.receiverList = row.receiverName
+      //     ? row.receiverId.split(",").map((el, index) => ({
+      //         label: row.receiverName.split(",")[index],
+      //         value: el,
+      //       }))
+      //     : [];
+      // } else {
+      //   this.id = row.id;
+      //   this.visible = true;
+      // }
     },
     confirmManger() {
       this.visible = true;
@@ -736,7 +738,7 @@ export default {
       this.approve_visible = true;
     },
     handleTrack() {
-      this.track_visible = true;
+      this.track_visible = true
     },
     // 转派的增加或删除
     handleCharge(type) {