説明なし

WorkOrderTransfer.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. /**
  2. * 工单分配
  3. * */
  4. $(document).ready(function() {
  5. autosize($('textarea'));
  6. var ID = helper.request.queryString("oid"); //工单编号
  7. if(ID) {
  8. getWorkOrderInfo(ID);
  9. }
  10. //tree下拉框效果
  11. $(".inpBox .tree").click(function() {
  12. if($(this).parent().find(".addTree").is(":hidden")) {
  13. $(this).parent().find(".addTree").show();
  14. } else {
  15. $(this).parent().find(".addTree").hide();
  16. }
  17. });
  18. //普通下拉框效果
  19. $(".inpBox .select").click(function() {
  20. if($(this).parent().find(".xl_common").is(":hidden")) {
  21. $(this).parent().find(".xl_common").show();
  22. } else {
  23. $(this).parent().find(".xl_common").hide();
  24. }
  25. });
  26. $(".xl").click(function() {
  27. if($(this).parent().find(".addTree").is(":hidden")) {
  28. $(this).parent().find(".addTree").show();
  29. } else {
  30. $(this).parent().find(".addTree").hide();
  31. }
  32. if($(this).parent().find(".xl_common").is(":hidden")) {
  33. $(this).parent().find(".xl_common").show();
  34. } else {
  35. $(this).parent().find(".xl_common").hide();
  36. }
  37. });
  38. $(".inpBox").mouseleave(function() {
  39. $(this).children(".addTree").hide();
  40. $(this).children(".xl_common").hide();
  41. });
  42. $(".xl_box").on("click", "li", function() {
  43. var obj = $(this).parent().parent().parent();
  44. obj.find("input").eq(0).val($(this).text());
  45. obj.find("input").eq(1).val($(this).attr("itemid"));
  46. obj.find(".xl_common").hide();
  47. });
  48. getBM($("#zrbmtree"));
  49. //点击确定
  50. $("#clgd").click(function() {
  51. if(!$("#clbm").val()) {
  52. layer.confirm('请选择接收部门!', {
  53. icon: 2,
  54. btn: ['确定']
  55. });
  56. return;
  57. }
  58. // if(!$("#cont").val()) {
  59. // layer.confirm('请输入处理内容!', {
  60. // icon: 2,
  61. // btn: ['确定']
  62. // });
  63. // return;
  64. // }
  65. dealWorkOrder(ID);
  66. });
  67. })
  68. $("#clbm").blur(function(){
  69. // alert($("#clbm").val())
  70. // if($("#clbm").find("input").text()=="市场管理科"){
  71. // $("#abcd").show()
  72. // }else{
  73. // $("#abcd").hide()
  74. // }
  75. })
  76. $('#yijian').find('input[type="radio"]').on('change', function() {
  77. if($(this).val() == "不同意") { //业务办理
  78. $('#nnn,#nnn').show();
  79. }else{
  80. $('#nnn,#nnn').hide();
  81. }
  82. });
  83. $('#buchang').find('input[type="radio"]').on('change', function() {
  84. if($(this).val() == "钱款") { //业务办理
  85. $('#mmm,#mmm').show();
  86. }else{
  87. $('#mmm,#mmm').hide();
  88. }
  89. });
  90. //获取工单信息
  91. function getWorkOrderInfo(oid) {
  92. $.ajax({
  93. type: "get",
  94. url: huayi.config.callcenter_url + "WorkOrderNew/GetDetails",
  95. async: true,
  96. dataType: 'json',
  97. data: {
  98. id: oid,
  99. token: $.cookie("token")
  100. },
  101. success: function(data) {
  102. /*验证请求*/
  103. if(data.state == "success") {
  104. var Str = data.rows;
  105. if(Str && Str.length > 0) {
  106. $('#cl_gdbh').text(Str[0].F_WorkOrderCode); //工单编号
  107. $("#cl_gdlx").text(Str[0].F_TypeName); //工单类型
  108. $("#xq_source").text(Str[0].F_SourceName); //工单来源
  109. // $("#xq_handle").text(Str[0].YWLXName); //业务办理
  110. $("#cl_khxm").text(Str[0].F_CusName); //姓名
  111. $("#cl_khdh").text(helper.filter.cutTel(Str[0].F_CusPhone)); //电话
  112. $('#cl_gdnr').text(decodeURIComponent(Str[0].Detail));
  113. // if($("#cl_gdlx").text()=="抽检"){
  114. // alert(Str[0].F_TypeName)
  115. // }else if($("#cl_gdlx").text()=="投诉"){
  116. // alert(Str[0].F_TypeName)
  117. // } else{
  118. // alert(Str[0].F_TypeName)
  119. // }
  120. //微信内文件(暂时不用)
  121. var Files = Str[0].Files;
  122. if(Files) {
  123. var a;
  124. var b;
  125. $(Files).each(function(i, n) {
  126. a = n.F_FileType.split("\/")[0];
  127. b = n.F_FileName.split(".")[1];
  128. // console.log(a);
  129. if(a == 'image') {
  130. $('<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");
  131. } else {
  132. $('<div class="img-box "><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><span class="">' + b + '</span></a><div>').appendTo(".space");
  133. }
  134. })
  135. }
  136. }
  137. }
  138. }
  139. });
  140. }
  141. //获取工单类型
  142. function getTypeName(val) {
  143. var str = '';
  144. switch(val + '') {
  145. case '1':
  146. str = "咨询";
  147. break;
  148. case '2':
  149. str = "投诉";
  150. break;
  151. case '3':
  152. str = "抽检";
  153. break;
  154. // case '4':
  155. // str = "其他";
  156. // break;
  157. }
  158. return str;
  159. }
  160. //获取部门
  161. var setting = {
  162. data: {
  163. key: {
  164. name: "text"
  165. },
  166. simpleData: {
  167. enable: true,
  168. idKey: "id",
  169. pIdKey: "ParentId",
  170. rootPId: 0
  171. }
  172. },
  173. callback: {
  174. onClick: zTreeOnClick
  175. }
  176. };
  177. function getBM(obj) {
  178. $.getJSON(huayi.config.callcenter_url + 'Department/GetDeptList', {
  179. token: $.cookie("token")
  180. }, function(result) {
  181. if(result.state.toLowerCase() == "success") {
  182. var treeObj = $.fn.zTree.init(obj, setting, result.data);
  183. treeObj.expandAll(true);
  184. }
  185. })
  186. }
  187. function zTreeOnClick(event, treeId, treeNode) {
  188. if(event) {
  189. event.stopPropagation();
  190. }
  191. var obj = $("#" + event.data.treeId).parent();
  192. obj.parent().find("input").eq(0).val(treeNode.text);
  193. obj.parent().find("input").eq(1).val(treeNode.id);
  194. obj.hide();
  195. getRY($(".clid"), $("#clbm").val());
  196. //alert($("#clbm").val());
  197. if ($("#clbm").val()==37) {
  198. if($("#cl_gdlx").text()=="抽检"){
  199. $("#abcde").show();
  200. $("#abcdef").hide();
  201. }else if($("#cl_gdlx").text()=="投诉"){
  202. $("#abc").show();
  203. $("#abcd").hide();
  204. }else if($("#cl_gdlx").text()=="咨询"){
  205. $("#abc").show();
  206. $("#abcd").hide();
  207. }
  208. }
  209. if ($("#clbm").val()==12) {
  210. if($("#cl_gdlx").text()=="抽检"){
  211. $("#abcdef").show();
  212. $("#abcde").hide();
  213. }else if($("#cl_gdlx").text()=="投诉"){
  214. $("#abcd").show();
  215. $("#abc").hide();
  216. }else if($("#cl_gdlx").text()=="咨询"){
  217. $("#abcd").show();
  218. $("#abc").hide();
  219. }
  220. }
  221. };
  222. //获取人员
  223. function getRY(obj, deptid) {
  224. var proid = helper.request.queryString("proid"); //项目id
  225. obj.empty();
  226. obj.append('<li itemid="">--请选择--</li>');
  227. obj.parent().parent().find("input").eq(0).val("--请选择--");
  228. obj.parent().parent().find("input").eq(1).val("");
  229. $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
  230. proid: proid,
  231. deptid: deptid,
  232. token: $.cookie("token")
  233. }, function(result) {
  234. if(result.state.toLowerCase() == "success") {
  235. $(result.data).each(function(i, n) {
  236. obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '(' + n.F_UserCode + ')</li>');
  237. });
  238. obj.find("li").click(function(event) {
  239. if(event) {
  240. event.stopPropagation();
  241. }
  242. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  243. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  244. $(this).parent().parent().hide();
  245. });
  246. }
  247. })
  248. }
  249. //派单(分配)
  250. function dealWorkOrder(oid) {
  251. // var ltype = $("input[name='ltype']:checked").val();
  252. var isDetail = helper.request.queryString("isDetail"); //是否是详情页面的处理
  253. // if($.trim($('#clbmname').val()) && !$('#clid').val()){
  254. // layer.confirm('请选择接收人!', {
  255. // icon: 2,
  256. // btn: ['确定']
  257. // });
  258. // return;
  259. // }
  260. $.post(huayi.config.callcenter_url + 'WorkOrderNew/AssignWorkOrder', {
  261. orderid: oid, //否 strubg 工单ID
  262. // isend: ltype, //否 int
  263. overtime: $("#Depth").val(), //是否短信回访
  264. clbm: $("#clbm").val(), //是 int 部门Id
  265. clid: $("#clid").val(), //否 int 接收人用户id
  266. cont: $("#cont").val(), //否 int 处理内容
  267. sms: $("#duanxin").find('input[type="radio"]:checked').val(),//短信提醒
  268. QualityMonth: $("#zhibao").val(), //否 int 处理内容
  269. PreliminaryOpinion: $("#chushen").val(),
  270. isvisit: $("#huifang").find('input[type="radio"]:checked').val(),
  271. QualityEventLevel: $("#dengji").val(),
  272. ApprovalDisagree: $("#butong").val(),
  273. ResponsibleUnit: $("#duoxuan").find('input[type="checkbox"]:checked').val(),
  274. ApprovalOpinions: $("#yijian").find('input[type="radio"]:checked').val(),
  275. CompensationMethod: $("#buchang").find('input[type="radio"]:checked').val(),
  276. CompensationMoney: $("#buqian").val(),
  277. CResponsibleUnits: $("#danwei").val(),
  278. Fquantity: $("#shuliang").val(),
  279. ImprovementRequirements: $("#yaoqiu").val(),
  280. CApprovalNo: $("#danhao").val(),
  281. SpotResult: $("#chou").val(),
  282. SelfResult: $("#zijian").val(),
  283. ApprovalNo: $("#duiying").val(),
  284. ReturnAccount: $("#shenpi").val(),
  285. isvisit: $("#hui_FA").find('input[type="radio"]:checked').val(),
  286. IsRecord: $("#shenpi").val(),
  287. ClaimAmount: $("#suopeijin").val(),
  288. token: $.cookie("token")
  289. }, function(result) {
  290. result = $.parseJSON(result);
  291. if(result.state.toLowerCase() == "success") {
  292. if(isDetail === "true") {
  293. parent.parent.layer.closeAll();
  294. parent.parent.$('#orderlist').bootstrapTable('refresh');
  295. parent.parent.layer.msg("工单转派成功!");
  296. } else {
  297. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  298. parent.layer.close(index); //再执行关闭
  299. parent.$('#workorderlist').bootstrapTable('refresh');
  300. parent.$('.Closed').trigger('click');
  301. parent.layer.msg("工单转派成功!");
  302. }
  303. top.workcount();
  304. }
  305. })
  306. }
  307. $(document).ready(function () {
  308. var wid = helper.request.queryString("wid");
  309. // CPZL($("#zhibao"));//产品种类
  310. SCCS($("#chushen"));//初审意见
  311. ZLSJDJ($("#dengji"));//质量事件等级
  312. ZLZRDW($("#danwei"));//责任单位
  313. SCCJJG($("#chou"));//责任单位
  314. });
  315. // function CPZL(obj) {
  316. // obj.empty();
  317. // obj.append('<option selected="selected" value="">请选择</option>');
  318. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetProTime", {
  319. // "token": $.cookie("token"),
  320. // flag:"CPZL",
  321. // }, function (data) {
  322. // if (data.state.toLowerCase() == "success") {
  323. // var content = data.data;
  324. // $(content).each(function (i, n) {
  325. // $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  326. // })
  327. // }
  328. // })
  329. // }
  330. function SCCS(obj) {
  331. obj.empty();
  332. obj.append('<option selected="selected" value="">请选择</option>');
  333. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  334. "token": $.cookie("token"),
  335. flag:"SCCS",
  336. }, function (data) {
  337. if (data.state.toLowerCase() == "success") {
  338. var content = data.data;
  339. $(content).each(function (i, n) {
  340. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  341. })
  342. }
  343. })
  344. }
  345. //质量事件等级
  346. function ZLSJDJ(obj) {
  347. obj.empty();
  348. obj.append('<option selected="selected" value="">请选择</option>');
  349. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  350. "token": $.cookie("token"),
  351. flag:"ZLSJDJ",
  352. }, function (data) {
  353. if (data.state.toLowerCase() == "success") {
  354. var content = data.data;
  355. $(content).each(function (i, n) {
  356. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  357. })
  358. }
  359. })
  360. }
  361. //责任单位
  362. function ZLZRDW(obj) {
  363. obj.empty();
  364. obj.append('<option selected="selected" value="">请选择</option>');
  365. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  366. "token": $.cookie("token"),
  367. flag:"ZLZRDW",
  368. }, function (data) {
  369. if (data.state.toLowerCase() == "success") {
  370. var content = data.data;
  371. $(content).each(function (i, n) {
  372. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  373. })
  374. }
  375. })
  376. }
  377. //抽检结果
  378. function SCCJJG(obj) {
  379. obj.empty();
  380. obj.append('<option selected="selected" value="">请选择</option>');
  381. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  382. "token": $.cookie("token"),
  383. flag:"SCCJJG",
  384. }, function (data) {
  385. if (data.state.toLowerCase() == "success") {
  386. var content = data.data;
  387. $(content).each(function (i, n) {
  388. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  389. })
  390. }
  391. })
  392. }