地铁二期项目正式开始

OverOrderView.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. var urlExcel;
  2. layui.use('laydate', function () {
  3. var laydate = layui.laydate;
  4. //日期时间范围
  5. laydate.render({
  6. elem: '#test10'
  7. , range: true
  8. });
  9. });
  10. layui.use(['table', 'jquery'], function () {
  11. var table = layui.table;
  12. var form = layui.form,
  13. layer = parent.layer === undefined ? layui.layer : parent.layer,
  14. $ = layui.jquery;
  15. //监听表格复选框选择
  16. table.on('checkbox(demo)', function (obj) {
  17. console.log(obj)
  18. });
  19. //监听工具条
  20. table.on('tool(demo)', function (obj) {
  21. var data = obj.data;
  22. if (obj.event === 'view') {
  23. layer.open({
  24. type: 2,
  25. anim: 4,
  26. scrollbar: false,
  27. content: '/Order/ViewMyOrder/?orderKeyId=' + data.F_WORKORDERID,
  28. area: ['90%', '90%'],
  29. id: 'ViewMyOrder',
  30. title: '服务监督热线系统业务工单'
  31. });
  32. }
  33. else if (obj.event === 'reset') {
  34. layer.confirm('确认要撤回该行数据么?', function (index) {
  35. $.ajax({
  36. url: "/CallRecord/ResetWorkOrder",
  37. type: "get",
  38. async: false,//同步请求
  39. contentType: "application/json",
  40. dataType: "text",
  41. cache: false,
  42. data: "workOrderId=" + data.F_WORKORDERID,
  43. success: function (thisResult, result) {
  44. if (thisResult == "True") {
  45. layer.open({
  46. content: '撤回成功'
  47. , icon: 1
  48. , btn: ['确定']
  49. , yes: function (index, layero) {
  50. //执行重载
  51. table.reload('recordtable', {
  52. page: {
  53. curr: 1 //重新从第 1 页开始
  54. }
  55. , where: {
  56. types: 0,
  57. dateParty: $("#test10").val()
  58. , NowDateTime: new Date()
  59. , workorderNum: $("#workorderNum").val()
  60. , cusName: $("#cusName").val()
  61. , phoneNumber: $("#phoneNumber").val()
  62. , userInfo: $("#userInfo").val()
  63. , status: $("#status").val()
  64. , turnout: $("#turnout").val()
  65. , bussType: $("#bussType").val()
  66. , detailType: $("#bussDetail").val()
  67. , Content: $("#Content").val()
  68. , GoType: $("#GoType").val()
  69. , FromType: $("#FromType").val()
  70. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  71. }
  72. });
  73. layer.close(index);
  74. }
  75. });
  76. } else {
  77. layui.layer.alert("撤回失败!", {
  78. icon: 2
  79. });
  80. }
  81. },
  82. error: function (error) {
  83. return false;
  84. }
  85. });
  86. layer.close(index);
  87. });
  88. }
  89. else if (obj.event === 'edit') {
  90. //置忙
  91. if ($("#SeatFlag").val() == 1) {
  92. top.AgentBusy();
  93. }
  94. var openUrl = "";
  95. var timeno = new Date().getTime();
  96. ////微信
  97. //if (data.F_REPAIRMANID === 3) {
  98. // openUrl = '/CallRecord/WXWorkFlowEdit/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
  99. //}
  100. ////微博
  101. //else if (data.F_REPAIRMANID === 4) {
  102. // openUrl = '/CallRecord/WXWorkFlowEdit/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
  103. //}
  104. ////语音工单
  105. //else {
  106. // openUrl = '/CallRecord/EditCallWorkFolw/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
  107. //}
  108. openUrl = '/CallRecord/EditCallWorkFolw/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
  109. layer.open({
  110. type: 2,
  111. anim: 4,
  112. scrollbar: false,
  113. content: openUrl,
  114. //content: '/CallRecord/EditCallWorkFolw/?workOrderNum=' + data.F_WORKORDERID,
  115. area: ['90%', '90%'],
  116. id: 'EditCallWorkFolw',
  117. title: '服务监督热线系统业务工单',
  118. end: function () {
  119. //置闲
  120. if ($("#SeatFlag").val() == 1) {
  121. top.AgentFree();
  122. }
  123. //执行重载
  124. table.reload('recordtable', {
  125. page: {
  126. curr: 1 //重新从第 1 页开始
  127. }
  128. , where: {
  129. types: 0,
  130. dateParty: $("#test10").val()
  131. , NowDateTime: new Date()
  132. , workorderNum: $("#workorderNum").val()
  133. , cusName: $("#cusName").val()
  134. , phoneNumber: $("#phoneNumber").val()
  135. , userInfo: $("#userInfo").val()
  136. , status: $("#status").val()
  137. , turnout: $("#turnout").val()
  138. , bussType: $("#bussType").val()
  139. , detailType: $("#bussDetail").val()
  140. , Content: $("#Content").val()
  141. , GoType: $("#GoType").val()
  142. , FromType: $("#FromType").val()
  143. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  144. }
  145. });
  146. }
  147. });
  148. }
  149. });
  150. $ = layui.$, active = {
  151. //查询按钮
  152. reload: function () {
  153. //var dataParty = getWeekStartDate() + ' - ' + getWeekEndDate();
  154. //$(".dayParty").val(dataParty);
  155. //执行重载
  156. table.reload('recordtable', {
  157. page: {
  158. curr: 1 //重新从第 1 页开始
  159. }
  160. , where: {
  161. types: 0,
  162. dateParty: $("#test10").val()
  163. , NowDateTime: new Date()
  164. , workorderNum: $("#workorderNum").val()
  165. , cusName: $("#cusName").val()
  166. , phoneNumber: $("#phoneNumber").val()
  167. , userInfo: $("#userInfo").val()
  168. , status: $("#status").val()
  169. , turnout: $("#turnout").val()
  170. , bussType: $("#bussType").val()
  171. , detailType: $("#bussDetail").val()
  172. , Content: $("#Content").val()
  173. , GoType: $("#GoType").val()
  174. , FromType: $("#FromType").val()
  175. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  176. }
  177. });
  178. }
  179. //一天
  180. , oneDay: function () {
  181. var dataParty = formatDate(now) + ' - ' + formatDate(now);
  182. $(".dayParty").val(dataParty);
  183. //执行重载
  184. table.reload('recordtable', {
  185. page: {
  186. curr: 1 //重新从第 1 页开始
  187. }
  188. , where: {
  189. types: 4
  190. , NowDateTime: new Date()
  191. , workorderNum: $("#workorderNum").val()
  192. , cusName: $("#cusName").val()
  193. , phoneNumber: $("#phoneNumber").val()
  194. , userInfo: $("#userInfo").val()
  195. , status: $("#status").val()
  196. , turnout: $("#turnout").val()
  197. , bussType: $("#bussType").val()
  198. , detailType: $("#bussDetail").val()
  199. , Content: $("#Content").val()
  200. , GoType: $("#GoType").val()
  201. , FromType: $("#FromType").val()
  202. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  203. }
  204. });
  205. }
  206. //一周
  207. , oneWeek: function () {
  208. var dataParty = getWeekStartDate() + ' - ' + formatDate(now);
  209. $(".dayParty").val(dataParty);
  210. //执行重载
  211. table.reload('recordtable', {
  212. page: {
  213. curr: 1 //重新从第 1 页开始
  214. }
  215. , where: {
  216. types: 1
  217. , NowDateTime: new Date()
  218. , workorderNum: $("#workorderNum").val()
  219. , cusName: $("#cusName").val()
  220. , phoneNumber: $("#phoneNumber").val()
  221. , userInfo: $("#userInfo").val()
  222. , status: $("#status").val()
  223. , turnout: $("#turnout").val()
  224. , bussType: $("#bussType").val()
  225. , detailType: $("#bussDetail").val()
  226. , Content: $("#Content").val()
  227. , GoType: $("#GoType").val()
  228. , FromType: $("#FromType").val()
  229. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  230. }
  231. });
  232. }
  233. //一月
  234. , oneMonth: function () {
  235. var dataParty = getMonthStartDate() + ' - ' + formatDate(now);
  236. $(".dayParty").val(dataParty);
  237. //执行重载
  238. table.reload('recordtable', {
  239. page: {
  240. curr: 1 //重新从第 1 页开始
  241. }
  242. , where: {
  243. types: 2
  244. , NowDateTime: new Date()
  245. , workorderNum: $("#workorderNum").val()
  246. , cusName: $("#cusName").val()
  247. , phoneNumber: $("#phoneNumber").val()
  248. , userInfo: $("#userInfo").val()
  249. , status: $("#status").val()
  250. , turnout: $("#turnout").val()
  251. , bussType: $("#bussType").val()
  252. , detailType: $("#bussDetail").val()
  253. , Content: $("#Content").val()
  254. , GoType: $("#GoType").val()
  255. , FromType: $("#FromType").val()
  256. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  257. }
  258. });
  259. }
  260. //一年
  261. , oneYear: function () {
  262. var dataParty = getYearStartDate() + ' - ' + formatDate(now);
  263. $(".dayParty").val(dataParty);
  264. //执行重载
  265. table.reload('recordtable', {
  266. page: {
  267. curr: 1 //重新从第 1 页开始
  268. }
  269. , where: {
  270. types: 3
  271. , NowDateTime: new Date()
  272. , workorderNum: $("#workorderNum").val()
  273. , cusName: $("#cusName").val()
  274. , phoneNumber: $("#phoneNumber").val()
  275. , userInfo: $("#userInfo").val()
  276. , status: $("#status").val()
  277. , turnout: $("#turnout").val()
  278. , bussType: $("#bussType").val()
  279. , detailType: $("#bussDetail").val()
  280. , Content: $("#Content").val()
  281. , GoType: $("#GoType").val()
  282. , FromType: $("#FromType").val()
  283. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  284. }
  285. });
  286. }
  287. };
  288. function saveAs (blob, filename) {
  289. var type = blob.type;
  290. var force_saveable_type = 'application/octet-stream';
  291. if (type && type != force_saveable_type) { // 强制下载,而非在浏览器中打开
  292. var slice = blob.slice || blob.webkitSlice || blob.mozSlice;
  293. blob = slice.call(blob, 0, blob.size, force_saveable_type);
  294. }
  295. var url = URL.createObjectURL(blob);
  296. var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
  297. save_link.href = url;
  298. save_link.download = filename;
  299. var theevent = document.createEvent('MouseEvents');
  300. theevent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  301. save_link.dispatchEvent(theevent);
  302. URL.revokeObjectURL(url);
  303. }
  304. $('.searchfilter .layui-btn').on('click', function () {
  305. var type = $(this).data('type');
  306. active[type] ? active[type].call(this) : '';
  307. });
  308. //回车执行
  309. document.onkeydown = function (event) {
  310. var e = event || window.event || arguments.callee.caller.arguments[0];
  311. if (e && e.keyCode == 13) {
  312. //执行重载
  313. table.reload('recordtable', {
  314. page: {
  315. curr: 1 //重新从第 1 页开始
  316. }
  317. , where: {
  318. types: 0,
  319. dateParty: $("#test10").val()
  320. , NowDateTime: new Date()
  321. , workorderNum: $("#workorderNum").val()
  322. , cusName: $("#cusName").val()
  323. , phoneNumber: $("#phoneNumber").val()
  324. , userInfo: $("#userInfo").val()
  325. , status: $("#status").val()
  326. , turnout: $("#turnout").val()
  327. , bussType: $("#bussType").val()
  328. , detailType: $("#bussDetail").val()
  329. , Content: $("#Content").val()
  330. , GoType: $("#GoType").val()
  331. , FromType: $("#FromType").val()
  332. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  333. }
  334. });
  335. }
  336. };
  337. //高级查询折叠
  338. $('#advanceBtn').on('click', function () {
  339. $('.collapsible_box').slideToggle(200);
  340. })
  341. //导出到excel
  342. $('#ExToExcel').on('click', function () {
  343. urlExcel = "/Order/ExToExcel"
  344. ExToExcel()
  345. })
  346. //定责数据导出
  347. $('#ExToExcelDZ').on('click', function () {
  348. if ($("#F_HASTENCOUNTS").val() == "1") {
  349. urlExcel = "/Order/ExToExcelDZ"
  350. ExToExcel()
  351. } else {
  352. layer.msg('请选择已定责类型')
  353. }
  354. })
  355. function ExToExcel () {
  356. var img = $("#progressImgage");
  357. var mask = $("#maskOfProgressImage");
  358. var dataModel = {
  359. dateParty: $("#test10").val()
  360. , workorderNum: $("#workorderNum").val()
  361. , cusName: $("#cusName").val()
  362. , phoneNumber: $("#phoneNumber").val()
  363. , userInfo: $("#userInfo").val()
  364. , status: $("#status").val()
  365. , turnout: $("#turnout").val()
  366. , bussType: $("#bussType").val()
  367. , detailType: $("#bussDetail").val()
  368. , Content: $("#Content").val()
  369. , GoType: $("#GoType").val()
  370. , FromType: $("#FromType").val()
  371. , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
  372. }
  373. var para = JSON.stringify(dataModel);
  374. $.ajaxLoading({
  375. url: urlExcel,
  376. type: "post",
  377. async: true,
  378. contentType: "application/json;charset=utf-8",
  379. dataType: "json",
  380. cache: false,
  381. data: para,
  382. success: function (dataContent, result) {
  383. if (dataContent.Code == "0") {
  384. var datajson = dataContent.Data.replace(/"/g, "\"");
  385. var ItemList = JSON.parse(datajson);
  386. // alert(ItemList);
  387. var bytes = window.atob(ItemList); //转换为byte
  388. //处理异常,将ascii码小于0的转换为大于0
  389. var ab = new ArrayBuffer(bytes.length);
  390. var ia = new Uint8Array(ab);
  391. for (var i = 0; i < bytes.length; i++) {
  392. ia[i] = bytes.charCodeAt(i);
  393. }
  394. var blob = new Blob([ab], { type: 'application/vnd.ms-excel' })
  395. var fileName = '工单数据.xls';
  396. if (dataContent.Message != null && dataContent.Message != "") {
  397. fileName = dataContent.Message;
  398. }
  399. //获取浏览器信息
  400. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  401. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
  402. var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
  403. var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
  404. if (isIE || isEdge || isIE11) {
  405. navigator.msSaveBlob(blob, fileName);
  406. }
  407. else {
  408. saveAs(blob, fileName);
  409. }
  410. }
  411. else {
  412. layer.msg('数据转换失败');
  413. }
  414. },
  415. error: function (XMLHttpRequest, textStatus, errorThrown) {
  416. layer.msg(textStatus);
  417. layer.msg(errorThrown);
  418. }
  419. });
  420. }
  421. });