Browse Source

房屋字段

work_tab_bar
mk 2 years ago
parent
commit
2622446bad
  1. 178
      subpages/addResi/pages/addResi/addResi.js
  2. 1
      subpages/addResi/pages/addResi/addResi.json
  3. 93
      subpages/addResi/pages/addResi/addResi.wxml
  4. 10
      utils/api.js

178
subpages/addResi/pages/addResi/addResi.js

@ -690,7 +690,8 @@ Page({
],
},
],
popupTitle: '新增'
popupTitle: '新增',
formType:null
},
/**
@ -699,9 +700,17 @@ Page({
onLoad: async function (options) {
if(options.type === 'edit'){
this.setData({
resiId:options.resiId
resiId:options.resiId,
formType:options.type
})
this.userXiangQ(options)
wx.setNavigationBarTitle({
title: '编辑居民',
})
}else{
wx.setNavigationBarTitle({
title: '新增居民',
})
}
this.setData({
agencyId: app.globalData.user.agencyId,
@ -817,51 +826,6 @@ Page({
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({
@ -1000,7 +964,7 @@ Page({
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 + '].buildName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].buildId']: selectedVillage.value,
['form.resideInfoDtos[' + indexP + '].unitId']: null,
['form.resideInfoDtos[' + indexP + '].unitName']: null,
@ -1029,7 +993,7 @@ Page({
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 + '].doorName']: selectedVillage.label,
['form.resideInfoDtos[' + indexP + '].homeId']: selectedVillage.value
});
},
@ -1194,12 +1158,15 @@ Page({
bindPickerChangeNation(e) {
this.setData({
"form.baseInfoDto.nation": this.data.dicts.nationList[e.detail.value].value
"form.baseInfoDto.nation": this.data.dicts.nationList[e.detail.value].value,
"form.baseInfoDto.nationName": this.data.dicts.nationList[e.detail.value].label
})
},
bindPickerChangeEducation(e) {
this.setData({
"form.eduInfoDto.cultureLevel": this.data.dicts.educationList[e.detail.value].value
"form.eduInfoDto.cultureLevel": this.data.dicts.educationList[e.detail.value].value,
"form.eduInfoDto.cultureLevelName": this.data.dicts.educationList[e.detail.value].label,
})
},
bindPickerChangeMarriage(e) {
@ -1328,7 +1295,6 @@ Page({
})
},
bindSpecialCategory(e){
console.log(e);
if(e.detail.value == '1'){
let specialCategoryCodes = this.data.form.specialDto.specialCategoryCodes;
@ -1435,36 +1401,94 @@ Page({
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)
}
if(this.data.formType === 'edit'){
api.updatetResi(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,
})
}else{
wx.showToast({
title: res.msg,
})
}
})
console.log(this.data.form);
}
})
}else{
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,
})
if(res.code == 0){
// 特殊人群类别
let specialResidentCategory = this.data.dicts.specialResidentCategory
let marriageName, careerStatusName,idTypeName,resideInfoDtos = null;
if(res.data.specialDto && res.data.specialDto.specialCategoryCodes){
specialResidentCategory.forEach(item=>{
if(res.data.specialDto.specialCategoryCodes.indexOf(item.value) !== -1){
item.radioValue = 1
}else{
item.radioValue = 0
}
})
}
if(res.data.familyInfoDto && res.data.familyInfoDto.marriage){
marriageName = this.data.dicts.marriageList.find(item=>item.value == res.data.familyInfoDto.marriage).label
}
if(res.data.workInfoDto && res.data.workInfoDto.careerStatus){
careerStatusName = this.data.dicts.careerStatusList.find(item=>item.value == res.data.workInfoDto.careerStatus).label
}
if(res.data.baseInfoDto && res.data.baseInfoDto.idType){
idTypeName = this.data.dicts.idTypeList.find(item=>item.value == res.data.workInfoDto.careerStatus).label
}
if(res.data.resideInfoDtos){
for(let i in res.data.resideInfoDtos){
this.getQuartersOptions(res.data.resideInfoDtos[i].gridId,i)
this.getBuildingoption(res.data.resideInfoDtos[i].villageId,i)
this.getUnitoption(res.data.resideInfoDtos[i].buildId,i)
this.getHouseoption(res.data.resideInfoDtos[i].unitId,i)
}
}
this.setData({
form:res.data,
"form.baseInfoDto.name":option.name,
"form.baseInfoDto.idNum":option.idNum,
"form.baseInfoDto.mobile":option.mobile,
"dicts.specialResidentCategory":specialResidentCategory,
marriageName:marriageName,
careerStatusName:careerStatusName,
idTypeName:idTypeName
})
}
}).catch(err=>{
console.log(err);
})

1
subpages/addResi/pages/addResi/addResi.json

@ -1,5 +1,4 @@
{
"navigationBarTitleText": "新增居民",
"usingComponents": {
"wux-select": "../../../../components/dist/select",
"DynamicForms": "../../../../components/DynamicForms/DynamicForms",

93
subpages/addResi/pages/addResi/addResi.wxml

@ -42,8 +42,8 @@
</view>
<view class="input">
<picker bindchange="bindPickerChangebuilding" range-key="label" value="{{index}}" range="{{form.resideInfoDtos[indexP].optionsB}}" data-indexP="{{indexP}}">
<view class="{{form.resideInfoDtos[indexP].buildingName?'':'gray'}}">
{{form.resideInfoDtos[indexP].buildingName ? form.resideInfoDtos[indexP].buildingName : '请选择'}}
<view class="{{form.resideInfoDtos[indexP].buildName?'':'gray'}}">
{{form.resideInfoDtos[indexP].buildName ? form.resideInfoDtos[indexP].buildName : '请选择'}}
</view>
</picker>
<image src="../../../../images/right.png" mode="" />
@ -70,8 +70,8 @@
</view>
<view class="input">
<picker bindchange="bindPickerChangeHouse" range-key="label" value="{{index}}" range="{{form.resideInfoDtos[indexP].optionsH}}" data-indexP="{{indexP}}">
<view class="{{form.resideInfoDtos[indexP].houseName?'':'gray'}}">
{{form.resideInfoDtos[indexP].houseName ? form.resideInfoDtos[indexP].houseName : '请选择'}}
<view class="{{form.resideInfoDtos[indexP].doorName?'':'gray'}}">
{{form.resideInfoDtos[indexP].doorName ? form.resideInfoDtos[indexP].doorName : '请选择'}}
</view>
</picker>
<image src="../../../../images/right.png" mode="" />
@ -265,7 +265,7 @@
<view class="input">
<picker bindchange="bindPickerChangeNation" range-key="label" value="{{index}}" range="{{dicts.nationList}}">
<view class="{{form.baseInfoDto.nation?'':'gray'}}">
{{form.baseInfoDto.nation ? dicts.nationList[form.baseInfoDto.nation].label : '请选择'}}
{{form.baseInfoDto.nationName? form.baseInfoDto.nationName : '请选择'}}
</view>
</picker>
<image src="../../../../images/right.png" mode="" />
@ -278,7 +278,7 @@
<view class="input">
<picker bindchange="bindPickerChangeEducation" range-key="label" value="{{index}}" range="{{dicts.educationList}}">
<view class="{{form.eduInfoDto.cultureLevel?'':'gray'}}">
{{form.eduInfoDto.cultureLevel ? dicts.educationList[form.eduInfoDto.cultureLevel].label : '请选择'}}
{{form.eduInfoDto.cultureLevelName ? form.eduInfoDto.cultureLevelName : '请选择'}}
</view>
</picker>
<image src="../../../../images/right.png" mode="" />
@ -460,8 +460,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindUnempCompensationFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.unemployedDto.unempCompensationFlag==1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.unemployedDto.unempCompensationFlag==0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -472,8 +472,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindEmploymentHardFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.unemployedDto.employmentHardFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.unemployedDto.employmentHardFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -498,8 +498,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindElderlyFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.familyInfoDto.elderlyFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.familyInfoDto.elderlyFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -537,9 +537,9 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindPartyFlag">
<radio value="0" checked="true" color="#3974f6" />群众
<radio value="1" color="#3974f6" />党员
<radio value="2"color="#3974f6" />共青团员
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.partyFlag==0?true:false}}" color="#3974f6" />群众
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.partyFlag==1?true:false}}" color="#3974f6" />党员
<radio value="2" checked="{{form.baseInfoDto.categoryInfo.partyFlag==2?true:false}}" color="#3974f6" />共青团员
</radio-group>
</view>
</view>
@ -560,8 +560,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="disabilityFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.disabilityFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.disabilityFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -579,8 +579,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="seriousIllnessFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.seriousIllnessFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.seriousIllnessFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
@ -599,8 +599,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="chronicDiseaseFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.chronicDiseaseFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.chronicDiseaseFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
@ -619,8 +619,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="deathFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.deathFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.deathFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
@ -644,8 +644,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="oldPeopleFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.oldPeopleFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.oldPeopleFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -662,8 +662,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="subsistenceAllowanceFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.subsistenceAllowanceFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.subsistenceAllowanceFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -680,8 +680,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="veteranFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.veteranFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.veteranFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -698,8 +698,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="form.attentionResiDto.ensureHouseFlag" data-category="ensureHouseFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.ensureHouseFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.ensureHouseFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -716,8 +716,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="fertileWomanFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.fertileWomanFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.fertileWomanFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -728,8 +728,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="specialSupportFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.specialSupportFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.specialSupportFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -751,11 +751,12 @@
<view class="label">
<view class="title">{{radioItem.label}}</view>
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindSpecialCategory" data-category="{{radioItem.value}}">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
</radio-group>
<radio value="{{radioItem.radioValue}}" checked="{{radioItem.radioValue==1?true:false}}" color="#3974f6" />是
<radio value="{{radioItem.radioValue}}" checked="{{radioItem.radioValue == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
</view>
@ -770,8 +771,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="volunteerFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.volunteerFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.volunteerFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
@ -789,8 +790,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="buildingChiefFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.buildingChiefFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.buildingChiefFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
@ -802,8 +803,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="unitChiefFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.unitChiefFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.unitChiefFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>
</view>
@ -814,8 +815,8 @@
</view>
<view class="input">
<radio-group class="radio_group" bindchange="bindResiLabelFlag" data-category="publicWelfareFlag">
<radio value="1" checked="true" color="#3974f6" />是
<radio value="0" checked="true" color="#3974f6" />否
<radio value="1" checked="{{form.baseInfoDto.categoryInfo.publicWelfareFlag == 1?true:false}}" color="#3974f6" />是
<radio value="0" checked="{{form.baseInfoDto.categoryInfo.publicWelfareFlag == 0?true:false}}" color="#3974f6" />否
</radio-group>
</view>

10
utils/api.js

@ -65,7 +65,8 @@ module.exports = {
submitResi,
getAllOrgCategoryCount,
getResiInfo,
userXiangQ
userXiangQ,
updatetResi
}
// 获取公钥
@ -335,12 +336,17 @@ function icEventOldDelete(parm) {
function updateEvent(parm) {
return fly.post(`governance/icEventOld/update`,parm)
}
// 居民新增
function submitResi(parm) {
return fly.post(`actual/base/residentBaseInfo/save`,parm)
}
function getAllOrgCategoryCount(parm) {
return fly.get(`actual/base/streetOverview/allOrgCategoryCount`,parm)
}
// 居民编辑
function updatetResi(parm) {
return fly.post(`actual/base/residentBaseInfo/update`,parm)
}

Loading…
Cancel
Save