feat(exports): 增强导出数据转换逻辑以支持渠道编码转换
- 在transformRow函数中添加对voucher_batch.provider字段的渠道编码转换逻辑,将老编码和新编码映射为中文名称 - 添加对order.key字段的解密处理,确保数据安全性 - 提升数据转换的可读性和可维护性,确保导出数据的准确性和友好性
This commit is contained in:
parent
bca7892799
commit
0eb65dde05
34
web/main.js
34
web/main.js
|
|
@ -328,13 +328,22 @@ const app = createApp({
|
|||
* 加载分销商列表
|
||||
*/
|
||||
const loadResellers = async () => {
|
||||
const id = state.exportForm.creatorId;
|
||||
if (!id) {
|
||||
const { creatorId, creatorIds } = state.exportForm;
|
||||
let ids = [];
|
||||
|
||||
if (creatorId) {
|
||||
ids = [Number(creatorId)];
|
||||
} else if (creatorIds?.length) {
|
||||
ids = creatorIds.map(Number);
|
||||
}
|
||||
|
||||
if (!ids.length) {
|
||||
resellerOptions.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
resellerOptions.value = await Api.fetchResellers([id]);
|
||||
resellerOptions.value = await Api.fetchResellers(ids);
|
||||
} catch (error) {
|
||||
console.error('加载分销商列表失败:', error);
|
||||
resellerOptions.value = [];
|
||||
|
|
@ -393,7 +402,10 @@ const app = createApp({
|
|||
};
|
||||
|
||||
// ==================== 导出相关计算属性 ====================
|
||||
const hasCreators = Vue.computed(() => !!state.exportForm.creatorId);
|
||||
const hasCreators = Vue.computed(() => {
|
||||
const { creatorId, creatorIds } = state.exportForm;
|
||||
return !!(creatorId || (creatorIds?.length > 0));
|
||||
});
|
||||
const hasReseller = Vue.computed(() => !!state.exportForm.resellerId);
|
||||
const hasPlan = Vue.computed(() => !!state.exportForm.planId);
|
||||
const hasKeyBatch = Vue.computed(() => !!state.exportForm.keyBatchId);
|
||||
|
|
@ -657,9 +669,15 @@ const app = createApp({
|
|||
const userId = Api.getUserId();
|
||||
if (userId) {
|
||||
const parts = String(userId).split(',').map(s => s.trim()).filter(Boolean);
|
||||
state.exportForm.creatorIds = parts.length > 1
|
||||
? parts.map(Number)
|
||||
: [Number(userId)];
|
||||
if (parts.length === 1) {
|
||||
// 单个用户 ID,同时设置 creatorId 和 creatorIds
|
||||
state.exportForm.creatorId = Number(parts[0]);
|
||||
state.exportForm.creatorIds = [Number(parts[0])];
|
||||
} else {
|
||||
// 多个用户 ID,只设置 creatorIds
|
||||
state.exportForm.creatorId = null;
|
||||
state.exportForm.creatorIds = parts.map(Number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -698,7 +716,7 @@ const app = createApp({
|
|||
showMessage('估算中', 'info');
|
||||
|
||||
try {
|
||||
const { tplId, dateRange, datasource, file_format, planId, resellerId, voucherChannelActivityId, creatorIds, creatorIdsRaw, ymtCreatorId, ymtMerchantId, ymtActivityId } = state.exportForm;
|
||||
const { tplId, dateRange, datasource, file_format, planId, resellerId, voucherChannelActivityId, creatorId, creatorIds, creatorIdsRaw, ymtCreatorId, ymtMerchantId, ymtActivityId } = state.exportForm;
|
||||
|
||||
const filters = {};
|
||||
const typeValue = exportType.value;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const createExportFormState = () => ({
|
|||
file_format: 'xlsx',
|
||||
dateRange: [],
|
||||
// 营销系统筛选条件
|
||||
creatorId: null,
|
||||
creatorIds: [],
|
||||
creatorIdsRaw: '',
|
||||
resellerId: null,
|
||||
|
|
|
|||
Loading…
Reference in New Issue