| | |
| | | <template> |
| | | <Dialog v-model="dialogVisible" :title="dialogTitle" width="50%"> |
| | | <Dialog v-model="dialogVisible" :title="dialogTitle" width="60%"> |
| | | <el-form |
| | | ref="formRef" |
| | | v-loading="formLoading" |
| | | :model="dataForm" |
| | | :rules="formRules" |
| | | label-width="120px" |
| | | label-width="100px" |
| | | > |
| | | <el-divider content-position="left">基本信息</el-divider> |
| | | <el-row> |
| | |
| | | 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> |
| | |
| | | </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.PRED_GRANULARITY)" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | |
| | | </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)" |
| | |
| | | </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)" |
| | |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="管网" prop="dataForm.dmModuleItem.moduleid"> |
| | | <el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择"> |
| | | <el-form-item label="管网" prop="dmModuleItem.moduleid"> |
| | | <el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择" @change="clearExpressionList"> |
| | | <el-option |
| | | v-for="item in moduleList" |
| | | :key="item.id" |
| | |
| | | </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-select |
| | | v-model="dataForm.mmItemOutput.pointid" |
| | | filterable |
| | | @change="changeOutputPoint" |
| | | 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-row v-if="dataForm.itemtypename === 'MergeItem'"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="预测长度"> |
| | | <el-form-item label="预测长度" prop="mmPredictItem.predictlength"> |
| | | <el-input |
| | | @change="clearExpressionList" |
| | | v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度" |
| | | maxlength="5"/> |
| | | </el-form-item> |
| | |
| | | :on-success="uploadModelSuccess" |
| | | :on-error="uploadModelError" |
| | | :action="uploadUrl" |
| | | :show-file-list="false" |
| | | :http-request="httpRequest"> |
| | | <el-button type="primary" @click="setReplaceModelOnly(false)"> |
| | | <Icon icon="ep:upload"/> |
| | | 上传模型 |
| | | </el-button> |
| | | <el-button |
| | | size="small" type="primary" @click="setReplaceModelOnly(true)" |
| | | v-if="!!dataForm.id"> |
| | | <el-button type="primary" plain @click="setReplaceModelOnly(true)"> |
| | | <Icon icon="ep:upload"/> |
| | | 更新模型 |
| | | </el-button> |
| | | </el-upload> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'"> |
| | | <el-row v-if="dataForm.itemtypename === 'NormalItem'"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="结果"> |
| | | <el-select v-model="dataForm.mmPredictModel.resultstrid" placeholder="请选择"> |
| | | <el-form-item label="关联项目" prop="mmPredictModel.mpkprojectid"> |
| | | <el-select v-model="dataForm.mmPredictModel.mpkprojectid" placeholder="请选择"> |
| | | <el-option |
| | | v-for="item in resultstridList" |
| | | v-for="item in mpkProjectList" |
| | | :key="item.id" |
| | | :label="item.resultstr" |
| | | :label="item.projectName" |
| | | :value="item.id"/> |
| | | </el-select> |
| | | </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> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型输出 |
| | | </el-divider> |
| | | <el-button |
| | | v-if="dataForm.itemtypename === 'NormalItem'" |
| | | @click="addItemOutput()" |
| | | type="primary" |
| | | size="small"> |
| | | 添加 |
| | | </el-button> |
| | | <el-table |
| | | v-if="dataForm.itemtypename === 'NormalItem'" |
| | | :data="dataForm.mmItemOutputList" |
| | | border |
| | | style="width: 100%; margin-top: 5px;"> |
| | | <el-table-column prop="outputorder" label="排序" align="center" width="80px"/> |
| | | <el-table-column label="结果KEY" align="center" width="150px"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.resultstr" placeholder="请输入"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="结果类型" align="center" width="150px"> |
| | | <template #default="scope"> |
| | | <el-select |
| | | v-model="scope.row.resultType" |
| | | @change="(value) => resultTypeChange(value,scope.row)" |
| | | filterable |
| | | placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getIntDictOptions(DICT_TYPE.MODEL_RESULT_TYPE)" |
| | | :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 style="width:100%;hight:100%" :disabled="scope.row.resultType !== 2" |
| | | v-model="scope.row.resultIndex" :min="0" step-strictly |
| | | controls-position="right"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="结果名称" align="center" width="150px"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.resultName" placeholder="请输入"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="数据点" align="center"> |
| | | <template #default="scope"> |
| | | <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 prop="" label="操作" width="80" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | @click="deleteItemOutput(scope.$index, dataForm.mmItemOutputList)" |
| | | type="text" |
| | | size="small"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型设置参数 |
| | | </el-divider> |
| | | <el-table |
| | | v-if="dataForm.itemtypename === 'NormalItem'" |
| | | :data="dataForm.mmModelArithSettingsList" |
| | | border |
| | | style="width: 100%; margin-top: 5px;"> |
| | | <el-table-column prop="key" label="键" align="center"/> |
| | | <el-table-column prop="name" label="名称" align="center"/> |
| | | <el-table-column prop="valuetype" label="类型" align="center"/> |
| | | <el-table-column prop="" label="值" align="center" min-width="150"> |
| | | <el-table-column prop="key" label="键" align="center" min-width="150"/> |
| | | <el-table-column prop="name" label="名称" align="center" min-width="150"/> |
| | | <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 size="mini" v-model="scope.row.value" maxlength="1000" |
| | | :disabled="scope.row.key === 'pyFile'" |
| | | style="width:100%;height:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">输入参数 |
| | | <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型输入参数 |
| | | </el-divider> |
| | | <el-table |
| | | v-if="dataForm.itemtypename === 'NormalItem'" |
| | |
| | | <el-table-column prop="modelparamorder" label="序号" width="60" align="center"/> |
| | | <el-table-column prop="" label="类型" width="200" align="center"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.modelparamtype" placeholder="请选择"> |
| | | <el-select v-model="scope.row.modelparamtype" |
| | | @change="changeModelparamtype(scope.row)" |
| | | placeholder="请选择"> |
| | | <el-option |
| | | v-for="dict in getStrDictOptions(DICT_TYPE.MODEL_PARAM_TYPE)" |
| | | :key="dict.value" |
| | |
| | | </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)" |
| | |
| | | </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"> |
| | | <el-table-column prop="" label="操作" width="120" align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | @click="addRow(scope.$index, dataForm.mmModelParamList)" |
| | | type="text" |
| | | size="small"> |
| | | size="mini"> |
| | | 添加 |
| | | </el-button> |
| | | <el-button |
| | | @click="deleteRow(scope.$index, dataForm.mmModelParamList)" |
| | | @click="deleteRow(scope.$index, scope.row, dataForm.mmModelParamList)" |
| | | type="text" |
| | | size="small"> |
| | | size="mini"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | |
| | | 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.name" |
| | | :value="item.code"/> |
| | | :no-data-text="'无数据(预测长度:' + dataForm.mmPredictItem.predictlength + ';管网:' + 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 && e.moduleid === dataForm.dmModuleItem.moduleid)" |
| | | :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> |
| | |
| | | label="运算符" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.operator" placeholder="请选择"> |
| | | <el-select v-model="scope.row.operator" placeholder="请选择" clearable> |
| | | <el-option |
| | | v-for="item in operatorList" |
| | | :key="item" |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import {DICT_TYPE, getIntDictOptions, getStrDictOptions} from '@/utils/dict' |
| | | import * as MmPredictItem from '@/api/model/pre/predict' |
| | | import * as MmItemType from '@/api/model/pre/item' |
| | | import * as MmPredictItem from '@/api/model/pre/item' |
| | | import * as MmItemType from '@/api/model/pre/type' |
| | | import * as DmModule from '@/api/model/pre/dm' |
| | | import * as MmResultTable from '@/api/model/pre/result' |
| | | import * as ProjectApi from '@/api/model/mpk/project' |
| | | import * as DaPoint from '@/api/data/da/point' |
| | | import {useUpload} from '@/api/model/pre/predict' |
| | | import {useUpload} from '@/api/model/pre/item' |
| | | import * as ScheduleModelApi from '@/api/model/sche/model' |
| | | |
| | | const {uploadUrl, httpRequest} = useUpload() |
| | | |
| | |
| | | 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 mpkProjectList = 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([]) |
| | |
| | | }) |
| | | const dataForm = ref({ |
| | | id: undefined, |
| | | itemtypename: undefined, |
| | | itemtypename: 'NormalItem', |
| | | mmPredictItem: { |
| | | id: undefined, |
| | | itemno: undefined, |
| | |
| | | status: undefined, |
| | | categoryid: undefined |
| | | }, |
| | | mmItemOutput: { |
| | | id: undefined, |
| | | itemid: undefined, |
| | | pointid: undefined, |
| | | resulttableid: undefined, |
| | | tagname: undefined, |
| | | outputorder: undefined |
| | | }, |
| | | mmItemOutputList: [], |
| | | mmPredictModel: { |
| | | id: undefined, |
| | | modelno: undefined, |
| | |
| | | methodname: undefined, |
| | | modelparamstructure: undefined, |
| | | resultstrid: undefined, |
| | | settingmap: undefined |
| | | settingmap: undefined, |
| | | mpkprojectid: undefined |
| | | }, |
| | | mmPredictMergeItem: { |
| | | id: undefined, |
| | |
| | | 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'}], |
| | | 'mmPredictItem.predictlength': [{required: true, message: '预测长度不能为空', trigger: 'blur'}], |
| | | 'mmPredictModel.mpkprojectid': [{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() |
| | | |
| | | // 加载参数列表 |
| | | modelparamListMap.value = await ScheduleModelApi.getModelParamList(id) |
| | | |
| | | // 获取预测项类型列表 |
| | | 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 |
| | | } |
| | | |
| | | // 获取管网列表 |
| | | moduleList.value = await DmModule.getModuleList() |
| | | |
| | | // 获取mpk项目列表 |
| | | mpkProjectList.value = await ProjectApi.list() |
| | | |
| | | // 获取数据点列表 |
| | | pointNoList.value = await DaPoint.getPointList(queryParams) |
| | | if (pointNoList.value.length > 0) { |
| | | pointList.value = [] |
| | | pointNoList.value.forEach(function (value) { |
| | | pointList.value.push(value) |
| | | pointMap[value.id] = value.pointName |
| | | }) |
| | | } |
| | | |
| | | // 修改时,设置数据 |
| | | if (id) { |
| | | formLoading.value = true |
| | |
| | | formLoading.value = false |
| | | } |
| | | } |
| | | formLoading.value = false |
| | | } |
| | | defineExpose({open}) // 提供 open 方法,用于打开弹窗 |
| | | |
| | |
| | | if (!formRef) return |
| | | const valid = await formRef.value.validate() |
| | | if (!valid) return |
| | | //校验模型输出 |
| | | if (dataForm.value.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.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 |
| | | } |
| | | }) |
| | | if (flag) return |
| | | } |
| | | |
| | | |
| | | // 提交请求 |
| | | formLoading.value = true |
| | | try { |
| | |
| | | } |
| | | if (dataForm.value.mmModelArithSettingsList) { |
| | | for (let item of dataForm.value.mmModelArithSettingsList) { |
| | | if (item.key === 'lenpredict') { |
| | | if (item.key === 'predictLength') { |
| | | dataForm.value.mmPredictItem.predictlength = item.value |
| | | } |
| | | } |
| | |
| | | |
| | | const getInfo = async (id) => { |
| | | dataForm.value = await MmPredictItem.getMmPredictItem(id) |
| | | dataForm.value.itemtypename = itemTypeMap[dataForm.value.mmPredictItem.itemtypeid] |
| | | expressionList.value = [] |
| | | if (dataForm.value.mmPredictMergeItem && dataForm.value.mmPredictMergeItem.expression) { |
| | | let expression = dataForm.value.mmPredictMergeItem.expression |
| | |
| | | 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 { |
| | |
| | | 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, |
| | |
| | | dataForm.value.itemtypename = itemTypeMap[value] |
| | | } |
| | | |
| | | function changeModelparamtype(value, row) { |
| | | function changeModelparamtype(row) { |
| | | row.modelparamid = '' |
| | | } |
| | | |
| | | function changeOutputPoint(value) { |
| | | dataForm.value.mmItemOutput.tagname = pointMap[value] |
| | | function changeOutputPoint(value, row) { |
| | | row.tagname = pointMap[value] |
| | | } |
| | | |
| | | function deleteExpressionRow(index, rows) { |
| | |
| | | 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) |
| | |
| | | let row = JSON.parse(JSON.stringify(rows[index])) |
| | | rows.splice(index, 0, row) |
| | | orderRow(rows) |
| | | } |
| | | |
| | | function addItemOutput() { |
| | | if (!dataForm.value.mmItemOutputList) { |
| | | dataForm.value.mmItemOutputList = [] |
| | | } |
| | | dataForm.value.mmItemOutputList.push({}) |
| | | orderItemOutput(dataForm.value.mmItemOutputList) |
| | | } |
| | | |
| | | function deleteItemOutput(index: string, rows) { |
| | | if (!rows || rows.length === 1) { |
| | | message.error('不能全部删除!') |
| | | return |
| | | } |
| | | rows.splice(index, 1) |
| | | orderItemOutput(rows) |
| | | } |
| | | |
| | | function orderItemOutput(list) { |
| | | list.sort((a, b) => a.outputorder - b.outputorder); |
| | | let outputorder = 1 |
| | | list.forEach(function (value) { |
| | | value.outputorder = outputorder |
| | | outputorder++ |
| | | }) |
| | | } |
| | | |
| | | function resultTypeChange(value, row) { |
| | | if (value === 1) { |
| | | row.resultIndex = undefined |
| | | } else if (value === 2) { |
| | | row.resultIndex = 0 |
| | | } |
| | | } |
| | | |
| | | function orderRow(rows) { |
| | |
| | | }) |
| | | } |
| | | |
| | | // 获取预测项类型列表 |
| | | 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 |
| | |
| | | dataForm.value.mmPredictModel.trainsamplength = 60 |
| | | dataForm.value.mmPredictModel.isonlinetrain = 0 |
| | | dataForm.value.mmPredictModel.status = 1 |
| | | dataForm.value.mmItemOutput.outputorder = 1 |
| | | dataForm.value.mmItemOutput.resulttableid = '3cc2b483-3a01-40f7-a419-0c260210d8eb' |
| | | dataForm.value.mmItemOutputList = [] |
| | | expressionList.value = [{ |
| | | point: '', |
| | | operator: '' |
| | | }] |
| | | fileList.value = [] |
| | | } |
| | | |
| | | const clearExpressionList = (value) => { |
| | | expressionList.value = [{ |
| | | point: '', |
| | | operator: '' |
| | | }] |
| | | } |
| | | |
| | | /** 重置表单 */ |
| | |
| | | mmModelArithSettingsList: [], |
| | | mmModelParamList: [], |
| | | id: '', |
| | | itemtypename: '', |
| | | itemtypename: 'NormalItem', |
| | | mmPredictItem: { |
| | | id: '', |
| | | itemno: '', |
| | |
| | | status: 1, |
| | | categoryid: '' |
| | | }, |
| | | mmItemOutput: { |
| | | id: '', |
| | | itemid: '', |
| | | pointid: '', |
| | | resulttableid: '3cc2b483-3a01-40f7-a419-0c260210d8eb', |
| | | tagname: '', |
| | | outputorder: 1 |
| | | }, |
| | | mmItemOutputList: [], |
| | | mmPredictModel: { |
| | | id: '', |
| | | modelno: '', |