保安服务企业管理项目备份
liuyg
2021-09-27 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed
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 {
@@ -79,7 +79,7 @@
        tip: false,
        searchShow: true,
        searchMenuSpan: 6,
        border: false,
        border: true, //liu
        addBtnText: "发起",
        saveBtnText: "发起",
        addTitle: "发起",
@@ -239,40 +239,88 @@
      ).content.user_id;
      var that = this;
      getDept(this.deptId).then((res) => {
        var deptCategory = res.data.data.deptCategory;
        deptCategory == 1
          ? (that.deptCategory = true)
          : (that.deptCategory = false);
      // getDept(this.deptId).then((res) => {
      //   var deptCategory = res.data.data.deptCategory;
      //   deptCategory == 1
      //     ? (that.deptCategory = true)
      //     : (that.deptCategory = false);
        //1:保安公司  2:公安  3:培训公司
        if(deptCategory == 1 || deptCategory == 3){
             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(deptCategory == 2){
             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();
        });
      });
      }
    },
  },
};