Commit a76c38ed450e6d85e1efb9b84c29ef7dccd485c0

Authored by 杨泽宇
2 parents 91d54a81 56b72204
src/api/housekeeper/buildinMganager.ts 0 → 100644
  1 +import request from '../request'
  2 +
  3 +// 查询列表
  4 +export function getTableList(params:any) {
  5 + return request({
  6 + method: 'get',
  7 + url: '/housekeeper/housekeeperList',
  8 + params: params
  9 + })
  10 +}
  11 +// 根据条件查询列表
  12 +export function residentListByCondition(params:any) {
  13 + return request({
  14 + method: 'get',
  15 + url: '/resident/residentListByCondition',
  16 + params: params
  17 + })
  18 +}
  19 +
  20 +// 房屋信息
  21 +export function getHouse(params:any) {
  22 + return request({
  23 + method: 'post',
  24 + url: '/house/getHouse',
  25 + params: params
  26 + })
  27 +}
  28 +// 删除
  29 +export function deleteResident(params:any) {
  30 + return request({
  31 + method: 'delete',
  32 + url: '/resident/deleteResident',
  33 + params: params
  34 + })
  35 +}
  36 +// 删除
  37 +export function changeBinding(params:any) {
  38 + return request({
  39 + method: 'PUT',
  40 + url: '/resident/changeBinding',
  41 + params: params
  42 + })
  43 +}
  44 +// 获取详情
  45 +export function getResidentById(params:any) {
  46 + return request({
  47 + method: 'get',
  48 + url: '/resident/getResidentById',
  49 + params: params
  50 + })
  51 +}
  52 +// 修改
  53 +export function update(params:any) {
  54 + return request({
  55 + method: 'post',
  56 + url: '/resident/update',
  57 + data: params
  58 + })
  59 +}
src/router/index.ts
@@ -6,6 +6,7 @@ import User from "./modules/user" @@ -6,6 +6,7 @@ import User from "./modules/user"
6 import Property from "./modules/property" 6 import Property from "./modules/property"
7 import Community from "./modules/community" 7 import Community from "./modules/community"
8 import OwnerManagement from "./modules/ownerManagement" 8 import OwnerManagement from "./modules/ownerManagement"
  9 +import Housekeeper from "./modules/housekeeper"
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' } },
@@ -27,6 +28,7 @@ const routes: Array&lt;any&gt; = [ @@ -27,6 +28,7 @@ const routes: Array&lt;any&gt; = [
27 Property, 28 Property,
28 Community, 29 Community,
29 OwnerManagement, 30 OwnerManagement,
  31 + Housekeeper,
30 { 32 {
31 path: '/login', 33 path: '/login',
32 name: 'Login', 34 name: 'Login',
src/router/modules/housekeeper.ts 0 → 100644
  1 +
  2 +import Layout from '@/layout/enter.vue'
  3 +const housekeeper = {
  4 + path: '/',
  5 + component: Layout,
  6 + name: 'buildinMganager',
  7 + children: [{
  8 + path: 'buildinMganager',
  9 + name: 'buildinMganager',
  10 + component: () => import('@/views/housekeeper/buildinMganager/index.vue'),
  11 + meta: { title: '楼管管家' }
  12 + }
  13 + ]
  14 +}
  15 +
  16 +export default housekeeper
src/views/community/housekeeper/index.vue
@@ -139,8 +139,12 @@ onMounted(() =&gt; { @@ -139,8 +139,12 @@ onMounted(() =&gt; {
139 <el-table-column label="使用面积" prop="employArea"></el-table-column> 139 <el-table-column label="使用面积" prop="employArea"></el-table-column>
140 <el-table-column 140 <el-table-column
141 label="楼管姓名" 141 label="楼管姓名"
142 - prop="buildingManager"  
143 - ></el-table-column> 142 +
  143 + >
  144 + <template #default="scope">
  145 + <span>{{ scope.row.housekeeper?.name }}</span>
  146 + </template>
  147 + </el-table-column>
144 <el-table-column label="操作"> 148 <el-table-column label="操作">
145 <template #default="scope"> 149 <template #default="scope">
146 <el-button type="text" size="mini">更换楼管</el-button> 150 <el-button type="text" size="mini">更换楼管</el-button>
src/views/dashboard/index.vue
@@ -3,11 +3,11 @@ import {ref} from &#39;vue&#39; @@ -3,11 +3,11 @@ import {ref} from &#39;vue&#39;
3 import {propertyList } from '@/api/property' 3 import {propertyList } from '@/api/property'
4 import router from '@/router' 4 import router from '@/router'
5 const title = ref(import.meta.env.VITE_APP_TITLE).value 5 const title = ref(import.meta.env.VITE_APP_TITLE).value
6 -propertyList().then(res => {  
7 - console.log(res)  
8 -}).catch(error => {  
9 - console.log(error)  
10 -}) 6 +// propertyList().then(res => {
  7 +// console.log(res)
  8 +// }).catch(error => {
  9 +// console.log(error)
  10 +// })
11 console.log(router.getRoutes()) 11 console.log(router.getRoutes())
12 </script> 12 </script>
13 13
src/views/housekeeper/buildinMganager/detail.vue 0 → 100644
  1 +<script setup lang="ts">
  2 +import { reactive, ref, onMounted,getCurrentInstance } from "vue";
  3 +import type { ElForm } from "element-plus";
  4 +import { addOrUpdate } from "@/api/community/residence.ts";
  5 +
  6 +const ruleFormRef = ref<InstanceType<typeof ElForm>>();
  7 +let instance: ComponentInternalInstance | null = getCurrentInstance();//获取app实例
  8 +// 声明props
  9 +const props = defineProps({
  10 + formObj: {
  11 + type: Object,
  12 + default: {
  13 + name: null,
  14 + address: null,
  15 + locality: null,
  16 + buildingCount: null,
  17 + storeroomCount: null,
  18 + truckSpaceCount: null,
  19 + },
  20 + },
  21 +});
  22 +
  23 +let loading = ref(false);
  24 +
  25 +// 表单验证
  26 +const rules = reactive({
  27 + name: [
  28 + {
  29 + required: true,
  30 + message: "请输入小区名",
  31 + trigger: "blur",
  32 + },
  33 + ],
  34 + locality: [
  35 + {
  36 + required: true,
  37 + message: "请输入所在地区",
  38 + trigger: "blur",
  39 + },
  40 + ],
  41 + address: [
  42 + {
  43 + required: true,
  44 + message: "请输入地址",
  45 + trigger: "blur",
  46 + },
  47 + ],
  48 + buildingCount: [
  49 + {
  50 + required: true,
  51 + message: "请输入楼座数",
  52 + trigger: "blur",
  53 + },
  54 + ],
  55 + storeroomCount: [
  56 + {
  57 + required: true,
  58 + message: "请输入储藏室数",
  59 + trigger: "blur",
  60 + },
  61 + ],
  62 + truckSpaceCount: [
  63 + {
  64 + required: true,
  65 + message: "请输入车位数",
  66 + trigger: "blur",
  67 + },
  68 + ],
  69 +});
  70 +
  71 +const emit = defineEmits<{
  72 + (e: "cancel"): void;
  73 + (e: "success"): void;
  74 +}>();
  75 +
  76 +/**
  77 + * 表单提交
  78 + * @param {ElForm | undefined} formEl 表单对象
  79 + */
  80 +let submitForm = (formEl: InstanceType<typeof ElForm> | undefined) => {
  81 + loading.value = true;
  82 + if (!formEl) return;
  83 + formEl.validate((valid) => {
  84 + if (valid) {
  85 + addOrUpdate(props.formObj).then((res) => {
  86 + loading.value = false;
  87 + emit("success");
  88 + });
  89 + } else {
  90 + instance?.proxy?.$message.error('请完善信息')//调用
  91 + loading.value = false;
  92 + return false;
  93 + }
  94 + });
  95 +};
  96 +
  97 +/**
  98 + * 取消提交
  99 + */
  100 +const cancel: void = () => {
  101 + emit("cancel");
  102 +};
  103 +</script>
  104 +
  105 +<template>
  106 + <el-form ref="ruleFormRef" :model="props.formObj" :rules="rules" label-width="100px">
  107 + <el-form-item label="小区名称:" prop="name">
  108 + <el-input v-model="props.formObj.name" placeholder="请输入名称"></el-input>
  109 + </el-form-item>
  110 + <el-form-item label="所在地区:" prop="locality">
  111 + <el-input v-model="props.formObj.locality" placeholder="请输入所在地区"></el-input>
  112 + </el-form-item>
  113 + <el-form-item label="详细地址:" prop="address">
  114 + <el-input v-model="props.formObj.address" placeholder="请输入详细地址"></el-input>
  115 + </el-form-item>
  116 + <el-form-item label="楼座数:" prop="buildingCount">
  117 + <el-input v-model="props.formObj.buildingCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入楼座数"></el-input>
  118 + </el-form-item>
  119 + <el-form-item label="储藏室数:" prop="storeroomCount">
  120 + <el-input v-model="props.formObj.storeroomCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入储藏室数"></el-input>
  121 + </el-form-item>
  122 + <el-form-item label="车位数:" prop="truckSpaceCount">
  123 + <el-input v-model="props.formObj.truckSpaceCount" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入车位数"></el-input>
  124 + </el-form-item>
  125 + <el-form-item>
  126 + <el-button
  127 + type="primary"
  128 + @click="submitForm(ruleFormRef)"
  129 + :loading="loading"
  130 + >保存</el-button
  131 + >
  132 + <el-button @click="cancel">取消</el-button>
  133 + </el-form-item>
  134 + </el-form>
  135 +</template>
src/views/housekeeper/buildinMganager/index.vue 0 → 100644
  1 +<script setup lang="ts">
  2 +import { reactive, onMounted, getCurrentInstance } from "vue";
  3 +import { getTableList } from "@/api/housekeeper/buildinMganager.ts";
  4 +import Detail from "./detail.vue";
  5 +import Pagination from "@/components/Pagination/index.vue";
  6 +
  7 +let instance: ComponentInternalInstance | null = getCurrentInstance(); //获取app实例
  8 +// 数据筛选
  9 +const searchData = reactive({
  10 + type: "",
  11 + condition: "",
  12 + page: 1,
  13 + pageSize: 10,
  14 +});
  15 +// 展示
  16 +const data = reactive({
  17 + total: 0,
  18 + tableList: [],
  19 + dialogVisible: false,
  20 + loading: false,
  21 + title: "新增楼管",
  22 + formObj: {},
  23 + options: [
  24 + { label: "选举", value: 0 },
  25 + { label: "派驻", value: 1 },
  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;
  37 + data.total = res.data.data.total;
  38 + data.loading = false;
  39 + })
  40 + .catch((err) => {
  41 + console.log(err);
  42 + data.loading = false;
  43 + });
  44 +};
  45 +/**
  46 + * 编辑
  47 + * @param { Object } 列表对象
  48 + */
  49 +const edit = (row: Object) => {
  50 + data.title = "编辑楼管";
  51 + data.formObj = row;
  52 + data.dialogVisible = true;
  53 +};
  54 +/**
  55 + * 删除
  56 + * @param { number } neighborhoodId 小区ID
  57 + */
  58 +const remove = (neighborhoodId: number) => {
  59 + instance?.proxy?.$messageBox
  60 + .confirm("确认要进行此操作?", "提示", {
  61 + confirmButtonText: "确定",
  62 + cancelButtonText: "取消",
  63 + })
  64 + .then(() => {
  65 + deleteNeighborhood({ neighborhoodId: neighborhoodId }).then((res) => {
  66 + instance?.proxy?.$message.success("操作成功"); //调用
  67 + search();
  68 + });
  69 + })
  70 + .catch((err) => {});
  71 +};
  72 +/**
  73 + * 组件操作成功回调
  74 + */
  75 +const changeData: void = () => {
  76 + data.dialogVisible = false;
  77 + search();
  78 +};
  79 +
  80 +/**
  81 + * 弹框关闭
  82 + */
  83 +const dialogClose: void = () => {
  84 + data.title = "新增小区";
  85 + data.formObj = {};
  86 +};
  87 +onMounted(() => {
  88 + search();
  89 +});
  90 +</script>
  91 +<template>
  92 + <div class="app-container">
  93 + <!-- 搜索 -->
  94 + <el-form :inline="true" :model="searchData" v-loading="data.loading">
  95 + <el-form-item>
  96 + <el-select v-model="searchData.type" placeholder="请选择类型" clearable>
  97 + <el-option
  98 + v-for="item in data.options"
  99 + :key="item.value"
  100 + :label="item.label"
  101 + :value="item.value"
  102 + >
  103 + </el-option>
  104 + </el-select>
  105 + </el-form-item>
  106 + <el-form-item>
  107 + <el-input
  108 + placeholder="请输入姓名/手机号/身份证号"
  109 + v-model="searchData.condition"
  110 + clearable
  111 + ></el-input>
  112 + </el-form-item>
  113 + <el-form-item
  114 + ><el-button type="primary" @click="search"
  115 + >查询</el-button
  116 + ></el-form-item
  117 + >
  118 + <el-row>
  119 + <el-form-item>
  120 + <!-- <el-button type="primary">导入</el-button>
  121 + <el-button type="primary">导出</el-button> -->
  122 + <el-button type="primary" @click="data.dialogVisible = true"
  123 + >新增</el-button
  124 + >
  125 + </el-form-item>
  126 + </el-row>
  127 + </el-form>
  128 +
  129 + <!-- 表格 -->
  130 + <el-table border :data="data.tableList">
  131 + <el-table-column label="姓名" prop="name"></el-table-column>
  132 + <el-table-column label="手机号" prop="mobile"></el-table-column>
  133 + <el-table-column label="身份证号" prop="idcard"></el-table-column>
  134 + <el-table-column label="类型">
  135 + <template #default="scope">
  136 + <span>{{ scope.row.type == 0 ? "选举" : "派驻" }}</span></template
  137 + >
  138 + </el-table-column>
  139 + <el-table-column label="操作">
  140 + <template #default="scope">
  141 + <el-button type="text" size="mini" @click="edit(scope.row)"
  142 + >编辑</el-button
  143 + >
  144 + <el-button type="text" size="mini" @click="remove(scope.row.id)"
  145 + >删除</el-button
  146 + >
  147 + </template>
  148 + </el-table-column>
  149 + </el-table>
  150 +
  151 + <!-- 分页 -->
  152 + <Pagination
  153 + v-if="data.total > 0"
  154 + :total="data.total"
  155 + :currentPage="searchData.pageNum"
  156 + :pageSize="searchData.pageSize"
  157 + @pageChange="search"
  158 + ></Pagination>
  159 +
  160 + <!-- 详情弹框 -->
  161 + <el-dialog
  162 + v-model="data.dialogVisible"
  163 + :title="data.title"
  164 + width="30%"
  165 + @close="dialogClose"
  166 + >
  167 + <Detail
  168 + @cancel="data.dialogVisible = false"
  169 + @success="changeData"
  170 + :formObj="data.formObj"
  171 + ></Detail>
  172 + </el-dialog>
  173 + </div>
  174 +</template>
  175 +
  176 +<style></style>