| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
- var urlExcel;
- layui.use('laydate', function () {
- var laydate = layui.laydate;
- //日期时间范围
- laydate.render({
- elem: '#test10'
- , range: true
- });
- });
- layui.use(['table', 'jquery'], function () {
- var table = layui.table;
- var form = layui.form,
- layer = parent.layer === undefined ? layui.layer : parent.layer,
- $ = layui.jquery;
- //监听表格复选框选择
- table.on('checkbox(demo)', function (obj) {
- console.log(obj)
- });
- //监听工具条
- table.on('tool(demo)', function (obj) {
- var data = obj.data;
- if (obj.event === 'view') {
- layer.open({
- type: 2,
- anim: 4,
- scrollbar: false,
- content: '/Order/ViewMyOrder/?orderKeyId=' + data.F_WORKORDERID,
- area: ['90%', '90%'],
- id: 'ViewMyOrder',
- title: '服务监督热线系统业务工单'
- });
- }
- else if (obj.event === 'reset') {
- layer.confirm('确认要撤回该行数据么?', function (index) {
- $.ajax({
- url: "/CallRecord/ResetWorkOrder",
- type: "get",
- async: false,//同步请求
- contentType: "application/json",
- dataType: "text",
- cache: false,
- data: "workOrderId=" + data.F_WORKORDERID,
- success: function (thisResult, result) {
- if (thisResult == "True") {
- layer.open({
- content: '撤回成功'
- , icon: 1
- , btn: ['确定']
- , yes: function (index, layero) {
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 0,
- dateParty: $("#test10").val()
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- layer.close(index);
- }
- });
- } else {
- layui.layer.alert("撤回失败!", {
- icon: 2
- });
- }
- },
- error: function (error) {
- return false;
- }
- });
- layer.close(index);
- });
- }
- else if (obj.event === 'edit') {
- //置忙
- if ($("#SeatFlag").val() == 1) {
- top.AgentBusy();
- }
- var openUrl = "";
- var timeno = new Date().getTime();
- ////微信
- //if (data.F_REPAIRMANID === 3) {
- // openUrl = '/CallRecord/WXWorkFlowEdit/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
- //}
- ////微博
- //else if (data.F_REPAIRMANID === 4) {
- // openUrl = '/CallRecord/WXWorkFlowEdit/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
- //}
- ////语音工单
- //else {
- // openUrl = '/CallRecord/EditCallWorkFolw/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
- //}
- openUrl = '/CallRecord/EditCallWorkFolw/?workOrderNum=' + data.F_WORKORDERID + '&timeno=' + timeno;
- layer.open({
- type: 2,
- anim: 4,
- scrollbar: false,
- content: openUrl,
- //content: '/CallRecord/EditCallWorkFolw/?workOrderNum=' + data.F_WORKORDERID,
- area: ['90%', '90%'],
- id: 'EditCallWorkFolw',
- title: '服务监督热线系统业务工单',
- end: function () {
- //置闲
- if ($("#SeatFlag").val() == 1) {
- top.AgentFree();
- }
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 0,
- dateParty: $("#test10").val()
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- });
- }
- });
- $ = layui.$, active = {
- //查询按钮
- reload: function () {
- //var dataParty = getWeekStartDate() + ' - ' + getWeekEndDate();
- //$(".dayParty").val(dataParty);
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 0,
- dateParty: $("#test10").val()
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- //一天
- , oneDay: function () {
- var dataParty = formatDate(now) + ' - ' + formatDate(now);
- $(".dayParty").val(dataParty);
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 4
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- //一周
- , oneWeek: function () {
- var dataParty = getWeekStartDate() + ' - ' + formatDate(now);
- $(".dayParty").val(dataParty);
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 1
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- //一月
- , oneMonth: function () {
- var dataParty = getMonthStartDate() + ' - ' + formatDate(now);
- $(".dayParty").val(dataParty);
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 2
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- //一年
- , oneYear: function () {
- var dataParty = getYearStartDate() + ' - ' + formatDate(now);
- $(".dayParty").val(dataParty);
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 3
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- };
- function saveAs (blob, filename) {
- var type = blob.type;
- var force_saveable_type = 'application/octet-stream';
- if (type && type != force_saveable_type) { // 强制下载,而非在浏览器中打开
- var slice = blob.slice || blob.webkitSlice || blob.mozSlice;
- blob = slice.call(blob, 0, blob.size, force_saveable_type);
- }
- var url = URL.createObjectURL(blob);
- var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
- save_link.href = url;
- save_link.download = filename;
- var theevent = document.createEvent('MouseEvents');
- theevent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- save_link.dispatchEvent(theevent);
- URL.revokeObjectURL(url);
- }
- $('.searchfilter .layui-btn').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- //回车执行
- document.onkeydown = function (event) {
- var e = event || window.event || arguments.callee.caller.arguments[0];
- if (e && e.keyCode == 13) {
- //执行重载
- table.reload('recordtable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- types: 0,
- dateParty: $("#test10").val()
- , NowDateTime: new Date()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- });
- }
- };
- //高级查询折叠
- $('#advanceBtn').on('click', function () {
- $('.collapsible_box').slideToggle(200);
- })
- //导出到excel
- $('#ExToExcel').on('click', function () {
- urlExcel = "/Order/ExToExcel"
- ExToExcel()
- })
- //定责数据导出
- $('#ExToExcelDZ').on('click', function () {
- if ($("#F_HASTENCOUNTS").val() == "1") {
- urlExcel = "/Order/ExToExcelDZ"
- ExToExcel()
- } else {
- layer.msg('请选择已定责类型')
- }
- })
- function ExToExcel () {
- var img = $("#progressImgage");
- var mask = $("#maskOfProgressImage");
- var dataModel = {
- dateParty: $("#test10").val()
- , workorderNum: $("#workorderNum").val()
- , cusName: $("#cusName").val()
- , phoneNumber: $("#phoneNumber").val()
- , userInfo: $("#userInfo").val()
- , status: $("#status").val()
- , turnout: $("#turnout").val()
- , bussType: $("#bussType").val()
- , detailType: $("#bussDetail").val()
- , Content: $("#Content").val()
- , GoType: $("#GoType").val()
- , FromType: $("#FromType").val()
- , F_HASTENCOUNTS: $("#F_HASTENCOUNTS").val()
- }
- var para = JSON.stringify(dataModel);
- $.ajaxLoading({
- url: urlExcel,
- type: "post",
- async: true,
- contentType: "application/json;charset=utf-8",
- dataType: "json",
- cache: false,
- data: para,
- success: function (dataContent, result) {
- if (dataContent.Code == "0") {
- var datajson = dataContent.Data.replace(/"/g, "\"");
- var ItemList = JSON.parse(datajson);
- // alert(ItemList);
- var bytes = window.atob(ItemList); //转换为byte
- //处理异常,将ascii码小于0的转换为大于0
- var ab = new ArrayBuffer(bytes.length);
- var ia = new Uint8Array(ab);
- for (var i = 0; i < bytes.length; i++) {
- ia[i] = bytes.charCodeAt(i);
- }
- var blob = new Blob([ab], { type: 'application/vnd.ms-excel' })
- var fileName = '工单数据.xls';
- if (dataContent.Message != null && dataContent.Message != "") {
- fileName = dataContent.Message;
- }
- //获取浏览器信息
- var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
- var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
- var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
- var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
- if (isIE || isEdge || isIE11) {
- navigator.msSaveBlob(blob, fileName);
- }
- else {
- saveAs(blob, fileName);
- }
- }
- else {
- layer.msg('数据转换失败');
- }
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- layer.msg(textStatus);
- layer.msg(errorThrown);
- }
- });
- }
- });
|