From d692738bc337f86307939a728c21720de268be9b Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 30 Aug 2021 16:55:53 +0800
Subject: [PATCH] 工作汇报修改

---
 src/views/workreport/workreport.vue |  101 +++++++++++++++++--------
 src/api/system/dict.js              |  130 +++++++++++++++++---------------
 2 files changed, 138 insertions(+), 93 deletions(-)

diff --git a/src/api/system/dict.js b/src/api/system/dict.js
index 572f1da..c269898 100644
--- a/src/api/system/dict.js
+++ b/src/api/system/dict.js
@@ -1,89 +1,97 @@
 import request from '@/router/axios';
 
 export const getList = (current, size, params) => {
-  return request({
-    url: '/api/blade-system/dict/list',
-    method: 'get',
-    params: {
-      ...params,
-      current,
-      size,
-    }
-  })
+    return request({
+        url: '/api/blade-system/dict/list',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size,
+        }
+    })
 }
 
 export const getParentList = (current, size, params) => {
-  return request({
-    url: '/api/blade-system/dict/parent-list',
-    method: 'get',
-    params: {
-      ...params,
-      current,
-      size,
-    }
-  })
+    return request({
+        url: '/api/blade-system/dict/parent-list',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size,
+        }
+    })
 }
 
 export const getChildList = (current, size, parentId, params) => {
-  return request({
-    url: '/api/blade-system/dict/child-list',
-    method: 'get',
-    params: {
-      ...params,
-      current,
-      size,
-      parentId: parentId,
-    }
-  })
+    return request({
+        url: '/api/blade-system/dict/child-list',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size,
+            parentId: parentId,
+        }
+    })
 }
 
 export const remove = (ids) => {
-  return request({
-    url: '/api/blade-system/dict/remove',
-    method: 'post',
-    params: {
-      ids,
-    }
-  })
+    return request({
+        url: '/api/blade-system/dict/remove',
+        method: 'post',
+        params: {
+            ids,
+        }
+    })
 }
 
 export const add = (row) => {
-  return request({
-    url: '/api/blade-system/dict/submit',
-    method: 'post',
-    data: row
-  })
+    return request({
+        url: '/api/blade-system/dict/submit',
+        method: 'post',
+        data: row
+    })
 }
 
 export const update = (row) => {
-  return request({
-    url: '/api/blade-system/dict/submit',
-    method: 'post',
-    data: row
-  })
+    return request({
+        url: '/api/blade-system/dict/submit',
+        method: 'post',
+        data: row
+    })
 }
 
 
 export const getDict = (id) => {
-  return request({
-    url: '/api/blade-system/dict/detail',
-    method: 'get',
-    params: {
-      id,
-    }
-  })
+    return request({
+        url: '/api/blade-system/dict/detail',
+        method: 'get',
+        params: {
+            id,
+        }
+    })
 }
 export const getDictTree = () => {
-  return request({
-    url: '/api/blade-system/dict/tree?code=DICT',
-    method: 'get'
-  })
+    return request({
+        url: '/api/blade-system/dict/tree?code=DICT',
+        method: 'get'
+    })
 }
 
 export const getDictionary = (params) => {
-  return request({
-    url: '/api/blade-system/dict/dictionary',
-    method: 'get',
-    params,
-  })
+    return request({
+        url: '/api/blade-system/dict/dictionary',
+        method: 'get',
+        params,
+    })
 }
+
+export const getDictionaryBiz = (params) => {
+    return request({
+        url: '/api/blade-system/dict-biz/dictionary',
+        method: 'get',
+        params,
+    })
+}
\ No newline at end of file
diff --git a/src/views/workreport/workreport.vue b/src/views/workreport/workreport.vue
index a955138..f28bb3c 100644
--- a/src/views/workreport/workreport.vue
+++ b/src/views/workreport/workreport.vue
@@ -52,7 +52,7 @@
 } from "@/api/workreport/workreport";
 import { getDept } from "@/api/system/dept";
 import { mapGetters } from "vuex";
-
+import { getDictionaryBiz } from "@/api/system/dict";
 export default {
   data() {
     return {
@@ -245,39 +245,76 @@
       //     ? (that.deptCategory = true)
       //     : (that.deptCategory = false);
 
-
-
-        //1:保安公司  2:公安  3:培训公司
-        if(this.userInfo.role_name=="保安公司管理员" 
-        || this.userInfo.role_name=="保安"
-        || this.userInfo.role_name=="未持证保安"
-        ){
-             const column = that.findObject(that.option.column, "category");
-             column.dicUrl = "/api/blade-system/dict-biz/dictionary?code=securityWorkReportCategory";
-             const columnReceivedIds = that.findObject(that.option.column, "receivedIds");
-             columnReceivedIds.dicUrl = "/api/blade-system/dept/lazy-tree-users?type={{key}}&deptId="+that.userInfo.dept_id;
-        }
-        if(this.userInfo.role_name=="公安管理员"){
-             const column = that.findObject(that.option.column, "category");
-             column.dicUrl = "/api/blade-system/dict-biz/dictionary?code=workReportCategory";
-             const columnReceivedIds = that.findObject(that.option.column, "receivedIds");
-             columnReceivedIds.dicUrl = "/api/blade-system/dept/lazy-tree-users?type={{key}}&deptId="+that.userInfo.dept_id;
-        }
-        params["deptId"] = this.deptId;
-        params["userId"] = this.userId;
-        // }
-        let values = {
-          ...params,
+      //1:保安公司  2:公安  3:培训公司
+      if (
+        this.userInfo.role_name == "保安公司管理员" ||
+        this.userInfo.role_name == "保安"
+      ) {
+        const column = that.findObject(that.option.column, "category");
+        var code = {
+          code: "securityWorkReportCategory",
         };
-        this.loading = true;
-        getListPage(page.currentPage, page.pageSize, values).then((res) => {
-          const data = res.data.data;
-          this.page.total = data.total;
-          this.data = data.records;
-          this.loading = false;
-          this.selectionClear();
+
+        getDictionaryBiz(code).then((res) => {
+          // column.dicUrl = "/api/blade-system/dict-biz/dictionary?code=securityWorkReportCategory";
+          column.dicData = res.data.data;
+          const columnReceivedIds = that.findObject(
+            that.option.column,
+            "receivedIds"
+          );
+          columnReceivedIds.dicUrl =
+            "/api/blade-system/dept/lazy-tree-users?type={{key}}&deptId=" +
+            that.userInfo.dept_id;
+
+          params["deptId"] = this.deptId;
+          params["userId"] = this.userId;
+          // }
+
+          let values = {
+            ...params,
+          };
+          this.loading = true;
+          getListPage(page.currentPage, page.pageSize, values).then((res) => {
+            const data = res.data.data;
+            this.page.total = data.total;
+            this.data = data.records;
+            this.loading = false;
+            this.selectionClear();
+          });
         });
-      // });
+      }
+      if (this.userInfo.role_name == "公安管理员") {
+        const column = that.findObject(that.option.column, "category");
+        var code1 = { code: "workReportCategory" };
+        getDictionaryBiz(code1).then((res) => {
+          // column.dicUrl = "/api/blade-system/dict-biz/dictionary?code=workReportCategory";
+          column.dicData = res.data.data;
+          const columnReceivedIds = that.findObject(
+            that.option.column,
+            "receivedIds"
+          );
+          columnReceivedIds.dicUrl =
+            "/api/blade-system/dept/lazy-tree-users?type={{key}}&deptId=" +
+            that.userInfo.dept_id;
+
+          params["deptId"] = this.deptId;
+          params["userId"] = this.userId;
+          // }
+
+          let values = {
+            ...params,
+          };
+          this.loading = true;
+          getListPage(page.currentPage, page.pageSize, values).then((res) => {
+            const data = res.data.data;
+            this.page.total = data.total;
+            this.data = data.records;
+            this.loading = false;
+            this.selectionClear();
+          });
+        });
+      }
+
     },
   },
 };

--
Gitblit v1.9.3