| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552 |
- /**
- * 工单处理
- * */
- $(document).ready(function() {
- var ID = helper.request.queryString("str");
- laydate.render({
- elem: '#t_inqtime',
- theme: '#1ab394',
- calendar: 'true',
- });
- autosize($('textarea'));
- // helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW'); //获取乡镇或单位下拉
- $('#t_investigator').val($.cookie("u_code"));//给调查员默认值;当前用户的账号
- helper.getDropList.getlistDropByDic($('#xl_boxs'), 'ZBDW'); //获取交办单位下拉
- helper.getDropList.getlistDropByDic($('#xl_box'), 'XXFL'); //信息分类
- //getDealDept(); //获取交办单位
- //获取乡镇或单位下拉//获取信息分类
- //$.when(helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW'), getInfoClass())
- helper.getDropList.getlistDropByDic($('#t_county'), 'JBDW')
- .then(function() {
- if(ID) {
- getWorkOrderInfo(ID); //获取工单信息
- }
- });
- /* //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(".addTree").hide();
- $(this).children(".xl_common").hide();
- })
- $(".xl_box").on("click", "li", function() {
- var obj = $(this).parent().parent().parent();
- obj.find("input").eq(0).val($(this).text());
- obj.find("input").eq(1).val($(this).attr("itemid"));
- obj.find(".xl_common").hide();
- })
- $("input[name='ltype']").click(function() {
- var val = $("input[name='ltype']:checked").val();
- if(val == '0') {
- $(".js").show();
- getBM($("#zrbmtree"));
- } else if(val == '1') {
- $(".js").hide();
- }
- })*/
- //点击确定
- $("#clgd").click(function() {
- /*var val = $("input[name='ltype']:checked").val();
- if(!val) {
- layer.confirm('请选择处理方式!', {
- btn: ['确定']
- });
- return;
- }
- if(val == '0') {
- if(!$("#clbm").val()) {
- layer.confirm('请选择接收部门!', {
- btn: ['确定']
- });
- return;
- }
- }
- if(!$("#cont").val()) {
- layer.confirm('请输入处理内容!', {
- btn: ['确定']
- });
- return;
- }*/
- dealWorkOrder(ID);
- });
- })
- /*//获取交办单位
- function getDealDept() {
- $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
- flag: 'JBDW',
- token: $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- $('<option value="0">请选择</option>').appendTo("#xl_box");
- for(var i = 0; i < result.data.length; i++) {
- $('<option value="' + result.data[i].F_DictionaryValueId + '">' + result.data[i].F_Name + '</option>').appendTo("#xl_box");
- }
- }
- })
- }
- ////获取信息分类
- function getInfoClass() {
- var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
- $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', {
- flag: 'XXFL',
- token: $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- for(var i = 0; i < result.data.length; i++) {
- var html = '<label class="radio-inline" style="font-weight: normal;">' +
- '<input type="radio" value="' + result.data[i].F_DictionaryValueId + '" name="ltypes" /> ' + result.data[i].F_Name + '' +
- '</label>';
- $(html).appendTo(".Message_box");
- }
- }
- dtd.resolve(); // 改变Deferred对象的执行状态
- });
- return dtd.promise(); // 返回promise对象
- }*/
- //点击显示外呼
- $('.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].InfoType); //信息分类
- $(".xl_boxs").val(Str[0].Unit); //交办单位
-
- //$("#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') {
- $('<div class="img-box">' +
- '<span class="img_mask"><span onclick=downloadFile("'+ n.F_FileUrl + '","' + n.F_FileName + '","' + n.F_FileType +
- '") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
- '<img layer-src="' + n.F_FileUrl + '" src="' + n.F_FileUrl + '" alt="' + n.F_FileName +
- '" class="image-item" /><div>').appendTo("#IMG_box");
- } else {
- $('<div class="img-box">' +
- '<span class="img_mask"><span href="javascript:;" onclick=downloadFile("' + n.F_FileUrl + '","' + n.F_FileName +
- '","' + n.F_FileType +
- '") title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></span></span>' +
- '<div class="noThumb" title="文件"><i class="glyphicon glyphicon-paperclip"></i><p class="file_list">无法预览</p></div>' +
- '</div>').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) {
- // $('.layui-layer-content').on("mousewheel", function(e, d) {
- //
- // helper.methods.zoomImg($('#layui-layer-photos').find('img[alt="' + pic.alt + '"]'), d);
- // $('#layui-layer-photos').find('img[alt="' + pic.alt + '"]').dragging({
- // move: "both", //拖动方向,x y both
- // randomPosition: false //初始位置是否随机
- // });
- // return false;
- //
- // });
- helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero);
- },
- });
- }
- // var Files = Str[0].Files;
- // if(Files) {
- // var a;
- // var b;
- // $(Files).each(function(i, n) {
- // a = n.F_FileType.split("\/")[0];
- // b = n.F_FileName.split(".")[1];
- // console.log(a);
- // if(a == 'image') {
- // $('<div class="img-box"><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><img src="' + n.F_FileUrl + '" alt="" class="image-item" data-preview-group="1" /><span class="">' + b + '</span></a><div>').appendTo(".space");
- // } else {
- // $('<div class="img-box "><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><span class="">' + b + '</span></a><div>').appendTo(".space");
- // }
- //
- // })
- // }
- }
- }
- });
- }
- /*
- //获取工单类型
- function getTypeName(val) {
- var str = '';
- switch(val + '') {
- case '1':
- str = "咨询";
- break;
- case '2':
- str = "报修服务";
- break;
- case '3':
- str = "投诉建议";
- break;
- }
- return str;
- }
- //获取部门
- var setting = {
- data: {
- key: {
- name: "F_DeptName"
- },
- simpleData: {
- enable: true,
- idKey: "F_DeptId",
- pIdKey: "F_ParentId",
- rootPId: 0
- }
- },
- callback: {
- onClick: zTreeOnClick
- }
- };
- function getBM(obj) {
- $.getJSON(huayi.config.callcenter_url + 'Department/GetAllList', {
- token: $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- $.fn.zTree.init(obj, setting, result.data);
- }
- })
- }
- function zTreeOnClick(event, treeId, treeNode) {
- if(event) {
- event.stopPropagation();
- }
- var obj = $("#" + event.data.treeId).parent();
- obj.parent().find("input").eq(0).val(treeNode.F_DeptName);
- obj.parent().find("input").eq(1).val(treeNode.F_DeptId);
- obj.hide();
- getRY($(".clid"), $("#clbm").val());
- };
- //获取人员
- function getRY(obj, deptid) {
- obj.empty();
- obj.append('<li itemid="">--请选择--</li>');
- obj.parent().parent().find("input").eq(0).val("--请选择--");
- obj.parent().parent().find("input").eq(1).val("");
- $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
- deptid: deptid,
- token: $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- $(result.data).each(function(i, n) {
- obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '</li>');
- });
- 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 dealWorkOrder(oid) {
- var infotype=$('#xl_box').find('option:selected').text();
- var unit=$('#xl_boxs').find('option:selected').text();
- if(infotype=='请选择'){
- infotype=''
- }
- if(unit=='请选择'){
- unit=''
- }
- $.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 否 回访反馈情况
- remark: $('#t_remarks').val(), //string 否 备注
- cont: $("#cont").val(), //string 否 问题处理情况
-
- isend: $("input[name='ltype']:checked").val(), //int 是 是否结束 0否,1是
- unit: unit, //string 否 交办单位
- infotype: infotype, //string 否 信息分类
- clbm: $("#t_unit").val(), //string 否 处理部门
- clgh: $("#t_clr").val(), //string 否 处理人
- /*clbm: $("#clbm").val(), //int 否 处理部门
- clid: $("#clid").val(), //int 否 处理人
- cont: $("#cont").val(), //string 否 问题处理情况
- infotypeid: $("input[name='ltypes']:checked").val(), //int 否 信息分类id,默认为0
- unitid: $("#xl_box").val(), //int 否 交办单位id,默认为0*/
-
- 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("处理工单成功");
- }
- })
- }
- //下拉选项
- //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将处理部门、处理人、信息分类、交办单位修改为文本框;
- //获取部门
- var setting = {
- data: {
- key: {
- name: "F_DeptName"
- },
- simpleData: {
- enable: true,
- idKey: "F_DeptId",
- pIdKey: "F_ParentId",
- rootPId: 0
- }
- },
- callback: {
- onClick: zTreeOnClick
- }
- };
- function getBM(obj) {
- $.getJSON(huayi.config.callcenter_url + 'Department/GetAllList', {
- "token": $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- $.fn.zTree.init(obj, setting, result.data);
- }
- })
- }
- var did; //部门id
- function zTreeOnClick(event, treeId, treeNode) {
- did = treeNode.F_DeptId;
- if(event) {
- event.stopPropagation();
- }
- var obj = $("#" + event.data.treeId).parent();
- obj.parent().find("input").eq(0).val(treeNode.F_DeptName);
- obj.parent().find("input").eq(1).val(treeNode.F_DeptId);
- obj.hide();
- if(event.data.treeId == "zrbmtree") {
- getRY($(".zrid"), $("#zrbm").val());
-
- }
- if(event.data.treeId == "clbmtree") {
- getRY($(".clid"), $("#clbm").val());
- }
- };
- //获取人员
- function getRY(obj, deptid) {
- obj.empty();
- obj.append('<li itemid="">--请选择--</li>');
- obj.parent().parent().find("input").eq(0).val("--请选择--");
- obj.parent().parent().find("input").eq(1).val("");
- $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
- "deptid": deptid,
- "token": $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- $(result.data).each(function(i, n) {
- obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '</li>');
- })
- 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 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('<li itemid="' + n.F_DictionaryValueId + '">' + n.F_Name + '</li>');
- })
- 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();
- }
|