Commit c3bbcc3e by Lin

feat(financeManage):通过动态场景类型处理来增强账户管理对话框的功能

- 在 downloadAccountDialog.vue 中添加了 sceneTypeList 属性,以便根据选定的业务线动态检索场景。
- 更新了 downloadReconciDialog.vue 以反映业务线术语的变化。
- 对 financeList.vue 进行了重构,以确保对场景类型的正确数据处理。
- 改进了 offlineAccountList.vue 和 onlineAccountList.vue 模板,以提供更好的用户体验并确保账户信息的显示一致性。
1 parent 2d199960
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
<script> <script>
import { getBillTmplAdapter, getMetaTmpl, getShopList, getTmplList } from "@api/accountManage"; import { getBillTmplAdapter, getMetaTmpl, getShopList, getTmplList } from "@api/accountManage";
import { getMerchantPageSearch } from "@api/publicAccount"; import { getMerchantPageSearch } from "@api/publicAccount";
import { getScenesByParams } from "@api/senseManage";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { mapActions, mapState } from "vuex"; import { mapActions, mapState } from "vuex";
import { import {
...@@ -187,10 +188,6 @@ export default { ...@@ -187,10 +188,6 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
sceneTypeList: {
type: Array,
default: () => [],
},
}, },
data() { data() {
const validateLonlat = (rule, value, callback) => { const validateLonlat = (rule, value, callback) => {
...@@ -207,6 +204,7 @@ export default { ...@@ -207,6 +204,7 @@ export default {
return { return {
loading: false, loading: false,
multipleLimit: 10, multipleLimit: 10,
sceneTypeList: [],
// 判断是否是模版模式 // 判断是否是模版模式
isTmpl: false, isTmpl: false,
localTmplList: deepClone(localTmplList), localTmplList: deepClone(localTmplList),
...@@ -340,7 +338,7 @@ export default { ...@@ -340,7 +338,7 @@ export default {
dowloadList: state => state.d2admin.user.dowloadList, dowloadList: state => state.d2admin.user.dowloadList,
}), }),
sceneTypeOptionList() { sceneTypeOptionList() {
// 选项 = 全部 + 父页面传入的“当前场景下子场景列表” // 选项 = 全部 + 当前业务线动态获取的场景列表
const inputList = Array.isArray(this.sceneTypeList) ? this.sceneTypeList : []; const inputList = Array.isArray(this.sceneTypeList) ? this.sceneTypeList : [];
const filteredList = inputList const filteredList = inputList
.map((item) => { .map((item) => {
...@@ -362,6 +360,8 @@ export default { ...@@ -362,6 +360,8 @@ export default {
const sceneStr = val == null ? "" : String(val); const sceneStr = val == null ? "" : String(val);
const exists = this.baseData.businessLineList.some(i => i.confId === sceneStr); const exists = this.baseData.businessLineList.some(i => i.confId === sceneStr);
this.infoForm.businessLine = exists ? sceneStr : (this.baseData.businessLineList[0]?.confId || ""); this.infoForm.businessLine = exists ? sceneStr : (this.baseData.businessLineList[0]?.confId || "");
// 首次打开弹框时,确保能根据当前业务线拉取“业务场景”列表
this.syncSceneTypeList();
}, },
immediate: true, immediate: true,
}, },
...@@ -369,6 +369,7 @@ export default { ...@@ -369,6 +369,7 @@ export default {
handler() { handler() {
// 切换业务线时,业务场景默认回到“全部” // 切换业务线时,业务场景默认回到“全部”
this.infoForm.sceneType = [""]; this.infoForm.sceneType = [""];
this.syncSceneTypeList();
}, },
}, },
}, },
...@@ -394,6 +395,27 @@ export default { ...@@ -394,6 +395,27 @@ export default {
methods: { methods: {
...mapActions("d2admin/user", ["actionSetDownloadList"]), ...mapActions("d2admin/user", ["actionSetDownloadList"]),
syncSceneTypeList() {
const sceneType = Number(this.infoForm?.businessLine);
if (this.infoForm?.businessLine === "" || this.infoForm?.businessLine === null || this.infoForm?.businessLine === undefined || Number.isNaN(sceneType)) {
this.sceneTypeList = [];
return;
}
getScenesByParams({ sceneType }).then((res) => {
const list = Array.isArray(res)
? res
: (Array.isArray(res?.data) ? res.data : []);
const normalized = list
.map(item => ({
confId: item?.baseSceneCode,
confLabel: item?.name,
}))
.filter(item => item.confId !== undefined && item.confId !== null && item.confId !== "");
this.sceneTypeList = normalized;
}).catch(() => {
this.sceneTypeList = [];
});
},
handleSceneTypeChange(value) { handleSceneTypeChange(value) {
if (!Array.isArray(value)) { if (!Array.isArray(value)) {
return; return;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
:model="infoForm" :model="infoForm"
:rules="formRules" :rules="formRules"
label-width="120px"> label-width="120px">
<el-form-item label="业务线:" prop="businessLine"> <el-form-item label="业务场景:" prop="businessLine">
<el-select v-model="infoForm.businessLine" style="width:400px"> <el-select v-model="infoForm.businessLine" style="width:400px">
<el-option v-for="item in baseData.businessLineList" <el-option v-for="item in baseData.businessLineList"
:key="item.confId" :key="item.confId"
...@@ -273,10 +273,10 @@ export default { ...@@ -273,10 +273,10 @@ export default {
baseData: { baseData: {
businessLineList: [{ businessLineList: [{
confId: "1", confId: "1",
confLabel: "权益类", confLabel: "精品升级",
}, { }, {
confId: "2", confId: "0",
confLabel: "轻改类", confLabel: "会员权益升级",
}], }],
reconStatusList: [{ reconStatusList: [{
confId: "all", confId: "all",
......
...@@ -603,7 +603,6 @@ ...@@ -603,7 +603,6 @@
<DownloadAccountDialog v-if="accountVisible" <DownloadAccountDialog v-if="accountVisible"
:account-visible="accountVisible" :account-visible="accountVisible"
:scene="searchForm.sceneType" :scene="searchForm.sceneType"
:scene-type-list="baseData.subSceneTypeList"
@custTmpl="handleCustTmpl" @custTmpl="handleCustTmpl"
@handleBill="handleBill" @handleBill="handleBill"
@accountClose="accountClose" /> @accountClose="accountClose" />
...@@ -726,7 +725,7 @@ export default { ...@@ -726,7 +725,7 @@ export default {
multiple: true, multiple: true,
collapseTags: true, collapseTags: true,
optionList: [], optionList: [],
optionId: "id", optionId: "baseSceneCode",
optionLabel: "name", optionLabel: "name",
optionsName: "subSceneTypeList", optionsName: "subSceneTypeList",
changeAttr: (value) => { changeAttr: (value) => {
...@@ -734,7 +733,11 @@ export default { ...@@ -734,7 +733,11 @@ export default {
return; return;
} }
const ALL = ""; const ALL = "";
let next = value; let next = value
.filter(v => v !== undefined && v !== null)
.map(v => (typeof v === "string" ? v : String(v)));
// 去重(以 baseSceneCode 作为唯一值)
next = Array.from(new Set(next));
// 空选择:视为“全部” // 空选择:视为“全部”
if (!next.length) { if (!next.length) {
next = [ALL]; next = [ALL];
...@@ -743,8 +746,8 @@ export default { ...@@ -743,8 +746,8 @@ export default {
if (next.includes(ALL) && next.length > 1) { if (next.includes(ALL) && next.length > 1) {
next = next[next.length - 1] === ALL ? [ALL] : next.filter(v => v !== ALL); next = next[next.length - 1] === ALL ? [ALL] : next.filter(v => v !== ALL);
} }
// v-model 绑定在 subSceneType,同时同步给后端入参 baseSceneCodeList
this.searchForm.subSceneType = next; this.searchForm.subSceneType = next;
// 保持现有入参行为:baseSceneCodeList 与该选择同步
this.searchForm.baseSceneCodeList = next; this.searchForm.baseSceneCodeList = next;
}, },
}, },
...@@ -1060,11 +1063,11 @@ export default { ...@@ -1060,11 +1063,11 @@ export default {
: (Array.isArray(res?.data) ? res.data : []); : (Array.isArray(res?.data) ? res.data : []);
const normalized = list const normalized = list
.map(item => ({ .map(item => ({
id: item?.id, baseSceneCode: item?.baseSceneCode,
name: item?.name, name: item?.name,
})) }))
.filter(item => item.id !== undefined && item.id !== null); .filter(item => item.baseSceneCode !== undefined && item.baseSceneCode !== null);
this.baseData.subSceneTypeList = normalized.map(({ id, name }) => ({ id, name })); this.baseData.subSceneTypeList = normalized.map(({ baseSceneCode, name }) => ({ baseSceneCode, name }));
this.getOptionsList(); this.getOptionsList();
}); });
}, },
...@@ -1402,13 +1405,6 @@ export default { ...@@ -1402,13 +1405,6 @@ export default {
? this.searchForm.channelType.join(",") ? this.searchForm.channelType.join(",")
: this.searchForm.channelType; : this.searchForm.channelType;
} }
if (Array.isArray(this.searchForm.subSceneType) && this.searchForm.subSceneType.length) {
const selected = this.searchForm.subSceneType;
// “全部”= 不传;否则按逗号分隔传给后端
if (!selected.includes("")) {
params.subSceneType = selected.join(",");
}
}
if (Array.isArray(this.searchForm.baseSceneCodeList) && this.searchForm.baseSceneCodeList.length) { if (Array.isArray(this.searchForm.baseSceneCodeList) && this.searchForm.baseSceneCodeList.length) {
const selected = this.searchForm.baseSceneCodeList; const selected = this.searchForm.baseSceneCodeList;
// “全部”= 不传;否则保持数组类型传给后端 // “全部”= 不传;否则保持数组类型传给后端
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!