⚡ 优化区划国家入口、计划-1展示、路线地图点选与对账导出
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -127,6 +127,13 @@
|
||||
</div>
|
||||
<el-button @click="resetInternalQuery">重置</el-button>
|
||||
<el-button type="primary" @click="internalFilterTick++">查询</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!filteredInternalRows.length"
|
||||
@click="exportInternalDetails"
|
||||
>导出</el-button
|
||||
>
|
||||
</div>
|
||||
<el-table
|
||||
:data="filteredInternalRows"
|
||||
@@ -616,6 +623,7 @@
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import * as XLSX from 'xlsx';
|
||||
import * as api from '@/api/settlement/transportReconciliation';
|
||||
import * as formalSettlementApi from '@/api/settlement/formalSettlement';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
@@ -1807,6 +1815,63 @@ export default {
|
||||
formatNumber(value) {
|
||||
return Number(value || 0).toFixed(2);
|
||||
},
|
||||
formatExportMoney(value) {
|
||||
if (value === null || value === undefined || value === '' || Number(value) === -1) {
|
||||
return '';
|
||||
}
|
||||
return Number(value || 0).toFixed(2);
|
||||
},
|
||||
formatInternalExportCell(row, column) {
|
||||
if (column.prop === 'matchResult') return this.matchName(row.matchResult);
|
||||
if (column.prop === 'updateResult') return this.updateName(row.updateResult);
|
||||
if (column.prop === 'matchedExternalLineNo') {
|
||||
return this.hasMatchedExternal(row)
|
||||
? this.formatMatchedExternalLineNo(row.matchedExternalLineNo)
|
||||
: '';
|
||||
}
|
||||
if (column.prop === 'transportType') return this.transportTypeLabel(row.transportType);
|
||||
if (column.prop === 'transportQuantity') {
|
||||
return row.transportQuantity === null ||
|
||||
row.transportQuantity === undefined ||
|
||||
row.transportQuantity === ''
|
||||
? ''
|
||||
: Number(row.transportQuantity || 0).toFixed(2);
|
||||
}
|
||||
if (column.feeItemName) {
|
||||
return this.formatExportMoney(this.getFeeItemAmount(row, column.feeItemName));
|
||||
}
|
||||
if (column.prop === 'mileage') {
|
||||
return Number(row.mileage) === -1 ? '' : this.formatExportMoney(row.mileage);
|
||||
}
|
||||
if (column.prop === 'actualDepartureTime' || column.prop === 'actualCompletionTime') {
|
||||
const text = this.formatDate(row[column.prop]);
|
||||
return text === '-' ? '' : text;
|
||||
}
|
||||
if (column.money || column.number) return this.formatExportMoney(row[column.prop]);
|
||||
const value = row[column.prop];
|
||||
return value === null || value === undefined || value === '' ? '' : value;
|
||||
},
|
||||
exportInternalDetails() {
|
||||
if (!this.filteredInternalRows.length) {
|
||||
this.$message.warning('暂无可导出的内部账单明细');
|
||||
return;
|
||||
}
|
||||
const rows = this.filteredInternalRows.map((row, index) => {
|
||||
const result = { 序号: index + 1 };
|
||||
this.internalTableColumns.forEach(column => {
|
||||
result[column.label] = this.formatInternalExportCell(row, column);
|
||||
});
|
||||
return result;
|
||||
});
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, XLSX.utils.json_to_sheet(rows), '内部账单明细');
|
||||
XLSX.writeFile(
|
||||
workbook,
|
||||
`${this.form.reconciliationNo || '运输对账'}内部账单明细${this.$dayjs().format(
|
||||
'YYYY-MM-DD HH-mm-ss'
|
||||
)}.xlsx`
|
||||
);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user