| | |
| | | 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 |
| | |
| | | tableData: [], |
| | | selection: [], |
| | | tableLoading: false, |
| | | selectedExportLoading: false, |
| | | filteredExportLoading: false, |
| | | exportLoading: false, |
| | | copiesDialogVisible: false, |
| | | submitLoading: false, |
| | | copiesForm: { id: null, reportCode: '', copies: 1, version: 0 }, |
| | |
| | | { label: '份数', prop: 'copies', dataType: 'slot', slot: 'copies', width: '120px' }, |
| | | { label: '用印人签字', prop: 'useUserName', width: '140px' } |
| | | ] |
| | | } |
| | | }, |
| | | computed: { |
| | | exportLoading() { |
| | | return this.selectedExportLoading || this.filteredExportLoading |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | 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 => { |