src/views/workreport/workreport.vue
@@ -1,8 +1,12 @@
<template>
  <basic-container
    :class="[$store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '']"
    :class="[
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :option="option"
      :table-loading="loading"
      :data="data"
@@ -50,7 +54,7 @@
  remove,
  update,
  add,
  getDetail,
  getDetail
} from "@/api/workreport/workreport";
import { getDept } from "@/api/system/dept";
import { mapGetters } from "vuex";
@@ -72,7 +76,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize,
        ...this.$store.state.control.changePageSize
      },
      selectionList: [],
      option: {
@@ -94,9 +98,9 @@
        menuWidth: 320,
        dialogClickModal: false,
        column: workreportColumn,
        ...this.$store.state.control.clearOtherBut,
        ...this.$store.state.control.clearOtherBut
      },
      data: [],
      data: []
    };
  },
  computed: {
@@ -106,21 +110,23 @@
        addBtn: this.vaildData(this.permission.workreport_add, false),
        viewBtn: this.vaildData(this.permission.workreport_view, false),
        delBtn: this.vaildData(this.permission.workreport_delete, false),
        editBtn: this.vaildData(this.permission.workreport_edit, false),
        editBtn: this.vaildData(this.permission.workreport_edit, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    ...mapState({
      userInfo: (state) => state.user.userInfo,
    }),
      userInfo: state => state.user.userInfo
    })
  },
  mounted() {},
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    rowSave(row, done, loading) {
      row.receivedIds = row.receivedIds.join(",");
@@ -131,11 +137,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -150,11 +156,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          window.console.log(error);
          loading();
        }
@@ -164,7 +170,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -173,7 +179,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -202,7 +208,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -211,14 +217,14 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -256,10 +262,10 @@
      ) {
        const column = that.findObject(that.option.column, "category");
        var code = {
          code: "securityWorkReportCategory",
          code: "securityWorkReportCategory"
        };
        getDictionaryBiz(code).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(
@@ -275,21 +281,22 @@
          // }
          let values = {
            ...params,
            ...params
          };
          this.loading = true;
          getListPage(page.currentPage, page.pageSize, values).then((res) => {
          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.$store.commit("setWindowSizeHeightAdd");
            this.selectionClear();
          });
        });
      } else if (this.userInfo.role_name == "公安管理员") {
        const column = that.findObject(that.option.column, "category");
        var code1 = { code: "workReportCategory" };
        getDictionaryBiz(code1).then((res) => {
        getDictionaryBiz(code1).then(res => {
          // column.dicUrl = "/api/blade-system/dict-biz/dictionary?code=workReportCategory";
          column.dicData = res.data.data;
          const columnReceivedIds = that.findObject(
@@ -305,28 +312,30 @@
          // }
          let values = {
            ...params,
            ...params
          };
          this.loading = true;
          getListPage(page.currentPage, page.pageSize, values).then((res) => {
          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.$store.commit("setWindowSizeHeightAdd");
            this.selectionClear();
          });
        });
      } else if (this.userInfo.role_name == "administrator") {
        getListPage(page.currentPage, page.pageSize, params).then((res) => {
        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.$store.commit("setWindowSizeHeightAdd");
          this.selectionClear();
        });
      }
    },
  },
    }
  }
};
</script>