Commit 9736860036a128fc55b2bc9fcdae6c0c334e96b3
1 parent
aa317845
fix bug
Showing
9 changed files
with
34 additions
and
16 deletions
src/views/community/housekeeper/houseDetail.vue
| ... | ... | @@ -84,7 +84,7 @@ const rules = reactive({ |
| 84 | 84 | { |
| 85 | 85 | required: true, |
| 86 | 86 | message: "请输入建筑面积", |
| 87 | - trigger: "change", | |
| 87 | + trigger: "blur", | |
| 88 | 88 | }, |
| 89 | 89 | { |
| 90 | 90 | type: "number", |
| ... | ... | @@ -92,6 +92,7 @@ const rules = reactive({ |
| 92 | 92 | max: 1000, |
| 93 | 93 | transform: (value) => Number(value), |
| 94 | 94 | }, |
| 95 | + { whitespace: true, message: "请输入正确的建筑面积", trigger: "blur" }, | |
| 95 | 96 | ], |
| 96 | 97 | houseCount: [ |
| 97 | 98 | { | ... | ... |
src/views/community/housekeeper/index.vue
| ... | ... | @@ -8,7 +8,7 @@ import Pagination from "@/components/Pagination/index.vue"; |
| 8 | 8 | import { useRoute } from "vue-router"; |
| 9 | 9 | |
| 10 | 10 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 11 | -const houseDetailRef = ref(null); | |
| 11 | +const houseDetailRef = ref<FormInstance>(); | |
| 12 | 12 | let route = useRoute(); // 路由 |
| 13 | 13 | |
| 14 | 14 | // 数据筛选 | ... | ... |
src/views/community/residence/communityDetail.vue
| ... | ... | @@ -30,6 +30,7 @@ const rules = reactive({ |
| 30 | 30 | message: "请输入小区名", |
| 31 | 31 | trigger: "blur", |
| 32 | 32 | }, |
| 33 | + { whitespace: true, message: "请输入正确的信息", trigger: "blur" }, | |
| 33 | 34 | ], |
| 34 | 35 | locality: [ |
| 35 | 36 | { |
| ... | ... | @@ -37,6 +38,7 @@ const rules = reactive({ |
| 37 | 38 | message: "请输入所在地区", |
| 38 | 39 | trigger: "blur", |
| 39 | 40 | }, |
| 41 | + { whitespace: true, message: "请输入正确的信息", trigger: "blur" }, | |
| 40 | 42 | ], |
| 41 | 43 | address: [ |
| 42 | 44 | { |
| ... | ... | @@ -44,6 +46,7 @@ const rules = reactive({ |
| 44 | 46 | message: "请输入地址", |
| 45 | 47 | trigger: "blur", |
| 46 | 48 | }, |
| 49 | + { whitespace: true, message: "请输入正确的信息", trigger: "blur" }, | |
| 47 | 50 | ], |
| 48 | 51 | buildingCount: [ |
| 49 | 52 | { |
| ... | ... | @@ -51,7 +54,7 @@ const rules = reactive({ |
| 51 | 54 | message: "请输入楼座数", |
| 52 | 55 | trigger: "blur", |
| 53 | 56 | }, |
| 54 | - { type: "number", message: "请输入数字,最大值不能超过5000",max:5000 } | |
| 57 | + { type: "number", message: "请输入数字,最大值不能超过5000", max: 5000 }, | |
| 55 | 58 | ], |
| 56 | 59 | storeroomCount: [ |
| 57 | 60 | { |
| ... | ... | @@ -59,7 +62,7 @@ const rules = reactive({ |
| 59 | 62 | message: "请输入储藏室数", |
| 60 | 63 | trigger: "blur", |
| 61 | 64 | }, |
| 62 | - { type: "number", message: "请输入数字,最大值不能超过5000",max:5000 } | |
| 65 | + { type: "number", message: "请输入数字,最大值不能超过5000", max: 5000 }, | |
| 63 | 66 | ], |
| 64 | 67 | truckSpaceCount: [ |
| 65 | 68 | { |
| ... | ... | @@ -67,7 +70,7 @@ const rules = reactive({ |
| 67 | 70 | message: "请输入车位数", |
| 68 | 71 | trigger: "blur", |
| 69 | 72 | }, |
| 70 | - { type: "number", message: "请输入数字,最大值不能超过5000",max:5000 } | |
| 73 | + { type: "number", message: "请输入数字,最大值不能超过5000", max: 5000 }, | |
| 71 | 74 | ], |
| 72 | 75 | }); |
| 73 | 76 | ... | ... |
src/views/housekeeper/buildinMganager/detail.vue
| ... | ... | @@ -69,6 +69,7 @@ const rules = reactive({ |
| 69 | 69 | message: "请输入姓名", |
| 70 | 70 | trigger: "blur", |
| 71 | 71 | }, |
| 72 | + { whitespace: true, message: "请输入正确的姓名", trigger: "blur" }, | |
| 72 | 73 | ], |
| 73 | 74 | mobile: [ |
| 74 | 75 | { |
| ... | ... | @@ -104,6 +105,7 @@ const rules = reactive({ |
| 104 | 105 | message: "请输入户籍所在地", |
| 105 | 106 | trigger: "blur", |
| 106 | 107 | }, |
| 108 | + { whitespace: true, message: "请输入正确信息", trigger: "blur" }, | |
| 107 | 109 | ], |
| 108 | 110 | birthdate: [ |
| 109 | 111 | { |
| ... | ... | @@ -118,6 +120,7 @@ const rules = reactive({ |
| 118 | 120 | message: "请输入民族", |
| 119 | 121 | trigger: "blur", |
| 120 | 122 | }, |
| 123 | + { whitespace: true, message: "请输入正确信息", trigger: "blur" }, | |
| 121 | 124 | ], |
| 122 | 125 | }); |
| 123 | 126 | |
| ... | ... | @@ -132,7 +135,7 @@ const emit = defineEmits<{ |
| 132 | 135 | */ |
| 133 | 136 | let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 134 | 137 | loading.value = true; |
| 135 | - console.log(!formEl) | |
| 138 | + console.log(!formEl); | |
| 136 | 139 | if (!formEl) return; |
| 137 | 140 | formEl.validate((valid) => { |
| 138 | 141 | if (valid) { |
| ... | ... | @@ -145,7 +148,7 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 145 | 148 | loading.value = false; |
| 146 | 149 | }); |
| 147 | 150 | } else { |
| 148 | - console.log(111) | |
| 151 | + console.log(111); | |
| 149 | 152 | instance?.proxy?.$message.error("请完善信息"); //调用 |
| 150 | 153 | loading.value = false; |
| 151 | 154 | return false; | ... | ... |
src/views/housekeeper/buildinMganager/index.vue
| ... | ... | @@ -6,7 +6,7 @@ import Pagination from "@/components/Pagination/index.vue"; |
| 6 | 6 | |
| 7 | 7 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 8 | 8 | |
| 9 | -const detailRef = ref(null); | |
| 9 | +const detailRef = ref<FormInstance>() | |
| 10 | 10 | // 数据筛选 |
| 11 | 11 | const searchData = reactive({ |
| 12 | 12 | type: "", | ... | ... |
src/views/maintain/detail.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | |
| 2 | +import { reactive, ref, onMounted, getCurrentInstance,defineExpose } from "vue"; | |
| 3 | 3 | import type { ElForm } from "element-plus"; |
| 4 | 4 | import { insertOrUpdate } from "@/api/notify/maintain.ts"; |
| 5 | 5 | |
| ... | ... | @@ -26,6 +26,7 @@ const rules = reactive({ |
| 26 | 26 | message: "请输入项目名称", |
| 27 | 27 | trigger: "blur", |
| 28 | 28 | }, |
| 29 | + { whitespace: true, message: "请输入正确的项目名称", trigger: "blur" }, | |
| 29 | 30 | ], |
| 30 | 31 | status: [ |
| 31 | 32 | { |
| ... | ... | @@ -35,7 +36,12 @@ const rules = reactive({ |
| 35 | 36 | }, |
| 36 | 37 | ], |
| 37 | 38 | }); |
| 38 | - | |
| 39 | +/** | |
| 40 | + * 重置 | |
| 41 | + */ | |
| 42 | +let resetForm = () => { | |
| 43 | + ruleFormRef.value.resetFields(); | |
| 44 | +}; | |
| 39 | 45 | const emit = defineEmits<{ |
| 40 | 46 | (e: "cancel"): void; |
| 41 | 47 | (e: "success"): void; |
| ... | ... | @@ -66,6 +72,9 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 66 | 72 | }); |
| 67 | 73 | }; |
| 68 | 74 | |
| 75 | +defineExpose({ | |
| 76 | + resetForm, | |
| 77 | +}); | |
| 69 | 78 | /** |
| 70 | 79 | * 取消提交 |
| 71 | 80 | */ | ... | ... |
src/views/maintain/index.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, getCurrentInstance } from "vue"; | |
| 2 | +import { reactive, onMounted, getCurrentInstance,ref } from "vue"; | |
| 3 | 3 | import { getTableList, deleteMaintainById } from "@/api/notify/maintain.ts"; |
| 4 | 4 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | 5 | import Detail from "./detail.vue"; |
| ... | ... | @@ -8,7 +8,7 @@ import Pagination from "@/components/Pagination/index.vue"; |
| 8 | 8 | import { useLoginStore } from "@/pinia/login"; |
| 9 | 9 | |
| 10 | 10 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 11 | - | |
| 11 | +const detailRef = ref<FormInstance>() | |
| 12 | 12 | // 数据筛选 |
| 13 | 13 | const searchData = reactive({ |
| 14 | 14 | name: null, |
| ... | ... | @@ -88,6 +88,8 @@ const changeData: void = () => { |
| 88 | 88 | const dialogClose: void = () => { |
| 89 | 89 | data.title = "新增项目"; |
| 90 | 90 | data.formObj = {}; |
| 91 | + detailRef.value.resetForm(); | |
| 92 | + | |
| 91 | 93 | }; |
| 92 | 94 | onMounted(() => { |
| 93 | 95 | search(); |
| ... | ... | @@ -172,6 +174,7 @@ onMounted(() => { |
| 172 | 174 | @close="dialogClose" |
| 173 | 175 | > |
| 174 | 176 | <Detail |
| 177 | + ref="detailRef" | |
| 175 | 178 | @cancel="data.dialogVisible = false" |
| 176 | 179 | @success="changeData" |
| 177 | 180 | :formObj="data.formObj" | ... | ... |
src/views/serviceman/detail.vue
src/views/serviceman/index.vue
| ... | ... | @@ -6,7 +6,7 @@ import { parseTime } from "@/utils/tool.ts"; |
| 6 | 6 | import Pagination from "@/components/Pagination/index.vue"; |
| 7 | 7 | |
| 8 | 8 | let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 |
| 9 | -const detailRef = ref<InstanceType<typeof ElForm>>(); | |
| 9 | +const detailRef = ref<FormInstance>(); | |
| 10 | 10 | // 数据筛选 |
| 11 | 11 | const searchData = reactive({ |
| 12 | 12 | name: null, |
| ... | ... | @@ -107,8 +107,6 @@ onMounted(() => { |
| 107 | 107 | > |
| 108 | 108 | <el-row> |
| 109 | 109 | <el-form-item> |
| 110 | - <!-- <el-button type="primary">导入</el-button> | |
| 111 | - <el-button type="primary">导出</el-button> --> | |
| 112 | 110 | <el-button type="primary" @click="data.dialogVisible = true" |
| 113 | 111 | >新增</el-button |
| 114 | 112 | > | ... | ... |