aqyj/pages/dickey/treeselect.js

68 lines
1.6 KiB
JavaScript

Page({
data: {
value: [],
action:''
},
selThis(e) {
//console.log(e.detail);
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2];
if (this.data.action=='yhlxo'){
prevPage.setData({
yhlxo__name: e.detail.name,
yhlxo: e.detail.id,
})
}
else if (this.data.action=='yhlb'){
prevPage.setData({
yhlb__name: e.detail.name,
yhlb: e.detail.id,
})
}
wx.navigateBack({
delta: 0,
})
},
onLoad:function(option) {
let strurl
if(option.a=='yhlxo'){
this.data.action = 'yhlxo';
strurl = getApp().globalData.serverUrl + 'getdickey?dicclass=56&a=combobox'
this.setData({
text:'隐患因素(依据GB13861-2009)'
})
}
else if(option.a=='yhlb1'){
this.data.action = 'yhlb';
strurl = getApp().globalData.serverUrl + 'getdickey?dicclass=16&a=combobox'
this.setData({
text:'隐患类别(依据隐患排查通用上报标准)'
})
}
else if(option.a=='yhlb2'){
this.data.action = 'yhlb';
strurl = getApp().globalData.serverUrl + 'getdickey?dicclass=17&a=combobox'
this.setData({
text:'隐患类别(依据隐患排查通用上报标准)'
})
}
wx.request({
url: strurl,
header: {
'content-type': 'application/json', // 默认值
'Cookie': getApp().globalData.sessionId,
},
data: {},
success: res => {
if (res.statusCode === 200) {
this.setData({
value: res.data
})
}
}
});
},
});