Commit bfd6f744 by Lin

refactor: 优化早期预警管理相关API与策略分析页面

- 统一API文件中的语句结束符风格,确保代码风格一致性。
- 调整策略分析页面模板结构,增强可读性与用户交互体验。
- 新增效果分析功能,提升数据展示的灵活性与可操作性。
1 parent 6a4e3e7b
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
:config="config" :config="config"
:dialog-config="dialogConfig.config" :dialog-config="dialogConfig.config"
:is-show.sync="dialogShow"> :is-show.sync="dialogShow">
<div v-loading="loading" <div class="content">
class="content">
<div class="block"> <div class="block">
<div class="business-box"> <div class="business-box">
<img class="bg" <img class="bg"
...@@ -13,7 +12,6 @@ ...@@ -13,7 +12,6 @@
<div class="business-title"> <div class="business-title">
当前周期 当前周期
</div> </div>
<!-- {{ row }} -->
<template v-for="(item, index) in row"> <template v-for="(item, index) in row">
<div :key="index" <div :key="index"
class="business-item"> class="business-item">
...@@ -65,8 +63,6 @@ ...@@ -65,8 +63,6 @@
</template> </template>
<script> <script>
import { getStrategyAnalysisEffect } from "@/api/earlyWarningManager";
const decline = require("@/assets/strategy/decline.png"); const decline = require("@/assets/strategy/decline.png");
const just01 = require("@/assets/strategy/just01.png"); const just01 = require("@/assets/strategy/just01.png");
const rise = require("@/assets/strategy/rise.png"); const rise = require("@/assets/strategy/rise.png");
...@@ -79,8 +75,8 @@ export default { ...@@ -79,8 +75,8 @@ export default {
default: false, default: false,
}, },
row: { row: {
type: Object, type: Array,
default: () => ({}), default: () => [],
}, },
searchParams: { searchParams: {
type: Object, type: Object,
...@@ -89,7 +85,6 @@ export default { ...@@ -89,7 +85,6 @@ export default {
}, },
data() { data() {
return { return {
loading: false,
config: { config: {
isShowFooter: false, isShowFooter: false,
cancel_name: "关闭", cancel_name: "关闭",
...@@ -101,11 +96,6 @@ export default { ...@@ -101,11 +96,6 @@ export default {
width: "720px", width: "720px",
}, },
}, },
businessDetail: {
beforeLearning: {},
afterLearning: {},
},
businessForm: [],
}; };
}, },
computed: { computed: {
...@@ -118,13 +108,6 @@ export default { ...@@ -118,13 +108,6 @@ export default {
}, },
}, },
}, },
watch: {
visible(val) {
if (val) {
this.fetchDetail();
}
},
},
methods: { methods: {
close() { close() {
this.$emit("update:visible", false); this.$emit("update:visible", false);
...@@ -136,36 +119,8 @@ export default { ...@@ -136,36 +119,8 @@ export default {
just01, just01,
}[name] ?? ""; }[name] ?? "";
}, },
formatIsRatio(key) { formatIsRatio(delta) {
const { beforeLearning, afterLearning } = this.businessDetail; return delta < 0 ? "decline" : delta === 0 ? "just01" : "rise";
const b = beforeLearning[key];
const a = afterLearning[key];
return a < b ? "decline" : b === a ? "just01" : "rise";
},
async fetchDetail() {
if (!this.row?.merchantId4s) {
return;
}
this.loading = true;
try {
const data = await getStrategyAnalysisEffect({
merchantId: this.row.merchantId4s,
...this.searchParams,
});
this.businessDetail = {
beforeLearning: data?.beforeLearning || data?.beforePeriod || {},
afterLearning: data?.afterLearning || data?.afterPeriod || {},
};
} catch (error) {
console.error("获取效果分析详情失败:", error);
this.businessDetail = {
beforeLearning: {},
afterLearning: {},
};
this.$message.error("获取效果分析详情失败,请稍后重试");
} finally {
this.loading = false;
}
}, },
}, },
}; };
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!