Commit 735c1915 by Jaxon

fix(performanceScheme): 修复门店选择组件和提成方案页面的加载与数据问题

- 移除调试用的 console.log 和硬编码的总数,使用接口返回的 total
- 为门店选择组件添加 overflow: hidden 防止布局溢出
- 将全局加载状态替换为页面级独立 loading 控制
- 优化 mounted 和异步操作的加载状态管理,确保 finally 中正确关闭
- 移除已注释的 watch 规则,简化代码逻辑
1 parent 38940b37
...@@ -309,10 +309,8 @@ export default { ...@@ -309,10 +309,8 @@ export default {
}); });
}, },
async getData() { async getData() {
console.log("this.queryParams", this.queryParams);
this.loading = true; this.loading = true;
const { currentPage, list, pageSize, total } const { currentPage, list, pageSize, total } = await getMerchantBrand(this.queryParams);
= await getMerchantBrand(this.queryParams);
this.loading = false; this.loading = false;
list.forEach((merchant, index) => { list.forEach((merchant, index) => {
const selectedMerchant const selectedMerchant
...@@ -356,8 +354,7 @@ export default { ...@@ -356,8 +354,7 @@ export default {
}); });
this.merchantTable = list; this.merchantTable = list;
// this.queryParams.total = total; this.queryParams.total = total;
this.queryParams.total = 99999999;
}, },
}, },
}; };
...@@ -367,6 +364,7 @@ export default { ...@@ -367,6 +364,7 @@ export default {
.selection-store-wrapper { .selection-store-wrapper {
display: flex; display: flex;
width: 100%; width: 100%;
overflow: hidden;
> .pre-select-store-wrapper { > .pre-select-store-wrapper {
flex: 1; flex: 1;
min-width: 616px; min-width: 616px;
......
<template> <template>
<d2-container v-loading="$store.state.d2admin.loading.value" class="performance-scheme-wrapper"> <!-- v-loading="$store.state.d2admin.loading.value" -->
<d2-container v-loading="loading.page" class="performance-scheme-wrapper">
<el-form ref="form" <el-form ref="form"
class="form-performance-name" class="form-performance-name"
label-width="170px" label-width="170px"
...@@ -112,6 +113,9 @@ export default { ...@@ -112,6 +113,9 @@ export default {
data() { data() {
return { return {
id: 0, id: 0,
loading: {
page: false,
},
rules: {}, rules: {},
detailVisible: false, detailVisible: false,
shouldValidateAll: false, // 是否应该验证所有字段 shouldValidateAll: false, // 是否应该验证所有字段
...@@ -122,28 +126,33 @@ export default { ...@@ -122,28 +126,33 @@ export default {
schemeName: bindFormFields("schemeName"), schemeName: bindFormFields("schemeName"),
}, },
watch: { watch: {
formData: { // formData: {
handler() { // handler() {
// 当formData变化时,更新rules // // 当formData变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList); // this.rules = getFormRules(this.formData, this.merchantBrandRefList);
}, // },
deep: true, // deep: true,
immediate: true, // immediate: true,
}, // },
merchantBrandRefList: { // merchantBrandRefList: {
handler() { // handler() {
// 当门店列表变化时,更新rules // // 当门店列表变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList); // this.rules = getFormRules(this.formData, this.merchantBrandRefList);
}, // },
deep: true, // deep: true,
}, // },
}, },
async mounted() { async mounted() {
try {
this.loading.page = true;
await this.initLoad(); await this.initLoad();
if (this.$route?.query?.id) { if (this.$route?.query?.id) {
this.id = this.$route.query.id; this.id = this.$route.query.id;
await this.getData(this.$route?.query?.id); await this.getData(this.$route?.query?.id);
} }
} finally {
this.loading.page = false;
}
}, },
methods: { methods: {
......
<template> <template>
<d2-container v-loading="$store.state.d2admin.loading.value" <d2-container v-loading="loading.page"
class="performance-scheme-wrapper"> class="performance-scheme-wrapper">
<el-form ref="form" <el-form ref="form"
class="form-performance-name" class="form-performance-name"
...@@ -134,6 +134,9 @@ export default { ...@@ -134,6 +134,9 @@ export default {
props: {}, props: {},
data() { data() {
return { return {
loading: {
page: false,
},
brandMerchantList: [], brandMerchantList: [],
rules: {}, rules: {},
detailVisible: false, detailVisible: false,
...@@ -172,21 +175,6 @@ export default { ...@@ -172,21 +175,6 @@ export default {
}, },
}, },
watch: { watch: {
formData: {
handler() {
// 当formData变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
immediate: true,
},
merchantBrandRefList: {
handler() {
// 当门店列表变化时,更新rules
this.rules = getFormRules(this.formData, this.merchantBrandRefList);
},
deep: true,
},
}, },
async mounted() { async mounted() {
console.log("this.$route.query", this.$route.query); console.log("this.$route.query", this.$route.query);
...@@ -206,6 +194,8 @@ export default { ...@@ -206,6 +194,8 @@ export default {
"resetFormData", "resetFormData",
]), ]),
async handleChangeBusinessType({ id }) { async handleChangeBusinessType({ id }) {
this.loading.page = true;
try {
const data = await getConfigMerchantDetail({ const data = await getConfigMerchantDetail({
id, id,
merchantId: this.$route.query?.id, merchantId: this.$route.query?.id,
...@@ -217,6 +207,9 @@ export default { ...@@ -217,6 +207,9 @@ export default {
id, id,
}); });
this.setMerchantBrandRefList(data.merchantBrandRefList); this.setMerchantBrandRefList(data.merchantBrandRefList);
} finally {
this.loading.page = false;
}
}, },
handleCheckClose(e) { handleCheckClose(e) {
...@@ -277,6 +270,8 @@ export default { ...@@ -277,6 +270,8 @@ export default {
} }
}, },
async getData(id) { async getData(id) {
this.loading.page = true;
try {
this.brandMerchantList = await postBrandMerchant({ this.brandMerchantList = await postBrandMerchant({
merchantId: id, merchantId: id,
}); });
...@@ -292,7 +287,9 @@ export default { ...@@ -292,7 +287,9 @@ export default {
pageSize: 999, pageSize: 999,
}); });
this.setProductDefineList(res?.list); this.setProductDefineList(res?.list);
console.log(this.brandMerchantList); } finally {
this.loading.page = false;
}
}, },
handleCancel() { handleCancel() {
// this.$EventBus.$emit("salaryPerformanceTab", { // this.$EventBus.$emit("salaryPerformanceTab", {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!