Commit a25f1314b63e4e62275f72351c728193931c32f1
1 parent
e42092aa
物业编辑
Showing
3 changed files
with
12 additions
and
3 deletions
src/views/property/edit.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, getCurrentInstance } from "vue"; | |
| 2 | +import { reactive, ref, getCurrentInstance, onMounted } from "vue"; | |
| 3 | 3 | import { propertyAdd } from "@/api/property"; |
| 4 | +import { useRoute } from "vue-router"; | |
| 4 | 5 | import { validMobile } from "@/utils/validate"; |
| 5 | 6 | import type { ElForm } from "element-plus"; |
| 6 | -const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | |
| 7 | 7 | const { |
| 8 | 8 | appContext: { |
| 9 | 9 | config: { globalProperties }, |
| ... | ... | @@ -25,6 +25,7 @@ let form = reactive({ |
| 25 | 25 | status: 0, |
| 26 | 26 | }, |
| 27 | 27 | }); |
| 28 | +const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | |
| 28 | 29 | // 校验手机号格式 |
| 29 | 30 | const checkPhone = (rules, value, callback) => { |
| 30 | 31 | if (validMobile(value)) { |
| ... | ... | @@ -114,11 +115,14 @@ const submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 114 | 115 | console.log(error); |
| 115 | 116 | }); |
| 116 | 117 | } else { |
| 117 | - globalProperties.$message.success("请检查表单格式"); | |
| 118 | + globalProperties.$message.error("请检查表单格式"); | |
| 118 | 119 | return false; |
| 119 | 120 | } |
| 120 | 121 | }); |
| 121 | 122 | }; |
| 123 | +onMounted(() => { | |
| 124 | + form.data = useRoute().query | |
| 125 | +}); | |
| 122 | 126 | </script> |
| 123 | 127 | |
| 124 | 128 | <template> | ... | ... |
src/views/property/index.vue
| ... | ... | @@ -152,6 +152,7 @@ onMounted(() => { |
| 152 | 152 | </el-table-column> |
| 153 | 153 | <el-table-column label="操作" align="center"> |
| 154 | 154 | <template #default="scope"> |
| 155 | + <el-button type="text"><router-link :to="{path:'/property/edit',query:scope.row}">编辑</router-link></el-button> | |
| 155 | 156 | <el-button type="text" disabled>代理登录</el-button> |
| 156 | 157 | <el-button type="text" @click="handleStatus(scope.row)">{{ |
| 157 | 158 | scope.row.status ? "禁用" : "启用" | ... | ... |