|
|
|
@ -15,6 +15,7 @@
|
|
|
|
|
{{ houseData.color }}</span
|
|
|
|
|
></ColorCell
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="house-is"
|
|
|
|
|
style="border: 1px solid #81204e; color: #e73388"
|
|
|
|
@ -43,6 +44,10 @@
|
|
|
|
|
>
|
|
|
|
|
退伍军人
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="hose-update">
|
|
|
|
|
更新时间:{{ houseData.updateTime }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="btn-group">
|
|
|
|
|
<div class="btn-gather" v-show="houseData.color == 'NO'">
|
|
|
|
@ -67,13 +72,15 @@
|
|
|
|
|
<div class="data-row">
|
|
|
|
|
<div class="row-item">
|
|
|
|
|
<div class="row-item-lable">
|
|
|
|
|
性別:{{ getGender(item.credentialNo) }}
|
|
|
|
|
性別:{{ filterCarId(item.credentialNo, "性别") }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row-item-value"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row-item">
|
|
|
|
|
<div class="row-item-lable">身份证号:</div>
|
|
|
|
|
<div class="row-item-value">{{ item.credentialNo }}</div>
|
|
|
|
|
<div class="row-item-value">
|
|
|
|
|
{{ item.credentialNo || "-" }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row-item">
|
|
|
|
|
<div class="row-item-lable">户籍:</div>
|
|
|
|
@ -89,7 +96,7 @@
|
|
|
|
|
<div class="row-item">
|
|
|
|
|
<div class="row-item-lable">年龄:</div>
|
|
|
|
|
<div class="row-item-value">
|
|
|
|
|
{{ calculateAge(item.credentialNo) }}岁
|
|
|
|
|
{{ filterCarId(item.credentialNo, "年龄") }} 岁
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row-item">
|
|
|
|
@ -111,7 +118,7 @@
|
|
|
|
|
<div class="row-item">
|
|
|
|
|
<div class="row-item-lable">出生年月:</div>
|
|
|
|
|
<div class="row-item-value">
|
|
|
|
|
{{ extractBirthMonth(item.credentialNo) }}
|
|
|
|
|
{{ filterCarId(item.credentialNo, "出生年月") }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row-item">
|
|
|
|
@ -129,6 +136,14 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="data-row last-row">
|
|
|
|
|
<div class="is-list">
|
|
|
|
|
<div
|
|
|
|
|
class="row-item-value"
|
|
|
|
|
:style="{
|
|
|
|
|
color: item.color == 'NL' ? '#E73388' : '#00C185',
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
{{ item.color == "NL" ? "租客" : "自住" }}
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="house-is"
|
|
|
|
|
style="border: 1px solid #81204e; color: #e73388"
|
|
|
|
@ -206,7 +221,8 @@
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="身份证" prop="credentialNo">
|
|
|
|
|
<!-- prop="credentialNo" -->
|
|
|
|
|
<el-form-item label="身份证">
|
|
|
|
|
<el-input v-model="form.credentialNo"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
@ -281,11 +297,19 @@ import {
|
|
|
|
|
} from "@/api/taicangpop/person.js";
|
|
|
|
|
import { pxToVw, handleColor } from "@/utils/myFuntion.js";
|
|
|
|
|
import ColorCell from "@/components/ColorCell";
|
|
|
|
|
|
|
|
|
|
import { validateAndParseIDCard } from "@/utils/myFuntion.js";
|
|
|
|
|
export default {
|
|
|
|
|
components: { ColorCell },
|
|
|
|
|
dicts: ["b_census_color_type", "b_flow_color_type"],
|
|
|
|
|
data() {
|
|
|
|
|
var validateNumber = (rule, value, callback) => {
|
|
|
|
|
console.log("value:" + value);
|
|
|
|
|
if (!/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/.test(value)) {
|
|
|
|
|
callback(new Error("手机号只能为数字!"));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
houseData: {},
|
|
|
|
|
form: {
|
|
|
|
@ -309,14 +333,11 @@ export default {
|
|
|
|
|
credentialNo: [
|
|
|
|
|
{ required: true, message: "身份证不能为空", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
phone: [{ required: true, message: "手机号不能为空", trigger: "blur" }],
|
|
|
|
|
workunit: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "工作单位不能为空",
|
|
|
|
|
trigger: "change",
|
|
|
|
|
},
|
|
|
|
|
phone: [
|
|
|
|
|
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
|
|
|
|
{ validator: validateNumber, trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
color: [{ required: true, message: "分色不能为空", trigger: "change" }],
|
|
|
|
|
},
|
|
|
|
|
multiple: [],
|
|
|
|
@ -362,6 +383,7 @@ export default {
|
|
|
|
|
houseId: undefined,
|
|
|
|
|
buildingId: undefined,
|
|
|
|
|
deptId: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
};
|
|
|
|
|
this.multiple = [];
|
|
|
|
|
},
|
|
|
|
@ -404,6 +426,12 @@ export default {
|
|
|
|
|
this.form.isX = this.multiple.some((item) => item == "重点人群")
|
|
|
|
|
? 1
|
|
|
|
|
: 0;
|
|
|
|
|
|
|
|
|
|
if (this.form.color == "HZ" || this.form.color == "HO") {
|
|
|
|
|
this.form.type = 1;
|
|
|
|
|
} else {
|
|
|
|
|
this.form.type = 2;
|
|
|
|
|
}
|
|
|
|
|
if (this.form.id != null) {
|
|
|
|
|
updatePerson(this.form).then((response) => {
|
|
|
|
|
this.open = false;
|
|
|
|
@ -431,11 +459,11 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
filterIcon(credentialNo) {
|
|
|
|
|
let sex = this.getGender(credentialNo);
|
|
|
|
|
if (sex == "男") {
|
|
|
|
|
return require("@/assets/images/ui/img_man@2x.png");
|
|
|
|
|
} else {
|
|
|
|
|
let sex = validateAndParseIDCard(credentialNo, "性别");
|
|
|
|
|
if (sex == "女") {
|
|
|
|
|
return require("@/assets/images/ui/img_woman@2x.png");
|
|
|
|
|
} else {
|
|
|
|
|
return require("@/assets/images/ui/img_man@2x.png");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
@ -456,109 +484,13 @@ export default {
|
|
|
|
|
houseId: this.houseItem.id,
|
|
|
|
|
deptId: this.houseItem.deptId,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.list = handleColor(res.rows);
|
|
|
|
|
this.total = res.total;
|
|
|
|
|
this.show = true;
|
|
|
|
|
},
|
|
|
|
|
isValidID(id) {
|
|
|
|
|
// 校验长度和基本格式
|
|
|
|
|
if (!/^\d{15}|\d{18}$/.test(id)) return false;
|
|
|
|
|
|
|
|
|
|
// 将15位升级为18位
|
|
|
|
|
if (id.length === 15) {
|
|
|
|
|
id =
|
|
|
|
|
id.substr(0, 6) + "19" + id.substr(6) + this.calculateCheckDigit(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 验证18位身份证的校验位
|
|
|
|
|
return this.validateID18(id);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
validateID18(id) {
|
|
|
|
|
if (!/^\d{17}[\dXx]$/.test(id)) return false;
|
|
|
|
|
|
|
|
|
|
// 校验码计算
|
|
|
|
|
const checkDigits = "10X98765432";
|
|
|
|
|
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
|
|
|
let sum = 0;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 17; i++) {
|
|
|
|
|
sum += id[i] * weights[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const checkDigit = checkDigits[sum % 11];
|
|
|
|
|
return checkDigit.toUpperCase() === id[17].toUpperCase();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
calculateCheckDigit(id) {
|
|
|
|
|
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
|
|
|
|
|
const checkDigits = "10X98765432";
|
|
|
|
|
let sum = 0;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < id.length; i++) {
|
|
|
|
|
sum += id[i] * weights[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return checkDigits[sum % 11];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
calculateAge(id) {
|
|
|
|
|
if (!this.isValidID(id)) return "Invalid ID";
|
|
|
|
|
|
|
|
|
|
let birthDate;
|
|
|
|
|
if (id.length === 18) {
|
|
|
|
|
// 从18位身份证中提取出生日期
|
|
|
|
|
birthDate = id.substr(6, 8);
|
|
|
|
|
} else if (id.length === 15) {
|
|
|
|
|
// 从15位身份证中提取出生日期
|
|
|
|
|
birthDate = "19" + id.substr(6, 6);
|
|
|
|
|
} else {
|
|
|
|
|
return "Invalid ID length";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 格式化出生日期
|
|
|
|
|
birthDate = birthDate.replace(/(.{4})(.{2})/, "$1-$2-");
|
|
|
|
|
const birth = new Date(birthDate);
|
|
|
|
|
const today = new Date();
|
|
|
|
|
let age = today.getFullYear() - birth.getFullYear();
|
|
|
|
|
|
|
|
|
|
// 计算是否已过生日
|
|
|
|
|
if (
|
|
|
|
|
today.getMonth() + 1 < birth.getMonth() + 1 ||
|
|
|
|
|
(today.getMonth() + 1 === birth.getMonth() + 1 &&
|
|
|
|
|
today.getDate() < birth.getDate())
|
|
|
|
|
) {
|
|
|
|
|
age--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return age;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
extractBirthMonth(id) {
|
|
|
|
|
if (!this.isValidID(id)) return "Invalid ID";
|
|
|
|
|
|
|
|
|
|
let birthDate;
|
|
|
|
|
if (id.length === 18) {
|
|
|
|
|
// 从18位身份证中提取出生日期
|
|
|
|
|
birthDate = id.substr(6, 8);
|
|
|
|
|
} else if (id.length === 15) {
|
|
|
|
|
// 从15位身份证中提取出生日期
|
|
|
|
|
birthDate = "19" + id.substr(6, 6);
|
|
|
|
|
} else {
|
|
|
|
|
return "Invalid ID length";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 格式化出生日期为 YYYY-MM
|
|
|
|
|
birthDate = birthDate.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2");
|
|
|
|
|
return birthDate;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getGender(id) {
|
|
|
|
|
if (!this.isValidID(id)) return "Invalid ID";
|
|
|
|
|
|
|
|
|
|
// 在18位身份证中,第17位为性别标识
|
|
|
|
|
return parseInt(id[16]) % 2 === 0 ? "女" : "男";
|
|
|
|
|
filterCarId(carId, type) {
|
|
|
|
|
return validateAndParseIDCard(carId, type);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
@ -685,7 +617,8 @@ div {
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.house-name {
|
|
|
|
|
.house-name,
|
|
|
|
|
.hose-update {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|