liuyg
2021-09-08 d356332a2003d00ca803b4e73dc404b9643b60d5
src/views/statisticalQueryManagement/securityGuardStatistics.vue
@@ -7,8 +7,6 @@
      :page.sync="page"
      :permission="permissionList"
      ref="crud"
      @row-update="rowUpdates"
      @row-save="rowSave"
      @search-change="searchChange"
      @search-reset="searchReset"
      @current-change="currentChange"
@@ -25,8 +23,11 @@
import FileSaver from "file-saver";
import XLSX from "xlsx";
import { mapGetters } from "vuex";
import { selectLi } from "../../api/statisticalQueryManagement/statisticalQueryManagement";
import { lazyTreeJu } from "../../api/index/index";
import {
  selectLi,
  dictionaryList
} from "../../api/statisticalQueryManagement/statisticalQueryManagement";
import { lazyTreeJu ,lazyTrees} from "../../api/index/index";
export default {
  name: "业务情况统计",
  data() {
@@ -102,13 +103,27 @@
            prop: "deptname",
            search: true,
            searchSpan: 4,
            width: 300,
            display: false
          },
          {
            label: "单位类型",
            prop: "stats",
            search: true,
            searchSpan: 4,
            display: false,
            type: "select",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            dicData: []
          },
          {
            label: "所属辖区",
            prop: "jurname",
            searchSpan: 4,
            type: "select",
            type: "tree",
            props: {
              label: "title",
              value: "value"
@@ -205,10 +220,11 @@
  },
  methods: {
    getSubOfficeData() {
      lazyTreeJu().then(res => {
      lazyTrees().then(res => {
        if (res.data.code === 200) {
          this.tableOption.column.forEach(item => {
            if (item.label == "所属辖区") {
              // let data = res.data.data;
              item.dicData = res.data.data;
            }
          });
@@ -217,37 +233,26 @@
        }
      });
    },
    rowSave(row, done, loading) {
      adddata(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
    // searchChildren(data) {
    //   data.forEach(item => {
    //     if(item.hasChildren)(
    //     )
    //     else {
    //       this.searchChildren()
    //     }
    //   });
    // },
    getDictionaryList() {
      dictionaryList().then(res => {
        if (res.data.code === 200) {
          this.tableOption.column.forEach(item => {
            if (item.label == "单位类型") {
              item.dicData = res.data.data;
            }
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdates(row, index, done, loading) {
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        },
        error => {
          window.console.log(error);
          loading();
        }
      );
      });
    },
    searchChange(params, done) {
      this.query = params;
@@ -262,69 +267,39 @@
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
      this.onLoad(this.page, this.query);
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.onLoad(this.page, this.query);
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      this.loading = true;
      // if (!params) {
      //   params = { current: page.currentPage, size: page.pageSize };
      // }
      let param = {};
      param["jurisdiction"] = params["jurname"] ? params["jurname"] : "";
      param["deptid"] =  "";
      param["jurisdiction"] = params["jurname"] || "";
      param["deptid"] = params["deptname"] || "";
      param["stats"] = params["stats"] || "";
      param["current"] = page.currentPage;
      param["size"] = page.pageSize;
      selectLi(param).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.tableData = res.data.data;
        // this.data = data.records;
        console.log(this.data);
        this.tableData = data.records;
        this.loading = false;
        // this.selectionClear();
      });
    },
    // toCompanyDetails() {
    //   this.$router.push({ path: "/statisticalQueryManagement/companyDetails" });
    // },
    handleRowClick(row, event, column) {
      this.$router.push({ path: "/statisticalQueryManagement/companyDetails" });
    },
    // getTableData() {
    //   selectLi({ current: 1, size: 10 }).then(res => {
    //     if (res.data.code === 200) {
    //       this.tableData = res.data.data;
    //       this.loading = false;
    //     }
    //   });
    // }
    // downExcel() {
    //   let et = XLSX.utils.table_to_book(document.getElementById("table"));
    //   let etout = XLSX.write(et, {
    //     bookType: "xlsx",
    //     bookSST: true,
    //     type: "array"
    //   });
    //   try {
    //     FileSaver.saveAs(
    //       new Blob([etout], {
    //         type: "application/octet-stream"
    //       }),
    //       `表.xlsx`
    //     ); //导出的文件名
    //   } catch (e) {
    //     console.log(e, etout);
    //   }
    //   return etout;
    // }
      this.$router.push({
        path: "/statisticalQueryManagement/companyDetails?deptid=" + row.dept_id
      });
    }
  },
  mounted() {
    this.getSubOfficeData();
    this.getDictionaryList();
  }
};
</script>