2024-12-04 | houzhongjian | |
2024-12-04 | houzhongjian | |
2024-12-03 | 潘志宝 | |
2024-12-03 | 潘志宝 | |
2024-11-29 | dengzedong | |
2024-11-29 | 潘志宝 | |
2024-11-29 | 潘志宝 | |
2024-11-29 | dengzedong | |
2024-11-29 | dengzedong | |
2024-11-28 | dengzedong |
.env.test
@@ -4,12 +4,12 @@ VITE_DEV=false # 请求路径 VITE_BASE_URL='http://172.16.8.100:48080' VITE_BASE_URL='http://172.16.8.100' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=server # 上传路径 VITE_UPLOAD_URL='http://172.16.8.100:48080/admin-api/infra/file/upload' VITE_UPLOAD_URL='http://172.16.8.100/admin-api/infra/file/upload' # 接口地址 VITE_API_URL=/admin-api @@ -34,9 +34,6 @@ # 公共静态文件路径 VITE_STATIC_DIR=/plat/ # 商城H5会员端域名 VITE_MALL_H5_DOMAIN='http://' # 验证码的开关 VITE_APP_CAPTCHA_ENABLE=false src/api/model/sche/model/index.ts
@@ -70,7 +70,7 @@ } // 查询模型参数列表 export const getModelParamList = async () => { export const getModelParamList = async (id) => { const dataPointList = ref([] as DataPointApi.DaPointVO) dataPointList.value = await DataPointApi.getPointList({}) @@ -91,13 +91,21 @@ status: CommonEnabled.ENABLE, itemtypename: 'NormalItem' }) const itemList = [] const normalItemList = [] if (predictItemList.value) { predictItemList.value.forEach(item => { itemList.push( // 过滤掉本身 predictItemList.value.filter(e => e.id !== id).forEach(item => { normalItemList.push( { id: item.id, name: item.itemname value: item.id, label: item.itemname, predictlength: item.predictlength, children: item.outPuts?.map(e => { return { value: e.id, label: e.resultName } }) } ) }) @@ -118,9 +126,28 @@ }) } predictItemList.value = await PredictItemApi.getMmPredictItemList({ status: CommonEnabled.ENABLE, itemtypename: 'MergeItem' }) const mergeItemList = [] if (predictItemList.value) { // 过滤掉本身 predictItemList.value.filter(e => e.id !== id).forEach(item => { mergeItemList.push( { id: item.id, name: item.itemname } ) }) } return { 'DATAPOINT':pointList, 'PREDICTITEM': itemList, 'NormalItem': normalItemList, 'MergeItem': mergeItemList, 'PLAN': planList, } } src/api/model/sche/scheme/index.ts
@@ -13,6 +13,7 @@ scheduleTime: string remark: string status: number mpkprojectid: string } export interface ScheduleSchemePageReqVO extends PageParam { src/assets/svgs/pay/icon/alipay_app.svg
文件已删除 src/assets/svgs/pay/icon/alipay_bar.svg
文件已删除 src/assets/svgs/pay/icon/alipay_pc.svg
文件已删除 src/assets/svgs/pay/icon/alipay_qr.svg
文件已删除 src/assets/svgs/pay/icon/alipay_wap.svg
文件已删除 src/assets/svgs/pay/icon/mock.svg
文件已删除 src/assets/svgs/pay/icon/wx_app.svg
文件已删除 src/assets/svgs/pay/icon/wx_bar.svg
文件已删除 src/assets/svgs/pay/icon/wx_lite.svg
文件已删除 src/assets/svgs/pay/icon/wx_native.svg
文件已删除 src/assets/svgs/pay/icon/wx_pub.svg
文件已删除 src/components/Icon/src/Icon.vue
@@ -1,6 +1,7 @@ <script lang="ts" setup> import { propTypes } from '@/utils/propTypes' import Iconify from '@purge-icons/generated' // import Iconify from '@purge-icons/generated' import { useDesign } from '@/hooks/web/useDesign' defineOptions({ name: 'Icon' }) src/main.ts
@@ -4,6 +4,19 @@ // 导入全局的svg图标 import '@/plugins/svgIcon' import Iconify from '@iconify/iconify' import epJson from '@iconify/json/json/ep.json' import faJson from '@iconify/json/json/fa.json' import faSolidJson from '@iconify/json/json/fa-solid.json' Iconify.addCollection(epJson) Iconify.addCollection(faJson) Iconify.addCollection(faSolidJson) export * from '@iconify/iconify' export default Iconify // 初始化多语言 import { setupI18n } from '@/plugins/vueI18n' src/views/Home/Index.vue
@@ -94,33 +94,35 @@ font-size: 40px; color: #282F3D; } #app { margin: 0 96px; width: 100%; } .card { width: 354px; height: 200px; margin: 0 24px 24px 0; background: linear-gradient( 180deg, #E9F0FA 0%, #FFFFFF 100%); background: linear-gradient(180deg, #E9F0FA 0%, #FFFFFF 100%); border-radius: 12px 12px 12px 12px; border: 2px solid; border-image: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 1)) 2 2; display: inline-block; } .card > div{ display: inline-block; } .card-left{ .card-left { height: 100px; width: 100px; float: left; margin: 50px 30px; } .card-right { float: right; margin: 61px 10px; } .app-title { width: 162px; font-family: Microsoft YaHei, Microsoft YaHei; @@ -128,6 +130,7 @@ font-size: 24px; color: #282F3D; } .goto-app { width: 96px; height: 35px; @@ -136,6 +139,7 @@ border-radius: 80px 80px 80px 80px; cursor: pointer; } .goto-app > div { padding: 6px; margin-left: 5px; src/views/data/point/DaPointForm.vue
@@ -283,6 +283,38 @@ </el-form-item> </el-col> </el-row> <!--累计点--> <el-row :gutter="20" v-if="formData.pointType === 'CUMULATE'"> <el-col :span="24"> <el-form-item label="瞬时测点" prop="cumulatePoint.momentPoint"> <el-select v-model="formData.cumulatePoint.momentPoint" filterable placeholder="请选择"> <el-option v-for="(item, index) in pointList" :key="index" :label="item.pointName" :value="item.pointNo"/> </el-select> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="累计长度" prop="cumulatePoint.length"> <el-input-number v-model="formData.cumulatePoint.length" style="width: 100%" :min="1" :max="3000" :controls="false"/> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="除数" prop="cumulatePoint.divisor"> <el-input-number v-model="formData.cumulatePoint.divisor" style="width: 100%" :min="1" :max="3000" :controls="false"/> </el-form-item> </el-col> </el-row> </el-form> <template #footer> <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button> @@ -343,6 +375,13 @@ tagNo: '', dimension: '', valueType: '', }, cumulatePoint: { id: '', pointId: '', momentPoint: '', length: '', divisor: '' } }) const formRules = reactive({ @@ -350,8 +389,11 @@ pointType: [{required: true, message: '测点类型不能为空', trigger: 'blur'}], dataType: [{required: true, message: '数据类型不能为空', trigger: 'blur'}], minfreqid: [{required: true, message: '采集频率不能为空', trigger: 'blur'}], "measurePoint.valueType": [{required: true, message: '采集频率不能为空', trigger: 'blur'}], "measurePoint.dimension": [{required: true, message: '采集频率不能为空', trigger: 'blur'}], "measurePoint.valueType": [{required: true, message: '值类型不能为空', trigger: 'blur'}], "measurePoint.dimension": [{required: true, message: '平滑尺度不能为空', trigger: 'blur'}], "cumulatePoint.momentPoint": [{required: true, message: '累计测点不能为空', trigger: 'blur'}], "cumulatePoint.length": [{required: true, message: '累计长度不能为空', trigger: 'blur'}], "cumulatePoint.divisor": [{required: true, message: '除数不能为空', trigger: 'blur'}], }) const formRef = ref() // 表单 Ref @@ -465,6 +507,13 @@ tagNo: '', dimension: '1', valueType: 'SIMULATE', }, cumulatePoint: { id: '', pointId: '', momentPoint: '', length: 60, divisor: 60 } } formRef.value?.resetFields() src/views/model/mpk/file/MpkForm.vue
@@ -333,6 +333,9 @@ menuAndGroup: [ {required: true, message: '所属目录不能为空', trigger: 'blur'} ], icon: [ {required: true, message: 'icon不能为空', trigger: 'blur'} ], }) const formRef = ref() // 表单 Ref src/views/model/mpk/file/index.vue
@@ -22,6 +22,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="模型名称" prop="pyName"> <el-input src/views/model/mpk/icon/index.vue
@@ -7,6 +7,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="模型名称" prop="iconName"> <el-input src/views/model/mpk/menu/index.vue
@@ -7,6 +7,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="菜单名称" prop="name"> <el-input src/views/model/mpk/pack/index.vue
@@ -7,6 +7,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="名称" prop="packName"> <el-input src/views/model/pre/dm/index.vue
@@ -7,6 +7,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="名称" prop="modulename"> <el-input src/views/model/pre/item/MmPredictItemForm.vue
@@ -103,8 +103,9 @@ </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="changePredictLength" v-model="dataForm.mmPredictItem.predictlength" placeholder="预测长度" maxlength="5"/> </el-form-item> @@ -201,7 +202,8 @@ <el-divider content-position="left" v-if="dataForm.itemtypename === 'NormalItem'">模型输出 </el-divider> <el-button @click="addItemOutput(dataForm.mmItemOutputList)" v-if="dataForm.itemtypename === 'NormalItem'" @click="addItemOutput()" type="primary" size="small"> 添加 @@ -283,6 +285,7 @@ <el-table-column prop="" label="值" align="center" min-width="200"> <template #default="scope"> <el-input size="mini" v-model="scope.row.value" maxlength="256" :disabled="scope.row.key === 'pyFile'" style="width:100%;height:100%"/> </template> </el-table-column> @@ -312,7 +315,26 @@ </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)" @@ -358,18 +380,28 @@ 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.itemname" :value="item.itemno"/> :no-data-text="'无数据(predictlength:' + dataForm.mmPredictItem.predictlength + ')'" @change="changeNormalItemSelect" style="width: 100%"> <el-option-group v-for="group in modelparamListMap['NormalItem'].filter(e => e.predictlength == dataForm.mmPredictItem.predictlength)" :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> @@ -446,7 +478,6 @@ const pointNoList = ref([]) const pointList = ref([]) const pointMap = ref({}) const predictItemList = ref([]) const modelparamListMap = ref({}) const modelparamMap = ref({}) const expressionList = ref([]) @@ -532,6 +563,7 @@ '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'}], }) const formRef = ref() // 表单 Ref @@ -547,7 +579,7 @@ setDefaultFields() // 加载参数列表 modelparamListMap.value = await ScheduleModelApi.getModelParamList() modelparamListMap.value = await ScheduleModelApi.getModelParamList(id) // 获取预测项类型列表 itemTypeList.value = await MmItemType.getItemTypeList() @@ -563,11 +595,6 @@ // 获取mpk项目列表 mpkProjectList.value = await ProjectApi.list() // 获取normal列表 predictItemList.value = await MmPredictItem.getMmPredictItemList({ itemtypename: 'NormalItem' }) // 获取数据点列表 pointNoList.value = await DaPoint.getPointList(queryParams) @@ -599,21 +626,40 @@ if (!formRef) return const valid = await formRef.value.validate() if (!valid) return //校验模型输出 if (dataForm.value.mmItemOutputList == undefined || dataForm.value.mmItemOutputList.length <= 0) { message.error("模型输出不为空") 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.pointid == undefined || e.pointid === '' || (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 } let flag = false dataForm.value.mmItemOutputList.forEach(e => { if (e.resultstr == undefined || e.resultstr === '' || e.resultType == undefined || e.resultType === '' || e.pointid == undefined || e.pointid === '' || (e.resultType === 2 && (e.resultIndex == undefined || e.resultIndex === ''))) { message.error("模型输出数据异常") flag = true } }) if (flag) return // 提交请求 formLoading.value = true @@ -679,7 +725,7 @@ 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 { @@ -719,7 +765,8 @@ 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, @@ -803,9 +850,12 @@ orderRow(rows) } function addItemOutput(list) { list.push({}) orderItemOutput(list) function addItemOutput() { if (!dataForm.value.mmItemOutputList) { dataForm.value.mmItemOutputList = [] } dataForm.value.mmItemOutputList.push({}) orderItemOutput(dataForm.value.mmItemOutputList) } function deleteItemOutput(index: string, rows) { @@ -866,6 +916,13 @@ fileList.value = [] } const changePredictLength = (value) => { expressionList.value = [{ point: '', operator: '' }] } /** 重置表单 */ const resetForm = () => { dataForm.value = { src/views/model/pre/item/index.vue
@@ -7,6 +7,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="编号" prop="itemno"> <el-input src/views/model/pre/type/index.vue
@@ -7,6 +7,7 @@ ref="queryFormRef" :inline="true" label-width="68px" @submit.prevent > <el-form-item label="名称" prop="itemtypename"> <el-input src/views/model/sche/scheme/ScheduleSchemeForm.vue
@@ -10,12 +10,12 @@ <el-row> <el-col :span="12"> <el-form-item label="方案编号" prop="code"> <el-input v-model="formData.code" placeholder="请输入方案编号" /> <el-input v-model="formData.code" placeholder="请输入方案编号"/> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="方案名称" prop="name"> <el-input v-model="formData.name" placeholder="请输入方案名称" /> <el-input v-model="formData.name" placeholder="请输入方案名称"/> </el-form-item> </el-col> </el-row> @@ -24,7 +24,7 @@ <el-form-item label="触发方式" prop="triggerMethod"> <el-select v-model="formData.triggerMethod" placeholder="请选择"> <el-option v-for="dict in getIntDictOptions(DICT_TYPE.SCHE_TRIGGER_METHOD)" v-for="dict in getDictOptions(DICT_TYPE.SCHE_TRIGGER_METHOD)" :key="dict.value" :label="dict.label" :value="dict.value" @@ -34,26 +34,26 @@ </el-col> <el-col :span="12"> <el-form-item label="触发条件" prop="triggerCondition"> <el-input v-model="formData.triggerCondition" placeholder="请输入触发条件" /> <el-input v-model="formData.triggerCondition" placeholder="请输入触发条件"/> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="调整对象" prop="scheduleObj"> <el-input v-model="formData.scheduleObj" placeholder="请输入调整对象" /> <el-input v-model="formData.scheduleObj" placeholder="请输入调整对象"/> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="调整类型" prop="scheduleType"> <el-input v-model="formData.scheduleType" placeholder="请输入调整类型" /> <el-input v-model="formData.scheduleType" placeholder="请输入调整类型"/> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="调整策略" prop="scheduleStrategy"> <el-input v-model="formData.scheduleStrategy" placeholder="请输入调整策略 " /> <el-input v-model="formData.scheduleStrategy" placeholder="请输入调整策略 "/> </el-form-item> </el-col> <el-col :span="12"> @@ -71,9 +71,23 @@ </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="关联项目"> <el-select v-model="formData.mpkprojectid" placeholder="请选择"> <el-option v-for="item in mpkProjectList" :key="item.id" :label="item.projectName" :value="item.id"/> </el-select> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="备注" prop="remark"> <el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" maxlength="100" <el-input v-model="formData.remark" placeholder="请输入备注" type="textarea" maxlength="100" show-word-limit/> </el-form-item> </el-col> @@ -86,20 +100,126 @@ </Dialog> </template> <script lang="ts" setup> import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import * as ScheduleSchemeApi from '@/api/model/sche/scheme' import { CommonStatusEnum } from '@/utils/constants' import * as ScheduleModelApi from "@/api/model/sche/model"; import {DICT_TYPE, getDictOptions} from '@/utils/dict' import * as ScheduleSchemeApi from '@/api/model/sche/scheme' import {CommonStatusEnum} from '@/utils/constants' import * as ScheduleModelApi from "@/api/model/sche/model"; import * as ProjectApi from '@/api/model/mpk/project' defineOptions({ name: 'ScheduleSchemeForm' }) defineOptions({name: 'ScheduleSchemeForm'}) 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 formData = ref({ 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 formData = ref({ id: undefined, code: undefined, name: undefined, triggerMethod: undefined, triggerCondition: undefined, scheduleObj: undefined, scheduleType: undefined, scheduleStrategy: undefined, modelId: undefined, scheduleTime: undefined, remark: undefined, status: 0, mpkprojectid: undefined, }) const formRules = reactive({ code: [{required: true, message: '编号不能为空', trigger: 'blur'}], name: [{required: true, message: '名称不能为空', trigger: 'blur'}], triggerMethod: [{required: true, message: '触发方式不能为空', trigger: 'blur'}], triggerCondition: [{required: true, message: '触发条件不能为空', trigger: 'blur'}], modelId: [{required: true, message: '调度模型不能为空', trigger: 'blur'}], triggerCondition: [{required: true, message: '触发条件不能为空', trigger: 'blur'}], }) const formRef = ref() // 表单 Ref const scheduleModelList = ref([] as ScheduleModelApi.ScheduleModelVO[]) const mpkProjectList = ref([]) const addRow = function (index, rows) { let row = JSON.parse(JSON.stringify(rows[index])) rows.splice(index, 0, row) this.orderRow(rows) } const deleteRow = function (index, rows) { if (!rows || rows.length === 1) { message.error('不能全部删除!') return } rows.splice(index, 1) this.orderRow(rows) } const orderRow = function (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 open = async (type: string, id?: number) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type resetForm() // 修改时,设置数据 if (id) { formLoading.value = true try { formData.value = await ScheduleSchemeApi.getScheduleScheme(id) } finally { formLoading.value = false } } // 加载调度模型列表 scheduleModelList.value = await ScheduleModelApi.getScheduleModelList() // 获取mpk项目列表 mpkProjectList.value = await ProjectApi.list() } 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 = formData.value as unknown as ScheduleSchemeApi.ScheduleSchemeVO if (formType.value === 'create') { await ScheduleSchemeApi.createScheduleScheme(data) message.success(t('common.createSuccess')) } else { await ScheduleSchemeApi.updateScheduleScheme(data) message.success(t('common.updateSuccess')) } dialogVisible.value = false // 发送操作成功的事件 emit('success') } finally { formLoading.value = false } } /** 重置表单 */ const resetForm = () => { formData.value = { id: undefined, code: undefined, name: undefined, @@ -111,105 +231,9 @@ modelId: undefined, scheduleTime: undefined, remark: undefined, status: 0 }) const formRules = reactive({ code: [{ required: true, message: '编号不能为空', trigger: 'blur' }], name: [{ required: true, message: '名称不能为空', trigger: 'blur' }] }) const formRef = ref() // 表单 Ref const scheduleModelList = ref([] as ScheduleModelApi.ScheduleModelVO[]) const addRow = function (index, rows) { let row = JSON.parse(JSON.stringify(rows[index])) rows.splice(index, 0, row) this.orderRow(rows) status: CommonStatusEnum.ENABLE, mpkprojectid: undefined } const deleteRow = function (index, rows) { if (!rows || rows.length === 1) { message.error('不能全部删除!') return } rows.splice(index, 1) this.orderRow(rows) } const orderRow = function (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 open = async (type: string, id?: number) => { dialogVisible.value = true dialogTitle.value = t('action.' + type) formType.value = type resetForm() // 修改时,设置数据 if (id) { formLoading.value = true try { formData.value = await ScheduleSchemeApi.getScheduleScheme(id) } finally { formLoading.value = false } } // 加载调度模型列表 scheduleModelList.value = await ScheduleModelApi.getScheduleModelList() } 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 = formData.value as unknown as ScheduleSchemeApi.ScheduleSchemeVO if (formType.value === 'create') { await ScheduleSchemeApi.createScheduleScheme(data) message.success(t('common.createSuccess')) } else { await ScheduleSchemeApi.updateScheduleScheme(data) message.success(t('common.updateSuccess')) } dialogVisible.value = false // 发送操作成功的事件 emit('success') } finally { formLoading.value = false } } /** 重置表单 */ const resetForm = () => { formData.value = { id: undefined, code: undefined, name: undefined, triggerMethod: undefined, triggerCondition: undefined, scheduleObj: undefined, scheduleType: undefined, scheduleStrategy: undefined, modelId: undefined, scheduleTime: undefined, remark: undefined, status: CommonStatusEnum.ENABLE } formRef.value?.resetFields() } formRef.value?.resetFields() } </script>