From 7c94f541602efcfdff8708743a6512e9dfa51f02 Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Fri, 3 Nov 2023 15:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=89=E6=B1=82=E7=B1=BB=E5=9E=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BApc=E5=85=B1=E6=80=A7=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E4=B8=AD=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dissatisfied/demandCheck/demandCheck.js | 36 +++++++++++++++++-- .../dissatisfied/demandCheck/demandCheck.wxml | 2 ++ utils/api.js | 9 +++-- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js index 3c20b44..b074633 100644 --- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js +++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.js @@ -59,7 +59,7 @@ Page({ hasPlay: false, playUrl: "", - // defaultFieldNames: { label: 'agencyName', value: 'agencyId', children: 'subAgencyList' }, + defaultFieldNames: { label: 'name', value: 'id',children:"children"}, angencyVisible: false, measureList:[], @@ -122,10 +122,10 @@ Page({ }, getDemandoption(){ api.getDemandoption().then(res=>{ - console.log(res); this.setData({ - measureList:res.data + measureList:res.data, }) + }).catch(err=>{ console.log(err); }) @@ -1227,6 +1227,12 @@ Page({ this.setData({ measureVisible:true }) + let e = { + detail:{ + value:[this.data.measureList[0].id] + } + } + this.handleChangeMeasureValue(e) }, showReportTypePicker(){ this.setData({ @@ -1250,4 +1256,28 @@ Page({ second = second >= 10 ? second : '0' + second return min + ':' + second }, + getDemandoption2: async function(id){ + const {data,code,msg} = await api.getDemandoption2(id) + if(code == 0){ + console.log(data); + return data + }else{ + console.log(msg); + } + }, + handleChangeMeasureValue: async function (e){ + console.log(e); + let id = e.detail.value.join(''); + let childrenData = await this.getDemandoption2(id); + let list = this.data.measureList.map(item => { + if(item.id == id){ + return {...item, children:childrenData}; + } else { + return item; + } + }); + this.setData({ + measureList: list + }); + } }) \ No newline at end of file diff --git a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml index 49fc886..8280c68 100644 --- a/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml +++ b/subpages/demandCheck/pages/dissatisfied/demandCheck/demandCheck.wxml @@ -241,10 +241,12 @@ options="{{ measureList }}" value="{{ measureValue }}" visible="{{measureVisible}}" + defaultFieldNames="{{defaultFieldNames}}" cols="2" controlled cascade bind:cancel="hidePickerMeasure" bind:confirm="onConfirmMeasure" + bind:valueChange="handleChangeMeasureValue" > \ No newline at end of file diff --git a/utils/api.js b/utils/api.js index d2bdb7e..4a507f5 100644 --- a/utils/api.js +++ b/utils/api.js @@ -44,7 +44,8 @@ module.exports = { clockRecords, clearOneMessage, getPubKey, - changePassword + changePassword, + getDemandoption2 } // 获取公钥 @@ -213,8 +214,12 @@ function getResidentBaseInfoPage (parm) { } // 获取需求分类树 function getDemandoption (parm) { - return fly.post(`governance/icresidemanddict/demandoption`,parm) + return fly.get(`governance/commonServiceType/selectList/0`,parm) } +function getDemandoption2 (id) { + return fly.get(`governance/commonServiceType/selectList/${id}`) +} + // 上报诉求 function addMeasure(parm) { return fly.post(`governance/userdemand/add`,parm)