| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- /**
- * 工单处理
- * */
- $(document).ready(function() {
- var deptId = '';
- var ID = helper.request.queryString("str");
- laydate.render({
- elem: '#t_inqtime',
- theme: '#1ab394',
- 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() {
- 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); //部门
- 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') {
- $('<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) {
- 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 否 处理人
- 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 = '<option value="">请选择</option>'
- result.data.forEach(function(v, n) {
- str += '<option value="' + v.F_DictionaryValueId + '">' + v.F_Name + '</option>'
- })
- 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 = '<option value="0">请选择</option>'
- $.getJSON(huayi.config.callcenter_url + 'CallOutPlan/GetDepartList', {
- "token": $.cookie("token")
- }, function(result) {
- if (result.state.toLowerCase() == "success") {
- result.data.forEach(function(v, n) {
- str += '<option value="' + v.F_DeptId + '">' + v.F_DeptName + '</option>'
- })
- 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 += '<option value="' + v.F_UserCode + '">' + v.F_UserName + '</option>'
- })
- 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('<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();
- }
|