Administrator
2022-01-12 21c7375b7b38ebf2c8a2ca8fbf6fe9fb4f28250f
src/views/workreport/workreport.vue
@@ -1,5 +1,7 @@
<template>
  <basic-container class="workreply">
  <basic-container
    :class="[$store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '']"
  >
    <avue-crud
      :option="option"
      :table-loading="loading"
@@ -52,7 +54,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 {
@@ -70,6 +72,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
      },
      selectionList: [],
      option: {
@@ -91,6 +94,7 @@
        menuWidth: 320,
        dialogClickModal: false,
        column: workreportColumn,
        ...this.$store.state.control.clearOtherBut,
      },
      data: [],
    };
@@ -245,39 +249,82 @@
      //     ? (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) => {
        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();
          });
        });
      } else 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();
          });
        });
      } else if (this.userInfo.role_name == "administrator") {
        getListPage(page.currentPage, page.pageSize, params).then((res) => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      // });
      }
    },
  },
};