liding
6 小时以前 49cdc0884a9a4381cd968cffff65e2a332bc675a
src/views/structural/sealManage/usageLedger/index.vue
@@ -35,18 +35,10 @@
        v-hasPermi="['structural:sealUsageLedger:export']"
        type="primary"
        size="small"
        :disabled="selection.length === 0 || exportLoading || submitLoading"
        :loading="selectedExportLoading"
        @click="exportSelected"
      >勾选导出</el-button>
      <el-button
        v-hasPermi="['structural:sealUsageLedger:export']"
        type="primary"
        size="small"
        :disabled="exportLoading || submitLoading"
        :loading="filteredExportLoading"
        @click="exportFiltered"
      >按条件导出</el-button>
        :loading="exportLoading"
        @click="exportLedger"
      >导出</el-button>
    </div>
    <lims-table
@@ -125,8 +117,7 @@
      tableData: [],
      selection: [],
      tableLoading: false,
      selectedExportLoading: false,
      filteredExportLoading: false,
      exportLoading: false,
      copiesDialogVisible: false,
      submitLoading: false,
      copiesForm: { id: null, reportCode: '', copies: 1, version: 0 },
@@ -144,11 +135,6 @@
        { label: '份数', prop: 'copies', dataType: 'slot', slot: 'copies', width: '120px' },
        { label: '用印人签字', prop: 'useUserName', width: '140px' }
      ]
    }
  },
  computed: {
    exportLoading() {
      return this.selectedExportLoading || this.filteredExportLoading
    }
  },
  mounted() {
@@ -221,19 +207,15 @@
        })
      })
    },
    exportSelected() {
      if (!this.selection.length) {
        this.$message.warning('请选择要导出的记录')
        return
      }
      this.selectedExportLoading = true
      this.downloadWord({ mode: 'selected', ids: this.selection.map(item => item.id) })
        .finally(() => { this.selectedExportLoading = false })
    },
    exportFiltered() {
      this.filteredExportLoading = true
      this.downloadWord({ mode: 'filtered', query: this.buildQuery() })
        .finally(() => { this.filteredExportLoading = false })
    exportLedger() {
      if (this.exportLoading || this.submitLoading) return
      const payload = this.selection.length
        ? { mode: 'selected', ids: this.selection.map(item => item.id) }
        : { mode: 'filtered', query: this.buildQuery() }
      this.exportLoading = true
      this.downloadWord(payload)
        .catch(() => {})
        .finally(() => { this.exportLoading = false })
    },
    downloadWord(payload) {
      return exportSealUsageLedger(payload).then(async data => {