From f2a74b0b28b74dc29be85ec8e6328bdd262f84b9 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Fri, 24 May 2024 14:35:58 +0800
Subject: [PATCH] 地址配置修改

---
 src/views/dispatch/dispatchChildoperable.vue |  122 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 118 insertions(+), 4 deletions(-)

diff --git a/src/views/dispatch/dispatchChildoperable.vue b/src/views/dispatch/dispatchChildoperable.vue
index 7cfd404..4657f17 100644
--- a/src/views/dispatch/dispatchChildoperable.vue
+++ b/src/views/dispatch/dispatchChildoperable.vue
@@ -12,6 +12,7 @@
       :data="data"
       :page.sync="page"
       ref="crudrec1"
+      :permission="permissionList"
       v-model="form"
       :table-loading="loading"
       :before-open="beforeOpen"
@@ -25,7 +26,39 @@
       @current-change="currentChange"
       @on-load="onLoad"
     >
+      <template slot="menuLeft">
+
+        <el-button
+          type="success"
+          size="small"
+          plain
+          icon="el-icon-upload2"
+          v-if="permission.dispatch_import"
+          @click="handleImport"
+        >批量导入
+        </el-button>
+      </template>
     </avue-crud>
+
+    <el-dialog
+      title="派遣单位导入"
+      append-to-body
+      :visible.sync="excelBox"
+      width="555px"
+    >
+      <avue-form
+        :option="excelOption"
+        v-model="excelForm"
+        :upload-after="uploadAfter"
+      >
+        <template slot="excelTemplate">
+          <el-button type="primary" @click="handleTemplate">
+            点击下载<i class="el-icon-download el-icon--right"></i>
+          </el-button>
+        </template>
+      </avue-form>
+    </el-dialog>
+
   </basic-container>
 </template>
 
@@ -40,6 +73,8 @@
 } from "@/api/dispatch/dispatch";
 import { update, getSecurityDispatcherTree } from "@/api/system/user";
 import { mapState } from "vuex";
+import { mapGetters } from "vuex";
+import {getToken} from "@/util/auth";
 
 export default {
   data() {
@@ -285,7 +320,61 @@
           }
         ]
       },
-      useifid: 266
+      useifid: 266,
+
+      excelBox: false,
+      excelForm: {},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: "模板上传",
+            prop: "excelFile",
+            type: "upload",
+            drag: true,
+            loadText: "模板上传中,请稍等",
+            span: 24,
+            propsHttp: {
+              res: "data"
+            },
+            tip: "请上传 .xls,.xlsx 标准格式文件",
+            action: "/api/dispatcher/import-dispatcher"
+          },
+          // {
+          //     label: "数据覆盖",
+          //     prop: "isCovered",
+          //     type: "switch",
+          //     align: "center",
+          //     width: 80,
+          //     dicData: [
+          //     {
+          //         label: "否",
+          //         value: 0,
+          //     },
+          //     {
+          //         label: "是",
+          //         value: 1,
+          //     },
+          //     ],
+          //     value: 0,
+          //     slot: true,
+          //     rules: [
+          //     {
+          //         required: true,
+          //         message: "请选择是否覆盖",
+          //         trigger: "blur",
+          //     },
+          //     ],
+          // },
+          {
+            label: "模板下载",
+            prop: "excelTemplate",
+            formslot: true,
+            span: 24
+          }
+        ]
+      },
     };
   },
   created() {
@@ -320,7 +409,7 @@
       column.value = that.userInfo.dept_id;
       this.useifid = this.userInfo.dept_id;
       this.initData(2);
-    } else if (roleName == "公安管理员" || roleName == "administrator") {
+    } else if (roleName == "公安管理员" || roleName == "administrator" || roleName == "民警") {
       var columnDept = that.findObject(that.option.column, "deptId");
       columnDept.dicUrl =
         "/api/blade-system/dept/security_lazy-tree?jurisdiction=" +
@@ -336,7 +425,15 @@
     }
   },
   computed: {
-    // },
+    ...mapGetters(["permission", "userInfo"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.dispatchChildoperable_add, false),
+        viewBtn: this.vaildData(this.permission.dispatchChildoperable_view, true),
+        delBtn: this.vaildData(this.permission.dispatchChildoperable_delete, false),
+        editBtn: this.vaildData(this.permission.dispatchChildoperable_edit, false)
+      };
+    },
     ids1() {
       let ids1 = [];
       this.selectionList1.forEach(ele => {
@@ -353,6 +450,23 @@
   },
 
   methods: {
+    handleTemplate() {
+      window.open(
+        `/api/dispatcher/export-template?${
+          this.website.tokenHeader
+        }=${getToken()}&`
+      );
+    },
+    handleImport() {
+      this.excelBox = true;
+    },
+    uploadAfter(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox = false;
+      this.refreshChange();
+      done();
+    },
+
     handleChangeTABS(column) {
       this.typeTABS = column;
       if (column.prop == "tab1") {
@@ -556,7 +670,7 @@
         values["deptId"] = this.useifid;
       }
       //公安局进入
-      if (this.userInfo.role_name == "公安管理员") {
+      if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警") {
         values["jurisdiction"] = this.userInfo.jurisdiction;
       }
       getdata1(

--
Gitblit v1.9.3