Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/process/testTaskListForPlan.jsp
2026-01-16 14:13:44 +08:00

556 lines
20 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="com.sipai.tools.CommString"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<%@page import="com.sipai.entity.process.TestTask" %>
<% request.setAttribute("Status_0", TestTask.Status_0); %>
<% request.setAttribute("Status_1", TestTask.Status_1); %>
<% request.setAttribute("Status_2", TestTask.Status_2); %>
<% request.setAttribute("PlanType_0", TestTask.PlanType_0); %>
<% request.setAttribute("PlanType_1", TestTask.PlanType_1); %>
<!DOCTYPE html>
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<!-- bootstrap switch -->
<link rel="stylesheet"
href="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css" />
<script type="text/javascript"
src="<%=request.getContextPath()%>/node_modules/bootstrap-switch/dist/js/bootstrap-switch.min.js"
charset="utf-8"></script>
<!-- 引入daterangepicker-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.css"/>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/moment.min.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-daterangepicker/daterangepicker.js" charset="utf-8"></script>
<style type="text/css">
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
.table-hover>tbody>tr:hover {
cursor: pointer;
}
</style>
<script type="text/javascript">
function dosearch() {
initFun();
// $("#table").bootstrapTable('refresh');
}
var addFun = function () {
$.post(ext.contextPath + '/process/testTask/doadd.do', { unitId: unitId }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var editFun = function (id) {
$.post(ext.contextPath + '/process/testTask/doedit.do', { id: id }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var deleteFun = function (id) {
stopBubbleDefaultEvent();
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/process/testTask/dodelete.do', { id: id }, function (data) {
var datajson = JSON.parse(data);
if (datajson.code == 1) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
});
}
});
};
var deletesFun = function () {
var checkedItems = $("#table").bootstrapTable('getSelections');
var datas = "";
$.each(checkedItems, function (index, item) {
datas += item.id + ",";
});
if (datas == "") {
showAlert('d', '请先选择记录', 'mainAlertdiv');
} else {
swal({
text: "您确定要删除此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/process/testTask/dodeletes.do', { ids: datas }, function (data) {
if (data.code > 0) {
$("#table").bootstrapTable('refresh');
} else {
showAlert('d', '删除失败', 'mainAlertdiv');
}
}, 'json');
}
});
}
};
var beginTimeStore = '';
var endTimeStore = '';
function initDate() {
var locale = {
"format": 'YYYY-MM-DD',
"separator": " ~ ",
"applyLabel": "确定",
"cancelLabel": "取消",
"fromLabel": "起始时间",
"toLabel": "结束时间'",
"customRangeLabel": "自定义",
"weekLabel": "W",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
};
beginTimeStore = moment().startOf('month').format('YYYY-MM-DD');
endTimeStore = moment().endOf('month').subtract(-1, 'days').format('YYYY-MM-DD');
$('#searchTime').val(beginTimeStore + locale.separator + endTimeStore);
$('#searchTime').daterangepicker({
"timePicker": true,
"timePicker24Hour": true,
"linkedCalendars": false,
"autoUpdateInput": false,
"timePickerIncrement": 10,
'opens': 'left',
"locale": locale,
//汉化按钮部分
ranges: {
// '今日': [moment(), moment().subtract(-1, 'days')],
'昨日': [moment().subtract(1, 'days'), moment()],
'最近7日': [moment().subtract(6, 'days'), moment().subtract(-1, 'days')],
'本月': [moment().startOf('month'), moment().endOf('month').subtract(-1, 'days')],
'上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month').subtract(-1, 'days')]
},
startDate: beginTimeStore,
endDate: endTimeStore
}, function(start, end, label) {
beginTimeStore = start.format(this.locale.format);
endTimeStore = end.format(this.locale.format);
if(!this.startDate){
this.element.val('');
}else{
this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
}
});
$('#searchTime').on('apply.daterangepicker', function() {
dosearch();
});
};
//表格查询参数
function queryParamsFun(params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
order: params.order,
unitId: unitId,
status:$('#status').val(),
sdt:beginTimeStore,
edt:endTimeStore
}
};
function visible(){
if($('#status').val()=='${Status_0}'){
return true;
}else{
return false;
}
}
$(function() {
initDate();
});
var initFun = function () {
// initoverhaulType();
$('#table').bootstrapTable('destroy');
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/process/testTask/getListForPlan.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
singleSelect: false,//单选多选
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
pageSize: 50, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: queryParamsFun,
sortName: 'insdt', // 要排序的字段
sortOrder: 'desc', // 排序规则
onClickRow: function (row) {//单击行事件,执行查看功能
//viewFun(row.id);
},
columns: [
{
checkbox: true, // 显示一个勾选框
visible : visible()
},{
field: 'insdt', // 返回json数据中的name
title: '创建日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value.substring(0,16);
}
},{
field: 'sendname', // 返回json数据中的name
title: '发单人', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle'
},{
field: 'senddt', // 返回json数据中的name
title: '发单日期', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return value.substring(0,16);
}
},{
field: 'receivname', // 返回json数据中的name
title: '接单人', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
if(value==''){
return "未接单";
}else{
return value;
}
}
},{
field: '', // 返回json数据中的name
title: '检验指标', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return row.testIndexManage.name
}
},{
field: '', // 返回json数据中的name
title: '检验方法', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return row.testIndexManage.methodname
}
},{
field: '', // 返回json数据中的name
title: '注意事项', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
return row.testIndexManage.matters
}
},{
field: 'plantype', // 返回json数据中的name
title: '计划类型', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle',
formatter: function (value, row, index) {
if(value=='${PlanType_0}'){
return '常规'
}else if(value=='${PlanType_1}'){
return '临时'
}
}
},{
title: "操作",
align: 'center',
valign: 'middle',
width: '120', // 定义列的宽度单位为像素px
formatter: function (value, row, index) {
var buts = '';
if(row.status=='${Status_0}'){
buts += '<button class="btn btn-default btn-sm" title="接单" onclick="getTask(\'' + row.id + '\')"><i class="fa fa-send"></i><span class="hidden-md hidden-lg"> 接单</span></button>';
}
buts += '<security:authorize buttonUrl="process/testTaskPlan/manage.do">';
// buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
if(row.status=='${Status_0}'){
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg"> 删除</span></button>';
}
buts += '</security:authorize>';
if(row.status=='${Status_1}'&&row.sender=='${userId}'){
buts += '<button class="btn btn-default btn-sm" title="撤回" onclick="replay(\'' + row.id + '\')"><i class="fa fa-reply"></i><span class="hidden-md hidden-lg"> 撤回</span></button>';
}
buts += '<button class="btn btn-default btn-sm" title="查看" onclick="doView(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg"> 查看</span></button>';
buts = '<div class="btn-group" >' + buts + '</div>';
return buts;
}
}
],
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("table");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
}
function selectUser(){
$.post(ext.contextPath + '/user/userForOneSelect.do',{formId:'searchForm',hiddenId:'receiver',textId:'receivername',userId:$('#receiver').val()}, function (data) {
$("#subDiv").html(data);
openModal('user4SelectModal');
});
}
function sendTask(){
var userId=$('#receiver').val();
var checkedItems = $("#table").bootstrapTable('getAllSelections');
var ckids="";
$.each(checkedItems, function(index, item){
if(ckids!=""){
ckids+=",";
}
ckids+=item.id;
});
if(userId==''){
showAlert('d', '请选择下发人员!', 'mainAlertdiv');
return;
}
if(ckids==''){
showAlert('d', '请勾选下发记录!', 'mainAlertdiv');
return;
}
$.post(ext.contextPath + '/process/testTask/sendTask.do',{userId:userId,ckids:ckids}, function (data) {
if (data.code > 0) {
$("#table").bootstrapTable('refresh');
showAlert('s', '下发成功!', 'mainAlertdiv');
} else {
$("#table").bootstrapTable('refresh');
showAlert('d', data.msg, 'mainAlertdiv');
}
},'json');
}
function getTask(id){
swal({
text: "您确定要接单?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/process/testTask/getTask.do',{id:id}, function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
showAlert('s', '接单成功!', 'mainAlertdiv');
} else {
showAlert('d', data.msg, 'mainAlertdiv');
}
},'json');
}
});
}
function replay(id){
swal({
text: "您确定要撤回此记录?",
dangerMode: true,
buttons: {
cancel: {
text: "取消",
value: null,
visible: true,
className: "btn btn-default btn-sm",
closeModal: true,
},
confirm: {
text: "确定",
value: true,
visible: true,
className: "btn btn-danger btn-sm",
closeModal: true
}
}
})
.then(function (willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/process/testTask/replay.do',{id:id}, function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
showAlert('s', '撤回成功!', 'mainAlertdiv');
} else {
showAlert('d', data.msg, 'mainAlertdiv');
}
},'json');
}
});
}
function doView(id){
$.post(ext.contextPath + '/process/testTask/doview.do', { id: id }, function (data) {
$("#subDiv").html(data);
openModal('subModal');
});
}
function manualSend(id){
$.post(ext.contextPath + '/process/testTask/manualSend.do', { unitId: unitId }, function (data) {
if (data.code == 1) {
$("#table").bootstrapTable('refresh');
showAlert('s', '手动下发成功!', 'mainAlertdiv');
} else {
showAlert('d', data.msg, 'mainAlertdiv');
}
},'json');
}
</script>
</head>
<body onload="initFun()">
<div class="wrapper">
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="head_title"></h1>
<ol class="breadcrumb">
<li><a id='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
</ol>
</section>
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<!-- <div id="subDiv" style="width: 220px;height:10px;"></div> -->
<div id="subDiv"></div>
<div id="subTestindexmanageDiv"></div>
<form id="searchForm">
<div class="btn-group" style="padding-bottom:10px;">
<security:authorize buttonUrl="process/testTaskPlan/manage.do">
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"><i class="fa fa-plus"></i>
临时新增</button>
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"><i class="fa fa-trash-o"></i>
删除</button>
<button type="button" class="btn btn-default btn-sm" onclick="manualSend();"><i class="fa fa-tags"></i>
手动下发</button>
<div class="input-group pull-left input-group-sm" style="padding-left: 5px;">
<input type="hidden" id="receiver" name="receiver" value="" />
<input type="text" class="form-control pull-left" id="receivername" name="receivername" style="width:80px" placeholder="单击选人" onclick="selectUser();" readonly>
<div class="input-group-btn pull-left">
<button type="button" class="btn btn-default" onclick="sendTask();" ><i class="fa fa-send"></i> 发单</button>
</div>
</div>
</security:authorize>
</div>
<div class="form-group pull-right form-inline" >
<div class="input-group input-group-sm " style="width: 260px;margin-left:10px;">
<label class="col-sm-3" style="line-height: 30px;">日期</label>
<input type="text" class="col-sm-9" id="searchTime" style="height: 30px;" readonly>
</div>
<div class="input-group input-group-sm " style="width: 150px;margin-left:10px">
<label class="col-sm-5" style="line-height: 30px;">状态</label>
<select id ="status" name="status" class="select2 col-sm-7" style="height: 30px;padding: 0px 10px;" onchange="dosearch();">
<option value="${Status_0}" selected>待下发</option>
<option value="${Status_1}" >已下发</option>
<option value="${Status_2}" >已完成</option>
<!-- <option value="${Status_2}" selected>待提交</option> -->
</select>
</div>
<!-- <div class="input-group input-group-sm " style="width: 220px;">
<input type="text" id="search_mpointcode" name="search_mpointcode" class="form-control " placeholder="点位编码">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearchMp();"><i class="fa fa-search"></i></button>
</div>
</div> -->
</div>
</form>
<table id="table"></table>
</section>
<!-- /.content -->
</div>
</div>
</body>
</html>