石广澎
2023-11-29 20913c80c3f5fc8e533cb92b90e6f20bcd68e032
admin-web/src/views/departmentitem/ledgerquy/itemQuy/index.vue
@@ -23,8 +23,7 @@
import MyTableV2 from "@/components/myTable/myTableV2";
import MyButton from "@/components/myButton/myButton";
import SettingIplatform from '@/utils/settingIplatform';
import * as finsystenant from '@/api/baseSetting/finsystenant'
import {getBaseUrl} from '@/utils/base';
import {doExport} from '@/api/deptGoods/ledgerQuery';
export default {
  name: "index",
@@ -38,40 +37,66 @@
          dataIndex: 'agencyId',
          label: '机构',
          placeholder: '请选择',
          optionsConfig: { url: '/pc/fin/sys/tenant/select/tree_fin_tenant', props: null },
          optionsConfig: {url: '/pc/fin/sys/tenant/select/tree_fin_tenant', props: null},
          defaultValue: '',
          options: [],
        },
        {
          type: 'select',
          dataIndex: 'name',
          dataIndex: 'departmentId',
          label: '部门',
          placeholder: '请选择',
          defaultValue: '',
          optionsConfig: {
            url: `/pc/fin/sys/tenant/department/list/all`,
            label: 'name',
            value: 'id',
          },
          options: [],
        },
        {
          type: 'text',
          dataIndex: 'name',
          type: 'select',
          dataIndex: 'goodsTemplateId',
          label: '物品名称',
          placeholder: '请输入',
          optionsConfig: {
            label: 'goodsName',
            value: 'id',
            url: SettingIplatform.apiBaseURL + '/pc/base/goods/template/query/goodsTemplate',
          },
          options: [],
          defaultValue: ''
        },
        {
          type: 'select',
          dataIndex: 'name',
          type: 'cascader',
          dataIndex: 'categoryId',
          label: '分类',
          placeholder: '请选择',
          defaultValue: '',
          options: [],
          optionsConfig: {
            label: 'label',
            value: 'id',
            url: SettingIplatform.apiBaseURL + '/pc/base/category/select/tree',
            props: {checkStrictly: false, emitPath: false, value: 'id'}
          },
        },
        {
          type: 'select',
          dataIndex: 'name',
          dataIndex: 'costType',
          label: '类别',
          placeholder: '请选择',
          defaultValue: '',
          options: [],
          options: [{
            label: 'A',
            value: '1'
          }, {
            label: 'B',
            value: '2'
          }, {
            label: 'C',
            value: '3'
          }],
        },
      ],
      // 树数据
@@ -93,29 +118,36 @@
      table: {
        showIndex: true, // 是否显示序号
        expand: false, // 是否显示详情数据
        url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/select/list', // 请求地址
        url: SettingIplatform.apiBaseURL + '/pc/fin/warehouse/ledger/getDeptLedgerList', // 请求地址
        // 工具条
        tools: {
          columnsCtrl: {// 列控制按钮
            show: false
          },
          generalExport: {// 通用导出按钮
            show: true
            show: false
          },
          // 自定义工具条按钮
          custom: [
          ]
            {
              name: '导出',
              icon: 'el-icon-download',
              click: () => {
                this.handleExport();
              },
            },
          ],
        },
        // 列信息
        columns: [
          {title: '机构', field: 'name', align: 'left',},
          {title: '部门', field: 'code', align: 'center'},
          {title: '分类', field: 'lv', align: 'center', },
          {title: '所属类别', field: 'lv', align: 'center', },
          {title: '物品名称', field: 'summary', align: 'left',},
          {title: '规格型号', field: 'summary', align: 'left',},
          {title: '单位', field: 'summary', align: 'left',},
          {title: '在用数量', field: 'summary', align: 'left',},
          {title: '机构', field: 'agencyName', align: 'left', minWidth: 130},
          {title: '部门', field: 'departName', align: 'left', minWidth: 130},
          {title: '分类', field: 'categoryName', align: 'left', minWidth: 130},
          {title: '所属类别', field: 'costType', align: 'center', width: 80},
          {title: '物品名称', field: 'goodsTemplateName', align: 'left', minWidth: 130},
          {title: '规格型号', field: 'baseGoodsModelsName', align: 'left', minWidth: 130},
          {title: '单位', field: 'unit', align: 'center', width: 80},
          {title: '在用数量', field: 'kucun', align: 'center', width: 80},
        ],
        // 操作信息
        operation: {
@@ -137,6 +169,40 @@
  created() {
  },
  methods: {
    // 导出
    handleExport() {
      let loading = this.$loading({
        lock: true,
        text: '导出中,请稍候...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)',
      });
      // 判断总条数是否大于最大支持条数
      doExport({...this.filterFrom})
          .then((res) => {
            const blob = new Blob([res], {type: 'application/vnd.ms-excel'});
            const fileName = `部门物品查询.xls`;
            if ('download' in document.createElement('a')) {
              // 非IE下载
              const elink = document.createElement('a');
              elink.download = fileName;
              elink.style.display = 'none';
              elink.href = URL.createObjectURL(blob);
              document.body.appendChild(elink);
              elink.click();
              URL.revokeObjectURL(elink.href);
              document.body.removeChild(elink);
            } else {
              // IE10+下载
              navigator.msSaveBlob(blob, fileName);
            }
            this.$message.success('导出成功!');
            loading.close();
          })
          .catch(() => {
            loading.close();
          });
    },
    // 查询table列表
    search(pageNum) {
      if (pageNum != undefined) {