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.

1472 lines
42 KiB

// subpages/addResi/pages/addResi/addResi.js
import api from "../../../../utils/api"
var http = require('../../../../utils/request.js')
var fly = require('../../../../utils/request')
const App = getApp()
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: '',
inactiveIcon: 'checked',
activeIcon: 'arrow',
},
{
text: '基础信息',
desc: '',
inactiveIcon: 'checked',
activeIcon: 'arrow',
},
{
text: '拓展信息',
desc: '',
inactiveIcon: 'checked',
activeIcon: 'arrow',
},
{
text: '人员标签',
desc: '',
inactiveIcon: 'checked',
activeIcon: 'arrow',
},
], //步骤条数据
activeForm: 0,
/** 步骤条状态 */
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: [], //就业意愿
specialResidentCategory:[],//特殊人群
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
}
]
},
showExpand: false,
expandFormList: [],
orgList: [
{
id: "healthyDto",
children: [
{
label: "残疾类别",
itemType: "select",
formNameP: "healthDto",
formName: "disabilityCategoryCode",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "disability_category_code" },
opction: [],
},
{
label: "残疾等级",
itemType: "select",
formNameP: "healthDto",
formName: "disabilityLevel",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "disability_level" },
opction: [],
},
{
label: "残疾证号",
formNameP: "healthDto",
itemType: "input",
formName: "disabilityNum",
},
{
label: "残疾说明",
formNameP: "healthDto",
itemType: "input",
formName: "disabilityDesc",
},
{
label: "监护人",
itemType: "radio",
formNameP: "healthDto",
formName: "guardianFlag",
opction: [
{ label: "有", formName: "", value: 1 },
{ label: "无", formName: "", value: 0 },
],
},
{
label: "监护人姓名",
formNameP: "healthDto",
itemType: "input",
formName: "guardianName",
},
{
label: "监护人联系电话",
formNameP: "healthDto",
itemType: "input",
formName: "guardianMobile",
},
{
label: "技能特长",
formNameP: "healthDto",
itemType: "radio",
formName: "specialSkillFlag",
opction: [
{ label: "有", formName: "", value: 1 },
{ label: "无", formName: "", value: 0 },
],
},
{
label: "劳动能力",
formNameP: "healthDto",
itemType: "radio",
formName: "workCapacityFlag",
opction: [
{ label: "有", formName: "", value: 1 },
{ label: "无", formName: "", value: 0 },
],
},
],
},
{
id: "seriousIllnessDto",
children: [
{
label: "所患大病",
itemType: "checkbox",
formName: "illnessCodes",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "illness_code" },
opction: [],
formNameP: "seriousIllnessDto",
},
],
},
{
id: "chronicDiseaseDto",
children: [
{
label: "所患慢病",
itemType: "checkbox",
formName: "chronicDiseaseCodes",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "chronic_disease_code" },
opction: [],
formNameP: "chronicDiseaseDto",
},
],
},
{
id: "deathDto",
children: [
{
label: "死亡时间",
itemType: "datepicker",
formName: "deathTime",
formNameP: "deathDto",
},
],
},
{
id: "oldPeopleDto",
children: [
{
label: "老年人分类",
itemType: "checkbox",
formName: "oldPeopleCategories",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "oldPeople_categories" },
formNameP: "oldPeopleDto",
opction:[]
},
{
label: "居住情况",
itemType: "select",
formName: "resideSituation",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "reside_situation" },
formNameP: "oldPeopleDto",
},
{
label: "高龄补助",
itemType: "inputNum",
formName: "oldSubsidy",
formNameP: "oldPeopleDto",
},
],
},
{
id: "subsistenceAllowanceDto",
children: [
{
label: "低保类别",
itemType: "select",
formName: "category",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "subsistence_allowance_category" },
formNameP: "subsistenceAllowanceDto",
},
{
label: "低保享受原因",
itemType: "checkbox",
formName: "reasons",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "subsistence_allowance_reasons" },
opction: [],
formNameP: "subsistenceAllowanceDto",
},
],
},
{
id: "parymemberInfoDto",
children: [
{
label: "入党时间",
itemType: "datepicker",
formName: "joinTime",
formNameP: "parymemberInfoDto",
opction: [],
},
{
label: "转正时间",
itemType: "datepicker",
formName: "positiveTime",
formNameP: "parymemberInfoDto",
opction: [],
},
{
label: "所属党组织",
itemType: "cascader1",
formName: "partyOrgId",
formNameP: "parymemberInfoDto",
opction: [],
},
{
label: "流动党员",
itemType: "radio",
formName: "flowFlag",
formNameP: "parymemberInfoDto",
opction: [
{ label: "是", value: 1 },
{ label: "否", value: 0 },
],
},
{
label: "流动党员活动证号",
itemType: "input",
formName: "flowActNum",
formNameP: "parymemberInfoDto",
},
{
label: "职务",
itemType: "select",
formName: "partyJob",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "party_job" },
formNameP: "parymemberInfoDto",
opction: [],
},
{
label: "工作职责",
itemType: "input",
formName: "duty",
formNameP: "parymemberInfoDto",
},
{
label: "是否退休",
itemType: "radio",
formName: "retiredFlag",
formNameP: "parymemberInfoDto",
opction: [
{ label: "是", value: 1 },
{ label: "否", value: 0 },
],
},
{
label: "党员中心户",
itemType: "radio",
formName: "centerFlag",
formNameP: "parymemberInfoDto",
opction: [
{ label: "是", value: 1 },
{ label: "否", value: 0 },
],
},
{
label: "免学习",
itemType: "radio",
formName: "studyNotNeed",
formNameP: "parymemberInfoDto",
opction: [
{ label: "是", value: 1 },
{ label: "否", value: 0 },
],
},
{
label: "入党时所在党支部",
itemType: "input",
formName: "joinBranchName",
formNameP: "parymemberInfoDto",
},
{
label: "组织关系转入社区时间",
itemType: "datepicker",
formName: "joinCommunityTime",
formNameP: "parymemberInfoDto",
opction: [],
},
],
},
{
id: "ensureHouseDto",
children: [
{
label: "所在社区",
itemType: "input",
formName: "liveCommunity",
formNameP: "ensureHouseDto",
},
{
label: "住房性质",
itemType: "select",
formName: "housingNature",
opctionUrl: "sys/dict/data/house",
opctionParams: { formCode: "resi_base_info" },
formNameP: "ensureHouseDto",
opction: [],
},
],
},
{
id: "veteranDto",
children: [
{
label: "入伍时间",
itemType: "datepicker",
formName: "joinArmyTime",
formNameP: "veteranDto",
opction: [],
},
{
label: "退伍时间",
itemType: "datepicker",
formName: "leaveArmyTime",
formNameP: "veteranDto",
opction: [],
},
{
label: "服役单位",
itemType: "input",
formName: "serviceUnit",
formNameP: "veteranDto",
},
{
label: "接收单位",
itemType: "input",
formName: "receiveUnit",
formNameP: "veteranDto",
},
{
label: "待安置补助金",
itemType: "inputNum",
formName: "settlementAmount",
formNameP: "veteranDto",
opction: [],
},
{
label: "培训状况",
itemType: "input",
formName: "trainDesc",
formNameP: "veteranDto",
},
{
label: "现就业情况",
itemType: "input",
formName: "employmentSituation",
formNameP: "veteranDto",
},
{
label: "是否办理公益性岗位",
itemType: "radio",
formName: "pubWelfareJobFlag",
formNameP: "veteranDto",
opction: [
{ label: "是", value: 1 },
{ label: "否", value: 0 },
],
},
],
},
{
id: "unitedFrontDto",
children: [
{
label: "统战类型",
itemType: "input",
formNameP: "unitedFrontDto",
formName: "unitedFrontType",
},
],
},
{
id: "volunteerDto",
children: [
{
label: "志愿者类别",
itemType: "checkbox",
formName: "volunteerCategory",
formNameP: "volunteerDto",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "VOLUNTEER_CATEGORY" },
opction: [],
},
],
},
{
id: "specialSupportDto",
children: [
{
label: "特扶类别",
itemType: "select",
formName: "specialSupportType",
formNameP: "specialSupportDto",
opction: [
{
value: "1",
label: "失独",
},
{
value: "2",
label: "伤残",
},
],
},
{
//1
label: "子女姓名",
itemType: "input",
formName: "childName",
formNameP: "specialSupportDto",
opction: [],
},
{
//2
label: "子女性别",
itemType: "select",
formName: "childGender",
formNameP: "specialSupportDto",
opction: [
{
value: "1",
label: "男",
},
{
value: "2",
label: "女",
},
],
},
{
label: "子女死亡日期",
itemType: "datepicker",
formName: "childDeathDate",
formNameP: "specialSupportDto",
opction: [],
},
{
label: "子女伤残类别",
itemType: "select",
formName: "childDisabilityCategoryCode",
opctionUrl: "sys/dict/data/dictlist",
formNameP: "specialSupportDto",
opctionParams: { dictType: "disability_category_code" },
opction: [],
},
{
label: "子女伤残等级",
itemType: "select",
formNameP: "specialSupportDto",
formName: "childDisabilityLevel",
opctionUrl: "sys/dict/data/dictlist",
opctionParams: { dictType: "disability_level" },
opction: [],
},
],
},
],
popupTitle: '新增'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: async function (options) {
if(options.type === 'edit'){
this.setData({
resiId:options.resiId
})
this.userXiangQ(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) {
let gridId = this.data.form.resideInfoDtos.filter(obj => !obj.gridId);
let villageId = this.data.form.resideInfoDtos.filter(obj => !obj.villageId);
let buildingId = this.data.form.resideInfoDtos.filter(obj => !obj.buildId);
let unitId = this.data.form.resideInfoDtos.filter(obj => !obj.unitId);
let houseId = this.data.form.resideInfoDtos.filter(obj => !obj.houseId);
if(gridId.length>=1){
this.showToast('请选择所属组织')
return false
}else if (villageId.length>=1){
this.showToast('请选择所在小区')
return false
}else if (buildingId.length>=1){
this.showToast('请选择所在楼栋')
return false
}else if(unitId.length>=1){
this.showToast('请选择所在单元')
}else if(houseId.legnth>= 1){
this.showToast('请选择所在门牌号')
}
this.setData({
activeForm: 1
})
} else if (this.data.activeForm === 1) {
if (!this.data.form.baseInfoDto.name) {
this.showToast('请填写姓名')
return
}
if (!this.data.form.baseInfoDto.idNum) {
this.showToast('请填写证件号')
return
}
if (!this.data.form.baseInfoDto.birthday) {
this.showToast('请选择出生日期')
return
}
if (!this.data.form.baseInfoDto.gender) {
this.showToast('请选择性别')
return
}
if (!this.data.form.baseInfoDto.mobile) {
this.showToast('请填写联系电话')
return
}
this.setData({
activeForm: 2
})
} else if (this.data.activeForm === 2) {
this.setData({
activeForm: 3
})
}
// 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);
// }
// }
},
showToast(title) {
wx.showToast({
title: title,
duration: 2000,
icon: 'none'
})
},
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",
}),
http.post("sys/dict/data/dictlist", {
dictType: "special_resident_category",
}),
];
const dictKeys = [
"nationalityList",
"nationList",
"educationList",
"marriageList",
"householdSituationList",
"houseHolderRelList",
"careerStatusList",
"spouseSituationList",
"unemploymentReasonList",
"employmentWishList",
"specialResidentCategory"
]; // 对应的键名
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:App.globalData.user.agencyId
}
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,
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].householdSituation']:this.data.resiHouseRelList[e.detail.value].value == '0'?'rhyz':'rzhbz',
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].householdSituationName']: this.data.dicts.householdSituationList[e.detail.value == 1?1:0].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,
})
},
bindPickerChangeHouseholdSituation(e){
this.setData({
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].householdSituation']: this.data.dicts.householdSituationList[e.detail.value].value,
['form.resideInfoDtos[' + e.currentTarget.dataset.indexp + '].householdSituationName']: this.data.dicts.householdSituationList[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
})
},
close(){
wx.navigateBack({
delta:1
})
},
//**房屋逻辑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.idNum': e.detail.value,
})
},
bindPickerChangeNationality(e) {
const selectedIndex = e.detail.value;
const selectedVillage = this.data.dicts.nationalityList[selectedIndex]
this.setData({
'form.baseInfoDto.nationalityName': selectedVillage.label,
'form.baseInfoDto.nationality': selectedVillage.value
})
},
bindMobileInput(e) {
this.setData({
'form.baseInfoDto.mobile': e.detail.value,
})
},
bindPickerChangeGender(e) {
this.setData({
'form.baseInfoDto.genderName': this.data.dicts.genderList[e.detail.value].label,
"form.baseInfoDto.gender": this.data.dicts.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,
"form.familyInfoDto.spouseSituation":null
})
},
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
})
},
bindElderlyFlag(e){
this.setData({
"form.familyInfoDto.elderlyFlag": this.data.dicts.employmentWishList[e.detail.value].value,
employmentWishName: this.data.dicts.employmentWishList[e.detail.value].label
})
console.log(this.data.form);
},
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 */
bindPartyFlag(e){
this.setData({
'form.baseInfoDto.categoryInfo.partyFlag':Number(e.detail.value)
})
},
bindSpecialCategory(e){
console.log(e);
if(e.detail.value == '1'){
let specialCategoryCodes = this.data.form.specialDto.specialCategoryCodes;
specialCategoryCodes.push(e.currentTarget.dataset.category);
this.setData({
'form.specialDto.specialCategoryCodes': specialCategoryCodes,
'form.baseInfoDto.categoryInfo.specialCrowdFlag':1
});
}else{
let specialCategoryCodes = this.data.form.specialDto.specialCategoryCodes;
specialCategoryCodes= specialCategoryCodes.filter(item => item != e.currentTarget.dataset.category);
this.setData({
'form.specialDto.specialCategoryCodes':specialCategoryCodes
})
}
console.log(this.data.form);
},
onCloseExpandForm() {
this.setData({
showExpand: false
})
},
bindResiLabelFlag(e) {
if(e.detail.value ==='1'){
this.setData({
['form.baseInfoDto.categoryInfo.' + e.target.dataset.category]: 1
});
}else{
this.setData({
['form.baseInfoDto.categoryInfo.' + e.target.dataset.category]: 0
});
}
console.log(this.data.form);
},
showDetailForm(e) {
let arr = this.data.orgList.filter(item => item.id === e.currentTarget.dataset.dto)
const promises = arr[0].children.map(async (item) => {
const acc = {};
if (item.opctionUrl) {
try {
const data = await this.getDictDataForm(item.opctionUrl, item.opctionParams);
item.opction = data;
} catch (error) {
console.error('Error fetching options:', error);
}
}
return acc;
});
Promise.all(promises).then((results) => {
this.setData({
popupTitle: e.currentTarget.dataset.title,
expandFormList: [...arr[0].children],
showExpand: true,
})
}).catch((error) => {
console.error('Error fetching options:', error);
});
},
async getDictDataForm(url, params) {
try {
const {
data
} = await fly.post(url, params);
return data;
} catch (error) {
console.log(error, `获取 ${opctionParams.dictType} 字典`);
}
},
hideExpandForm(e) {
let form = this.data.form;
delete form[e.detail.formType]
console.log(form);
this.setData({
showExpand: false,
form
})
},
confirmExpandForm(e) {
let orgListCopy = this.data.orgList
orgListCopy.forEach(item=>{
if(item.id === e.detail.formType){
item.children = e.detail.formList
}
})
this.setData({
showExpand: false
})
},
changExpandForm(e){
this.setData({
['form.' + e.detail.formNameP+'.'+ e.detail.formName]:e.detail.formValue
})
console.log(this.data.form);
},
//**人员标签end */
// 提交
saveForm(){
let form = {...this.data.form};
form.resideInfoDtos.forEach(item=>{
delete item.optionsB,
delete item.optionsD
delete item.optionsH
delete item.optionsV
})
api.submitResi(form).then(res=>{
if(res.code === 0){
wx.showToast({
title: '新增成功',
duration: 3000,
success: function () {
setTimeout(() => {
wx.navigateBack({
delta: 1
})
}, 3000)
}
})
}else{
wx.showToast({
title: res.msg,
})
}
})
console.log(this.data.form);
},
//**编辑回填逻辑 start*/
userXiangQ(option){
api.userXiangQ(this.data.resiId).then(res=>{
this.setData({
form:res.data,
"form.baseInfoDto.name":option.name,
"form.baseInfoDto.idNum":option.idNum,
"form.baseInfoDto.mobile":option.mobile,
})
}).catch(err=>{
console.log(err);
})
}
})