Нет описания

WorkOrderTransfer.js 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  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 (Str[0].F_limit>0) {
  316. $(".chaishi input[type=radio][value="+Str[0].F_limit+"]").prop("checked", true);
  317. $(".chaishi input").attr("disabled", "disabled");
  318. $(".residue").show();
  319. $(".residueTime").text(Str[0].RemainingTime);
  320. }
  321. //微信内文件(暂时不用)
  322. var Files = Str[0].Files;
  323. if(Files) {
  324. var a;
  325. var b;
  326. $(Files).each(function(i, n) {
  327. a = n.F_FileType.split("\/")[0];
  328. b = n.F_FileName.split(".")[1];
  329. // console.log(a);
  330. if(a == 'image') {
  331. $('<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");
  332. } else {
  333. $('<div class="img-box "><a href="+' + n.F_FileUrl + '" download="' + n.F_FileName + '"><span class="">' + b + '</span></a><div>').appendTo(".space");
  334. }
  335. })
  336. }
  337. }
  338. }
  339. }
  340. });
  341. }
  342. /**
  343. * 附件上传直接在知识库管理拿来用 开始
  344. * */
  345. var proimglist = []; //保存附件数组
  346. var uploader; //上传实例
  347. var limitNum = 6; //限制数量
  348. var edit_id = helper.request.queryString("edit_id");
  349. var token = $.cookie("token");
  350. $(function() {
  351. autosize($('textarea'));
  352. getChangeTree();
  353. if(edit_id) {
  354. getDetail();
  355. } else {
  356. $('#kn_type').val('顶级分类');
  357. $('#kn_type').attr('data-id', 0)
  358. uploaderImages();
  359. }
  360. //初始化 下拉
  361. $('.inps1').focus(function() {
  362. $('.xlAdd').css('display', 'block');
  363. });
  364. $('.xl_one').click(function() {
  365. if($('.xlAdd').css('display') == 'block') {
  366. $('.xlAdd').css('display', 'none')
  367. } else {
  368. $('.xlAdd').css('display', 'block')
  369. }
  370. });
  371. $('.addTree').mouseleave(function() {
  372. $(this).css('display', 'none')
  373. });
  374. $('#save_knowledge').on('click', saveKnowledge);
  375. });
  376. //修改弹出框内 下拉树形图参数配置项
  377. function getChangeTree() {
  378. var setting3 = {
  379. data: {
  380. key: {
  381. name: "text"
  382. },
  383. simpleData: {
  384. enable: true,
  385. idKey: "id",
  386. rootPId: 0
  387. }
  388. },
  389. callback: {
  390. onClick: changeTreeClick
  391. }
  392. }
  393. $.get(huayi.config.callcenter_url + 'KnowledgeClass/GetList', {
  394. // "pid": pid,
  395. "token": token,
  396. }, function(result) {
  397. result = $.parseJSON(result);
  398. $.fn.zTree.init($("#addTreeDemo"), setting3, result.data); //实例化树形图
  399. });
  400. }
  401. function changeTreeClick(event, treeId, treeNode) {
  402. $('#kn_type').val(treeNode.text);
  403. $('#kn_type').attr('data-id', treeNode.id);
  404. };
  405. //获取详情
  406. function getDetail() {
  407. var dtd = $.Deferred(); //在函数内部,新建一个Deferred对象
  408. $.ajax({
  409. type: "post",
  410. url: huayi.config.callcenter_url + "Knowledge/GetInfo",
  411. async: true,
  412. dataType: 'json',
  413. data: {
  414. infoid: edit_id,
  415. token: token
  416. },
  417. success: function(data) {
  418. var con = data.data;
  419. $('#kn_title').val(con.F_Title);
  420. $('#kn_key').val(con.F_KeyWords);
  421. $('#kn_content').val(con.F_Description);
  422. $('#kn_type').val(con.F_Expand1);
  423. $('#kn_type').attr('data-id', con.F_CategoryId);
  424. //附件
  425. var proimglists = con.FileUrls;
  426. proimglists = proimglists == null ? [] : proimglists;
  427. limitNum -= proimglists.length;
  428. uploaderImages(); //附件上传
  429. if(proimglists.length > 0) {
  430. $('#fileNum').text(proimglists.length);
  431. var $list = $("#fileList");
  432. $.each(proimglists, function(i, v) {
  433. proimglist.push(v.F_FileId);
  434. if(v.F_FileType.split("\/")[0] === 'image') {
  435. //原来的图片
  436. var $li = $(
  437. '<li><span class="img_mask"><i class="img_del"></i></span>' +
  438. '<img src="' + v.F_FileUrl + '" title="原来的图片"/>' +
  439. '<span class="file_name">' + v.F_FileName + '</span>' +
  440. '</li>'
  441. );
  442. $list.append($li);
  443. } else {
  444. var $liFile = $(
  445. '<li><span class="img_mask"><i class="img_del"></i></span>' +
  446. '<div class="noThumb" title="原来的文件"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>' +
  447. '<span class="file_name">' + v.F_FileName + '</span>' +
  448. '</li>'
  449. );
  450. $list.append($liFile);
  451. }
  452. });
  453. $list.find('li').off('click');
  454. $list.find('li').on('click', '.img_del', function() {
  455. $(this).parent().parent().remove();
  456. var itemFileName = $(this).parent().parent().find('.file_name').text();
  457. $.each(proimglists, function(i, v) {
  458. if(v && v.F_FileName == itemFileName) {
  459. proimglist.splice(i, 1);
  460. }
  461. });
  462. $('#fileNum').text(proimglist.length);
  463. limitNum = 6 - proimglist.length;
  464. uploaderImages();
  465. });
  466. }
  467. dtd.resolve(); // 改变Deferred对象的执行状态
  468. }
  469. });
  470. return dtd.promise(); // 返回promise对象
  471. }
  472. //保存
  473. function saveKnowledge() {
  474. var wUrl;
  475. if(!$.trim($('#kn_type').val())) {
  476. layer.confirm('所属分类不能为空', {
  477. icon: 2,
  478. btn: ['确定'] //按钮
  479. });
  480. return;
  481. }
  482. if(!$.trim($('#kn_title').val())) {
  483. layer.confirm('标题不能为空', {
  484. icon: 2,
  485. btn: ['确定'] //按钮
  486. });
  487. return;
  488. }
  489. if(edit_id) {
  490. wURL = "Knowledge/EditInfo";
  491. } else {
  492. wURL = "Knowledge/AddInfo";
  493. }
  494. $.ajax({
  495. type: "post",
  496. url: huayi.config.callcenter_url + wURL,
  497. dataType: 'json',
  498. async: true,
  499. beforeSend: function() { //触发ajax请求开始时执行
  500. $('#save_knowledge').attr("disabled", true);
  501. $('#save_knowledge').text('保存中...');
  502. $(document).off('click', '#save_knowledge', saveKnowledge);
  503. loadIndex = layer.load();
  504. },
  505. data: {
  506. infoid: edit_id,
  507. title: $('#kn_title').val(),
  508. key: $('#kn_key').val(),
  509. con: helper.filter.delHtmlTag($('#kn_content').val()),
  510. pid: $('#kn_type').attr('data-id'),
  511. fileids: proimglist && proimglist.join(','),
  512. token: token
  513. },
  514. success: function(result) {
  515. if(result.state.toLowerCase() === "success") {
  516. var index = parent.layer.getFrameIndex(window.name);
  517. parent.layer.close(index);
  518. parent.table.bootstrapTable('refresh');
  519. layer.msg("保存成功");
  520. }
  521. },
  522. error: function(textStatus) {
  523. layer.close(loadIndex);
  524. layer.confirm('网络繁忙,请稍后再试...', {
  525. icon: 7,
  526. closeBtn: 0,
  527. btn: ['确定'] //按钮
  528. });
  529. $('#save_knowledge').text('保存');
  530. $('#save_knowledge').attr("disabled", false);
  531. $(document).off('click', '#save_knowledge', saveKnowledge);
  532. $(document).on('click', '#save_knowledge', saveKnowledge);
  533. },
  534. complete: function(XMLHttpRequest, textStatus) {
  535. layer.close(loadIndex);
  536. if(textStatus == 'timeout') {
  537. var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
  538. xmlhttp.abort();
  539. layer.confirm('网络超时,请稍后再试...', {
  540. icon: 7,
  541. closeBtn: 0,
  542. btn: ['确定'] //按钮
  543. });    
  544. }
  545. $('#save_knowledge').text('保存');
  546. $('#save_knowledge').attr("disabled", false);
  547. $(document).off('click', '#save_knowledge', saveKnowledge);
  548. $(document).on('click', '#save_knowledge', saveKnowledge);
  549. },
  550. });
  551. }
  552. //上传附件
  553. function uploaderImages() {
  554. if(uploader) {
  555. uploader.destroy();
  556. }
  557. uploader = WebUploader.create({
  558. auto: true, // 选完文件后,是否自动上传
  559. swf: '../../js/webuploader/Uploader.swf', // swf文件路径
  560. server: huayi.config.callcenter_url + "Knowledge/UpLoadProcess", // 文件接收服务端
  561. pick: '#imgPicker', // 选择文件的按钮。可选
  562. formData: {
  563. token: token
  564. },
  565. // 多类型文件上传
  566. accept: {
  567. title: 'Files',
  568. extensions: 'gif,jpg,jpeg,bmp,png,pdf,doc,docx,txt,xls,xlsx,ppt,pptx,zip,mp3,mp4,text,csv',
  569. mimeTypes: 'image/*,text/*,audio/mpeg,audio/mp4, video/mp4'
  570. //word
  571. +',application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  572. //excel
  573. +',application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  574. //ppt
  575. +',application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation'
  576. +',application/pdf'
  577. +',application/zip'
  578. +',application/csv'
  579. // title: 'Images',
  580. // extensions: 'gif,jpg,jpeg,bmp,png',
  581. // mimeTypes: 'image/*'
  582. },
  583. compress: false, //webuploader默认压缩图片,设置compress:false,可以按照原始比例上传图片
  584. //fileVal: "upFile",//设置文件上传域的name。
  585. threads: limitNum, //上传并发数。允许同时最大上传进程数,为了保证文件上传顺序
  586. fileNumLimit: limitNum,
  587. fileSizeLimit: 180 * 1024 * 1024, // 180 M
  588. fileSingleSizeLimit: 30 * 1024 * 1024 // 30 M
  589. });
  590. uploader.on('fileQueued', function(file) {
  591. var $list = $("#fileList"),
  592. $li = $(
  593. '<li id="' + file.id + '"><span class="img_mask"><i class="img_del"></i></span>' +
  594. '<img/>' +
  595. '<span class="img_state"><i></i></span>' +
  596. '<span class="file_name">' + file.name + '</span>' +
  597. '</li>'
  598. ),
  599. $img = $li.find('img');
  600. // $list为容器jQuery实例
  601. $list.append($li);
  602. // 保存缩略图
  603. uploader.makeThumb(file, function(error, src) {
  604. if(error) {
  605. $img.replaceWith('<div class="noThumb"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>');
  606. return;
  607. }
  608. $img.attr('src', src);
  609. }, 109, 109); //109*109为缩略图尺寸
  610. //绑定删除
  611. $('#' + file.id).on('click', '.img_del', function() {
  612. uploader.removeFile(file);
  613. var $fileLi = $('#' + file.id);
  614. $fileLi.off().find('.img_del').off().end().remove();
  615. var itemFileName = $(this).parent().parent().find('.file_name').text();
  616. $.each(proimglist, function(i, v) {
  617. if(v && v.filename == itemFileName) {
  618. proimglist.splice(i, 1);
  619. //helper.methods.delImgs(v.filesmallurl, v.fileurl);
  620. }
  621. });
  622. $('#fileNum').text(proimglist.length);
  623. });
  624. });
  625. // 文件上传过程中保存进度条实时显示。
  626. uploader.on('uploadProgress', function(file, percentage) {
  627. var $li = $('#' + file.id),
  628. $percent = $li.find('.progress span');
  629. // 避免重复保存
  630. if(!$percent.length) {
  631. $percent = $('<div class="progress" style="">' +
  632. '<span class="text">0%</span>' +
  633. '<span class="percentage"></span>' +
  634. '</div>')
  635. .appendTo($li)
  636. .find('span');
  637. }
  638. $percent.eq(0).text(Math.round(percentage * 100) + '%');
  639. $percent.eq(1).css('width', Math.round(percentage * 100) + '%');
  640. });
  641. // 文件上传成功,给item添加成功class, 用样式标记上传成功。
  642. uploader.on('uploadSuccess', function(file, res) {
  643. proimglist.push(res.data.F_FileId);
  644. $('#fileNum').text(proimglist.length);
  645. $('#' + file.id).addClass('upload-state-done');
  646. });
  647. // 文件上传失败,显示上传出错。
  648. uploader.on('uploadError', function(file) {
  649. var $li = $('#' + file.id),
  650. $error = $li.find('div.error');
  651. // 避免重复创建
  652. if(!$error.length) {
  653. $error = $('<div class="error"></div>').appendTo($li);
  654. }
  655. $error.text('上传失败');
  656. });
  657. // 完成上传完了,成功或者失败,先删除进度条。
  658. uploader.on('uploadComplete', function(file) {
  659. $('#' + file.id).find('.progress').remove();
  660. });
  661. uploader.onError = function(code) {
  662. switch(code) {
  663. case "Q_EXCEED_NUM_LIMIT":
  664. layer.msg('只能上传六个文件。');
  665. break;
  666. case "Q_TYPE_DENIED":
  667. layer.msg('文件类型不正确。');
  668. break;
  669. case "F_DUPLICATE":
  670. layer.msg('该文件已上传,请选择其它文件。');
  671. break;
  672. case "F_EXCEED_SIZE":
  673. layer.msg('单文件大小不能超过30M。');
  674. break;
  675. case "Q_EXCEED_SIZE_LIMIT":
  676. layer.msg('总文件大小不能超过180M。');
  677. break;
  678. default:
  679. break;
  680. }
  681. };
  682. }
  683. /**
  684. * 附件上传直接在知识库管理拿来用 结束
  685. * */
  686. //获取工单类型
  687. function getTypeName(val) {
  688. var str = '';
  689. switch(val + '') {
  690. case '1':
  691. str = "咨询";
  692. break;
  693. case '2':
  694. str = "投诉";
  695. break;
  696. case '3':
  697. str = "抽检";
  698. break;
  699. }
  700. return str;
  701. }
  702. //派单(分配)
  703. function dealWorkOrder(oid) {
  704. var isDetail = helper.request.queryString("isDetail"); //是否是详情页面的处理
  705. var overtime =$(".chaishi").find('input[type="radio"]:checked').val()
  706. $.post(huayi.config.callcenter_url + 'WorkOrderNew/AssignWorkOrder', {
  707. orderid: oid, //否 strubg 工单ID
  708. // isend: ltype, //否 int
  709. overtime: overtime, //超时时限
  710. clbm: $("#clbm").val(), //是 int 部门Id
  711. clid: $("#clid").val(), //否 int 接收人用户id
  712. cont: $("#cont").val(), //否 int 处理内容
  713. isApprovalp:$("#gcDuanxin").find('input[type="radio"]:checked').val(),//高层办理
  714. hclid:$("#gcRevice").val(),//办理人员
  715. sms: $("#duanxin").find('input[type="radio"]:checked').val(),//短信提醒
  716. QualityMonth: $("#zhibao").val(), //否 int 处理内容
  717. PreliminaryOpinion: $("#chushen").val(),
  718. QualityEventLevel: $("#dengji").val(),
  719. ApprovalDisagree: $("#butong").val(),
  720. ResponsibleUnit: $("#duoxuan").find('input[type="checkbox"]:checked').val(),
  721. ApprovalOpinions: $("#yijian").find('input[type="radio"]:checked').val(),
  722. CompensationMethod: $("#buchang").find('input[type="radio"]:checked').val(),
  723. CompensationMoney: $("#buqian").val(),
  724. CResponsibleUnits: $("#danwei").val(),
  725. Fquantity: $("#shuliang").val(),
  726. ImprovementRequirements: $("#yaoqiu").val(),
  727. CApprovalNo: $("#danhao").val(),
  728. F_Files: proimglist && proimglist.join(','),
  729. Fquantity: $("#fanzha").val(),
  730. SpotResult: $("#chou").val(),
  731. SelfResult: $("#zijian").val(),
  732. ApprovalNo: $("#duiying").val(),
  733. ReturnAccount: $("#shenpi").val(),
  734. isvisit: $("#hui_FA").find('input[type="radio"]:checked').val(),
  735. IsRecord: $("#shenpi").val(),
  736. ClaimAmount: $("#suopeijin").val(),
  737. token: $.cookie("token")
  738. }, function(result) {
  739. result = $.parseJSON(result);
  740. if(result.state.toLowerCase() == "success") {
  741. debugger
  742. if(isDetail === "true") {
  743. parent.parent.layer.closeAll();
  744. parent.parent.$('#orderlist').bootstrapTable('refresh');
  745. parent.parent.layer.msg("工单转派成功!");
  746. } else {
  747. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  748. parent.layer.close(index); //再执行关闭
  749. parent.$('#workorderlist').bootstrapTable('refresh');
  750. parent.$('.Closed').trigger('click');
  751. parent.layer.msg("工单转派成功!");
  752. }
  753. }
  754. })
  755. }
  756. $(document).ready(function () {
  757. var wid = helper.request.queryString("wid");
  758. // CPZL($("#zhibao"));//产品种类
  759. SCCS($("#zhibao"));//初审意见
  760. SCCS($("#chushen"));//初审意见
  761. ZLSJDJ($("#cat"));//质量事件等级
  762. ZLZRDW($("#danwei"));//责任单位
  763. SCCJJG($("#chou"));//责任单位
  764. });
  765. // function CPZL(obj) {
  766. // obj.empty();
  767. // obj.append('<option selected="selected" value="">请选择</option>');
  768. // $.getJSON(huayi.config.callcenter_url + "WorkOrder/GetProTime", {
  769. // "token": $.cookie("token"),
  770. // flag:"CPZL",
  771. // }, function (data) {
  772. // if (data.state.toLowerCase() == "success") {
  773. // var content = data.data;
  774. // $(content).each(function (i, n) {
  775. // $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  776. // })
  777. // }
  778. // })
  779. // }
  780. function SCCS(obj) {
  781. obj.empty();
  782. obj.append('<option selected="selected" value="">请选择</option>');
  783. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  784. "token": $.cookie("token"),
  785. flag:"SCCS",
  786. }, function (data) {
  787. if (data.state.toLowerCase() == "success") {
  788. var content = data.data;
  789. $(content).each(function (i, n) {
  790. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  791. })
  792. }
  793. })
  794. }
  795. //质量事件等级
  796. function ZLSJDJ(obj) {
  797. obj.empty();
  798. obj.append('<option selected="selected" value="">请选择</option>');
  799. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  800. "token": $.cookie("token"),
  801. flag:"ZLSJDJ",
  802. }, function (data) {
  803. if (data.state.toLowerCase() == "success") {
  804. var content = data.data;
  805. $(content).each(function (i, n) {
  806. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  807. })
  808. }
  809. })
  810. }
  811. //责任单位
  812. function ZLZRDW(obj) {
  813. obj.empty();
  814. obj.append('<option selected="selected" value="">请选择</option>');
  815. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  816. "token": $.cookie("token"),
  817. flag:"ZLZRDW",
  818. }, function (data) {
  819. if (data.state.toLowerCase() == "success") {
  820. var content = data.data;
  821. $(content).each(function (i, n) {
  822. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  823. })
  824. }
  825. })
  826. }
  827. //抽检结果
  828. function SCCJJG(obj) {
  829. obj.empty();
  830. obj.append('<option selected="selected" value="">请选择</option>');
  831. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", {
  832. "token": $.cookie("token"),
  833. flag:"SCCJJG",
  834. }, function (data) {
  835. if (data.state.toLowerCase() == "success") {
  836. var content = data.data;
  837. $(content).each(function (i, n) {
  838. $("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
  839. })
  840. }
  841. })
  842. }
  843. $('.chaishi').find('input[type="radio"]').on('change', function() {
  844. if($(this).val() == "其他") { //超时时限
  845. $('#penli').show();
  846. $('#liset').show();
  847. }else{
  848. $('#penli').hide();
  849. $('#liset').hide();
  850. }
  851. });
  852. $('#chushen').change(function(){
  853. if($('#chushen').val() == "其他") { //超时时限
  854. $('#displ').show();
  855. $('#splay').show();
  856. }else{
  857. $('#displ').hide();
  858. $('#splay').hide();
  859. }
  860. });
  861. // checkYear()
  862. // function checkYear() {
  863. // var selectValue = $("select[name='periodType']").val();
  864. // if(selectValue == '其他'){
  865. // $('#displ').show();
  866. // $('#splay').show();
  867. // }else{
  868. // $('#displ').hide();
  869. // $('#splay').hide();
  870. // }
  871. //
  872. // }