| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875 |
- /**
- * 报修平台
- * */
- var $storages = window.localStorage;
- var state = ''; // state tab页的 data-index(工单状态参数);
- var f_State = ''
- $(document).ready(function() {
- $('.tool_bars').authorizeButton();
- //搜索
- $('#sc_btns').click(function() {
- initTable1();
- })
- $('#HY_seeMore').click(function() {
- $('.moreCondition').toggleClass('show');
- })
- //TAB切换
- $('#tab_head_left li').click(function() {
- $(this).addClass('tab_head_active').siblings().removeClass('tab_head_active');
- state = $(this).attr('data-index');
- f_State = state
- initTable1();
- })
- //时间
- laydate.render({
- elem: '#startTime',
- range: '~',
- theme: '#249fea'
- });
- //系统名称
- // helper.getDropList.getlistDropByDic($('#sysname'), 'XTMC');
- //项目类型
- // helper.getDropList.getlistDropByDic($('#protype'), 'XMLX');
- //报修地点
- // helper.getDropList.getlistDropByDic($('#replace'), 'BXDD');
- // GetEquipName($('#equipname')); //设备名称
- //省市
- // getProvinceCity($('#province'));
- helper.getDropList.getProlistDrop($('#proname'));
- helper.getDropList.getProUser('', $('#usercode'));
- $('#proname').on('change', function() {
- $('#usercode').empty();
- $('#usercode').append('<option value="">请选择维修工账号</option>');
- helper.getDropList.getProUser($(this).val(), $('#usercode'));
- });
- if ($('#startTime').val() == "") {
- function p(s) {
- return s < 10 ? '0' + s : s;
- }
- var currentYear = new Date().getFullYear();
- var currentMonth = new Date().getMonth() + 1;
- var currentDate = new Date().getDate();
- var prevCurrentYear = 0;
- var prevCurrentMonth = 0;
- if (currentMonth == 1) {
- prevCurrentYear = currentYear - 1;
- prevCurrentMonth = 12;
- } else {
- prevCurrentYear = currentYear;
- prevCurrentMonth = currentMonth - 1;
- }
- var current = currentYear + "-" + p(currentMonth) + "-" + p(currentDate);
- // var lastmonth = prevCurrentYear + "-" + p(prevCurrentMonth) + "-" + p(currentDate)
- var a = getPreDatetime(3600 * 1000 * 24 * 30);
- $('#startTime').val(getPreDatetime(3600 * 1000 * 24 * 30) + " ~ " + current)
- initTable1();
- }
- var t, n, count = 0;
- t = setInterval("showAuto()", 1000 * 60);
- refreshOrderDatas(huayi.config.repairPlatformTime); //刷新 工单数据
- });
- $(function() {
- getdept()
- })
- function getdept() {
- $("#Pwcode").html('');
- equipmentdata = []
- $("#Pwcode").append('<option value="">请选择维修班组</option>');
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/getallbzcount",
- async: true,
- dataType: 'json',
- success: function(data) {
- var leveldata = []
- if (data.state.toLowerCase() == 'success') {
- leveldata = data.data
- $(leveldata).each(function(q, p) {
- console.log(p.role_name)
- $("<option value='" + p.role_name + "'>" + p.role_name + "</option>").appendTo("#Pwcode");
- $("#Pwcode").selectpicker('refresh');
- });
- } else {
- $("#Pwcode").empty();
- $("#Pwcode").selectpicker('refresh');
- }
- }
- });
- }
- function initTable1() {
- //先销毁表格
- $('#table1').bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- $('#table1').bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/getlistbypage", //获取数据的Servlet地址
- contentType: "application/x-www-form-urlencoded",
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 10, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [10, 20, 50, 100], //记录数可选列表
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- pageindex: params.pageNumber,
- pagesize: params.pageSize,
- phone: $("#phone").val(), //联系电话
- wocode: $("#wocode").val(), //工单编号
- province: $('#province').val(),
- city: $('#city').val(),
- protypeid: $('#protype').val(), //项目类型
- projectid: $('#proname').val(), //项目名称
- buildid: $('#build').val(), //楼名称
- floorid: $('#floor').val(), //楼层名称
- Pwcode: $('#Pwcode').val(), //维修班组
- systemid: $('#sysname').val(), //系统名称
- equipmentid: $('#equipname').val(), //设备名称
- usercode: $('#usercode').val(), //维修工账号
- channel: $('#channelSource').val(), //渠道来源
- stime: $('#startTime').val() && $('#startTime').val().split(' ~ ')[0], //开始时间
- etime: $('#startTime').val() && $('#startTime').val().split(' ~ ')[1], //结束时间
- //replace: getReplice(),//保修地点
- state: state //工单状态
- };
- return param;
- },
- responseHandler: function(res) {
- //格式化数据
- return {
- "total": res.data && res.data.total, //总页数
- "rows": res.data && res.data.rows, //数据
- "totalcounts": res.data && res.data.totalcounts,
- "wzpcounts": res.data && res.data.wzpcounts,
- "yjdcounts": res.data && res.data.yjdcounts,
- "dpjcounts": res.data && res.data.dpjcounts,
- "ywjcounts": res.data && res.data.ywjcounts,
- "ygqcounts": res.data && res.data.ygqcounts,
- "yqxcounts": res.data && res.data.yqxcounts,
- };
- },
- onPostBody: function() {
- //console.log("行数据渲染完成!");
- var totalPages = $('#table1').bootstrapTable("getOptions").totalPages;
- var pageNumber = $('#table1').bootstrapTable("getOptions").pageNumber;
- var goInputWidth = 45; //输入框默认宽度
- var maxLen = ("" + totalPages).length;
- //根据总页数设定跳转页面输入框宽度
- if (totalPages > 999)
- goInputWidth = maxLen * 10 + 15;
- var $pageGo = $('<span style="padding-left: 5px;">跳转到<input type="number" maxlength="' +
- maxLen + '" min="1" max="' + totalPages +
- '" class="input-box" id="c_jump-to-page" value="' +
- pageNumber + '" style="width: ' + goInputWidth + 'px;" />/' +
- totalPages + '页 </span>');
- var $go = $("<a href=\"javascript:;\">Go</a>");
- var $shou = $("<a href=\"javascript:;\">首页</a>")
- var $wei = $("<a href=\"javascript:;\">尾页</a>")
- $pageGo.append($go);
- $pageGo.append($shou);
- $pageGo.append($wei);
- $(".pagination-detail").append($pageGo);
- //页码范围限定(部分浏览器min~max失效时)
- $pageGo.change(function() {
- var goPage = $('#c_jump-to-page').val();
- if (goPage < 1)
- $('#c_jump-to-page').val(1);
- if (goPage > totalPages)
- $('#c_jump-to-page').val(totalPages);
- });
- //跳转到
- $go.click(function() {
- var goPage = parseInt($('#c_jump-to-page').val());
- console.log(totalPages)
- if (goPage != pageNumber)
- $('#table1').bootstrapTable('selectPage', parseInt(goPage));
- });
- $shou.click(function() {
- $('#table1').bootstrapTable('selectPage', 1);
- });
- $wei.click(function() {
- $('#table1').bootstrapTable('selectPage', totalPages);
- });
- },
- onLoadSuccess: function(res) { //加载成功时执行
- if (res.totalcounts >= 100) {
- res.totalcounts = '99+';
- }
- if (res.wzpcounts >= 100) {
- res.wzpcounts = '99+';
- }
- if (res.yjdcounts >= 100) {
- res.yjdcounts = '99+';
- }
- if (res.dpjcounts >= 100) {
- res.dpjcounts = '99+';
- }
- if (res.ywjcounts >= 100) {
- res.ywjcounts = '99+';
- }
- if (res.ygqcounts >= 100) {
- res.ygqcounts = '99+';
- }
- if (res.yqxcounts >= 100) {
- res.yqxcounts = '99+';
- }
- $('.audit_all').text(res.totalcounts); //全部
- $('.audit_none').text(res.wzpcounts); //未指派
- $('.audit_order').text(res.yjdcounts); //已接单
- $('.audit_waitEvaluate').text(res.dpjcounts); //待评价
- $('.audit_complete').text(res.ywjcounts); //已完结
- $('.audit_ygqcounts').text(res.ygqcounts); //挂起
- $('.audit_yqxcounts').text(res.yqxcounts); //挂起
- $('.tool_down').authorizeOperateButton();
- //layer.msg("加载成功");
- // 判断满意度的显隐
- if ($storages.getItem('roleCode') == "YWYG") {
- $('#table1').bootstrapTable('hideColumn', 'score'); //隐藏上述score列
- }
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- //操作
- function formatterOperate(val, row) {
- var str = '';
- str = '<div class="task_tools" onclick = helper.methods.taskTools(this)>' +
- '<a title="操作"><i class="fa fa-cogs" aria-hidden="true"></i></a>' +
- '<ul class="tool_down">'
- switch (val + '') {
- case '0':
- str += '<li><a class="aBtn" authorize="yes" id="HY_assign_' + row.id + '" onclick="btn_assign(\'' + row.projectid +
- '\',\'' + row.wocode + '\')"><i class="fa icon-paidan tub"></i>派单</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_handle_' + row.id + '" onclick="btn_robbing(\'' + row.wocode +
- '\')"><i class="fa icon-qiangdan tub"></i>接收</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id +
- '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_edit_' + row.id + '" onclick="btn_edit(\'' + row.id +
- '\')"><i class="fa icon-edit tub"></i>编辑</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id +
- '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- break;
- case '1':
- str += '<li><a class="aBtn" authorize="yes" id="HY_assign_' + row.id + '" onclick="btn_assign(\'' + row.projectid +
- '\',\'' + row.wocode + '\')"><i class="fa icon-paidan tub"></i>派单</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_deal' + row.id + '" onclick="btn_handle(\'' + row.wocode + '\',\'' +
- row.floorid + '\')"><i class="fa icon-msnui-audit tub"></i>处理</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id +
- '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id +
- '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- break;
- case '2':
- str += '<li><a class="aBtn" authorize="yes" id="HY_evaluate_' + row.id + '" onclick="btn_evaluate(\'' + row.wocode +
- '\',\'' + row.id + '\')"><i class="fa icon-zan tub"></i>评价</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id +
- '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id +
- '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- break;
- case '3':
- str += '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id +
- '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id +
- '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- break;
- case '7':
- str += '<li><a class="aBtn" authorize="yes" id="HY_assign_' + row.id + '" onclick="btn_assign(\'' + row.projectid +
- '\',\'' + row.wocode + '\')"><i class="fa icon-paidan tub"></i>派单</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id +
- '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id +
- '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- break;
- case '8':
- str += '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id +
- '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id +
- '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- break;
- default:
- str += '<li><a class="aBtn">-</a><li>'
- break;
- }
- str += '</ul>';
- str += '</div>';
- return str;
- }
- //编号
- function Code(val, row, index) {
- return index + 1;
- }
- //渠道来源
- function formatterChannel(val, row) {
- var str = '';
- switch (val + '') {
- case '1':
- str = '电话';
- break;
- case '2':
- str = "安卓";
- break;
- case '3':
- str = "IOS";
- break;
- case '4':
- str = "PC端";
- break;
- default:
- str = "其他"
- }
- return str
- }
- function formatterCreateuser(val, row) {
- var str = '';
- if (row.channel == 4) {
- str = row.repairman + '<br>' + '(' + row.createusername + ')'
- } else {
- str = row.repairman + '<br>' + '(' + val + ')'
- }
- return '<span>' + str + '</span>'
- }
- //格式化接单人
- function formatterToUser(val, row) {
- var toUserStr = '';
- var touser = row.touser;
- var tousername = row.tousername;
- // var touser = ["AA000", "AA001", "AA002"];
- // var tousername = ["张山", "李四", "王五"];
- if (touser != null) {
- if (touser.length < 1) {
- toUserStr = '-';
- } else {
- var toUsers = touser.concat(tousername);
- var toUsersLength = toUsers.length;
- if (toUsersLength === 2) {
- toUserStr = toUsers[0] + '-' + toUsers[1];
- } else {
- for (var i = 0; i < toUsersLength; i++) {
- if (i < toUsersLength / 2) {
- toUserStr += toUsers[i] + '-' + toUsers[toUsersLength / 2 + i] + ','
- toUserStr.substring(0, toUserStr.length - 1);
- } else {
- break;
- }
- }
- }
- }
- }
- return toUserStr;
- }
- //格式化满意度
- function formatterScore(val) {
- //1 差、2 不满意、3 一般、4 满意、5 很满意
- var stateClass = 'timeout_default';
- var stateTxt = '-';
- switch (val) {
- case 1:
- stateClass = 'timeout_termination';
- stateTxt = '不满意';
- break;
- case 2:
- stateClass = 'timeout_refuse';
- stateTxt = '不满意';
- break;
- case 3:
- stateClass = 'timeout_wait';
- stateTxt = '基本满意';
- break;
- case 4:
- stateClass = 'timeout_doned';
- stateTxt = '满意';
- break;
- case 5:
- stateClass = 'timeout_success';
- stateTxt = '满意';
- break;
- default:
- stateClass = 'timeout_default';
- stateTxt = '-';
- break;
- }
- return '<span class="' + stateClass + '">' + stateTxt + '</span>';
- }
- // 格式化报修地点
- // function formatterRepairPlace(val, row) {
- // return val + ' ' + (row.repairoom || '')
- // }
- //故障说明
- function formatterDescripe(val) {
- if (val) {
- //var strD = decodeURIComponent(val);
- if (val.length > 12) {
- val = val.substring(0, 12) + '...';
- }
- return val;
- }
- }
- function timestampToTime(timestamp) {
- var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
- var Y = date.getFullYear() + '-';
- var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
- var D = (date.getDate() < 10 ? '0'+(date.getDate()) : date.getDate()) + ' ';
- var h = (date.getHours() < 10 ? '0'+(date.getHours()) : date.getHours()) + ':';
- var m = (date.getMinutes() < 10 ? '0'+(date.getMinutes()) : date.getMinutes()) + ':';
- var s = (date.getSeconds() < 10 ? '0'+(date.getSeconds()) : date.getSeconds());
- return Y+M+D+h+m+s;
- };
- // 格式化超时时长
- function formatterdate(val, row) {
- console.log(row.tobztimes)
- var dateval = ''
- var dealdate = ''
- var lasttime = ''
- if (row.tobztimes != null && val != null && row.wxtimeleths != null && row.wxtimeid != null) {
- var beginTimes = row.tobztimes.replace(/-/g, '/') //班组时间
- var endTimes = val.replace(/-/g, '/') //处理时间
- var middletime = row.wxtimeleths //维修时效
- var dateone =new Date(beginTimes)
- var datetwo =new Date(endTimes)
- lasttime = timestampToTime(dateone.getTime()/1000+middletime*60*60)
- dealdate = lasttime.substr(0, 11).concat('23:59:59').replace(/-/g, '/') //
- var datethree =new Date(dealdate)
- var b = ( datetwo.getTime()/1000 - datethree.getTime()/1000) / 3600 //比价的差值
- console.log(b)
- if ( datetwo.getTime()/1000 - dateone.getTime()/1000 > middletime) {
- if (b > 0) {
- dateval = b.toFixed(2) + '小时'
- } else {
- dateval = ''
- }
- } else {
- dateval = ''
- }
- } else {
- dateval = ''
- }
- return dateval;
- }
- // 格式化维修时效
- function formatterwxtimeleths(val, row) {
- var wxtimeval = ''
- // console.log(val, row)
- if (val != null && val > 0) {
- wxtimeval = val
- } else {
- wxtimeval = ''
- }
- return wxtimeval;
- }
- //省市
- function formatterLocation(val, row) {
- return '<div>' + val + '' + row.city + '</div>'
- }
- //工单状态
- function formatterState(val, row) {
- var str = '',
- className = '';
- switch (val) {
- case 0:
- str = '新工单';
- className = 'state_audit_wait';
- break;
- case 1: //已接收
- str = "已接单";
- className = 'state_audit_doned';
- break;
- case 2:
- str = "已处理";
- className = 'state_audit_refuse';
- break;
- case 3:
- str = "已完结";
- className = 'state_audit_done';
- break;
- case 7:
- str = "挂起";
- className = 'state_audit_revoke';
- break;
- case 8:
- str = "已取消";
- className = 'state_audit_hang';
- break;
- default:
- str = "其他";
- className = 'state_audit_other';
- break;
- }
- return '<a href="javaScript:;" class="state_audit ' + className + '">' + str + '</a>'
- }
- // 导出
- $("#HY_export").click(function() {
- console.log(1)
- var phone = $("#phone").val() //联系电话
- var wocode = $("#wocode").val() //工单编号
- var province = $('#province').val()
- var city = $('#city').val()
- var protypeid = $('#protype').val() //项目类型
- var projectid = $('#proname').val() //项目名称
- var buildid = $('#build').val() //楼名称
- var Pwcode = $('#Pwcode').val() //楼名称
- var floorid = $('#floor').val() //班组名称
- var systemid = $('#sysname').val() //系统名称
- var equipmentid = $('#equipname').val() //设备名称
- var usercode = $('#usercode').val() //维修工账号
- var channel = $('#channelSource').val() //渠道来源
- var useraccount = $storages.getItem('userCode')
- var state = f_State //工单状态
- var stime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[0] //开始时间
- var etime = $('#startTime').val() && $('#startTime').val().split(' ~ ')[1] //结束时间
- console.log(state)
- if (wocode == 'undefined') {
- wocode = ''
- } else {
- wocode = ''
- }
- if (province == 'undefined') {
- } else {
- province = ''
- }
- if (city == 'undefined') {
- } else {
- city = ''
- }
- if (protypeid == 'undefined') {
- } else {
- protypeid = ''
- }
- if (projectid == 'undefined') {
- projectid = ''
- } else {
- }
- if (buildid == 'undefined') {
- } else {
- buildid = ''
- }
- if (Pwcode == 'undefined') {
- } else {
- Pwcode = ''
- }
- if (floorid == 'undefined') {
- } else {
- floorid = ''
- }
- if (systemid == 'undefined') {
- } else {
- systemid = ''
- }
- if (equipmentid == 'undefined') {
- } else {
- equipmentid = ''
- }
- if (equipmentid == 'undefined') {
- } else {
- equipmentid = ''
- }
- if (usercode == 'undefined') {
- } else {
- usercode = ''
- }
- if (channel == 'undefined') {
- } else {
- channel = ''
- }
- if (state == 'undefined') {
- state = ''
- } else {
- state = state
- }
- console.log(state)
- window.location.href = huayi.config.callcenter_url + "equipmentapi/api/worepairbase/excelwocodeinfo?useraccount=" +
- useraccount + "&stime=" + stime + "&etime=" + etime + "+&wocode=" + wocode + "&province=" + province + "&city=" +
- city + "&protypeid=" + protypeid + "&projectid=" + projectid + "&buildid=" + buildid + "&floorid=" + floorid +
- "&systemid=" + systemid + "&equipmentid=" + equipmentid + "&usercode=" + usercode + "&channel=" + channel +
- "&phone=" + phone + "&state=" + state + "&Pwcode=" + Pwcode
- })
- //添加
- function btn_add() {
- layer.open({
- type: 2,
- content: "template/addEquipmentRepair.html",
- title: '添加故障维修',
- area: ['70%', '80%'], //宽高
- });
- }
- //编辑
- function btn_edit(ids) {
- layer.open({
- type: 2,
- content: "template/addEquipmentRepair.html?ids=" + ids,
- title: '修改故障维修',
- area: ['70%', '80%'], //宽高
- });
- }
- //处理
- function btn_handle(code, floorId, sysId) {
- layer.open({
- type: 2,
- content: "template/HandleEquipmentRepair.html?code=" + code + "&floorId=" + floorId,
- title: '故障维修处理',
- area: ['70%', '80%'], //宽高
- });
- }
- //详情
- function btn_details(ids) {
- layer.open({
- type: 2,
- content: "template/seeEquipmentRepair.html?ids=" + ids,
- title: '故障维修详情',
- area: ['70%', '80%'], //宽高
- });
- }
- //派单
- function btn_assign(proId, wocode) {
- layer.open({
- type: 2,
- content: "template/assignEquipmentRepair.html?&proId=" + proId + "&code=" + wocode,
- title: '故障维修派单',
- area: ['70%', '80%'], //宽高
- });
- }
- //接收
- function btn_robbing(wocode) {
- layer.confirm('您确定接收吗?', {
- icon: 7,
- btn: ['是', '否'] //按钮
- }, function() {
- /*发送请求*/
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "equipmentapi/api/worepairbase/grab",
- async: true,
- dataType: 'json',
- data: {
- wocode: wocode,
- channel: 1
- },
- success: function(data) {
- if (data.state.toLowerCase() == 'success') {
- layer.msg("接收成功!");
- $('#table1').bootstrapTable('refresh');
- }
- }
- });
- });
- }
- //评价
- function btn_evaluate(wocode, ids) {
- layer.open({
- type: 2,
- content: "template/EvaluateEquipmentRepair.html?code=" + wocode + "&id=" + ids,
- title: '工单评价',
- area: ['70%', '80%'], //宽高
- });
- }
- //获取楼层楼的文本
- function getReplice() {
- var str = "";
- if ($("#build option:selected").val() == '') {
- $("#build option:selected").text('')
- }
- if ($("#floor option:selected").val() == '') {
- $("#floor option:selected").text('')
- }
- str = $("#build option:selected").text() + " " + $("#floor option:selected").text();
- return str
- }
- //刷新弹出框
- function sendmsg() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "equipmentapi/api/WoRepairBase/getnewmassage", //获取数据的Servlet地址
- async: true,
- dataType: 'json',
- data: {},
- success: function(data) {
- if (data.data.data == 1) {
- $('audio').remove();
- audioElementHovertree = document.createElement('audio');
- audioElementHovertree.setAttribute('src', './video/Sound.mp3');
- audioElementHovertree.setAttribute('autoplay', 'autoplay'); //打开自动播放
- layer.confirm('来新工单了', {
- icon: 7,
- btn: ['确定'], //按钮
- shade: 0,
- offset: "rb"
- });
- }
- }
- });
- }
- function showAuto() {
- sendmsg()
- }
- /**
- * 刷新 工单数据
- * repairPlatformTime 刷新时间的间隔;
- *
- * */
- function refreshOrderDatas(repairPlatformTime) {
- var objTime = {
- init: 0,
- time: function() {
- if (top.$("iframe:visible").contents().find('.layui-layer').length < 2) {
- objTime.init += 1000;
- //console.log(objTime.init);
- //当页面没有click、keydown、mousemove、mousewheel 并且没有layer 弹窗时;每间隔 huayi.config.repairPlatformTime 刷新数据;
- if (objTime.init == repairPlatformTime) {
- $('#table1').bootstrapTable('refresh');
- objTime.init = 0;
- }
- }
- },
- eventFun: function() {
- clearInterval(testUser);
- objTime.init = 0;
- testUser = setInterval(objTime.time, 1000 * 60);
- }
- }
- var testUser = setInterval(objTime.time, 1000 * 60);
- var body = document.querySelector('html');
- body.addEventListener("click", objTime.eventFun);
- body.addEventListener("keydown", objTime.eventFun);
- body.addEventListener("mousemove", objTime.eventFun);
- body.addEventListener("mousewheel", objTime.eventFun);
- }
- //批量删除
- function btn_deletes() {
- var ids = $.map($('#table1').bootstrapTable('getSelections'),
- function(row) {
- return row.id;
- });
- /*判断长度*/
- if (ids.length <= 0) {
- layer.confirm('请选择要删除的选项', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- btn_delete(ids);
- }
- //删除
- function btn_delete(del_id) {
- /*发送请求*/
- layer.confirm('您确定要删除当前报修工单吗?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- $.post(huayi.config.callcenter_url + "equipmentapi/api/worepairbase/delete", {
- ids: del_id,
- }, function(result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- layer.msg("删除成功");
- $('#table1').bootstrapTable('refresh');
- }
- })
- },
- });
- }
- function getPreDatetime(pdate) {
- var start = new Date()
- start.setTime(start.getTime() - pdate)
- start.getYear(); // 获取当前年份(2位)
- var YY = start.getFullYear() // 获取完整的年份(4位,1970-????)
- var MM = start.getMonth() + 1 // 获取当前月份(0-11,0代表1月)
- MM = MM > 9 ? MM : ('0' + MM);
- var DD = start.getDate() // 获取当前日(1-31)
- DD = DD > 9 ? DD : ('0' + DD)
- var lastmonth = YY + '-' + MM + '-' + DD;
- return lastmonth;
- }
|