From 5c475d3ac8ee98713e0f0962dd9464daccfb9eb1 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期四, 28 十一月 2024 18:16:07 +0800 Subject: [PATCH] 模型参数改为output --- src/views/model/pre/item/MmPredictItemForm.vue | 84 ++++++++++++++++++--------- src/api/model/sche/model/index.ts | 40 +++++++++++-- 2 files changed, 89 insertions(+), 35 deletions(-) diff --git a/src/api/model/sche/model/index.ts b/src/api/model/sche/model/index.ts index 8863d31..16242f4 100644 --- a/src/api/model/sche/model/index.ts +++ b/src/api/model/sche/model/index.ts @@ -70,7 +70,7 @@ } // 查询模型参数列表 -export const getModelParamList = async () => { +export const getModelParamList = async (id) => { const dataPointList = ref([] as DataPointApi.DaPointVO) dataPointList.value = await DataPointApi.getPointList({}) @@ -91,13 +91,20 @@ status: CommonEnabled.ENABLE, itemtypename: 'NormalItem' }) - const itemList = [] + const normalItemList = [] if (predictItemList.value) { - predictItemList.value.forEach(item => { - itemList.push( + // 过滤掉本身 + predictItemList.value.filter(e => e.id !== id).forEach(item => { + normalItemList.push( { - id: item.id, - name: item.itemname + value: item.id, + label: item.itemname, + children: item.outPuts?.map(e => { + return { + value: e.id, + label: e.resultName + } + }) } ) }) @@ -118,9 +125,28 @@ }) } + + predictItemList.value = await PredictItemApi.getMmPredictItemList({ + status: CommonEnabled.ENABLE, + itemtypename: 'MergeItem' + }) + const mergeItemList = [] + if (predictItemList.value) { + // 过滤掉本身 + predictItemList.value.filter(e => e.id !== id).forEach(item => { + mergeItemList.push( + { + id: item.id, + name: item.itemname + } + ) + }) + } + return { 'DATAPOINT':pointList, - 'PREDICTITEM': itemList, + 'NormalItem': normalItemList, + 'MergeItem': mergeItemList, 'PLAN': planList, } } diff --git a/src/views/model/pre/item/MmPredictItemForm.vue b/src/views/model/pre/item/MmPredictItemForm.vue index 28e5345..acb6797 100644 --- a/src/views/model/pre/item/MmPredictItemForm.vue +++ b/src/views/model/pre/item/MmPredictItemForm.vue @@ -201,6 +201,7 @@ <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型输出 </el-divider> <el-button + v-if="dataForm.itemtypename === 'NormalItem'" @click="addItemOutput(dataForm.mmItemOutputList)" type="primary" size="small"> @@ -283,6 +284,7 @@ <el-table-column prop="" label="值" align="center" min-width="200"> <template #default="scope"> <el-input size="mini" v-model="scope.row.value" maxlength="256" + :disabled="scope.row.key === 'pyFile'" style="width:100%;height:100%"/> </template> </el-table-column> @@ -312,7 +314,26 @@ </el-table-column> <el-table-column prop="" label="参数名称" align="center"> <template #default="scope"> - <el-select + <el-select v-if="scope.row.modelparamtype === 'NormalItem'" + v-model="scope.row.modelparamid" + placeholder="请选择" + filterable + @change="changeModelparam(scope.row)" + style="width: 100%"> + <el-option-group + v-for="group in modelparamListMap['NormalItem']" + :key="group.value" + :label="group.label" + > + <el-option + v-for="item in group.children" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-option-group> + </el-select> + <el-select v-else v-model="scope.row.modelparamid" filterable @change="changeModelparam(scope.row)" @@ -358,18 +379,26 @@ style="width: 100%; margin-top: 5px;"> <el-table-column prop="" - label="预测项" + label="预测项(NormalItem)" align="center"> <template #default="scope"> <el-select v-model="scope.row.point" + placeholder="请选择" filterable - placeholder="请选择"> - <el-option - v-for="(item, index) in predictItemList" - :key="index" - :label="item.itemname" - :value="item.itemno"/> + style="width: 100%"> + <el-option-group + v-for="group in modelparamListMap['NormalItem']" + :key="group.value" + :label="group.label" + > + <el-option + v-for="item in group.children" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-option-group> </el-select> </template> </el-table-column> @@ -446,7 +475,6 @@ const pointNoList = ref([]) const pointList = ref([]) const pointMap = ref({}) -const predictItemList = ref([]) const modelparamListMap = ref({}) const modelparamMap = ref({}) const expressionList = ref([]) @@ -547,7 +575,7 @@ setDefaultFields() // 加载参数列表 - modelparamListMap.value = await ScheduleModelApi.getModelParamList() + modelparamListMap.value = await ScheduleModelApi.getModelParamList(id) // 获取预测项类型列表 itemTypeList.value = await MmItemType.getItemTypeList() @@ -563,11 +591,6 @@ // 获取mpk项目列表 mpkProjectList.value = await ProjectApi.list() - - // 获取normal列表 - predictItemList.value = await MmPredictItem.getMmPredictItemList({ - itemtypename: 'NormalItem' - }) // 获取数据点列表 pointNoList.value = await DaPoint.getPointList(queryParams) @@ -601,19 +624,23 @@ if (!valid) return //校验模型输出 - if (dataForm.value.mmItemOutputList == undefined || dataForm.value.mmItemOutputList.length <= 0) { - message.error("模型输出不为空") - return + if (dataForm.itemtypename === 'NormalItem') { + if (dataForm.value.mmItemOutputList == undefined || dataForm.value.mmItemOutputList.length <= 0) { + message.error("模型输出不为空") + return + } + + 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 === ''))) { + message.error("模型输出数据异常") + flag = true + return + } + }) + if (flag) return } - 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 === ''))) { - message.error("模型输出数据异常") - flag = true - } - }) - if (flag) return // 提交请求 formLoading.value = true @@ -679,7 +706,7 @@ let endIndex = (indexSub == -1 || (indexPlus < indexSub && indexPlus !== -1)) ? indexPlus : indexSub expressionList.value.push({ point: expression.substring(0, endIndex), - operator: expression.substring(endIndex, 1) + operator: expression.substring(endIndex, endIndex + 1) }) expression = expression.substring(endIndex + 1) } else { @@ -719,7 +746,8 @@ dataForm.value.mmPredictModel.modelparamstructure = '' if (response.data.loadFieldSetList && response.data.loadFieldSetList[0].propertyList) { response.data.loadFieldSetList[0].propertyList.forEach(function (value) { - if (value.key !== 'data1') { + //匹配 data数字 + if (!/^data\d+$/.test(value.key)) { dataForm.value.mmModelArithSettingsList.push({ key: value.key, name: value.name, -- Gitblit v1.9.3