epmet 工作端 小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

843 lines
24 KiB

// subpages/addResi/pages/addResi/addResi.js
import api from "../../../../utils/api"
var http = require('../../../../utils/request.js')
import {
cardHide
} from "../../../../utils/util"
import {
$wuxSelect
} from '../../../../components/dist/index'
import {
dictlist,
getHouseType,
getOldPeopleDetailById,
getVeteranDetailById,
getVolunteerDetailById,
publicWelfarePost,
residentEnsureHouse,
residentSpecial,
residentTenant,
residentUnemployed,
residentUnitedFront,
specialSupport
} from "../../../../utils/statisticsApi";
const app = getApp()
Page({
data: {
stepsList: [{
text: '居住房屋',
desc: '',
},
{
text: '基础信息',
desc: '',
},
{
text: '拓展信息',
desc: '',
},
{
text: '人员标签',
desc: '',
},
], //步骤条数据
activeForm: 2,
/** 步骤条状态 */
form: {
baseInfoDto: {
name: null, //姓名
idType: null, //证件类型
idNum: null, //身份证号
nationality: null, //国籍
mobile: null, //手机号
gender: null, //性别
birthday: null, //出生日期
nation: null, //民族
localResidenceFlag: 0, //是否本地户籍
nativePlace: null, //籍贯,
remark: null, //备注
categoryInfo: {
partyFlag: 0,
subsistenceAllowanceFlag: 0,
ensureHouseFlag: 0,
unemployedFlag: 0,
fertileWomanFlag: 0,
veteranFlag: 0,
unitedFrontFlag: 0,
petitionOfficerFlag: 0,
volunteerFlag: 0,
oldPeopleFlag: 0,
emptyNesterFlag: 0,
specialSupportFlag: 0,
disabledFlag: 0,
dementedFlag: 0,
disabilityFlag: 0,
seriousIllnessFlag: 0,
chronicDiseaseFlag: 0,
specialCrowdFlag: 0,
tenantFlag: 0,
floatingFlag: 0,
liveAloneFlag: 0,
publicWelfareFlag: 0,
buildingChiefFlag: 0,
unitChiefFlag: 0,
riskyFlag: 0,
delFlag: 0,
},
},
eduInfoDto: {
cultureLevel: null, //文化程度
},
familyInfoDto: {
marriage: null, //婚姻状况
spouseSituation: null, //配偶情况
elderlyFlag: null, //有无赡养人
elderlyRelation: null, //与赡养人关系
dependantMobile: null, //赡养人联系电话
},
resideInfoDtos: [{
gridName: null,
agencyName: null,
agencyId: null,
gridId: null, //所属网格id
villageId: null, //小区id
buildId: null, //楼栋id
unitId: null, //单元id
moveOutFlag: null,
outOfTime: null, //迁出时间
homeId: null, //房屋id
placeOfDomicile: null, //户籍所在地
currentResidence: null, //现居住地
householdSituation: null, //人户状况
houseHolderRel: null, //与户主关系
resiHouseRel: null, //人房关系
optionsV: [],
optionsB: [],
optionsH: [],
optionsD: [],
},
],
religionDto: {
religion: null, //宗教信仰
},
workInfoDto: {
careerStatus: null, //就业状况
workUnit: null, //工作单位
occupation: null, //职业
},
specialDto: {
specialCategoryCodes: [],
},
unemployedDto: {
originWorkUnit: null, //原工作单位
unemploymentTime: null, //失业时间yyyy-MM-dd
unemploymentNum: null, //失业证号
employmentNum: null, //再就业优惠证号
specialSkill: null, //技术特长
unempCompensationFlag: null, //是否领取失业补助金
unemploymentReason: null, //失业原因【字典表】code
employmentHardFlag: null, //是否就业困难对象;1是0不是
employmentWish: null, //劳动能力就业愿望
},
healthyDto:{ //健康状况
disabilityFlag:null, //残疾
seriousIllnessFlag:null, //大病
chronicDiseaseFlag:null, //慢病
deathFlag:null, //死亡
},
attentionResiDto:{// 关注人群
oldPeopleFlag:null, //老年人
subsistenceAllowanceFlag:null, //低保
veteranFlag:null, //退役军人
ensureHouseFlag:null, //保障房人员
fertileWomanFlag:null, //育龄妇女
specialSupportFlag:null, //特扶人员
},
specialResiDto:{ //特殊人群
specialResiFlag:null,
},
identityDto:{ //身份信息
volunteerFlag:null, //志愿者
buildingChiefFlag:null, //楼长
unitChiefFlag:null, //单元长
publicWelfareFlag:null, //公益岗
},
economyDto: {
monthIncome: null, //月收入
},
},
resiHouseRelList: [{
label: "自住",
value: 0,
},
{
label: "租住",
value: 1,
},
],
gridList: [], //网格列表
agencyId: null,
dicts: {
educationList: [], //文化程度
nationList: [], //民族
nationalityList: [], //国籍
marriageList: [], //婚姻状况
householdSituationList: [], //人户状况
houseHolderRelList: [], //与户主关系
careerStatusList: [], //就业状况
spouseSituationList: [], //配偶情况
unemploymentReasonList: [], //失业原因
employmentWishList: [], //就业意愿
genderList: [{ label: '男', value: '1' }, { label: '女', value: '2' }],
idTypeList : [
{
label: '其他',
value: 0
},
{
label: '身份证',
value: 1
},
{
label: '护照',
value: 2
},
{
label: '港澳通行证',
value: 3
},
{
label: '军人证',
value: 4
},
{
label: '台胞证',
value: 5
}
],
binaryOptionList : [
{
label: '是',
value: 1
},
{
label: '否',
value: 0
}
]
},
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: async function (options) {
this.setData({
agencyId: app.globalData.user.agencyId,
'form.resideInfoDtos[0].agencyId': app.globalData.user.agencyId,
'form.resideInfoDtos[0].agencyName': app.globalData.user.agencyName,
// day: `${year}-${month}-${day}`
})
await this.getGridoptionDict()
this.getDicts()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {},
backStep() {
this.setData({
activeForm: this.data.activeForm - 1
})
},
nextStep: async function () {
if (this.data.activeForm === 0) {
// if (!this.data.form.gridId) {
// this.showToast('请选择所在网格')
// return
// }
// if (!this.data.form.villageId) {
// this.showToast('请选择所在小区')
// return
// }
// if (!this.data.form.buildId) {
// this.showToast('请选择所在楼栋')
// return
// }
// if (!this.data.form.unitId) {
// this.showToast('请选择所在单元')
// return
// }
// if (!this.data.form.homeId) {
// this.showToast('请选择所在房屋')
// return
// }
this.setData({
activeForm: 1
})
} else if (this.data.activeForm === 1) {
// if (!this.data.form.name) {
// this.showToast('请填写姓名')
// return
// }
// if (!this.data.form.idNum) {
// this.showToast('请填写证件号')
// return
// }
// if (!this.data.form.birthday) {
// this.showToast('请选择出生日期')
// return
// }
// if (!this.data.form.gender) {
// this.showToast('请选择性别')
// return
// }
// if (!this.data.form.mobile) {
// this.showToast('请填写联系电话')
// return
// }
this.setData({
activeForm: 2
})
} else if (this.data.activeForm === 2) {
this.setData({
activeForm: 3
})
}
// console.log(this.data.isShowIdNum,this.data.formType != 'edit')
// const parm = {
// ...this.data.form,
// }
// if (this.data.formType == 'edit') {
// parm.resiId = this.data.resiId
// try {
// const res = await api.resiEdit(parm)
// if (res.code === 0) {
// wx.showToast({
// title: '编辑成功',
// duration: 3000,
// success: function () {
// setTimeout(() => {
// wx.navigateBack({
// delta: 1
// })
// }, 3000)
// }
// })
// }
// } catch (err) {
// console.log(err);
// }
// } else {
// try {
// const res = await api.resiAdd(parm)
// if (res.code === 0) {
// wx.showToast({
// title: '新增成功',
// duration: 3000,
// success: function () {
// setTimeout(() => {
// wx.navigateBack({
// delta: 1
// })
// }, 3000)
// }
// })
// }
// } catch (err) {
// console.log(err);
// }
// }
},
async getDicts() {
try {
const requests = [
http.post("sys/dict/data/dictlist", {
dictType: "nationality",
}),
http.post("sys/dict/data/nation", {
formCode: "resi_base_info",
}),
http.post("sys/dict/data/education", {
formCode: "resi_base_info",
}),
http.post("sys/dict/data/dictlist", {
dictType: "marriage",
}),
http.post("sys/dict/data/dictlist", {
dictType: "household_situation",
}),
http.post("sys/dict/data/relationship", {
formCode: "resi_base_info",
}),
http.post("sys/dict/data/dictlist", {
dictType: "career_status",
}),
http.post("sys/dict/data/dictlist", {
dictType: "spouse_situation",
}),
http.post("sys/dict/data/dictlist", {
dictType: "unemployment_reason",
}),
http.post("sys/dict/data/dictlist", {
dictType: "career_goals",
}),
];
const dictKeys = [
"nationalityList",
"nationList",
"educationList",
"marriageList",
"householdSituationList",
"houseHolderRelList",
"careerStatusList",
"spouseSituationList",
"unemploymentReasonList",
"employmentWishList",
]; // 对应的键名
const results = await Promise.all(requests);
results.forEach((result, index) => {
if (result.code === 0) {
this.setData({
[`dicts.${dictKeys[index]}`]: [...result.data]
})
} else {
console.log(`获取${dictKeys[index]}失败: ${result.data.msg}`);
}
});
} catch (error) {
console.log("获取字典失败: ", error);
}
},
//** 房屋逻辑start */
getGridoptionDict() {
console.log(this.data);
let parm = {
agencyId: this.data.agencyId,
purpose: 'addorupdate'
}
api.getGridoptionDict(parm).then(res => {
this.setData({
gridList: res.data
})
}).catch(err => {
console.log(err);
})
},
bindPickerChangeGrid(e) {
let indexP = e.currentTarget.dataset.indexp;
const selectedIndex = e.detail.value;
const selectedVillage = this.data.gridList[selectedIndex];
this.setData({
['form.resideInfoDtos[' + indexP + '].gridName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].gridId']: selectedVillage.value,
['form.resideInfoDtos[' + indexP + '].villageName']: null,
['form.resideInfoDtos[' + indexP + '].optionsV']: [],
['form.resideInfoDtos[' + indexP + '].villageId']: null,
['form.resideInfoDtos[' + indexP + '].buildId']: null,
['form.resideInfoDtos[' + indexP + '].optionsB']: [],
['form.resideInfoDtos[' + indexP + '].buildingName']: null,
['form.resideInfoDtos[' + indexP + '].unitName']: null,
['form.resideInfoDtos[' + indexP + '].optionsD']: [],
['form.resideInfoDtos[' + indexP + '].unitId']: null,
['form.resideInfoDtos[' + indexP + '].unitName']: null,
['form.resideInfoDtos[' + indexP + '].homeId']: null,
['form.resideInfoDtos[' + indexP + '].houseName']: null,
['form.resideInfoDtos[' + indexP + '].optionsH']: []
});
this.getQuartersOptions(selectedVillage.value, indexP);
},
bindPickerChangevillageId(e) {
let indexP = e.currentTarget.dataset.indexp
const selectedIndex = e.detail.value;
const selectedVillage = this.data.form.resideInfoDtos[indexP].optionsV[selectedIndex];
this.setData({
['form.resideInfoDtos[' + indexP + '].villageId']: selectedVillage.value,
['form.resideInfoDtos[' + indexP + '].villageName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].buildId']: null,
['form.resideInfoDtos[' + indexP + '].optionsB']: [],
['form.resideInfoDtos[' + indexP + '].buildingName']: null,
['form.resideInfoDtos[' + indexP + '].unitName']: null,
['form.resideInfoDtos[' + indexP + '].optionsD']: [],
['form.resideInfoDtos[' + indexP + '].unitId']: null,
['form.resideInfoDtos[' + indexP + '].unitName']: null,
['form.resideInfoDtos[' + indexP + '].homeId']: null,
['form.resideInfoDtos[' + indexP + '].houseName']: null,
['form.resideInfoDtos[' + indexP + '].optionsH']: []
});
this.getBuildingoption(selectedVillage.value, indexP);
},
bindPickerChangebuilding(e) {
let indexP = e.currentTarget.dataset.indexp
const selectedIndex = e.detail.value;
const selectedVillage = this.data.form.resideInfoDtos[indexP].optionsB[selectedIndex];
this.setData({
['form.resideInfoDtos[' + indexP + '].buildingName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].buildId']: selectedVillage.value,
['form.resideInfoDtos[' + indexP + '].unitId']: null,
['form.resideInfoDtos[' + indexP + '].unitName']: null,
['form.resideInfoDtos[' + indexP + '].optionsD']: [],
['form.resideInfoDtos[' + indexP + '].homeId']: null,
['form.resideInfoDtos[' + indexP + '].houseName']: null,
['form.resideInfoDtos[' + indexP + '].optionsH']: []
});
this.getUnitoption(selectedVillage.value, indexP);
},
bindPickerChangeUnit(e) {
let indexP = e.currentTarget.dataset.indexp
const selectedIndex = e.detail.value;
const selectedVillage = this.data.form.resideInfoDtos[indexP].optionsD[selectedIndex];
this.setData({
['form.resideInfoDtos[' + indexP + '].unitName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].unitId']: selectedVillage.value,
['form.resideInfoDtos[' + indexP + '].homeId']: null,
['form.resideInfoDtos[' + indexP + '].houseName']: null,
['form.resideInfoDtos[' + indexP + '].optionsH']: [],
});
this.getHouseoption(selectedVillage.value, indexP);
},
bindPickerChangeHouse(e) {
let indexP = e.currentTarget.dataset.indexp
const selectedIndex = e.detail.value;
const selectedVillage = this.data.form.resideInfoDtos[indexP].optionsH[selectedIndex];
this.setData({
['form.resideInfoDtos[' + indexP + '].houseName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].homeId']: selectedVillage.value
});
},
getQuartersOptions(gridId, indexP) {
let parm = {
gridId,
agencyId: this.data.agecyId
}
api.getQuartersOptions(parm).then(res => {
this.setData({
['form.resideInfoDtos[' + indexP + '].optionsV']: res.data
})
}).catch(err => {
console.log(err);
})
},
getBuildingoption(villageId, indexP) {
api.getBuildingoption(villageId).then(res => {
this.setData({
['form.resideInfoDtos[' + indexP + '].optionsB']: res.data
})
}).catch(err => {
console.log(err);
})
},
getUnitoption(buildingId, indexP) {
api.getUnitoption(buildingId).then(res => {
this.setData({
['form.resideInfoDtos[' + indexP + '].optionsD']: res.data
})
}).catch(err => {
console.log(err);
})
},
getHouseoption(unitId, indexP) {
api.getHouseoption(unitId).then(res => {
this.setData({
['form.resideInfoDtos[' + indexP + '].optionsH']: res.data
})
}).catch(err => {
console.log(err);
})
},
bindPickerChangeResiHouseRel(e) {
this.setData({
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].resiHouseRel']: this.data.resiHouseRelList[e.detail.value].value,
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].resiHouseRelName']: this.data.resiHouseRelList[e.detail.value].label,
})
},
bindPickerChangehouseHolderRel(e) {
this.setData({
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].houseHolderRel']: this.data.dicts.houseHolderRelList[e.detail.value].value,
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].houseHolderRelName']: this.data.dicts.houseHolderRelList[e.detail.value].label,
})
},
bindCurrentResidenceInput(e) {
this.setData({
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].currentResidence']: e.detail.value,
})
},
bindPlaceOfDomicileInput(e){
this.setData({
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].placeOfDomicile']: e.detail.value,
})
},
bindOutOfTimeChange(e){
this.setData({
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].outOfTime']: e.detail.value,
})
},
delHouse(e){
this.data.form.resideInfoDtos = this.data.form.resideInfoDtos.filter((item, index) => index != e.currentTarget.dataset.indexp)
this.setData({
'form.resideInfoDtos':this.data.form.resideInfoDtos
})
},
addHouse(){
this.data.form.resideInfoDtos.push(
{
// agencyName: this.$store.state.user.agencyName,
// agencyId: this.$store.state.user.agencyId,
gridId: null,//所属网格id
villageId: null,//小区id
buildId: null,//楼栋id
unitId: null,//单元id
moveOutFlag: null,
outOfTime: null,//迁出时间
homeId: null, //房屋id
placeOfDomicile: null,//户籍所在地
currentResidence: null,//现居住地
householdSituation: null,//人户状况
houseHolderRel: null,//与户主关系
resiHouseRel: null,//人房关系
optionsV: [],
optionsB: [],
optionsH: [],
optionsD: [],
}
)
this.setData({
'form.resideInfoDtos':this.data.form.resideInfoDtos
})
},
//**房屋逻辑end */
//**基础信息start */
bindNameInput(e){
this.setData({
['form.baseInfoDto.name']: e.detail.value,
})
},
bindPickerChangeIdType(e){
const selectedIndex = e.detail.value;
const selectedVillage = this.data.dicts.idTypeList[selectedIndex]
this.setData({
idTypeName:selectedVillage.label,
'form.baseInfoDto.idType':selectedVillage.value
})
},
bindIdNumInput(e){
this.setData({
'form.baseInfoDto.name': e.detail.value,
})
},
bindPickerChangeNationality(e){
const selectedIndex = e.detail.value;
const selectedVillage = this.data.dicts.nationalityList[selectedIndex]
this.setData({
nationalityName:selectedVillage.label,
'form.baseInfoDto.nationality':selectedVillage.value
})
},
bindMobileInput(e){
this.setData({
'form.baseInfoDto.mobile': e.detail.value,
})
},
bindPickerChangeGender(){
this.setData({
genderName: this.data.genderList[e.detail.value].label,
"form.gender": this.data.genderList[e.detail.value].value
})
},
bindDateChange(e) {
this.setData({
'form.baseInfoDto.birthday': e.detail.value
})
},
bindPickerChangeNation(e) {
this.setData({
"form.baseInfoDto.nation": this.data.dicts.nationList[e.detail.value].value
})
},
bindPickerChangeEducation(e){
this.setData({
"form.eduInfoDto.cultureLevel": this.data.dicts.educationList[e.detail.value].value
})
},
bindPickerChangeMarriage(e) {
this.setData({
"form.familyInfoDto.marriage": this.data.dicts.marriageList[e.detail.value].value,
marriageName: this.data.dicts.marriageList[e.detail.value].label,
})
},
bindPickerChangeSpouse(e){
this.setData({
"form.familyInfoDto.spouseSituation": this.data.dicts.spouseSituationList[e.detail.value].value,
spouseSituationName: this.data.dicts.spouseSituationList[e.detail.value].label,
})
},
bindNativePlaceInput(e) {
this.setData({
'form.baseInfoDto.nativePlace': e.detail.value
})
},
bindLocalResidenceFlag(e){
this.setData({
'form.baseInfoDto.localResidenceFlag': e.detail.value
})
},
//**基础信息end */
//**拓展信息start */
bindReligionInput(e) {
this.setData({
"form.religionDto.religion": e.detail.value
})
},
bindCareerStatus(e){
this.setData({
"form.workInfoDto.careerStatus":this.data.dicts.careerStatusList[e.detail.value].value,
careerStatusName:this.data.dicts.careerStatusList[e.detail.value].label
})
},
bindWorkUnit(e){
this.setData({
"form.workInfoDto.workUnit": e.detail.value
})
},
bindWorkOccupation(e){
this.setData({
"form.workInfoDto.occupation": e.detail.value
})
},
bindMonthIncome(e){
this.setData({
"form.economyDto.monthIncome": e.detail.value
})
},
bindOriginWorkUnit(e){
this.setData({
"form.unemployedDto.originWorkUnit": e.detail.value
})
},
bindUnemploymentTime(e){
this.setData({
"form.unemployedDto.unemploymentTime": e.detail.value
})
},
bindUnemploymentNum(e){
this.setData({
"form.unemployedDto.unemploymentNum": e.detail.value
})
},
bindUnemploymentReason(e){
this.setData({
"form.unemployedDto.unemploymentReason":this.data.dicts.unemploymentReasonList[e.detail.value].value,
unemploymentReasonName:this.data.dicts.unemploymentReasonList[e.detail.value].label
})
},
bindEmploymentNum(e){
this.setData({
"form.unemployedDto.employmentNum": e.detail.value
})
},
bindSpecialSkill(e){
this.setData({
"form.unemployedDto.specialSkill": e.detail.value
})
},
bindUnempCompensationFlag(e){
this.setData({
"form.unemployedDto.unempCompensationFlag": Number(e.detail.value)
})
},
bindEmploymentHardFlag(e){
this.setData({
"form.unemployedDto.employmentHardFlag": Number(e.detail.value)
})
},
bindEmploymentWish(e){
this.setData({
"form.unemployedDto.employmentWish":this.data.dicts.employmentWishList[e.detail.value].value,
employmentWishName:this.data.dicts.employmentWishList[e.detail.value].label
})
},
bindElderlyRelation(e){
this.setData({
"form.familyInfoDto.elderlyRelation":this.data.dicts.houseHolderRelList[e.detail.value].value,
elderlyRelationName:this.data.dicts.houseHolderRelList[e.detail.value].label
})
},
bindDependantMobile(e){
this.setData({
"form.familyInfoDto.dependantMobile": e.detail.value
})
},
//**拓展信息end */
//**人员标签start */
bindResiLabelFlag(e){
let flagLabel = e.currentTarget.dataset.field.toString();
this.setData({
[flagLabel]: Number(e.detail.value)
})
},
showDetailForm(e){
console.log(e.currentTarget.dataset.field);
}
//**人员标签end */
})