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 | import axios from 'axios' | 1 | import axios from 'axios' |
| 2 | import * as store from "@/pinia/index"; | 2 | import * as store from "@/pinia/index"; |
| 3 | import router from '@/router' | 3 | import router from '@/router' |
| 4 | -import { ElMessage } from "element-plus"; | 4 | +import { ElMessage } from 'element-plus' |
| 5 | 5 | ||
| 6 | // 不这样写报ts类型错误,import...有一个多余的boolean类型 | 6 | // 不这样写报ts类型错误,import...有一个多余的boolean类型 |
| 7 | -let url: any = import.meta.env | 7 | +let url: any = import.meta.env |
| 8 | let instance = axios.create({ | 8 | let instance = axios.create({ |
| 9 | baseURL: url.VITE_BASE_URL, | 9 | baseURL: url.VITE_BASE_URL, |
| 10 | withCredentials: true, | 10 | withCredentials: true, |
| @@ -26,18 +26,22 @@ instance.interceptors.request.use( | @@ -26,18 +26,22 @@ instance.interceptors.request.use( | ||
| 26 | 26 | ||
| 27 | instance.interceptors.response.use( | 27 | instance.interceptors.response.use( |
| 28 | response => { | 28 | response => { |
| 29 | - if(response) { | 29 | + if (response) { |
| 30 | console.log(response?.data?.errorCode) | 30 | console.log(response?.data?.errorCode) |
| 31 | switch (~~response?.data?.errorCode) { | 31 | switch (~~response?.data?.errorCode) { |
| 32 | case 0: | 32 | case 0: |
| 33 | return response | 33 | return response |
| 34 | break; | 34 | break; |
| 35 | case 10002: | 35 | case 10002: |
| 36 | - ElMessage.error("登录失效"); | 36 | + ElMessage.error(response?.data?.errorMessage || '登录失效'); |
| 37 | router.push({ | 37 | router.push({ |
| 38 | path: 'login' | 38 | path: 'login' |
| 39 | }) | 39 | }) |
| 40 | break; | 40 | break; |
| 41 | + case 500: | ||
| 42 | + ElMessage.error(`${response?.data?.errorMessage},请联系管理员`) | ||
| 43 | + Promise.reject(response?.data) | ||
| 44 | + break; | ||
| 41 | default: | 45 | default: |
| 42 | ElMessage.error(response?.data?.errorMessage || '操作失败'); | 46 | ElMessage.error(response?.data?.errorMessage || '操作失败'); |
| 43 | } | 47 | } |
src/main.ts
| @@ -5,7 +5,7 @@ import promise from 'es6-promise' | @@ -5,7 +5,7 @@ import promise from 'es6-promise' | ||
| 5 | // import store from '@/store/index' | 5 | // import store from '@/store/index' |
| 6 | 6 | ||
| 7 | import ElementPlus from 'element-plus' | 7 | import ElementPlus from 'element-plus' |
| 8 | -import { ElMessage } from 'element-plus' | 8 | +import { ElMessage,ElMessageBox } from 'element-plus' |
| 9 | import 'element-plus/dist/index.css' | 9 | import 'element-plus/dist/index.css' |
| 10 | import zhCn from 'element-plus/es/locale/lang/zh-cn' // TIP elementUI配置中文环境 | 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,6 +38,7 @@ for(const i in globalVariable) { | ||
| 38 | // app.config.warnHandler = () => null; | 38 | // app.config.warnHandler = () => null; |
| 39 | // app.config.errorHandler = () => null; | 39 | // app.config.errorHandler = () => null; |
| 40 | app.provide("$message", ElMessage); | 40 | app.provide("$message", ElMessage); |
| 41 | +app.provide("$messageBox", ElMessageBox ); | ||
| 41 | 42 | ||
| 42 | app | 43 | app |
| 43 | // .use(store) | 44 | // .use(store) |
src/router/index.ts
| @@ -6,6 +6,7 @@ import User from "./modules/user" | @@ -6,6 +6,7 @@ import User from "./modules/user" | ||
| 6 | import Resident from "./modules/resident" | 6 | import Resident from "./modules/resident" |
| 7 | import Property from "./modules/property" | 7 | import Property from "./modules/property" |
| 8 | import Community from "./modules/community" | 8 | import Community from "./modules/community" |
| 9 | +import OwnerManagement from "./modules/ownerManagement" | ||
| 9 | import Layout from '@/layout/enter.vue' | 10 | import Layout from '@/layout/enter.vue' |
| 10 | const routes: Array<any> = [ | 11 | const routes: Array<any> = [ |
| 11 | { path: '/', redirect: { path: '/dashboard' } }, | 12 | { path: '/', redirect: { path: '/dashboard' } }, |
| @@ -46,7 +47,7 @@ const routes: Array<any> = [ | @@ -46,7 +47,7 @@ const routes: Array<any> = [ | ||
| 46 | Resident, | 47 | Resident, |
| 47 | Property, | 48 | Property, |
| 48 | Community, | 49 | Community, |
| 49 | - | 50 | + OwnerManagement, |
| 50 | { | 51 | { |
| 51 | path: '/login', | 52 | path: '/login', |
| 52 | name: 'Login', | 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 | <script setup lang="ts"> | 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 | import { addOrUpdate } from "@/api/community/housekeeper.ts"; | 9 | import { addOrUpdate } from "@/api/community/housekeeper.ts"; |
| 6 | import { getTableList } from "@/api/community/residence.ts"; | 10 | import { getTableList } from "@/api/community/residence.ts"; |
| 11 | + | ||
| 7 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | 12 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); |
| 13 | +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例 | ||
| 14 | + | ||
| 8 | // 声明props | 15 | // 声明props |
| 9 | const props = defineProps({ | 16 | const props = defineProps({ |
| 10 | formObj: { | 17 | formObj: { |
| @@ -30,7 +37,7 @@ let data = reactive({ | @@ -30,7 +37,7 @@ let data = reactive({ | ||
| 30 | * 获取下拉数据 | 37 | * 获取下拉数据 |
| 31 | */ | 38 | */ |
| 32 | const getSelectList: void = () => { | 39 | const getSelectList: void = () => { |
| 33 | - getTableList({ pageNum: 1, pageSize: 1000,type:0 }) | 40 | + getTableList({ pageNum: 1, pageSize: 1000, type: 0 }) |
| 34 | .then((res) => { | 41 | .then((res) => { |
| 35 | data.options = res.data.data.list; | 42 | data.options = res.data.data.list; |
| 36 | }) | 43 | }) |
| @@ -39,8 +46,8 @@ const getSelectList: void = () => { | @@ -39,8 +46,8 @@ const getSelectList: void = () => { | ||
| 39 | }); | 46 | }); |
| 40 | }; | 47 | }; |
| 41 | onMounted(() => { | 48 | onMounted(() => { |
| 42 | - getSelectList() | ||
| 43 | -}) | 49 | + getSelectList(); |
| 50 | +}); | ||
| 44 | // 表单验证 | 51 | // 表单验证 |
| 45 | const rules = reactive({ | 52 | const rules = reactive({ |
| 46 | neighborhoodId: [ | 53 | neighborhoodId: [ |
| @@ -100,6 +107,12 @@ const emit = defineEmits<{ | @@ -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 | * @param {ElForm | undefined} formEl 表单对象 | 117 | * @param {ElForm | undefined} formEl 表单对象 |
| 105 | */ | 118 | */ |
| @@ -108,16 +121,16 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -108,16 +121,16 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 108 | if (!formEl) return; | 121 | if (!formEl) return; |
| 109 | formEl.validate((valid) => { | 122 | formEl.validate((valid) => { |
| 110 | if (valid) { | 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 | } else { | 132 | } else { |
| 117 | - ElMessage({ | ||
| 118 | - message: "请完善信息", | ||
| 119 | - type: "error", | ||
| 120 | - }); | 133 | + instance?.proxy?.$message.error("请完善信息"); //调用 |
| 121 | loading.value = false; | 134 | loading.value = false; |
| 122 | return false; | 135 | return false; |
| 123 | } | 136 | } |
| @@ -130,6 +143,10 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -130,6 +143,10 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 130 | const cancel: void = () => { | 143 | const cancel: void = () => { |
| 131 | emit("cancel"); | 144 | emit("cancel"); |
| 132 | }; | 145 | }; |
| 146 | + | ||
| 147 | +defineExpose({ | ||
| 148 | + resetForm, | ||
| 149 | +}); | ||
| 133 | </script> | 150 | </script> |
| 134 | 151 | ||
| 135 | <template> | 152 | <template> |
src/views/community/housekeeper/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, ref } from "vue"; | 2 | +import { reactive, onMounted, ref, getCurrentInstance } from "vue"; |
| 3 | import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts"; | 3 | import { getTableList, deleteBuilding } from "@/api/community/housekeeper.ts"; |
| 4 | import { parseTime } from "@/utils/tool.ts"; | 4 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | import HouseDetail from "./houseDetail.vue"; | 5 | import HouseDetail from "./houseDetail.vue"; |
| 6 | import Pagination from "@/components/Pagination/index.vue"; | 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 | const searchData = reactive({ | 14 | const searchData = reactive({ |
| 10 | neighborhoodId: null, | 15 | neighborhoodId: null, |
| @@ -45,19 +50,27 @@ const search = (): void => { | @@ -45,19 +50,27 @@ const search = (): void => { | ||
| 45 | * @param { Object } 列表对象 | 50 | * @param { Object } 列表对象 |
| 46 | */ | 51 | */ |
| 47 | const edit = (row: Object) => { | 52 | const edit = (row: Object) => { |
| 53 | + data.title = "编辑楼宇"; | ||
| 48 | data.formObj = row; | 54 | data.formObj = row; |
| 49 | data.dialogVisible = true; | 55 | data.dialogVisible = true; |
| 50 | - console.log(data.formObj); | ||
| 51 | }; | 56 | }; |
| 52 | /** | 57 | /** |
| 53 | * 删除 | 58 | * 删除 |
| 54 | * @param { number } buildingId 楼宇ID | 59 | * @param { number } buildingId 楼宇ID |
| 55 | */ | 60 | */ |
| 56 | const remove = (buildingId: number) => { | 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,9 +84,14 @@ const changeData: void = () => { | ||
| 71 | * 弹框关闭 | 84 | * 弹框关闭 |
| 72 | */ | 85 | */ |
| 73 | const dialogClose: void = () => { | 86 | const dialogClose: void = () => { |
| 87 | + data.title = "新增楼宇"; | ||
| 74 | data.formObj = {}; | 88 | data.formObj = {}; |
| 89 | + houseDetailRef.value.resetForm(); | ||
| 75 | }; | 90 | }; |
| 76 | onMounted(() => { | 91 | onMounted(() => { |
| 92 | + searchData.neighborhoodId = route.query.neighborhoodId | ||
| 93 | + ? route.query.neighborhoodId | ||
| 94 | + : null; | ||
| 77 | search(); | 95 | search(); |
| 78 | }); | 96 | }); |
| 79 | </script> | 97 | </script> |
| @@ -96,8 +114,8 @@ onMounted(() => { | @@ -96,8 +114,8 @@ onMounted(() => { | ||
| 96 | > | 114 | > |
| 97 | <el-row> | 115 | <el-row> |
| 98 | <el-form-item> | 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 | <el-button type="primary" @click="data.dialogVisible = true" | 119 | <el-button type="primary" @click="data.dialogVisible = true" |
| 102 | >新增</el-button | 120 | >新增</el-button |
| 103 | > | 121 | > |
| @@ -129,7 +147,14 @@ onMounted(() => { | @@ -129,7 +147,14 @@ onMounted(() => { | ||
| 129 | <el-table-column label="操作"> | 147 | <el-table-column label="操作"> |
| 130 | <template #default="scope"> | 148 | <template #default="scope"> |
| 131 | <el-button type="text" size="mini">更换楼管</el-button> | 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 | <el-button type="text" size="mini" @click="edit(scope.row)" | 158 | <el-button type="text" size="mini" @click="edit(scope.row)" |
| 134 | >编辑</el-button | 159 | >编辑</el-button |
| 135 | > | 160 | > |
| @@ -157,6 +182,7 @@ onMounted(() => { | @@ -157,6 +182,7 @@ onMounted(() => { | ||
| 157 | @close="dialogClose" | 182 | @close="dialogClose" |
| 158 | > | 183 | > |
| 159 | <HouseDetail | 184 | <HouseDetail |
| 185 | + ref="houseDetailRef" | ||
| 160 | @cancel="data.dialogVisible = false" | 186 | @cancel="data.dialogVisible = false" |
| 161 | @success="changeData" | 187 | @success="changeData" |
| 162 | :formObj="data.formObj" | 188 | :formObj="data.formObj" |
src/views/community/houses/detail.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, onMounted } from "vue"; | 2 | +import { reactive, onMounted } from "vue"; |
| 3 | import { getHouse } from "@/api/community/houses.ts"; | 3 | import { getHouse } from "@/api/community/houses.ts"; |
| 4 | 4 | ||
| 5 | // 声明props | 5 | // 声明props |
| @@ -9,7 +9,6 @@ const props = defineProps({ | @@ -9,7 +9,6 @@ const props = defineProps({ | ||
| 9 | default: {}, | 9 | default: {}, |
| 10 | }, | 10 | }, |
| 11 | }); | 11 | }); |
| 12 | -console.log(props.formObj); | ||
| 13 | </script> | 12 | </script> |
| 14 | 13 | ||
| 15 | <template> | 14 | <template> |
src/views/community/houses/index.vue
| 1 | <script setup lang="ts"> | 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 | import { parseTime } from "@/utils/tool.ts"; | 4 | import { parseTime } from "@/utils/tool.ts"; |
| 5 | import Detail from "./detail.vue"; | 5 | import Detail from "./detail.vue"; |
| 6 | import Pagination from "@/components/Pagination/index.vue"; | 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 | const searchData = reactive({ | 12 | const searchData = reactive({ |
| 10 | - buildingId: 1, | 13 | + buildingId: null, |
| 11 | type: 0, | 14 | type: 0, |
| 12 | roomNumber: null, | 15 | roomNumber: null, |
| 13 | pageNum: 1, | 16 | pageNum: 1, |
| @@ -47,7 +50,7 @@ const search = (): void => { | @@ -47,7 +50,7 @@ const search = (): void => { | ||
| 47 | const check = (houseId: number) => { | 50 | const check = (houseId: number) => { |
| 48 | getHouse({ houseId: houseId }).then((res) => { | 51 | getHouse({ houseId: houseId }).then((res) => { |
| 49 | data.formObj = res.data.data; | 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,13 +59,24 @@ const check = (houseId: number) => { | ||
| 56 | * @param { number } houseId 房屋ID | 59 | * @param { number } houseId 房屋ID |
| 57 | */ | 60 | */ |
| 58 | const remove = (houseId: number) => { | 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 | onMounted(() => { | 76 | onMounted(() => { |
| 77 | + searchData.buildingId = route.query.buildingId | ||
| 78 | + ? route.query.buildingId | ||
| 79 | + : null; | ||
| 66 | search(); | 80 | search(); |
| 67 | }); | 81 | }); |
| 68 | </script> | 82 | </script> |
| @@ -99,7 +113,7 @@ onMounted(() => { | @@ -99,7 +113,7 @@ onMounted(() => { | ||
| 99 | > | 113 | > |
| 100 | </el-table-column> | 114 | </el-table-column> |
| 101 | <el-table-column label="楼宇名称" prop="buildingName"> | 115 | <el-table-column label="楼宇名称" prop="buildingName"> |
| 102 | - <template #default="scope"> | 116 | + <template #default="scope"> |
| 103 | <span>{{ scope.row.building.buildingName }}</span></template | 117 | <span>{{ scope.row.building.buildingName }}</span></template |
| 104 | > | 118 | > |
| 105 | </el-table-column> | 119 | </el-table-column> |
| @@ -109,10 +123,13 @@ onMounted(() => { | @@ -109,10 +123,13 @@ onMounted(() => { | ||
| 109 | <el-table-column label="使用面积" prop="useArea"></el-table-column> | 123 | <el-table-column label="使用面积" prop="useArea"></el-table-column> |
| 110 | <el-table-column label="操作" width="350px"> | 124 | <el-table-column label="操作" width="350px"> |
| 111 | <template #default="scope"> | 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 | <el-button type="text" size="mini">查看业主</el-button> | 132 | <el-button type="text" size="mini">查看业主</el-button> |
| 115 | - <el-button type="text" size="mini" @click="check(scope.row.id)">查看房屋</el-button> | ||
| 116 | <!-- <el-button type="text" size="mini" @click="edit(scope.row)" | 133 | <!-- <el-button type="text" size="mini" @click="edit(scope.row)" |
| 117 | >编辑</el-button | 134 | >编辑</el-button |
| 118 | > --> | 135 | > --> |
| @@ -139,9 +156,7 @@ onMounted(() => { | @@ -139,9 +156,7 @@ onMounted(() => { | ||
| 139 | width="40%" | 156 | width="40%" |
| 140 | @close="data.dialogClose" | 157 | @close="data.dialogClose" |
| 141 | > | 158 | > |
| 142 | - <Detail | ||
| 143 | - :formObj="data.formObj" | ||
| 144 | - ></Detail> | 159 | + <Detail :formObj="data.formObj"></Detail> |
| 145 | </el-dialog> | 160 | </el-dialog> |
| 146 | </div> | 161 | </div> |
| 147 | </template> | 162 | </template> |
src/views/community/residence/communityDetail.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, ref, watch, onMounted } from "vue"; | 2 | +import { reactive, ref, onMounted,getCurrentInstance } from "vue"; |
| 3 | import type { ElForm } from "element-plus"; | 3 | import type { ElForm } from "element-plus"; |
| 4 | -import { ElMessage } from "element-plus"; | ||
| 5 | import { addOrUpdate } from "@/api/community/residence.ts"; | 4 | import { addOrUpdate } from "@/api/community/residence.ts"; |
| 5 | + | ||
| 6 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); | 6 | const ruleFormRef = ref<InstanceType<typeof ElForm>>(); |
| 7 | +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例 | ||
| 7 | // 声明props | 8 | // 声明props |
| 8 | const props = defineProps({ | 9 | const props = defineProps({ |
| 9 | formObj: { | 10 | formObj: { |
| @@ -81,16 +82,12 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | @@ -81,16 +82,12 @@ let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => { | ||
| 81 | if (!formEl) return; | 82 | if (!formEl) return; |
| 82 | formEl.validate((valid) => { | 83 | formEl.validate((valid) => { |
| 83 | if (valid) { | 84 | if (valid) { |
| 84 | - console.log("111") | ||
| 85 | addOrUpdate(props.formObj).then((res) => { | 85 | addOrUpdate(props.formObj).then((res) => { |
| 86 | - console.log(res); | ||
| 87 | - emit("success"); | 86 | + loading.value = false; |
| 87 | + emit("success"); | ||
| 88 | }); | 88 | }); |
| 89 | } else { | 89 | } else { |
| 90 | - ElMessage({ | ||
| 91 | - message: "请完善信息", | ||
| 92 | - type: "error", | ||
| 93 | - }); | 90 | + instance?.proxy?.$message.error('请完善信息')//调用 |
| 94 | loading.value = false; | 91 | loading.value = false; |
| 95 | return false; | 92 | return false; |
| 96 | } | 93 | } |
src/views/community/residence/index.vue
| 1 | <script setup lang="ts"> | 1 | <script setup lang="ts"> |
| 2 | -import { reactive, onMounted, ref } from "vue"; | 2 | +import { reactive, onMounted, getCurrentInstance } from "vue"; |
| 3 | import { getTableList, deleteNeighborhood } from "@/api/community/residence.ts"; | 3 | import { getTableList, deleteNeighborhood } from "@/api/community/residence.ts"; |
| 4 | import CommunityDetail from "./communityDetail.vue"; | 4 | import CommunityDetail from "./communityDetail.vue"; |
| 5 | import Pagination from "@/components/Pagination/index.vue"; | 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 | const searchData = reactive({ | 9 | const searchData = reactive({ |
| 9 | - propertyId: 1, | ||
| 10 | type: 0, | 10 | type: 0, |
| 11 | name: null, | 11 | name: null, |
| 12 | pageNum: 1, | 12 | pageNum: 1, |
| @@ -44,19 +44,27 @@ const search = (): void => { | @@ -44,19 +44,27 @@ const search = (): void => { | ||
| 44 | * @param { Object } 列表对象 | 44 | * @param { Object } 列表对象 |
| 45 | */ | 45 | */ |
| 46 | const edit = (row: Object) => { | 46 | const edit = (row: Object) => { |
| 47 | + data.title = "编辑小区"; | ||
| 47 | data.formObj = row; | 48 | data.formObj = row; |
| 48 | data.dialogVisible = true; | 49 | data.dialogVisible = true; |
| 49 | - console.log(data.formObj); | ||
| 50 | }; | 50 | }; |
| 51 | /** | 51 | /** |
| 52 | * 删除 | 52 | * 删除 |
| 53 | * @param { number } neighborhoodId 小区ID | 53 | * @param { number } neighborhoodId 小区ID |
| 54 | */ | 54 | */ |
| 55 | const remove = (neighborhoodId: number) => { | 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,6 +78,7 @@ const changeData: void = () => { | ||
| 70 | * 弹框关闭 | 78 | * 弹框关闭 |
| 71 | */ | 79 | */ |
| 72 | const dialogClose: void = () => { | 80 | const dialogClose: void = () => { |
| 81 | + data.title = "新增小区"; | ||
| 73 | data.formObj = {}; | 82 | data.formObj = {}; |
| 74 | }; | 83 | }; |
| 75 | onMounted(() => { | 84 | onMounted(() => { |
| @@ -82,7 +91,7 @@ onMounted(() => { | @@ -82,7 +91,7 @@ onMounted(() => { | ||
| 82 | <el-form :inline="true" :model="searchData" v-loading="data.loading"> | 91 | <el-form :inline="true" :model="searchData" v-loading="data.loading"> |
| 83 | <el-form-item> | 92 | <el-form-item> |
| 84 | <el-input | 93 | <el-input |
| 85 | - placeholder="请输入社区名称" | 94 | + placeholder="输入小区名称" |
| 86 | v-model="searchData.name" | 95 | v-model="searchData.name" |
| 87 | clearable | 96 | clearable |
| 88 | ></el-input> | 97 | ></el-input> |
| @@ -94,8 +103,8 @@ onMounted(() => { | @@ -94,8 +103,8 @@ onMounted(() => { | ||
| 94 | > | 103 | > |
| 95 | <el-row> | 104 | <el-row> |
| 96 | <el-form-item> | 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 | <el-button type="primary" @click="data.dialogVisible = true" | 108 | <el-button type="primary" @click="data.dialogVisible = true" |
| 100 | >新增</el-button | 109 | >新增</el-button |
| 101 | > | 110 | > |
| @@ -119,7 +128,14 @@ onMounted(() => { | @@ -119,7 +128,14 @@ onMounted(() => { | ||
| 119 | <el-button type="text" size="mini" @click="remove(scope.row.id)" | 128 | <el-button type="text" size="mini" @click="remove(scope.row.id)" |
| 120 | >删除</el-button | 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 | </template> | 139 | </template> |
| 124 | </el-table-column> | 140 | </el-table-column> |
| 125 | </el-table> | 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> |