refactor(config): 更新配置文件和组件逻辑

- 在 `EditCom.vue` 中修改 `workModeIdSelect` 的监听器,添加异步处理逻辑,并引入新的方法 `getPolicyList` 以获取策略列表。
- 在 `device.vue` 中更新状态显示逻辑,使用 `is_error` 和 `is_running` 替换 `is_online`。
This commit is contained in:
zhoumengru
2025-09-18 16:02:43 +08:00
parent 575dc0478c
commit 4916d34b39
4 changed files with 31 additions and 20 deletions

View File

@@ -693,20 +693,7 @@ export const stationOptions = [
value: undefined, value: undefined,
key: 'policy_id', key: 'policy_id',
type: 'unshow', type: 'unshow',
list: [ list: []
{
label: '削峰套利',
value: '1'
},
{
label: '需求响应',
value: '2'
},
{
label: '自发自用',
value: '3'
}
]
} }
], ],
ruleForm: {} ruleForm: {}

View File

@@ -176,14 +176,21 @@ export default {
computed: {}, computed: {},
watch: { watch: {
workModeIdSelect: { workModeIdSelect: {
handler(n) { async handler(n,o) {
if(n !== o){
this.detailInfos[0].ruleForm.policy_id=''
}
switch (n) { switch (n) {
case '1': case '1':
this.detailInfos[0].list[this.detailInfos[0].list.length - 1].type = 'select' 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 break
case '5': case '5':
this.detailInfos[0].list[this.detailInfos[0].list.length - 1].type = 'select' 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 break
default: default:
@@ -263,6 +270,23 @@ export default {
console.log('modal') console.log('modal')
}, },
methods: { 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() { async getRoleIdList() {
const params = { const params = {
page_size: 1000, page_size: 1000,

View File

@@ -21,15 +21,15 @@
<span class="text">在线状态</span> <span class="text">在线状态</span>
</div> </div>
<div class="status-item"> <div class="status-item">
<a-tag :color="item.is_online == 0 ? 'green' : 'red'">{{ <a-tag :color="item.is_error == 0 ? 'green' : 'red'">{{
['正常', '错误'][item.is_online] ['正常', '错误'][item.is_error]
}}</a-tag> }}</a-tag>
<span class="text">故障状态</span> <span class="text">故障状态</span>
</div> </div>
<div class="status-item"> <div class="status-item">
<a-tag :color="item.is_online == 0 ? 'orange' : 'green'">{{ <a-tag :color="item.is_running == 0 ? 'orange' : 'green'">{{
['空闲', '工作'][item.is_online] ['空闲', '工作'][item.is_running]
}}</a-tag> }}</a-tag>
<span class="text">工作状态</span> <span class="text">工作状态</span>

View File

@@ -14,7 +14,7 @@ module.exports = defineConfig({
proxy: { proxy: {
'/api': { '/api': {
// 代理前缀,可以自定义(如 '/api' // 代理前缀,可以自定义(如 '/api'
target: 'http://192.168.0.187:19801', // 目标服务器地址 target: 'http://192.168.0.187:19800', // 目标服务器地址
changeOrigin: true, // 是否改变请求源(跨域必备) changeOrigin: true, // 是否改变请求源(跨域必备)
pathRewrite: { pathRewrite: {
'^/api': '' // 重写路径,去掉 '/api' 前缀 '^/api': '' // 重写路径,去掉 '/api' 前缀