mui.init({}) var UserCode = helper.cookies.get("usercode"); var id = helper.request.queryString("id"); var itype = helper.request.queryString("itype"); var openid = helper.cookies.get("openid"); //var openid = "oXF5e1mWpX5DajW5_yjNLPKb8ThE"; //alert(id); $(function() { // 接收人员 $('#order_recive').on('tap', function() { //alert("ddd"); getReceiveUser(); $("#order_recive option").remove(); }); //返回列表 $('.return').on('tap', function() { window.location.href = "orderDetail.html?id=" + id + '&type=' + itype; }); //提交按钮 $('#submit').on('tap', function() { if($('#recive_type').attr('data-index')== '') { mui.alert('请选择部门!') //请输入工单类型 } else if($('#ower_recive').attr('data-index')== '') { mui.alert('请选择接收人!') //请输入工单类型 } else if($('#order_reception').val() == '') { mui.alert('请输入转派理由!') //填写详细描述 } else { $.ajax({ type: "post", dataType: 'json', url: huayi.config.callcenter_url + '/WxLogin/AssignWorkOrder', async: true, data: { orderid: id, //否 strubg 工单编号 clbm: $('#recive_type').attr('data-index'), //是 int 部门Id clid: $("#ower_recive").attr('data-index'), //否 int 接收人用户id cont: $("#order_reception").val(), //否 int 处理内容 openid: openid, //微信openid, // openid: 'oXF5e1mWpX5DajW5_yjNLPKb8ThE', //微信openid 测试用 }, success: function(data) { if(data.state == "success") { debugger mui.toast('成功'); window.location.href="orderList.html?Itype=2"; } else { mui.toast(data.message); } } }); } }) // 接收部门 function getDepts() {} var recive = []; $.ajax({ type: "get", url: huayi.config.callcenter_url + 'Department/GetDeptList', async: false, data: {}, dataType: 'json', success: function(data) { console.log(data) recive = data.data; //alert(JSON.stringify(data)); } }); //接收人员 function getReceiveUser() { renyuan = [] $.ajax({ url: huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', type: 'get', data: { deptid: $('#recive_type').attr('data-index'), }, dataType: "json", async: true, success: function(res) { if(res.state.toLowerCase() === "success") { res = res.data; if(res && res.length > -1) { res.forEach(function(v, i) { var obj = {}; obj.value = v.F_UserId; obj.text = v.F_UserCode; renyuan.push(obj); //$('').appendTo('#order_recive'); }); cityPicker5.setData(renyuan); } } }, }); } (function($, doc) { $.init(); $.ready(function() { //接收部门 var RCiPickers = new $.PopPicker({ layer: 3 }); RCiPickers.setData(recive); var RCs = doc.getElementById('showUserPicker1'); var RCResults = doc.getElementById('recive_type'); var RCResults2 = doc.getElementById('recive_type1'); var RCResults3 = doc.getElementById('recive_type2'); RCs.addEventListener('tap', function(event) { RCiPickers.show(function(items) { console.log(items) if(items[2].text == undefined) { RCResults.value = items[1].text; RCResults.setAttribute("data-index", items[1].id); } else if(items[1].text == undefined) { RCResults.value = items[0].text; RCResults.setAttribute("data-index", items[0].id); } else { RCResults.value = items[2].text RCResults.setAttribute("data-index", items[2].id); } //RCResults.value =items[0].text + "-" + items[1].text + "-" + items[2].text; //RCResults.setAttribute("data-index", items[0].id); //RCResults2.setAttribute("data-index", items[1].id); //RCResults3.setAttribute("data-index", items[2].id); //返回 false 可以阻止选择框的关闭 //return false; }); }, false); // 接收人员 cityPicker5 = new $.PopPicker(); var showCityPickerButton5 = doc.getElementById('showCityPicker5'); var cityResult5 = doc.getElementById('ower_recive'); showCityPickerButton5.addEventListener('tap', function(event) { getReceiveUser(); cityPicker5.show(function(items) { if (items[0].text!=undefined) { cityResult5.value = items[0].text; cityResult5.setAttribute("data-index", items[0].value); } //返回 false 可以阻止选择框的关闭 //return false; }); }, false); }) })(mui, document); })