324 lines
13 KiB
JavaScript
324 lines
13 KiB
JavaScript
var example = null;
|
||
var pers = null;
|
||
$(function () {
|
||
layui.use(['layer', 'laydate', 'form'], function () {
|
||
var layer = layui.layer;
|
||
var laydate = layui.laydate;
|
||
var form = layui.form;
|
||
|
||
pers = checkPermission();
|
||
init();
|
||
|
||
$("#searchBt").click(function () {
|
||
|
||
example.ajax.reload();
|
||
});
|
||
});
|
||
|
||
})
|
||
|
||
function init() {
|
||
example =
|
||
$('#dt-table').DataTable({
|
||
"searching": false,
|
||
"processing": true, //加载数据时显示进度状态
|
||
"serverSide": true,
|
||
"language": {
|
||
"url": contentPath + "/js/plugin/datatables/Chinese.lang"
|
||
},
|
||
"ajax": {
|
||
"url": ctxPath + "/noSignalTeamApply",
|
||
"type": "get",
|
||
"data": function (d) {
|
||
d.keyWord = $("#keyWord").val();
|
||
d.examineStatus = $("#examineStatus").val();
|
||
},
|
||
"error": function (xhr, textStatus, errorThrown) {
|
||
var msg = xhr.responseText;
|
||
var response = JSON.parse(msg);
|
||
var code = response.code;
|
||
var message = response.message;
|
||
if (code == 400) {
|
||
layer.msg(message);
|
||
} else if (code == 401) {
|
||
localStorage.removeItem("token");
|
||
layer.msg("token过期,请先登录", {shift: -1, time: 1000}, function () {
|
||
location.href = ctxPath + '/login.html';
|
||
});
|
||
} else if (code == 403) {
|
||
console.log("未授权:" + message);
|
||
layer.msg('未授权');
|
||
} else if (code == 500) {
|
||
console.log('系统错误:' + message);
|
||
}
|
||
}
|
||
},
|
||
"drawCallback": function() {
|
||
// alert( '表格重绘了' );
|
||
var thisDataTable = $('#dt-table').DataTable();
|
||
$(".pagination").append("<li>" +
|
||
"<a class='paginate_button' style='padding:4px;' href='#' tabindex='0'>到 <input style='margin:0px;width:40px;' id='changePage'> 页</a>" +
|
||
"<a class='paginate_button' style='margin-bottom:1px' href='#' tabindex='0' id='dataTable-btn'>确认</a></li>");
|
||
//点击按钮跳转指定页数
|
||
$('#dataTable-btn').click(function (e) {
|
||
if ($("#changePage").val() && $("#changePage").val() > 0) {
|
||
var redirectpage = $("#changePage").val() - 1;
|
||
} else {
|
||
var redirectpage = 0;
|
||
}
|
||
thisDataTable.page(redirectpage).draw( 'page' );
|
||
});
|
||
//敲击回车键跳转指定页数
|
||
$("#changePage").keypress(function (e) {
|
||
if(event.keyCode==13){
|
||
if ($("#changePage").val() && $("#changePage").val() > 0) {
|
||
var redirectpage = $("#changePage").val() - 1;
|
||
} else {
|
||
var redirectpage = 0;
|
||
}
|
||
thisDataTable.page(redirectpage).draw( 'page' );
|
||
}
|
||
});
|
||
},
|
||
"dom": "<'dt-toolbar'r>t<'dt-toolbar-footer'<'col-sm-4 col-xs-4 hidden-xs'i><'col-xs-8 col-sm-8' p v>>",
|
||
"columns": [
|
||
{
|
||
width: '5%',
|
||
"orderable": false,
|
||
data: function (row, type, set, meta) {
|
||
var c = meta.settings._iDisplayStart + meta.row + 1;
|
||
return c;
|
||
}
|
||
},
|
||
{"data": "proName",width: '6%'},
|
||
{"data": "subName",width: '8%'},
|
||
{"data": "teamName",width: '6%'},
|
||
|
||
{"data": "time",width: '10%',"orderable": false,},
|
||
{
|
||
"data": "",
|
||
"defaultContent": "",width: '5%',
|
||
"orderable": false,
|
||
"render": function (data, type, row) {
|
||
var fileCount = row['fileCount'];
|
||
var fileName = row['fileName'];
|
||
var filePath = row['filePath'];
|
||
var html = '';
|
||
console.log("fileCount",fileCount);
|
||
if(fileCount == 0 || fileCount == '0'){
|
||
html += "<span style='color:#F6A93E'>" + fileCount + "</span>";
|
||
}else{
|
||
html += "<span style='color:#54C1F3; cursor: pointer' onclick='photoViewBtn(\"" + fileName + "\",\"" + filePath + "\")'>" + fileCount + "</span>";
|
||
}
|
||
|
||
return html;
|
||
}
|
||
},
|
||
{"data": "remark",width: '6%'},
|
||
|
||
{
|
||
"data": "",
|
||
"defaultContent": "",width: '5%',
|
||
"orderable": false,
|
||
"render": function (data, type, row) {
|
||
var examineStatus = row['examineStatus'];
|
||
var examineOpinion = row['examineOpinion'];
|
||
var html = '';
|
||
if(examineStatus == "0"){
|
||
html += "<span style='color:#F6A93E'>待审核</span>";
|
||
}
|
||
if(examineStatus == "1"){
|
||
html += "<span style='color:#94C345;cursor: pointer' onclick='examineStatusDetails(\"" + examineStatus + "\",\"" + examineOpinion + "\")'>已通过</span>";
|
||
}
|
||
if(examineStatus == "2"){
|
||
html += "<span style='color:#E44A6E;cursor: pointer' onclick='examineStatusDetails(\"" + examineStatus + "\",\"" + examineOpinion + "\")'>未通过</span>";
|
||
}
|
||
if(examineStatus == "3"){
|
||
html += "<span style='color:#E13132'>已回收</span>";
|
||
}
|
||
if(examineStatus == "4"){
|
||
html += "<span style='color:#F6A93E'>回收中</span>";
|
||
}
|
||
if(examineStatus == "5"){
|
||
html += "<span style='color:#E44A6E'>已失效</span>";
|
||
}
|
||
return html;
|
||
}
|
||
},
|
||
{"data": "uploadName",width: '10%'},
|
||
{
|
||
"data": "",
|
||
"defaultContent": "",width: '5%',
|
||
"orderable": false,
|
||
"render": function (data, type, row) {
|
||
var id = row['id'];
|
||
var examineStatus = row['examineStatus'];
|
||
var stopTime = row['stopTime'];
|
||
var html = '';
|
||
if(examineStatus == "2"){
|
||
html += updBtn(id,"", pers);
|
||
}
|
||
if(examineStatus == "4"){
|
||
html += stopTimebtn(stopTime,"", pers);
|
||
}
|
||
return html;
|
||
}
|
||
},
|
||
|
||
],
|
||
"order": [[1, "desc"],[2, "desc"],[3, "desc"],[6, "desc"],[7, "desc"]] //在栏目列上显示排序功能
|
||
});
|
||
}
|
||
// 回收详情
|
||
function stopTimebtn(stopTime, permission, pers) {
|
||
if (permission != "") {
|
||
if ($.inArray(permission, pers) < 0) {
|
||
return "";
|
||
}
|
||
}
|
||
var btn = $("<button class='layui-btn layui-btn-xs' title='回收详情' onclick='stopTimeView(\"" + stopTime + "\")'>回收详情</button>");
|
||
return btn.prop("outerHTML");
|
||
}
|
||
function stopTimeView(stopTime){
|
||
var html = "";
|
||
html += "<div style='width: 100%;\n" +
|
||
" height: 80%;\n" +
|
||
" text-align: center;\n" +
|
||
" margin-top: 10%;\n" +
|
||
" font-size: 20px;'>";
|
||
html += "<span>失效日期:</span><span>" + stopTime + "</span>";
|
||
html += "</div>";
|
||
var index = layer.open({
|
||
title: false,
|
||
type: 1,
|
||
content: html,
|
||
area: ['50%', '50%'],
|
||
maxmin: false
|
||
});
|
||
}
|
||
function photoViewBtn(fileName,filePath){
|
||
var photoT = filePath.split(",");
|
||
var name = fileName.split(",");
|
||
var html = "";
|
||
for (var j = 0; j < photoT.length; j++) {
|
||
var path = '';
|
||
if (photoT[j].indexOf("http") != -1) {
|
||
path = photoT[j];
|
||
} else {
|
||
path = dataPath + "/" + photoT[j];
|
||
}
|
||
html += '<div style="text-align: center">';
|
||
//ondblclick="delPhoto(\'' + j + 'BoardFile\',\'' + ids[j] + '\')" id="' + j + 'BoardFile"
|
||
html += '<img newPhoto="1" src="' + path + '" name="' + photoT[j] + '" style="height: 80px;width: 80px;margin-right: 10px" class="layui-upload-img ">';
|
||
html += '<p>' + name[j] + '</p>';
|
||
html += '</div>';
|
||
}
|
||
|
||
var index = layer.open({
|
||
title: false,
|
||
type: 1,
|
||
content: html,
|
||
area: ['50%', '50%'],
|
||
maxmin: false
|
||
});
|
||
}
|
||
|
||
function examineStatusDetails(examineStatus,examineOpinion){
|
||
var html = "";
|
||
if(examineStatus == "1"){//已通过
|
||
html += "<div style='text-align: center;margin-top: 10%'>"
|
||
html += "<input type='radio' disabled checked/>已通过";
|
||
html += "<input type='radio' disabled style='margin-left: 20px'/>未通过";
|
||
html += "<p></p>"
|
||
html += "<textarea type='text' cols='40' rows='5' readonly lay-verify='' class='' style='margin-top: 6%;'>" + examineOpinion + "</textarea>";
|
||
html += "</div>"
|
||
}else if(examineStatus == "2"){//未通过
|
||
html += "<div style='text-align: center;margin-top: 10%'>"
|
||
html += "<input type='radio' disabled/>已通过";
|
||
html += "<input type='radio' disabled checked style='margin-left: 20px'/>未通过";
|
||
html += "<p></p>"
|
||
html += "<textarea type='text' cols='40' rows='5' readonly lay-verify='' class='' style='margin-top: 6%;'>" + examineOpinion + "</textarea>";
|
||
html += "</div>"
|
||
}
|
||
var index = layer.open({
|
||
title: false,
|
||
type: 1,
|
||
content: html,
|
||
area: ['50%', '50%'],
|
||
maxmin: false
|
||
});
|
||
}
|
||
|
||
|
||
/**
|
||
* 修改
|
||
* */
|
||
function updView(id) {
|
||
$.ajax({
|
||
type: 'POST',
|
||
contentType: "application/x-www-form-urlencoded",
|
||
url: ctxPath + '/noSignalTeamApply/getNoSignalTeamApplyById',
|
||
data: {"id": id},
|
||
dataType: 'json',
|
||
success: function (data) {
|
||
var height = '750px';
|
||
var width = '850px';
|
||
var index = layer.open({
|
||
title: ['无信号班组申请web端打卡', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: 'noSignalTeamApplyForm.html',
|
||
area: [width, height],
|
||
maxmin: false,
|
||
btn: ['确定', '关闭'],
|
||
success: function (layero, index) {
|
||
var myIframe = window[layero.find('iframe')[0]['name']];
|
||
myIframe.setData(data);
|
||
},
|
||
yes: function (index, layero) {
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
console.log(formSubmit.find('button')[2]);
|
||
var submited = formSubmit.find('button')[2];
|
||
submited.click();
|
||
}
|
||
});
|
||
}
|
||
})
|
||
}
|
||
|
||
|
||
// 修改
|
||
function updBtn(id, permission, pers) {
|
||
if (permission != "") {
|
||
if ($.inArray(permission, pers) < 0) {
|
||
return "";
|
||
}
|
||
}
|
||
var btn = $("<button class='layui-btn layui-btn-xs' title='修改' onclick='updView(" + id + ")'>修改</button>");
|
||
return btn.prop("outerHTML");
|
||
}
|
||
|
||
|
||
function noSignalOpenAdd(){
|
||
var height = '750px';
|
||
var width = '850px';
|
||
var index = layer.open({
|
||
title: ['无信号班组申请web端打卡', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||
type: 2,
|
||
content: 'noSignalTeamApplyForm.html',
|
||
area: [width, height],
|
||
maxmin: false,
|
||
btn: ['确定', '关闭'],
|
||
success: function (layero, index) {
|
||
var myIframe = window[layero.find('iframe')[0]['name']];
|
||
myIframe.getSub("");
|
||
},
|
||
yes: function (index, layero) {
|
||
// 获取弹出层中的form表单元素
|
||
var formSubmit = layer.getChildFrame('form', index);
|
||
console.log(formSubmit.find('button')[2]);
|
||
var submited = formSubmit.find('button')[2];
|
||
submited.click();
|
||
}
|
||
});
|
||
} |