| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- var selid = helper.request.queryString("id");
- var type = helper.request.queryString("type");
- $(document).ready(function () {
- //工单详情
- getWorkOrderDetails();
- getWorkOrderRecord();
- //获取角色
- getLoginPerson();
- // 工单详情、记录切换
- $(".ckxq ul li").click(function() {
- $(this).addClass("Active").siblings().removeClass("Active");
- var i = $(this).index();
- $(".gdxq").hide();
- $(".gdxq").eq(i).show();
- if(i === 0) {
- getWorkOrderDetails();
- } else if(i === 1) {
- getWorkOrderRecord();
- } else if (i === 2) {
- getWorkOrderDe();
- } else if (i ===3) {
- // 催单
- $('.customerSubmit').click(function() {
- saveCustomer();
- });
- }
- });
-
- //提交
- $(".repeatSubmit").click(function() {
- submitRepeatWorkOrder();
- })
- /*
- 判断提交按钮是否显示
- type:
- 1: 隐藏提交按钮
- */
- if(type === "1") {
- $(".repeatSubmit").hide();
- } else {
- $(".repeatSubmit").show();
- }
- })
- // 工单详情
- function getWorkOrderDetails() {
- $.getJSON(huayi.config.callcenter_url + 'WorkOrder/GetDetails', {
- id: selid,
- token: $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- if(result.rows.length > 0) {
- var data = result.rows[0];
- $("#detailWorkOrderId").text(data.F_WorkOrderId);
- $("#detailSource").text(workOrderDetailsSourceJudge(data)); //工单来源
- $("#detailType").text(workOrderDetailsTypeJudge(data)); //工单类别
- $("#detailAreaName").html(data.F_AreaName);
- $("#detailOfficeName").text(data.F_OfficName);
- $("#detailCreateTime").text(data.F_CreateTime);
- $("#detailDealTimely").text(data.F_DealTimely); //重要级别
- $("#detailReason").text(data.F_Reason); //重要原因
- $("#detailCusName").text(data.F_CusName);
- $("#detailCusPhone").text(data.F_CusPhone);
- $("#detailAddress").text(data.F_AddRess);
- $("#detailProductType").text(data.F_ProductType); //产品代码
- $("#detailProductName").text(data.F_ProductName);
- $('#detailSpecifications').text(data.F_Specifications);
- $("#detailPRoductDate").text(data.F_ProductDate); //生产日期
- $("#detailBatchNumber").text(data.F_BatchNumber);
- $("#detailManufacturer").text(data.F_Manufacturer);
- $("#detailProblemCode").text(data.F_ProblemCode); //问题代码
- $("#detailQualityProblem").text(data.F_QualityProblem);
- $("#detailNotifications").text(data.F_Notifications);
- $("#detailReceivingPerson").text(data.F_ReceivingPerson);
- $("#detailSerialNumber").text(data.F_SerialNumber);
- $("#detailState").text(workOrderDetailsStateJudge(data)); //工单状态
- $("#detailContent").text(data.F_Content);
- $("#detailDealResult").text(data.F_DealResult); //落实情况
- $("#detailDealUser").text(data.F_DealUser);
- $("#detailDealTime").text(data.F_DealTime);
- $("#detailReduction").text(workOrderDetailsReduction(data)); //减免
- $("#detailReductionRemarks").text(data.F_RemissionRemarks); //减免备注
- var processingProgress = data.F_State; //处理进度
- getLoginPerson(processingProgress)
- }
- }
- })
- }
- // 工单记录
- function getWorkOrderRecord() {
- //先销毁表格
- $('#workOrderRecord').bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- $('#workOrderRecord').bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "WorkOrder/GetItemList", //获取数据的Servlet地址
- contentType: 'application/x-www-form-urlencoded',
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 5, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [5, 10, 20], //记录数可选列表
- 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 = {
- id: selid, // 工单ID
- token: $.cookie("token"),
- pageindex: params.pageNumber, //页码
- pagesize: params.pageSize, //条数
- };
- return param;
- },
- // responseHandler: function(res) {
- // return {
- // "total": res.itemlasts.length,//总页数
- // "rows": res.itemlasts //数据
- // };
- // },
- onLoadSuccess: function() { //加载成功时执行
- //layer.msg("加载成功");
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- function getWorkOrderDe() {
- $.getJSON(huayi.config.callcenter_url + 'WorkOrder/GetDetails', {
- id: selid,
- "token": $.cookie("token")
- }, function(result) {
- if(result.state.toLowerCase() == "success") {
- var con = result;
- if (con) {
- $("#fileList").empty();
- var proimglist = con.FileUrl;
- if (proimglist && proimglist.length > 0) {
- $(proimglist).each(function(i, n) {
- var fileType = n.F_Type;
- var fileType1 = n.F_Type.split("\/")[0];
- if (fileType === '.jpg'||fileType === '.png'||fileType1==='image') {
- $('<div class="img-box">' +
- '<span class="img_mask"><span onclick=downloadFile("'+ n.F_Url + '","' + n.F_Name + '","' + n.F_Type +
- '") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
- '<img layer-src="' + n.F_Url + '" src="' + n.F_Url + '" alt="' + n.F_Name +
- '" class="image-item" /><div>').appendTo("#fileList");
- } else {
- $('<div class="img-box">' +
- '<span class="img_mask"><span href="javascript:;" onclick=downloadFile("' + n.F_Url + '","' + n.F_Name +
- '","' + n.F_Type +
- '") title="点击下载"><i class="fa fa-download" aria-hidden="true"></i></span></span>' +
- '<span class="img_filename">'+n.F_OriName + n.F_Name.split(".")[1] + '</span><div>').appendTo("#fileList");
- }
- });
- layer.photos({
- photos: '#fileList',
- anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
- title: '查看图片',
- move: '.layui-layer-title',
- shadeClose: false,
- closeBtn: 1,
- area: ['60%', '95%'],
- tab: function(pic, layero){
- // console.log(pic) //当前图片的一些信息
- }
- });
- }
-
- }
- }
- });
- }
- function downloadFile(data, strFileName, strMimeType) {
- console.log("123123132");
- event.preventDefault();
- //详细见文档 http://danml.com/download.html
- var x = new XMLHttpRequest();
- x.open("GET", data, true);
- x.responseType = 'blob';
- x.onload = function(e) {
- download(x.response, strFileName, strMimeType);
- }
- x.send();
- }
- // 工单详情中判断工单来源的值
- function workOrderDetailsSourceJudge (data) {
- if (data.F_Source === 1) {
- return 'PC';
- } else if (data.F_Source === 2) {
- return 'APP';
- } else if (data.F_Source === 3) {
- return '微信';
- } else {
- return '';
- }
- }
- // 工单详情中工单类别返回值判断
- function workOrderDetailsTypeJudge (data) {
- if (data.F_Type === 1) {
- return '咨询';
- } else if (data.F_Type === 2) {
- return '投诉';
- } else if (data.F_Type === 3) {
- return '重复';
- } else {
- return '';
- }
- }
- // 工单详情中减免返回值判断
- function workOrderDetailsReduction (data) {
- if (data.F_IsReduction === 0) {
- return '否';
- } else if (data.F_IsReduction === 1) {
- return '是';
- }
- }
- // 工单详情中工单状态返回值判断
- function workOrderDetailsStateJudge (data) {
- if (data.F_State === 0) {
- return '待提交';
- } else if (data.F_State === 1) {
- return '待分派';
- } else if (data.F_State === 2) {
- return '待接单';
- } else if (data.F_State === 3) {
- return '待处理';
- } else if (data.F_State === 4) {
- return '处理中';
- } else if (data.F_State === 5) {
- return '退回待分派';
- } else if (data.F_State === 6) {
- return '退回待提交';
- } else if (data.F_State === 10) {
- return '已完成';
- } else {
- return '';
- }
- }
- // 工单记录中工单状态返回值判断
- function formatterWorkOrderRecordStatus(val, row) {
- var formatterWorkOrderRecordStatusStr = '';
- if (row.F_WoState === 0){
- formatterWorkOrderRecordStatusStr = "待提交";
- }
- if (row.F_WoState === 1){
- formatterWorkOrderRecordStatusStr = "待分派";
- }
- if (row.F_WoState === 2){
- formatterWorkOrderRecordStatusStr = "待接单";
- }
- if (row.F_WoState === 3){
- formatterWorkOrderRecordStatusStr = "待处理";
- }
- if (row.F_WoState === 4){
- formatterWorkOrderRecordStatusStr = "处理中";
- }
- if (row.F_WoState === 5){
- formatterWorkOrderRecordStatusStr = "退回待分派";
- }
- if (row.F_OptType == 6){
- formatterWorkOrderRecordStatusStr = "退回待提交";
- }
- if (row.F_OptType == 10){
- formatterWorkOrderRecordStatusStr = "已完成";
- }
- return formatterWorkOrderRecordStatusStr;
- }
- // 提交重复工单
- function submitRepeatWorkOrder () {
- var laye = layer.confirm("您确定要提交重复工单吗?", {
- btn: ["确定", "取消"]
- }, function () {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/Repeat",
- async: true,
- dataType: "json",
- data: {
- token: $.cookie("token"),
- orderid: selid,
- isbj: 1
- },
- success: function (data) {
- if (data.state.toLowerCase() == 'success') {
- layer.msg("标记重复工单成功!");
- //工单列表
- parent.$("#workorderlist").bootstrapTable('refresh');
- //工单详情
- getWorkOrderDetails();
- getWorkOrderRecord();
- } else {
- layer.msg("标记重复工单失败!");
- }
- }
- });
- }, function(){
- layer.close(laye)
- })
- }
- // 获取当前登录人
- function getLoginPerson(processingProgress) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "UserAccount/GetNowUser",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token")
- },
- success: function(data) {
- var userRoleCode = data.data.role.F_RoleCode;
- // var processingProgress = processingProgress;
- // 判断角色权限
- rolePermission(userRoleCode, processingProgress)
- }
- });
- }
- /*
- 催单判断
- processingProgress
- 1、待分派
- 3、待处理
- 4、处理中
- 5、退回待分派
- userRoleCode
- XTGLY:系统维护
- CJGLY:超级管理员
- CLZY:总部处理专员
- */
- function rolePermission(userRoleCode, processingProgress) {
- if (processingProgress == 1 || processingProgress == 3 || processingProgress == 4 || processingProgress == 5) {
- if (userRoleCode == "XTGLY" || userRoleCode == "CJGLY" || userRoleCode == "CLZY") {
- $(".reminder-title").show();
- }
- }
- }
- //催单
- function saveCustomer() {
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/Reminder",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('确定中...');
- },
- data: {
- token: $.cookie("token"),
- id: selid,
- count: $('#cont').val(), //催单备注
- },
- success: function(data) {
- if (data.state.toLowerCase() == 'success') {
- parent.layer.msg("催单成功!");
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.$("#workorderlist").bootstrapTable('refresh');
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('确定');
- }
- }
- });
- }
|