From 69b6b6e33b8458295a731b96c062f6cbdddebe58 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 13 Sep 2021 17:17:37 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/zhba_regulatory

---
 src/views/securityGuardManagement/register.vue |  189 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 141 insertions(+), 48 deletions(-)

diff --git a/src/views/securityGuardManagement/register.vue b/src/views/securityGuardManagement/register.vue
index 39c6757..a90f75f 100644
--- a/src/views/securityGuardManagement/register.vue
+++ b/src/views/securityGuardManagement/register.vue
@@ -2,7 +2,7 @@
  * @Author: Morpheus
  * @Date: 2021-07-05 16:31:54
  * @Last Modified by: liu
- * @Last Modified time: 2021-08-31 11:26:49
+ * @Last Modified time: 2021-09-10 16:47:56
  * menu-name 保安员注册查询
  */
 <template>
@@ -54,11 +54,21 @@
                     <template slot-scope="{row}"
                               slot="deptName">
                         <el-tag>{{row.deptName}}</el-tag>
-                    </template>
-                    <template slot-scope="{row}"
-                              slot="userTypeName">
-                        <el-tag>{{row.userTypeName}}</el-tag>
                     </template> -->
+            <template slot-scope="{ row }" slot="age">
+              {{ row.age == -1 ? "" : row.age }}
+            </template>
+            <template slot-scope="{ row }" slot="sex">
+              {{
+                row.sex == -1
+                  ? ""
+                  : row.sex == 1
+                  ? "男"
+                  : row.sex == 2
+                  ? "女"
+                  : ""
+              }}
+            </template>
             <template slot-scope="{ row }" slot="deptId">
               <el-tag
                 class="rowClickSelf"
@@ -86,6 +96,8 @@
                 :size="size"
                 :type="type"
                 class="zhengJian-icon"
+                :disabled="row.hold != 1"
+                :title="row.hold != 1 ? '暂无证件或已吊销' : ''"
                 @click.stop="handleViewCredentials(row)"
                 >打印证件</el-button
               >
@@ -95,6 +107,8 @@
                 :size="size"
                 :type="type"
                 class="zhengJian-icon"
+                :disabled="row.hold != 1"
+                :title="row.hold != 1 ? '暂无证件或已吊销' : ''"
                 @click.stop="handleCredentials(row)"
                 >证件吊销</el-button
               >
@@ -356,16 +370,64 @@
         lazy: true,
         treeLoad: function (node, resolve) {
           const parentId = node.level === 0 ? 0 : node.data.id;
-          getDeptLazyTree(parentId).then((res) => {
-            resolve(
-              res.data.data.map((item) => {
-                return {
-                  ...item,
-                  leaf: !item.hasChildren,
-                };
-              })
-            );
-          });
+
+
+
+          if (parentId == 0) {
+            getDeptLazyTree(parentId).then((res) => {
+
+              resolve(
+
+                res.data.data.map((item) => {
+
+                  return {
+                    ...item,
+                    leaf: !item.hasChildren,
+                  };
+
+                })
+
+              );
+
+            });
+          } else if (parentId == '1372091709474910209') {
+
+            getDeptLazyTree(parentId).then((res) => {
+
+              resolve(
+
+                res.data.data[0].children.map((item) => {
+
+                  return {
+                    ...item,
+                    leaf: !item.hasChildren,
+                  };
+
+                })
+
+              );
+
+            });
+          } else {
+            getDeptLazyTree(parentId).then((res) => {
+              res.data.data = [];
+              resolve(
+
+                res.data.data.map((item) => {
+
+                  return {
+                    ...item,
+                    leaf: !item.hasChildren,
+                  };
+
+                })
+
+              );
+
+            });
+          }
+
+
         },
         addBtn: false,
         menu: false,
@@ -430,6 +492,7 @@
             label: "性别",
             prop: "sex",
             width: 55,
+            slot: true,
             type: "select",
             dicData: [
               {
@@ -485,6 +548,7 @@
             label: "年龄",
             prop: "age",
             width: 55,
+            slot: true,
             display: false,
           },
           {
@@ -576,11 +640,25 @@
             searchSpan: 3,
             width: 72,
             display: false,
-            dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
-            props: {
-              label: "dictValue",
-              value: "dictKey",
-            },
+            dicData: [
+              {
+                label: "是",
+                value: "1",
+              },
+              {
+                label: "否",
+                value: "2",
+              },
+              {
+                label: "已吊销",
+                value: "3",
+              },
+            ],
+            // dicUrl: "/api/blade-system/dict-biz/dictionary?code=equipage",
+            // props: {
+            //   label: "dictValue",
+            //   value: "dictKey",
+            // },
             type: "select",
             rules: [
               {
@@ -752,9 +830,21 @@
     submitf(form, done) {
       console.log(form);
       // this.$message.success(JSON.stringify(form));
-      addhonor(form).then((res) => {
-        console.log(res);
-      });
+      addhonor(form).then(
+        (res) => {
+          // console.log(res);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        },
+        (error) => {
+          this.$message({
+            type: "info",
+            message: "操作失败",
+          });
+        }
+      );
       this.objf = {};
       this.dialogVisible = false;
       done();
@@ -834,11 +924,11 @@
     searchChange(params, done) {
       this.query = params;
       this.page.currentPage = 1;
-      var deptId;
+      // var deptId;
       if (params.deptId) {
-        deptId = params.deptId;
+        this.query["deptId"] = params.deptId;
       }
-      this.onLoad(this.page, params, deptId);
+      this.onLoad(this.page, params);
       done();
     },
     selectionChange(list) {
@@ -889,27 +979,27 @@
     refreshChange() {
       this.onLoad(this.page, this.query);
     },
-    onLoad(page, params = {}, deptId) {
+    onLoad(page, params = {}) {
       this.loading = true;
       params["jurisdiction"] = this.jurisdiction;
+      console.log(params, 1, this.query, 2);
       getListSecurity(
         page.currentPage,
         page.pageSize,
-        Object.assign(params, this.query),
-        deptId
+        Object.assign(params, this.query)
       ).then((res) => {
         const data = res.data.data;
         this.page.total = data.total;
-        var d = data.records;
-        var date = new Date();
-        var datayear = date.getFullYear();
-        for (const key in d) {
-          var year = d[key].cardid.slice(6, 10);
-          d[key]["age"] = +datayear - +year;
-          // d[key].securitynumber = "赣洪202100009";
-        }
+        // var d = data.records;
+        // var date = new Date();
+        // var datayear = date.getFullYear();
+        // for (const key in d) {
+        //   var year = d[key].cardid.slice(6, 10);
+        //   d[key]["age"] = +datayear - +year;
+        //   // d[key].securitynumber = "赣洪202100009";
+        // }
         this.data = data.records;
-        console.log(this.data);
+        // console.log(this.data);
         this.loading = false;
         this.selectionClear();
       });
@@ -961,43 +1051,46 @@
       // this.$Print("#certificatess");
       this.objVisiblecertificates = obj;
       console.log(this.objVisiblecertificates);
-      getER(this.obj.securitynumber).then((res) => {
+      getER(this.objVisiblecertificates.securitynumber).then((res) => {
         this.erweima = res.data;
         // console.log(res.data);
       });
     },
     // 证件吊销事件
     handleCredentials(row) {
-      if (row.hold == 1) {
+      console.log(row);
+      // return;
+      if (row.hold == 2) {
         this.$message({
           type: "info",
           message: "证件未拥有!",
         });
-      } else if (row.hold == 2) {
+      } else if (row.hold == 3) {
         this.$message({
           type: "info",
           message: "证件已吊销!",
         });
-      } else {
+      } else if (row.hold == 1) {
         this.$confirm("是否吊销该人员的证件?", "提示", {
           confirmButtonText: "是",
           cancelButtonText: "否",
           type: "warning",
         })
           .then(() => {
-            updateHold(2, row.cardid).then((res) => {
+            updateHold(3, row.cardid).then((res) => {
               console.log(res);
               this.$message({
                 type: "success",
-                message: "删除成功!",
+                message: "吊销成功!",
               });
+              this.refreshChange();
             });
           })
           .catch(() => {
-            this.$message({
-              type: "info",
-              message: "已取消删除",
-            });
+            // this.$message({
+            //   type: "info",
+            //   message: "已取消删除",
+            // });
           });
       }
     },

--
Gitblit v1.9.3