Commit 22dc23b9 by Jaxon

fix(profitMarginTable): 修复利润率表格的初始化和数据计算逻辑

调整加载状态的包裹范围,移除重复的API请求,补充缺失的表格高度更新逻辑,优化组件初始化流程
1 parent 649aee6d
......@@ -272,17 +272,24 @@ export default {
},
async mounted() {
await this.withLoading(async () => {
await this.getTableData();
await this.$nextTick();
await this.setTableHeight();
if (this.$refs.tableRef) {
this.$refs.tableRef.doLayout();
}
});
if (this.useEdit) {
await this.getCalculateData();
}
await this.withLoading(async () => {
const { profitRateCalFinish } = await getShelfProductUpdateStep({ businessCode: this.businessCode });
if (profitRateCalFinish === "Y") {
await this.getTableData();
await this.$nextTick();
await this.setTableHeight();
if (this.$refs.tableRef) {
this.$refs.tableRef.doLayout();
}
return;
}
if (this.useEdit) {
await this.getCalculateData(profitRateCalFinish);
}
});
window.addEventListener("resize", this.setTableHeight);
},
beforeDestroy() {
......@@ -293,18 +300,18 @@ export default {
},
methods: {
isZeroOrNumber,
async getCalculateData() {
const { profitRateCalFinish } = await getShelfProductUpdateStep({ businessCode: this.businessCode });
async getCalculateData(profitRateCalFinish) {
const that = this;
const requestFn = () => {
return getShelfProductUpdateStep({ businessCode: that.businessCode });
};
async function stopCondition({ profitRateCalFinish }) {
console.log("profitRateCalFinish", profitRateCalFinish);
// // 更新数据
if (profitRateCalFinish === "Y") {
await that.getTableData();
await that.$nextTick();
await that.setTableHeight();
that.dialog.profitRateCalFinish.show = false;
return true;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!