//工单类型 var typeList = []; $.ajax({ type: "get", url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListById', async: false, data: { id: 2 }, dataType: 'json', success: function(data) { var type_data = data.data; $(type_data).each(function(i, n) { var obj = {}; obj.value = n.F_ValueId; obj.text = n.F_Value; typeList.push(obj) }) } }); //事发地域 var areaList = []; $.ajax({ type: "get", url: huayi.config.callcenter_url + 'web/GetWebAreaList', async: false, data: {}, dataType: 'json', success: function(data) { var area_data = data.data; console.log(area_data); $(area_data).each(function(i, n) { var obj = {}; obj.value = n.F_AreaId; obj.text = n.F_AreaName; areaList.push(obj) console.log(obj); }) } }); //主题词 var keyList = []; $.ajax({ type: "get", url: huayi.config.callcenter_url + 'Dictionary/GetDicValueListById', async: false, data: { id: 3 }, dataType: 'json', success: function(data) { var key_data = data.data; $(key_data).each(function(i, n) { var obj = {}; obj.value = n.F_ValueId; obj.text = n.F_Value; keyList.push(obj) }) } }); (function($, doc) { $.ready(function() { //诉求类型 var userPicker = new $.PopPicker(); userPicker.setData(typeList); var showUserPickerButton = doc.getElementById('showUserPicker'); var userResult = doc.getElementById('userResult'); showUserPickerButton.addEventListener('tap', function(event) { userPicker.show(function(items) { console.log(items) userResult.value = items[0].text; userResult.setAttribute("data-index", items[0].value); //返回 false 可以阻止选择框的关闭 //return false; }); }, false); //主题词 var zhuTiPicker = new $.PopPicker(); zhuTiPicker.setData(keyList); var showZhuTiPickerButton = doc.getElementById('showZhuTiPicker'); var zhuTiResult = doc.getElementById('zhuTiResult'); showZhuTiPickerButton.addEventListener('tap', function(event) { zhuTiPicker.show(function(items) { console.log(items) zhuTiResult.value = items[0].text; zhuTiResult.setAttribute("data-index", items[0].value); //返回 false 可以阻止选择框的关闭 //return false; }); }, false); //事件地址 var cityPicker3 = new $.PopPicker(); cityPicker3.setData(areaList); var showCityPickerButton = doc.getElementById('showCityPicker3'); var cityResult3 = doc.getElementById('cityResult3'); showCityPickerButton.addEventListener('tap', function(event) { cityPicker3.show(function(items) { cityResult3.value = items[0].text; cityResult3.setAttribute("data-index", items[0].value); //返回 false 可以阻止选择框的关闭 //return false; }); }, false); }) })(mui, document);