Files
emsfront/src/views/ems/dzjk/clpz/clyx/index.vue

130 lines
3.5 KiB
Vue
Raw Normal View History

2025-06-25 12:55:58 +08:00
<template>
2025-07-13 00:29:19 +08:00
<div v-loading="loading">
2025-07-13 16:13:45 +08:00
<template v-if="!showTemp">
<el-button v-if="!showTemp" type="primary" plain @click="settingStrategy" style="margin-bottom: 20px;">新增策略</el-button>
<cl-container v-for="(item,index) in list" :key="index+'clContainer'" :info="item" :hide-setting-btn="showTemp" class="contain" @update="init" @showSetting="settingStrategy(item)">
<template v-slot:default>
<div class="cl-items cl-items-main" @click="toDetail(item.mainStrategyId,item.mainStrategyName)">
<div class="cl-header">主策略</div>
<div class="cl-content" >
<div class="cl-name">{{item.mainStrategyName}}</div>
</div>
2025-07-13 00:29:19 +08:00
</div>
2025-07-13 16:13:45 +08:00
<div class="cl-items" v-show="item.auxStrategyName" @click="toDetail(item.auxStrategyId,item.auxStrategyName)">
<div class="cl-header">辅助策略</div>
<div class="cl-content">
<div class="cl-name">{{item.auxStrategyName}}</div>
</div>
2025-07-13 00:29:19 +08:00
</div>
2025-07-13 16:13:45 +08:00
</template>
</cl-container>
<div v-if="list.length === 0">
<el-empty :image-size="200" ></el-empty>
</div>
</template>
<xftg ref="xftgTemp" v-else/>
<setting ref="setting"/>
</div>
2025-06-25 12:55:58 +08:00
</template>
<script>
2025-07-13 00:29:19 +08:00
import Setting from './../Setting.vue'
2025-06-26 01:29:16 +08:00
import ClContainer from './../ClContainer.vue'
2025-07-12 15:55:05 +08:00
import getQuerySiteId from '@/mixins/ems/getQuerySiteId'
2025-07-13 16:13:45 +08:00
import Xftg from './../xftg/index.vue'
2025-07-13 00:29:19 +08:00
import {strategyRunningList} from '@/api/ems/dzjk'
2025-06-25 12:55:58 +08:00
export default {
name:'DzjkClpzClyx',
2025-07-13 16:13:45 +08:00
components:{ClContainer,Setting,Xftg},
2025-07-12 15:55:05 +08:00
mixins: [getQuerySiteId],
2025-06-25 12:55:58 +08:00
data() {
return {
2025-07-13 16:13:45 +08:00
showTemp:false,
updateStrategyId:'',
updateStrategyName:'',
2025-07-13 00:29:19 +08:00
loading:false,
list:[],
2025-06-25 12:55:58 +08:00
}
},
2025-07-13 00:29:19 +08:00
provide(){
return {$home:this}
},
2025-07-12 15:55:05 +08:00
methods:{
2025-07-13 00:29:19 +08:00
settingStrategy(item=''){
this.$refs.setting.showSettingDialog(item)
},
init(){
this.loading = true
this.list = []
strategyRunningList(this.siteId).then(response => {
this.list =JSON.parse(JSON.stringify(response?.data || {}))
}).finally(() => {this.loading=false})
2025-07-13 16:13:45 +08:00
this.$nextTick(() => {
// 每次切换站点 展示策略运行 清空策略配置的数据
this.$refs['xftgTemp'] && this.$refs['xftgTemp'].changeSiteId()
this.showTemp=false
this.updateStrategyId=''
this.updateStrategyName=''
})
2025-07-13 00:29:19 +08:00
},
2025-07-13 16:13:45 +08:00
toDetail(id,name){
this.updateStrategyId=id
this.updateStrategyName = name
this.showTemp = true
this.$nextTick(() => {
this.$refs['xftgTemp'].init()
2025-07-13 00:29:19 +08:00
})
}
2025-07-12 15:55:05 +08:00
},
2025-06-25 12:55:58 +08:00
}
</script>
<style scoped lang="scss">
2025-07-13 00:29:19 +08:00
.contain{
margin-bottom: 20px;
}
2025-06-26 01:29:16 +08:00
.clyx-main{
padding:0 12px 0 12px;
.cl-items{
2025-07-13 00:29:19 +08:00
cursor: pointer;
2025-06-26 01:29:16 +08:00
width: 228px;
height: 156px;
display: inline-block;
margin:24px 12px 0 12px;
font-size:14px;
color:#333333;
border: 1px solid #eeeeee;
.cl-header{
background: #FFE5AC;
text-align: center;
font-size:16px;
line-height: 40px;
height: 40px;
width: 100%;
}
.cl-content{
background-color: #ffffff;
position: relative;
height: 114px;
width: 100%;
.cl-name{
position: absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
}
}
&.cl-items-main{
.cl-header{
background: #FFBE29;
}
.cl-content{
background-color: #FFF2CB;
}
}
}
}
2025-06-25 12:55:58 +08:00
</style>