策略运行

This commit is contained in:
白菜
2025-07-13 00:29:19 +08:00
parent 3308887e4c
commit be1fb382ff
6 changed files with 150 additions and 64 deletions

View File

@ -1,32 +1,41 @@
<template>
<el-container class="clyx-container">
<el-header class="clyx-header">
<div class="clyx-title">策略状态<span class="clyx-status save">已运行</span></div>
<div class="clyx-title">策略状态<span class="clyx-status save">{{strategyStatusOptions[info.status]}}</span></div>
<div class="clyx-btns">
<el-button v-if="!hideSettingBtn" size="small" @click="$refs.setting.dialogFormVisible = true">配置</el-button>
<el-button type="warning" class="alarm-btn" size="small" @click='close'>停止策略</el-button>
<el-button v-if="!hideSettingBtn" size="small" @click="$emit('showSetting')">配置</el-button>
<el-button v-if="info.status === '1'" type="warning" class="alarm-btn" size="small" @click='close'>停止策略</el-button>
</div>
</el-header>
<el-main class="clyx-main">
<slot name="default"></slot>
<setting ref="setting"/>
</el-main>
</el-container>
</template>
<script>
import Setting from './Setting.vue'
import {mapState} from "vuex";
import {stopStrategyRunning} from '@/api/ems/dzjk'
export default {
name:'DzjkClpzClContainer',
components:{Setting},
props:{
hideSettingBtn:{
type:Boolean,
default:false
},
info:{
type:Object,
default:()=>{return {}},
}
},
computed:{
...mapState({
strategyStatusOptions: state => state.ems.strategyStatusOptions,
})
},
data() {
return {
loading:true
}
},
methods:{
@ -40,13 +49,13 @@ export default {
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
instance.confirmButtonLoading = true;
setTimeout(() => {
// todo 调用接口如果关机成功 调用done方法 否则不关闭弹窗
done();
// setTimeout(() => {
this.loading = true
stopStrategyRunning(this.info.id).then(response => {
response.code === 200 && done();
}).finally(() => {
this.loading = false
instance.confirmButtonLoading = false;
// }, 300);
}, 3000);
})
} else {
done();
}
@ -57,6 +66,7 @@ export default {
type: 'success',
message: '停止策略成功!'
});
this.$emit('update')
}).catch(() => {
//取消复位
});