From 43cf39c8e20a423537015d8ff459f5db32ac4fcb Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Thu, 25 Nov 2021 18:41:46 +0800
Subject: [PATCH] 逐级审批

---
 src/views/licenseApproval/securityPermit.vue |  186 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 179 insertions(+), 7 deletions(-)

diff --git a/src/views/licenseApproval/securityPermit.vue b/src/views/licenseApproval/securityPermit.vue
index 3e95252..1b5d5f9 100644
--- a/src/views/licenseApproval/securityPermit.vue
+++ b/src/views/licenseApproval/securityPermit.vue
@@ -3,7 +3,7 @@
  * @Author: liu
  * @Date: 2021-08-26 16:22:20 
  * @Last Modified by: liu
- * @Last Modified time: 2021-09-22 11:29:43
+ * @Last Modified time: 2021-11-25 18:39:39
  */
 
 <template>
@@ -55,7 +55,7 @@
             :size="size"
             :type="type"
             @click.stop="rowDel(row)"
-            v-if="row.type == '2'"
+            v-if="row.stateOur == '0'"
             >许可审批
           </el-button>
           <el-button
@@ -63,18 +63,24 @@
             :size="size"
             :type="type"
             @click.stop="viewLicense(row)"
-            v-if="row.type == '0'"
+            v-if="
+              row.papprove == '1' && row.xapprove == '1' && row.sapprove == '1'
+            "
             >打印许可证
           </el-button>
         </template>
         <template class="tdtype" slot-scope="{ row }" slot="type">
           <el-tag class="dtype">
             {{
-              row.type == "0" ? "通过" : row.type == "1" ? "不通过" : "待审核"
+              row.stateOur == "1"
+                ? "通过"
+                : row.stateOur == "2"
+                ? "不通过"
+                : "待审核"
             }}
-            <i class="gz" v-if="row.type == '2'"></i>
-            <i class="yj" v-if="row.type == '1'"></i>
-            <i class="zc" v-if="row.type == '0'"></i>
+            <i class="gz" v-if="row.stateOur == '0'"></i>
+            <i class="yj" v-if="row.stateOur == '2'"></i>
+            <i class="zc" v-if="row.stateOur == '1'"></i>
           </el-tag>
         </template>
       </avue-crud>
@@ -206,6 +212,19 @@
         </div>
       </div>
     </el-dialog>
+    <el-dialog
+      title=""
+      :visible.sync="dialogVisibleccsee"
+      width="30%"
+      :modal-append-to-body="false"
+    >
+      <div class="flots">
+        <div class="f_title">
+          审批 {{ stateOur == "1" ? "通过" : stateOur == "2" ? "不通过" : "" }}
+        </div>
+        <div><span>审批意见:</span> {{ stateText }}</div>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -265,6 +284,13 @@
         column: column,
       },
       data: [],
+
+      user_name: "",
+      stateOur: "",
+      stateText: "",
+      dialogVisibleccsee: false,
+
+      userData: "",
     };
   },
   computed: {
@@ -335,6 +361,73 @@
           console.log(error);
         }
       );
+    },
+    rowDel(row) {
+      this.dialogVisiblecc = true;
+      this.xukezData = row;
+    },
+    rowSee(row) {
+      this.dialogVisibleccsee = true;
+      this.stateOur = row.stateOur;
+      if (this.user_name == "派") {
+        // 派出所审批
+        this.stateText = row.popinion;
+      } else if (this.user_name == "县") {
+        // 分局审批
+        this.stateText = row.xopinion;
+      } else if (this.user_name == "市") {
+        // 市局审批
+        this.stateText = row.sopinion;
+      }
+    },
+    closecc() {
+      this.upsData("1", "0"); //通过
+    },
+    subcc() {
+      this.upsData("2", "1"); //不通过
+    },
+    upsData(state, type) {
+      let date = new Date(+new Date() + 8 * 3600 * 1000)
+        .toJSON()
+        .substr(0, 19)
+        .replace("T", " ");
+      // console.log(date);
+      // return;
+      this.dialogVisiblecc = false;
+      if (this.user_name == "派") {
+        // 派出所审批
+        this.xukezData.ptime = date;
+        this.xukezData.papprove = state;
+        this.xukezData.popinion = this.textareaShenpi;
+        this.xukezData.type = type == "0" ? "2" : "1"; // 为了保持审核系统识别
+      } else if (this.user_name == "县") {
+        // 分局审批
+        this.xukezData.xtime = date;
+        this.xukezData.xapprove = state;
+        this.xukezData.xopinion = this.textareaShenpi;
+        this.xukezData.type = type == "0" ? "2" : "1"; // 为了保持审核系统识别
+      } else if (this.user_name == "市") {
+        // 市局审批
+        this.xukezData.stime = date;
+        this.xukezData.sapprove = state;
+        this.xukezData.sopinion = this.textareaShenpi;
+        this.xukezData.permitime = new Date(+new Date() + 8 * 3600 * 1000)
+          .toJSON()
+          .substr(0, 19)
+          .replace("T", " ");
+        this.xukezData.type = type == "0" ? "0" : "1"; // 为了保持审核系统识别
+      }
+      // console.log(this.xukezData);
+      // return;
+      update(this.xukezData).then((res) => {
+        console.log(res);
+        this.$message({
+          type: "success",
+          message: "操作成功!",
+        });
+        this.refreshChange();
+        this.textareaShenpi = "";
+      });
     },
     rowDel(row) {
       this.dialogVisiblecc = true;
@@ -429,9 +522,72 @@
     refreshChange() {
       this.onLoad(this.page, this.query);
     },
+    getFenji(name) {
+      var d = {};
+      if (name == "派出所管理员") {
+        d = {
+          // papprove: 1,
+        };
+        this.user_name = "派";
+      } else if (name == "县局管理员") {
+        d = {
+          papprove: "1",
+        };
+        this.user_name = "县";
+      } else if (name == "市局管理员") {
+        d = {
+          xapprove: "1",
+        };
+        this.user_name = "市";
+      }
+      return d;
+    },
+    changeState(data) {
+      var b = data;
+      if (this.user_name == "派") {
+        // 派出所审批
+        b["stateOur"] = b.papprove == "0" ? "0" : b.papprove == "1" ? "1" : "2";
+      } else if (this.user_name == "县") {
+        // 分局审批
+        b["stateOur"] = b.xapprove == "0" ? "0" : b.xapprove == "1" ? "1" : "2";
+      } else if (this.user_name == "市") {
+        // 市局审批
+        b["stateOur"] = b.sapprove == "0" ? "0" : b.sapprove == "1" ? "1" : "2";
+      }
+      // console.log(this.user_name);
+      return b;
+    },
     onLoad(page, params = {}) {
       this.loading = true;
       params["ptype"] = 0;
+      var gonganj = "";
+      console.log(this.userInfo);
+      if (this.userInfo.role_name == "公安管理员") {
+        let test = /派出所$/g;
+        if (test.test(this.userInfo.list.name)) {
+          gonganj = "派出所管理员";
+        }
+        test = /分局|公安局$/g;
+        if (test.test(this.userInfo.list.name)) {
+          gonganj = "县局管理员";
+        }
+        test = /市公安局$/g;
+        if (test.test(this.userInfo.list.name)) {
+          gonganj = "市局管理员";
+        }
+      }
+      // console.log(gonganj, 23);
+      this.userData =
+        gonganj == "派出所管理员" ? "2" : gonganj == "县局管理员" ? "1" : "0";
+      params = {
+        ...params,
+        ...this.getFenji(gonganj),
+      };
+      console.log(params, "params");
+      params["jurisdiction"] = this.userInfo.jurisdiction;
+      // params["usetype"] = this.userData;
+      // this.option.column[this.option.column.length - 2].prop = "opinionOur";
+      // return;
       getList(
         page.currentPage,
         page.pageSize,
@@ -440,6 +596,22 @@
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
+        for (var k in this.data) {
+          // console.log(this.changeState(this.data[k]));
+          this.data[k] = this.changeState(this.data[k]);
+          let paichusuoyijian = this.data[k].popinion
+            ? "派出所意见:" + this.data[k].popinion + ";"
+            : "";
+          let fenjuijian = this.data[k].xopinion
+            ? "分局意见:" + this.data[k].xopinion + ";"
+            : "";
+          let shijuyijian = this.data[k].sopinion
+            ? "市局意见:" + this.data[k].sopinion + ";"
+            : "";
+          this.data[k]["opinionOur"] =
+            paichusuoyijian + fenjuijian + shijuyijian;
+        }
+        console.log(this.data);
         this.loading = false;
         this.selectionClear();
       });

--
Gitblit v1.9.3