|
|
@ -69,6 +69,7 @@ Page({ |
|
|
|
value: 'id', |
|
|
|
label: 'shortName', |
|
|
|
}, |
|
|
|
newOptions: [], |
|
|
|
pid: 0, |
|
|
|
}, |
|
|
|
onLoad: function (options) { |
|
|
@ -116,19 +117,22 @@ Page({ |
|
|
|
return |
|
|
|
} |
|
|
|
// 如果不是第一层级,要往下加children
|
|
|
|
let options1 = this.data.options1 |
|
|
|
let arr = this.recursionMethod(options1, this.data.pid, res.data) |
|
|
|
let arr = this.recursionMethod( |
|
|
|
this.data.options1, |
|
|
|
this.data.pid, |
|
|
|
res.data |
|
|
|
) |
|
|
|
this.setData({ |
|
|
|
options1: arr, |
|
|
|
}) |
|
|
|
console.log('options1---', this.data.options1) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
recursionMethod(arr, pid, children) { |
|
|
|
arr.forEach((item) => { |
|
|
|
console.log('item.children', item.children) |
|
|
|
if (item.children) { |
|
|
|
console.log('掉children') |
|
|
|
console.log('掉children', item.children, this.data.pid, children) |
|
|
|
this.recursionMethod(item.children, this.data.pid, children) |
|
|
|
} else { |
|
|
|
if (item.id === pid) { |
|
|
@ -137,32 +141,7 @@ Page({ |
|
|
|
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()
|
|
|
|
// }
|
|
|
|
}) |
|
|
|
console.log('options1---', this.data.options1) |
|
|
|
return arr |
|
|
|
}, |
|
|
|
// 动态加载级联选择器
|
|
|
@ -268,7 +247,7 @@ Page({ |
|
|
|
this.showToast('来自地区不能为空') |
|
|
|
return |
|
|
|
} |
|
|
|
if (this.data.localTimeValue.length === 0) { |
|
|
|
if (this.data.localTime.length === 0) { |
|
|
|
this.showToast('来到本地时间不能为空') |
|
|
|
return |
|
|
|
} |
|
|
@ -292,6 +271,11 @@ Page({ |
|
|
|
backDate: this.data.backTime, |
|
|
|
note: this.data.actContent.trim(''), |
|
|
|
} |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '是否要上报行程', |
|
|
|
success(res) { |
|
|
|
if (res.confirm) { |
|
|
|
saveTripInfo(params) |
|
|
|
.then((res) => { |
|
|
|
if (res.code == 0 && res.msg == 'success') { |
|
|
@ -315,6 +299,11 @@ Page({ |
|
|
|
lock: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else if (res.cancel) { |
|
|
|
console.log('用户点击取消') |
|
|
|
} |
|
|
|
}, |
|
|
|
}) |
|
|
|
}, |
|
|
|
onInputValue(e) { |
|
|
|
let code = e.currentTarget.dataset.code |
|
|
|