From 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 27 Sep 2021 11:44:44 +0800
Subject: [PATCH] 图表颜色

---
 src/views/securityEquipment/gun.vue |   88 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/src/views/securityEquipment/gun.vue b/src/views/securityEquipment/gun.vue
index 2eec3f4..897bc12 100644
--- a/src/views/securityEquipment/gun.vue
+++ b/src/views/securityEquipment/gun.vue
@@ -35,7 +35,9 @@
 import { data, column } from "./gun";
 import { getdata, adddata, update, remove } from "@/api/gun/gun";
 
+import { mapGetters } from "vuex";
 export default {
+  props: ["fromDeptId"],
   data() {
     return {
       loading: true,
@@ -56,12 +58,16 @@
         index: true,
         menuWidth: 160,
         align: "center",
+        border: true,
         selection: true,
+        labelWidth: 110,
         column: column,
       },
+      useifid: 266,
     };
   },
   computed: {
+    ...mapGetters(["userInfo"]),
     ids() {
       let ids = [];
       this.selectionList.forEach((ele) => {
@@ -69,6 +75,24 @@
       });
       return ids.join(",");
     },
+  },
+  created() {
+    var that = this;
+    if (
+      this.userInfo.role_name == "装备管理员" ||
+      this.userInfo.role_name == "保安公司管理员"
+    ) {
+      this.useifid = this.userInfo.dept_id;
+    }
+    //公安局进入
+    if (this.userInfo.role_name == "公安管理员") {
+      that.option.column[5].dicUrl =
+        "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
+        that.userInfo.jurisdiction;
+    } else {
+      that.option.column[5].dicUrl =
+        "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
+    }
   },
   methods: {
     sizeChange(val) {
@@ -87,8 +111,14 @@
       //   var form = this.data[0];
       //   delete form.id;
       //   for (var k = 0; k < 13; k++) {
-      form["deptId"] = form.tenantName;
-      delete form.tenantName;
+      // form["deptId"] = form.tenantName;
+      // delete form.tenantName;
+      if (this.fromDeptId != undefined) {
+        form["deptId"] = this.fromDeptId;
+      }
+      if (this.useifid != 266) {
+        form["deptId"] = this.useifid;
+      }
       adddata(form).then(
         (res) => {
           this.onLoad(this.page);
@@ -117,8 +147,14 @@
     },
     rowUpdate(row, index, done, loading) {
       // console.log(row);
-      row["deptId"] = row.tenantName;
-      delete row.tenantName;
+      // row["deptId"] = row.tenantName;
+      // delete row.tenantName;
+      if (this.fromDeptId != undefined) {
+        row["deptId"] = this.fromDeptId;
+      }
+      if (this.useifid != 266) {
+        row["deptId"] = this.useifid;
+      }
       update(row).then(
         () => {
           this.onLoad(this.page);
@@ -179,8 +215,52 @@
     refreshChange() {
       this.onLoad(this.page, this.query);
     },
+    closeDep(name) {
+      for (let k in this.option.column) {
+        if (this.option.column[k].prop == name) {
+          this.option.column[k].search = false;
+          this.option.column[k].hide = true;
+          this.option.column[k].addDisplay = false;
+          this.option.column[k].editDisplay = false;
+        }
+      }
+    },
+    openDep(name) {
+      for (let k in this.option.column) {
+        if (this.option.column[k].prop == name) {
+          this.option.column[k].search = true;
+          this.option.column[k].hide = false;
+          this.option.column[k].addDisplay = true;
+          this.option.column[k].editDisplay = true;
+        }
+      }
+    },
     onLoad(page, params = {}) {
       this.loading = true;
+      var that = this;
+      // console.log(params.deptId);
+      if (this.fromDeptId != undefined) {
+        params["deptId"] = this.fromDeptId;
+        // this.closeDep("deptId");
+      } else if (this.useifid != 266) {
+        console.log(123);
+        params["deptId"] = this.useifid;
+        // this.closeDep("deptId");
+        // for (let k in this.option.column) {
+        // if (this.option.column[k].prop == "deptId") {
+        // this.option.column[4].search = false;
+        // this.option.column[k].hide = true;
+        // this.option.column[k].addDisplay = false;
+        // this.option.column[k].editDisplay = false;
+        // }
+        // }
+      } else {
+        this.openDep("deptId");
+      }
+      //公安局进入
+      if (this.userInfo.role_name == "公安管理员") {
+        params["jurisdiction"] = that.userInfo.jurisdiction;
+      }
       getdata(
         page.currentPage,
         page.pageSize,

--
Gitblit v1.9.3