Browse Source

行程上报-级联

release
FightingN 4 years ago
parent
commit
73ff8231b4
  1. 6
      epdc-resident-mp-yushan/project.private.config.json
  2. 46
      epdc-resident-mp-yushan/subpages/extend/pages/tripReport/tripReport.js
  3. 4
      epdc-resident-mp-yushan/subpages/extend/pages/tripReport/tripReport.wxml

6
epdc-resident-mp-yushan/project.private.config.json

@ -62,6 +62,12 @@
"pathName": "subpages/gridArmy/pages/index/index",
"query": "",
"scene": null
},
{
"name": "行程上报",
"pathName": "subpages/extend/pages/epidemicControl/epidemicControl",
"query": "",
"scene": null
}
]
}

46
epdc-resident-mp-yushan/subpages/extend/pages/tripReport/tripReport.js

@ -117,23 +117,53 @@ Page({
}
// 如果不是第一层级,要往下加children
let options1 = this.data.options1
this.recursionMethod(options1, this.data.pid, res.data)
let arr = this.recursionMethod(options1, this.data.pid, res.data)
this.setData({
options1: arr,
})
}
})
},
recursionMethod(arr, pid, children) {
arr.forEach((item) => {
if (item.id === pid) {
item.children = children
wx.hideLoading()
}
console.log('item.children', item.children)
if (item.children) {
console.log('掉children')
this.recursionMethod(item.children, this.data.pid, children)
} else {
if (item.id === pid) {
console.log('值相等')
item.children = children
wx.hideLoading()
}
}
// if (item.id === pid) {
// console.log('值相等')
// item.children = children
// wx.hideLoading()
// }
// else {
// item.children = [
// {
// label: '11',
// value: '1111',
// id: '11111111111111111',
// },
// ]
// }
// if (item.children) {
// console.log('掉children')
// this.recursionMethod(item.children, this.data.pid, children)
// }
// if (item.id === pid) {
// console.log('值相等')
// item.children = children
// wx.hideLoading()
// }
})
this.setData({
options1: arr,
})
console.log('options1---', this.data.options1)
return arr
},
// 动态加载级联选择器
onLoadOptions(e) {

4
epdc-resident-mp-yushan/subpages/extend/pages/tripReport/tripReport.wxml

@ -152,11 +152,11 @@
<view class="textarea">{{actContent}}</view>
</view>
</view>
<view class="data-form" wx:if="{{type==='look'}}">
<!-- <view class="data-form" wx:if="{{type==='look'}}">
<view class="footer-item">
<view class="submit delete" bindtap="deleteTripById">删除</view>
<view class="submit confirm" bind:tap="confirmButton">确定</view>
</view>
</view>
</view> -->
</view>
<wux-actionsheet id="wux-actionsheet" />
Loading…
Cancel
Save