From 0359df4402149d0717757426dfe715d2bed307d9 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期四, 13 二月 2025 13:46:35 +0800 Subject: [PATCH] 预测数据加一条Y轴,展示累计值 --- src/views/model/pre/item/MmPredictItemForm.vue | 179 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 144 insertions(+), 35 deletions(-) diff --git a/src/views/model/pre/item/MmPredictItemForm.vue b/src/views/model/pre/item/MmPredictItemForm.vue index c7d32b1..52eae1e 100644 --- a/src/views/model/pre/item/MmPredictItemForm.vue +++ b/src/views/model/pre/item/MmPredictItemForm.vue @@ -1,5 +1,5 @@ <template> - <Dialog v-model="dialogVisible" :title="dialogTitle" width="60%"> + <Dialog v-model="dialogVisible" :title="dialogTitle" width="75%"> <el-form ref="formRef" v-loading="formLoading" @@ -78,7 +78,7 @@ <el-row> <el-col :span="12"> <el-form-item label="管网" prop="dmModuleItem.moduleid"> - <el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择"> + <el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择" @change="clearExpressionList"> <el-option v-for="item in moduleList" :key="item.id" @@ -101,16 +101,69 @@ </el-form-item> </el-col> </el-row> - <el-row v-if="dataForm.itemtypename === 'MergeItem'"> - <el-col :span="12"> - <el-form-item label="预测长度" prop="mmPredictItem.predictlength"> - <el-input - @change="changePredictLength" - v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度" - maxlength="5"/> - </el-form-item> - </el-col> - </el-row> + <div v-if="dataForm.itemtypename === 'MergeItem'"> + <el-row> + <el-col :span="12"> + <el-form-item label="预测长度" prop="mmPredictItem.predictlength"> + <el-input + v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度" + maxlength="5"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="真实数据点"> + <el-select + v-model="dataForm.pointId" + filterable + clearable + placeholder="请选择"> + <el-option + v-for="item in pointList" + :key="item.id" + :label="item.pointName" + :value="item.id"/> + </el-select> + </el-form-item> + </el-col> + </el-row> + <el-divider content-position="left">累计配置</el-divider> + <el-row> + <el-col :span="6"> + <el-form-item label="是否累计" prop="iscumulant"> + <el-select v-model="dataForm.iscumulant" placeholder="请选择" @change="(value) => iscumulantChange(dataForm)"> + <el-option + v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="累计除数" prop="cumuldivisor"> + <el-input-number v-model="dataForm.cumuldivisor" style="width: 100%" :disabled="dataForm.iscumulant !== 1" + :min="1" :max="60" + :controls="false"/> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="累计测点"> + <el-select + v-model="dataForm.cumulpoint" :disabled="dataForm.iscumulant !== 1" + filterable + clearable + placeholder="请选择"> + <el-option + v-for="item in pointList.filter(e => e.pointType === 'CUMULATE')" + :key="item.id" + :label="item.pointName" + :value="item.id"/> + </el-select> + </el-form-item> + </el-col> + </el-row> + </div> <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型信息 </el-divider> <el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'"> @@ -136,9 +189,7 @@ <Icon icon="ep:upload"/> 上传模型 </el-button> - <el-button - size="small" type="primary" @click="setReplaceModelOnly(true)" - v-if="formType.value === 'update'"> + <el-button type="primary" plain @click="setReplaceModelOnly(true)"> <Icon icon="ep:upload"/> 更新模型 </el-button> @@ -147,7 +198,7 @@ </el-row> <el-row v-if="dataForm.itemtypename === 'NormalItem'"> <el-col :span="12"> - <el-form-item label="关联项目"> + <el-form-item label="关联项目" prop="mmPredictModel.mpkprojectid"> <el-select v-model="dataForm.mmPredictModel.mpkprojectid" placeholder="请选择"> <el-option v-for="item in mpkProjectList" @@ -251,10 +302,46 @@ <el-select v-model="scope.row.pointid" filterable + clearable @change="(value) => changeOutputPoint(value,scope.row)" placeholder="请选择"> <el-option v-for="item in pointList" + :key="item.id" + :label="item.pointName" + :value="item.id"/> + </el-select> + </template> + </el-table-column> + <el-table-column label="是否累计" align="center" width="150px"> + <template #default="scope"> + <el-select v-model="scope.row.iscumulant" placeholder="请选择" @change="(value) => iscumulantChange(scope.row)"> + <el-option + v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" + :key="dict.value" + :label="dict.label" + :value="dict.value" + /> + </el-select> + </template> + </el-table-column> + <el-table-column label="累计除数" align="center" width="100px"> + <template #default="scope"> + <el-input-number v-model="scope.row.cumuldivisor" style="width: 100%" + :min="1" :max="60" :disabled="scope.row.iscumulant !== 1" + :controls="false"/> + </template> + </el-table-column> + <el-table-column label="累计数据点" align="center"> + <template #default="scope"> + <el-select + v-model="scope.row.cumulpoint" + :disabled="scope.row.iscumulant !== 1" + filterable + clearable + placeholder="请选择"> + <el-option + v-for="item in pointList.filter(e => e.pointType === 'CUMULATE')" :key="item.id" :label="item.pointName" :value="item.id"/> @@ -284,7 +371,7 @@ <el-table-column prop="valuetype" label="类型" align="center" min-width="150"/> <el-table-column prop="" label="值" align="center" min-width="200"> <template #default="scope"> - <el-input size="mini" v-model="scope.row.value" maxlength="256" + <el-input v-model="scope.row.value" maxlength="1000" :disabled="scope.row.key === 'pyFile'" style="width:100%;height:100%"/> </template> @@ -358,14 +445,12 @@ <template #default="scope"> <el-button @click="addRow(scope.$index, dataForm.mmModelParamList)" - type="text" - size="mini"> + type="text"> 添加 </el-button> <el-button - @click="deleteRow(scope.$index, dataForm.mmModelParamList)" - type="text" - size="mini"> + @click="deleteRow(scope.$index, scope.row, dataForm.mmModelParamList)" + type="text"> 删除 </el-button> </template> @@ -387,11 +472,11 @@ v-model="scope.row.point" placeholder="请选择" filterable - :no-data-text="'无数据(predictlength:' + dataForm.mmPredictItem.predictlength + ')'" + :no-data-text="'无数据(管网:' + moduleList.find(e => e.id === dataForm.dmModuleItem.moduleid)?.modulename + ')'" @change="changeNormalItemSelect" style="width: 100%"> <el-option-group - v-for="group in modelparamListMap['NormalItem'].filter(e => e.predictlength == dataForm.mmPredictItem.predictlength)" + v-for="group in modelparamListMap['NormalItem'].filter(e => e.moduleid === dataForm.dmModuleItem.moduleid)" :key="group.value" :label="group.label" > @@ -460,6 +545,7 @@ import * as DaPoint from '@/api/data/da/point' import {useUpload} from '@/api/model/pre/item' import * as ScheduleModelApi from '@/api/model/sche/model' +import {getPointSimpleList} from "@/api/data/da/point"; const {uploadUrl, httpRequest} = useUpload() @@ -506,7 +592,7 @@ predictphase: undefined, workchecked: 0, unittransfactor: undefined, - saveindex: undefined + saveindex: undefined, }, dmModuleItem: { id: undefined, @@ -545,7 +631,11 @@ num: undefined }, mmModelArithSettingsList: [], - mmModelParamList: [] + mmModelParamList: [], + pointId: undefined, + iscumulant: 0, + cumuldivisor: undefined, + cumulpoint: undefined, }) const formRules = reactive({ 'mmPredictItem.itemname': [{required: true, message: '预测项名不能为空', trigger: 'blur'}], @@ -561,9 +651,11 @@ trigger: 'blur' }], 'mmPredictItem.status': [{required: true, message: '是否启用不能为空', trigger: 'blur'}], + 'iscumulant': [{required: true, message: '是否累计不能为空', trigger: 'blur'}], 'dmModuleItem.moduleid': [{required: true, message: '管网不能为空', trigger: 'blur'}], 'dmModuleItem.itemorder': [{required: true, message: '排序不能为空', trigger: 'blur'}], 'mmPredictItem.predictlength': [{required: true, message: '预测长度不能为空', trigger: 'blur'}], + 'mmPredictModel.mpkprojectid': [{required: true, message: '关联项目不能为空', trigger: 'blur'}], }) const formRef = ref() // 表单 Ref @@ -597,7 +689,7 @@ mpkProjectList.value = await ProjectApi.list() // 获取数据点列表 - pointNoList.value = await DaPoint.getPointList(queryParams) + pointNoList.value = await DaPoint.getPointSimpleList(queryParams) if (pointNoList.value.length > 0) { pointList.value = [] pointNoList.value.forEach(function (value) { @@ -626,6 +718,13 @@ if (!formRef) return const valid = await formRef.value.validate() if (!valid) return + //校验累计配置 + if (dataForm.value.iscumulant === 1) { + if (dataForm.value.cumuldivisor == undefined) { + message.error("累计除数不为空") + return + } + } //校验模型输出 if (dataForm.value.itemtypename === 'NormalItem') { if (dataForm.value.mmItemOutputList == undefined || dataForm.value.mmItemOutputList.length <= 0) { @@ -635,7 +734,10 @@ let flag = false dataForm.value.mmItemOutputList.forEach(e => { - if (e.resultstr == undefined || e.resultstr === '' || e.resultType == undefined || e.resultType === '' || e.pointid == undefined || e.pointid === '' || (e.resultType === 2 && (e.resultIndex == undefined || e.resultIndex === ''))) { + if (e.resultstr == undefined || e.resultstr === '' || e.resultType == undefined || e.resultType === '' + || (e.resultType === 2 && (e.resultIndex == undefined || e.resultIndex === '')) + || (e.iscumulant === 1 && e.cumuldivisor == undefined) + ) { message.error("模型输出数据异常") flag = true return @@ -651,7 +753,7 @@ let flag = false expressionList.value.forEach((e,index) => { - if (e.point == undefined || e.point === '' || e.operator == undefined || (e.operator === '' && index != expressionList.value.length - 1)) { + if (e.point == undefined || e.point === '' || ((e.operator == undefined || e.operator === '') && index != expressionList.value.length - 1)) { message.error("表达式数据异常") flag = true return @@ -835,9 +937,9 @@ rows.splice(index, 0, row) } -function deleteRow(index: string, rows) { - if (!rows || rows.length === 1) { - message.error('不能全部删除!') +function deleteRow(index, row, rows) { + if (!rows || rows.length === 1 || rows.filter(e => e.modelparamportorder === row.modelparamportorder).length === 1) { + message.error('不可删除!') return } rows.splice(index, 1) @@ -883,6 +985,10 @@ row.resultIndex = 0 } } +function iscumulantChange(row) { + row.cumuldivisor = undefined + row.cumulpoint = undefined +} function orderRow(rows) { let modelparamorder = 0 @@ -916,7 +1022,7 @@ fileList.value = [] } -const changePredictLength = (value) => { +const clearExpressionList = (value) => { expressionList.value = [{ point: '', operator: '' @@ -943,7 +1049,7 @@ predictphase: '', workchecked: 0, unittransfactor: '', - saveindex: '' + saveindex: '', }, dmModuleItem: { id: '', @@ -979,7 +1085,10 @@ itemid: '', expression: '', num: '' - } + }, + iscumulant: 0, + cumuldivisor: undefined, + cumulpoint: '', } formRef.value?.resetFields() } -- Gitblit v1.9.3