|
@@ -6,16 +6,20 @@ const dialogFormVisible = ref(false)
|
|
|
const formLabelWidth = '140px'
|
|
|
|
|
|
const form = reactive({
|
|
|
- name: '',
|
|
|
- region: '',
|
|
|
- date1: '',
|
|
|
- date2: '',
|
|
|
- delivery: false,
|
|
|
- type: [],
|
|
|
- resource: '',
|
|
|
- desc: '',
|
|
|
- phone:''
|
|
|
-})
|
|
|
+ phone: '',
|
|
|
+ name:''
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+const rules = {
|
|
|
+ phone: [
|
|
|
+ { required: true, message: '请输入联系电话', trigger: 'blur' },
|
|
|
+ { min: 11, max: 11, message: '联系电话必须是11位数字', trigger: 'blur' },
|
|
|
+ { pattern: /^\d{11}$/, message: '联系电话必须是11位数字', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+};
|
|
|
+
|
|
|
+const formRef = ref(null);
|
|
|
|
|
|
|
|
|
const tableData = [
|
|
@@ -42,6 +46,51 @@ const tableData = [
|
|
|
},
|
|
|
]
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+function confirm(){formRef.value.validate((valid) => {
|
|
|
+ form.name='';
|
|
|
+ form.name='';
|
|
|
+ form.region='';
|
|
|
+ form.date1='';
|
|
|
+ form.date2='';
|
|
|
+ form.delivery= false;
|
|
|
+ form.type= [];
|
|
|
+ form.resource= '';
|
|
|
+ form.desc= '';
|
|
|
+ form.time=0;
|
|
|
+ form.times=0;
|
|
|
+ form.intervalTime=0;
|
|
|
+ form.required='';
|
|
|
+ form.phone='';
|
|
|
+ if (valid) {
|
|
|
+ dialogFormVisible.value = false;
|
|
|
+ alert('提交成功!');
|
|
|
+ } else {
|
|
|
+ dialogFormVisible.value = true;
|
|
|
+ alert('提交失败!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+});
|
|
|
+}
|
|
|
+
|
|
|
+function cencle(){
|
|
|
+ form.name='';
|
|
|
+ form.name= '';
|
|
|
+ form.region= '';
|
|
|
+ form.date1= '';
|
|
|
+ form.date2= '';
|
|
|
+ form.delivery= false;
|
|
|
+ form.type= [];
|
|
|
+ form.resource= '';
|
|
|
+ form.desc= '';
|
|
|
+ form.time=0;
|
|
|
+ form.times=0;
|
|
|
+ form.intervalTime=0;
|
|
|
+ form.required='';
|
|
|
+ form.phone='';
|
|
|
+ dialogFormVisible.value = false
|
|
|
+}
|
|
|
</script>
|
|
|
<template>
|
|
|
<div style="padding-left: 20px" >
|
|
@@ -58,20 +107,20 @@ const tableData = [
|
|
|
</el-button>
|
|
|
|
|
|
<el-dialog v-model="dialogFormVisible" title="添加供应商" width="500">
|
|
|
- <el-form :model="form">
|
|
|
+ <el-form :model="form" :rules="rules" ref="formRef" label-width="120px">
|
|
|
<el-form-item label="部门名称" :label-width="formLabelWidth" required="required" prop="name">
|
|
|
<el-input v-model="form.name" autocomplete="off" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="联系电话" :label-width="formLabelWidth" required="required" prop="number">
|
|
|
+ <el-form-item label="联系电话" :label-width="formLabelWidth" required="required" prop="phone">
|
|
|
<el-input v-model="form.phone" autocomplete="off" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button type="primary" @click="dialogFormVisible = false">
|
|
|
+ <el-button type="primary" @click="confirm">
|
|
|
确定
|
|
|
</el-button>
|
|
|
- <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
+ <el-button @click="cencle">取消</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-dialog>
|