From fcd59a6fe686072b781a994a4b61f82cc5cff6c0 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期五, 29 十一月 2024 12:01:58 +0800 Subject: [PATCH] 计算模型表达式添加预测长度限制 --- src/views/model/pre/item/MmPredictItemForm.vue | 45 +++++++++++++++++++++++++++++++++++++-------- 1 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/views/model/pre/item/MmPredictItemForm.vue b/src/views/model/pre/item/MmPredictItemForm.vue index acb6797..c7d32b1 100644 --- a/src/views/model/pre/item/MmPredictItemForm.vue +++ b/src/views/model/pre/item/MmPredictItemForm.vue @@ -103,8 +103,9 @@ </el-row> <el-row v-if="dataForm.itemtypename === 'MergeItem'"> <el-col :span="12"> - <el-form-item label="预测长度"> + <el-form-item label="预测长度" prop="mmPredictItem.predictlength"> <el-input + @change="changePredictLength" v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度" maxlength="5"/> </el-form-item> @@ -202,7 +203,7 @@ </el-divider> <el-button v-if="dataForm.itemtypename === 'NormalItem'" - @click="addItemOutput(dataForm.mmItemOutputList)" + @click="addItemOutput()" type="primary" size="small"> 添加 @@ -386,9 +387,11 @@ v-model="scope.row.point" placeholder="请选择" filterable + :no-data-text="'无数据(predictlength:' + dataForm.mmPredictItem.predictlength + ')'" + @change="changeNormalItemSelect" style="width: 100%"> <el-option-group - v-for="group in modelparamListMap['NormalItem']" + v-for="group in modelparamListMap['NormalItem'].filter(e => e.predictlength == dataForm.mmPredictItem.predictlength)" :key="group.value" :label="group.label" > @@ -560,6 +563,7 @@ 'mmPredictItem.status': [{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'}], }) const formRef = ref() // 表单 Ref @@ -622,9 +626,8 @@ if (!formRef) return const valid = await formRef.value.validate() if (!valid) return - //校验模型输出 - if (dataForm.itemtypename === 'NormalItem') { + if (dataForm.value.itemtypename === 'NormalItem') { if (dataForm.value.mmItemOutputList == undefined || dataForm.value.mmItemOutputList.length <= 0) { message.error("模型输出不为空") return @@ -634,6 +637,22 @@ 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 === ''))) { message.error("模型输出数据异常") + flag = true + return + } + }) + if (flag) return + } + if (dataForm.value.itemtypename === 'MergeItem') { + if (expressionList.value == undefined || expressionList.value.length <= 1) { + message.error("表达式长度低于2") + return + } + + let flag = false + expressionList.value.forEach((e,index) => { + if (e.point == undefined || e.point === '' || e.operator == undefined || (e.operator === '' && index != expressionList.value.length - 1)) { + message.error("表达式数据异常") flag = true return } @@ -831,9 +850,12 @@ orderRow(rows) } -function addItemOutput(list) { - list.push({}) - orderItemOutput(list) +function addItemOutput() { + if (!dataForm.value.mmItemOutputList) { + dataForm.value.mmItemOutputList = [] + } + dataForm.value.mmItemOutputList.push({}) + orderItemOutput(dataForm.value.mmItemOutputList) } function deleteItemOutput(index: string, rows) { @@ -894,6 +916,13 @@ fileList.value = [] } +const changePredictLength = (value) => { + expressionList.value = [{ + point: '', + operator: '' + }] +} + /** 重置表单 */ const resetForm = () => { dataForm.value = { -- Gitblit v1.9.3