diff --git a/app.json b/app.json index ed58cf2..2d545f8 100644 --- a/app.json +++ b/app.json @@ -20,7 +20,8 @@ "root": "subpages/searchResult", "name": "searchResult", "pages": [ - "pages/searchResult/searchResult" + "pages/searchResult/searchResult", + "pages/searchRecords/searchRecords" ] }, { diff --git a/pages/index/index.wxml b/pages/index/index.wxml index d442b35..92463cd 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -18,7 +18,7 @@ - + {{item.content}} diff --git a/pages/work/work.js b/pages/work/work.js index bae6387..1f68f00 100644 --- a/pages/work/work.js +++ b/pages/work/work.js @@ -8,7 +8,8 @@ Page({ */ data: { setlectVal:'resi', - keyWord:'' + keyWord:'', + SearchRecordsList:[] }, /** @@ -19,7 +20,7 @@ Page({ statusHeight: app.globalData.deviceInfo.statusHeight, navigationHeight: app.globalData.deviceInfo.navigationHeight, share:app.globalData.share, - agencyName:app.globalData.user.agencyName + agencyName:app.globalData.user.agencyName, }) this.getSituation() }, @@ -49,7 +50,9 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - + this.setData({ + SearchRecordsList:wx.getStorageSync('searchRecords') || [] + }) }, /** @@ -107,5 +110,33 @@ Page({ wx.navigateTo({ url: `/subpages/searchResult/pages/searchResult/searchResult?type=${this.data.setlectVal}&keyWord=${this.data.keyWord}`, }) + console.log(this.data.setlectVal); + if(this.data.setlectVal == 'house'){ + // 获取当前的搜索记录 + let records = wx.getStorageSync('searchRecords') || []; + // 检查关键词是否已存在于记录中,如果存在,则先移除它(这样我们可以将其放到数组的前面) + const index = records.indexOf(this.data.keyWord); + if (index > -1) { + records.splice(index, 1); + } + // 将新的关键词添加到记录的开始 + records.unshift(this.data.keyWord); + // 为了避免本地存储数据太大,您可以限制记录的数量,例如最多保存10条 + if (records.length > 10) { + records.pop(); + } + // 保存更新后的搜索记录 + wx.setStorageSync('searchRecords', records); + } + }, + handelClickSearchRecordsList(e){ + wx.navigateTo({ + url: `/subpages/searchResult/pages/searchResult/searchResult?type=${this.data.setlectVal}&keyWord=${e.currentTarget.dataset.value}`, + }) + }, + navToSearchRecords(){ + wx.navigateTo({ + url: '/subpages/searchResult/pages/searchRecords/searchRecords', + }) } }) \ No newline at end of file diff --git a/pages/work/work.wxml b/pages/work/work.wxml index 3ffd38f..243384f 100644 --- a/pages/work/work.wxml +++ b/pages/work/work.wxml @@ -14,12 +14,18 @@ 搜索 - + 识别身份证查询 - + + 最近查询: + + {{item}} + + + diff --git a/pages/work/work.wxss b/pages/work/work.wxss index 90a5b6e..40d8af1 100644 --- a/pages/work/work.wxss +++ b/pages/work/work.wxss @@ -135,6 +135,53 @@ page { font-weight: 500; color: #FFFFFF; } +.content .searChrecord{ + font-size:26rpx; + color: #FFFFFF; + margin-top: 30rpx; + display: flex; + overflow: hidden; + justify-content: space-around; + align-items: center; +} +.content .searChrecord .item_list { + flex: 1; + display: flex; + justify-content: start; + overflow: hidden; + margin: 0 20rpx; + box-sizing: border-box; +} + +.content .searChrecord .item_list .label{ + width: 111rpx; +} +.content .searChrecord .item_list .item{ + padding: 7rpx 16rpx; + height: 40rpx; + line-height: 26rpx; + width: fit-content; + text-overflow: ellipsis; + white-space: nowrap; + background: linear-gradient(0deg, #579EFD 0%, #408DF3 100%); + opacity: 0.9; + border-radius: 20rpx; + box-sizing: border-box; + margin-left: 10rpx; +} +.content .searChrecord .item_list .item:last-child { + flex: 1; + overflow: hidden; + max-width: 150rpx; + text-overflow: ellipsis; + white-space: nowrap; + text-align: center; +} + +.content .searChrecord image{ + width: 32rpx; + height: 32rpx; +} .header .content .jump view{ flex: 1; text-align: left; diff --git a/project.private.config.json b/project.private.config.json index 9e8ad61..e68b207 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -42,6 +42,20 @@ "query": "type=edit&resiId=1695348130663325697", "launchMode": "default", "scene": null + }, + { + "name": "新增房屋", + "pathName": "subpages/addhouse/pages/addhouse/addhouse", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "搜索记录", + "pathName": "subpages/searchResult/pages/searchRecords/searchRecords", + "query": "", + "launchMode": "default", + "scene": null } ] } diff --git a/subpages/addResi/pages/addResi/addResi.wxml b/subpages/addResi/pages/addResi/addResi.wxml index 93e4e66..997bdfc 100644 --- a/subpages/addResi/pages/addResi/addResi.wxml +++ b/subpages/addResi/pages/addResi/addResi.wxml @@ -3,7 +3,7 @@ - {{formType == 'edit'?'修改居民信息':'填写居民信息'}} + {{formType == 'edit'?'修改居民信息':'新增居民信息'}} 填写居民信息 diff --git a/subpages/addhouse/pages/addhouse/addhouse.js b/subpages/addhouse/pages/addhouse/addhouse.js index 11e866b..0aa6faf 100644 --- a/subpages/addhouse/pages/addhouse/addhouse.js +++ b/subpages/addhouse/pages/addhouse/addhouse.js @@ -1,20 +1,213 @@ // subpages/addhouse/pages/addhouse/addhouse.js +import api from "../../../../utils/api" +const app = getApp() Page({ /** * 页面的初始数据 */ data: { - + form:{ + neighborHoodId: "", //小区id + buildingId: "", //楼栋id + buildingUnitId: "",//单元id + doorName: "", //门牌号 + houseType: "",//房屋类型 + purpose: "",//房屋用途 + rentFlag: null,//房屋状态 + ownerPhone: "",//联系方式 + ownerName: "",//房主姓名 + ownerIdCard: "",//房主证件号 + remark: "", + coding: "", + sysCoding: "",//房屋编码 + familyTags: []//家庭标签 + }, + gridName: '', + gridId: '', + neighborHoodIdList:[], + neighborHoodIdName:'', + buildingList:[], + buildingName:'', + houseTypeList:[ + { + label:'楼房', + value:'1' + }, + { + label:'平房', + value:'2' + }, { + label:'别墅', + value:'3' + }, + ], + purposeList:[ + { + label:'住宅', + value:'1' + }, + { + label:'商业', + value:'2' + }, { + label:'办公', + value:'3' + }, { + label:'工业', + value:'4' + }, { + label:'仓储', + value:'5' + }, { + label:'商住混用', + value:'6' + }, { + label:'其他', + value:'7' + }, + ], + isFirstLoadGrid:true, + isFirstLoadVillage: true, + isFirstLoadBuilding:true, + isFirstLoadUnit:true, + rentFlagList:[ + { + label:'自住', + value:0 + }, { + label:'出租', + value:1 + }, { + label:'闲置', + value:2 + }, { + label:'未出售', + value:3 + }, + ] }, /** * 生命周期函数--监听页面加载 */ - onLoad(options) { - + onLoad: async function (options) { + console.log(options); + this.setData({ + statusHeight: app.globalData.deviceInfo.statusHeight, + navigationHeight: app.globalData.deviceInfo.navigationHeight, + agencyId:'7b6f9a9f9f38d5f9fa7ce94a93d6eb28',//app.globalData.user.agencyId + 'form.agencyId':app.globalData.user.agencyId, + 'form.agencyName':app.globalData.user.agencyName, + formType:options.type, + houseId:options.houseId + }) + await this.getGridoptionDict() + if(options.houseId){ + wx.setNavigationBarTitle({ + title: '修改房屋信息', + }) + await this.getClearHouseDeatilById() + + }else{ + this.setData({ + isFirstLoadGrid:false, + isFirstLoadVillage: false, + isFirstLoadBuilding:false, + isFirstLoadUnit:false, + isFirstLoadHouse:false, + }) + } + }, + getClearHouseDeatilById: async function() { + try { + let res = await api.getClearHouseDeatilById(this.data.houseId); + wx.showLoading({ + title: '加载中...', + }) + await this.setDataAsync({ + form:res.data, + gridId:res.data.gridId + }); + setTimeout(()=>{ + this.bindPickerChangeGrid(); + },1000) + setTimeout(()=>{ + this.bindPickerChangeneighborHoodId(); + },1500) + setTimeout(()=>{ + this.bindPickerChangebuilding() + },2000) + setTimeout(()=>{ + this.bindPickerChangeUnit() + wx.hideLoading() + },2500) + + } catch(err) { + console.log(err); + } + }, + setDataAsync: function(data) { + return new Promise((resolve) => { + this.setData(data, resolve); + }); + }, + getGridoptionDict(){ + let parm ={ + agencyId:this.data.agencyId, + purpose:'addorupdate' + } + api.getGridoptionDict(parm).then(res=>{ + this.setData({ + gridList:res.data, + }) + }).catch(err=>{ + console.log(err); + }) + }, + getQuartersOptions(gridId){ + let parm = { + gridId, + agencyId:this.data.agecyId + } + api.getQuartersOptions(parm).then(res=>{ + this.setData({ + neighborHoodIdList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + // 获取楼栋列表 + getBuildingoption(neighborHoodId){ + api.getBuildingoption(neighborHoodId).then(res=>{ + this.setData({ + buildingList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + // 获取单元列表 + getUnitoption(buildingId){ + api.getUnitoption(buildingId).then(res=>{ + this.setData({ + unitList:res.data + }) + }).catch(err=>{ + console.log(err); + }) + }, + // 获取房屋列表 + getHouseoption(buildingUnitId){ + api.getHouseoption(buildingUnitId).then(res=>{ + this.setData({ + houseList:res.data + }) + }).catch(err=>{ + console.log(err); + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ @@ -62,5 +255,288 @@ Page({ */ onShareAppMessage() { + }, + // 获取网格列表 + bindPickerChangeGrid(e){ + if (this.data.isFirstLoadGrid) { + // 编辑回填逻辑 + const id = this.data.gridId; + const gridName = this.data.gridList.filter(item => item.value == id)[0].label; + this.setData({ + gridName: gridName, + gridId: id + }); + this.getQuartersOptions(id); + this.setData({ + isFirstLoadGrid: false + }); + } else { + // 正常修改逻辑 + const selectedIndex = e.detail.value; + const selectedVillage = this.data.gridList[selectedIndex]; + this.setData({ + gridName:selectedVillage.label, + gridId:selectedVillage.value, + neighborHoodIdName:'', + neighborHoodIdList:[], + buildingName:'', + buildingList:[], + unitName:'', + unitList:[], + doorName:'', + houseList:[], + }); + this.getQuartersOptions(selectedVillage.value); + } + }, + bindPickerChangeneighborHoodId(e) { + if (this.data.isFirstLoadVillage) { + // 编辑回填逻辑 + const id = this.data.form.neighborHoodId; + const neighborHoodIdName = this.data.neighborHoodIdList.filter(item => item.value == id)[0].label; + this.setData({ + neighborHoodIdName: neighborHoodIdName, + "form.neighborHoodId": id + }); + this.getBuildingoption(id); + this.setData({ + isFirstLoadVillage: false + }); + } else { + // 正常修改逻辑 + const selectedIndex = e.detail.value; + const selectedVillage = this.data.neighborHoodIdList[selectedIndex]; + + this.setData({ + neighborHoodIdName: selectedVillage.label, + "form.neighborHoodId": selectedVillage.value + }); + + this.getBuildingoption(selectedVillage.value); + } + }, + + bindPickerChangebuilding(e){ + if (this.data.isFirstLoadBuilding) { + const id = this.data.form.buildingId; + const buildingName = this.data.buildingList.filter(item => item.value == id)[0].label; + this.setData({ + buildingName: buildingName, + "form.buildingId": id + }); + this.getUnitoption(id); + this.setData({ + isFirstLoadBuilding: false + }); + } else { + const selectedIndex = e.detail.value; + const selectedVillage = this.data.buildingList[selectedIndex]; + this.setData({ + buildingName: selectedVillage.label, + "form.buildingId": selectedVillage.value + }); + this.getUnitoption(selectedVillage.value); + } + }, + bindPickerChangeUnit(e){ + if (this.data.isFirstLoadUnit) { + const id = this.data.form.buildingUnitId; + const unitName = this.data.unitList.filter(item => item.value == id)[0].label; + this.setData({ + unitName: unitName, + "form.buildingUnitId": id + }); + this.getHouseoption(id); + this.setData({ + isFirstLoadunit: false + }); + } else { + const selectedIndex = e.detail.value; + const selectedVillage = this.data.unitList[selectedIndex]; + this.setData({ + unitName: selectedVillage.label, + "form.buildingUnitId": selectedVillage.value + }); + this.getHouseoption(selectedVillage.value); + } + }, + // bindPickerChangeHouse(e){ + // if (this.data.isFirstLoadHouse) { + // const id = this.data.form.doorName; + // const doorName = this.data.houseList.filter(item => item.value == id)[0].label; + // this.setData({ + // doorName: doorName, + // "form.doorName": id + // }); + // this.setData({ + // isFirstLoadHouse: false + // }); + // } else { + // const selectedIndex = e.detail.value; + // const selectedVillage = this.data.houseList[selectedIndex]; + // this.setData({ + // doorName: selectedVillage.label, + // "form.doorName": selectedVillage.value + // }); + // } + // }, + + bindDoorNameInput(e){ + this.setData({ + 'form.doorName':e.detail.value + }) + }, + bindsysCodingInput(e){ + this.setData({ + 'form.sysCoding':e.detail.value, + 'form.coding':res.data.sysCoding + }) + }, + bindPickerChangehouseType(e){ + this.setData({ + "form.houseType" :this.data.houseTypeList[e.detail.value].value, + }) + }, + bindPickerChangePurpose(e){ + this.setData({ + "form.purpose" :this.data.purposeList[e.detail.value].value, + }) + }, + bindPickerChangeRentFlag(e){ + this.setData({ + "form.rentFlag" :this.data.rentFlagList[e.detail.value].value, + }) + }, + bindOwnerNameInput(e){ + this.setData({ + 'form.ownerName':e.detail.value + }) + }, + bindOwnerPhoneInput(e){ + this.setData({ + 'form.ownerPhone':e.detail.value + }) + }, + bindOwnerIdCardInput(e){ + this.setData({ + 'form.ownerIdCard':e.detail.value + }) + }, + bindRemarkInput(e){ + this.setData({ + 'form.remark':e.detail.value + }) + }, + handelClickSysCoding(){ + if(!this.data.form.buildingUnitId){ + wx.showToast({ + title: '请先选择单元', + icon:'none' + }) + } + api.getHouseCoding(this.data.form.buildingUnitId).then(res=>{ + this.setData({ + 'form.sysCoding':res.data.sysCoding, + 'form.coding':res.data.sysCoding + }) + }).catch(err=>{ + console.log(err); + }) + }, + bindRemarkInput(e){ + this.setData({ + 'form.remark':e.detail.value + }) + }, + showToast(title){ + wx.showToast({ + title: title, + duration:2000, + icon:'none' + }) + }, + submit: async function() { + if(!this.data.gridId){ + this.showToast('请选择所在网格') + return + } + if(!this.data.form.neighborHoodId){ + this.showToast('请选择所在小区') + return + } + if(!this.data.form.buildingId){ + this.showToast('请选择所在楼栋') + return + } + if(!this.data.form.buildingUnitId){ + this.showToast('请选择所在单元') + return + } + if(!this.data.form.doorName){ + this.showToast('请选择门牌号') + return + } + if(!this.data.form.sysCoding){ + this.showToast('请输入房屋编码') + return + } + if(!this.data.form.houseType){ + this.showToast('请选择房屋类型') + return + } + if(!this.data.form.purpose){ + this.showToast('请选择房屋用途') + return + } + if(this.data.form.rentFlag == null){ + this.showToast('请选择房屋状态') + return + } + const parm = {...this.data.form} + if(this.data.formType == 'edit'){ + parm.houseId = this.data.houseId + try { + const res = await api.updateCommunityHouse(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.saveCommunityHouse(parm) + if(res.code === 0){ + wx.showToast({ + title: '新增成功', + duration:3000, + success:function(){ + setTimeout(()=>{ + wx.navigateBack({ + delta: 1 + }) + },3000) + } + }) + } + }catch(err) { + console.log(err); + } + } + }, + back(){ + wx.navigateBack({ + delta: 1 + }) } }) \ No newline at end of file diff --git a/subpages/addhouse/pages/addhouse/addhouse.json b/subpages/addhouse/pages/addhouse/addhouse.json index 3928faa..7af8b0a 100644 --- a/subpages/addhouse/pages/addhouse/addhouse.json +++ b/subpages/addhouse/pages/addhouse/addhouse.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/subpages/addhouse/pages/addhouse/addhouse.wxml b/subpages/addhouse/pages/addhouse/addhouse.wxml index 79583cb..e68d67d 100644 --- a/subpages/addhouse/pages/addhouse/addhouse.wxml +++ b/subpages/addhouse/pages/addhouse/addhouse.wxml @@ -1,2 +1,173 @@ -subpages/addhouse/pages/addhouse/addhouse.wxml + + + + + {{formType == 'edit'?'修改房屋信息':'新增房屋信息'}} + + + 填写房屋信息 + * 号为必填项 + + + + + 基本信息 + + + * + 所在网格 + + + + + {{gridName?gridName:'请选择'}} + + + + + + + + * + 所在小区 + + + + + {{neighborHoodIdName?neighborHoodIdName:'请选择'}} + + + + + + + + * + 所在楼栋 + + + + + {{buildingName?buildingName:'请选择'}} + + + + + + + + * + 所在单元 + + + + + {{unitName?unitName:'请选择'}} + + + + + + + + * + 门牌号 + + + + + + + + * + 房屋编码 + + + + 生成 + + + + + * + 房屋类型 + + + + + {{form.houseType?houseTypeList[form.houseType - 1].label:'请选择'}} + + + + + + + + * + 房屋用途 + + + + + {{form.purpose?purposeList[form.purpose - 1].label:'请选择'}} + + + + + + + + * + 房屋状态 + + + + + {{form.rentFlag!=null?rentFlagList[form.rentFlag].label:'请选择'}} + + + + + + + + + 房主姓名 + + + + + + + + + 房主电话 + + + + + + + + + 证件号 + + + + + + + + 备注 + + + +