From 3a5325039b8782785d029b8ebab8ff807f357eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AE=8F=E6=9D=B0?= <1943105267@qq.com> Date: Fri, 8 Nov 2024 16:19:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=B7=E5=8A=9F=E8=83=BD=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/system/dict/data.js | 52 ++++++ api/system/dict/type.js | 60 +++++++ api/taicangpop/house.js | 68 ++++---- api/taicangpop/person.js | 60 +++---- components/BottomBtn/index.vue | 45 ++++++ components/ColorItem/index.vue | 36 +++-- main.js | 2 + pages.json | 171 +++++++++++--------- pages/building/building.vue | 22 ++- pages/house/addAndEdit.vue | 238 +++++++++++++++++++++++++++ pages/house/house.vue | 288 +++++++++++++++++++++++++++++++++ pages/house/personInfo.vue | 107 ++++++++++++ pages/index.vue | 3 +- static/scss/index.scss | 3 +- store/getters.js | 2 +- store/modules/user.js | 6 +- utils/handlerColor.js | 48 ++++++ 17 files changed, 1048 insertions(+), 163 deletions(-) create mode 100644 api/system/dict/data.js create mode 100644 api/system/dict/type.js create mode 100644 components/BottomBtn/index.vue create mode 100644 pages/house/addAndEdit.vue create mode 100644 pages/house/house.vue create mode 100644 pages/house/personInfo.vue diff --git a/api/system/dict/data.js b/api/system/dict/data.js new file mode 100644 index 0000000..6c9eb79 --- /dev/null +++ b/api/system/dict/data.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询字典数据列表 +export function listData(query) { + return request({ + url: '/system/dict/data/list', + method: 'get', + params: query + }) +} + +// 查询字典数据详细 +export function getData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'get' + }) +} + +// 根据字典类型查询字典数据信息 +export function getDicts(dictType) { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) +} + +// 新增字典数据 +export function addData(data) { + return request({ + url: '/system/dict/data', + method: 'post', + data: data + }) +} + +// 修改字典数据 +export function updateData(data) { + return request({ + url: '/system/dict/data', + method: 'put', + data: data + }) +} + +// 删除字典数据 +export function delData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'delete' + }) +} diff --git a/api/system/dict/type.js b/api/system/dict/type.js new file mode 100644 index 0000000..a7a6e01 --- /dev/null +++ b/api/system/dict/type.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 查询字典类型列表 +export function listType(query) { + return request({ + url: '/system/dict/type/list', + method: 'get', + params: query + }) +} + +// 查询字典类型详细 +export function getType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'get' + }) +} + +// 新增字典类型 +export function addType(data) { + return request({ + url: '/system/dict/type', + method: 'post', + data: data + }) +} + +// 修改字典类型 +export function updateType(data) { + return request({ + url: '/system/dict/type', + method: 'put', + data: data + }) +} + +// 删除字典类型 +export function delType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'delete' + }) +} + +// 刷新字典缓存 +export function refreshCache() { + return request({ + url: '/system/dict/type/refreshCache', + method: 'delete' + }) +} + +// 获取字典选择框列表 +export function optionselect() { + return request({ + url: '/system/dict/type/optionselect', + method: 'get' + }) +} \ No newline at end of file diff --git a/api/taicangpop/house.js b/api/taicangpop/house.js index 55493d9..a8143be 100644 --- a/api/taicangpop/house.js +++ b/api/taicangpop/house.js @@ -1,55 +1,55 @@ -import { request } from '@/api/request.js' +import request from '@/utils/request' // 查询住户管理列表 export function listHouse(query) { - return request({ - url: '/taicangpop/house/list', - method: 'get', - params: query, - }) + return request({ + url: '/taicangpop/house/list', + method: 'get', + params: query, + }) } // 查询住户管理详细 export function getHouse(id) { - return request({ - url: '/taicangpop/house/' + id, - method: 'get', - }) + return request({ + url: '/taicangpop/house/' + id, + method: 'get', + }) } // 新增住户管理 export function addHouse(data) { - return request({ - url: '/taicangpop/house', - method: 'post', - data: data, - }) + return request({ + url: '/taicangpop/house', + method: 'post', + data: data, + }) } // 修改住户管理 export function updateHouse(data) { - return request({ - url: '/taicangpop/house', - method: 'put', - data: data, - }) + return request({ + url: '/taicangpop/house', + method: 'put', + data: data, + }) } // 删除住户管理 export function delHouse(id) { - return request({ - url: '/taicangpop/house/' + id, - method: 'delete', - }) + return request({ + url: '/taicangpop/house/' + id, + method: 'delete', + }) } // 导出住户管理 export function exportHouse(query) { - return request({ - url: '/taicangpop/house/export', - method: 'get', - params: query, - }) + return request({ + url: '/taicangpop/house/export', + method: 'get', + params: query, + }) } // 查询住户管理排摸 @@ -61,8 +61,8 @@ export function exportHouse(query) { // } export function listPaimoHouse(id) { - return request({ - url: '/taicangpop/house/getweigengxinnew?buildingid=' + id, - method: 'get', - }) -} + return request({ + url: '/taicangpop/house/getweigengxinnew?buildingid=' + id, + method: 'get', + }) +} \ No newline at end of file diff --git a/api/taicangpop/person.js b/api/taicangpop/person.js index 9d545ce..ce0f10e 100644 --- a/api/taicangpop/person.js +++ b/api/taicangpop/person.js @@ -1,53 +1,53 @@ -import { request } from '@/api/request.js' +import request from '@/utils/request' // 查询居民管理列表 export function listPerson(query) { - return request({ - url: '/taicangpop/person/list', - method: 'get', - params: query, - }) + return request({ + url: '/taicangpop/person/list', + method: 'get', + params: query, + }) } // 查询居民管理详细 export function getPerson(id) { - return request({ - url: '/taicangpop/person/' + id, - method: 'get', - }) + return request({ + url: '/taicangpop/person/' + id, + method: 'get', + }) } // 新增居民管理 export function addPerson(data) { - return request({ - url: '/taicangpop/person', - method: 'post', - data: data, - }) + return request({ + url: '/taicangpop/person', + method: 'post', + data: data, + }) } // 修改居民管理 export function updatePerson(data) { - return request({ - url: '/taicangpop/person', - method: 'put', - data: data, - }) + return request({ + url: '/taicangpop/person', + method: 'put', + data: data, + }) } // 删除居民管理 export function delPerson(id) { - return request({ - url: '/taicangpop/person/' + id, - method: 'delete', - }) + return request({ + url: '/taicangpop/person/' + id, + method: 'delete', + }) } // 导出居民管理 export function exportPerson(query) { - return request({ - url: '/taicangpop/person/export', - method: 'get', - params: query, - }) -} + return request({ + url: '/taicangpop/person/export', + method: 'get', + params: query, + }) +} \ No newline at end of file diff --git a/components/BottomBtn/index.vue b/components/BottomBtn/index.vue new file mode 100644 index 0000000..08b2faa --- /dev/null +++ b/components/BottomBtn/index.vue @@ -0,0 +1,45 @@ + + + {{title}} + + + + + + \ No newline at end of file diff --git a/components/ColorItem/index.vue b/components/ColorItem/index.vue index 286a060..e1e5379 100644 --- a/components/ColorItem/index.vue +++ b/components/ColorItem/index.vue @@ -1,17 +1,16 @@ - + {{item.color}} - {{item.name.replace("室","")}} + {{item.name.replace("室","")}} - + @@ -31,7 +30,7 @@ type: Boolean, default: false, }, - + showColorName: { type: Boolean, default: true, @@ -49,6 +48,12 @@ return { }; + }, + methods: { + clickHouse() { + if (!this.showBuildingName) return + this.$emit('clickHouse', this.item) + }, } } @@ -61,7 +66,8 @@ border: 2rpx solid #fff; display: flex; align-items: center; - .color-building-name{ + + .color-building-name { position: absolute; top: 0; left: 0; @@ -73,30 +79,34 @@ align-items: center; justify-content: center; } - - .color-warn{ + + .color-warn { position: absolute; bottom: 0; right: 0; display: flex; align-items: center; - &>view{ + + &>view { height: 20rpx; width: 20rpx; border-radius: 50%; border: 1px solid #fff; } } - .color-is-type{ + + .color-is-type { position: absolute; top: -20rpx; - left:0; - &>image{ + left: 0; + + &>image { height: 20rpx; width: 20rpx; margin-right: 6rpx; } } + .left-color, .rigth-color { flex: 1; @@ -127,6 +137,4 @@ font-size: 28rpx; } } - - \ No newline at end of file diff --git a/main.js b/main.js index bfb5c1e..06a2f89 100644 --- a/main.js +++ b/main.js @@ -14,9 +14,11 @@ Vue.use(uView); // 自定义包含导航栏容器 import NavigationGeneral from "@/components/NavigationGeneral"; import ColorItem from "@/components/ColorItem"; +import BottomBtn from "@/components/BottomBtn"; Vue.component("NavigationGeneral", NavigationGeneral); Vue.component("ColorItem", ColorItem); +Vue.component("BottomBtn", BottomBtn); App.mpType = 'app' diff --git a/pages.json b/pages.json index e2e0e04..82e3dbb 100644 --- a/pages.json +++ b/pages.json @@ -3,84 +3,103 @@ "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" }, "pages": [{ - "path": "pages/login", - "style": { - "navigationBarTitleText": "登录" - } - }, { - "path": "pages/register", - "style": { - "navigationBarTitleText": "注册" - } - }, { - "path": "pages/index", - "style": { - "navigationBarTitleText": "若依移动端框架", - "navigationStyle": "custom" - } - }, { - "path": "pages/work/index", - "style": { - "navigationBarTitleText": "工作台" - } - }, { - "path": "pages/mine/index", - "style": { - "navigationBarTitleText": "我的" - } - }, { - "path": "pages/mine/avatar/index", - "style": { - "navigationBarTitleText": "修改头像" - } - }, { - "path": "pages/mine/info/index", - "style": { - "navigationBarTitleText": "个人信息" - } - }, { - "path": "pages/mine/info/edit", - "style": { - "navigationBarTitleText": "编辑资料" - } - }, { - "path": "pages/mine/pwd/index", - "style": { - "navigationBarTitleText": "修改密码" - } - }, { - "path": "pages/mine/setting/index", - "style": { - "navigationBarTitleText": "应用设置" - } - }, { - "path": "pages/mine/help/index", - "style": { - "navigationBarTitleText": "常见问题" - } - }, { - "path": "pages/mine/about/index", - "style": { - "navigationBarTitleText": "关于我们" - } - }, { - "path": "pages/common/webview/index", - "style": { - "navigationBarTitleText": "浏览网页" - } - }, { - "path": "pages/common/textview/index", - "style": { - "navigationBarTitleText": "浏览文本" - } - }, - { - "path" : "pages/building/building", - "style" : + "path": "pages/login", + "style": { + "navigationBarTitleText": "登录" + } + }, { + "path": "pages/register", + "style": { + "navigationBarTitleText": "注册" + } + }, { + "path": "pages/index", + "style": { + "navigationBarTitleText": "若依移动端框架", + "navigationStyle": "custom" + } + }, { + "path": "pages/work/index", + "style": { + "navigationBarTitleText": "工作台" + } + }, { + "path": "pages/mine/index", + "style": { + "navigationBarTitleText": "我的" + } + }, { + "path": "pages/mine/avatar/index", + "style": { + "navigationBarTitleText": "修改头像" + } + }, { + "path": "pages/mine/info/index", + "style": { + "navigationBarTitleText": "个人信息" + } + }, { + "path": "pages/mine/info/edit", + "style": { + "navigationBarTitleText": "编辑资料" + } + }, { + "path": "pages/mine/pwd/index", + "style": { + "navigationBarTitleText": "修改密码" + } + }, { + "path": "pages/mine/setting/index", + "style": { + "navigationBarTitleText": "应用设置" + } + }, { + "path": "pages/mine/help/index", + "style": { + "navigationBarTitleText": "常见问题" + } + }, { + "path": "pages/mine/about/index", + "style": { + "navigationBarTitleText": "关于我们" + } + }, { + "path": "pages/common/webview/index", + "style": { + "navigationBarTitleText": "浏览网页" + } + }, { + "path": "pages/common/textview/index", + "style": { + "navigationBarTitleText": "浏览文本" + } + }, + { + "path": "pages/building/building", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/house/house", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/house/personInfo", + "style": { + "navigationBarTitleText": "" + } + }, { - "navigationBarTitleText" : "" + "path" : "pages/house/addAndEdit", + "style" : + { + "navigationBarTitleText" : "" + } } - }], + ], "tabBar": { "color": "#000000", "selectedColor": "#000000", diff --git a/pages/building/building.vue b/pages/building/building.vue index be1221f..c0cb98a 100644 --- a/pages/building/building.vue +++ b/pages/building/building.vue @@ -19,7 +19,7 @@ + :key="house.id" @clickHouse="clickHouse"> @@ -67,7 +67,6 @@ }, computed: { handlerWidth() { - return { width: (this.buildingInfo.house + 1) * 122 + 'rpx' } @@ -103,10 +102,25 @@ this.boxTop = (systemData.statusBarHeight + 44) * 2 this.title = option.deptname this.queryParams.buildingId = option.buildingId - this.getBuildingInfo() + + }, + onShow() { + this.getBuildingInfo() }, methods: { + //单击house + clickHouse(e) { + this.$u.route({ + url: 'pages/house/house', + params: { + buildingId: e.building_id, + houseId: e.id, + deptId: e.dept_id, + houseName: e.name + } + }) + }, //楼信息 async getBuildingInfo() { const res = await getBuilding(this.queryParams.buildingId) @@ -125,7 +139,7 @@ } } - \ No newline at end of file diff --git a/pages/house/house.vue b/pages/house/house.vue new file mode 100644 index 0000000..ef8a4fd --- /dev/null +++ b/pages/house/house.vue @@ -0,0 +1,288 @@ + + + + 住户信息 + 房屋信息采集 + + + + + + {{houseInfo.typename}} + + + + + 中共党员 + 帮扶对象 + 重点人群 + 退伍军人 + + + + + + + + + + + + 居民信息 + 新增居民 + + + + {{item.name}} + {{ filterCarId(item.credentialNo, "性别") }} + {{ filterCarId(item.credentialNo, "年龄") }} 岁 + {{ filterCarId(item.credentialNo, "出生年月") }} + {{personType[item.color]}} + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/house/personInfo.vue b/pages/house/personInfo.vue new file mode 100644 index 0000000..5b48b6d --- /dev/null +++ b/pages/house/personInfo.vue @@ -0,0 +1,107 @@ + + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index 3ef2959..5b7899a 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -66,12 +66,11 @@ methods: { //跳转楼栋页面 handlerBuilding(item) { - console.log(item) this.$u.route({ url: 'pages/building/building', params: { buildingId: item.id, - deptname: item.name + deptname: item.name } }) }, diff --git a/static/scss/index.scss b/static/scss/index.scss index 745cffa..64595e6 100644 --- a/static/scss/index.scss +++ b/static/scss/index.scss @@ -3,4 +3,5 @@ // color-ui @import "@/static/scss/colorui.css"; // iconfont -@import "@/static/font/iconfont.css"; \ No newline at end of file +@import "@/static/font/iconfont.css"; + diff --git a/store/getters.js b/store/getters.js index 7304960..8accd64 100644 --- a/store/getters.js +++ b/store/getters.js @@ -6,6 +6,6 @@ const getters = { permissions: state => state.user.permissions, dept: state => state.user.dept, deptId: state => state.user.deptId, - + userId: state => state.user.userId, } export default getters \ No newline at end of file diff --git a/store/modules/user.js b/store/modules/user.js index 7aa3e76..6c68100 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -19,7 +19,7 @@ const baseUrl = config.baseUrl const user = { state: { - + userId: null, dept: {}, deptId: null, token: getToken(), @@ -34,6 +34,9 @@ const user = { SET_DEPT_ID: (state, deptId) => { state.deptId = deptId }, + SET_USER_ID: (state, userId) => { + state.userId = userId + }, SET_DEPT: (state, dept) => { state.dept = dept }, @@ -97,6 +100,7 @@ const user = { commit('SET_ROLES', ['ROLE_DEFAULT']) } commit('SET_NAME', username) + commit('SET_USER_ID', user.userId) commit('SET_DEPT', user.dept) commit('SET_AVATAR', avatar) diff --git a/utils/handlerColor.js b/utils/handlerColor.js index 9a949eb..875d321 100644 --- a/utils/handlerColor.js +++ b/utils/handlerColor.js @@ -62,4 +62,52 @@ function checkType(value) { } else { return "neither"; } +} + +export function validateAndParseIDCard(idCard, type) { + // 验证身份证号格式 + const idCardPattern = + /^[1-9]\d{5}(18|19|20)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])\d{3}([0-9Xx])$/; + if (!idCardPattern.test(idCard)) { + return "-"; + } + + // 提取出生年月 + const birthYear = + idCard.length === 18 ? + idCard.substring(6, 10) : + `19${idCard.substring(6, 8)}`; + const birthMonth = + idCard.length === 18 ? idCard.substring(10, 12) : idCard.substring(8, 10); + const birthDay = + idCard.length === 18 ? idCard.substring(12, 14) : idCard.substring(10, 12); + + // 计算年龄 + const today = new Date(); + const birthDate = new Date(`${birthYear}-${birthMonth}-${birthDay}`); + let age = today.getFullYear() - birthDate.getFullYear(); + if ( + today.getMonth() < birthDate.getMonth() || + (today.getMonth() === birthDate.getMonth() && + today.getDate() < birthDate.getDate()) + ) { + age--; + } + + // 提取性别(第17位,奇数为男,偶数为女) + const genderCode = + idCard.length === 18 ? idCard.substring(16, 17) : idCard.substring(14, 15); + const gender = genderCode % 2 === 0 ? "女" : "男"; + + // 根据type返回对应的信息 + switch (type) { + case "年龄": + return age; + case "性别": + return gender; + case "出生年月": + return `${birthYear}-${birthMonth}-${birthDay}`; + default: + return "无效的type参数"; + } } \ No newline at end of file