| | |
| | | :rules="formRules" |
| | | label-width="120px" |
| | | > |
| | | <el-divider content-position="left">基本信息</el-divider> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="模型编号" prop="modelCode"> |
| | | <el-input v-model="formData.modelCode" placeholder="请输入模型编号" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="模型名称" prop="modelName"> |
| | | <el-input v-model="formData.modelName" placeholder="请输入模型名称" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-divider content-position="left">模型信息</el-divider> |
| | | <div style="width: 120px;text-align: right;margin-bottom: 8px"> |
| | | <el-popover placement="right" :width="300" trigger="click" ref="modelPopover" @before-enter4="model = undefined"> |
| | | <template #reference> |
| | | <span style="color: #409eff;cursor: pointer">关联模型信息</span> |
| | | </template> |
| | | <template #default> |
| | | <div style="display:flex;flex-direction: row;align-items: center;"> |
| | | <el-cascader style="width: 100%" v-model="model" placeholder="选择模型" :teleported="false" @change="changeModel" :options="scheduleModelList"/> |
| | | </div> |
| | | </template> |
| | | </el-popover> |
| | | </div> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="模型名称" prop="modelName"> |
| | | <el-input v-model="formData.modelName" placeholder="请输入模型名称" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="类名" prop="className"> |
| | | <el-input v-model="formData.className" placeholder="请输入类名 " /> |
| | | <el-input v-model="formData.className" placeholder="请输入类名" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="方法名" prop="methodName"> |
| | | <el-input v-model="formData.methodName" placeholder="请输入方法名 " /> |
| | | <el-input v-model="formData.methodName" placeholder="请输入方法名" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="参数数量" prop="portLength"> |
| | | <el-input-number v-model="formData.portLength" :min="0" controls-position="right" /> |
| | | <el-input-number v-model="formData.portLength" :min="0" controls-position="right" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="参数构造" prop="paramStructure"> |
| | | <el-input v-model="formData.paramStructure" placeholder="请输入参数构造 " /> |
| | | <el-input v-model="formData.paramStructure" placeholder="请输入参数构造" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="模型路径" prop="modelPath"> |
| | | <el-input v-model="formData.modelPath" placeholder="模型路径" /> |
| | | <el-input v-model="formData.modelPath" placeholder="模型路径" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | width="100" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input size="mini" v-model="scope.row.modelparamportorder" maxlength="5" clearable |
| | | <el-input v-model="scope.row.modelparamportorder" maxlength="5" clearable :disabled="true" |
| | | style="width:100%; hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | width="100" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input size="mini" v-model="scope.row.modelparamorder" maxlength="5" clearable |
| | | <el-input v-model="scope.row.modelparamorder" maxlength="5" clearable |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | width="150" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.modelparamtype" placeholder="请选择"> |
| | | <el-select v-model="scope.row.modelparamtype" placeholder="请选择" @change="changeModelparamtype(scope.row)"> |
| | | <el-option |
| | | v-for="dict in getStrDictOptions(DICT_TYPE.MODEL_PARAM_TYPE)" |
| | | :key="dict.value" |
| | |
| | | label="参数名称" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-select |
| | | size="mini" |
| | | <el-select v-if="scope.row.modelparamtype === 'NormalItem'" |
| | | v-model="scope.row.modelparamid" |
| | | placeholder="请选择" |
| | | filterable |
| | | 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 |
| | | placeholder="请选择"> |
| | |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | @click.prevent="deleteRow(scope.$index, formData.paramList)" |
| | | @click.prevent="deleteRow(scope.$index, scope.row, formData.paramList)" |
| | | type="primary" |
| | | size="small"> |
| | | 删除 |
| | |
| | | label="键" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input size="mini" v-model="scope.row.key" maxlength="20" clearable |
| | | <el-input v-model="scope.row.key" maxlength="20" clearable :disabled="true" |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | label="名称" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input size="mini" v-model="scope.row.name" maxlength="20" clearable |
| | | <el-input v-model="scope.row.name" maxlength="20" clearable :disabled="true" |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | label="类型" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.valuetype" placeholder="请选择"> |
| | | <el-select v-model="scope.row.valuetype" placeholder="请选择" :disabled="true"> |
| | | <el-option |
| | | v-for="dict in getStrDictOptions(DICT_TYPE.MODEL_METHOD_SETTING_VALUE_TYPE)" |
| | | :key="dict.value" |
| | |
| | | label="值" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-input size="mini" v-model="scope.row.value" maxlength="256" clearable |
| | | <el-input v-model="scope.row.value" maxlength="256" clearable :disabled="scope.row.key === 'pyFile'" |
| | | style="width:100%;hight:100%"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="" |
| | | label="操作" |
| | | width="100" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | @click.prevent="addRow(scope.$index, formData.settingList)" |
| | | link |
| | | type="primary" |
| | | size="small"> |
| | | 添加 |
| | | </el-button> |
| | | <el-button |
| | | @click.prevent="deleteRow(scope.$index, formData.settingList)" |
| | | link |
| | | type="primary" |
| | | size="small"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column--> |
| | | <!-- prop=""--> |
| | | <!-- label="操作"--> |
| | | <!-- width="100"--> |
| | | <!-- align="center">--> |
| | | <!-- <template #default="scope">--> |
| | | <!-- <el-button--> |
| | | <!-- @click.prevent="addRow(scope.$index, formData.settingList)"--> |
| | | <!-- link--> |
| | | <!-- type="primary"--> |
| | | <!-- size="small">--> |
| | | <!-- 添加--> |
| | | <!-- </el-button>--> |
| | | <!-- <el-button--> |
| | | <!-- @click.prevent="deleteRow(scope.$index, formData.settingList)"--> |
| | | <!-- link--> |
| | | <!-- type="primary"--> |
| | | <!-- size="small">--> |
| | | <!-- 删除--> |
| | | <!-- </el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | </el-table> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
| | | import * as ScheduleModelApi from '@/api/model/sche/model' |
| | | import { CommonStatusEnum } from '@/utils/constants' |
| | | import * as MpkApi from "@/api/model/mpk/mpk"; |
| | | |
| | | defineOptions({ name: 'ScheduleModelForm' }) |
| | | |
| | |
| | | resultStrId: undefined, |
| | | invocation: undefined, |
| | | status: CommonStatusEnum.ENABLE, |
| | | paramList: [{ |
| | | modelparamportorder: '1', |
| | | modelparamorder: '1', |
| | | modelparamtype: '', |
| | | modelparamid: '', |
| | | datalength: '' |
| | | }], |
| | | settingList: [{ |
| | | key: '', |
| | | value: '', |
| | | valuetype: '', |
| | | name: '' |
| | | }] |
| | | paramList: [], |
| | | settingList: [] |
| | | }) |
| | | const formRules = reactive({ |
| | | modelCode: [{ required: true, message: '模型编号不能为空', trigger: 'blur' }], |
| | |
| | | }) |
| | | const formRef = ref() // 表单 Ref |
| | | const modelparamListMap = ref({}) |
| | | // 调度模型列表 |
| | | const scheduleModelList = ref([]) |
| | | const model = ref() |
| | | const modelPopover = ref() |
| | | |
| | | const addRow = function (index, rows) { |
| | | let row = JSON.parse(JSON.stringify(rows[index])) |
| | |
| | | this.orderRow(rows) |
| | | } |
| | | |
| | | const deleteRow = function (index, rows) { |
| | | if (!rows || rows.length === 1) { |
| | | message.error('不能全部删除!') |
| | | const deleteRow = function (index, row, rows) { |
| | | if (!rows || rows.length === 1 || rows.filter(e => e.modelparamportorder === row.modelparamportorder).length === 1) { |
| | | message.error('不可删除!') |
| | | return |
| | | } |
| | | rows.splice(index, 1) |
| | |
| | | } |
| | | // 加载参数列表 |
| | | modelparamListMap.value = await ScheduleModelApi.getModelParamList() |
| | | // 加载调度模型列表 |
| | | getScheduleModelList() |
| | | } |
| | | defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
| | | |
| | |
| | | resultStrId: undefined, |
| | | invocation: undefined, |
| | | status: CommonStatusEnum.ENABLE, |
| | | paramList: [{ |
| | | modelparamportorder: '1', |
| | | modelparamorder: '1', |
| | | modelparamtype: '', |
| | | modelparamid: '', |
| | | datalength: '' |
| | | }], |
| | | settingList: [{ |
| | | key: '', |
| | | value: '', |
| | | valuetype: '', |
| | | name: '' |
| | | }] |
| | | paramList: [], |
| | | settingList: [] |
| | | } |
| | | formRef.value?.resetFields() |
| | | } |
| | | |
| | | const getScheduleModelList = async () => { |
| | | let list = await MpkApi.list({pyType: 'schedul'}) |
| | | if (list && list.length > 0) { |
| | | scheduleModelList.value = list.map(e => { |
| | | return { |
| | | label: e.pyChineseName, |
| | | value: e, |
| | | children: e.modelMethods.map(m => { |
| | | return { |
| | | label: m.methodName, |
| | | value: m |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | // 选择调度模型 |
| | | const changeModel = async () => { |
| | | // 校验 |
| | | if (model.value && model.value.length > 0) { |
| | | const modelInfo = model.value[0] |
| | | const methodInfo = model.value[1] |
| | | formData.value.modelName = modelInfo.pyChineseName |
| | | formData.value.className = modelInfo.pkgName + '.impl.' + modelInfo.pyName + 'Impl'; |
| | | formData.value.methodName = methodInfo.methodName |
| | | formData.value.portLength = methodInfo.dataLength |
| | | // 参数构造 |
| | | let paramStructure = [] |
| | | for (let i = 0; i < methodInfo.dataLength; i++) { |
| | | paramStructure.push('[[D') |
| | | } |
| | | if (methodInfo.model === 1) { |
| | | paramStructure.push('java.util.HashMap') |
| | | } |
| | | paramStructure.push('java.util.HashMap') |
| | | formData.value.paramStructure = paramStructure.join(',') |
| | | formData.value.modelPath = modelInfo.pyModule |
| | | // 输入参数 |
| | | let paramList = [] |
| | | for (let i = 0; i < methodInfo.dataLength; i++) { |
| | | paramList.push({ |
| | | modelparamportorder: i+1 + '', |
| | | modelparamorder: '1', |
| | | modelparamtype: '', |
| | | modelparamid: '', |
| | | datalength: 0 |
| | | }) |
| | | } |
| | | |
| | | formData.value.paramList = paramList |
| | | // 设置参数 |
| | | let settingList = [] |
| | | methodInfo.methodSettings.forEach(e => { |
| | | settingList.push({ |
| | | key: e.settingKey, |
| | | value: e.value, |
| | | valuetype: e.valueType, |
| | | name: e.name |
| | | }) |
| | | }) |
| | | formData.value.settingList = settingList |
| | | modelPopover.value.hide() |
| | | }else { |
| | | message.error("请先选择模型") |
| | | } |
| | | } |
| | | |
| | | function changeModelparamtype(row) { |
| | | row.modelparamid = '' |
| | | } |
| | | </script> |