增加导出功能

This commit is contained in:
wuweihua
2026-10-26 16:20:46 +08:00
parent 7f4fc3df8c
commit 76cc5b5781
16 changed files with 801 additions and 10 deletions
@@ -65,6 +65,15 @@
@click="logDrawerRef.open()"
>操作记录</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
v-hasPermi="['monitor:orderSource:export']"
@click="handleExport"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
@@ -131,10 +140,19 @@
<order-source-sync-log-drawer ref="logDrawerRef" />
<order-source-product-check-drawer ref="productCheckDrawerRef" />
<order-source-compare-drawer ref="compareDrawerRef" @fill-search="onCompareFillSearch" />
<excel-export-field-dialog
ref="exportFieldRef"
:fields="ORDER_SOURCE_EXPORT_FIELDS"
storage-key="exportFields:orderSource"
/>
</div>
</template>
<script setup name="OrderSource">
import { exportAsync } from '@/utils/excelExport'
import ExcelExportFieldDialog from '@/components/ExcelExportFieldDialog/index.vue'
import { ORDER_SOURCE_EXPORT_FIELDS } from '@/utils/exportFieldDefs'
import { ElMessage } from 'element-plus'
import { listOrderSource, listOrderSourceByTransferNos, syncOrderSourceSelected } from '@/api/monitor/orderSource'
import OrderSourceSyncDialog from './components/OrderSourceSyncDialog.vue'
@@ -144,6 +162,7 @@ import OrderSourceCompareDrawer from './components/OrderSourceCompareDrawer.vue'
const { proxy } = getCurrentInstance()
const tableRef = ref()
const exportFieldRef = ref()
const syncDialogRef = ref()
const logDrawerRef = ref()
const productCheckDrawerRef = ref()
@@ -330,6 +349,32 @@ function buildFilterQuery(params) {
return query
}
async function handleExport() {
const q = buildFilterQuery()
const identifierCount = (q.orderIdentifiers || []).length
const hasIdentifier = identifierCount > 0
const hasCustomer = !!(q.customerKeywords && q.customerKeywords.length) || !!(q.customerCodes && q.customerCodes.length)
const hasTime = !!q.beginTime && !!q.endTime
if (!hasIdentifier && !(hasCustomer && hasTime)) {
ElMessage.warning('请先设置列表查询条件后再导出')
return
}
if (identifierCount > MAX_ORDER_IDENTIFIERS) {
ElMessage.warning(`单次最多导出 ${MAX_ORDER_IDENTIFIERS} 个单号,当前 ${identifierCount} 个`)
return
}
const fields = await exportFieldRef.value?.open?.()
if (!fields || !fields.length) return
return exportAsync({
baseUrl: '/monitor/orderSource/export',
query: { ...q, exportFields: fields },
requireFilter: false,
filePrefix: 'order_source'
})
}
function queryList(params) {
const src = params || tableRef.value?.getQueryParams?.() || {}
const identifiers = splitLines(src.orderIdentifiers)
+18 -2
View File
@@ -234,12 +234,20 @@
<div class="import-progress-msg">{{ cwImportProgressMessage }}</div>
</div>
</el-dialog>
<excel-export-field-dialog
ref="exportFieldRef"
:fields="BILLING_BILL_EXPORT_FIELDS"
storage-key="exportFields:billingBill"
/>
</div>
</template>
<script setup name="BillingBill">
import { listBill, getBill, refundBill, updateCreditArrears, importChargeWeightAsync, downloadChargeWeightTemplate, recalcBillPriceAsync } from '@/api/price/billing'
import { exportAsyncFromTable } from '@/utils/excelExport'
import ExcelExportFieldDialog from '@/components/ExcelExportFieldDialog/index.vue'
import { BILLING_BILL_EXPORT_FIELDS } from '@/utils/exportFieldDefs'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useProducts } from '@/components/ProductSelect/useProducts'
import BillDetail from './components/BillDetail.vue'
@@ -281,6 +289,7 @@ const productOptions = computed(() =>
)
const tableRef = ref()
const exportFieldRef = ref()
const tableHeight = ref(480)
let tableResizeObserver = null
@@ -442,18 +451,25 @@ function queryList(params) {
return listBill(query)
}
function handleExport() {
async function handleExport() {
const params = tableRef.value?.getQueryParams?.() || {}
if (!validateOrderIdentifierLimit(params.orderIdentifiers)) return
const fields = await exportFieldRef.value?.open?.()
if (!fields || !fields.length) return
return exportAsyncFromTable({
baseUrl: '/price/billing/bill/export',
tableRef: tableRef.value,
normalize: buildBillQuery,
normalize: (raw) => {
const q = buildBillQuery(raw)
q.exportFields = fields
return q
},
filePrefix: 'billing_bill',
requireFilter: true
})
}
function handleUpdateArrears(ids, selection) {
const billIds = (ids && ids.length)
? ids
+17 -3
View File
@@ -188,6 +188,12 @@
</el-dialog>
<order-source-sync-log-drawer ref="logDrawerRef" />
<order-bill-product-check-drawer ref="productCheckDrawerRef" />
<excel-export-field-dialog
ref="exportFieldRef"
:fields="ORDER_BILL_EXPORT_FIELDS"
storage-key="exportFields:orderBill"
/>
</div>
</template>
@@ -195,10 +201,13 @@
import { ElMessage, ElMessageBox } from 'element-plus'
import { listOrderBill, localRebillAsync } from '@/api/price/billing'
import { exportAsyncFromTable } from '@/utils/excelExport'
import ExcelExportFieldDialog from '@/components/ExcelExportFieldDialog/index.vue'
import { ORDER_BILL_EXPORT_FIELDS } from '@/utils/exportFieldDefs'
import OrderSourceSyncLogDrawer from '../../monitor/orderSource/components/OrderSourceSyncLogDrawer.vue'
import OrderBillProductCheckDrawer from './components/OrderBillProductCheckDrawer.vue'
const tableRef = ref()
const exportFieldRef = ref()
const logDrawerRef = ref()
const productCheckDrawerRef = ref()
const checkLoading = ref(false)
@@ -417,19 +426,24 @@ function queryList(params) {
return listOrderBill(query)
}
function handleExport() {
async function handleExport() {
const params = tableRef.value?.getQueryParams?.() || {}
if (!validateOrderIdentifierLimit(params.orderIdentifiers)) return
const fields = await exportFieldRef.value?.open?.()
if (!fields || !fields.length) return
return exportAsyncFromTable({
baseUrl: '/price/billing/orderBill/export',
tableRef: tableRef.value,
normalize: applySearchRanges,
normalize: (raw) => {
const q = applySearchRanges(raw)
q.exportFields = fields
return q
},
filePrefix: 'order_bill',
requireFilter: true
})
}
const MAX_REBILL = 10000
function currentIdentifiers() {
const q = tableRef.value?.getQueryParams?.() || {}