后台管理页面集成

master
许宏杰 6 months ago
parent 92ab617a9f
commit 5420136712

@ -1,136 +1,142 @@
import request from '@/utils/request'
import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";
// 查询用户列表
export function listUser(query) {
return request({
url: '/system/user/list',
method: 'get',
params: query
})
url: "/system/user/list",
method: "get",
params: query,
});
}
// 查询用户详细
export function getUser(userId) {
return request({
url: '/system/user/' + parseStrEmpty(userId),
method: 'get'
})
url: "/system/user/" + parseStrEmpty(userId),
method: "get",
});
}
// 新增用户
export function addUser(data) {
return request({
url: '/system/user',
method: 'post',
data: data
})
url: "/system/user",
method: "post",
data: data,
});
}
// 修改用户
export function updateUser(data) {
return request({
url: '/system/user',
method: 'put',
data: data
})
url: "/system/user",
method: "put",
data: data,
});
}
// 删除用户
export function delUser(userId) {
return request({
url: '/system/user/' + userId,
method: 'delete'
})
url: "/system/user/" + userId,
method: "delete",
});
}
// 用户密码重置
export function resetUserPwd(userId, password) {
const data = {
userId,
password
}
password,
};
return request({
url: '/system/user/resetPwd',
method: 'put',
data: data
})
url: "/system/user/resetPwd",
method: "put",
data: data,
});
}
// 用户状态修改
export function changeUserStatus(userId, status) {
const data = {
userId,
status
}
status,
};
return request({
url: '/system/user/changeStatus',
method: 'put',
data: data
})
url: "/system/user/changeStatus",
method: "put",
data: data,
});
}
// 查询用户个人信息
export function getUserProfile() {
return request({
url: '/system/user/profile',
method: 'get'
})
url: "/system/user/profile",
method: "get",
});
}
// 修改用户个人信息
export function updateUserProfile(data) {
return request({
url: '/system/user/profile',
method: 'put',
data: data
})
url: "/system/user/profile",
method: "put",
data: data,
});
}
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
newPassword
}
newPassword,
};
return request({
url: '/system/user/profile/updatePwd',
method: 'put',
params: data
})
url: "/system/user/profile/updatePwd",
method: "put",
params: data,
});
}
// 用户头像上传
export function uploadAvatar(data) {
return request({
url: '/system/user/profile/avatar',
method: 'post',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: data
})
url: "/system/user/profile/avatar",
method: "post",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
data: data,
});
}
// 查询授权角色
export function getAuthRole(userId) {
return request({
url: '/system/user/authRole/' + userId,
method: 'get'
})
url: "/system/user/authRole/" + userId,
method: "get",
});
}
// 保存授权角色
export function updateAuthRole(data) {
return request({
url: '/system/user/authRole',
method: 'put',
params: data
})
url: "/system/user/authRole",
method: "put",
params: data,
});
}
// 查询部门下拉树结构
// export function deptTreeSelect() {
// return request({
// url: '/system/user/deptTree',
// method: 'get'
// })
// }
export function deptTreeSelect() {
return request({
url: '/system/user/deptTree',
method: 'get'
})
url: "/system/dept/treeselect",
method: "get",
});
}

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve">
<path d="M37.9,29.1v-2.2h-2.8c-0.1-0.6-0.4-1.2-0.7-1.7l2.1-2.1l-1.6-1.6l-2.1,2.1c-0.5-0.4-1.1-0.6-1.7-0.7v-2.8h-2.2v2.8
c-0.6,0.1-1.1,0.4-1.6,0.7l-2.2-2.1L23.3,23l2.2,2.2c-0.2,0.5-0.5,1.1-0.6,1.6h-3v2.2h3c0.1,0.6,0.4,1.1,0.7,1.6l-2.2,2.2l1.6,1.6
l2.2-2.2c0.5,0.4,1,0.6,1.6,0.7v3h2.2v-3c0.6-0.1,1.1-0.4,1.6-0.6l2.2,2.2l1.6-1.6l-2.1-2.1c0.4-0.5,0.6-1.1,0.7-1.6h2.7V29.1z
M30,30.8c-1.6,0-3-1.4-3-3c0-1.6,1.4-3,3-3c1.6,0,3,1.4,3,3S31.6,30.8,30,30.8z"/>
<path d="M22.1,33.3h-1.6V16h11v2.3c0.7,0.1,1.9,0.1,2.6,0.4v-4.3c0-0.6-0.5-1.1-1.1-1.1H20.6V5.1c0-0.6-0.5-1.1-1.1-1.1H5.8
C5.1,4,4.6,4.5,4.6,5.1V33h-1c-1,0-1.5,0.5-1.5,1.5S2.6,36,3.6,36h20.8C23.2,34.9,23,34.6,22.1,33.3z M17,27.7
c0,0.9-0.6,1.5-1.5,1.5H9.6c-0.9,0-1.5-0.6-1.5-1.5s0.6-1.5,1.5-1.5h5.9C16.4,26.2,17,27,17,27.7z M15.6,21.2H9.6
c-0.9,0-1.5-0.6-1.5-1.5c0-0.9,0.6-1.5,1.5-1.5h5.9c0.9,0,1.5,0.6,1.5,1.5C17,20.6,16.4,21.2,15.6,21.2z M15.6,13.1H9.6
c-0.9,0-1.5-0.6-1.5-1.5c0-0.9,0.6-1.5,1.5-1.5h5.9c0.9,0,1.5,0.6,1.5,1.5C17,12.5,16.4,13.1,15.6,13.1z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 40 40" style="enable-background:new 0 0 40 40;" xml:space="preserve">
<path d="M20,4c0.5,0,0.9,0.2,1.1,0.5l8.9,8.2l7.8,6.6c0.5,0.5,0.5,0.9,0.2,1.4c-0.2,0.5-0.7,0.9-1.1,0.9h-5.2V36H8V21.6H3.2
c-0.7,0-1.1-0.2-1.4-0.9c0-0.5,0-0.9,0.5-1.4L18.9,4.5C19.1,4.3,19.6,4,20,4z M22.5,26.6c0,0-1.8,2.3-2.7,2.3
c-0.7,0-2.7-2.3-2.7-2.3s-2.7,0.5-3.9,1.4c-0.9,0.7-1.4,5-1.4,5h16c0,0-0.2-4.1-1.4-5C25.3,27.1,22.5,26.6,22.5,26.6z M19.8,16.1
c-1.1,0-2.1,0.5-2.7,1.1c-0.9,0.9-1.1,1.8-1.1,3c0,2.3,1.8,4.1,4.1,4.1s4.1-1.8,4.1-4.1c0-1.1-0.5-2.1-1.1-3
C21.9,16.6,21,16.1,19.8,16.1z"/>
</svg>

After

Width:  |  Height:  |  Size: 847 B

@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1648098799488" class="icon" viewBox="0 0 1048 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3911" xmlns:xlink="http://www.w3.org/1999/xlink" width="131" height="128"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M334.571747 570.128513a14.452891 14.452891 0 0 0 14.452891 14.70645h125.638727c7.987124 0 14.452891-6.592547 14.452891-14.83323V528.671536c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638727c-7.987124 0-14.452891 6.592547-14.452891 14.706451v41.583756zM474.663365 233.78185c7.987124 0 14.452891-6.592547 14.452891-14.83323V177.491643c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638727c-7.987124 0-14.452891 6.592547-14.452891 14.70645v41.456977a14.452891 14.452891 0 0 0 14.452891 14.70645h125.638727z" p-id="3912"></path><path d="M464.013867 985.966077c0-22.440015 2.535595-44.372911 6.972886-65.798688h-107.382444v-100.155999h-112.453634v100.155999H87.731584c-9.381701 0-16.734926-7.480005-16.734927-16.861706V87.985143c0-4.437291 1.648137-8.874582 4.81763-12.044076s7.480005-4.94441 11.917297-4.94441h439.291816c4.437291 0 8.747802 1.774916 11.917296 4.94441s4.94441 7.606785 4.81763 11.917296v347.376501a101.246304 101.246304 0 0 1 68.080723-26.243407c1.014238 0 1.901696 0 2.915934 0.12678v-50.711898a16.89974 16.89974 0 0 1 16.734927-16.861706h272.069332c4.437291 0 8.747802 1.774916 11.790517 4.94441 3.169494 3.169494 4.94441 7.480005 4.94441 11.917296v49.063761c27.891544 17.749164 52.106475 40.696298 70.996657 67.827164V305.919525c0-19.524081-15.847468-35.371549-35.244769-35.371549H614.628204V35.498329A35.498329 35.498329 0 0 0 579.256655 0H35.371549A35.574396 35.574396 0 0 0 0 35.498329v920.167388a35.498329 35.498329 0 0 0 35.371549 35.498329h428.895877c-0.12678-1.774916-0.253559-3.549833-0.253559-5.197969z" p-id="3913"></path><path d="M334.571747 394.665346a14.452891 14.452891 0 0 0 14.452891 14.70645h125.638727c7.987124 0 14.452891-6.592547 14.452891-14.83323v-41.456976c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638727c-7.987124 0-14.452891 6.592547-14.452891 14.70645v41.710536zM334.571747 745.71846c0 3.930172 1.521357 7.606785 4.183732 10.395939 2.662375 2.789154 6.465767 4.310511 10.269159 4.310511h125.638727c7.987124 0 14.452891-6.592547 14.452891-14.83323v-41.456977c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638727c-7.987124 0-14.452891 6.592547-14.452891 14.706451v41.710536zM280.056457 353.208369c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638728c-7.987124 0-14.452891 6.592547-14.45289 14.706451v41.456976c0 3.803392 1.521357 7.606785 4.183731 10.395939 2.662375 2.789154 6.465767 4.310511 10.269159 4.310512h125.638728c7.987124 0 14.452891-6.592547 14.452891-14.83323v-41.203418zM280.056457 528.671536c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638728c-7.987124 0-14.452891 6.592547-14.45289 14.706451v41.456976c0 3.803392 1.521357 7.606785 4.183731 10.395939 2.662375 2.789154 6.465767 4.310511 10.269159 4.310512h125.638728c7.987124 0 14.452891-6.592547 14.452891-14.83323V528.671536zM280.056457 177.618423c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638728c-7.987124 0-14.452891 6.592547-14.45289 14.83323v41.456976c0 3.803392 1.521357 7.606785 4.183731 10.395939 2.789154 2.789154 6.338987 4.310511 10.269159 4.310512h125.638728c7.987124 0 14.452891-6.592547 14.452891-14.83323v-41.330197zM139.964838 689.428253c-7.987124 0-14.452891 6.592547-14.45289 14.70645v41.456977c0 3.803392 1.521357 7.606785 4.183731 10.395939 2.662375 2.789154 6.465767 4.310511 10.269159 4.310511h125.638728c7.987124 0 14.452891-6.592547 14.452891-14.83323v-41.456976c0-8.240683-6.338987-14.83323-14.452891-14.83323h-125.638728z" p-id="3914"></path><path d="M787.682555 432.065371c-38.921382 0-75.180389 12.170856-104.973628 32.835954 0 0-0.12678 0-0.12678 0.126779-16.861706 10.522719-46.781726 8.621023-68.714622 7.353226-20.918658-1.141018-39.048161 14.70645-40.315959 35.625108a38.109991 38.109991 0 0 0 35.625109 40.315959l6.846106 0.380339c-8.367463 21.172217-13.185093 44.119351-13.185094 68.207503 0 55.402749 24.595271 104.973629 63.389873 138.9506-82.406834 43.612232-138.823821 130.329578-138.823821 230.105238 0 21.045438 16.988486 38.033923 38.033923 38.033923s38.033923-16.988486 38.033924-38.033923c0-101.550576 82.660394-184.210969 184.337749-184.21097 101.930915 0 184.718088-82.913953 184.718089-184.718088s-82.913953-184.971648-184.844869-184.971648z m0 293.495109c-59.966819 0-108.650241-48.810202-108.650241-108.650241s48.810202-108.650241 108.650241-108.650241 108.650241 48.810202 108.650242 108.650241-48.683422 108.650241-108.650242 108.650241zM987.867773 819.377492a38.148025 38.148025 0 0 0-53.627832-4.94441 38.148025 38.148025 0 0 0-4.94441 53.627832c27.511205 32.962734 42.597994 74.80005 42.597994 117.905163 0 21.045438 16.988486 38.033923 38.033923 38.033923s38.033923-16.988486 38.033924-38.033923c0.12678-60.854278-21.298997-119.933639-60.093599-166.588585z" p-id="3915"></path></svg>

After

Width:  |  Height:  |  Size: 5.3 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1730273791795" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5295" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M184.204 412.113L702.999 930.91H186.205a93.09 93.09 0 0 1-93.09-93.09l-0.024-334.593 91.113-91.113zM568.669 93.091a253.324 253.324 0 0 0-79.918 184.855c0 67.63 26.46 129.07 69.725 174.662l5.283 5.4L728.25 621.614c8.378 8.331 21.644 8.96 30.79 1.908l2.188-1.908 164.491-163.678a225.687 225.687 0 0 0 5.213-5.329v385.21a93.09 93.09 0 0 1-93.09 93.091h-36.073l-568.18-568.18L503.225 93.09h65.466z m176.082 0c102.772 0 186.181 87.668 186.181 195.863 0 54.11-20.829 103.052-54.574 138.496L756.736 553.356a16.407 16.407 0 0 1-23.97 0L613.12 427.496c-33.745-35.444-54.575-84.386-54.575-138.495 0-108.195 83.41-195.91 186.182-195.91z m-340.271 0L93.09 404.457V186.182a93.09 93.09 0 0 1 93.092-93.091H404.48z m340.247 93.09a93.09 93.09 0 1 0 0 186.183 93.09 93.09 0 0 0 0-186.182z" p-id="5296" ></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

@ -1,13 +1,22 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb
id="breadcrumb-container"
class="breadcrumb-container"
v-if="!topNav"
/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav" />
<div class="right-menu">
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<template v-if="device !== 'mobile'">
<!-- <search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
@ -21,22 +30,24 @@
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</el-tooltip> -->
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<img :src="avatar" class="user-avatar" />
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<!-- <el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
</el-dropdown-item> -->
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
@ -47,15 +58,15 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb";
import TopNav from "@/components/TopNav";
import Hamburger from "@/components/Hamburger";
import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import RuoYiGit from "@/components/RuoYi/Git";
import RuoYiDoc from "@/components/RuoYi/Doc";
export default {
components: {
@ -66,48 +77,46 @@ export default {
SizeSelect,
Search,
RuoYiGit,
RuoYiDoc
RuoYiDoc,
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device'
]),
...mapGetters(["sidebar", "avatar", "device"]),
setting: {
get() {
return this.$store.state.settings.showSettings
return this.$store.state.settings.showSettings;
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
this.$store.dispatch("settings/changeSetting", {
key: "showSettings",
value: val,
});
},
},
topNav: {
get() {
return this.$store.state.settings.topNav
}
}
return this.$store.state.settings.topNav;
},
},
},
methods: {
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
this.$store.dispatch("app/toggleSideBar");
},
async logout() {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
this.$confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$store.dispatch("LogOut").then(() => {
location.href = "/index";
});
})
}).catch(() => {});
}
}
}
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
@ -116,18 +125,18 @@ export default {
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background .3s;
-webkit-tap-highlight-color:transparent;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
@ -164,10 +173,10 @@ export default {
&.hover-effect {
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
}

@ -71,7 +71,7 @@ export const constantRoutes = [
path: "/index",
component: () => import("@/views/index"),
name: "Index",
meta: { title: "首页", icon: "dashboard", affix: true },
meta: { title: "街道", icon: "map", affix: true },
},
{
path: "/shequ",

@ -2,7 +2,7 @@ module.exports = {
/**
* 侧边栏主题 深色主题theme-dark浅色主题theme-light
*/
sideTheme: 'theme-dark',
sideTheme: "theme-dark",
/**
* 是否系统布局配置
@ -22,7 +22,7 @@ module.exports = {
/**
* 是否固定头部
*/
fixedHeader: false,
fixedHeader: true,
/**
* 是否显示logo
@ -40,5 +40,5 @@ module.exports = {
* The default is only used in the production env
* If you want to also use it in dev, you can pass ['production', 'development']
*/
errorLog: 'production'
}
errorLog: "production",
};

@ -0,0 +1,90 @@
/*
* @Author: 许宏杰
* @Date: 2021-12-28 16:05:36
* @LastEditors: 许宏杰
* @LastEditTime: 2022-03-24 14:25:05
* @FilePath: \taicangpopulationpc\src\utils\regex\formRegex.js
*/
//以key:value方式一次性全部导出
export default {
// 邮箱
checkEmail: (rule, value, callback) => {
const mailReg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
if (!value) {
return callback(new Error("邮箱不能为空"));
}
setTimeout(() => {
if (mailReg.test(value)) {
callback();
} else {
callback(new Error("请输入正确的邮箱格式"));
}
}, 100);
},
//手机号
checkPhone: (rule, value, callback) => {
const phoneReg = /^1[3|4|5|7|8][0-9]{9}$/;
if (!value) {
return callback(new Error("电话号码不能为空"));
}
setTimeout(() => {
// Number.isInteger是es6验证数字是否为整数的方法,但是我实际用的时候输入的数字总是识别成字符串
// 所以我就在前面加了一个+实现隐式转换
if (!Number.isInteger(+value)) {
callback(new Error("请输入数字值"));
} else {
if (phoneReg.test(value)) {
callback();
} else {
callback(new Error("电话号码格式不正确"));
}
}
}, 100);
},
//正整数大于0
checkcontractLeaseArea: (rule, value, callback) => {
const contractLeaseArea = /^[1-9]\d*$/;
if (!value) {
return callback(new Error("数字不能小于且等于0"));
}
setTimeout(() => {
if (contractLeaseArea.test(value)) {
callback();
} else {
callback(new Error("请输入大于0的数字"));
}
}, 100);
},
//只接受中文汉字
ChineseCharacters(text) {
let personalName = (rule, value, callback) => {
const names = /^[\u4e00-\u9fa5]{2,15}$/;
if (!value) {
return callback(new Error(`${text}名称不能为空`));
}
setTimeout(() => {
if (names.test(value)) {
callback();
} else {
callback(new Error(`${text}只能为中文汉字`));
}
}, 100);
};
return personalName;
},
//身份证
idCard: (rule, value, callback) => {
let id =
/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;
if (!value) {
return callback(new Error("身份证号码不能为空"));
}
setTimeout(() => {
if (id.test(value)) {
callback();
} else {
callback(new Error("请输入正确的身份证号码"));
}
}, 100);
},
};

@ -0,0 +1,16 @@
/*
* @Author: 许宏杰
* @Date: 2021-12-28 10:21:48
* @LastEditors: 许宏杰
* @LastEditTime: 2021-12-28 16:22:32
* @FilePath: \hezhangzhipc\src\utils\regex\index.js
*/
import formRegex from './formRegex.js'//引入自己的正则文件目录
export default {
formRegex,//导出
}
//页面使用
// 引入 import 名字 from "@/utils/regex/index.js";
// 使用 名字.index导出名字.key

@ -77,7 +77,6 @@ export default {
} else {
//
let floors = Array.from({ length: this.info.floor }, () => []);
//
this.list.forEach((room) => {
//

@ -0,0 +1,550 @@
<template>
<div class="app-container">
<div class="table_container">
<el-row :gutter="20">
<el-col :span="4" :xs="24">
<div class="from_tree">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入部门名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
node-key="id"
:default-expanded-keys="defaultKey"
:current-node-key="defaultActive"
highlight-current
ref="tree"
@node-click="handleNodeClick"
/>
<!-- :default-checked-keys="defaultActive" -->
</div>
</div>
</el-col>
<el-col :span="20" :xs="24">
<div class="from_table">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
>
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
class="search_btn"
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
class="agin_btn"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="new"
size="mini"
@click="handleAdd"
v-hasPermi="['taicangpop:building:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="revise"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['taicangpop:building:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="remove"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['taicangpop:building:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="export"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['taicangpop:building:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="buildingList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="组团名称"
align="center"
prop="deptname"
/>
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="层数" align="center" prop="floor" />
<el-table-column label="每层单元数" align="center" prop="unit" />
<el-table-column label="每层总户数" align="center" prop="house" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="200"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-zoom-in"
@click="handleInfo(scope.row)"
>查看</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['taicangpop:building:edit']"
>修改</el-button
>
<el-button
class="table_icon_text"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['taicangpop:building:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改楼栋管理对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
append-to-body
:close-on-click-modal="false"
:destroy-on-close="true"
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="auto"
>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="归属部门" prop="deptId">
<treeselect
v-model="form.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
/>
</el-form-item>
<el-form-item label="层数" prop="floor">
<el-input v-model="form.floor" placeholder="请输入层数" />
</el-form-item>
<el-form-item label="每层单元数" prop="unit">
<el-input
v-model="form.unit"
placeholder="请输入每层单元数"
/>
</el-form-item>
<el-form-item label="每层总户数" prop="house">
<el-input
v-model="form.house"
placeholder="请输入每层总户数"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入备注"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 详情样式 -->
<el-dialog
title="详情信息"
:visible.sync="infoOpen"
width="500px"
append-to-body
:close-on-click-modal="false"
:destroy-on-close="true"
>
<el-descriptions
title="楼幢详情"
:column="1"
border
class="textData"
>
<el-descriptions-item label="苑名称">{{
form.deptname
}}</el-descriptions-item>
<el-descriptions-item label="楼名称">{{
form.name
}}</el-descriptions-item>
<el-descriptions-item label="层数">{{
form.floor
}}</el-descriptions-item>
<el-descriptions-item label="每层单元数">{{
form.unit
}}</el-descriptions-item>
<el-descriptions-item label="每层总户数">{{
form.house
}}</el-descriptions-item>
<el-descriptions-item label="备注">{{
form.remark
}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import {
listBuilding,
getBuilding,
delBuilding,
addBuilding,
updateBuilding,
exportBuilding,
} from "@/api/taicangpop/building";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
//
import { treeselect } from "@/api/system/dept";
//
import check from "@/utils/regex/index.js";
export default {
name: "Building",
components: { Treeselect },
data() {
return {
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
buildingList: [],
//
title: "",
//
deptName: undefined,
//
deptOptions: undefined,
defaultProps: {
children: "children",
label: "label",
},
//
open: false,
//
infoOpen: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
deptId: undefined,
},
defaultKey: [],
defaultActive: "",
//
form: {},
//
rules: {
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
deptId: [
{ required: true, message: "归属部门不能为空", trigger: "blur" },
],
},
autoWidth: {
width: "",
},
};
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.getTreeselect();
// this.getList();
},
methods: {
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then((response) => {
this.deptOptions = response.data;
//
this.deptOptions.forEach((item) => {
item.children.forEach((child) => {
if (child.children) {
child.children.forEach((childs) => {
if (childs.children) {
childs.children.forEach((childss) => {
// console.warn("4", childss);
this.defaultKey.push(childss.id);
});
}
});
}
});
});
//
this.defaultActive =
this.deptOptions[0].children[0].children[0].children[0].children[0].id;
//setCurrentKey$nextTicktreedefaultActive
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.defaultActive);
});
this.queryParams = {
pageNum: 1,
pageSize: 10,
name: null,
deptId: this.defaultActive,
};
this.getList();
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
if (!data.children) {
this.queryParams.deptId = data.id;
this.getList();
}
},
/** 查询楼栋管理列表 */
getList() {
this.loading = true;
listBuilding(this.queryParams).then((response) => {
this.buildingList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
floor: null,
unit: null,
house: null,
createId: null,
createBy: null,
createTime: null,
updateId: null,
updateBy: null,
updateTime: null,
remark: null,
userId: null,
deptId: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 查看按钮操作 */
handleLook(row) {
this.reset();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加楼栋管理";
},
/**查看详情 */
handleInfo(row) {
this.reset();
let id = row.id;
getBuilding(id).then((response) => {
this.form = response.data;
this.infoOpen = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getBuilding(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改楼栋管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateBuilding(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.userId = JSON.parse(
sessionStorage.getItem("USER_INFO")
).userId;
addBuilding(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除楼栋管理编号为"' + ids + '"的数据项?')
.then(function () {
return delBuilding(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal
.confirm("是否确认导出所有楼栋管理数据项?")
.then(() => {
this.exportLoading = true;
return exportBuilding(queryParams);
})
.then((response) => {
this.$download.name(response.msg);
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-descriptions-row th {
text-align: center !important;
width: 130px !important;
}
::v-deep .textData {
padding-bottom: 10px;
}
</style>

@ -0,0 +1,730 @@
<template>
<div class="app-container">
<div class="table_container">
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="from_tree">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入部门名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
:load="loadNode"
lazy
ref="tree"
node-key="id"
:default-expanded-keys="defaultExpandKeys"
@node-click="handleNodeClick"
@node-expand="handleNodeExpand"
@node-collapse="handleNodeCollapse"
:current-node-key="defaultActive"
highlight-current
/>
</div>
</div>
</el-col>
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="分色" prop="color">
<el-select
v-model="queryParams.color"
placeholder="请选择分色"
clearable
size="small"
>
<el-option
v-for="dict in dict.type.b_color_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
class="search_btn"
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
class="agin_btn"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置
</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="new"
size="mini"
@click="handleAdd"
v-hasPermi="['taicangpop:check:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="revise"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['taicangpop:check:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="remove"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['taicangpop:check:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="export"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['taicangpop:check:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="checkList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="组团名称" align="center" prop="deptname" />
<el-table-column
label="楼栋名称"
align="center"
prop="buildingname"
/>
<el-table-column label="住户名称" align="center" prop="housename" />
<!-- <el-table-column label="网格员id" align="center" prop="managerId" /> -->
<el-table-column label="分色" align="center" prop="color">
<template slot-scope="scope">
<dict-tag
:options="dict.type.b_color_type"
:value="scope.row.color"
/>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="200"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-zoom-in"
@click="handleInfo(scope.row)"
>查看</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['taicangpop:check:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['taicangpop:check:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 添加或修改巡检记录管理对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- <el-form-item label="网格员id" prop="managerId">
<el-input v-model="form.managerId" placeholder="请输入网格员id" />
</el-form-item> -->
<el-form-item label="组团" prop="deptId">
<treeselect
v-model="form.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属组团"
@select="treeSelect"
/>
</el-form-item>
<el-form-item label="楼栋" prop="buildingId">
<el-select
v-model="form.buildingId"
placeholder="请输入楼栋"
filterable
@change="selectBuildingChange"
>
<el-option
v-for="dict in buildingList"
:key="parseInt(dict.id)"
:label="dict.name"
:value="parseInt(dict.id)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="住户" prop="houseId">
<el-select
v-model="form.houseId"
placeholder="请输入住户"
filterable
>
<el-option
v-for="dict in houselist"
:key="parseInt(dict.id)"
:label="dict.name"
:value="parseInt(dict.id)"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="分色" prop="color">
<el-select v-model="form.color" placeholder="请选择分色">
<el-option
v-for="dict in dict.type.b_color_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入备注"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<el-dialog
title="详情信息"
:visible.sync="infoOpen"
width="500px"
append-to-body
:close-on-click-modal="false"
:destroy-on-close="true"
>
<el-descriptions title="巡检详情" :column="1" border class="textData">
<el-descriptions-item label="苑名称">{{
form.deptname
}}</el-descriptions-item>
<el-descriptions-item label="楼名称">{{
form.buildingname
}}</el-descriptions-item>
<el-descriptions-item label="室名称">{{
form.housename
}}</el-descriptions-item>
<el-descriptions-item label="备注">{{
form.remark
}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</div>
</template>
<script>
import {
listCheck,
getCheck,
delCheck,
addCheck,
updateCheck,
exportCheck,
} from "@/api/taicangpop/check";
import { treeselect, getDept, listDept } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { listBuilding } from "@/api/taicangpop/building";
import { listHouse } from "@/api/taicangpop/house";
export default {
name: "Check",
dicts: ["b_color_type"],
components: { Treeselect },
data() {
return {
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
checkList: [],
//
title: "",
//
open: false,
infoOpen: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
managerId: null,
color: null,
buildingId: null,
houseId: null,
},
//
form: {},
//
rules: {},
//
deptOptions: undefined,
//
deptName: undefined,
defaultProps: {
children: "children",
label: "label",
isLeaf: "leaf",
},
// default-expanded-keys
defaultExpandKeys: [],
defaultActive: "",
buildingList: [],
houselist: [],
deptId: null,
isInit: true,
};
},
created() {
// this.getList();
},
methods: {
treeSelect(node, instanceId) {
// console.log(node);
if (!node.children) {
this.deptId = node.id;
let queryBuildingParams = {
deptId: node.id,
};
this.getBuildingList(queryBuildingParams);
}
},
/** 查询楼栋管理列表 */
getBuildingList(queryBuildingParams) {
listBuilding(queryBuildingParams).then((response) => {
this.buildingList = response.rows;
});
},
selectBuildingChange(val) {
// console.log(val);
let queryHouseParams = {
buildingId: val,
deptId: this.deptId,
};
this.getHouseList(queryHouseParams);
},
/** 查询楼栋管理列表 */
getHouseList(queryHouseParams) {
// this.queryHouseParams
listHouse(queryHouseParams).then((response) => {
this.houselist = response.rows;
});
},
/** 查询部门下拉树结构 */
getTreeselect(node, resolve) {
treeselect().then((response) => {
this.deptOptions = response.data;
let datas = response.data;
datas.forEach((item) => {
item.children = item.children;
item.label = item.label;
item.id = item.id;
item.parentId = item.id;
});
if (this.isInit) {
//
this.defaultExpandKeys = [this.deptOptions[0].id];
}
return resolve(datas);
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeExpand() {
this.isInit = false;
},
handleNodeCollapse() {
this.isInit = false;
},
//
handleNodeClick(data, node) {
this.isInit = false;
// console.log(data, node);
//
if (node.level == 5) {
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: data.id,
};
this.getList();
}
//
else if (node.level == 6) {
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: data.deptId,
buildingId: data.id,
};
this.getList();
}
//
else if (node.level == 7) {
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: data.parentId,
buildingId: data.buildingId,
houseId: data.id,
};
this.getList();
}
// this.queryParams.deptId = data.id;
// this.getList();
},
reqListDept(queryParam, resolve) {
listDept(queryParam).then((res) => {
let datas = res.data;
// console.log(datas);
datas.forEach((item) => {
item.children = item.children;
item.label = item.deptName;
item.id = item.deptId;
item.parentId = item.parentId;
});
if (this.isInit) {
//
this.defaultExpandKeys.push(datas[0].deptId);
}
return resolve(datas);
});
},
//
reqListBuilding(queryParam, resolve) {
listBuilding(queryParam).then((res) => {
let datas = res.rows;
// console.log(datas);
datas.forEach((item) => {
item.children = item.children;
item.label = item.name;
item.id = item.id;
item.parentId = item.deptId;
});
if (this.isInit) {
//
this.defaultExpandKeys.push(datas[0].id);
}
return resolve(datas);
});
},
//
reqListHouse(queryParam, resolve) {
listHouse(queryParam).then((res) => {
let datas = res.rows;
// console.log(datas);
datas.forEach((item) => {
item.label = item.name;
item.id = item.id;
item.parentId = item.deptId;
item.leaf = true;
});
this.defaultActive = res.rows[0].id;
// console.log("", this.defaultActive);
//setCurrentKey$nextTicktreedefaultActive
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.defaultActive);
});
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: datas[0].parentId,
houseId: datas[0].id,
buildingId: datas[0].buildingId,
};
this.getList();
return resolve(datas);
});
},
loadNode(node, resolve) {
this.defaultActive = "";
this.defaultExpandKeys = [];
if (node.level == 0) {
// console.log("");
this.getTreeselect(node, resolve);
}
if (node.level > 0 && node.level < 5) {
// console.log(node.data);
let queryParam = {
parentId: node.data.id,
};
// console.log("<5", node.data);
this.reqListDept(queryParam, resolve);
}
// 5id
else if (node.level == 5) {
let queryParam = {
deptId: node.data.id,
};
// console.log("building", node);
this.reqListBuilding(queryParam, resolve);
}
// 6id
else if (node.level == 6) {
let queryParam = {
buildingId: node.data.id,
deptId: node.data.parentId,
};
// console.log("housing", node);
this.reqListHouse(queryParam, resolve);
} else {
return resolve([]); //
}
},
/** 查询巡检记录管理列表 */
getList() {
this.loading = true;
listCheck(this.queryParams).then((response) => {
this.checkList = response.rows;
// console.log(this.checkList);
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
managerId: null,
color: null,
buildingId: null,
houseId: null,
createId: null,
createBy: null,
createTime: null,
updateId: null,
updateBy: null,
updateTime: null,
remark: null,
userId: null,
deptId: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加巡检记录管理";
},
/**查看详情 */
handleInfo(row) {
const id = row.id;
getCheck(id).then((response) => {
this.form = response.data;
this.infoOpen = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getCheck(id).then((response) => {
this.form = response.data;
let Data = {
deptId: this.form.deptId,
};
listBuilding(Data).then((res) => {
this.buildingList = res.rows;
});
let queryParam = {
buildingId: this.form.buildingId,
deptId: this.form.deptId,
};
listHouse(queryParam).then((res) => {
this.houselist = res.rows;
this.open = true;
});
this.title = "修改巡检记录管理";
//
// console.log(this.form);
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateCheck(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.userId = JSON.parse(
sessionStorage.getItem("USER_INFO")
).userId;
addCheck(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除巡检记录管理编号为"' + ids + '"的数据项?')
.then(function () {
return delCheck(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal
.confirm("是否确认导出所有巡检记录管理数据项?")
.then(() => {
this.exportLoading = true;
return exportCheck(queryParams);
})
.then((response) => {
this.$download.name(response.msg);
this.exportLoading = false;
})
.catch(() => {});
},
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val);
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-descriptions-row th {
text-align: center !important;
width: 130px !important;
}
::v-deep .textData {
padding-bottom: 10px;
}
</style>

@ -0,0 +1,769 @@
<template>
<div class="app-container">
<div class="table_container">
<el-row :gutter="20">
<el-col :span="4" :xs="24">
<div class="from_tree">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入部门名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
lazy
:load="loadNode"
@node-click="handleNodeClick"
node-key="id"
:default-expanded-keys="defaultExpandKeys"
:current-node-key="defaultActive"
highlight-current
/>
</div>
</div>
</el-col>
<el-col :span="20" :xs="24">
<div class="from_table">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
>
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="分色" prop="color">
<el-select
v-model="queryParams.color"
placeholder="请选择分色"
clearable
size="small"
>
<el-option
v-for="dict in dict.type.b_color_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="巡检时间">
<el-date-picker
v-model="daterangeCheckTime"
size="small"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button
class="search_btn"
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
class="agin_btn"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="new"
size="mini"
@click="handleAdd"
v-hasPermi="['taicangpop:house:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="revise"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['taicangpop:house:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="remove"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['taicangpop:house:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="export"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['taicangpop:house:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="houseList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="组团名称"
align="center"
prop="deptname"
/>
<el-table-column
label="楼栋名称"
align="center"
prop="buildingname"
/>
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="分色" align="center" prop="color">
<template slot-scope="scope">
<dict-tag
:options="dict.type.b_color_type"
:value="scope.row.color"
/>
</template>
</el-table-column>
<el-table-column
label="巡检时间"
align="center"
prop="checkTime"
width="180"
>
<template slot-scope="scope">
<span>{{
parseTime(scope.row.checkTime, "{y}-{m}-{d}")
}}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="200"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-zoom-in"
@click="handleInfo(scope.row)"
>查看</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['taicangpop:house:edit']"
>修改</el-button
>
<el-button
class="table_icon_text"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['taicangpop:house:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改住户管理对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="500px"
append-to-body
:close-on-click-modal="false"
:destroy-on-close="true"
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="auto"
class="data_container"
>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="归属部门" prop="deptId">
<treeselect
v-model="form.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
@select="depidChange"
/>
</el-form-item>
<el-form-item label="所属楼栋" prop="buildingId">
<el-select v-model="form.buildingId" placeholder="请选择楼幢">
<el-option
v-for="item in louList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="户主" v-if="xiu">
<el-select v-model="form.holderId" placeholder="请选择户主">
<el-option
v-for="item in huzhuList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="分色" prop="color">
<el-select v-model="form.color" placeholder="请选择分色">
<el-option
v-for="dict in dict.type.b_color_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item label="巡检时间" prop="checkTime">
<el-date-picker
clearable
size="small"
v-model="form.checkTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择巡检时间"
>
</el-date-picker>
</el-form-item> -->
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入备注"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 详情样式 -->
<el-dialog
title="详情信息"
:visible.sync="infoOpen"
width="500px"
append-to-body
:close-on-click-modal="false"
:destroy-on-close="true"
>
<el-descriptions
title="住户详情"
:column="1"
border
class="textData"
>
<el-descriptions-item label="所属网格">{{
form.parentname
}}</el-descriptions-item>
<el-descriptions-item label="苑名称">{{
form.deptname
}}</el-descriptions-item>
<el-descriptions-item label="楼名称">{{
form.buildingname
}}</el-descriptions-item>
<el-descriptions-item label="室名称">{{
form.name
}}</el-descriptions-item>
<!-- <el-descriptions-item label="户主">
{{
form.holdername
}}
</el-descriptions-item> -->
<el-descriptions-item label="类型">{{
form.type == 1 ? "户籍" : "流动"
}}</el-descriptions-item>
<el-descriptions-item label="分色">{{
form.colorname
}}</el-descriptions-item>
<el-descriptions-item label="巡检事件">{{
form.checkTime
}}</el-descriptions-item>
<el-descriptions-item label="备注">{{
form.remark
}}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import {
listHouse,
getHouse,
delHouse,
addHouse,
updateHouse,
exportHouse,
} from "@/api/taicangpop/house";
import { listPerson } from "@/api/taicangpop/person";
import { treeselect, listDept } from "@/api/system/dept";
import { listBuilding } from "@/api/taicangpop/building";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "House",
dicts: ["b_color_type"],
components: { Treeselect },
data() {
return {
infoBoole: false,
value: "",
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
houseList: [],
//
deptName: undefined,
//
deptOptions: undefined,
defaultProps: {
children: "children",
label: "label",
isLeaf: "leaf",
},
//
title: "",
//
open: false,
//
infoOpen: false,
// id
daterangeCheckTime: [],
xiu: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
color: null,
checkTime: null,
deptId: undefined,
buildingId: undefined,
},
defaultExpandKeys: [],
defaultActive: "",
//
form: {},
//
rules: {
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
color: [{ required: true, message: "分色不能为空", trigger: "change" }],
checkTime: [
{ required: true, message: "巡检时间不能为空", trigger: "blur" },
],
},
louList: [],
huzhuList: [],
};
},
watch: {
//
deptName(val) {
this.$refs.tree.filter(val);
},
},
created() {
// this.getTreeselect();
// this.getList();
},
methods: {
/**
* 部门发生变化
*/
getId(e) {
// console.log(e, "aaaaalllll");
},
depidChange(node, instanceId) {
// console.log(node, "");
if (!node.children) {
let parmar = {
deptId: node.id,
};
listBuilding(parmar).then((res) => {
this.louList = res.rows;
});
} else {
this.louList = [];
this.form.deptId = undefined;
}
},
/** 查询部门下拉树结构 */
getTreeselect(node, resolve) {
if (resolve) {
treeselect().then((response) => {
this.deptOptions = response.data;
let datas = response.data;
datas.forEach((item) => {
item.children = item.children;
item.label = item.label;
item.id = item.id;
item.parentId = item.id;
});
this.defaultExpandKeys.push(datas[0].id);
return resolve(datas);
});
}
},
loadNode(node, resolve) {
this.defaultExpandKeys = [];
this.defaultActive = "";
if (node.level == 0) {
this.getTreeselect(node, resolve);
}
if (node.level > 0 && node.level < 5) {
let queryParam = {
parentId: node.data.id,
};
this.reqListDept(queryParam, resolve);
}
// 5id
else if (node.level == 5) {
let queryParam = {
deptId: node.data.id,
};
this.reqListBuilding(queryParam, resolve);
} else {
return resolve([]); //
}
},
reqListDept(queryParam, resolve) {
listDept(queryParam).then((res) => {
let datas = res.data;
datas.forEach((item) => {
item.children = item.children;
item.label = item.deptName;
item.id = item.deptId;
item.parentId = item.parentId;
});
//
this.defaultExpandKeys.push(datas[0].deptId);
return resolve(datas);
});
},
//
reqListBuilding(queryParam, resolve) {
listBuilding(queryParam).then((res) => {
let datas = res.rows;
datas.forEach((item) => {
item.children = item.children;
item.label = item.name;
item.id = item.id;
item.parentId = item.deptId;
item.leaf = true;
});
this.defaultActive = res.rows[0].id;
// console.log("", this.defaultActive);
//setCurrentKey$nextTicktreedefaultActive
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.defaultActive);
});
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
buildingId: datas[0].id,
deptId: datas[0].parentId,
};
this.getList();
return resolve(datas);
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data, node) {
if (node.level == 5) {
let deptId = //list
(this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: data.id,
});
this.getList();
} //
else if (node.level == 6) {
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: data.deptId,
buildingId: data.id,
};
this.getList();
} //
else if (node.level == 7) {
//list
this.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: data.parentId,
buildingId: data.buildingId,
houseId: data.id,
};
this.getList();
} //
},
/** 查询住户管理列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeCheckTime && "" != this.daterangeCheckTime) {
this.queryParams.params["beginCheckTime"] = this.daterangeCheckTime[0];
this.queryParams.params["endCheckTime"] = this.daterangeCheckTime[1];
}
listHouse(this.queryParams).then((response) => {
this.houseList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
buildingId: null,
color: null,
checkTime: null,
holderId: null,
createId: null,
createBy: null,
createTime: null,
updateId: null,
updateBy: null,
updateTime: null,
remark: null,
userId: null,
deptId: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeCheckTime = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.xiu = false;
this.title = "添加住户管理";
},
/**查看详情 */
handleInfo(row) {
this.reset();
const id = row.id;
getHouse(id).then((response) => {
this.form = response.data;
this.infoOpen = true;
});
},
/** 修改按钮操作 */
handleUpdate(row, text) {
this.reset();
const id = row.id || this.ids;
getHouse(id).then((response) => {
this.form = response.data;
//
let Data = {
deptId: this.form.deptId,
};
listBuilding(Data).then((res) => {
this.louList = res.rows;
});
let params = {
buildingId: this.form.buildingId,
deptId: this.form.deptId,
houseId: this.form.id,
};
listPerson(params).then((res) => {
this.huzhuList = res.rows;
// console.log("", res);
this.open = true;
});
this.title = "修改住户管理";
//
this.xiu = true;
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateHouse(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
this.form.userId = JSON.parse(
sessionStorage.getItem("USER_INFO")
).userId;
addHouse(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除住户管理编号为"' + ids + '"的数据项?')
.then(function () {
return delHouse(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal
.confirm("是否确认导出所有住户管理数据项?")
.then(() => {
this.exportLoading = true;
return exportHouse(queryParams);
})
.then((response) => {
this.$download.name(response.msg);
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .el-descriptions-row th {
text-align: center !important;
width: 130px !important;
}
::v-deep .textData {
padding-bottom: 10px;
}
</style>
<style lang="scss" scoped>
::v-deep .el-descriptions-row th {
text-align: center !important;
width: 130px !important;
}
::v-deep .textData {
padding-bottom: 10px;
}
</style>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save