fix(export): 修复导出创建者选择为单选的逻辑问题
- 将订单数据创建者选择从多选改为单选 - 修改关联分销商加载逻辑,支持单个创建者ID查询 - 更新计算属性hasCreators以适应单选字段 - 调整导出筛选条件构建中创建者ID的处理 - 添加监听导出表单中的creatorId变化,重置相关筛选条件并重新加载分销商列表
This commit is contained in:
parent
4b573d3981
commit
ae4d69edb9
|
|
@ -271,7 +271,7 @@
|
||||||
<el-row :gutter="8" v-if="isOrder && exportForm.datasource==='marketing'">
|
<el-row :gutter="8" v-if="isOrder && exportForm.datasource==='marketing'">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="订单数据创建者" prop="creator">
|
<el-form-item label="订单数据创建者" prop="creator">
|
||||||
<el-select v-model="exportForm.creatorIds" multiple clearable filterable :disabled="hasOnlyUserId" :teleported="false" placeholder="请选择创建者" style="width:100%">
|
<el-select v-model="exportForm.creatorId" clearable filterable :disabled="hasOnlyUserId" :teleported="false" placeholder="请选择创建者" style="width:100%">
|
||||||
<el-option v-for="opt in creatorOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
<el-option v-for="opt in creatorOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
||||||
20
web/main.js
20
web/main.js
|
|
@ -295,13 +295,13 @@ const app = createApp({
|
||||||
* 加载分销商列表
|
* 加载分销商列表
|
||||||
*/
|
*/
|
||||||
const loadResellers = async () => {
|
const loadResellers = async () => {
|
||||||
const ids = state.exportForm.creatorIds;
|
const id = state.exportForm.creatorId;
|
||||||
if (!ids?.length) {
|
if (!id) {
|
||||||
resellerOptions.value = [];
|
resellerOptions.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
resellerOptions.value = await Api.fetchResellers(ids);
|
resellerOptions.value = await Api.fetchResellers([id]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载分销商列表失败:', error);
|
console.error('加载分销商列表失败:', error);
|
||||||
resellerOptions.value = [];
|
resellerOptions.value = [];
|
||||||
|
|
@ -360,7 +360,7 @@ const app = createApp({
|
||||||
};
|
};
|
||||||
|
|
||||||
// ==================== 导出相关计算属性 ====================
|
// ==================== 导出相关计算属性 ====================
|
||||||
const hasCreators = Vue.computed(() => state.exportForm.creatorIds?.length > 0);
|
const hasCreators = Vue.computed(() => !!state.exportForm.creatorId);
|
||||||
const hasReseller = Vue.computed(() => !!state.exportForm.resellerId);
|
const hasReseller = Vue.computed(() => !!state.exportForm.resellerId);
|
||||||
const hasPlan = Vue.computed(() => !!state.exportForm.planId);
|
const hasPlan = Vue.computed(() => !!state.exportForm.planId);
|
||||||
const hasKeyBatch = Vue.computed(() => !!state.exportForm.keyBatchId);
|
const hasKeyBatch = Vue.computed(() => !!state.exportForm.keyBatchId);
|
||||||
|
|
@ -702,7 +702,9 @@ const app = createApp({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creatorIds?.length) {
|
if (creatorId) {
|
||||||
|
filters.creator_in = [Number(creatorId)];
|
||||||
|
} else if (creatorIds?.length) {
|
||||||
filters.creator_in = creatorIds.map(Number);
|
filters.creator_in = creatorIds.map(Number);
|
||||||
} else if (creatorIdsRaw) {
|
} else if (creatorIdsRaw) {
|
||||||
const arr = String(creatorIdsRaw).split(',').map(s => s.trim()).filter(Boolean);
|
const arr = String(creatorIdsRaw).split(',').map(s => s.trim()).filter(Boolean);
|
||||||
|
|
@ -923,6 +925,14 @@ const app = createApp({
|
||||||
});
|
});
|
||||||
|
|
||||||
// 导出筛选条件变化
|
// 导出筛选条件变化
|
||||||
|
Vue.watch(() => state.exportForm.creatorId, () => {
|
||||||
|
state.exportForm.resellerId = null;
|
||||||
|
state.exportForm.planId = null;
|
||||||
|
state.exportForm.keyBatchId = null;
|
||||||
|
state.exportForm.codeBatchId = null;
|
||||||
|
loadResellers();
|
||||||
|
});
|
||||||
|
|
||||||
Vue.watch(() => state.exportForm.creatorIds, () => {
|
Vue.watch(() => state.exportForm.creatorIds, () => {
|
||||||
state.exportForm.resellerId = null;
|
state.exportForm.resellerId = null;
|
||||||
state.exportForm.planId = null;
|
state.exportForm.planId = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue