/** * 工单处理 * */ var buttontype = ''; $(document).ready(function() { var deptId = ''; var ID = helper.request.queryString("str"); laydate.render({ elem: '#t_inqtime', theme: '#00479D', calendar: 'true', }); getDepartList($('#t_county')); //营业部 getDepartList($('#clbmname')); //部门 autosize($('textarea')); $('#t_investigator').val($.cookie("u_code")); //给调查员默认值;当前用户的账号 helper.getDropList.getlistDropByDic($('#xl_boxs'), 'ZBDW'); //获取交办单位下拉 helper.getDropList.getlistDropByDic($('#xl_box'), 'WTFL') .then(function() { if (ID) { getWorkOrderInfo(ID); //获取工单信息 } }); //信息分类 // helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW') // .then(function() { // if(ID) { // getWorkOrderInfo(ID); //获取工单信息 // } // }); //点击确定 $("#clgd").click(function() { buttontype = '' dealWorkOrder(ID); }); //点击保存 $("#bcgd").click(function() { buttontype = 1 dealWorkOrder(ID); }); }) //点击显示外呼 $('.callout').click(function() { // if($("#top-search li",window.parent.document).find('i',window.parent.document).hasClass('active')){ if ($(".WH", window.parent.parent.document).hasClass("fadeOutUp")) { $(".WH", window.parent.parent.document).removeClass("fadeOutUp").addClass("fadeInDown"); } $('.WH', window.parent.parent.document).removeClass('hidens') $('.first', window.parent.parent.document).removeClass('first'); $('.WH', window.parent.parent.document).addClass('first'); $("#Result", window.parent.parent.document).val($('#cl_khdh').text()); window.parent.parent.loadWH(); // } }) //获取工单信息 function getWorkOrderInfo(oid) { $.ajax({ type: "get", url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder", async: true, dataType: 'json', data: { orderid: oid, token: $.cookie("token") }, success: function(data) { /*验证请求*/ if (data.state == "success") { var con = data; var Str = con.data.data; $('#cl_gdbh').text(Str[0].WorkOrderID); //工单编号 //$("#cl_gdlx").text(getTypeName(Str[0].Type)); //工单类型 $("#cl_khxm").val(Str[0].Customer); //姓名 $("#cl_khdh").text(Str[0].CustomerTel); //电话 $("#t_county").val(Str[0].County); //营业部 $("#t_address").val(Str[0].Address); //地址 $("#t_inqtime").val(Str[0].Inqtime && Str[0].Inqtime.split(' ')[0]); //调查时间 $("#t_inquser").val(Str[0].Inquser); //调查员 $("#t_detail").val(Str[0].Detail); //string 是 反映问题 $("#t_answer").val(Str[0].Answer); //string 否 回访反馈情况 $("#t_remarks").val(Str[0].Remark); //string 否 备注 $('#xl_box').val(Str[0].InfoTypeID); //问题分类 $(".xl_boxs").val(Str[0].Unit); //交办单位 $('#clbmname').val(Str[0].UnitID); //部门 $("#cont").val(Str[0].clcontent); deptId = Str[0].UnitID if (deptId) { getUserListByDepartment($('#clidname'), deptId, con.data.item[0].ToUser) } if (Str[0].InfoType) { getInfotypedetail($('#xq_rdwt'), Str[0].InfoType, Str[0].InfoTypeDetailID) } // $("#clidname").val(Str[0].CreateUser); //处理人 //$("#xl_box").val(Str[0].UnitID); //交办单位 //$('.Message_box').find('input[value="' + Str[0].InfoTypeID + '"]').attr('checked', true); //信息分类 var Files = data.data.data[0].File; console.log(data); $("#IMG_box").empty(); if (Files && Files.length > 0) { $(Files).each(function(i, n) { var fileType = n.F_FileType; var fileType1 = n.F_FileType.split("\/")[0]; if (fileType === '.jpg' || fileType === '.png' || fileType1 === 'image') { $('
' + '' + '' + n.F_FileName +
								'
').appendTo("#IMG_box"); } else { $('
' + '' + '

无法预览

' + '
').appendTo("#IMG_box"); } }); layer.photos({ photos: '#IMG_box', anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数) title: '查看图片', move: '.layui-layer-title', shadeClose: false, closeBtn: 1, area: ['80%', '90%'], tab: function(pic, layero) { helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero); }, }); } } } }); } //处理 function dealWorkOrder(oid) { var infotype = $('#xl_box').find('option:selected').text(); var infotypedetail = $('#xq_rdwt').find('option:selected').text(); if (infotype == '请选择') { infotype = '' } if (infotypedetail == '请选择') { infotypedetail = '' } if($('#cont').val() == '') { layer.confirm('请输入问题处理情况!', { icon: 2, btn: ['确定'] }); return; } $.post(huayi.config.callcenter_url + 'WorkOrder/DealWorkOrder', { orderid: oid, //string 是 工单编号 customer: $('#cl_khxm').val(), //string 是 客户姓名 country: $('#t_county').val(), //string 否 乡镇或单位 //country: $("#t_county").find("option:selected").text(), address: $('#t_address').val(), //string 否 住址 inqtime: $('#t_inqtime').val(), //string 否 调查时间 inquser: $('#t_inquser').val(), //string 否 调查员 detail: $('#t_detail').val(), //string 是 反映问题 // answer: $('#t_answer').val(), //string 否 回访反馈情况 cont: $('#cont').val(), //问题处理情况 remark: $('#t_remarks').val(), //string 否 备注 isend: $("input[name='ltype']:checked").val(), //int 是 是否结束 0否,1是 isrestore: $("input[name='isT']:checked").val(), //是否修复 unit: $("#clbmname").val(), //string 否 交办单位 infotype: infotype, //string 否 信息分类 infotypeid: $('#xl_box').val(), infotypedetail: infotypedetail, infotypedetailid: $('#xq_rdwt').val(), clbm: $("#clbmname").val(), //string 否 处理部门 clgh: $("#clidname").val(), //string 否 处理人 buttontype:buttontype, token: $.cookie("token") }, function(result) { result = $.parseJSON(result); if (result.state.toLowerCase() == "success") { var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭 parent.initTable(); parent.Hiden(); parent.layer.msg("处理工单成功"); } }) } $('#xl_box').change(function() { getInfotypedetail($('#xq_rdwt'), $('#xl_box').find('option:selected').text()) }) function getInfotypedetail(obj, val, name) { $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByDescribe', { "token": $.cookie("token"), des: val }, function(result) { if (result.state.toLowerCase() == "success") { let str = '' result.data.forEach(function(v, n) { str += '' }) obj.html(str) if (name) { $('#xq_rdwt').val(name) } } }) } //下拉选项 //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框; // getBM($("#zrbmtree")); // getBM($("#clbmtree")); //标签切换 $(".ldtp-cr ul.ld-service li").click(function() { $(this).addClass("cr-click").siblings().removeClass("cr-click"); var index = $(this).index(); $(".gsxx").find(".sqzx").eq(index).addClass("Shows").siblings().removeClass("Shows"); if (index == 2) { getLX($(".tslx"), "TSLX"); getBM($("#zrbmtree")); getBM($("#clbmtree")); } }); //tree下拉框效果 $(".inpBox .tree").click(function() { if ($(this).parent().find(".addTree").is(":hidden")) { $(this).parent().find(".addTree").show(); } else { $(this).parent().find(".addTree").hide(); } }); //普通下拉框效果 $(".inpBox .select").click(function() { if ($(this).parent().find(".xl_common").is(":hidden")) { $(this).parent().find(".xl_common").show(); } else { $(this).parent().find(".xl_common").hide(); } }); $(".xl").click(function() { if ($(this).parent().find(".addTree").is(":hidden")) { $(this).parent().find(".addTree").show(); } else { $(this).parent().find(".addTree").hide(); } if ($(this).parent().find(".xl_common").is(":hidden")) { $(this).parent().find(".xl_common").show(); } else { $(this).parent().find(".xl_common").hide(); } }); $(".inpBox").mouseleave(function() { $(this).children(".xl_common").hide(); $(this).children(".addTree").hide(); }) //删除 $(".inpBox").hover(function(event) { $(this).children(".de_icon").show(); event.stopPropagation(); }, function() { $(this).children(".de_icon").hide(); }); $(".de_icon").click(function(event) { event.stopPropagation(); $(this).siblings("input").eq(0).val(""); $(this).siblings("input").eq(1).val(""); if ($(this).siblings("div").find("ul").attr("id") == "zrbmtree") { getRY($(".zrid"), $("#zrbm").val()); } if ($(this).siblings("div").find("ul").attr("id") == "clbmtree") { getRY($(".clid"), $("#clbm").val()); } }); //20180518byfanlongfei将处理部门、处理人、信息分类、交办单位修改为文本框; //获取部门 //营业部(部门) function getDepartList(obj) { obj.empty(); let str = '' $.getJSON(huayi.config.callcenter_url + 'CallOutPlan/GetDepartList', { "token": $.cookie("token") }, function(result) { if (result.state.toLowerCase() == "success") { result.data.forEach(function(v, n) { str += '' }) obj.html(str) } }) } //获取处理人员 $('#clbmname').change(function() { getUserListByDepartment($('#clidname'), $('#clbmname').val()) }) function getUserListByDepartment(obj, deptid, name) { obj.empty(); let str = '' $.getJSON(huayi.config.callcenter_url + 'CallInScreen/getUserListByDepartment', { "token": $.cookie("token"), deptid: deptid }, function(result) { if (result.state.toLowerCase() == "success") { result.data.forEach(function(v, n) { str += '' }) obj.html(str) if (name) { $("#clidname").val(name) } } }) } //获取类型 function getLX(obj, type) { obj.empty(); $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "flag": type, "token": $.cookie("token") }, function(result) { if (result.state.toLowerCase() == "success") { $(result.data).each(function(i, n) { obj.append('
  • ' + n.F_Name + '
  • '); }) obj.find("li").click(function(event) { if (event) { event.stopPropagation(); } $(this).parent().parent().parent().find("input").eq(0).val($(this).text()); $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid")); $(this).parent().parent().hide(); }); } }) } //下载 function downloadFile(data, strFileName, strMimeType) { console.log(111) event.preventDefault(); //详细见文档 http://danml.com/download.html var x = new XMLHttpRequest(); x.open("GET", data, true); x.responseType = 'blob'; x.onload = function(e) { download(x.response, strFileName, strMimeType); } x.send(); }