<template> <el-form ref="ruleForm" :model="form" :rules="rules"> <el-row :gutter="40"> <el-col :span="12"> <el-form-item label="工程类型:" prop="engineeringType"> <el-select v-model="form.engineeringType" placeholder="请选择工程类型" style="width: 100%"> <el-option v-for="dict in sponge_engineering_type" :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="assessType"> <el-select v-model="form.assessType" placeholder="请选择考核类型" style="width: 100%"> <el-option v-for="dict in assess_type" :key="dict.value" :label="dict.label" :value="dict.value" /> </el-select> </el-form-item> </el-col> </el-row> </el-form> </template> <script setup> import { reactive } from 'vue' import { assessTargetConfigAdd } from '@/api/examineManage/examineManage.js' const { proxy } = getCurrentInstance(); const emit = defineEmits(['close']) const form = reactive({ engineeringType: '', assessType: '' }) const rules = { engineeringType: [{ required: true, trigger: "change", message: "请选择工程类型" }], assessType: [{ required: true, trigger: "change", message: "请选择考核类型" }] }; const { sponge_engineering_type } = proxy.useDict("sponge_engineering_type") const { assess_type } = proxy.useDict("assess_type") const submit = () => { proxy.$refs.ruleForm.validate(async (valid, fields) => { if (valid) { const params = { ...form } const res = await assessTargetConfigAdd(params) if(res?.code !== 200) return proxy.$modal.msgSuccess('操作成功!') emit('close', 'add') } else { // console.log('error submit!', fields) } }) } defineExpose({ submit }) </script> <style lang="scss" scoped></style>