From e1ff2dfdc5b7cfa04a73a508187651d342fac04b Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 26 九月 2024 18:46:32 +0800 Subject: [PATCH] PRE ITEM 测点配置 --- src/views/model/pre/item/MmPredictItemForm.vue | 174 +++++++++++++++++++--------------------------------------- src/views/model/sche/model/index.vue | 0 src/views/model/sche/scheme/index.vue | 0 src/views/model/sche/scheme/ScheduleSchemeForm.vue | 0 src/views/model/sche/model/ScheduleModelForm.vue | 0 5 files changed, 57 insertions(+), 117 deletions(-) diff --git a/src/views/model/pre/item/MmPredictItemForm.vue b/src/views/model/pre/item/MmPredictItemForm.vue index bd2b6d3..11d9120 100644 --- a/src/views/model/pre/item/MmPredictItemForm.vue +++ b/src/views/model/pre/item/MmPredictItemForm.vue @@ -15,9 +15,9 @@ maxlength="50"/> </el-form-item> </el-col> - <el-col :span="12" v-if="!!dataForm.id"> + <el-col :span="12"> <el-form-item label="编号" prop="mmPredictItem.itemno"> - <el-input v-model="dataForm.mmPredictItem.itemno" placeholder="编号" maxlength="50"/> + <el-input v-model="dataForm.mmPredictItem.itemno" placeholder="编号" maxlength="50" readonly/> </el-form-item> </el-col> </el-row> @@ -36,10 +36,10 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="粒度" prop="dataForm.mmPredictItem.granularity"> + <el-form-item label="粒度" prop="mmPredictItem.granularity"> <el-select v-model="dataForm.mmPredictItem.granularity" placeholder="请选择"> <el-option - v-for="dict in getStrDictOptions(DICT_TYPE.TIME_GRANULARITY)" + v-for="dict in getIntDictOptions(DICT_TYPE.TIME_GRANULARITY)" :key="dict.value" :label="dict.label" :value="dict.value" @@ -50,7 +50,7 @@ </el-row> <el-row> <el-col :span="12"> - <el-form-item label="是否检查" prop="dataForm.mmPredictItem.workchecked"> + <el-form-item label="是否检查" prop="mmPredictItem.workchecked"> <el-select v-model="dataForm.mmPredictItem.workchecked" placeholder="请选择"> <el-option v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" @@ -62,7 +62,7 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="是否启用" prop="dataForm.mmPredictItem.status"> + <el-form-item label="是否启用" prop="mmPredictItem.status"> <el-select v-model="dataForm.mmPredictItem.status" placeholder="请选择"> <el-option v-for="dict in getIntDictOptions(DICT_TYPE.COM_IS_INT)" @@ -76,7 +76,7 @@ </el-row> <el-row> <el-col :span="12"> - <el-form-item label="管网" prop="dataForm.dmModuleItem.moduleid"> + <el-form-item label="管网" prop="dmModuleItem.moduleid"> <el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择"> <el-option v-for="item in moduleList" @@ -94,13 +94,13 @@ </el-row> <el-row> <el-col :span="12"> - <el-form-item label="排序" prop="dataForm.dmModuleItem.itemorder"> + <el-form-item label="排序" prop="dmModuleItem.itemorder"> <el-input-number v-model="dataForm.dmModuleItem.itemorder" :min="1" clearable controls-position="right"/> </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="数据点" prop="dataForm.mmItemOutput.pointid"> + <el-form-item label="数据点" prop="mmItemOutput.pointid"> <el-select v-model="dataForm.mmItemOutput.pointid" filterable @@ -150,7 +150,7 @@ </el-button> <el-button size="small" type="primary" @click="setReplaceModelOnly(true)" - v-if="!!dataForm.id"> + v-if="formType.value === 'update'"> <Icon icon="ep:upload"/> 更新模型 </el-button> @@ -170,9 +170,9 @@ </el-form-item> </el-col> <el-col :span="12"> - <el-form-item label="编号" v-if="!!dataForm.id"> + <el-form-item label="编号"> <el-input - v-model="dataForm.mmPredictModel.modelno" placeholder="编号" maxlength="32" + v-model="dataForm.mmPredictModel.modelno" placeholder="编号" maxlength="30" readonly disabled/> </el-form-item> </el-col> @@ -264,9 +264,9 @@ </el-table-column> <el-table-column prop="" label="参数长度" width="120" align="center"> <template #default="scope"> - <el-input - v-model="scope.row.datalength" maxlength="50" - style="width:100%;height:100%"/> + <el-input-number v-model="scope.row.datalength" :min="0" clearable + controls-position="right" + style="width:100%;hight:100%"/> </template> </el-table-column> <el-table-column prop="" label="操作" width="140" align="center"> @@ -364,6 +364,7 @@ import * as MmResultTable from '@/api/model/pre/result' import * as DaPoint from '@/api/data/da/point' import {useUpload} from '@/api/model/pre/predict' +import * as ScheduleModelApi from '@/api/model/sche/model' const {uploadUrl, httpRequest} = useUpload() @@ -375,18 +376,14 @@ const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 -const pointLoading = ref(false) const itemTypeList = ref([]) const itemTypeMap = ref({}) const moduleList = ref([]) -const resulttableList = ref([]) const resultstridList = ref([]) const pointNoList = ref([]) const pointList = ref([]) const pointMap = ref({}) -const predictList = ref([]) const predictItemList = ref([]) -const modelparamList = ref([]) const modelparamListMap = ref({}) const modelparamMap = ref({}) const expressionList = ref([]) @@ -401,7 +398,7 @@ }) const dataForm = ref({ id: undefined, - itemtypename: undefined, + itemtypename: 'NormalItem', mmPredictItem: { id: undefined, itemno: undefined, @@ -465,48 +462,72 @@ const formRules = reactive({ 'mmPredictItem.itemname': [{required: true, message: '预测项名不能为空', trigger: 'blur'}], 'mmPredictItem.itemtypeid': [{required: true, message: '类型不能为空', trigger: 'blur'}], - 'dataForm.mmPredictItem.granularity': [{ + 'mmPredictItem.granularity': [{ required: true, message: '粒度不能为空', trigger: 'blur' }], - 'dataForm.mmPredictItem.workchecked': [{ + 'mmPredictItem.workchecked': [{ required: true, message: '是否检查不能为空', trigger: 'blur' }], - 'dataForm.mmPredictItem.status': [{required: true, message: '是否启用不能为空', trigger: 'blur'}], - 'dataForm.dmModuleItem.moduleid': [{required: true, message: '管网不能为空', trigger: 'blur'}], - 'dataForm.dmModuleItem.itemorder': [{required: true, message: '排序不能为空', trigger: 'blur'}], - 'dataForm.mmItemOutput.pointid': [{required: true, message: '数据点不能为空', trigger: 'blur'}], + 'mmPredictItem.status': [{required: true, message: '是否启用不能为空', trigger: 'blur'}], + 'dmModuleItem.moduleid': [{required: true, message: '管网不能为空', trigger: 'blur'}], + 'dmModuleItem.itemorder': [{required: true, message: '排序不能为空', trigger: 'blur'}], + 'mmItemOutput.pointid': [{required: true, message: '数据点不能为空', trigger: 'blur'}], }) const formRef = ref() // 表单 Ref /** 打开弹窗 */ const open = async (type: string, id?: number, itemtypename?: string) => { + formType.value = type dialogVisible.value = true dialogTitle.value = t('action.' + type) - formType.value = type dataForm.value.itemtypename = itemtypename || 'NormalItem' - // resetForm() + resetForm() resetFields(dataForm.value) setDefaultFields() - getItemTypeList() - getModuleList() - getPointList() - getModelparamList() - getResulttableList() - getResultstridList() // 修改时,设置数据 if (id) { formLoading.value = true try { getInfo(id) } finally { - formLoading.value = false + /*formLoading.value = false*/ } } + + // 加载参数列表 + modelparamListMap.value = await ScheduleModelApi.getModelParamList() + + // 获取预测项类型列表 + itemTypeList.value = await MmItemType.getItemTypeList() + itemTypeList.value.forEach(function (value) { + itemTypeMap[value.id] = value.itemtypename + }) + if (!dataForm.value.id) { + dataForm.value.mmPredictItem.itemtypeid = itemTypeList.value[0].id + } + dataForm.value.itemtypename = itemTypeMap[dataForm.value.mmPredictItem.itemtypeid] + + // 获取管网列表 + moduleList.value = await DmModule.getModuleList() + + // 获取结果字符串列表 + resultstridList.value = await MmResultTable.getResultstridList() + + // 获取数据点列表 + pointNoList.value = await DaPoint.getPointList(queryParams) + if (pointNoList.value.length > 0) { + pointNoList.value.forEach(function (value) { + pointList.value.push(value) + pointMap[value.id] = value.pointname + }) + } + + formLoading.value = false } defineExpose({open}) // 提供 open 方法,用于打开弹窗 @@ -717,87 +738,6 @@ }) } -// 获取预测项类型列表 -const getItemTypeList = async () => { - itemTypeList.value = [] - itemTypeList.value = await MmItemType.getItemTypeList() - itemTypeList.value.forEach(function (value) { - itemTypeMap[value.id] = value.itemtypename - }) - if (!dataForm.value.id) { - dataForm.value.mmPredictItem.itemtypeid = itemTypeList.value[0].id - } -} - -// 获取管网列表 -const getModuleList = async () => { - moduleList.value = [] - moduleList.value = await DmModule.getModuleList() -} - -const getResulttableList = async () => { - resulttableList.value = [] - resulttableList.value = await MmResultTable.getResulttableList() -} - -const getResultstridList = async () => { - resultstridList.value = [] - resultstridList.value = await MmResultTable.getResultstridList() -} - -const getPointList = async () => { - pointLoading.value = true - pointNoList.value = await DaPoint.getPointList(queryParams) - if (pointNoList.value.length > 0) { - pointNoList.value.forEach(function (value) { - pointList.value.push(value) - pointMap[value.id] = value.pointname - }) - } -} - -const getModelparamList = async () => { - modelparamListMap.value = [] - modelparamList.value = [] - predictItemList.value = [] - pointNoList.value = await DaPoint.getPointList(queryParams) - let paramList = [] - if (pointNoList.value.length > 0) { - pointNoList.value.forEach(function (value) { - paramList.push({ - id: value.id, - code: value.pointno, - name: value.pointname, - type: 'DATAPOINT' - }) - modelparamMap[value.id] = value.pointname - }) - modelparamListMap['DATAPOINT'] = paramList; - } - - predictList.value = await MmPredictItem.getMmPredictItemList() - paramList = [] - if (predictList.value.length > 0) { - predictList.value.forEach(function (value) { - paramList.push({ - id: value.id, - code: value.itemno, - name: value.itemname, - type: 'PREDICTITEM' - }) - if (value.id !== dataForm.value.id) { - predictItemList.value.push({ - id: value.id, - code: value.itemno, - name: value.itemname - }) - } - modelparamMap[value.id] = value.itemname - }) - modelparamListMap['PREDICTITEM'] = paramList; - } -} - const setDefaultFields = () => { dataForm.value.mmPredictItem.workchecked = 0 dataForm.value.mmPredictItem.status = 1 @@ -824,7 +764,7 @@ mmModelArithSettingsList: [], mmModelParamList: [], id: '', - itemtypename: '', + itemtypename: 'NormalItem', mmPredictItem: { id: '', itemno: '', diff --git a/src/views/model/mcs/sche/model/ScheduleModelForm.vue b/src/views/model/sche/model/ScheduleModelForm.vue similarity index 100% rename from src/views/model/mcs/sche/model/ScheduleModelForm.vue rename to src/views/model/sche/model/ScheduleModelForm.vue diff --git a/src/views/model/mcs/sche/model/index.vue b/src/views/model/sche/model/index.vue similarity index 100% rename from src/views/model/mcs/sche/model/index.vue rename to src/views/model/sche/model/index.vue diff --git a/src/views/model/mcs/sche/scheme/ScheduleSchemeForm.vue b/src/views/model/sche/scheme/ScheduleSchemeForm.vue similarity index 100% rename from src/views/model/mcs/sche/scheme/ScheduleSchemeForm.vue rename to src/views/model/sche/scheme/ScheduleSchemeForm.vue diff --git a/src/views/model/mcs/sche/scheme/index.vue b/src/views/model/sche/scheme/index.vue similarity index 100% rename from src/views/model/mcs/sche/scheme/index.vue rename to src/views/model/sche/scheme/index.vue -- Gitblit v1.9.3