|
@@ -119,7 +119,9 @@
|
|
|
<!-- 参数弹框 -->
|
|
|
<el-dialog title="策略参数维护" :visible.sync="openParameterDialog" width="50%" append-to-body>
|
|
|
<div>
|
|
|
- <h2>默认参数:</h2>
|
|
|
+ <div class="container-block">
|
|
|
+ <SubTitle title="默认参数" />
|
|
|
+ </div>
|
|
|
<div v-for="param in defaultParams" :key="param.paramName">
|
|
|
<label class="param-label">{{ param.paramName }}</label>
|
|
|
<el-input v-if="param.paramValueFormat === 'text'" v-model="param.paramValue" placeholder="请输入" @change="handleParamChange"></el-input>
|
|
@@ -129,13 +131,17 @@
|
|
|
:key="item.key"
|
|
|
:label="item.name"
|
|
|
:value="item.key">
|
|
|
+ <el-tooltip :content="item.desc" placement="top">
|
|
|
+ <div>{{ item.name }}</div>
|
|
|
+ </el-tooltip>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 模型参数输入框/下拉框 -->
|
|
|
- <!-- 模式参数 -->
|
|
|
- <h2>模式参数:</h2>
|
|
|
+ <div class="container-block">
|
|
|
+ <SubTitle title="模式参数" />
|
|
|
+ </div>
|
|
|
<div v-if="selectedParamValue === 'maxPowerTrack'">
|
|
|
<!-- 当 selectedParamValue 为 'maxPowerTrack' 时,不显示任何模式参数 -->
|
|
|
</div>
|
|
@@ -146,17 +152,21 @@
|
|
|
:key="item.key"
|
|
|
:label="item.name"
|
|
|
:value="item.key">
|
|
|
+ <el-tooltip :content="item.desc" placement="top">
|
|
|
+ <div>{{ item.name }}</div>
|
|
|
+ </el-tooltip>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
<div v-if="selectedParamValue === 'powerAndVoltage'">
|
|
|
<!-- 当 selectedParamValue 为 'powerAndVoltage' 时,显示文本框 -->
|
|
|
- <div v-for="item in defaultParamsOption" :key="item.paramName">
|
|
|
+ <div v-for="item in defaultParamsOption" :key="item.paramName" class="param-container">
|
|
|
<label>{{ item.paramName }}</label>
|
|
|
- <el-input v-if="item.paramValueFormat === 'text'" v-model="item.paramValue"></el-input>
|
|
|
+ <el-input v-if="item.paramValueFormat === 'text'" v-model="item.paramValue" class="param-containerInput"></el-input>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="updateOpEnergyStrategy">确认</el-button>
|
|
|
<el-button @click="openParameterDialog = false">关闭</el-button>
|
|
|
</div>
|
|
|
|
|
@@ -288,11 +298,13 @@ import {
|
|
|
updateOpEnergyStrategy, updateStrategyStep
|
|
|
} from '@/api/mgr/OpEnergyStrategy'
|
|
|
import { Tooltip } from 'element-ui';
|
|
|
+import SubTitle from "@/components/SubTitle/index.vue";
|
|
|
+import BaseChart from "@/components/BaseChart/index.vue";
|
|
|
|
|
|
export default {
|
|
|
name: 'EnergyStrategy',
|
|
|
dicts: ['strategy_type', 'allow_modify', 'exec_mode'],
|
|
|
- components: {Treeselect},
|
|
|
+ components: {BaseChart, SubTitle, Treeselect},
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -337,6 +349,9 @@ export default {
|
|
|
modeParams: [], // 存储模式参数的数据
|
|
|
currentStrategyCode:'',
|
|
|
defaultParamsOption:[],
|
|
|
+ paramKeys:'',//获取"controlMode": "reactivePower"、 "voltage":
|
|
|
+ paramValues:'',
|
|
|
+ savedParams: {}, // 用于存储用户保存的参数
|
|
|
|
|
|
stepDialogVisible:false,
|
|
|
strategyStepOption:[],
|
|
@@ -410,7 +425,6 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
|
|
|
-
|
|
|
methods: {
|
|
|
/** 查询能源策略列表 */
|
|
|
getList() {
|
|
@@ -456,6 +470,7 @@ export default {
|
|
|
this.ids = selection.map(item => item.id);
|
|
|
this.single = selection.length !== 1;
|
|
|
this.multiple = !selection.length;
|
|
|
+
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
@@ -471,20 +486,24 @@ export default {
|
|
|
console.log("参数按钮操作!!!!!",row)
|
|
|
this.currentStrategyCode=row.strategyCode
|
|
|
this.openParameterDialog = true; // 打开弹框
|
|
|
- this.getStrategyParam(row.strategyCode); // 获取默认参数
|
|
|
- this.getStrategyParamOption(row.strategyType, 'default.controlMode'); // 获取参数选项
|
|
|
+ this.getStrategyParam(row.strategyCode);
|
|
|
+ this.getStrategyParamOption(row.strategyType, 'default.controlMode');
|
|
|
+ console.log("打开参数弹框时的 selectedParamValue:", this.selectedParamValue);
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
/** 获取默认参数 */
|
|
|
getStrategyParam(strategyCode) {
|
|
|
getStrategyParam(strategyCode).then(response => {
|
|
|
const params = response.data.default.controlMode;
|
|
|
this.defaultParams = [
|
|
|
- { paramName: params.paramName, paramValue: params.paramValue, paramValueFormat: params.paramValueFormat },
|
|
|
+ { paramName: params.paramName, paramValue: this.selectedParamValue, paramValueFormat: params.paramValueFormat },
|
|
|
];
|
|
|
console.log(" 获取默认参数", this.defaultParams)
|
|
|
- console.log("response.data", response.data);
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
/** 获取参数选项 */
|
|
|
getStrategyParamOption(strategyType, paramKey) {
|
|
|
getStrategyParamOption({strategyType, paramKey}).then(response => {
|
|
@@ -501,25 +520,35 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
-
|
|
|
handleParamChange(value) {
|
|
|
this.selectedParamValue = value;
|
|
|
console.log("选中的参数值:", this.selectedParamValue);
|
|
|
- this.modelParamValue = '';
|
|
|
- // 根据选中的参数值决定调用哪个接口
|
|
|
switch (this.selectedParamValue) {
|
|
|
case 'maxPowerTrack':
|
|
|
// 无模式参数
|
|
|
this.modelParamOptions = [];
|
|
|
break;
|
|
|
case 'inverterControl':
|
|
|
+ getStrategyParam(this.currentStrategyCode).then(response => {
|
|
|
+ const inverterControlParams = response.data.inverterControl;
|
|
|
+ console.log("inverterControlParams",inverterControlParams)
|
|
|
+ this.paramKeys = Object.keys(inverterControlParams);
|
|
|
+ console.log("Param Keys:", this.paramKeys);
|
|
|
+ });
|
|
|
this.getStrategyParamOptions(1, 'inverterControl.controlMode');
|
|
|
break;
|
|
|
case 'powerAndVoltage':
|
|
|
+
|
|
|
// 直接展示文本框,不需要调用接口
|
|
|
getStrategyParam(this.currentStrategyCode).then(response => {
|
|
|
const powerAndVoltageParams = response.data.powerAndVoltage;
|
|
|
+ this.paramKeys = Object.keys(powerAndVoltageParams);
|
|
|
this.defaultParamsOption = Object.values(powerAndVoltageParams);
|
|
|
+ // 重置 powerAndVoltage 模式下的参数值
|
|
|
+ this.defaultParamsOption.forEach((item) => {
|
|
|
+ item.paramValue = ''; // 或者设置为某个初始值
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
break;
|
|
|
default:
|
|
@@ -527,17 +556,56 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- /**------------------------------------------------------步骤流程图弹框*/
|
|
|
+ updateOpEnergyStrategy() {
|
|
|
+ // 根据 selectedParamValue 确定参数结构
|
|
|
+ if (this.selectedParamValue === 'powerAndVoltage') {
|
|
|
+ this.paramKeys.forEach((key, index) => {
|
|
|
+ const requestBody = {
|
|
|
+ strategyCode: this.currentStrategyCode,
|
|
|
+ paramGroup: this.selectedParamValue,
|
|
|
+ paramKey: key,
|
|
|
+ paramValue: this.defaultParamsOption[index].paramValue,
|
|
|
+ };
|
|
|
+ console.log("requestBody",requestBody)
|
|
|
+ updateOpEnergyStrategy(requestBody).then(response => {
|
|
|
+ if (response || response.data || response.data.success) {
|
|
|
+ this.$message.success('参数修改成功');
|
|
|
+ this.openParameterDialog = false; // 关闭弹框
|
|
|
+ } else {
|
|
|
+ this.$message.error('参数修改失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }else if(this.selectedParamValue === 'inverterControl'){
|
|
|
+ this.paramKeys.forEach((key, index) => {
|
|
|
+ const requestBody = {
|
|
|
+ strategyCode: this.currentStrategyCode,
|
|
|
+ paramGroup: this.selectedParamValue,
|
|
|
+ paramKey: key,
|
|
|
+ paramValue: this.selectedParamKey,
|
|
|
+ };
|
|
|
+ console.log("requestBody",requestBody)
|
|
|
+ updateOpEnergyStrategy(requestBody).then(response => {
|
|
|
+ if (response || response.data || response.data.success) {
|
|
|
+ this.$message.success('参数修改成功');
|
|
|
+ this.openParameterDialog = false; // 关闭弹框
|
|
|
+ } else {
|
|
|
+ this.$message.error('参数修改失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**步骤流程图弹框*/
|
|
|
handleStep(row){
|
|
|
this.stepDialogVisible=true;
|
|
|
+ this.editMode=false;
|
|
|
this.currentRow = row; // 保存当前行的数据
|
|
|
getStrategyStep(row.strategyCode).then(response => {
|
|
|
this.strategyStepOption=response.data
|
|
|
- console.log("this.strategyStepOption",this.strategyStepOption)
|
|
|
this.activeStep = 1;
|
|
|
// 默认展示第一个步骤的详情
|
|
|
- this.currentStepDetail = this.strategyStepOption[0];
|
|
|
- console.log("默认展示第一个步骤的详情",this.currentStepDetail)
|
|
|
+ this.currentStepDetail = this.strategyStepOption[0] || {};
|
|
|
this.editMode = false;
|
|
|
})
|
|
|
},
|
|
@@ -550,7 +618,7 @@ export default {
|
|
|
id:'',
|
|
|
stepName: '',
|
|
|
stepCode: '',
|
|
|
- stepIndex: this.strategyStepOption.length + 1,
|
|
|
+ stepIndex: this.strategyStepOption.length + 1 || 1,
|
|
|
stepHandler: '',
|
|
|
stepParam: '',
|
|
|
targetFacs: '',
|
|
@@ -562,17 +630,6 @@ export default {
|
|
|
this.currentStepDetail = newStep;
|
|
|
this.editMode = true;
|
|
|
},
|
|
|
- // saveStep() {
|
|
|
- // // 调用更新接口,更新步骤信息
|
|
|
- // console.log("保存!!!!!!!!!!!!!!!",this.currentStepDetail)
|
|
|
- // addStrategyStep(this.currentStepDetail).then(response => {
|
|
|
- // this.$message.success('保存成功');
|
|
|
- // // 重新加载步骤信息
|
|
|
- // this.handleStep(this.currentRow);
|
|
|
- // }).catch(error => {
|
|
|
- // console.error('保存失败', error);
|
|
|
- // });
|
|
|
- // },
|
|
|
|
|
|
saveStep() {
|
|
|
// 克隆当前步骤详情,以避免直接修改原始数据
|
|
@@ -609,7 +666,7 @@ export default {
|
|
|
console.error('删除失败', error);
|
|
|
});
|
|
|
},
|
|
|
- /** --------------------------------修改按钮操作 */
|
|
|
+ /** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
const id = row.id || this.ids;
|
|
@@ -693,5 +750,18 @@ export default {
|
|
|
display: inline-block;
|
|
|
margin-right: 10px;
|
|
|
}
|
|
|
+.param-container {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 10px; /* 根据需要调整间距 */
|
|
|
+}
|
|
|
+.param-containerInput {
|
|
|
+ width: 40%;
|
|
|
+}
|
|
|
+
|
|
|
+.param-container label {
|
|
|
+ margin-right: 10px; /* 根据需要调整标签和输入框之间的间距 */
|
|
|
+ white-space: nowrap; /* 防止标签换行 */
|
|
|
+}
|
|
|
|
|
|
</style>
|