Няма описание

WorkOrderTransfer.js 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  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. //确定点击按钮
  11. $("#clgd").click(function() {
  12. //alert($("#gcDuanxin").find('input[type="radio"]:checked').val());
  13. //alert($("#gcRevice").val());
  14. dealWorkOrder(ID);
  15. });
  16. //tree下拉框效果
  17. $(".inpBox .tree").click(function() {
  18. if($(this).parent().find(".addTree").is(":hidden")) {
  19. $(this).parent().find(".addTree").show();
  20. } else {
  21. $(this).parent().find(".addTree").hide();
  22. }
  23. });
  24. //普通下拉框效果
  25. $(".inpBox .select").click(function() {
  26. if($(this).parent().find(".xl_common").is(":hidden")) {
  27. $(this).parent().find(".xl_common").show();
  28. } else {
  29. $(this).parent().find(".xl_common").hide();
  30. }
  31. });
  32. $(".xl").click(function() {
  33. if($(this).parent().find(".addTree").is(":hidden")) {
  34. $(this).parent().find(".addTree").show();
  35. } else {
  36. $(this).parent().find(".addTree").hide();
  37. }
  38. if($(this).parent().find(".xl_common").is(":hidden")) {
  39. $(this).parent().find(".xl_common").show();
  40. } else {
  41. $(this).parent().find(".xl_common").hide();
  42. }
  43. });
  44. // $(".inpBox").mouseleave(function() {
  45. // $(this).children(".addTree").hide();
  46. // $(this).children(".xl_common").hide();
  47. // });
  48. //清除
  49. $(".Cleans ").click(function () {
  50. $('.inps').val("");
  51. $("#PID").val("");
  52. $("#Dpment").val("");
  53. })
  54. $(".xl_box").on("click", "li", function() {
  55. var obj = $(this).parent().parent().parent();
  56. obj.find("input").eq(0).val($(this).text());
  57. obj.find("input").eq(1).val($(this).attr("itemid"));
  58. obj.find(".xl_common").hide();
  59. });
  60. getBM($("#zrbmtree"));
  61. $('#btn_cha').click(function(){
  62. initTable();
  63. })
  64. })
  65. //获取部门
  66. var setting = {
  67. data: {
  68. key: {
  69. name: "text"
  70. },
  71. simpleData: {
  72. enable: true,
  73. idKey: "id",
  74. pIdKey: "ParentId",
  75. rootPId: 0
  76. }
  77. },
  78. callback: {
  79. onClick: zTreeOnClick
  80. }
  81. };
  82. function darptSearch() {
  83. $('.xlAdd').css('display', 'none');
  84. $(".selDpart1").css('display', 'block');
  85. depart();
  86. }
  87. function getBM(obj) {
  88. $.getJSON(huayi.config.callcenter_url + 'Department/GetAssignDeptList', {
  89. token: $.cookie("token"),
  90. keywords:$('.inps').val(),
  91. }, function(result) {
  92. if(result.state.toLowerCase() == "success") {
  93. // alert(111111);
  94. var treeObj = $.fn.zTree.init(obj, setting, result.data);
  95. treeObj.expandAll(false);
  96. }
  97. })
  98. }
  99. function zTreeOnClick(event, treeId, treeNode) {
  100. if(event) {
  101. event.stopPropagation();
  102. }
  103. var obj = $("#" + event.data.treeId).parent();
  104. obj.parent().find("input").eq(0).val(treeNode.text);
  105. obj.parent().find("input").eq(1).val(treeNode.id);
  106. obj.hide();
  107. getRY($(".clid"), $("#clbm").val());
  108. };
  109. $("#sponsor").on('click', 'li', function() {
  110. $(".selDpart1").css('display', 'none');
  111. $(".tree").val($(this).html());
  112. $("#Dpment").val($(this).attr("index"));
  113. $(".Cleans").show();
  114. getRY($(".clid"), $("#clbmname").val());
  115. })
  116. function depart() {
  117. $("#sponsor").empty();
  118. $.getJSON(huayi.config.callcenter_url + "WorkOrderNew/GetModelDeptName", {
  119. "token": $.cookie("token"),
  120. F_DeptName: $('.inps').val(),
  121. }, function(data) {
  122. if(data.state.toLowerCase() == "success") {
  123. var content = data.data;
  124. $(content).each(function(i, n) {
  125. $("<li index='" + n.depname + "'>" + n.deptid + "</li>").appendTo("#sponsor");
  126. })
  127. getRY($(".clid"), $("#clbm").val());
  128. }
  129. })
  130. }
  131. //获取人员
  132. function getRY(obj, deptid) {
  133. var proid = helper.request.queryString("proid"); //项目id
  134. obj.empty();
  135. obj.append('<li itemid="">--请选择--</li>');
  136. obj.parent().parent().find("input").eq(0).val("--请选择--");
  137. obj.parent().parent().find("input").eq(1).val("");
  138. $.getJSON(huayi.config.callcenter_url + 'UserAccount/GetDeptUserList', {
  139. proid: proid,
  140. deptid: deptid,
  141. token: $.cookie("token")
  142. }, function(result) {
  143. if(result.state.toLowerCase() == "success") {
  144. $(result.data).each(function(i, n) {
  145. obj.append('<li itemid="' + n.F_UserId + '">' + n.F_UserName + '(' + n.F_UserCode + ')</li>');
  146. });
  147. obj.find("li").click(function(event) {
  148. if(event) {
  149. event.stopPropagation();
  150. }
  151. $(this).parent().parent().parent().find("input").eq(0).val($(this).text());
  152. $(this).parent().parent().parent().find("input").eq(1).val($(this).attr("itemid"));
  153. $(this).parent().parent().hide();
  154. });
  155. }
  156. })
  157. }
  158. getReceiveUser();
  159. //获取接收人员
  160. function getReceiveUser() {
  161. $.ajax({
  162. url: huayi.config.callcenter_url + 'WxLogin/GetHighlevel',
  163. type: 'get',
  164. data: {
  165. token: $.cookie("token")
  166. },
  167. dataType: "json",
  168. async: true,
  169. success: function(res) {
  170. $("#gcRevice").empty();
  171. if(res.state.toLowerCase() === "success") {
  172. res = res.data.user;
  173. if(res && res.length > 0) {
  174. $("#gcRevice").append('<option value="">请选择接收人</option>');
  175. res.forEach(function(v, i) {
  176. $("#gcRevice").append('<option value="' + v.F_UserId + '" data-code="'+ v.F_UserId +'">' + v.F_UserName + '('+ v.F_UserCode +')</option>');
  177. });
  178. }
  179. }
  180. },
  181. });
  182. }
  183. $('#gcDuanxin').find('input[type="radio"]').on('change', function() {
  184. if($(this).val() == "0") { //业务办理
  185. $(".gcSelDiv").hide();
  186. $(".gcSelDiv").val("");
  187. }else{
  188. $(".gcSelDiv").show();
  189. }
  190. });
  191. $('#yijian').find('input[type="radio"]').on('change', function() {
  192. if($(this).val() == "不同意") { //业务办理
  193. $('#pionn,#piocni').show();
  194. }else{
  195. $('#pionn,#piocni').hide();
  196. }
  197. });
  198. $('#buchang').find('input[type="radio"]').on('change', function() {
  199. if($(this).val() == "钱款") { //业务办理
  200. $('#mmm,#mmm').show();
  201. }else{
  202. $('#mmm,#mmm').hide();
  203. }
  204. });
  205. //获取工单信息
  206. function getWorkOrderInfo(oid) {
  207. $.ajax({
  208. type: "get",
  209. url: huayi.config.callcenter_url + "WorkOrderNew/GetDetails",
  210. async: true,
  211. dataType: 'json',
  212. data: {
  213. id: oid,
  214. token: $.cookie("token")
  215. },
  216. success: function(data) {
  217. /*验证请求*/
  218. if(data.state == "success") {
  219. var Str = data.rows;
  220. if(Str && Str.length > 0) {
  221. $('#cl_gdbh').text(Str[0].F_WorkOrderCode); //工单编号
  222. $("#cl_gdlx").text(Str[0].F_TypeName); //工单类型
  223. $("#xq_source").text(Str[0].F_SourceName); //工单来源
  224. $("#cl_gdn").text(Str[0].F_DeptName); //业务办理
  225. $("#cl_khxm").text(Str[0].F_CusName); //姓名
  226. $("#cl_khdh").text(helper.filter.cutTel(Str[0].F_CusPhone)); //电话
  227. $('#cl_gdnr').text(decodeURIComponent(Str[0].Detail));
  228. if($("#cl_gdn").text()=="市场管理科"){
  229. $(".isSelDiv").show();
  230. }else{
  231. $(".isSelDiv").remove();
  232. }
  233. if($("#cl_gdlx").text()=="抽检"){
  234. $('.noSampling').hide();
  235. $('.Sampling').show();
  236. $(".chaishi input[type=radio][value='720']").prop("checked", true);
  237. if($("#cl_gdn").text()=="市场管理科"){
  238. $("#abcde").show();
  239. $("#abc").hide();
  240. $("#zipeti").hide();
  241. }
  242. }else if($("#cl_gdlx").text()=="投诉"){
  243. $('.Sampling').hide();
  244. $('.noSampling').show();
  245. $(".chaishi input[type=radio][value='12']").prop("checked", true);
  246. if($("#cl_gdn").text()=="市场管理科"){
  247. $("#abc").show();
  248. $("#abcde").hide();
  249. $("#zipeti").show();
  250. }
  251. }else if($("#cl_gdlx").text()=="咨询"){
  252. $('.Sampling').hide();
  253. $('.noSampling').show();
  254. $(".chaishi input[type=radio][value='12']").prop("checked", true);
  255. if($("#cl_gdn").text()=="市场管理科"){
  256. $("#abc").show();
  257. $("#ddd").hide();
  258. $("#zipeti").show();
  259. }
  260. }else if($("#cl_gdlx").text()=="建议及其他"){
  261. $('.Sampling').hide();
  262. $('.noSampling').show();
  263. $(".chaishi input[type=radio][value='12']").prop("checked", true);
  264. }
  265. if($("#cl_gdlx").text()=="抽检"){
  266. if($("#cl_gdn").text()=="质量管理部"){
  267. $("#abcdef").show();
  268. $("#abcde").hide();
  269. }
  270. }else if($("#cl_gdlx").text()=="投诉"){
  271. if($("#cl_gdn").text()=="质量管理部"){
  272. $("#zcetey").show();
  273. $("#abcd").show();
  274. $("#abc").hide();
  275. }
  276. }else if($("#cl_gdlx").text()=="咨询"){
  277. if($("#cl_gdn").text()=="质量管理部"){
  278. $("#zcetey").show();
  279. $("#ddd").show();
  280. $("#ccc").hide();
  281. }
  282. }
  283. if($("#cl_gdlx").text()=="抽检"){
  284. if($("#cl_gdn").text()=="销售财务"){
  285. $("#hhh").show();
  286. $("#nnn").hide();
  287. }
  288. }else if($("#cl_gdlx").text()=="投诉"){
  289. if($("#cl_gdn").text()=="销售财务"){
  290. $("#hhh").show();
  291. $("#nnn").hide();
  292. }
  293. }else if($("#cl_gdlx").text()=="咨询"){
  294. if($("#cl_gdn").text()=="销售财务"){
  295. $("#hhh").show();
  296. $("#nnn").hide();
  297. }
  298. }
  299. if($("#cl_gdlx").text()=="抽检"){
  300. if($("#cl_gdn").text()=="复合肥市场管理科"){
  301. $("#nnn").show();
  302. $("#hhh").hide();
  303. }
  304. }else if($("#cl_gdlx").text()=="投诉"){
  305. if($("#cl_gdn").text()=="复合肥市场管理科"){
  306. $("#nnn").show();
  307. $("#hhh").hide();
  308. }
  309. }else if($("#cl_gdlx").text()=="咨询"){
  310. if($("#cl_gdn").text()=="复合肥市场管理科"){
  311. $("#nnn").show();
  312. $("#hhh").hide();
  313. }
  314. }
  315. // if($("#cl_gdlx").text()=="抽检"){
  316. // alert(Str[0].F_TypeName)
  317. // }else if($("#cl_gdlx").text()=="投诉"){
  318. // alert(Str[0].F_TypeName)
  319. // } else{
  320. // alert(Str[0].F_TypeName)
  321. // }
  322. //微信内文件(暂时不用)
  323. var Files = Str[0].Files;
  324. if(Files) {
  325. var a;
  326. var b;
  327. $(Files).each(function(i, n) {
  328. a = n.F_FileType.split("\/")[0];
  329. b = n.F_FileName.split(".")[1];
  330. // console.log(a);
  331. if(a == 'image') {
  332. $('<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");
  333. } else {
  334. $('<div class="img-box "><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><span class="">' + b + '</span></a><div>').appendTo(".space");
  335. }
  336. })
  337. }
  338. }
  339. }
  340. }
  341. });
  342. }
  343. /**
  344. * 附件上传直接在知识库管理拿来用 开始
  345. * */
  346. var proimglist = []; //保存附件数组
  347. var uploader; //上传实例
  348. var limitNum = 6; //限制数量
  349. var edit_id = helper.request.queryString("edit_id");
  350. var token = $.cookie("token");
  351. $(function() {
  352. autosize($('textarea'));
  353. getChangeTree();
  354. if(edit_id) {
  355. getDetail();
  356. } else {
  357. $('#kn_type').val('顶级分类');
  358. $('#kn_type').attr('data-id', 0)
  359. uploaderImages();
  360. }
  361. //初始化 下拉
  362. $('.inps1').focus(function() {
  363. $('.xlAdd').css('display', 'block');
  364. });
  365. $('.xl_one').click(function() {
  366. if($('.xlAdd').css('display') == 'block') {
  367. $('.xlAdd').css('display', 'none')
  368. } else {
  369. $('.xlAdd').css('display', 'block')
  370. }
  371. });
  372. $('.addTree').mouseleave(function() {
  373. $(this).css('display', 'none')
  374. });
  375. $('#save_knowledge').on('click', saveKnowledge);
  376. });
  377. //修改弹出框内 下拉树形图参数配置项
  378. function getChangeTree() {
  379. var setting3 = {
  380. data: {
  381. key: {
  382. name: "text"
  383. },
  384. simpleData: {
  385. enable: true,
  386. idKey: "id",
  387. rootPId: 0
  388. }
  389. },
  390. callback: {
  391. onClick: changeTreeClick
  392. }
  393. }
  394. $.get(huayi.config.callcenter_url + 'KnowledgeClass/GetList', {
  395. // "pid": pid,
  396. "token": token,
  397. }, function(result) {
  398. result = $.parseJSON(result);
  399. $.fn.zTree.init($("#addTreeDemo"), setting3, result.data); //实例化树形图
  400. });
  401. }
  402. function changeTreeClick(event, treeId, treeNode) {
  403. $('#kn_type').val(treeNode.text);
  404. $('#kn_type').attr('data-id', treeNode.id);
  405. };
  406. //获取详情
  407. function getDetail() {
  408. var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
  409. $.ajax({
  410. type: "post",
  411. url: huayi.config.callcenter_url + "Knowledge/GetInfo",
  412. async: true,
  413. dataType: 'json',
  414. data: {
  415. infoid: edit_id,
  416. token: token
  417. },
  418. success: function(data) {
  419. var con = data.data;
  420. $('#kn_title').val(con.F_Title);
  421. $('#kn_key').val(con.F_KeyWords);
  422. $('#kn_content').val(con.F_Description);
  423. $('#kn_type').val(con.F_Expand1);
  424. $('#kn_type').attr('data-id', con.F_CategoryId);
  425. //附件
  426. var proimglists = con.FileUrls;
  427. proimglists = proimglists == null ? [] : proimglists;
  428. limitNum -= proimglists.length;
  429. uploaderImages(); //附件上传
  430. if(proimglists.length > 0) {
  431. $('#fileNum').text(proimglists.length);
  432. var $list = $("#fileList");
  433. $.each(proimglists, function(i, v) {
  434. proimglist.push(v.F_FileId);
  435. if(v.F_FileType.split("\/")[0] === 'image') {
  436. //原来的图片
  437. var $li = $(
  438. '<li><span class="img_mask"><i class="img_del"></i></span>' +
  439. '<img src="' + v.F_FileUrl + '" title="原来的图片"/>' +
  440. '<span class="file_name">' + v.F_FileName + '</span>' +
  441. '</li>'
  442. );
  443. $list.append($li);
  444. } else {
  445. var $liFile = $(
  446. '<li><span class="img_mask"><i class="img_del"></i></span>' +
  447. '<div class="noThumb" title="原来的文件"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>' +
  448. '<span class="file_name">' + v.F_FileName + '</span>' +
  449. '</li>'
  450. );
  451. $list.append($liFile);
  452. }
  453. });
  454. $list.find('li').off('click');
  455. $list.find('li').on('click', '.img_del', function() {
  456. $(this).parent().parent().remove();
  457. var itemFileName = $(this).parent().parent().find('.file_name').text();
  458. $.each(proimglists, function(i, v) {
  459. if(v && v.F_FileName == itemFileName) {
  460. proimglist.splice(i, 1);
  461. }
  462. });
  463. $('#fileNum').text(proimglist.length);
  464. limitNum = 6 - proimglist.length;
  465. uploaderImages();
  466. });
  467. }
  468. dtd.resolve(); // 改变Deferred对象的执行状态
  469. }
  470. });
  471. return dtd.promise(); // 返回promise对象
  472. }
  473. //保存
  474. function saveKnowledge() {
  475. var wUrl;
  476. if(!$.trim($('#kn_type').val())) {
  477. layer.confirm('所属分类不能为空', {
  478. icon: 2,
  479. btn: ['确定'] //按钮
  480. });
  481. return;
  482. }
  483. if(!$.trim($('#kn_title').val())) {
  484. layer.confirm('标题不能为空', {
  485. icon: 2,
  486. btn: ['确定'] //按钮
  487. });
  488. return;
  489. }
  490. if(edit_id) {
  491. wURL = "Knowledge/EditInfo";
  492. } else {
  493. wURL = "Knowledge/AddInfo";
  494. }
  495. $.ajax({
  496. type: "post",
  497. url: huayi.config.callcenter_url + wURL,
  498. dataType: 'json',
  499. async: true,
  500. beforeSend: function() { //触发ajax请求开始时执行
  501. $('#save_knowledge').attr("disabled", true);
  502. $('#save_knowledge').text('保存中...');
  503. $(document).off('click', '#save_knowledge', saveKnowledge);
  504. loadIndex = layer.load();
  505. },
  506. data: {
  507. infoid: edit_id,
  508. title: $('#kn_title').val(),
  509. key: $('#kn_key').val(),
  510. con: helper.filter.delHtmlTag($('#kn_content').val()),
  511. pid: $('#kn_type').attr('data-id'),
  512. fileids: proimglist && proimglist.join(','),
  513. token: token
  514. },
  515. success: function(result) {
  516. if(result.state.toLowerCase() === "success") {
  517. var index = parent.layer.getFrameIndex(window.name);
  518. parent.layer.close(index);
  519. parent.table.bootstrapTable('refresh');
  520. layer.msg("保存成功");
  521. }
  522. },
  523. error: function(textStatus) {
  524. layer.close(loadIndex);
  525. layer.confirm('网络繁忙,请稍后再试...', {
  526. icon: 7,
  527. closeBtn: 0,
  528. btn: ['确定'] //按钮
  529. });
  530. $('#save_knowledge').text('保存');
  531. $('#save_knowledge').attr("disabled", false);
  532. $(document).off('click', '#save_knowledge', saveKnowledge);
  533. $(document).on('click', '#save_knowledge', saveKnowledge);
  534. },
  535. complete: function(XMLHttpRequest, textStatus) {
  536. layer.close(loadIndex);
  537. if(textStatus == 'timeout') {
  538. var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
  539. xmlhttp.abort();
  540. layer.confirm('网络超时,请稍后再试...', {
  541. icon: 7,
  542. closeBtn: 0,
  543. btn: ['确定'] //按钮
  544. });    
  545. }
  546. $('#save_knowledge').text('保存');
  547. $('#save_knowledge').attr("disabled", false);
  548. $(document).off('click', '#save_knowledge', saveKnowledge);
  549. $(document).on('click', '#save_knowledge', saveKnowledge);
  550. },
  551. });
  552. }
  553. //上传附件
  554. function uploaderImages() {
  555. if(uploader) {
  556. uploader.destroy();
  557. }
  558. uploader = WebUploader.create({
  559. auto: true, // 选完文件后,是否自动上传
  560. swf: '../../js/webuploader/Uploader.swf', // swf文件路径
  561. server: huayi.config.callcenter_url + "Knowledge/UpLoadProcess", // 文件接收服务端
  562. pick: '#imgPicker', // 选择文件的按钮。可选
  563. formData: {
  564. token: token
  565. },
  566. // 多类型文件上传
  567. accept: {
  568. title: 'Files',
  569. extensions: 'gif,jpg,jpeg,bmp,png,pdf,doc,docx,txt,xls,xlsx,ppt,pptx,zip,mp3,mp4,text,csv',
  570. mimeTypes: 'image/*,text/*,audio/mpeg,audio/mp4, video/mp4'
  571. //word
  572. +',application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  573. //excel
  574. +',application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  575. //ppt
  576. +',application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation'
  577. +',application/pdf'
  578. +',application/zip'
  579. +',application/csv'
  580. // title: 'Images',
  581. // extensions: 'gif,jpg,jpeg,bmp,png',
  582. // mimeTypes: 'image/*'
  583. },
  584. compress: false, //webuploader默认压缩图片,设置compress:false,可以按照原始比例上传图片
  585. //fileVal: "upFile",//设置文件上传域的name。
  586. threads: limitNum, //上传并发数。允许同时最大上传进程数,为了保证文件上传顺序
  587. fileNumLimit: limitNum,
  588. fileSizeLimit: 180 * 1024 * 1024, // 180 M
  589. fileSingleSizeLimit: 30 * 1024 * 1024 // 30 M
  590. });
  591. uploader.on('fileQueued', function(file) {
  592. var $list = $("#fileList"),
  593. $li = $(
  594. '<li id="' + file.id + '"><span class="img_mask"><i class="img_del"></i></span>' +
  595. '<img/>' +
  596. '<span class="img_state"><i></i></span>' +
  597. '<span class="file_name">' + file.name + '</span>' +
  598. '</li>'
  599. ),
  600. $img = $li.find('img');
  601. // $list为容器jQuery实例
  602. $list.append($li);
  603. // 保存缩略图
  604. uploader.makeThumb(file, function(error, src) {
  605. if(error) {
  606. $img.replaceWith('<div class="noThumb"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>');
  607. return;
  608. }
  609. $img.attr('src', src);
  610. }, 109, 109); //109*109为缩略图尺寸
  611. //绑定删除
  612. $('#' + file.id).on('click', '.img_del', function() {
  613. uploader.removeFile(file);
  614. var $fileLi = $('#' + file.id);
  615. $fileLi.off().find('.img_del').off().end().remove();
  616. var itemFileName = $(this).parent().parent().find('.file_name').text();
  617. $.each(proimglist, function(i, v) {
  618. if(v && v.filename == itemFileName) {
  619. proimglist.splice(i, 1);
  620. //helper.methods.delImgs(v.filesmallurl, v.fileurl);
  621. }
  622. });
  623. $('#fileNum').text(proimglist.length);
  624. });
  625. });
  626. // 文件上传过程中保存进度条实时显示。
  627. uploader.on('uploadProgress', function(file, percentage) {
  628. var $li = $('#' + file.id),
  629. $percent = $li.find('.progress span');
  630. // 避免重复保存
  631. if(!$percent.length) {
  632. $percent = $('<div class="progress" style="">' +
  633. '<span class="text">0%</span>' +
  634. '<span class="percentage"></span>' +
  635. '</div>')
  636. .appendTo($li)
  637. .find('span');
  638. }
  639. $percent.eq(0).text(Math.round(percentage * 100) + '%');
  640. $percent.eq(1).css('width', Math.round(percentage * 100) + '%');
  641. });
  642. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  643. uploader.on('uploadSuccess', function(file, res) {
  644. proimglist.push(res.data.F_FileId);
  645. $('#fileNum').text(proimglist.length);
  646. $('#' + file.id).addClass('upload-state-done');
  647. });
  648. // 文件上传失败,显示上传出错。
  649. uploader.on('uploadError', function(file) {
  650. var $li = $('#' + file.id),
  651. $error = $li.find('div.error');
  652. // 避免重复创建
  653. if(!$error.length) {
  654. $error = $('<div class="error"></div>').appendTo($li);
  655. }
  656. $error.text('上传失败');
  657. });
  658. // 完成上传完了,成功或者失败,先删除进度条。
  659. uploader.on('uploadComplete', function(file) {
  660. $('#' + file.id).find('.progress').remove();
  661. });
  662. uploader.onError = function(code) {
  663. // console.log('Error:' + code);
  664. switch(code) {
  665. case "Q_EXCEED_NUM_LIMIT":
  666. layer.msg('只能上传六个文件。');
  667. break;
  668. case "Q_TYPE_DENIED":
  669. layer.msg('文件类型不正确。');
  670. break;
  671. case "F_DUPLICATE":
  672. layer.msg('该文件已上传,请选择其它文件。');
  673. break;
  674. case "F_EXCEED_SIZE":
  675. layer.msg('单文件大小不能超过30M。');
  676. break;
  677. case "Q_EXCEED_SIZE_LIMIT":
  678. layer.msg('总文件大小不能超过180M。');
  679. break;
  680. default:
  681. break;
  682. }
  683. };
  684. }
  685. /**
  686. * 附件上传直接在知识库管理拿来用 结束
  687. * */
  688. //获取工单类型
  689. function getTypeName(val) {
  690. var str = '';
  691. switch(val + '') {
  692. case '1':
  693. str = "咨询";
  694. break;
  695. case '2':
  696. str = "投诉";
  697. break;
  698. case '3':
  699. str = "抽检";
  700. break;
  701. // case '4':
  702. // str = "其他";
  703. // break;
  704. }
  705. return str;
  706. }
  707. // var zzar;//是否回访
  708. //
  709. // function market(){
  710. // if($('#bazaar').text()=='投诉类市场管理科'){
  711. // zzar='';
  712. // }else if($('#bazaar1').text()=='投诉类质量管理部'){
  713. //
  714. // zzar=$("#hiution").find('input[type="radio"]:checked').val();
  715. // }else if($('#bazaar2').text()=='抽检类市场管理科'){
  716. //
  717. // zzar='';
  718. // }else if($('#bazaar3').text()=='抽检类质量管理部'){
  719. //
  720. // zzar=$("#hui_FA").find('input[type="radio"]:checked').val();
  721. // }
  722. //
  723. //
  724. // }
  725. //派单(分配)
  726. function dealWorkOrder(oid) {
  727. var isDetail = helper.request.queryString("isDetail"); //是否是详情页面的处理
  728. var overtime =$(".chaishi").find('input[type="radio"]:checked').val()
  729. $.post(huayi.config.callcenter_url + 'WorkOrderNew/AssignWorkOrder', {
  730. orderid: oid, //否 strubg 工单ID
  731. // isend: ltype, //否 int
  732. overtime: overtime, //超时时限
  733. clbm: $("#clbm").val(), //是 int 部门Id
  734. clid: $("#clid").val(), //否 int 接收人用户id
  735. cont: $("#cont").val(), //否 int 处理内容
  736. isApprovalp:$("#gcDuanxin").find('input[type="radio"]:checked').val(),//高层办理
  737. hclid:$("#gcRevice").val(),//办理人员
  738. sms: $("#duanxin").find('input[type="radio"]:checked').val(),//短信提醒
  739. QualityMonth: $("#zhibao").val(), //否 int 处理内容
  740. PreliminaryOpinion: $("#chushen").val(),
  741. QualityEventLevel: $("#dengji").val(),
  742. ApprovalDisagree: $("#butong").val(),
  743. ResponsibleUnit: $("#duoxuan").find('input[type="checkbox"]:checked').val(),
  744. ApprovalOpinions: $("#yijian").find('input[type="radio"]:checked').val(),
  745. CompensationMethod: $("#buchang").find('input[type="radio"]:checked').val(),
  746. CompensationMoney: $("#buqian").val(),
  747. CResponsibleUnits: $("#danwei").val(),
  748. Fquantity: $("#shuliang").val(),
  749. ImprovementRequirements: $("#yaoqiu").val(),
  750. CApprovalNo: $("#danhao").val(),
  751. F_Files: proimglist && proimglist.join(','),
  752. Fquantity: $("#fanzha").val(),
  753. SpotResult: $("#chou").val(),
  754. SelfResult: $("#zijian").val(),
  755. ApprovalNo: $("#duiying").val(),
  756. ReturnAccount: $("#shenpi").val(),
  757. isvisit: $("#hui_FA").find('input[type="radio"]:checked').val(),
  758. IsRecord: $("#shenpi").val(),
  759. ClaimAmount: $("#suopeijin").val(),
  760. token: $.cookie("token")
  761. }, function(result) {
  762. result = $.parseJSON(result);
  763. if(result.state.toLowerCase() == "success") {
  764. debugger
  765. if(isDetail === "true") {
  766. parent.parent.layer.closeAll();
  767. parent.parent.$('#orderlist').bootstrapTable('refresh');
  768. parent.parent.layer.msg("工单转派成功!");
  769. } else {
  770. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  771. parent.layer.close(index); //再执行关闭
  772. parent.$('#workorderlist').bootstrapTable('refresh');
  773. parent.$('.Closed').trigger('click');
  774. parent.layer.msg("工单转派成功!");
  775. }
  776. }
  777. })
  778. }
  779. $(document).ready(function () {
  780. var wid = helper.request.queryString("wid");
  781. // CPZL($("#zhibao"));//产品种类
  782. SCCS($("#zhibao"));//初审意见
  783. SCCS($("#chushen"));//初审意见
  784. ZLSJDJ($("#cat"));//质量事件等级
  785. ZLZRDW($("#danwei"));//责任单位
  786. SCCJJG($("#chou"));//责任单位
  787. });
  788. // function CPZL(obj) {
  789. // obj.empty();
  790. // obj.append('<option selected="selected" value="">请选择</option>');
  791. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetProTime", {
  792. // "token": $.cookie("token"),
  793. // flag:"CPZL",
  794. // }, function (data) {
  795. // if (data.state.toLowerCase() == "success") {
  796. // var content = data.data;
  797. // $(content).each(function (i, n) {
  798. // $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  799. // })
  800. // }
  801. // })
  802. // }
  803. function SCCS(obj) {
  804. obj.empty();
  805. obj.append('<option selected="selected" value="">请选择</option>');
  806. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  807. "token": $.cookie("token"),
  808. flag:"SCCS",
  809. }, function (data) {
  810. if (data.state.toLowerCase() == "success") {
  811. var content = data.data;
  812. $(content).each(function (i, n) {
  813. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  814. })
  815. }
  816. })
  817. }
  818. //质量事件等级
  819. function ZLSJDJ(obj) {
  820. obj.empty();
  821. obj.append('<option selected="selected" value="">请选择</option>');
  822. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  823. "token": $.cookie("token"),
  824. flag:"ZLSJDJ",
  825. }, function (data) {
  826. if (data.state.toLowerCase() == "success") {
  827. var content = data.data;
  828. $(content).each(function (i, n) {
  829. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  830. })
  831. }
  832. })
  833. }
  834. //责任单位
  835. function ZLZRDW(obj) {
  836. obj.empty();
  837. obj.append('<option selected="selected" value="">请选择</option>');
  838. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  839. "token": $.cookie("token"),
  840. flag:"ZLZRDW",
  841. }, function (data) {
  842. if (data.state.toLowerCase() == "success") {
  843. var content = data.data;
  844. $(content).each(function (i, n) {
  845. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  846. })
  847. }
  848. })
  849. }
  850. //抽检结果
  851. function SCCJJG(obj) {
  852. obj.empty();
  853. obj.append('<option selected="selected" value="">请选择</option>');
  854. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  855. "token": $.cookie("token"),
  856. flag:"SCCJJG",
  857. }, function (data) {
  858. if (data.state.toLowerCase() == "success") {
  859. var content = data.data;
  860. $(content).each(function (i, n) {
  861. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  862. })
  863. }
  864. })
  865. }
  866. $('.chaishi').find('input[type="radio"]').on('change', function() {
  867. if($(this).val() == "其他") { //超时时限
  868. $('#penli').show();
  869. $('#liset').show();
  870. }else{
  871. $('#penli').hide();
  872. $('#liset').hide();
  873. }
  874. });
  875. $('#chushen').change(function(){
  876. if($('#chushen').val() == "其他") { //超时时限
  877. $('#displ').show();
  878. $('#splay').show();
  879. }else{
  880. $('#displ').hide();
  881. $('#splay').hide();
  882. }
  883. });
  884. // checkYear()
  885. // function checkYear() {
  886. // var selectValue = $("select[name='periodType']").val();
  887. // if(selectValue == '其他'){
  888. // $('#displ').show();
  889. // $('#splay').show();
  890. // }else{
  891. // $('#displ').hide();
  892. // $('#splay').hide();
  893. // }
  894. //
  895. // }