liriming
2024-09-23 cd9f113e55f8bf78065861f21c687283e0af4221
pre模块修改
已修改11个文件
958 ■■■■ 文件已修改
src/api/data/da/point/index.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/pre/dm/index.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/pre/item/index.ts 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/pre/predict/index.ts 91 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/pre/result/index.ts 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/model/sche/model/index.ts 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/pre/dm/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/pre/item/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/pre/predict/MmPredictItemForm.vue 775 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/pre/predict/index.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/model/pre/result/index.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/data/da/point/index.ts
@@ -28,6 +28,11 @@
  return request.get({ url: '/data/da/point/page', params })
}
// 查询DaPoint列表
export const getPointList = (params: DaPointPageReqVO) => {
  return request.get({ url: '/data/da/point/list', params })
}
// 查询DaPoint详情
export const getDaPoint = (id: number) => {
  return request.get({ url: `/data/da/point/info/${id}`})
src/api/model/pre/dm/index.ts
@@ -36,3 +36,8 @@
export const deleteDmModule = (id: number) => {
  return request.delete({ url: '/model/pre/module/delete?id=' + id })
}
// 查询getModuleList详情
export const getModuleList = () => {
  return request.get({ url: `/model/pre/module/list`})
}
src/api/model/pre/item/index.ts
@@ -13,25 +13,31 @@
// 查询MmItemType列表
export const getMmItemTypePage = (params: MmItemTypePageReqVO) => {
  return request.get({ url: '/pre/item-type/page', params })
  return request.get({ url: '/model/pre/item-type/page', params })
}
// 查询MmItemType详情
export const getMmItemType = (id: number) => {
  return request.get({ url: `/pre/item-type/get/${id}`})
  return request.get({ url: `/model/pre/item-type/get/${id}`})
}
// 新增MmItemType
export const createMmItemType = (data: MmItemTypeVO) => {
  return request.post({ url: '/pre/item-type/create', data })
  return request.post({ url: '/model/pre/item-type/create', data })
}
// 修改MmItemType
export const updateMmItemType = (data: MmItemTypeVO) => {
  return request.put({ url: '/pre/item-type/update', data })
  return request.put({ url: '/model/pre/item-type/update', data })
}
// 删除MmItemType
export const deleteMmItemType = (id: number) => {
  return request.delete({ url: '/pre/item-type/delete?id=' + id })
  return request.delete({ url: '/model/pre/item-type/delete?id=' + id })
}
// 查询getItemTypeList详情
export const getItemTypeList = () => {
  return request.get({ url: `/model/pre/item-type/list`})
}
src/api/model/pre/predict/index.ts
@@ -1,22 +1,68 @@
import request from '@/config/axios'
export interface MmPredictItemVO {
  id: string
  itemno: string,
  itemname: string,
  itemtypeid: string,
  id: string,
  itemtypename: string,
  granularity: number,
  isfuse: number,
  workchecked: number,
  moduleid: string,
  itemorder: number,
  status: number,
  categoryid: string,
  pointid: string,
  tagname: string,
  resulttableid: string,
  tablename: string,
  mmPredictItem: {
    id: string,
    itemno: string,
    itemname: string,
    caltypeid: string,
    itemtypeid: string,
    predictlength: string,
    granularity: number,
    status: string,
    isfuse: number,
    predictphase: string,
    workchecked: number,
    unittransfactor: string,
    saveindex: string
  },
  dmModuleItem: {
    id: string,
    moduleid: string,
    itemid: string,
    itemorder: number,
    status: number,
    categoryid: string
  },
  mmItemOutput: {
    id: string,
    itemid: string,
    pointid: string,
    resulttableid: string,
    tagname: string,
    outputorder: number
  },
  mmPredictModel: {
    id: string,
    modelno: string,
    modelname: string,
    itemid: string,
    arithid: string,
    trainsamplength: string,
    predictsamplength: string,
    isonlinetrain: string,
    modelpath: string,
    isnormal: string,
    normalmax: string,
    normalmin: string,
    status: number,
    classname: string,
    methodname: string,
    modelparamstructure: string,
    resultstrid: string,
    settingmap: string
  },
  mmPredictMergeItem: {
    id: string,
    itemid: string,
    expression: string,
    num: string
  },
  modelparamtypeList: [],
  mmModelArithSettingsList: [],
  mmModelParamList: []
}
export interface MmPredictItemPageReqVO extends PageParam {
@@ -26,25 +72,30 @@
// 查询MmPredictItem列表
export const getMmPredictItemPage = (params: MmPredictItemPageReqVO) => {
  return request.get({ url: '/pre/result-table/page', params })
  return request.get({ url: '/model/pre/predict-item/page', params })
}
// 查询MmPredictItem详情
export const getMmPredictItem = (id: number) => {
  return request.get({ url: `/pre/result-table/get/${id}`})
  return request.get({ url: `/model/pre/predict-item/get/${id}`})
}
// 新增MmPredictItem
export const createMmPredictItem = (data: MmPredictItemVO) => {
  return request.post({ url: '/pre/result-table/create', data })
  return request.post({ url: '/model/pre/predict-item/create', data })
}
// 修改MmPredictItem
export const updateMmPredictItem = (data: MmPredictItemVO) => {
  return request.put({ url: '/pre/result-table/update', data })
  return request.put({ url: '/model/pre/predict-item/update', data })
}
// 删除MmPredictItem
export const deleteMmPredictItem = (id: number) => {
  return request.delete({ url: '/pre/result-table/delete?id=' + id })
  return request.delete({ url: '/model/pre/predict-item/delete?id=' + id })
}
// 查询getMmPredictItemList详情
export const getMmPredictItemList = () => {
  return request.get({ url: `/model/pre/predict-item/list`})
}
src/api/model/pre/result/index.ts
@@ -11,25 +11,36 @@
// 查询MmResultTable列表
export const getMmResultTablePage = (params: MmResultTablePageReqVO) => {
  return request.get({ url: '/pre/predict-item/page', params })
  return request.get({ url: '/model/pre/result-table/page', params })
}
// 查询MmResultTable详情
export const getMmResultTable = (id: number) => {
  return request.get({ url: `/pre/predict-item/get/${id}`})
  return request.get({ url: `/model/pre/result-table/get/${id}`})
}
// 新增MmResultTable
export const createMmResultTable = (data: MmResultTableVO) => {
  return request.post({ url: '/pre/predict-item/create', data })
  return request.post({ url: '/model/pre/result-table/create', data })
}
// 修改MmResultTable
export const updateMmResultTable = (data: MmResultTableVO) => {
  return request.put({ url: '/pre/predict-item/update', data })
  return request.put({ url: '/model/pre/result-table/update', data })
}
// 删除MmResultTable
export const deleteMmResultTable = (id: number) => {
  return request.delete({ url: '/pre/predict-item/delete?id=' + id })
  return request.delete({ url: '/model/pre/result-table/delete?id=' + id })
}
// 查询getResulttableList详情
export const getResulttableList = () => {
  return request.get({ url: `/model/pre/result-table/list`})
}
// 查询getResulttableList详情
export const getResultstridList = () => {
  return request.get({ url: `/model/pre/model-resultstr/list`})
}
src/api/model/sche/model/index.ts
@@ -25,6 +25,10 @@
  datalength: number
}
export interface WorkPrecessParamVO {
  processType: string
}
export interface ScheduleModelPageReqVO extends PageParam {
  modelCode?: string
  modelName?: string
@@ -64,3 +68,8 @@
export const getModelParamList = (modelparamListMap) => {
  modelparamListMap['point'] = []
}
// 查询getScheduleWorkPrecessList列表
export const getScheduleWorkPrecessList = (data: WorkPrecessParamVO) => {
  return request.get({ url: '/model/sche/model/work-process/list/all'},data)
}
src/views/model/pre/dm/index.vue
@@ -30,7 +30,7 @@
          type="primary"
          plain
          @click="openForm('create')"
          v-hasPermi="['system:tenant:create']"
          v-hasPermi="['model:pre-module:create']"
        >
          <Icon icon="ep:plus" class="mr-5px" />
          新增
@@ -55,7 +55,7 @@
            link
            type="primary"
            @click="openForm('update', scope.row.id)"
            v-hasPermi="['system:tenant:update']"
            v-hasPermi="['model:pre-module:update']"
          >
            编辑
          </el-button>
@@ -63,7 +63,7 @@
            link
            type="danger"
            @click="handleDelete(scope.row.id)"
            v-hasPermi="['system:tenant:delete']"
            v-hasPermi="['model:pre-module:delete']"
          >
            删除
          </el-button>
src/views/model/pre/item/index.vue
@@ -30,7 +30,7 @@
          type="primary"
          plain
          @click="openForm('create')"
          v-hasPermi="['system:tenant:create']"
          v-hasPermi="['model:pre-item:create']"
        >
          <Icon icon="ep:plus" class="mr-5px" />
          新增
@@ -52,7 +52,7 @@
            link
            type="primary"
            @click="openForm('update', scope.row.id)"
            v-hasPermi="['system:tenant:update']"
            v-hasPermi="['model:pre-item:update']"
          >
            编辑
          </el-button>
@@ -60,7 +60,7 @@
            link
            type="danger"
            @click="handleDelete(scope.row.id)"
            v-hasPermi="['system:tenant:delete']"
            v-hasPermi="['model:pre-item:delete']"
          >
            删除
          </el-button>
src/views/model/pre/predict/MmPredictItemForm.vue
@@ -3,101 +3,355 @@
    <el-form
      ref="formRef"
      v-loading="formLoading"
      :model="formData"
      :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="itemno">
            <el-input v-model="formData.itemno" placeholder="请输入编号"/>
          <el-form-item label="预测项名" prop="mmPredictItem.itemname">
            <el-input v-model="dataForm.mmPredictItem.itemname" placeholder="预测项名"
                      maxlength="50"
                      clearable/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="预测项名" prop="itemname">
            <el-input v-model="formData.itemname" placeholder="请输入预测项名"/>
          <el-form-item label="编号" prop="mmPredictItem.itemno">
            <el-input v-model="dataForm.mmPredictItem.itemno" placeholder="编号" maxlength="50"
                      clearable/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="类型ID" prop="itemtypeid">
            <el-input v-model="formData.itemtypeid" placeholder="请输入类型ID"/>
          <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="itemtypename">
            <el-input v-model="formData.itemtypename" placeholder="请输入类型名称"/>
          <el-form-item label="粒度" prop="mmPredictItem.granularity">
            <el-input v-model="dataForm.mmPredictItem.granularity" placeholder="粒度" maxlength="5"
                      clearable/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="粒度" prop="granularity">
            <el-input v-model="formData.granularity" placeholder="请输入粒度"/>
          <el-form-item label="是否检查" prop="mmPredictItem.workchecked">
            <el-select v-model="dataForm.mmPredictItem.workchecked" placeholder="请选择">
              <el-option
                v-for="item in isList"
                :key="item.code"
                :label="item.name"
                :value="item.code"/>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否融合" prop="isfuse">
            <el-input v-model="formData.isfuse" placeholder="请输入是否融合"/>
          <el-form-item label="是否启用" prop="dmModuleItem.status">
            <el-select v-model="dataForm.dmModuleItem.status" placeholder="请选择">
              <el-option
                v-for="item in isList"
                :key="item.code"
                :label="item.name"
                :value="item.code"/>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="是否检查" prop="workchecked">
            <el-input v-model="formData.workchecked" placeholder="请输入是否检查"/>
          <el-form-item label="管网" prop="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="模块ID" prop="moduleid">
            <el-input v-model="formData.moduleid" placeholder="请输入模块ID"/>
          <el-form-item label="类别" prop="dmModuleItem.categoryid">
            <el-input v-model="dataForm.dmModuleItem.categoryid" placeholder="类别" maxlength="64"
                      clearable/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="排序" prop="itemorder">
            <el-input v-model="formData.itemorder" placeholder="请输入排序"/>
          <el-form-item label="排序" prop="dmModuleItem.itemorder">
            <el-input v-model="dataForm.dmModuleItem.itemorder" placeholder="排序" maxlength="36"
                      clearable/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否启用" prop="status">
            <el-input v-model="formData.status" placeholder="请输入是否启用"/>
          <el-form-item label="数据点" prop="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>
        <el-col :span="12">
          <el-form-item label="类别ID" prop="categoryid">
            <el-input v-model="formData.categoryid" placeholder="请输入类别ID"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="数据点ID" prop="pointid">
            <el-input v-model="formData.pointid" placeholder="请输入数据点ID"/>
          <el-form-item label="保存点位" prop="mmPredictItem.saveindex">
            <el-select v-model="dataForm.mmPredictItem.saveindex" placeholder="请选择">
              <el-option
                v-for="item in saveIndexList"
                :key="item.code"
                :label="item.name"
                :value="item.code"/>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
      <el-row v-if="dataForm.itemtypename === 'MergeItem'">
        <el-col :span="12">
          <el-form-item label="数据点名称" prop="tagname">
            <el-input v-model="formData.tagname" placeholder="请输入数据点名称"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="存放表ID" prop="resulttableid">
            <el-input v-model="formData.resulttableid" placeholder="请输入存放表ID"/>
          <el-form-item label="预测长度" prop="mmPredictItem.predictlength">
            <el-input v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度"
                      maxlength="5"
                      clearable/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
      <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型信息
      </el-divider>
      <el-row v-if="dataForm.itemtypename === 'NormalItem'">
        <el-col :span="24">
          <el-form-item label="模型名称" prop="mmPredictModel.modelname">
            <el-input v-model="dataForm.mmPredictModel.modelname" placeholder="模型名称"
                      maxlength="50"
                      clearable/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="存放表" prop="tablename">
            <el-input v-model="formData.tablename" placeholder="请输入存放表"/>
          <el-form-item label="编号" prop="mmPredictModel.modelno" v-if="!!dataForm.id">
            <el-input v-model="dataForm.mmPredictModel.modelno" placeholder="编号" maxlength="32"
                      clearable
                      disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-if="dataForm.itemtypename === 'NormalItem'">
        <el-col :span="12">
          <el-form-item label="上传模型" prop="itemorder">
            <el-upload
              class="upload-demo"
              :limit="1"
              :file-list="fileList"
              :before-upload="beforeUpload"
              :on-success="uploadModelSuccess"
              :on-error="uploadModelError"
              :action="uploadModelUrl">
              <el-button size="small" type="primary" @click="setReplaceModelOnly(0)">点击上传
              </el-button>
              <el-button size="small" type="primary" @click="setReplaceModelOnly(1)"
                         v-if="!!dataForm.id">只替换模型
              </el-button>
            </el-upload>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="结果" prop="mmPredictModel.resultstrid">
            <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-row>
      <el-row v-if="dataForm.itemtypename === 'NormalItem'">
        <el-col :span="24">
          <el-form-item label="路径" prop="mmPredictModel.modelpath">
            <el-input v-model="dataForm.mmPredictModel.modelpath" placeholder="路径" maxlength="32"
                      clearable
                      disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-if="dataForm.itemtypename === 'NormalItem'">
        <el-col :span="24">
          <el-form-item label="类名" prop="mmPredictModel.classname">
            <el-input v-model="dataForm.mmPredictModel.classname" placeholder="类名" maxlength="32"
                      clearable
                      disabled/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row v-if="dataForm.itemtypename === 'NormalItem'">
        <el-col :span="12">
          <el-form-item label="方法名" prop="mmPredictModel.methodname">
            <el-input v-model="dataForm.mmPredictModel.methodname" placeholder="方法名"
                      maxlength="32" clearable
                      disabled/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="参数" prop="mmPredictModel.modelparamstructure">
            <el-input v-model="dataForm.mmPredictModel.modelparamstructure" placeholder="参数"
                      maxlength="32" clearable
                      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">
          <template #default="scope">
            <el-input v-model="scope.row.value" maxlength="256" clearable
                      style="width:100%;hight:100%"/>
          </template>
        </el-table-column>
      </el-table>
      <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">输入参数
      </el-divider>
      <el-table
        :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"
                       @change="changeModelparamtype(value, scope.row)" placeholder="请选择">
              <el-option
                v-for="item in dataForm.modelparamtypeList"
                :key="item"
                :label="item"
                :value="item"/>
            </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" clearable
                      style="width:100%;hight:100%"/>
          </template>
        </el-table-column>
        <el-table-column prop="" label="操作" width="100" 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
        :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="100"
          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>
@@ -107,36 +361,133 @@
</template>
<script lang="ts" setup>
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 request from "@/config/axios";
import * as ScheduleModelApi from '@/api/model/sche/model'
defineOptions({name: 'DataMmPredictItemForm'})
const {t} = useI18n() // 国际化
const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // 弹窗的是否展示
const pointLoading = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formType = ref('') // 表单的类型:create - 新增;update - 修改
const formData = ref({
  id: undefined,
  itemno: undefined,
  itemname: undefined,
  itemtypeid: undefined,
  itemtypename: undefined,
  granularity: undefined,
  isfuse: undefined,
  workchecked: undefined,
  moduleid: undefined,
  itemorder: undefined,
  status: undefined,
  categoryid: undefined,
  pointid: undefined,
  tagname: undefined,
  resulttableid: undefined,
  tablename: undefined,
const uploadModelUrl = ''
const itemTypeList = ref([])
const itemTypeMap = ref({})
const moduleList = ref([])
const resulttableList = ref([])
const resultstridList = ref([])
const pointList = ref([])
const pointMap = ref({})
const predictItemList = ref([])
const modelparamList = ref([])
const modelparamListMap = ref([])
const modelparamMap = ref({})
const expressionList = ref([])
const fileList = ref([])
const operatorList = ['+', '-']
const replaceModelOnly = ref(0)
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  pointNo: undefined,
  pointName: undefined,
})
const isList = ref([
  {
    code: 0,
    name: '否'
  },
  {
    code: 1,
    name: '是'
  }])
const saveIndexList = ref([
  {
    code: '2',
    name: 'T+2'
  },
  {
    code: '30',
    name: 'T+30'
  },
  {
    code: 'n',
    name: 'T+n'
  }])
const dataForm = ref({
  id: '',
  itemtypename: '',
  mmPredictItem: {
    id: '',
    itemno: '',
    itemname: '',
    caltypeid: '',
    itemtypeid: '',
    predictlength: '',
    granularity: '',
    status: '',
    isfuse: '',
    predictphase: '',
    workchecked: 0,
    unittransfactor: '',
    saveindex: ''
  },
  dmModuleItem: {
    id: '',
    moduleid: '',
    itemid: '',
    itemorder: '',
    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: ''
  },
  modelparamtypeList: ['DATAPOINT', 'PREDICTITEM', 'DAYWORKPROCESSPLAN', 'MONTHWORKPROCESSPLAN', 'ST_PLAN_NQ', 'ST_PLAN_BQ', 'ST_PLAN_NQ_HI', 'ST_PLAN_BQ_HI'],
  mmModelArithSettingsList: [],
  mmModelParamList: []
})
const formRules = reactive({
  itemno: [{required: true, message: '编号不能为空', trigger: 'blur'}],
  itemname: [{required: true, message: '预测项名不能为空', trigger: 'blur'}],
  // itemno: [{required: true, message: '编号不能为空', trigger: 'blur'}],
  // itemname: [{required: true, message: '预测项名不能为空', trigger: 'blur'}],
})
const formRef = ref() // 表单 Ref
@@ -150,7 +501,7 @@
  if (id) {
    formLoading.value = true
    try {
      formData.value = await MmPredictItem.getMmPredictItem(id)
      dataForm.value = await MmPredictItem.getMmPredictItem(id)
    } finally {
      formLoading.value = false
    }
@@ -168,7 +519,7 @@
  // 提交请求
  formLoading.value = true
  try {
    const data = formData.value as unknown as MmPredictItem.MmPredictItemVO
    const data = dataForm.value as unknown as MmPredictItem.MmPredictItemVO
    if (formType.value === 'create') {
      await MmPredictItem.createMmPredictItem(data)
      message.success(t('common.createSuccess'))
@@ -183,27 +534,297 @@
    formLoading.value = false
  }
}
const setReplaceModelOnly = (value) => {
  replaceModelOnly.value = value
}
const 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
  }
}
const uploadModelSuccess = (response, file, fileList) => {
  if (response.code === 0) {
    message.success(t('上传成功'))
    dataForm.value.mmModelArithSettingsList = []
    if (!replaceModelOnly) {
      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((value) => {
        if (value.key !== 'data1') {
          dataForm.value.mmModelArithSettingsList.push({
            key: value.key,
            name: value.name,
            valuetype: value.valueType,
            value: value.value
          })
        }
      }, this)
    }
    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) {
      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 = []
}
const uploadModelError = (file, err, fileList) => {
}
const changeModelparam = (row) => {
  row.modelparamname = modelparamMap[row.modelparamid]
}
const changeItemtype = (value) => {
  dataForm.value.itemtypename = itemTypeMap[value]
}
const changeModelparamtype = (value, row) => {
  row.modelparamid = ''
}
const changeOutputPoint = (value) => {
  dataForm.value.mmItemOutput.tagname = pointMap[value]
}
const deleteExpressionRow = (index, rows) => {
  rows.splice(index, 1)
}
const addExpressionRow = (index, rows) => {
  let row = JSON.parse(JSON.stringify(rows[index]))
  rows.splice(index, 0, row)
}
const deleteRow = (index: string, rows) => {
  if (!rows || rows.length === 1) {
    message.error('不能全部删除!')
    return
  }
  rows.splice(index, 1)
  orderRow(rows)
}
const addRow = (index: string, rows) => {
  let row = JSON.parse(JSON.stringify(rows[index]))
  rows.splice(index, 0, row)
  orderRow(rows)
}
const 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((value) => {
    itemTypeMap[value.id] = value.itemtypename
  })
  if (!dataForm.value.id) {
    // dataForm.value.mmPredictItem.itemtypeid = itemTypeList[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
  pointList.value = await DaPoint.getPointList(queryParams)
  pointList.value.forEach((value) => {
    pointList.value.push(value)
    pointMap[value.id] = value.pointname
  })
}
const getModelparamList = async () => {
  modelparamListMap.value = []
  modelparamList.value = []
  predictItemList.value = []
  let pointRes = await DaPoint.getPointList(queryParams)
  let paramList = []
  pointRes.forEach((value) => {
    paramList.push({
      id: value.id,
      code: value.pointno,
      name: value.pointname,
      type: 'DATAPOINT'
    })
    modelparamMap[value.id] = value.pointname
  })
  modelparamListMap['DATAPOINT'] = paramList;
  let predictRes = await MmPredictItem.getMmPredictItemList
  paramList = []
  predictRes.forEach((value) => {
    paramList.push({
      id: value.id,
      code: value.itemno,
      name: value.itemname,
      type: 'PREDICTITEM'
    })
    if (value.id !== dataForm.value.id) {
      predictItemList.push({
        id: value.id,
        code: value.itemno,
        name: value.itemname
      })
    }
    modelparamMap[value.id] = value.itemname
  })
  modelparamListMap['PREDICTITEM'] = paramList;
  const dayParams = {
    'processType': '日计划'
  }
  let dayScheduleRes = await ScheduleModelApi.getScheduleWorkPrecessList(dayParams)
  paramList = []
  dayScheduleRes.forEach((value) => {
    paramList.push({
      id: value.id,
      code: value.code,
      name: value.aliasName,
      type: 'DAYWORKPROCESSPLAN'
    })
    modelparamMap[value.id] = value.aliasName
  })
  modelparamListMap['DAYWORKPROCESSPLAN'] = paramList;
  const monthParams = {
    'processType': '月计划'
  }
  let monthScheduleRes = await ScheduleModelApi.getScheduleWorkPrecessList(monthParams)
  paramList = []
  monthScheduleRes.forEach((value) => {
    paramList.push({
      id: value.id,
      code: value.code,
      name: value.aliasName,
      type: 'MONTHWORKPROCESSPLAN'
    })
    modelparamMap[value.id] = value.aliasName
  })
  modelparamListMap['MONTHWORKPROCESSPLAN'] = paramList;
}
/** 重置表单 */
const resetForm = () => {
  formData.value = {
    id: undefined,
    itemno: undefined,
    itemname: undefined,
    itemtypeid: undefined,
    itemtypename: undefined,
    granularity: undefined,
    isfuse: undefined,
    workchecked: undefined,
    moduleid: undefined,
    itemorder: undefined,
    status: undefined,
    categoryid: undefined,
    pointid: undefined,
    tagname: undefined,
    resulttableid: undefined,
    tablename: undefined,
  dataForm.value = {
    mmModelArithSettingsList: [],
    mmModelParamList: [],
    modelparamtypeList: [],
    id: '',
    itemtypename: '',
    mmPredictItem: {
      id: '',
      itemno: '',
      itemname: '',
      caltypeid: '',
      itemtypeid: '',
      predictlength: '',
      granularity: '',
      status: '',
      isfuse: '',
      predictphase: '',
      workchecked: 0,
      unittransfactor: '',
      saveindex: ''
    },
    dmModuleItem: {
      id: '',
      moduleid: '',
      itemid: '',
      itemorder: '',
      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()
})
const init = async () => {
  getItemTypeList()
  getModuleList()
  getPointList()
  getModelparamList()
  getResulttableList()
  getResultstridList()
}
</script>
src/views/model/pre/predict/index.vue
@@ -39,7 +39,7 @@
          type="primary"
          plain
          @click="openForm('create')"
          v-hasPermi="['system:tenant:create']"
          v-hasPermi="['model:pre-predict:create']"
        >
          <Icon icon="ep:plus" class="mr-5px" />
          新增
@@ -73,7 +73,7 @@
            link
            type="primary"
            @click="openForm('update', scope.row.id)"
            v-hasPermi="['system:tenant:update']"
            v-hasPermi="['model:pre-predict:update']"
          >
            编辑
          </el-button>
@@ -81,7 +81,7 @@
            link
            type="danger"
            @click="handleDelete(scope.row.id)"
            v-hasPermi="['system:tenant:delete']"
            v-hasPermi="['model:pre-predict:delete']"
          >
            删除
          </el-button>
src/views/model/pre/result/index.vue
@@ -30,7 +30,7 @@
          type="primary"
          plain
          @click="openForm('create')"
          v-hasPermi="['system:tenant:create']"
          v-hasPermi="['model:pre-result:create']"
        >
          <Icon icon="ep:plus" class="mr-5px" />
          新增
@@ -50,7 +50,7 @@
            link
            type="primary"
            @click="openForm('update', scope.row.id)"
            v-hasPermi="['system:tenant:update']"
            v-hasPermi="['model:pre-result:update']"
          >
            编辑
          </el-button>
@@ -58,7 +58,7 @@
            link
            type="danger"
            @click="handleDelete(scope.row.id)"
            v-hasPermi="['system:tenant:delete']"
            v-hasPermi="['model:pre-result:delete']"
          >
            删除
          </el-button>
@@ -75,14 +75,14 @@
  </ContentWrap>
  <!-- 表单弹窗:添加/修改 -->
  <MmPredictItemForm ref="formRef" @success="getList" />
  <MmResultTableForm ref="formRef" @success="getList" />
</template>
<script lang="ts" setup>
import MmPredictItemForm from './MmResultTableForm.vue'
import * as MmPredictItem from '@/api/model/pre/dm'
import MmResultTableForm from './MmResultTableForm.vue'
import * as MmResultTable from '@/api/model/pre/result'
defineOptions({name: 'DataMmPredictItem'})
defineOptions({name: 'DataMmResultTable'})
  const message = useMessage() // 消息弹窗
  const {t} = useI18n() // 国际化
@@ -102,7 +102,7 @@
  const getList = async () => {
    loading.value = true
    try {
      const page = await MmPredictItem.getMmPredictItemPage(queryParams)
      const page = await MmResultTable.getMmResultTablePage(queryParams)
      list.value = page.list
      total.value = page.total
    } finally {
@@ -134,7 +134,7 @@
      // 删除的二次确认
      await message.delConfirm()
      // 发起删除
      await MmPredictItem.deleteMmPredictItem(id)
      await MmResultTable.deleteMmResultTable(id)
      message.success(t('common.delSuccess'))
      // 刷新列表
      await getList()