|
|
|
@ -99,6 +99,19 @@ const getMarket = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 递归遍历地区树寻找匹配的 ID |
|
|
|
const findIdsByNames = (nodes, names, resultIds) => { |
|
|
|
if (!nodes || nodes.length === 0) return; |
|
|
|
nodes.forEach(node => { |
|
|
|
if (names.includes(node.label)) { |
|
|
|
resultIds.push(node.value); |
|
|
|
} |
|
|
|
if (node.children) { |
|
|
|
findIdsByNames(node.children, names, resultIds); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
// 查询列表 |
|
|
|
const fetchData = async () => { |
|
|
|
loading.value = true |
|
|
|
@ -106,25 +119,7 @@ const fetchData = async () => { |
|
|
|
// 将 adminData 中的名称列表转换为 ID 列表 |
|
|
|
const adminMarketNames = adminData.value.marketName?.split(',').map(item => item.trim()).filter(Boolean) || []; |
|
|
|
const adminMarketIds = []; |
|
|
|
|
|
|
|
// 递归遍历地区树寻找匹配的 ID |
|
|
|
const findIdsByNames = (nodes, names, resultIds) => { |
|
|
|
if (!nodes || nodes.length === 0) return; |
|
|
|
nodes.forEach(node => { |
|
|
|
if (names.includes(node.label)) { |
|
|
|
resultIds.push(node.value); |
|
|
|
} |
|
|
|
if (node.children) { |
|
|
|
findIdsByNames(node.children, names, resultIds); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
findIdsByNames(marketOptions.value, adminMarketNames, adminMarketIds); |
|
|
|
console.log('adminMarketNames:', adminMarketNames) |
|
|
|
console.log('adminMarketIds:', adminMarketIds) |
|
|
|
console.log('adminMarketIds:', queryParams.adminMarketIds) |
|
|
|
|
|
|
|
// 构建请求参数 |
|
|
|
console.log('adminData.value.markets:', adminData.value.markets) |
|
|
|
const params = { |
|
|
|
@ -216,12 +211,15 @@ const exportListLoading = ref(false) |
|
|
|
// 导出Excel |
|
|
|
const handleExport = async () => { |
|
|
|
try { |
|
|
|
const adminMarketNames = adminData.value.marketName?.split(',').map(item => item.trim()).filter(Boolean) || []; |
|
|
|
const adminMarketIds = []; |
|
|
|
findIdsByNames(marketOptions.value, adminMarketNames, adminMarketIds); |
|
|
|
const params = { |
|
|
|
pageNum: queryParams.pageNum, |
|
|
|
pageSize: queryParams.pageSize, |
|
|
|
performanceDTO: { |
|
|
|
jwcode: queryParams.jwcode, |
|
|
|
adminMarket: adminData.value.marketName.split(',').filter(item => item.trim() !== '') || [], |
|
|
|
adminMarket: adminMarketIds, |
|
|
|
customerMarket: queryParams.customerMarket, |
|
|
|
startTime: queryParams.timeRange?.[0] ? dayjs(queryParams.timeRange[0]).format('YYYY-MM-DD HH:mm:ss') : '', |
|
|
|
endTime: queryParams.timeRange?.[1] ? dayjs(queryParams.timeRange[1]).format('YYYY-MM-DD HH:mm:ss') : '', |
|
|
|
@ -337,7 +335,7 @@ const handleAdjustment = () => { |
|
|
|
const computedAdjustData = computed(() => { |
|
|
|
const data = [...adjustData.value] |
|
|
|
const sumRow = { inMarket: t('cash.cashFlow.total'), isSum: true } |
|
|
|
|
|
|
|
|
|
|
|
matrixMarkets.value.forEach(colMarket => { |
|
|
|
let colSum = 0 |
|
|
|
adjustData.value.forEach(row => { |
|
|
|
@ -346,7 +344,7 @@ const computedAdjustData = computed(() => { |
|
|
|
}) |
|
|
|
sumRow[colMarket.key] = colSum |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
data.push(sumRow) |
|
|
|
return data |
|
|
|
}) |
|
|
|
@ -554,8 +552,8 @@ onMounted(async () => { |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<el-table-column v-for="col in matrixMarkets" :key="col.key" :label="col.label + ' ' + t('cash.cashFlow.marketTeam')" |
|
|
|
min-width="120" align="center"> |
|
|
|
<el-table-column v-for="col in matrixMarkets" :key="col.key" |
|
|
|
:label="col.label + ' ' + t('cash.cashFlow.marketTeam')" min-width="120" align="center"> |
|
|
|
<template #default="{ row }"> |
|
|
|
<span v-if="row.isSum">{{ row[col.key] }}</span> |
|
|
|
<el-input v-else v-model="row[col.key]" @input="row[col.key] = formatNumber($event)" placeholder="" |
|
|
|
@ -572,7 +570,8 @@ onMounted(async () => { |
|
|
|
|
|
|
|
<template #footer> |
|
|
|
<div class="dialog-footer" style="text-align: center;"> |
|
|
|
<el-button type="primary" plain @click="adjustVisible = false" style="width: 100px;">{{ t('common.cancel') }}</el-button> |
|
|
|
<el-button type="primary" plain @click="adjustVisible = false" style="width: 100px;">{{ t('common.cancel') |
|
|
|
}}</el-button> |
|
|
|
<el-button type="primary" @click="submitAdjustment" style="width: 100px;">{{ t('common.submit') }}</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|