<template> <el-form class="tableForm" ref="tableForm" :model="formModel" :rules="rules" :disabled="props.disabled" > <el-row :gutter="20"> <el-col :span="12"> <el-form-item label="地面高程m:" prop="groundElevation"> <el-input v-model="formModel.groundElevation" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="设施底高程m:" prop="facilityBaseElevation"> <el-input v-model="formModel.facilityBaseElevation"/> </el-form-item> </el-col> </el-row> </el-form> </template> <script setup> import { computed, reactive } from 'vue' import { isNumber } from '@/utils/validate-helper' const { proxy } = getCurrentInstance() const props = defineProps({ data: { type: Object, default: () => {} }, disabled: { type: Boolean, default: false } }) const formModel = computed(() => { return props.data.data }) const rules = reactive({ groundElevation: isNumber('地面高程', { required: false, min: 0 }), facilityBaseElevation: isNumber('设施底高程', { required: false, min: 0 }), }) const validate = () => { return proxy.$refs.tableForm.validate() } defineExpose({ validate }) </script> <style lang="scss" scoped></style>