<template>
|
<Dialog v-model="dialogVisible" :title="dialogTitle" width="50%">
|
<el-form
|
ref="formRef"
|
v-loading="formLoading"
|
:model="dataForm"
|
:rules="formRules"
|
label-width="120px"
|
>
|
<el-divider content-position="left">基本信息</el-divider>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="预测项名" prop="mmPredictItem.itemname">
|
<el-input v-model="dataForm.mmPredictItem.itemname" placeholder="预测项名"
|
maxlength="50"/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12" v-if="!!dataForm.id">
|
<el-form-item label="编号" prop="mmPredictItem.itemno">
|
<el-input v-model="dataForm.mmPredictItem.itemno" placeholder="编号" maxlength="50"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="类型" prop="mmPredictItem.itemtypeid">
|
<el-select
|
v-model="dataForm.mmPredictItem.itemtypeid" @change="changeItemtype"
|
placeholder="请选择">
|
<el-option
|
v-for="item in itemTypeList"
|
:key="item.id"
|
:label="item.itemtypename"
|
:value="item.id"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="粒度" prop="dataForm.mmPredictItem.granularity">
|
<el-select v-model="dataForm.mmPredictItem.granularity" placeholder="请选择">
|
<el-option
|
v-for="dict in getStrDictOptions(DICT_TYPE.TIME_GRANULARITY)"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="是否检查" prop="dataForm.mmPredictItem.workchecked">
|
<el-select v-model="dataForm.mmPredictItem.workchecked" placeholder="请选择">
|
<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="12">
|
<el-form-item label="是否启用" prop="dataForm.mmPredictItem.status">
|
<el-select v-model="dataForm.mmPredictItem.status" placeholder="请选择">
|
<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-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="管网" prop="dataForm.dmModuleItem.moduleid">
|
<el-select v-model="dataForm.dmModuleItem.moduleid" placeholder="请选择">
|
<el-option
|
v-for="item in moduleList"
|
:key="item.id"
|
:label="item.modulename"
|
:value="item.id"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="类别">
|
<el-input v-model="dataForm.dmModuleItem.categoryid" placeholder="类别" maxlength="64"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="排序" prop="dataForm.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-input
|
v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度"
|
maxlength="5"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型信息
|
</el-divider>
|
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'">
|
<el-col :span="12">
|
<el-form-item label="模型名称">
|
<el-input
|
v-model="dataForm.mmPredictModel.modelname" placeholder="模型名称"
|
maxlength="50"/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-upload
|
class="upload-demo"
|
:limit="1"
|
:file-list="fileList"
|
:before-upload="beforeUpload"
|
:on-success="uploadModelSuccess"
|
:on-error="uploadModelError"
|
:action="uploadUrl"
|
: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">
|
<Icon icon="ep:upload"/>
|
更新模型
|
</el-button>
|
</el-upload>
|
</el-col>
|
</el-row>
|
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'">
|
<el-col :span="12">
|
<el-form-item label="结果">
|
<el-select v-model="dataForm.mmPredictModel.resultstrid" placeholder="请选择">
|
<el-option
|
v-for="item in resultstridList"
|
:key="item.id"
|
:label="item.resultstr"
|
:value="item.id"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="编号" v-if="!!dataForm.id">
|
<el-input
|
v-model="dataForm.mmPredictModel.modelno" placeholder="编号" maxlength="32"
|
disabled/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'">
|
<el-col :span="24">
|
<el-form-item label="路径">
|
<el-input
|
v-model="dataForm.mmPredictModel.modelpath" placeholder="路径" maxlength="32"
|
disabled/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'">
|
<el-col :span="24">
|
<el-form-item label="类名">
|
<el-input
|
v-model="dataForm.mmPredictModel.classname" placeholder="类名" maxlength="32"
|
disabled/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="8" v-if="dataForm.itemtypename === 'NormalItem'">
|
<el-col :span="12">
|
<el-form-item label="方法名">
|
<el-input
|
v-model="dataForm.mmPredictModel.methodname" placeholder="方法名"
|
maxlength="32" disabled/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="参数">
|
<el-input
|
v-model="dataForm.mmPredictModel.modelparamstructure" placeholder="参数"
|
maxlength="32" disabled/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<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">
|
<template #default="scope">
|
<el-input size="mini" v-model="scope.row.value" maxlength="256"
|
style="width:100%;height:100%"/>
|
</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.mmModelParamList"
|
border
|
style="width: 100%; margin-top: 5px;">
|
<el-table-column prop="modelparamportorder" label="端口" width="60" align="center"/>
|
<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-option
|
v-for="dict in getStrDictOptions(DICT_TYPE.MODEL_PARAM_TYPE)"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column prop="" label="参数名称" align="center">
|
<template #default="scope">
|
<el-select
|
v-model="scope.row.modelparamid"
|
filterable
|
@change="changeModelparam(scope.row)"
|
placeholder="请选择">
|
<el-option
|
v-for="(item, index) in modelparamListMap[scope.row.modelparamtype]"
|
:key="index"
|
:label="item.name"
|
:value="item.id"/>
|
</el-select>
|
</template>
|
</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%"/>
|
</template>
|
</el-table-column>
|
<el-table-column prop="" label="操作" width="140" align="center">
|
<template #default="scope">
|
<el-button
|
@click="addRow(scope.$index, dataForm.mmModelParamList)"
|
type="text"
|
size="small">
|
添加
|
</el-button>
|
<el-button
|
@click="deleteRow(scope.$index, dataForm.mmModelParamList)"
|
type="text"
|
size="small">
|
删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-divider content-position="left" v-if="dataForm.itemtypename === 'MergeItem'">表达式
|
</el-divider>
|
<el-table
|
v-if="dataForm.itemtypename === 'MergeItem'"
|
:data="expressionList"
|
border
|
style="width: 100%; margin-top: 5px;">
|
<el-table-column
|
prop=""
|
label="预测项"
|
align="center">
|
<template #default="scope">
|
<el-select
|
v-model="scope.row.point"
|
filterable
|
placeholder="请选择">
|
<el-option
|
v-for="(item, index) in predictItemList"
|
:key="index"
|
:label="item.name"
|
:value="item.code"/>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="point"
|
label="编号"
|
align="center"/>
|
<el-table-column
|
prop=""
|
label="运算符"
|
align="center">
|
<template #default="scope">
|
<el-select v-model="scope.row.operator" placeholder="请选择">
|
<el-option
|
v-for="item in operatorList"
|
:key="item"
|
:label="item"
|
:value="item"/>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop=""
|
label="操作"
|
width="140"
|
align="center">
|
<template #default="scope">
|
<el-button
|
@click="addExpressionRow(scope.$index, expressionList)"
|
type="text"
|
size="small">
|
添加
|
</el-button>
|
<el-button
|
@click="deleteExpressionRow(scope.$index, expressionList)"
|
type="text"
|
size="small">
|
删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-form>
|
<template #footer>
|
<el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
</template>
|
</Dialog>
|
</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 DmModule from '@/api/model/pre/dm'
|
import * as MmResultTable from '@/api/model/pre/result'
|
import * as DaPoint from '@/api/data/da/point'
|
import {useUpload} from '@/api/model/pre/predict'
|
|
const {uploadUrl, httpRequest} = useUpload()
|
|
defineOptions({name: 'DataMmPredictItemForm'})
|
|
const {t} = useI18n() // 国际化
|
const message = useMessage() // 消息弹窗
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
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([])
|
const fileList = ref([])
|
const operatorList = ['+', '-']
|
const replaceModelOnly = ref(false)
|
const queryParams = reactive({
|
pageNo: 1,
|
pageSize: 10,
|
pointNo: undefined,
|
pointName: undefined,
|
})
|
const dataForm = ref({
|
id: undefined,
|
itemtypename: undefined,
|
mmPredictItem: {
|
id: undefined,
|
itemno: undefined,
|
itemname: undefined,
|
caltypeid: undefined,
|
itemtypeid: undefined,
|
predictlength: undefined,
|
granularity: 60,
|
status: undefined,
|
isfuse: undefined,
|
predictphase: undefined,
|
workchecked: 0,
|
unittransfactor: undefined,
|
saveindex: undefined
|
},
|
dmModuleItem: {
|
id: undefined,
|
moduleid: undefined,
|
itemid: undefined,
|
itemorder: 1,
|
status: undefined,
|
categoryid: undefined
|
},
|
mmItemOutput: {
|
id: undefined,
|
itemid: undefined,
|
pointid: undefined,
|
resulttableid: undefined,
|
tagname: undefined,
|
outputorder: undefined
|
},
|
mmPredictModel: {
|
id: undefined,
|
modelno: undefined,
|
modelname: undefined,
|
itemid: undefined,
|
arithid: undefined,
|
trainsamplength: undefined,
|
predictsamplength: undefined,
|
isonlinetrain: undefined,
|
modelpath: undefined,
|
isnormal: undefined,
|
normalmax: undefined,
|
normalmin: undefined,
|
status: undefined,
|
classname: undefined,
|
methodname: undefined,
|
modelparamstructure: undefined,
|
resultstrid: undefined,
|
settingmap: undefined
|
},
|
mmPredictMergeItem: {
|
id: undefined,
|
itemid: undefined,
|
expression: undefined,
|
num: undefined
|
},
|
mmModelArithSettingsList: [],
|
mmModelParamList: []
|
})
|
const formRules = reactive({
|
'mmPredictItem.itemname': [{required: true, message: '预测项名不能为空', trigger: 'blur'}],
|
'mmPredictItem.itemtypeid': [{required: true, message: '类型不能为空', trigger: 'blur'}],
|
'dataForm.mmPredictItem.granularity': [{
|
required: true,
|
message: '粒度不能为空',
|
trigger: 'blur'
|
}],
|
'dataForm.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'}],
|
|
})
|
const formRef = ref() // 表单 Ref
|
|
/** 打开弹窗 */
|
const open = async (type: string, id?: number, itemtypename?: string) => {
|
dialogVisible.value = true
|
dialogTitle.value = t('action.' + type)
|
formType.value = type
|
dataForm.value.itemtypename = itemtypename || 'NormalItem'
|
// resetForm()
|
resetFields(dataForm.value)
|
setDefaultFields()
|
getItemTypeList()
|
getModuleList()
|
getPointList()
|
getModelparamList()
|
getResulttableList()
|
getResultstridList()
|
// 修改时,设置数据
|
if (id) {
|
formLoading.value = true
|
try {
|
getInfo(id)
|
} finally {
|
formLoading.value = false
|
}
|
}
|
}
|
defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
|
/** 提交表单 */
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const submitForm = async () => {
|
// 校验表单
|
if (!formRef) return
|
const valid = await formRef.value.validate()
|
if (!valid) return
|
// 提交请求
|
formLoading.value = true
|
try {
|
const data = dataForm.value as unknown as MmPredictItem.MmPredictItemVO
|
if (expressionList.value && expressionList.value.length > 0) {
|
let expression = ''
|
for (let i = 0; i < expressionList.value.length; i++) {
|
let value = expressionList.value[i]
|
expression = expression + value.point + (i === (expressionList.value.length - 1) ? '' : value.operator)
|
}
|
dataForm.value.mmPredictMergeItem.expression = expression
|
} else {
|
dataForm.value.mmPredictMergeItem.expression = ''
|
}
|
if (dataForm.value.mmModelArithSettingsList) {
|
for (let item of dataForm.value.mmModelArithSettingsList) {
|
if (item.key === 'lenpredict') {
|
dataForm.value.mmPredictItem.predictlength = item.value
|
}
|
}
|
}
|
if (formType.value === 'create') {
|
await MmPredictItem.createMmPredictItem(data)
|
message.success(t('common.createSuccess'))
|
} else {
|
await MmPredictItem.updateMmPredictItem(data)
|
message.success(t('common.updateSuccess'))
|
}
|
dialogVisible.value = false
|
// 发送操作成功的事件
|
emit('success')
|
} finally {
|
formLoading.value = false
|
}
|
}
|
|
const resetFields = (obj) => {
|
for (let key in obj) {
|
if (key === 'itemtypename') {
|
continue
|
}
|
if (obj[key] instanceof Array) {
|
obj[key] = []
|
} else if (obj[key] instanceof Object) {
|
resetFields(obj[key])
|
} else {
|
obj[key] = ''
|
}
|
}
|
}
|
|
const getInfo = async (id) => {
|
dataForm.value = await MmPredictItem.getMmPredictItem(id)
|
expressionList.value = []
|
if (dataForm.value.mmPredictMergeItem && dataForm.value.mmPredictMergeItem.expression) {
|
let expression = dataForm.value.mmPredictMergeItem.expression
|
do {
|
let indexPlus = expression.indexOf('+')
|
let indexSub = expression.indexOf('-')
|
if (indexPlus !== -1 || indexSub !== -1) {
|
let endIndex = (indexSub == -1 || (indexPlus < indexSub && indexPlus !== -1)) ? indexPlus : indexSub
|
expressionList.value.push({
|
point: expression.substring(0, endIndex),
|
operator: expression.substring(endIndex, 1)
|
})
|
expression = expression.substring(endIndex + 1)
|
} else {
|
expressionList.value.push({
|
point: expression,
|
operator: ''
|
})
|
expression = ''
|
}
|
} while (expression && expression.length > 0)
|
}
|
}
|
|
function setReplaceModelOnly(value) {
|
replaceModelOnly.value = value
|
}
|
|
function beforeUpload(file) {
|
let fileName = file.name
|
let first = fileName.lastIndexOf('.')
|
let nameLength = fileName.length
|
let fileSuffix = fileName.substring(first + 1, nameLength)
|
if (fileSuffix !== 'miail') {
|
message.error('只能上传miail类型文件')
|
return
|
}
|
}
|
|
function uploadModelSuccess(response, file, fileList) {
|
if (response.code === 0) {
|
message.success(t('上传成功'))
|
dataForm.value.mmModelArithSettingsList = []
|
if (!replaceModelOnly.value) {
|
dataForm.value.mmModelParamList = []
|
}
|
dataForm.value.mmPredictModel.modelpath = ''
|
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') {
|
dataForm.value.mmModelArithSettingsList.push({
|
key: value.key,
|
name: value.name,
|
valuetype: value.valueType,
|
value: value.value
|
})
|
}
|
})
|
}
|
dataForm.value.mmPredictModel.modelname = response.data.originalFilename
|
dataForm.value.mmPredictModel.classname = response.data.className
|
dataForm.value.mmPredictModel.methodname = response.data.methodName
|
if (response.data.paramPathList) {
|
dataForm.value.mmPredictModel.modelpath = response.data.paramPathList[0]
|
}
|
if (response.data.paramsArray) {
|
dataForm.value.mmPredictModel.modelparamstructure = response.data.paramsArray.join(',')
|
}
|
if (response.data.paramsCount && !replaceModelOnly.value) {
|
for (let i = 0; i < response.data.paramsCount; i++) {
|
dataForm.value.mmModelParamList.push({
|
modelparamportorder: (i + 1),
|
modelparamorder: (i + 1),
|
modelparamtype: '',
|
modelparamid: '',
|
modelparamname: '',
|
datalength: 0
|
})
|
}
|
}
|
if (response.data.settingConfigMap && response.data.settingConfigMap.settingMap) {
|
dataForm.value.mmPredictModel.settingmap = JSON.stringify(response.data.settingConfigMap.settingMap)
|
}
|
} else {
|
message.error('上传失败!' + response.msg)
|
return
|
}
|
fileList = []
|
}
|
|
function uploadModelError(file, err, fileList) {
|
}
|
|
function changeModelparam(row) {
|
row.modelparamname = modelparamMap[row.modelparamid]
|
}
|
|
function changeItemtype(value) {
|
dataForm.value.itemtypename = itemTypeMap[value]
|
}
|
|
function changeModelparamtype(value, row) {
|
row.modelparamid = ''
|
}
|
|
function changeOutputPoint(value) {
|
dataForm.value.mmItemOutput.tagname = pointMap[value]
|
}
|
|
function deleteExpressionRow(index, rows) {
|
rows.splice(index, 1)
|
}
|
|
function addExpressionRow(index, rows) {
|
let row = JSON.parse(JSON.stringify(rows[index]))
|
rows.splice(index, 0, row)
|
}
|
|
function deleteRow(index: string, rows) {
|
if (!rows || rows.length === 1) {
|
message.error('不能全部删除!')
|
return
|
}
|
rows.splice(index, 1)
|
orderRow(rows)
|
}
|
|
function addRow(index: string, rows) {
|
let row = JSON.parse(JSON.stringify(rows[index]))
|
rows.splice(index, 0, row)
|
orderRow(rows)
|
}
|
|
function orderRow(rows) {
|
let modelparamorder = 0
|
let modelparamportorder = 0
|
rows.forEach(function (value) {
|
if (value.modelparamportorder !== modelparamportorder) {
|
modelparamportorder = value.modelparamportorder
|
modelparamorder = 1
|
}
|
value.modelparamorder = modelparamorder
|
modelparamorder++
|
})
|
}
|
|
// 获取预测项类型列表
|
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.mmPredictItem.isfuse = 0
|
dataForm.value.mmPredictItem.predictphase = 0
|
dataForm.value.mmPredictItem.unittransfactor = 1
|
dataForm.value.mmPredictItem.saveindex = '2'
|
dataForm.value.dmModuleItem.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'
|
expressionList.value = [{
|
point: '',
|
operator: ''
|
}]
|
fileList.value = []
|
}
|
|
/** 重置表单 */
|
const resetForm = () => {
|
dataForm.value = {
|
mmModelArithSettingsList: [],
|
mmModelParamList: [],
|
id: '',
|
itemtypename: '',
|
mmPredictItem: {
|
id: '',
|
itemno: '',
|
itemname: '',
|
caltypeid: '',
|
itemtypeid: '',
|
predictlength: '',
|
granularity: 60,
|
status: '',
|
isfuse: '',
|
predictphase: '',
|
workchecked: 0,
|
unittransfactor: '',
|
saveindex: ''
|
},
|
dmModuleItem: {
|
id: '',
|
moduleid: '',
|
itemid: '',
|
itemorder: 1,
|
status: 1,
|
categoryid: ''
|
},
|
mmItemOutput: {
|
id: '',
|
itemid: '',
|
pointid: '',
|
resulttableid: '3cc2b483-3a01-40f7-a419-0c260210d8eb',
|
tagname: '',
|
outputorder: 1
|
},
|
mmPredictModel: {
|
id: '',
|
modelno: '',
|
modelname: '',
|
itemid: '',
|
arithid: '',
|
trainsamplength: '',
|
predictsamplength: '',
|
isonlinetrain: '',
|
modelpath: '',
|
isnormal: '',
|
normalmax: '',
|
normalmin: '',
|
status: 1,
|
classname: '',
|
methodname: '',
|
modelparamstructure: '',
|
resultstrid: '',
|
settingmap: ''
|
},
|
mmPredictMergeItem: {
|
id: '',
|
itemid: '',
|
expression: '',
|
num: ''
|
}
|
}
|
formRef.value?.resetFields()
|
}
|
|
onMounted(() => {
|
init()
|
})
|
|
function init() {
|
}
|
</script>
|