var url = null; var auditList = null; var workAuditData = null; var dateTime; //工单审核列表 var data = { "interfaceId": "5703", "outId": "10703", "reqDateTime": new Date(), "tokenAuth": "", "data": { "deptId": "", } }; //工单审核 var data1 = { "interfaceId": "5704", "outId": "10704", "reqDateTime": new Date(), "tokenAuth": "", "data": { "id": "", "status": "" } }; function init() { var user = JSON.parse(localStorage.getItem('user')); var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId')); url = user.url + "/api-phone/v35/gateway"; data.tokenAuth = user.tokenAuth; data1.tokenAuth = user.tokenAuth; data.data.deptId = selectDeptId; dateTime = getDate(new Date()); getAuditList(); } //日期格式化yyyy-MM-dd function getDate(date) { var year = date.getFullYear(); var month, day,hour,minute; month = date.getMonth() + 1; if (month > 0 && month <= 9) { month = "0" + month; } day = date.getDate() if (day > 0 && day <= 9) { day = "0" + day } hour = date.getHours(); minute = date.getMinutes(); return year + "-" + month + "-" + day + " "+ hour + ":" + minute } //获取工单审核列表 function getAuditList() { console.log(JSON.stringify(data.data),"work-aduit","工单审核列表") mui.ajax(url, { type: "POST", dataType: "json", crossDomain: true, contentType: "application/json;charset=utf-8", data: JSON.stringify(data), success: function(result) { if (result.code == "0000") { auditList = result.data; // console.log(JSON.stringify(auditList)) renderAuditList(); } else { renderAuditList(); mui.alert(result.msg, '提示', ["确定"], function() {}, "div"); } }, error: function() { renderAuditList(); mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div"); } }) } function renderAuditList() { var html = ''; if (auditList && auditList.length > 0) { $.each(auditList, function(index, item) { html += '
  • '; html += '
    申请人:
    ' + item.applyUserName +'
    '; html += '
    '; html += '
    '; html += '
    有效期: ' + item.startTime + '至' + item.endTime + '
    '; html += ''; html += '
  • '; }) } else { html += '
  • '; html += '
    申请人:
    暂无工单审核
    '; html += '
    '; html += '
    '; html += '
    有效期: ' + dateTime + ' 至 ' + dateTime + '
    '; html += '
  • '; // html += // '
  • 暂无工单审核信息
  • '; } $("#handleList").html(html); } //工单审核 function workAudit() { console.log(JSON.stringify(data1.data),"work-aduit","工单审核") mui.ajax(url, { type: "POST", dataType: "json", crossDomain: true, contentType: "application/json;charset=utf-8", data: JSON.stringify(data1), success: function(result) { if (result.code == "0000") { workAuditData = result.data; // console.log(JSON.stringify(auditList)) } else { mui.alert(result.msg, '提示', ["确定"], function() {}, "div"); } }, error: function() { mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div"); } }) } //拒绝 mui(".mui-scroll").on("tap", ".wp ul li .refuse", function() { var id = this.getAttribute("id"); console.log(id) data1.data.id = id data1.data.status = '10' workAudit(); }) //通过 mui(".mui-scroll").on("tap", ".wp ul li .adopt", function() { var id = this.getAttribute("id"); console.log(id) data1.data.id = id data1.data.status = '20' workAudit(); }) //查看申请内容 mui(".mui-scroll").on("tap", ".wp ul li .icon", function() { var info = this.getAttribute("info") // mui.alert(info, '工单内容', ["确定"], function() {}, "div"); $("#textareaPop").val(info) $('#m-pop').css('display', 'flex'); console.log("申请内容") }) //关闭弹窗 function closePop() { $("#m-pop").css('display', 'none'); } mui('.mui-scroll-wrapper').scroll({ indicators: true, //是否显示滚动条 deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏 bounce: false, //是否启用回弹 deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006 });