Commit ce470f443e801b0c55afd647142fb9cdc86bc09e
solve conflict
Showing
13 changed files
with
349 additions
and
73 deletions
src/api/ownerManagement/owner.ts
0 → 100644
| 1 | +import request from '../request' | |
| 2 | + | |
| 3 | +// 列表查询 | |
| 4 | +export function getTableList(params:any) { | |
| 5 | + return request({ | |
| 6 | + method: 'get', | |
| 7 | + url: '/resident/residentList', | |
| 8 | + params: params | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 房屋信息 | |
| 13 | +export function getHouse(params:any) { | |
| 14 | + return request({ | |
| 15 | + method: 'post', | |
| 16 | + url: '/house/getHouse', | |
| 17 | + params: params | |
| 18 | + }) | |
| 19 | +} | |
| 20 | +// 删除 | |
| 21 | +export function deleteHouse(params:any) { | |
| 22 | + return request({ | |
| 23 | + method: 'delete', | |
| 24 | + url: '/house/deleteHouse', | |
| 25 | + params: params | |
| 26 | + }) | |
| 27 | +} | ... | ... |
src/api/request.ts
| 1 | 1 | import axios from 'axios' |
| 2 | 2 | import * as store from "@/pinia/index"; |
| 3 | 3 | import router from '@/router' |
| 4 | -import { ElMessage } from "element-plus"; | |
| 4 | +import { ElMessage } from 'element-plus' | |
| 5 | 5 | |
| 6 | 6 | // 不这样写报ts类型错误,import...有一个多余的boolean类型 |
| 7 | -let url: any = import.meta.env | |
| 7 | +let url: any = import.meta.env | |
| 8 | 8 | let instance = axios.create({ |
| 9 | 9 | baseURL: url.VITE_BASE_URL, |
| 10 | 10 | withCredentials: true, |
| ... | ... | @@ -26,18 +26,22 @@ instance.interceptors.request.use( |
| 26 | 26 | |
| 27 | 27 | instance.interceptors.response.use( |
| 28 | 28 | response => { |
| 29 | - if(response) { | |
| 29 | + if (response) { | |
| 30 | 30 | console.log(response?.data?.errorCode) |
| 31 | 31 | switch (~~response?.data?.errorCode) { |
| 32 | 32 | case 0: |
| 33 | 33 | return response |
| 34 | 34 | break; |
| 35 | 35 | case 10002: |
| 36 | - ElMessage.error("登录失效"); | |
| 36 | + ElMessage.error(response?.data?.errorMessage || '登录失效'); | |
| 37 | 37 | router.push({ |
| 38 | 38 | path: 'login' |
| 39 | 39 | }) |
| 40 | 40 | break; |
| 41 | + case 500: | |
| 42 | + ElMessage.error(`${response?.data?.errorMessage},请联系管理员`) | |
| 43 | + Promise.reject(response?.data) | |
| 44 | + break; | |
| 41 | 45 | default: |
| 42 | 46 | ElMessage.error(response?.data?.errorMessage || '操作失败'); |
| 43 | 47 | } | ... | ... |
src/main.ts
| ... | ... | @@ -5,7 +5,7 @@ import promise from 'es6-promise' |
| 5 | 5 | // import store from '@/store/index' |
| 6 | 6 | |
| 7 | 7 | import ElementPlus from 'element-plus' |
| 8 | -import { ElMessage } from 'element-plus' | |
| 8 | +import { ElMessage,ElMessageBox } from 'element-plus' | |
| 9 | 9 | import 'element-plus/dist/index.css' |
| 10 | 10 | import zhCn from 'element-plus/es/locale/lang/zh-cn' // TIP elementUI配置中文环境 |
| 11 | 11 | |
| ... | ... | @@ -38,6 +38,7 @@ for(const i in globalVariable) { |
| 38 | 38 | // app.config.warnHandler = () => null; |
| 39 | 39 | // app.config.errorHandler = () => null; |
| 40 | 40 | app.provide("$message", ElMessage); |
| 41 | +app.provide("$messageBox", ElMessageBox ); | |
| 41 | 42 | |
| 42 | 43 | app |
| 43 | 44 | // .use(store) | ... | ... |
src/router/index.ts
| ... | ... | @@ -6,6 +6,7 @@ import User from "./modules/user" |
| 6 | 6 | import Resident from "./modules/resident" |
| 7 | 7 | import Property from "./modules/property" |
| 8 | 8 | import Community from "./modules/community" |
| 9 | +import OwnerManagement from "./modules/ownerManagement" | |
| 9 | 10 | import Layout from '@/layout/enter.vue' |
| 10 | 11 | const routes: Array<any> = [ |
| 11 | 12 | { path: '/', redirect: { path: '/dashboard' } }, |
| ... | ... | @@ -46,7 +47,7 @@ const routes: Array<any> = [ |
| 46 | 47 | Resident, |
| 47 | 48 | Property, |
| 48 | 49 | Community, |
| 49 | - | |
| 50 | + OwnerManagement, | |
| 50 | 51 | { |
| 51 | 52 | path: '/login', |
| 52 | 53 | name: 'Login', | ... | ... |
src/router/modules/ownerManagement.ts
0 → 100644
| 1 | + | |
| 2 | +import Layout from '@/layout/enter.vue' | |
| 3 | +const OwnerManagement = { | |
| 4 | + path: '/', | |
| 5 | + component: Layout, | |
| 6 | + name: 'Owner', | |
| 7 | + children: [{ | |
| 8 | + path: 'owner', | |
| 9 | + name: 'owner', | |
| 10 | + component: () => import('@/views/ownerManagement/owner/index.vue'), | |
| 11 | + meta: { title: '业主管理' } | |
| 12 | + } | |
| 13 | + ] | |
| 14 | +} | |
| 15 | + | |
| 16 | +export default OwnerManagement | ... | ... |
src/style/element.scss
src/views/community/housekeeper/houseDetail.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, watch, onMounted } from "vue"; | |
| 3 | -import type { ElForm } from "element-plus"; | |
| 4 | -import { ElMessage } from "element-plus"; | |
| 2 | +import { | |
| 3 | + reactive, | |
| 4 | + ref, | |
| 5 | + onMounted, | |
| 6 | + getCurrentInstance, | |
| 7 | + defineExpose, | |
| 8 | +} from "vue"; | |
| 5 | 9 | import { addOrUpdate } from "@/api/community/housekeeper.ts"; |
| 6 | 10 | import { getTableList } from "@/api/community/residence.ts"; |
| 11 | + | |
| 7 | 12 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); |
| 13 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 14 | + | |
| 8 | 15 | // 声明props |
| 9 | 16 | const props = defineProps({ |
| 10 | 17 | formObj: { |
| ... | ... | @@ -30,7 +37,7 @@ let data = reactive({ |
| 30 | 37 | * 获取下拉数据 |
| 31 | 38 | */ |
| 32 | 39 | const getSelectList: void = () => { |
| 33 | - getTableList({ pageNum: 1, pageSize: 1000,type:0 }) | |
| 40 | + getTableList({ pageNum: 1, pageSize: 1000, type: 0 }) | |
| 34 | 41 | .then((res) => { |
| 35 | 42 | data.options = res.data.data.list; |
| 36 | 43 | }) |
| ... | ... | @@ -39,8 +46,8 @@ const getSelectList: void = () => { |
| 39 | 46 | }); |
| 40 | 47 | }; |
| 41 | 48 | onMounted(() => { |
| 42 | - getSelectList() | |
| 43 | -}) | |
| 49 | + getSelectList(); | |
| 50 | +}); | |
| 44 | 51 | // 表单验证 |
| 45 | 52 | const rules = reactive({ |
| 46 | 53 | neighborhoodId: [ |
| ... | ... | @@ -100,6 +107,12 @@ const emit = defineEmits<{ |
| 100 | 107 | }>(); |
| 101 | 108 | |
| 102 | 109 | /** |
| 110 | + * 重置 | |
| 111 | + */ | |
| 112 | +let resetForm = () => { | |
| 113 | + ruleFormRef.value.resetFields(); | |
| 114 | +}; | |
| 115 | +/** | |
| 103 | 116 | * 表单提交 |
| 104 | 117 | * @param {ElForm | undefined} formEl 表单对象 |
| 105 | 118 | */ |
| ... | ... | @@ -108,16 +121,16 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 108 | 121 | if (!formEl) return; |
| 109 | 122 | formEl.validate((valid) => { |
| 110 | 123 | if (valid) { |
| 111 | - console.log("111"); | |
| 112 | - addOrUpdate(props.formObj).then((res) => { | |
| 113 | - console.log(res); | |
| 114 | - emit("success"); | |
| 115 | - }); | |
| 124 | + addOrUpdate(props.formObj) | |
| 125 | + .then((res) => { | |
| 126 | + loading.value = false; | |
| 127 | + emit("success"); | |
| 128 | + }) | |
| 129 | + .catch((err) => { | |
| 130 | + console.log(err); | |
| 131 | + }); | |
| 116 | 132 | } else { |
| 117 | - ElMessage({ | |
| 118 | - message: "请完善信息", | |
| 119 | - type: "error", | |
| 120 | - }); | |
| 133 | + instance?.proxy?.$message.error("请完善信息"); //调用 | |
| 121 | 134 | loading.value = false; |
| 122 | 135 | return false; |
| 123 | 136 | } |
| ... | ... | @@ -130,6 +143,10 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 130 | 143 | const cancel: void = () => { |
| 131 | 144 | emit("cancel"); |
| 132 | 145 | }; |
| 146 | + | |
| 147 | +defineExpose({ | |
| 148 | + resetForm, | |
| 149 | +}); | |
| 133 | 150 | </script> |
| 134 | 151 | |
| 135 | 152 | <template> | ... | ... |
src/views/community/housekeeper/index.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, ref } from "vue"; | |
| 2 | +import { reactive, onMounted, ref, getCurrentInstance } from "vue"; | |
| 3 | 3 | import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts"; |
| 4 | 4 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | 5 | import HouseDetail from "./houseDetail.vue"; |
| 6 | 6 | import Pagination from "@/components/Pagination/index.vue"; |
| 7 | -import { ElMessage } from "element-plus"; | |
| 7 | +import { useRoute } from "vue-router"; | |
| 8 | + | |
| 9 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 10 | +const houseDetailRef = ref(null); | |
| 11 | +let route = useRoute(); // 路由 | |
| 12 | + | |
| 8 | 13 | // 数据筛选 |
| 9 | 14 | const searchData = reactive({ |
| 10 | 15 | neighborhoodId: null, |
| ... | ... | @@ -45,19 +50,27 @@ const search = (): void => { |
| 45 | 50 | * @param { Object } 列表对象 |
| 46 | 51 | */ |
| 47 | 52 | const edit = (row: Object) => { |
| 53 | + data.title = "编辑楼宇"; | |
| 48 | 54 | data.formObj = row; |
| 49 | 55 | data.dialogVisible = true; |
| 50 | - console.log(data.formObj); | |
| 51 | 56 | }; |
| 52 | 57 | /** |
| 53 | 58 | * 删除 |
| 54 | 59 | * @param { number } buildingId 楼宇ID |
| 55 | 60 | */ |
| 56 | 61 | const remove = (buildingId: number) => { |
| 57 | - deleteBuilding({ buildingId: buildingId }).then((res) => { | |
| 58 | - ElMessage.success("操作成功"); | |
| 59 | - search(); | |
| 60 | - }); | |
| 62 | + instance?.proxy?.$messageBox | |
| 63 | + .confirm("确认要进行此操作?", "提示", { | |
| 64 | + confirmButtonText: "确定", | |
| 65 | + cancelButtonText: "取消", | |
| 66 | + }) | |
| 67 | + .then(() => { | |
| 68 | + deleteBuilding({ buildingId: buildingId }).then((res) => { | |
| 69 | + instance?.proxy?.$message.success("操作成功"); //调用 | |
| 70 | + search(); | |
| 71 | + }); | |
| 72 | + }) | |
| 73 | + .catch((err) => {}); | |
| 61 | 74 | }; |
| 62 | 75 | /** |
| 63 | 76 | * 组件操作成功回调 |
| ... | ... | @@ -71,9 +84,14 @@ const changeData: void = () => { |
| 71 | 84 | * 弹框关闭 |
| 72 | 85 | */ |
| 73 | 86 | const dialogClose: void = () => { |
| 87 | + data.title = "新增楼宇"; | |
| 74 | 88 | data.formObj = {}; |
| 89 | + houseDetailRef.value.resetForm(); | |
| 75 | 90 | }; |
| 76 | 91 | onMounted(() => { |
| 92 | + searchData.neighborhoodId = route.query.neighborhoodId | |
| 93 | + ? route.query.neighborhoodId | |
| 94 | + : null; | |
| 77 | 95 | search(); |
| 78 | 96 | }); |
| 79 | 97 | </script> |
| ... | ... | @@ -96,8 +114,8 @@ onMounted(() => { |
| 96 | 114 | > |
| 97 | 115 | <el-row> |
| 98 | 116 | <el-form-item> |
| 99 | - <el-button type="primary">导入</el-button> | |
| 100 | - <el-button type="primary">导出</el-button> | |
| 117 | + <!-- <el-button type="primary">导入</el-button> | |
| 118 | + <el-button type="primary">导出</el-button> --> | |
| 101 | 119 | <el-button type="primary" @click="data.dialogVisible = true" |
| 102 | 120 | >新增</el-button |
| 103 | 121 | > |
| ... | ... | @@ -129,7 +147,14 @@ onMounted(() => { |
| 129 | 147 | <el-table-column label="操作"> |
| 130 | 148 | <template #default="scope"> |
| 131 | 149 | <el-button type="text" size="mini">更换楼管</el-button> |
| 132 | - <el-button type="text" size="mini">房屋管理</el-button> | |
| 150 | + <router-link | |
| 151 | + :to="{ | |
| 152 | + name: 'houses', | |
| 153 | + query: { buildingId: scope.row.id }, | |
| 154 | + }" | |
| 155 | + > | |
| 156 | + <el-button type="text" size="mini">房屋管理</el-button> | |
| 157 | + </router-link> | |
| 133 | 158 | <el-button type="text" size="mini" @click="edit(scope.row)" |
| 134 | 159 | >编辑</el-button |
| 135 | 160 | > |
| ... | ... | @@ -157,6 +182,7 @@ onMounted(() => { |
| 157 | 182 | @close="dialogClose" |
| 158 | 183 | > |
| 159 | 184 | <HouseDetail |
| 185 | + ref="houseDetailRef" | |
| 160 | 186 | @cancel="data.dialogVisible = false" |
| 161 | 187 | @success="changeData" |
| 162 | 188 | :formObj="data.formObj" | ... | ... |
src/views/community/houses/detail.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, onMounted } from "vue"; | |
| 2 | +import { reactive, onMounted } from "vue"; | |
| 3 | 3 | import { getHouse } from "@/api/community/houses.ts"; |
| 4 | 4 | |
| 5 | 5 | // 声明props |
| ... | ... | @@ -9,7 +9,6 @@ const props = defineProps({ |
| 9 | 9 | default: {}, |
| 10 | 10 | }, |
| 11 | 11 | }); |
| 12 | -console.log(props.formObj); | |
| 13 | 12 | </script> |
| 14 | 13 | |
| 15 | 14 | <template> | ... | ... |
src/views/community/houses/index.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, ref } from "vue"; | |
| 3 | -import { getTableList, deleteHouse,getHouse } from "@/api/community/houses.ts"; | |
| 2 | +import { reactive, onMounted, getCurrentInstance } from "vue"; | |
| 3 | +import { getTableList, deleteHouse, getHouse } from "@/api/community/houses.ts"; | |
| 4 | 4 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | 5 | import Detail from "./detail.vue"; |
| 6 | 6 | import Pagination from "@/components/Pagination/index.vue"; |
| 7 | -import { ElMessage } from "element-plus"; | |
| 7 | +import { useRoute } from "vue-router"; | |
| 8 | + | |
| 9 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 10 | +let route = useRoute(); // 路由 | |
| 8 | 11 | // 数据筛选 |
| 9 | 12 | const searchData = reactive({ |
| 10 | - buildingId: 1, | |
| 13 | + buildingId: null, | |
| 11 | 14 | type: 0, |
| 12 | 15 | roomNumber: null, |
| 13 | 16 | pageNum: 1, |
| ... | ... | @@ -47,7 +50,7 @@ const search = (): void => { |
| 47 | 50 | const check = (houseId: number) => { |
| 48 | 51 | getHouse({ houseId: houseId }).then((res) => { |
| 49 | 52 | data.formObj = res.data.data; |
| 50 | - data.dialogVisible=true; | |
| 53 | + data.dialogVisible = true; | |
| 51 | 54 | }); |
| 52 | 55 | }; |
| 53 | 56 | |
| ... | ... | @@ -56,13 +59,24 @@ const check = (houseId: number) => { |
| 56 | 59 | * @param { number } houseId 房屋ID |
| 57 | 60 | */ |
| 58 | 61 | const remove = (houseId: number) => { |
| 59 | - deleteHouse({ houseId: houseId }).then((res) => { | |
| 60 | - ElMessage.success("操作成功"); | |
| 61 | - search(); | |
| 62 | - }); | |
| 62 | + instance?.proxy?.$messageBox | |
| 63 | + .confirm("确认要进行此操作?", "提示", { | |
| 64 | + confirmButtonText: "确定", | |
| 65 | + cancelButtonText: "取消", | |
| 66 | + }) | |
| 67 | + .then(() => { | |
| 68 | + deleteHouse({ houseId: houseId }).then((res) => { | |
| 69 | + instance?.proxy?.$message.success("操作成功"); //调用 | |
| 70 | + search(); | |
| 71 | + }); | |
| 72 | + }) | |
| 73 | + .catch((err) => {}); | |
| 63 | 74 | }; |
| 64 | 75 | |
| 65 | 76 | onMounted(() => { |
| 77 | + searchData.buildingId = route.query.buildingId | |
| 78 | + ? route.query.buildingId | |
| 79 | + : null; | |
| 66 | 80 | search(); |
| 67 | 81 | }); |
| 68 | 82 | </script> |
| ... | ... | @@ -99,7 +113,7 @@ onMounted(() => { |
| 99 | 113 | > |
| 100 | 114 | </el-table-column> |
| 101 | 115 | <el-table-column label="楼宇名称" prop="buildingName"> |
| 102 | - <template #default="scope"> | |
| 116 | + <template #default="scope"> | |
| 103 | 117 | <span>{{ scope.row.building.buildingName }}</span></template |
| 104 | 118 | > |
| 105 | 119 | </el-table-column> |
| ... | ... | @@ -109,10 +123,13 @@ onMounted(() => { |
| 109 | 123 | <el-table-column label="使用面积" prop="useArea"></el-table-column> |
| 110 | 124 | <el-table-column label="操作" width="350px"> |
| 111 | 125 | <template #default="scope"> |
| 112 | - <el-button type="text" size="mini">更换楼管</el-button> | |
| 113 | - <el-button type="text" size="mini">房屋管理</el-button> | |
| 126 | + <el-button type="text" size="mini">绑定业主</el-button> | |
| 127 | + <el-button type="text" size="mini">取消绑定</el-button> | |
| 128 | + | |
| 129 | + <el-button type="text" size="mini" @click="check(scope.row.id)" | |
| 130 | + >查看房屋</el-button | |
| 131 | + > | |
| 114 | 132 | <el-button type="text" size="mini">查看业主</el-button> |
| 115 | - <el-button type="text" size="mini" @click="check(scope.row.id)">查看房屋</el-button> | |
| 116 | 133 | <!-- <el-button type="text" size="mini" @click="edit(scope.row)" |
| 117 | 134 | >编辑</el-button |
| 118 | 135 | > --> |
| ... | ... | @@ -139,9 +156,7 @@ onMounted(() => { |
| 139 | 156 | width="40%" |
| 140 | 157 | @close="data.dialogClose" |
| 141 | 158 | > |
| 142 | - <Detail | |
| 143 | - :formObj="data.formObj" | |
| 144 | - ></Detail> | |
| 159 | + <Detail :formObj="data.formObj"></Detail> | |
| 145 | 160 | </el-dialog> |
| 146 | 161 | </div> |
| 147 | 162 | </template> | ... | ... |
src/views/community/residence/communityDetail.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, watch, onMounted } from "vue"; | |
| 2 | +import { reactive, ref, onMounted,getCurrentInstance } from "vue"; | |
| 3 | 3 | import type { ElForm } from "element-plus"; |
| 4 | -import { ElMessage } from "element-plus"; | |
| 5 | 4 | import { addOrUpdate } from "@/api/community/residence.ts"; |
| 5 | + | |
| 6 | 6 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); |
| 7 | +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例 | |
| 7 | 8 | // 声明props |
| 8 | 9 | const props = defineProps({ |
| 9 | 10 | formObj: { |
| ... | ... | @@ -81,16 +82,12 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { |
| 81 | 82 | if (!formEl) return; |
| 82 | 83 | formEl.validate((valid) => { |
| 83 | 84 | if (valid) { |
| 84 | - console.log("111") | |
| 85 | 85 | addOrUpdate(props.formObj).then((res) => { |
| 86 | - console.log(res); | |
| 87 | - emit("success"); | |
| 86 | + loading.value = false; | |
| 87 | + emit("success"); | |
| 88 | 88 | }); |
| 89 | 89 | } else { |
| 90 | - ElMessage({ | |
| 91 | - message: "请完善信息", | |
| 92 | - type: "error", | |
| 93 | - }); | |
| 90 | + instance?.proxy?.$message.error('请完善信息')//调用 | |
| 94 | 91 | loading.value = false; |
| 95 | 92 | return false; |
| 96 | 93 | } | ... | ... |
src/views/community/residence/index.vue
| 1 | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, ref } from "vue"; | |
| 2 | +import { reactive, onMounted, getCurrentInstance } from "vue"; | |
| 3 | 3 | import { getTableList, deleteNeighborhood } from "@/api/community/residence.ts"; |
| 4 | 4 | import CommunityDetail from "./communityDetail.vue"; |
| 5 | 5 | import Pagination from "@/components/Pagination/index.vue"; |
| 6 | -import { ElMessage } from "element-plus"; | |
| 6 | + | |
| 7 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 7 | 8 | // 数据筛选 |
| 8 | 9 | const searchData = reactive({ |
| 9 | - propertyId: 1, | |
| 10 | 10 | type: 0, |
| 11 | 11 | name: null, |
| 12 | 12 | pageNum: 1, |
| ... | ... | @@ -44,19 +44,27 @@ const search = (): void => { |
| 44 | 44 | * @param { Object } 列表对象 |
| 45 | 45 | */ |
| 46 | 46 | const edit = (row: Object) => { |
| 47 | + data.title = "编辑小区"; | |
| 47 | 48 | data.formObj = row; |
| 48 | 49 | data.dialogVisible = true; |
| 49 | - console.log(data.formObj); | |
| 50 | 50 | }; |
| 51 | 51 | /** |
| 52 | 52 | * 删除 |
| 53 | 53 | * @param { number } neighborhoodId 小区ID |
| 54 | 54 | */ |
| 55 | 55 | const remove = (neighborhoodId: number) => { |
| 56 | - deleteNeighborhood({ neighborhoodId: neighborhoodId }).then((res) => { | |
| 57 | - ElMessage.success("操作成功"); | |
| 58 | - search(); | |
| 59 | - }); | |
| 56 | + instance?.proxy?.$messageBox | |
| 57 | + .confirm("确认要进行此操作?", "提示", { | |
| 58 | + confirmButtonText: "确定", | |
| 59 | + cancelButtonText: "取消", | |
| 60 | + }) | |
| 61 | + .then(() => { | |
| 62 | + deleteNeighborhood({ neighborhoodId: neighborhoodId }).then((res) => { | |
| 63 | + instance?.proxy?.$message.success("操作成功"); //调用 | |
| 64 | + search(); | |
| 65 | + }); | |
| 66 | + }) | |
| 67 | + .catch((err) => {}); | |
| 60 | 68 | }; |
| 61 | 69 | /** |
| 62 | 70 | * 组件操作成功回调 |
| ... | ... | @@ -70,6 +78,7 @@ const changeData: void = () => { |
| 70 | 78 | * 弹框关闭 |
| 71 | 79 | */ |
| 72 | 80 | const dialogClose: void = () => { |
| 81 | + data.title = "新增小区"; | |
| 73 | 82 | data.formObj = {}; |
| 74 | 83 | }; |
| 75 | 84 | onMounted(() => { |
| ... | ... | @@ -82,7 +91,7 @@ onMounted(() => { |
| 82 | 91 | <el-form :inline="true" :model="searchData" v-loading="data.loading"> |
| 83 | 92 | <el-form-item> |
| 84 | 93 | <el-input |
| 85 | - placeholder="请输入社区名称" | |
| 94 | + placeholder="输入小区名称" | |
| 86 | 95 | v-model="searchData.name" |
| 87 | 96 | clearable |
| 88 | 97 | ></el-input> |
| ... | ... | @@ -94,8 +103,8 @@ onMounted(() => { |
| 94 | 103 | > |
| 95 | 104 | <el-row> |
| 96 | 105 | <el-form-item> |
| 97 | - <el-button type="primary">导入</el-button> | |
| 98 | - <el-button type="primary">导出</el-button> | |
| 106 | + <!-- <el-button type="primary">导入</el-button> | |
| 107 | + <el-button type="primary">导出</el-button> --> | |
| 99 | 108 | <el-button type="primary" @click="data.dialogVisible = true" |
| 100 | 109 | >新增</el-button |
| 101 | 110 | > |
| ... | ... | @@ -119,7 +128,14 @@ onMounted(() => { |
| 119 | 128 | <el-button type="text" size="mini" @click="remove(scope.row.id)" |
| 120 | 129 | >删除</el-button |
| 121 | 130 | > |
| 122 | - <el-button type="text" size="mini">楼宇管理</el-button> | |
| 131 | + <router-link | |
| 132 | + :to="{ | |
| 133 | + name: 'housekeeper', | |
| 134 | + query: { neighborhoodId: scope.row.id }, | |
| 135 | + }" | |
| 136 | + > | |
| 137 | + <el-button type="text" size="mini">楼宇管理</el-button></router-link | |
| 138 | + > | |
| 123 | 139 | </template> |
| 124 | 140 | </el-table-column> |
| 125 | 141 | </el-table> | ... | ... |
src/views/ownerManagement/owner/index.vue
0 → 100644
| 1 | +<script setup lang="ts"> | |
| 2 | +import { reactive, onMounted, getCurrentInstance } from "vue"; | |
| 3 | +import { getTableList } from "@/api/ownerManagement/owner.ts"; | |
| 4 | +// import CommunityDetail from "./communityDetail.vue"; | |
| 5 | +import Pagination from "@/components/Pagination/index.vue"; | |
| 6 | + | |
| 7 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | |
| 8 | +// 数据筛选 | |
| 9 | +const searchData = reactive({ | |
| 10 | + isOwner: null, | |
| 11 | + pageNum: 1, | |
| 12 | + pageSize: 10, | |
| 13 | +}); | |
| 14 | +// 展示 | |
| 15 | +const data = reactive({ | |
| 16 | + total: 0, | |
| 17 | + tableList: [], | |
| 18 | + dialogVisible: false, | |
| 19 | + loading: false, | |
| 20 | + title: "新增小区", | |
| 21 | + formObj: {}, | |
| 22 | + options:[ | |
| 23 | + {label:'业主',value:1}, | |
| 24 | + {label:'租户',value:2}, | |
| 25 | + {label:'住户',value:3} | |
| 26 | + ] | |
| 27 | +}); | |
| 28 | + | |
| 29 | +/** | |
| 30 | + * 列表查询 | |
| 31 | + */ | |
| 32 | +const search = (): void => { | |
| 33 | + data.loading = true; | |
| 34 | + getTableList(searchData) | |
| 35 | + .then((res) => { | |
| 36 | + data.tableList = res.data.data.list; | |
| 37 | + data.total = res.data.data.total; | |
| 38 | + searchData.pageSize = res.data.data.pageSize; | |
| 39 | + data.loading = false; | |
| 40 | + }) | |
| 41 | + .catch((err) => { | |
| 42 | + console.log(err); | |
| 43 | + data.loading = false; | |
| 44 | + }); | |
| 45 | +}; | |
| 46 | +/** | |
| 47 | + * 编辑 | |
| 48 | + * @param { Object } 列表对象 | |
| 49 | + */ | |
| 50 | +const edit = (row: Object) => { | |
| 51 | + data.formObj = row; | |
| 52 | + data.dialogVisible = true; | |
| 53 | +}; | |
| 54 | +/** | |
| 55 | + * 删除 | |
| 56 | + * @param { number } neighborhoodId 小区ID | |
| 57 | + */ | |
| 58 | +const remove = (neighborhoodId: number) => { | |
| 59 | + // deleteNeighborhood({ neighborhoodId: neighborhoodId }).then((res) => { | |
| 60 | + // instance?.proxy?.$message.success('操作成功')//调用 | |
| 61 | + // search(); | |
| 62 | + // }); | |
| 63 | +}; | |
| 64 | +/** | |
| 65 | + * 组件操作成功回调 | |
| 66 | + */ | |
| 67 | +const changeData: void = () => { | |
| 68 | + data.dialogVisible = false; | |
| 69 | + search(); | |
| 70 | +}; | |
| 71 | + | |
| 72 | +/** | |
| 73 | + * 弹框关闭 | |
| 74 | + */ | |
| 75 | +const dialogClose: void = () => { | |
| 76 | + data.formObj = {}; | |
| 77 | +}; | |
| 78 | +onMounted(() => { | |
| 79 | + console.log("11"); | |
| 80 | + search(); | |
| 81 | +}); | |
| 82 | +</script> | |
| 83 | +<template> | |
| 84 | + <div class="app-container"> | |
| 85 | + <!-- 搜索 --> | |
| 86 | + <el-form :inline="true" :model="searchData" v-loading="data.loading"> | |
| 87 | + <el-form-item> | |
| 88 | + <el-select v-model="searchData.isOwner" placeholder="请选择类型"> | |
| 89 | + <el-option | |
| 90 | + v-for="item in data.options" | |
| 91 | + :key="item.value" | |
| 92 | + :label="item.label" | |
| 93 | + :value="item.value" | |
| 94 | + > | |
| 95 | + </el-option> | |
| 96 | + </el-select> | |
| 97 | + </el-form-item> | |
| 98 | + <el-form-item | |
| 99 | + ><el-button type="primary" @click="search" | |
| 100 | + >查询</el-button | |
| 101 | + ></el-form-item | |
| 102 | + > | |
| 103 | + <el-row> | |
| 104 | + <el-form-item> | |
| 105 | + <el-button type="primary">导入</el-button> | |
| 106 | + <el-button type="primary">导出</el-button> | |
| 107 | + <el-button type="primary" @click="data.dialogVisible = true" | |
| 108 | + >新增</el-button | |
| 109 | + > | |
| 110 | + </el-form-item> | |
| 111 | + </el-row> | |
| 112 | + </el-form> | |
| 113 | + | |
| 114 | + <!-- 表格 --> | |
| 115 | + <el-table border :data="data.tableList"> | |
| 116 | + <el-table-column label="房产名称" prop="name"></el-table-column> | |
| 117 | + <el-table-column label="姓名" prop="buildingCount"></el-table-column> | |
| 118 | + <el-table-column label="手机号" prop="storeroomCount"></el-table-column> | |
| 119 | + <el-table-column label="身份证" prop="truckSpaceCount"></el-table-column> | |
| 120 | + <el-table-column label="绑定日期" prop="locality"></el-table-column> | |
| 121 | + <el-table-column label="类型" prop="address"></el-table-column> | |
| 122 | + <el-table-column label="操作"> | |
| 123 | + <template #default="scope"> | |
| 124 | + <el-button type="text" size="mini" @click="edit(scope.row)" | |
| 125 | + >编辑</el-button | |
| 126 | + > | |
| 127 | + <el-button type="text" size="mini" @click="remove(scope.row.id)" | |
| 128 | + >删除</el-button | |
| 129 | + > | |
| 130 | + <el-button type="text" size="mini">楼宇管理</el-button> | |
| 131 | + </template> | |
| 132 | + </el-table-column> | |
| 133 | + </el-table> | |
| 134 | + | |
| 135 | + <!-- 分页 --> | |
| 136 | + <Pagination | |
| 137 | + v-if="data.total > 0" | |
| 138 | + :total="data.total" | |
| 139 | + :currentPage="searchData.pageNum" | |
| 140 | + :pageSize="searchData.pageSize" | |
| 141 | + @pageChange="search" | |
| 142 | + ></Pagination> | |
| 143 | + | |
| 144 | + <!-- 详情弹框 --> | |
| 145 | + <!-- <el-dialog | |
| 146 | + v-model="data.dialogVisible" | |
| 147 | + :title="data.title" | |
| 148 | + width="30%" | |
| 149 | + @close="dialogClose" | |
| 150 | + > --> | |
| 151 | + <!-- <CommunityDetail | |
| 152 | + @cancel="data.dialogVisible = false" | |
| 153 | + @success="changeData" | |
| 154 | + :formObj="data.formObj" | |
| 155 | + ></CommunityDetail> --> | |
| 156 | + <!-- </el-dialog> --> | |
| 157 | + </div> | |
| 158 | +</template> | |
| 159 | + | |
| 160 | +<style></style> | ... | ... |