expressForm的更新

master
cxy 2 weeks ago
parent 5e8f2d8378
commit bbf1faf092

@ -9,33 +9,33 @@
<el-button class="btn">智能填写</el-button> <el-button class="btn">智能填写</el-button>
</el-row> </el-row>
</el-row> </el-row>
<el-form label-width="auto" class="form" ref="formRef"> <el-form label-width="auto" class="form" ref="sendFormRef">
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 姓名 <span style="color: red;">*</span> 姓名
</template> </template>
<el-input placeholder="请填写真实姓名" v-model="formData.name"></el-input> <el-input placeholder="请填写真实姓名" v-model="sendFormData.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 联系电话 <span style="color: red;">*</span> 联系电话
</template> </template>
<el-input placeholder="请填写手机号码或者固话号码" v-model="formData.phone"></el-input> <el-input placeholder="请填写手机号码或者固话号码" v-model="sendFormData.phone"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 省市区 <span style="color: red;">*</span> 省市区
</template> </template>
<el-input placeholder="请选择省市区" v-model="formData.region"></el-input> <el-input placeholder="请选择省市区" v-model="sendFormData.region"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 详细地址 <span style="color: red;">*</span> 详细地址
</template> </template>
<el-input placeholder="请填写详细地址" v-model="formData.address"></el-input> <el-input placeholder="请填写详细地址" v-model="sendFormData.address"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="公司名称"> <el-form-item label="公司名称">
<el-input placeholder="请填写公司名称" v-model="formData.company"></el-input> <el-input placeholder="请填写公司名称" v-model="sendFormData.company"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-row> </el-row>
@ -48,33 +48,33 @@
<el-button class="btn">智能填写</el-button> <el-button class="btn">智能填写</el-button>
</el-row> </el-row>
</el-row> </el-row>
<el-form label-width="auto" class="form" ref="formRef"> <el-form label-width="auto" class="form" ref="receiveFormRef">
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 姓名 <span style="color: red;">*</span> 姓名
</template> </template>
<el-input placeholder="请填写真实姓名" v-model="formData.name"></el-input> <el-input placeholder="请填写真实姓名" v-model="receiveFormData.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 联系电话 <span style="color: red;">*</span> 联系电话
</template> </template>
<el-input placeholder="请填写手机号码或者固话号码" v-model="formData.phone"></el-input> <el-input placeholder="请填写手机号码或者固话号码" v-model="receiveFormData.phone"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 省市区 <span style="color: red;">*</span> 省市区
</template> </template>
<el-input placeholder="请选择省市区" v-model="formData.region"></el-input> <el-input placeholder="请选择省市区" v-model="receiveFormData.region"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<template #label> <template #label>
<span style="color: red;">*</span> 详细地址 <span style="color: red;">*</span> 详细地址
</template> </template>
<el-input placeholder="请填写详细地址" v-model="formData.address"></el-input> <el-input placeholder="请填写详细地址" v-model="receiveFormData.address"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="公司名称"> <el-form-item label="公司名称">
<el-input placeholder="请填写公司名称" v-model="formData.company"></el-input> <el-input placeholder="请填写公司名称" v-model="receiveFormData.company"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-row> </el-row>
@ -89,7 +89,7 @@
</el-row> </el-row>
</el-row> </el-row>
<el-row class="panel send-panel"> <el-row class="panel send-panel">
<el-text class="confirm-btn">下单</el-text> <el-button @click="submitForm" class="confirm-btn">下单</el-button>
</el-row> </el-row>
</el-row> </el-row>
</template> </template>
@ -97,34 +97,36 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
const formRef = ref(null); // const sendFormRef = ref(null); //
const formData = ref({ const receiveFormRef = ref(null); //
const sendFormData = ref({
name: '', name: '',
phone: '', phone: '',
region: '', region: '',
address: '', address: '',
company: '' company: ''
}); // }); //
// const receiveFormData = ref({
const rules = { name: '',
name: [{ required: true, message: '姓名为必填项', trigger: ['blur', 'change'] }], phone: '',
phone: [{ required: true, message: '联系电话为必填项', trigger: ['blur', 'change'] }], region: '',
region: [{ required: true, message: '省市区为必填项', trigger: ['blur', 'change'] }], address: '',
address: [{ required: true, message: '详细地址为必填项', trigger: ['blur', 'change'] }], company: ''
company: [{ required: true, message: '公司名称为必填项', trigger: ['blur', 'change'] }] }); //
};
// //
const submitForm = async () => { const submitForm = async () => {
try { try {
// await sendFormRef.value.validate(); //
await formRef.value.validate(); await receiveFormRef.value.validate(); //
// //
console.log('表单数据:', formData.value); console.log('寄件表单数据:', sendFormData.value);
console.log('收件表单数据:', receiveFormData.value);
// //
} catch (error) { } catch (error) {
//
console.log('表单验证失败:', error); console.log('表单验证失败:', error);
} }
}; };

Loading…
Cancel
Save