| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- var ns;
- var id = helper.request.queryString("id");
- console.log(id)
- var phone = helper.request.queryString("phone");
- var objs = {};
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token")
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- if(data.data.groname == '客服组') {
- $('.customerService').show();
- ns = 1;
- } else {
- $('.market').show();
- ns = 2;
- }
- }
- }
- });
- if(id) {
- $("#tel").val(phone);
- $("#tel_market").val(phone);
- $("#CallID").val(id);
- }
- GDLY();
- State();
- //工单类型
- getOrderType();
- //来电单位
- getAccount('#comeCall_dep');
- // getAccount('#comeCall_dep_market');
- getAccount('#feedbackDep');
- // getAccount('#feedbackDep_market');
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- })
- $('.marketSubmit').click(function() {
- saveMarket();
- })
- // })
- //编辑器配置
- KindEditor.ready(function(K) {
- window.changeEditor = K.create('#feedBackCon');//修改弹出框编辑器
- XQ()
- })
-
-
-
- //工单状态
- function State(){
- $.ajax({
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- type: 'get',
- async: false,
- data: {
- flag: 'GDZT',
- token: $.cookie("token")
- },
- dataType: "json",
- success: function(res) {
- if(res.state == "success") {
- console.log(res.data);
- $(res.data).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
- })
- //
- }
- }
- })
- }
-
- //工单来源
- function GDLY(){
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: false,
- data: {
- token: $.cookie("token"),
- flag: "GDLY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
- })
- }
- });
- }
-
- //获取详情
- function XQ(){
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder",
- dataType: 'json',
- async: true,
- cache: false,
- data: {
- "orderid": id,
- "token": $.cookie("token")
- },
- success: function(result) {
- if(result.data.data.length > 0) {
- var data = result.data.data[0];
- var state = data.State;
- var state_;
- $("#xq_gdlx").text(data.GDLXName);
- $("#xq_cjsj").text(data.CreateTime);
- // $("#xq_gdzt").html(GetStateName(data.State));
- $("#name").val(data.Customer);
- $("#name_market").val(data.Customer);
- $("#tel_market").val(data.CustomerTel);
- $("#tel").val(data.CustomerTel);
- //
- $("#testInput1").val(data.Address);
- $("#testInput2").val(data.Source);
- $("#testInput3").val(data.Address);
- $("#testInput4").val(data.Source);
- $("#typeclass").val(data.GDLXName);
- // $("#feedBackCon").text(decodeURIComponent(data.Detail));
- changeEditor.html(decodeURIComponent(data.Detail));
- $("#remark_market").text(data.Detail);
- $("#express").text(data.Files);
- $("#remark1").text(data.City);
- $("#remark2").text(data.Province);
- $("#remark3").text(data.County);
- if(state == 0) {
- state_ = 471;
- } else {
- state_ = 472;
- }
- console.log(state_)
- $("#State").val(state_);
- $("#States").val(data.State);
- $("#DicValueList").val(data.Type);
- console.log(data.GDLYName)
- $("#typeclassId").val(data.TypeClass);
-
- }
- }
- });
- }
- //工单类型
- function getOrderType() {
- $.get(huayi.config.callcenter_url + 'WorkType/GetTreeList', {
- "token": $.cookie("token"),
- }, function(result) {
- result = $.parseJSON(result);
- $.fn.zTree.init($("#TreeDemo"), setting3, result.data); //实例化树形图
- });
- }
- var setting3 = {
- data: {
- key: {
- name: "text"
- },
- simpleData: {
- enable: true,
- idKey: "id",
- rootPId: 0
- }
- },
- callback: {
- onClick: changeTreeClick
- }
- }
- function changeTreeClick(event, treeId, treeNode) {
- var chanId = treeNode.id;
- var changeName = treeNode.text;
- $('#typeclass').val(changeName);
- $('#typeclassId').val(chanId);
- var pidnode = treeNode.getParentNode();
- };
- $('.down').click(function() {
- if($('.treeList').css('display') == 'block') {
- $('.treeList').css('display', 'none')
- } else {
- $('.treeList').css('display', 'block')
- }
- })
- $('#typeclass').click(function() {
- $('.treeList').css('display', 'block')
- })
- $('.treeList').mouseleave(function() {
- $(this).css('display', 'none')
- })
- //来电单位
- function getAccount(obj) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Customer/BindLDdep",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token")
- },
- success: function(data) {
- var Count = data.data.dep;
- $(Count).each(function(i, n) {
- $("<option value='" + n + "'>" + n + "</option>").appendTo($(obj));
- })
- // $(obj).selectpicker('refresh');
- }
- });
- }
- function saveCustomer() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrderDetail",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- orderid: id,
- customer: $('#name').val(), //姓名
- lddep: $('#testInput1').val(), //来电单位
- fkdep: $('#testInput2').val(), //反馈单位
- type: $('#DicValueList').val(), //工单来源
- typeclass: $('#typeclassId').val(), //工单类型id
- gdzt: $('#State').val(), //工单状态id
- detail: encodeURIComponent(changeEditor.html()), //反馈内容
- files: $('#express').val(), //快递信息
- remark1: $('#remark1').val(), //备注一
- remark2: $('#remark2').val(), //备注二
- remark3: $('#remark3').val() //备注三 callid:$("#CallID").val()
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- layer.msg("保存成功!");
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.$('#workorderlist').bootstrapTable('refresh');
- parent.layer.msg("修改成功!");
- clear();
- }
- }
- });
- }
- function saveMarket() {
- if($('#name_market').val() == '') {
- layer.confirm('请输入姓名!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- if($('#tel_market').val() == '') {
- layer.confirm('请输入电话!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- if($('#testInput3').val() == '') {
- layer.confirm('请选择来电单位!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrderDetail",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- orderid: $("#CallID").val(),
- customer: $('#name_market').val(), //姓名
- lddep: $('#testInput3').val(), //来电单位
- fkdep: $('#testInput4').val(), //反馈单位
- detail:$('#remark_market').val(), //备注
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
- layer.msg("保存成功!");
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.$('#workorderlist_').bootstrapTable('refresh');
- parent.layer.msg("修改成功!");
- clear();
- }
- }
- });
- }
- function clear() {
- if(ns == 1) {
- $('#name').val('');
- $('#tel').val(''); //号码
- $('#testInput1').val(''); //来电单位
- $('#testInput2').val(''); //反馈单位
- $('#orderSource').val(''); //工单来源
- $('#typeclassId').val(''); //工单类型id
- $('#State').val(''); //工单状态id
- changeEditor.html('') //反馈内容
- $('#express').val(''); //快递信息
- $('#remark1').val(''); //备注一
- $('#remark2').val(''); //备注二
- $('#remark3').val(''); //备注三
- } else {
- $('#name_market').val('');
- $('#tel_market').val(''); //号码
- $('#testInput3').val(''); //来电单位
- $('#testInput4').val(''); //反馈单位
- $('#remark_market').val(''); //备注内容
- }
- }
|