Commit a25f1314b63e4e62275f72351c728193931c32f1

Authored by 杨泽宇
1 parent e42092aa

物业编辑

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