zhongrj
2024-03-27 cc1c0a396698648256c350f6f0fe2cb2f0b02c7e
src/views/statisticalQueryManagement/businessStatisticsDetail.vue
@@ -1,29 +1,44 @@
<template>
  <basic-container>
  <basic-container class="businessDetail">
    <avue-crud
      :option="tableOption"
      :data="tableData"
      :page.sync="tablePage"
      :table-loading="loading"
      :data="tableData"
      :page.sync="page"
      :permission="permissionList"
      :before-open="beforeOpen"
      @date-change="dateChange"
      ref="crud"
      @row-update="rowUpdates"
      @row-save="rowSave"
      @search-change="searchChange"
      @search-reset="searchReset"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
    </avue-crud>
  </basic-container>
</template>
<script>
// import FileSaver from "file-saver";
// import XLSX from "xlsx";
import { mapGetters } from "vuex";
import {
  selectDis,
  selectFw
  selectFw,
  fwList,
  dispatcherUnit
} from "../../api/statisticalQueryManagement/statisticalQueryManagement";
import { lazyTreeJu, lazyTrees } from "../../api/index/index";
export default {
  name: "业务情况统计明细",
  props: ["fwdeptId"],
  data() {
    return {
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      query: {},
      value1: "",
      value2: "",
      tableData: [
@@ -79,82 +94,96 @@
        searchShow: true,
        searchMenuSpan: 6,
        index: true,
        indexLabel:'序号',
        viewBtn: true,
        dialogClickModal: false,
        column: [
          {
            label: "公司名称",
            prop: "gsname",
            search: true,
            searchSpan: 4,
            display: false
          },
          // {
          //   label: "公司名称",
          //   prop: "gsname",
          //   // search: true,
          //   // searchSpan: 4,
          //   display: false
          // },
          // {
          //   label: "所属辖区",
          //   prop: "jurname",
          //   searchSpan: 4,
          //   props: {
          //     label: "title",
          //     value: "id"
          //   },
          //   // cascaderItem: ["city", "area"],
          //   // dicUrl:subofficeOptions,
          //   dicData: [],
          //   search: true,
          //   type: "tree",
          //   rules: [
          //     {
          //       required: true,
          //       message: "请选择所属辖区",
          //       trigger: "blur"
          //     }
          //   ]
          // },
          {
            label: "所属辖区",
            prop: "jurname",
            searchSpan: 4,
            type: "select",
            label: "服务单位名称",
            prop: "name",
            props: {
              label: "label",
              value: "value"
              label: "name",
              value: "name"
            },
            // cascaderItem: ["city", "area"],
            // dicUrl:subofficeOptions,
            dicData: [
              {
                value: "0",
                label: "南昌市公安局"
              },
              {
                value: "2",
                label: "东湖分局"
              },
              {
                value: "3",
                label: "西湖分局"
              },
              {
                value: "4",
                label: "青云谱分局"
              },
              {
                value: "5",
                label: "青山湖分局"
              }
            ],
            dicData: [],
            searchLabelWidth: 110,
            search: true,
            type: "tree",
            searchSpan: 8,
            rules: [
              {
                required: true,
                message: "请选择所属辖区",
                message: "请选择服务单位",
                trigger: "blur"
              }
            ]
            // display: false
          },
          {
            label: "企业名称",
            width: 300,
            prop: "deptName",
            display: false
          },
          {
            label: "服务开始时间",
            prop: "dispatcherTime",
            prop: "startTime",
            display: false
          },
          {
            label: "服务到期时间",
            prop: "end_time",
            prop: "endTime",
            display: false
          },
          {
            label: "服务单位名称",
            prop: "fwname",
            searchLabelWidth: 110,
            search: true,
            searchSpan: 4,
            display: false
          },
          {
            label: "保安派遣人数",
            label: "保安员人数",
            prop: "num",
            display: false
          },
          // {
          //   label: "保安派遣人数",
          //   prop: "num",
          //   display: false
          // },
          {
            label: "联系人",
            prop: "linkman",
            display: false
          },
          {
            label: "联系电话",
            prop: "phone",
            display: false
          }
          // {
          //   label: "备注",
          //   prop: "bz",
@@ -210,7 +239,8 @@
      ],
      servicesList: [],
      companyName: "",
      loading: true
      loading: true,
      deptid: ""
    };
  },
  computed: {
@@ -225,53 +255,95 @@
    }
  },
  methods: {
    dateChange() {},
    getTableData() {
      let params = {
        jurisdiction: "",
        current: 1,
        fid: 20,
        deptid: "1412222709480509442",
        size: 10
      };
      selectDis(params).then(res => {
        if (res.data.code === 200) {
          this.tableData = res.data.data;
          this.loading = false;
        }
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    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;
      let param = {};
      // param["jurisdiction"] = params["jurname"] || "";
      // param["id"] = params["name"] || "";
      param["deptId"] = this.fwdeptId;
      param["current"] = page.currentPage;
      param["size"] = page.pageSize;
      param["name"] = params["name"] || "";
      dispatcherUnit(param).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.tableData = data.records;
        this.loading = false;
      });
    },
    getFuWuList() {
      selectFw().then(res => {
        if (res.data.code === 200) {
          this.servicesList = res.data.data;
          this.tableOption.column.forEach(item => {
            if (item.label == "服务单位名称") {
              item.dicData = res.data.data;
            }
          });
          // this.servicesList = res.data.data;
        }
      });
    },
    getSubOfficeData() {
      lazyTrees().then(res => {
        if (res.data.code === 200) {
          this.tableOption.column.forEach(item => {
            if (item.label == "所属辖区") {
              item.dicData = res.data.data;
            }
          });
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    getLocationParams() {
      let url = window.location.href;
      let urlArr = url.split("?")[1].split("&");
      var object = new Object();
      for (var i = 0; i < urlArr.length; i++) {
        let mm = urlArr[i].split("=");
        object[decodeURIComponent(mm[0])] = decodeURIComponent(mm[1]);
      }
      this.deptid = object["departmentid"] || "";
      // let jurisdiction = object["jurisdiction"] || "";
      this.query = { deptid: this.deptid };
      // this.onLoad(this.page, obj);
      this.onLoad(this.page, this.query);
    }
    // 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;
    // }
  },
  mounted() {
    this.getTableData();
    // this.getTableData();
    this.getFuWuList();
    this.getSubOfficeData();
    // this.getLocationParams();
  }
};
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
  .businessDetail{
    height: 50%;
  }
</style>