From 4916d34b39e240702de4fb86f0bdf6a5431a65f6 Mon Sep 17 00:00:00 2001 From: zhoumengru Date: Thu, 18 Sep 2025 16:02:43 +0800 Subject: [PATCH] =?UTF-8?q?```=20refactor(config):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=92=8C=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 `EditCom.vue` 中修改 `workModeIdSelect` 的监听器,添加异步处理逻辑,并引入新的方法 `getPolicyList` 以获取策略列表。 - 在 `device.vue` 中更新状态显示逻辑,使用 `is_error` 和 `is_running` 替换 `is_online`。 --- web/public/config/columnList.js | 15 +-------------- web/src/components/EditCom.vue | 26 +++++++++++++++++++++++++- web/src/components/monitor/device.vue | 8 ++++---- web/vue.config.js | 2 +- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/web/public/config/columnList.js b/web/public/config/columnList.js index ebb9567..fac1d4a 100644 --- a/web/public/config/columnList.js +++ b/web/public/config/columnList.js @@ -693,20 +693,7 @@ export const stationOptions = [ value: undefined, key: 'policy_id', type: 'unshow', - list: [ - { - label: '削峰套利', - value: '1' - }, - { - label: '需求响应', - value: '2' - }, - { - label: '自发自用', - value: '3' - } - ] + list: [] } ], ruleForm: {} diff --git a/web/src/components/EditCom.vue b/web/src/components/EditCom.vue index ac71c0e..4854cb4 100644 --- a/web/src/components/EditCom.vue +++ b/web/src/components/EditCom.vue @@ -176,14 +176,21 @@ export default { computed: {}, watch: { workModeIdSelect: { - handler(n) { + async handler(n,o) { + if(n !== o){ + this.detailInfos[0].ruleForm.policy_id='' + } switch (n) { case '1': this.detailInfos[0].list[this.detailInfos[0].list.length - 1].type = 'select' + this.detailInfos[0].list[this.detailInfos[0].list.length - 1].list = + await this.getPolicyList(1) break case '5': this.detailInfos[0].list[this.detailInfos[0].list.length - 1].type = 'select' + this.detailInfos[0].list[this.detailInfos[0].list.length - 1].list = + await this.getPolicyList(5) break default: @@ -263,6 +270,23 @@ export default { console.log('modal') }, methods: { + async getPolicyList(type) { + let list = [] + try { + const res = await getReq('/queryPolicyByType', { type }) + if (res.errcode == 0) { + list = res.data + .map((item) => { + + return {label:item.name,value:item.policy_id } + }) + } + } catch (error) { + console.log(error) + } + + return list + }, async getRoleIdList() { const params = { page_size: 1000, diff --git a/web/src/components/monitor/device.vue b/web/src/components/monitor/device.vue index 689d8dc..51a7aeb 100644 --- a/web/src/components/monitor/device.vue +++ b/web/src/components/monitor/device.vue @@ -21,15 +21,15 @@ 在线状态
- {{ - ['正常', '错误'][item.is_online] + {{ + ['正常', '错误'][item.is_error] }} 故障状态
- {{ - ['空闲', '工作'][item.is_online] + {{ + ['空闲', '工作'][item.is_running] }} 工作状态 diff --git a/web/vue.config.js b/web/vue.config.js index 00aa3e2..56dc2c6 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -14,7 +14,7 @@ module.exports = defineConfig({ proxy: { '/api': { // 代理前缀,可以自定义(如 '/api') - target: 'http://192.168.0.187:19801', // 目标服务器地址 + target: 'http://192.168.0.187:19800', // 目标服务器地址 changeOrigin: true, // 是否改变请求源(跨域必备) pathRewrite: { '^/api': '' // 重写路径,去掉 '/api' 前缀