From 21c7375b7b38ebf2c8a2ca8fbf6fe9fb4f28250f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 12 Jan 2022 10:59:40 +0800
Subject: [PATCH] 新增公司注册机公司注册审核

---
 src/views/dispatch/dispatch.vue |  259 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 201 insertions(+), 58 deletions(-)

diff --git a/src/views/dispatch/dispatch.vue b/src/views/dispatch/dispatch.vue
index 806c805..06b2a61 100644
--- a/src/views/dispatch/dispatch.vue
+++ b/src/views/dispatch/dispatch.vue
@@ -1,6 +1,11 @@
 <template>
   <basic-container>
-    <div class="dispatch">
+    <div
+      :class="[
+        'dispatch',
+        $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
+      ]"
+    >
       <!-- <avue-tabs :option="optionTABS" @change="handleChangeTABS"></avue-tabs>
     <span v-if="typeTABS.prop === 'tab1'"> -->
       <avue-crud
@@ -95,7 +100,7 @@
       <!-- <span v-else-if="typeTABS.prop === 'tab3'">选项卡内容3</span> -->
     </div>
   </basic-container>
-</template> 
+</template>
 
 <script>
 import {
@@ -112,6 +117,15 @@
 import { mapState } from "vuex";
 export default {
   data() {
+    var phones = (rule, value, callback) => {
+      window.yanzhengphons =
+        /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/;
+      if (!yanzhengphons.test(value)) {
+        callback(new Error("请输入正确电话"));
+      } else {
+        callback();
+      }
+    };
     return {
       typeTABS: {}, //标签页
       deptId: "",
@@ -141,6 +155,7 @@
         pageSize: 10,
         currentPage: 1,
         total: 0,
+        ...this.$store.state.control.changePageSize,
       },
       query: {},
       data: [],
@@ -199,7 +214,6 @@
       },
       option: {
         tip: false,
-        // card: true,
         index: true,
         searchSize: "mini",
         searchMenuSpan: 6,
@@ -207,8 +221,8 @@
         menuWidth: 160,
         align: "center",
         selection: true,
+        ...this.$store.state.control.clearOtherBut,
         column: [
-          //派遣服务公司登记
           {
             label: "派遣单位名称",
             prop: "name",
@@ -217,41 +231,61 @@
             overHidden: true,
             searchSpan: 4,
             width: 210,
-            // span: 12,
-            labelWidth: 118,
+            labelWidth: 138,
+            rules: [
+              {
+                required: true,
+                message: "请输入派遣单位名称",
+                trigger: "click",
+              },
+            ],
           },
           {
-            label: "保安公司",
+            label: "派遣单位类型",
+            prop: "district",
+            type: "select",
+            search: false,
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=dispatcherUnitType",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            searchLabelWidth: 110,
+            overHidden: true,
+            searchSpan: 4,
+            width: 100,
+            labelWidth: 138,
+            rules: [
+              {
+                required: true,
+                message: "请选择派遣单位类型",
+                trigger: "click",
+              },
+            ],
+            dataType: "number",
+          },
+          {
+            label: "企业名称",
             prop: "deptId",
             type: "tree",
             overHidden: true,
-            dicUrl:
-              "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697",
+            dicUrl: "",
             props: {
               label: "title",
               value: "id",
             },
-            // hide: true,
-            // hide: !website.tenantMode,
-            // addDisplay: website.tenantMode,
-            // editDisplay: website.tenantMode,
-            // viewDisplay: website.tenantMode,
             rules: [
               {
                 required: true,
-                message: "请选择保安公司",
+                message: "请选择企业名称",
                 trigger: "click",
               },
             ],
-            labelWidth: 118,
-            width: 230,
+            labelWidth: 138,
+            width: 180,
             searchLabelWidth: 80,
             search: true,
             searchSpan: 4,
-            // editDisplay: false,
-            // addDisplay: false,
-            // hide: true,
-            // span: 11,
           },
           {
             label: "保安服务类型",
@@ -261,7 +295,7 @@
             searchSpan: 4,
             overHidden: true,
             // span: 12,
-            labelWidth: 118,
+            labelWidth: 138,
           },
           {
             label: "合同生效时间",
@@ -294,7 +328,8 @@
             search: true,
             searchSpan: 4,
             overHidden: true,
-            labelWidth: 118,
+            labelWidth: 138,
+            parent: false,
             type: "tree",
             dicUrl: "/api/jurisdiction/lazy-tree",
             props: {
@@ -305,7 +340,7 @@
             slot: true,
             rules: [
               {
-                required: true,
+                required: false,
                 message: "请选择所属辖区",
                 trigger: "click",
               },
@@ -320,7 +355,8 @@
             editDisplay: false,
             viewDisplay: false,
             overHidden: true,
-            labelWidth: 118,
+            labelWidth: 138,
+            width:100,
             type: "tree",
             dicUrl: "/api/jurisdiction/lazy-tree",
             props: {
@@ -331,62 +367,159 @@
             slot: true,
             rules: [
               {
-                required: true,
+                required: false,
                 message: "请选择所属辖区",
                 trigger: "click",
               },
             ],
           },
-          // {
-          //   label: " 派遣人数",
-          //   prop: "num",
-          //   labelWidth: 118,
-          // },
+          {
+            label: " 派遣单位地址",
+            prop: "address",
+            labelWidth: 138,
+          },
           {
             label: "合同开始时间",
             prop: "startTime",
-            labelWidth: 118,
+            labelWidth: 138,
             type: "date",
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd",
             // search: true,
-            // searchSpan: 4,
-            // overHidden: true
+            rules: [
+              {
+                required: true,
+                message: "请选择开始时间",
+                trigger: "click",
+              },
+            ],
           },
           {
             label: "合同结束时间",
             prop: "endTime",
-            labelWidth: 118,
+            labelWidth: 138,
             type: "date",
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd",
             // search: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择结束时间",
+                trigger: "click",
+              },
+            ],
             // searchSpan: 4,
             // overHidden: true
           },
           {
-            label: " 负责人",
+            label: " 派遣单位联系人",
             prop: "linkman",
-            labelWidth: 118,
+            labelWidth: 138,
+            // rules: [
+            //   {
+            //     required: true,
+            //     message: "请输入派遣单位联系人",
+            //     trigger: "click",
+            //   },
+            // ],
+          },
+          {
+            label: "派遣单位联系方式",
+            prop: "phone",
+            labelWidth: 138,
+            width: 130,
+          },
+          {
+            label: " 负责人",
+            prop: "securityLinkman",
+            labelWidth: 138,
+            rules: [
+              {
+                required: true,
+                message: "请输入负责人",
+                trigger: "click",
+              },
+            ],
           },
           {
             label: "负责人联系方式",
-            prop: "phone",
-            labelWidth: 118,
+            prop: "cell",
+            labelWidth: 138,
             width: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入联系方式",
+                trigger: "click",
+              },
+              // {
+              //   validator: phones,
+              //   trigger: ["change", "blur"],
+              // },
+            ],
+          },
+          
+          {
+            label: "派遣保安员数",
+            prop: "num",
+            type: "number",
+            labelWidth: 138,
+            width: 110,
+            rules: [
+              {
+                required: true,
+                message: "请输入派遣保安员数",
+                trigger: "click",
+              },
+            ],
           },
         ],
       },
+
+      useifid: 266,
     };
   },
   created() {
-    if (this.userInfo.role_name == "保安公司管理员") {
-      const deptColumn = this.findObject(this.option.column, "deptId");
-      deptColumn.search = false;
-      deptColumn.addDisplay = false;
-      deptColumn.editDisplay = false;
-      deptColumn.viewDisplay = false;
-      deptColumn.hide = true;
+    var that = this;
+    var roleName = this.userInfo.role_name;
+    // if (this.userInfo.role_name == "保安公司管理员") {
+    //   const deptColumn = this.findObject(this.option.column, "deptId");
+    //   deptColumn.search = false;
+    //   deptColumn.addDisplay = false;
+    //   deptColumn.editDisplay = false;
+    //   deptColumn.viewDisplay = false;
+    //   deptColumn.hide = true;
+    //   this.useifid = this.userInfo.dept_id;
+    // }
+
+    if (
+      roleName == "保安公司管理员" ||
+      roleName == "保安" ||
+      roleName == "分公司管理员"
+    ) {
+      //查询保安单位信息(包含子级)
+      const column = this.findObject(this.option.column, "deptId");
+      // column.search = false;
+      //默认全部展开
+      column.defaultExpandAll = true;
+      column.dicUrl =
+        "/api/blade-system/dept/security_lazy-tree?deptId=" +
+        this.userInfo.dept_id;
+      //赋值
+      column.value = that.userInfo.dept_id;
+      this.useifid = this.userInfo.dept_id;
+    } else if (roleName == "公安管理员" || roleName == "administrator") {
+      var columnDept = that.findObject(that.option.column, "deptId");
+      columnDept.dicUrl =
+        "/api/blade-system/dept/security_lazy-tree?jurisdiction=" +
+        that.userInfo.jurisdiction;
+    } else {
+      //查询保安单位信息(包含子级)
+      const column = this.findObject(this.option.column, "deptId");
+      // column.search = false;
+      //默认全部展开
+      column.dicUrl = "/api/blade-system/dept/security_lazy-tree";
     }
   },
   computed: {
@@ -405,9 +538,9 @@
       });
       return ids1.join(",");
     },
-        ...mapState({
+    ...mapState({
       userInfo: (state) => state.user.userInfo,
-        })
+    }),
   },
   methods: {
     handleChangeTABS(column) {
@@ -436,7 +569,9 @@
       //   this.$message.success("页码" + val);
     },
     rowSave(form, done, loading) {
-      form["deptId"] = this.userInfo.dept_id;
+      if (this.useifid != 266) {
+        form["deptId"] = this.useifid;
+      }
       adddata(form).then(
         (res) => {
           this.onLoad(this.page);
@@ -464,6 +599,9 @@
       this.onLoad(this.page);
     },
     rowUpdate(row, index, done, loading) {
+      if (this.useifid != 266) {
+        row["deptId"] = this.useifid;
+      }
       update(row).then(
         () => {
           this.onLoad(this.page);
@@ -525,14 +663,10 @@
       this.onLoad(this.page, this.query);
     },
     rowClick(row) {
-      // console.log(row);
       window.localStorage.setItem("paqiandata", JSON.stringify(row));
       this.$router.push({
         path: "/dispatchChild",
-        // redirect: { name: "foo" },
-        // query: { row: row },
         query: { rowdispatch: "fromDispatch" },
-        // params: { row: row.identificationnumber },
       });
     },
     getStartTime() {
@@ -575,22 +709,31 @@
           ...this.query,
         };
       }
-
-      console.log(values);
-
+      if (this.useifid != 266) {
+        values["deptId"] = this.useifid;
+      }
+      if (this.userInfo.role_name == "公安管理员") {
+        values["jurisdiction"] = that.userInfo.jurisdiction;
+      }
       getdata(
         page.currentPage,
         page.pageSize,
         // Object.assign(params, this.query)
         values
       ).then((res) => {
-        // console.log(res);
         const data = res.data.data;
         this.page.total = data.total;
         this.data = data.records;
         for (var k in this.data) {
           // this.data[k]["deptId"] = that.userInfo.dept_id;
           this.data[k]["tenantName"] = that.userInfo.user_name;
+          // console.log(this.data[k], 123456);
+          if (this.data[k].num == -1) {
+            this.data[k].num = null;
+          }
+          if (this.data[k].district == -1) {
+            this.data[k].district = null;
+          }
         }
         window.localStorage.setItem("paqiandataS", JSON.stringify(this.data));
         this.loading = false;
@@ -634,4 +777,4 @@
 .el-collapse-item {
   padding-top: 15px !important;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3