window.onload = function() {
mui.plusReady(function() {
//var isdeal=helper.request.queryString("isdeal");
var token = localStorage.getItem("token");
var F_See = localStorage.getItem("F_See");
var page = 1; //页数
var pageSize = 10; //每页显示条目
var total; //数据总条数
var wv = plus.webview.currentWebview();
var index = wv.index; //交办条件
var importClass = wv.importClass; //工单等级
var keyw="";
plus.nativeUI.closeWaiting();
//显示当前页面
mui.currentWebview.show();
if(index == 0) {
$(".Totle-box").text('待提交')
} else if(index == 1) {
$(".Totle-box").text('待分派')
} else if(index == 3) {
$(".Totle-box").text('待处理')
} else if(index == 4) {
$(".Totle-box").text('处理中')
} else if(index == 5) {
$(".Totle-box").text('退回待分派')
} else if(index == 6) {
$(".Totle-box").text('退回待提交')
} else if(index == 10) {
$(".Totle-box").text('已处理')
}
if(importClass == 1) {
$(".Totle-box").text('一级列表')
} else if(importClass == 2) {
$(".Totle-box").text('二级列表')
} else if(importClass == 3) {
$(".Totle-box").text('三级列表')
}
if(importClass == 1) {
classImport = "Ⅰ级"
} else if(importClass == 2) {
classImport = "Ⅱ级"
} else if(importClass == 3) {
classImport = "普通工单"
} else {
classImport = ""
}
if(F_See == 0) { //调度
$("#DW").css('display', 'block')
} else{
$("#DW").css('display', 'none')
}
Ajax();
$('.go_search').on('input focus', function() {
keyw = $(this).val();
page = 1;
Ajax(keyw);
});
mui.init({
swipeBack: false,
pullRefresh: {
container: '#pullrefresh',
up: {
contentrefresh: "正在加载...", //可选,正在加载状态时,上拉加载控件上显示的标题内容
contentnomore: '没有更多数据了', //可选,请求完毕若没有更多数据时显示的提醒内容;
callback: pullupRefresh
}
},
beforeback: function() {
var list = plus.webview.currentWebview().opener();
//refresh是A页面自定义事件
mui.fire(list, 'refreshPer');
//返回true,继续页面关闭逻辑
return true;
}
});
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh((page++ >= Math.ceil(total / 10)));
mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
data: {
token: token,
state: index,
dealTimely: classImport,
offce:$("#DWResult").attr("data-index"),
extensionphone: 1,
pageindex: page,
pagesize: pageSize
},
dataType: 'json', //服务器返回json格式数据
type: 'get', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
},
success: function(data) {
var total = data.total;
if(!total) {
total = 0;
}
var imgnum;
$(".Totle").text('(' + total + ')');
for(var i = 0; i < data.rows.length; i++) {
var a = data.rows[i].F_Content;
var c = data.rows[i].F_WorkState;
var time = data.rows[i].F_CreateTime;
if(data.rows[i].F_DealTimely == "Ⅰ级") {
imgnum = '
';
} else if(data.rows[i].F_DealTimely == "Ⅱ级") {
imgnum = '
';
} else if(data.rows[i].F_DealTimely == "普通工单") {
imgnum = '
';
} else {
imgnum = "";
}
var areaOffice;
if (!data.rows[i].F_AreaName) {
areaOffice='';
}else{
areaOffice='
' +
'大区办事处:'+data.rows[i].F_AreaName +"-"+data.rows[i].F_OfficName+'' +
'
'
}
$('' +
'' +
'
' +
'
' + data.rows[i].F_QualityProblem + '
' +
'
' +
'' + a + '' +
'
'+areaOffice+'
' +
'投诉时间:' + time + '' +
'
' +
'
' +
'
' +
''+ imgnum +
'
' +
'' +
'').appendTo('#order_list');
if(classImport) {
$(".mui-btn-submit").hide();
}
if(data.rows[i].F_DealTimely = "Ⅰ级") {
$(".class-icon img").eq(0).show()
} else if(data.rows[i].F_DealTimely = "Ⅱ级") {
$(".class-icon img").eq(1).show()
} else if(data.rows[i].F_DealTimely = "普通工单") {
$(".class-icon img").eq(2).show()
}
if(index == 0 || index == 6) {
//待提交
$(".mui-btn-submit").text("提交")
} else if(index == 1 || index == 5) {
//待分派
$(".mui-btn-submit").text("指派")
} else if(index == 3 || index == 4) {
//待处理
$(".mui-btn-submit").text("处理")
}else if(index == 10) {
$(".mui-btn-submit").hide();
}
}
$(".mui-btn-submit").on("tap", function() {
var a = index;
var b = $(this).attr("data-index");
//submitFun(b);
if(a == 0 || a == 6) {
//待提交
submitFun(b);
} else if(a == 1 || a == 5) {
//待分派
appointFun(b);
} else if(a == 3 || a == 4) {
//待处理
disposeFun(b);
}
})
},
error: function(xhr, type, errorThrown) {
//异常处理;
}
})
}, 1000);
}
function Ajax() {
$(".orderLi").remove();
page=1;
pageSize=10;
mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/GetList', {
data: {
token: token,
state: index,
dealTimely: classImport,
extensionphone: 1,
keywords:keyw,
offce:$("#DWResult").attr("data-index"),
pageindex: 1,
pagesize: 10
},
dataType: 'json', //服务器返回json格式数据
type: 'get', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
},
success: function(data) {
var total = data.total;
if(!total) {
total = 0;
$(".noWork").show();
}
var imgnum;
$(".class-icon img").hide()
$(".Totle").text('(' + total + ')');
for(var i = 0; i < data.rows.length; i++) {
var a = data.rows[i].F_Content;
var c = data.rows[i].F_WorkState;
var time = data.rows[i].F_CreateTime;
var areaOffice;
if (!data.rows[i].F_AreaName) {
areaOffice='';
}else{
areaOffice='' +
'大区办事处:'+data.rows[i].F_AreaName +"-"+data.rows[i].F_OfficName+'' +
'
'
}
if(data.rows[i].F_DealTimely == "Ⅰ级") {
imgnum = '
';
} else if(data.rows[i].F_DealTimely == "Ⅱ级") {
imgnum = '
';
} else if(data.rows[i].F_DealTimely == "普通工单") {
imgnum = '
';
} else {
imgnum = "";
}
$('' +
'' +
'
' +
'
' + data.rows[i].F_QualityProblem + '
' +
'
' +
'' + a + '' +
'
'+areaOffice+'
' +
'投诉时间:' + time + '' +
'
' +
'' + imgnum +
'
' +
'' +
'').appendTo('#order_list');
if(classImport) {
$(".mui-btn-submit").hide();
}
if(index == 0 || index == 6) {
//待提交
$(".mui-btn-submit").text("提交")
} else if(index == 1 || index == 5) {
//待分派
$(".mui-btn-submit").text("指派")
} else if(index == 3 || index == 4) {
//待处理
$(".mui-btn-submit").text("处理")
} else if(index == 10) {
$(".mui-btn-submit").hide();
}
}
$(".mui-btn-submit").on("tap", function() {
var a = index;
var b = $(this).attr("data-index");
//submitFun(b);
if(a == 0 || a == 6) {
//待提交
submitFun(b);
} else if(a == 1 || a == 5) {
//待分派
appointFun(b);
} else if(a == 3 || a == 4) {
//待处理
disposeFun(b);
}
})
},
error: function(xhr, type, errorThrown) {
//异常处理;
}
})
}
$('#order_list').on('tap', '.order', function() {
var id = $(this).attr('data-index');
mui.openWindow({
id: 'WorkDetails',
url: 'WorkDetails.html',
createNew: true,
show: {
aniShow: 'pop-in'
},
styles: {
popGesture: 'hide'
},
waiting: {
autoShow: true
},
extras: {
name: id,
classImport: classImport,
token: token
}
});
})
//提交
function submitFun(b) {
mui.openWindow({
id: 'Work-assign',
url: 'Work-assign.html',
createNew: true,
show: {
aniShow: 'pop-in'
},
styles: {
popGesture: 'hide'
},
waiting: {
autoShow: true
},
extras: {
name: b,
token: token
}
});
}
// 指派
function appointFun(b) {
mui.openWindow({
id: 'Work-appoint',
url: 'Work-appoint.html',
createNew: true,
show: {
aniShow: 'pop-in'
},
styles: {
popGesture: 'hide'
},
waiting: {
autoShow: true
},
extras: {
name: b,
token: token
}
});
}
// 处理
function disposeFun(b) {
mui.openWindow({
id: 'Work-dispose',
url: 'Work-dispose.html',
createNew: true,
show: {
aniShow: 'pop-in'
},
styles: {
popGesture: 'hide'
},
waiting: {
autoShow: true
},
extras: {
name: b,
token: token
}
});
}
// 产品代码
var Product = [];
$.ajax({
type: "get",
url: huayi.config.callcenter_url + 'Department/GetAreaList',
async: false,
data: {
flag: "CPDM",
token:localStorage.getItem("token")
},
dataType: 'json',
success: function(res) {
if(res.state.toLowerCase() === "success") {
res = res.data;
if(res && res.length > 0) {
res.forEach(function(v, i) {
var obj = {};
obj.id = v.id;
obj.text = v.text;
obj.children = v.children;
Product.push(obj);
});
}
}
}
});
(function($, doc) {
$.ready(function() {
//交办单位
var ZTiPickers = new $.PopPicker({
layer: 2
});
ZTiPickers.setData(Product);
var ZXs = doc.getElementById('DW');
var ZXResults = doc.getElementById('DWResult');
ZXs.addEventListener('tap', function(event) {
ZTiPickers.show(function(items) {
ZXResults.value = items[1].text;
ZXResults.setAttribute("data-index", items[1].id);
Ajax();
});
}, false);
})
})(mui, document);
});
}