From 50d114ffb36cd494b0708206c6ca49e99d85a855 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 05 Jan 2024 14:44:53 +0800
Subject: [PATCH] 住户管理--房屋管理下住户新增: 字段调整,显示调整、校验添加
---
src/views/userHouse/components/householdManager.vue | 750 ++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 442 insertions(+), 308 deletions(-)
diff --git a/src/views/userHouse/components/householdManager.vue b/src/views/userHouse/components/householdManager.vue
index 731b74f..c10ad49 100644
--- a/src/views/userHouse/components/householdManager.vue
+++ b/src/views/userHouse/components/householdManager.vue
@@ -48,7 +48,8 @@
getToken
} from '@/util/auth'
import {
- downloadXls
+ downloadXls,
+ findParentOrCur,
} from "@/util/util"
import {
dateNow
@@ -59,6 +60,62 @@
export default {
data () {
+ let isCardId = function (rule, value, callback) {
+ // 15位和18位身份证号码的正则表达式
+ var regIdCard = /^(^[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{4})|\d{3}[Xx])$)$/
+
+ // 如果通过该验证,说明身份证格式正确,但准确性还需计算
+ if (regIdCard.test(value)) {
+ if (value.length == 18) {
+ var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10,
+ 5, 8, 4, 2) // 将前17位加权因子保存在数组里
+ var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2) // 这是除以11后,可能产生的11位余数、验证码,也保存成数组
+ var idCardWiSum = 0 // 用来保存前17位各自乖以加权因子后的总和
+ for (var i = 0; i < 17; i++) {
+ idCardWiSum += value.substring(i, i + 1) * idCardWi[i]
+ }
+
+ var idCardMod = idCardWiSum % 11// 计算出校验码所在数组的位置
+ var idCardLast = value.substring(17)// 得到最后一位身份证号码
+
+ // 如果等于2,则说明校验码是10,身份证号码最后一位应该是X
+ if (idCardMod == 2) {
+ if (idCardLast == "X" || idCardLast == "x") {
+ callback()
+ } else {
+ callback(new Error("身份证号格式有误!"))
+ }
+ } else {
+ // 用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
+ if (idCardLast == idCardY[idCardMod]) {
+ callback()
+ } else {
+ callback(new Error("身份证号格式有误!"))
+ }
+ }
+ } else {
+ callback()
+ }
+ } else {
+ //alert("身份证格式不正确!");
+ callback(new Error("身份证号格式有误!"))
+ }
+
+ callback()
+ }
+
+ //手机号格式校验
+ let validatorPhone = function (rule, value, callback) {
+ if (value) {
+ if (!/^1[3456789]\d{9}$/.test(value)) {
+ callback(new Error('手机号格式有误!'))
+ } else {
+ callback()
+ }
+ }
+ callback()
+ }
+
return {
form: {},
search: {},
@@ -85,340 +142,394 @@
addBtn: true,
dialogType: 'dialog',
dialogClickModal: false,
- column: [{
- label: "姓名",
- prop: "name",
- search: true,
- searchSpan: 4,
- },
-
- {
- label: "性别",
- prop: "gender",
- type: "select",
- dicData: [
- {
- label: "男",
- value: 1
+ column: [
+ {
+ label: "与业主关系",
+ prop: "relationship",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
+ dataType: "number",
+ hide: true,
+ props: {
+ label: "dictValue",
+ value: "dictKey",
},
- {
- label: "女",
- value: 0
+ rules: [
+ {
+ required: true,
+ message: "请选择与业主关系",
+ trigger: "blur",
+ }
+ ],
+ },
+
+ {
+ width: 96,
+ label: "姓名",
+ prop: "name",
+ search: true,
+ searchSpan: 3,
+ rules: [
+ {
+ required: true,
+ message: "请输入姓名",
+ trigger: "blur",
+ }
+ ],
+ },
+
+ {
+ hide: true,
+ label: "证件类型",
+ prop: "cardType",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
},
- {
- label: "未知",
- value: 1
- }
- ],
- },
-
- {
- label: "电话",
- prop: "phoneNumber",
- search: true,
- searchSpan: 4,
- },
-
- {
- label: "身份证号",
- prop: "idCard",
- },
- {
- label: "证件类型",
- prop: "cardType",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
},
- },
- {
- width: 160,
- label: "证件号码",
- prop: "cardNo",
- },
- // {
- // label: "关系",
- // prop: "roleType",
- // type: "select",
- // dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleType",
- // dataType: "number",
- // props: {
- // label: "dictValue",
- // value: "dictKey",
- // },
- // },
- {
- label: "与业主关系",
- prop: "relationship",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
- dataType: "number",
- hide: true,
- props: {
- label: "dictValue",
- value: "dictKey",
+ {
+ display: true,
+ width: 160,
+ label: "身份证号",
+ prop: "idCard",
+ search: true,
+ searchSpan: 4,
+ slot: true,
+ rules: [
+ {
+ validator: isCardId,
+ trigger: 'blur'
+ }
+ ],
},
- },
- {
- label: "小区",
- prop: "aoiName",
- display: false
- },
- {
- label: "地址",
- prop: "address",
- display: false
- },
- {
- label: "主要联系人",
- prop: "isPrimaryContact",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=primaryContactType",
- dataType: "number",
- hide: true,
- props: {
- label: "dictValue",
- value: "dictKey",
+
+ {
+ hide: true,
+ display: false,
+ width: 160,
+ label: "证件号码",
+ prop: "cardNo",
},
- },
- {
- label: "居住情况",
- prop: "residentialStatus",
- type: "select",
- hide: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentialStatusType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+
+ {
+ label: "性别",
+ prop: "gender",
+ type: "select",
+ dicData: [
+ {
+ label: "男",
+ value: 1
+ },
+ {
+ label: "女",
+ value: 0
+ },
+ {
+ label: "未知",
+ value: 1
+ }
+ ],
},
- },
- {
- label: "生日",
- prop: "birthday",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd",
- hide: true,
- },
- {
- label: "港澳台通行证",
- prop: "hkmtPass",
- hide: true,
- },
- {
- label: "护照",
- prop: "passport",
- hide: true,
- },
- {
- label: "民族",
- prop: "ethnicity",
- type: "select",
- hide: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+ {
+ width: 120,
+ label: "手机号码",
+ prop: "phoneNumber",
+ search: true,
+ searchSpan: 3,
+ slot: true,
+ rules: [
+ {
+ required: true,
+ message: "请输入手机号码",
+ trigger: "blur",
+ },
+ {
+ validator: validatorPhone,
+ trigger: 'blur'
+ }
+ ],
},
- },
- {
- label: "学历",
- prop: "education",
- type: "select",
- hide: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+
+ {
+ label: "其他联系方式",
+ prop: "otherContact",
+ hide: true,
+ rules: [
+ {
+ validator: validatorPhone,
+ trigger: 'blur'
+ }
+ ],
},
- },
- {
- hide: true,
- parent: false,
- width: 160,
- label: "籍贯地行政区划",
- prop: "nativePlaceAdcode",
- type: "tree",
- props: {
- label: 'name',
- value: 'id'
+ {
+ label: "主要联系人",
+ prop: "isPrimaryContact",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=primaryContactType",
+ dataType: "number",
+ hide: true,
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
},
- dicUrl: `/api/blade-system/region/getBaseTree`,
- },
- {
- label: "户籍类型",
- prop: "residentType",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+
+ {
+ label: "居住情况",
+ prop: "residentialStatus",
+ type: "select",
+ hide: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentialStatusType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
},
- },
- {
- hide: true,
- parent: false,
- width: 160,
- label: "户籍地行政区划",
- prop: "residentAdcode",
- type: "tree",
- props: {
- label: 'name',
- value: 'id'
+ {
+ width: 142,
+ label: "小区",
+ prop: "aoiName",
+ display: false
},
- dicUrl: `/api/blade-system/region/getBaseTree`,
- },
- {
- label: "户籍地址",
- prop: "hukouRegistration",
- hide: true,
- },
-
- {
- disabled: false,
- label: "居住地行政区划",
- prop: "homeAdcode",
- hide: true,
- type: 'select',
- props: {
- label: 'name',
- value: 'code'
+ {
+ label: "地址",
+ prop: "address",
+ display: false
},
- dicUrl: `/api/blade-system/region/select?code=361102`,
- },
- {
- disabled: false,
- label: "现居住地址",
- prop: "currentAddress",
- hide: true,
- },
-
- {
- label: "婚姻状态",
- prop: "maritalStatus",
- type: "select",
- hide: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+ {
+ label: "生日",
+ prop: "birthday",
+ type: "date",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
+ hide: true,
},
- },
- {
- label: "车牌号",
- prop: "cardNumber",
- hide: true,
- },
- {
- label: "残疾证",
- prop: "disabilityCert",
- hide: true,
- },
- {
- hide: true,
- width: 160,
- label: "宗教信仰",
- prop: "religiousBelief",
- },
- {
- hide: true,
- label: "健康状况",
- prop: "healthStatus",
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+ {
+ hide: true,
+ parent: false,
+ width: 160,
+ label: "籍贯地区",
+ prop: "nativePlaceAdcode",
+ type: "tree",
+ typeformat (item, label, value) {
+ return item.addressDetail
+ },
+ change: ({ value, column, item, dic }) => {
+ item.addressDetail = findParentOrCur(dic, item.id)
+ },
+ props: {
+ label: 'name',
+ value: 'id'
+ },
+ dicUrl: `/api/blade-system/region/getBaseTree`,
},
- },
- {
- hide: true,
- width: 160,
- label: "疾病名称",
- prop: "diseaseName"
- },
- {
- hide: true,
- width: 160,
- label: "外出时间",
- prop: "goOutTime"
- },
- {
- hide: true,
- width: 160,
- label: "外出原因",
- prop: "goOutReason"
- },
-
- {
- hide: true,
- width: 160,
- label: "外出去向",
- prop: "goOutWhere"
- },
-
- {
- hide: true,
- width: 160,
- label: "外出详址",
- prop: "goOutAddr"
- },
-
- {
- label: "工作状态",
- prop: "workStatus",
- type: "select",
- hide: true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=workStatusType",
- dataType: "number",
- props: {
- label: "dictValue",
- value: "dictKey",
+ {
+ hide: true,
+ label: "户籍类型",
+ prop: "residentType",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
},
- },
- {
- label: "就职单位",
- prop: "employer",
- hide: true,
- },
+ {
+ hide: true,
+ parent: false,
+ width: 160,
+ label: "户籍地区",
+ prop: "residentAdcode",
+ type: "tree",
+ typeformat (item, label, value) {
+ return item.addressDetail
+ },
+ change: ({ value, column, item, dic }) => {
+ item.addressDetail = findParentOrCur(dic, item.id)
+ },
+ props: {
+ label: 'name',
+ value: 'id'
+ },
+ dicUrl: `/api/blade-system/region/getBaseTree`,
+ },
- {
- hide: true,
- width: 160,
- label: "职业类别",
- prop: "occupation"
- },
+ {
+ label: "户籍地址",
+ prop: "hukouRegistration",
+ hide: true,
+ },
- {
- hide: true,
- width: 160,
- label: "就职单位地址",
- prop: "cmpyRegAddr"
- },
- {
- label: "其他联系方式",
- prop: "otherContact",
- hide: true,
- },
+ {
+ disabled: false,
+ label: "居住地区",
+ prop: "homeAdcode",
+ hide: true,
+ type: 'select',
+ props: {
+ label: 'name',
+ value: 'code'
+ },
+ dicUrl: `/api/blade-system/region/select?code=361102`,
+ },
+
+ {
+ disabled: false,
+ label: "现居住地",
+ prop: "currentAddress",
+ hide: true,
+ },
+
+ {
+ label: "民族",
+ prop: "ethnicity",
+ type: "select",
+ hide: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ },
+
+ {
+ label: "学历",
+ prop: "education",
+ type: "select",
+ hide: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "职业类别",
+ prop: "occupation"
+ },
+
+ {
+ label: "工作单位",
+ prop: "employer",
+ hide: true,
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "工作单位地址",
+ prop: "cmpyRegAddr"
+ },
+
+ {
+ label: "工作状态",
+ prop: "workStatus",
+ type: "select",
+ hide: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=workStatusType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ },
+
+ {
+ label: "婚姻状态",
+ prop: "maritalStatus",
+ type: "select",
+ hide: true,
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "宗教信仰",
+ prop: "religiousBelief",
+ },
+
+ {
+ hide: true,
+ label: "健康状态",
+ prop: "healthStatus",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus",
+ dataType: "number",
+ props: {
+ label: "dictValue",
+ value: "dictKey",
+ },
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "疾病名称",
+ prop: "diseaseName"
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "外出去向",
+ prop: "goOutWhere"
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "外出原因",
+ prop: "goOutReason"
+ },
+
+ {
+ hide: true,
+ label: "外出时间",
+ prop: "goOutTime",
+ type: "date",
+ format: "yyyy-MM-dd",
+ valueFormat: "yyyy-MM-dd",
+ width: 160,
+ },
+
+ {
+ hide: true,
+ width: 160,
+ label: "外出详址",
+ prop: "goOutAddr"
+ },
+
+ {
+ label: "车牌号",
+ prop: "cardNumber",
+ hide: true,
+ },
]
},
houseCode: "",
@@ -495,6 +606,29 @@
}
},
immediate: true
+ },
+
+ 'form.cardType': {
+ handler (newData) {
+ let idCardColumn = this.findObject(
+ this.option.column,
+ 'idCard'
+ )
+
+ let cardNoColumn = this.findObject(
+ this.option.column,
+ 'cardNo'
+ )
+
+ if (newData == 111) {
+ idCardColumn.display = true
+ cardNoColumn.display = false
+ } else {
+ idCardColumn.display = false
+ cardNoColumn.display = true
+ }
+ },
+ immediate: true
}
},
computed: {
--
Gitblit v1.9.3