新增任务督办时App端和短信端消息通知功能。

This commit is contained in:
Renpc-kilig 2021-11-25 18:19:24 +08:00
parent 510495e1ab
commit 6d80d55afa
6 changed files with 1017 additions and 89 deletions

View File

@ -163,6 +163,7 @@ public class ReceiverUserController extends DefaultBaseController {
public SuccessResult back(@PathVariable("receiverUserIds") String receiverUserIds) { public SuccessResult back(@PathVariable("receiverUserIds") String receiverUserIds) {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
params.put("receiverUserIds", Arrays.asList(receiverUserIds.split("_"))); params.put("receiverUserIds", Arrays.asList(receiverUserIds.split("_")));
params.put("receiverIds", receiverUserIds);
receiverUserService.back(params); receiverUserService.back(params);
return new SuccessResult(); return new SuccessResult();
} }

View File

@ -67,4 +67,9 @@ public class DistributeRouteController extends DefaultBaseController {
public ModelAndView listEveryday() { public ModelAndView listEveryday() {
return new ModelAndView("distribute/list-everyday"); return new ModelAndView("distribute/list-everyday");
} }
@GetMapping("list-already-business")
public ModelAndView listAlreadyBusiness() {
return new ModelAndView("distribute/list-already-business");
}
} }

View File

@ -303,6 +303,21 @@ public class ReceiverUserServiceImpl extends DefaultBaseService implements IRece
setAppUpdateInfo(token, params); setAppUpdateInfo(token, params);
} }
receiverUserDao.cancel(params); receiverUserDao.cancel(params);
if(!StringHandler.isNull(params.get("isSupervision"))) {
String[] receiverUserIds = params.get("receiverIds").toString().split("_");
for(int i=0;i<receiverUserIds.length;i++) {
ReceiverUserDTO receiverUserDTO = get(receiverUserIds[i]);
if(null != receiverUserDTO) {
String taskId = receiverUserDTO.getDistributeId();
DistributeDTO distributeDTO = distributeService.get(taskId);
if(null != distributeDTO) {
// app和短信催办
sendAppMsg("任务督办", "您的任务:" + distributeDTO.getDistributeTitle() + "已被督办。请及时处理。", receiverUserDTO.getUserId());
sendNoteMsg("您的任务:" + distributeDTO.getDistributeTitle() + "已被督办。", receiverUserDTO.getUserId());
}
}
}
}
} }
@Override @Override
@ -310,7 +325,7 @@ public class ReceiverUserServiceImpl extends DefaultBaseService implements IRece
Map<String, Object> params = new HashMap<>(2); Map<String, Object> params = new HashMap<>(2);
params.put("isReceive", 1); params.put("isReceive", 1);
params.put("distributeStatus", "已下派"); params.put("distributeStatus", "已下派");
params.put("taskType", "正常"); params.put("NotTaskType", "正常");
params.put("executeStatusNoOver", "完成"); params.put("executeStatusNoOver", "完成");
List<ReceiverUserDTO> receiverUserDTOList = list(params); List<ReceiverUserDTO> receiverUserDTOList = list(params);
if(null != receiverUserDTOList && receiverUserDTOList.size() > 0) { if(null != receiverUserDTOList && receiverUserDTOList.size() > 0) {

View File

@ -436,6 +436,10 @@
AND AND
t1.task_type = #{taskType} t1.task_type = #{taskType}
</if> </if>
<if test="NotTaskType != null and NotTaskType != ''">
AND
t1.task_type <![CDATA[ <> ]]> #{NotTaskType}
</if>
<if test="checkStatus != null and checkStatus != ''"> <if test="checkStatus != null and checkStatus != ''">
AND AND
t1.check_status = #{checkStatus} t1.check_status = #{checkStatus}

View File

@ -0,0 +1,811 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item" style="width: 170px;" placeholder="输入关键字">
</div>
<div class="layui-inline">
<input type="text" id="distributeDeadline" class="layui-input search-item" style="width: 170px;" placeholder="截止日期" readonly>
</div>
<div class="layui-inline">
<input type="text" id="area" name="area" class="layui-input search-item" placeholder="点击选择区域" readonly>
<input type="hidden" id="areaId_1" name="areaId_1">
<input type="hidden" id="areaId_2" name="areaId_2">
<input type="hidden" id="areaId_3" name="areaId_3">
<input type="hidden" id="areaId_4" name="areaId_4">
<input type="hidden" id="areaId_5" name="areaId_5">
</div>
<div class="layui-inline">
<input type="text" id="receiverUser" name="receiverUser" style="width: 170px;" class="layui-input search-item" placeholder="点击选择任务接收人" readonly>
<input type="hidden" id="userId" name="userId">
</div>
<div class="layui-inline">
<input type="text" id="reportCount" name="reportCount" class="layui-input search-item" style="width: 120px;" placeholder="上报次数">
</div>
<div class="layui-inline">
<div class="layui-input-block layui-form" style="width: 120px;margin-left: 0px;" id="urgentLevelSelectTemplateBox" lay-filter="urgentLevelSelectTemplateBox"></div>
<script id="urgentLevelSelectTemplate" type="text/html">
<select id="urgentLevel" name="urgentLevel" lay-filter="urgentLevel" lay-verify="required">
<option value="">紧急等级</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-inline">
<div class="layui-input-block layui-form" style="width: 120px;margin-left: 0px;">
<select name="taskType" id="taskType" lay-filter="taskType">
<option value="">任务状态</option>
<option value="未下派">未下派</option>
<option value="已下派">已下派</option>
<option value="已取消">已取消</option>
<option value="下派超时">下派超时</option>
</select>
</div>
</div>
<div class="layui-btn-group">
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
<button type="button" id="charts" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 图表
</button>
</div>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<!--<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 编辑
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>-->
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="cancelEvent">
<i class="fa fa-lg fa-edit"></i> 取消
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="reassignmentEvent">
<i class="fa fa-lg fa-edit"></i> 转派
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="reissueEvent">
<i class="fa fa-lg fa-edit"></i> 补发
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="backEvent">
<i class="fa fa-lg fa-edit"></i> 退回
</button>
</div>
</script>
<!-- 审核退回原因 -->
<noscript id="task-back" >
<!-- style 尽量不要影响到页面其他元素,使用#userinfo范围限定 -->
<style type="text/css">
#userinfo .layui-form-label.layui-required:after {
content: "*";
color: red;
position: absolute;
top: 10px;
right: 5px;
}
</style>
<div class="layui-card" id="userinfo">
<div class="layui-card-header">任务回退原因</div>
<input type="hidden" id="distributeIds" value="{{d.distributeIds}}">
<div class="layui-card-body">
<form class="layui-form" action="" lay-filter="info">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">回退原因</label>
<div class="layui-input-block">
<textarea placeholder="请输入回退原因" name="reason" id="reason" lay-verify="contentRule" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" id="subBtn" lay-submit lay-filter="submitForm">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</div>
</form>
<script>
layui.use(['index', 'form', 'laydate', 'laytpl'], function() {
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
form.verify({
contentRule: function(value) {
if (null == value || '' == value || typeof (value) == "undefined") {
return '退回原因必须填写';
}
},
});
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
var distributeIds = $('#distributeIds').val();
top.restAjax.delete(top.restAjax.path('api/distribute/back/{distributeIds}?checkStatus={checkStatus}&reason={reason}', [distributeIds, '已回退', formData.field.reason]), {}, null, function (code, data) {
if('200' == code) {
top.dialog.msg('回退成功');
window.location.reload();
}else {
top.dialog.msg('回退失败');
}
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
form.render();
});
</script>
</div>
</div>
</noscript>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'form', 'table', 'laydate', 'common', 'laytpl'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var laytpl = layui.laytpl;
var form = layui.form;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/distribute/listpage?distributeStatus={distributeStatus}&distributeStatusCancel={distributeStatusCancel}&distributeTaskType={distributeTaskType}';
var selectedAreaArray = [];
var receiverUserList = [];
// 初始化任务紧急程度下拉选择
function initUrgentLevelSelect() {
top.restAjax.get(top.restAjax.path('api/data/listbyparentid/{dataParentId}', ['203f7283-74a6-4f05-9d5f-c6675b3a69fc']), {}, null, function(code, data, args) {
laytpl(document.getElementById('urgentLevelSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('urgentLevelSelectTemplateBox').innerHTML = html;
});
form.render('select', 'urgentLevelSelectTemplateBox');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
initUrgentLevelSelect();
// 事件 - 跳转图表页面
$(document).on('click', '#charts', function() {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/distribute/charts', []),
end: function() {
reloadTable();
}
});
});
// 选择区域
$(document).on('click', '#area', function() {
top.dialog.open({
title: '选择地区',
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#area').val())]),
width: '800px',
height: '225px',
onClose: function () {
selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
console.log(selectedAreaArray)
var areaCode = '';
var areaName = '';
if (selectedAreaArray.length > 0) {
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
for (var i = 0, item; item = selectedAreaArray[i++];) {
if (areaName) {
areaName += ',';
}
areaName += item.areaName;
$('#areaId_' + i).val(item.areaId);
}
}
$('#area').val(areaName);
}
})
});
// 任务接收人点击事件
$(document).on('click', '#receiverUser', function() {
top.dialog.open({
url: top.restAjax.path('route/department/user/select-user', []),
title: '任务接收人',
width: '1040px',
height: '98%',
onClose: function(data) {
var receiverUserList = [];
console.log(top.dialog.dialogData.selectedDepartmentUsers)
if(top.dialog.dialogData.selectedDepartmentUsers.length > 0) {
receiverUserList = top.dialog.dialogData.selectedDepartmentUsers;
}
if(receiverUserList.length > 0) {
var ids = '';
var userNames = '';
for(var i = 0, item; item = receiverUserList[i++];) {
if(i > 1) {
ids += ',';
userNames += ',';
}
ids += item['userId'];
userNames += item['userName'];
}
$('#userId').val(ids);
$('#receiverUser').val(userNames);
}
}
});
});
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, ['已下派', '已取消', '巡查任务']),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'distributeTitle', width: 180, title: '名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'distributeSummary', width: 180, title: '描述', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'distributeType', width: 180, title: '下派类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'distributeTime', width: 180, title: '下派时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskTemplate', width: 180, title: '下派模板', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'distributeDeadline', width: 180, title: '截止时间', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'urgentLevel', width: 180, title: '紧急等级', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'reportCount', width: 180, title: '上报次数', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea1Name', width: 180, title: '任务一级地区名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea1Code', width: 180, title: '任务一级地区编码', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea2Name', width: 180, title: '任务二级地区名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea2Code', width: 180, title: '任务二级地区编码', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea3Name', width: 180, title: '任务三级地区名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea3Code', width: 180, title: '任务三级地区编码', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea4Name', width: 180, title: '任务四级地区名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea4Code', width: 180, title: '任务四级地区编码', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea5Name', width: 180, title: '任务五级地区名称', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'taskArea5Code', width: 180, title: '任务五级地区编码', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'missionLocation', width: 180, title: '任务地点', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'missionLocationLng', width: 180, title: '任务地点精度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'missionLocationLat', width: 180, title: '任务地点纬度', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'distributeStatus', width: 180, title: '下派状态', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
}
]
],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
console.log($('#areaId_1').val())
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, ['已下派', '已取消', '巡查任务']),
where: {
keywords: $('#keywords').val(),
distributeDeadline: $('#distributeDeadline').val(),
taskArea1Id: $('#areaId_1').val(),
taskArea2Id: $('#areaId_2').val(),
taskArea3Id: $('#areaId_3').val(),
taskArea4Id: $('#areaId_4').val(),
taskArea5Id: $('#areaId_5').val(),
userId: $('#userId').val(),
urgentLevel: $('#urgentLevel').val(),
reportCount: $('#reportCount').val(),
distributeStatus: $('#distributeStatus').val(),
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
// 初始化日期
function initDate() {
// 日期选择
laydate.render({
elem: '#distributeDeadline',
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/distribute/remove/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
// 取消
function cancelData(ids) {
top.dialog.msg('确定取消?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/distribute/cancel/{ids}/{distributeType}', [ids, '已取消']), {}, null, function (code, data) {
top.dialog.msg('取消成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
// 转派
function reassignmentData(ids) {
top.dialog.msg('任务转派会将此任务下的所有人员转为新的人员', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.open({
url: top.restAjax.path('route/department/user/select-user', []),
title: '任务接收人',
width: '1040px',
height: '98%',
onClose: function(data) {
receiverUserList = [];
if(top.dialog.dialogData.selectedDepartmentUsers.length > 0) {
receiverUserList = top.dialog.dialogData.selectedDepartmentUsers;
}
if(receiverUserList.length > 0) {
top.dialog.close(index);
var layIndex;
top.restAjax.put(top.restAjax.path('api/distribute/reassignment/{ids}', [ids]), {receiverUserList}, null, function (code, data) {
top.dialog.msg('转派成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
}
});
}
});
}
// 补发
function reissueData(ids) {
top.dialog.msg('确定补发?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.open({
url: top.restAjax.path('route/department/user/select-user', []),
title: '任务接收人',
width: '1040px',
height: '98%',
onClose: function(data) {
receiverUserList = [];
if(top.dialog.dialogData.selectedDepartmentUsers.length > 0) {
receiverUserList = top.dialog.dialogData.selectedDepartmentUsers;
}
if(receiverUserList.length > 0) {
top.dialog.close(index);
var layIndex;
top.restAjax.put(top.restAjax.path('api/distribute/reissue/{ids}', [ids]), {receiverUserList}, null, function (code, data) {
top.dialog.msg('补发成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
}
});
}
});
}
// 退回
function back(distributeIds) {
//给模板 tpl-user 传递参数
var tpldata = {
"distributeIds": distributeIds
};
//获取id为tpl-user的noscript标签的html内容,不能使用innerHtml
laytpl(document.getElementById('task-back').innerText)
.render(tpldata,function(html){
//渲染完成后直接打开
layer.open({
type: 1,
shade: false,
area: ['80%', '50%'],
title: false, //不显示标题
content: html,
});
});
}
initTable();
initDate();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/distribute/save', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/distribute/update?distributeId={distributeId}', [checkDatas[0].distributeId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['distributeId'];
}
removeData(ids);
}
} else if(layEvent === 'cancelEvent') {
if(checkDatas.length === 0) {
top.dialog.msg('请选择要取消的任务');
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['distributeId'];
}
cancelData(ids);
}
} else if(layEvent === 'reassignmentEvent') {
if(checkDatas.length === 0) {
top.dialog.msg('请选择要转派的任务');
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['distributeId'];
}
reassignmentData(ids);
}
} else if(layEvent === 'reissueEvent') {
if(checkDatas.length === 0) {
top.dialog.msg('请选择要补发的任务');
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['distributeId'];
}
reissueData(ids);
}
} else if(layEvent === 'backEvent') {
console.log(checkDatas)
if(checkDatas.length === 0) {
top.dialog.msg('请选择需要退回的数据');
} else {
var distributeIds = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
distributeIds += '_';
}
distributeIds += item['distributeId'];
}
back(distributeIds);
}
}
});
});
</script>
</body>
</html>

View File

@ -365,6 +365,15 @@
return rowData; return rowData;
} }
}, },
{field: 'distributeTaskType', width: 180, title: '任务类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'distributeTime', width: 180, title: '下派时间', align:'center', {field: 'distributeTime', width: 180, title: '下派时间', align:'center',
templet: function(row) { templet: function(row) {
var rowData = row[this.field]; var rowData = row[this.field];
@ -479,7 +488,7 @@
return rowData; return rowData;
} }
}, },
{field: '', fixed: 'right', width: 300, title: '操作', align:'center', {field: '', fixed: 'right', width: 340, title: '操作', align:'center',
templet: function(row) { templet: function(row) {
var rowData = '<div class="layui-btn-group">\n' + var rowData = '<div class="layui-btn-group">\n' +
' <a class="layui-btn layui-btn-xs" lay-event="reassignment">转派</a>\n' + ' <a class="layui-btn layui-btn-xs" lay-event="reassignment">转派</a>\n' +
@ -828,6 +837,16 @@
// 退回 // 退回
function check(receiverUserIds) { function check(receiverUserIds) {
var layIndex;
top.restAjax.get(top.restAjax.path('api/receiveruser/get/{receiverUserId}', [receiverUserIds]), {}, null, function (code, getData) {
if('未完成' == getData.executeStatus) {
top.dialog.msg('当前任务未完成');
return false;
}else {
if('已通过' == getData.checkStatus || '已回退' == getData.checkStatus) {
top.dialog.msg('当前任务审核:' + getData.checkStatus);
return false;
}else {
layer.confirm('审核状态', { layer.confirm('审核状态', {
btn: ['通过', '回退'] btn: ['通过', '回退']
}, function(index, layero){ }, function(index, layero){
@ -847,28 +866,42 @@
back(receiverUserIds); back(receiverUserIds);
}); });
} }
}
// 修改任务状态
function taskStatus(receiverUserId) {
layer.confirm('任务状态', {
btn: ['完成', '进行中', '任务接收']
,btn3: function(index, layero){
top.dialog.close(index);
var layIndex;
top.restAjax.put(top.restAjax.path('api/receiveruser/update/{receiverUserId}', [receiverUserId]), {
isReceive: 1
}, null, function (code, data) {
top.dialog.msg('任务接收成功', {time: 1000});
reloadTable();
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);
}, function () { }, function () {
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3}); layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () { }, function () {
top.dialog.close(layIndex); top.dialog.close(layIndex);
}); });
} }
}, function(outerIndex, layero){
// 修改任务状态
function taskStatus(receiverUserId) {
var layIndex;
top.restAjax.get(top.restAjax.path('api/receiveruser/get/{receiverUserId}', [receiverUserId]), {}, null, function (getCode, getData) {
if ('正常' != getData.taskType) {
top.dialog.msg('当前任务' + getData.taskType);
return false;
}else {
layer.confirm('审核状态', {
btn: ['任务接收', '任务完成']
}, function(index1, layero){
if ('1' == getData.isReceive) {
top.dialog.msg('当前任务已接收');
return false;
} else {
layer.close(index1);
receiveTask(receiverUserId);
}
}, function(index2){
if ('0' == getData.isReceive) {
top.dialog.msg('您需要先接收任务');
return false;
}else {
top.restAjax.get(top.restAjax.path('api/receiveruserpatrol/list/?receiverUserId={receiverUserId}', [receiverUserId]), {}, null, function (patrolCode, patrolData) {
console.log(patrolData)
if ('' == patrolData) {
top.dialog.msg('您须先填写任务结果', { top.dialog.msg('您须先填写任务结果', {
time: 0, time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no], btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
@ -879,25 +912,37 @@
title: '任务结果', title: '任务结果',
width: '1040px', width: '1040px',
height: '98%', height: '98%',
onClose: function(data) { onClose: function (data) {
var layIndex; var layIndex;
top.restAjax.get(top.restAjax.path('api/receiveruserpatrol/list?receiverUserId={receiverUserId}', [receiverUserId]), {}, null, function (code, backData) { top.restAjax.get(top.restAjax.path('api/receiveruserpatrol/list?receiverUserId={receiverUserId}', [receiverUserId]), {}, null, function (code, backData) {
console.log(backData); if (backData.length > 0) {
if(backData.length > 0) { layer.close(index);
layer.close(outerIndex); overTask(receiverUserId)
top.restAjax.put(top.restAjax.path('api/receiveruser/update/{receiverUserId}', [receiverUserId]), { }
executeStatus: '完成'
}, null, function (code, data) {
top.dialog.msg('提交成功', {time: 1000});
reloadTable();
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);
}, function () { }, function () {
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3}); layIndex = top.dialog.msg(top.dataMessage.deleting, {
icon: 16,
time: 0,
shade: 0.3
});
}, function () { }, function () {
top.dialog.close(layIndex); top.dialog.close(layIndex);
}); });
} }
});
}
});
} else {
if ('完成' == getData.executeStatus) {
top.dialog.msg('当前任务已完成');
return false;
} else {
layer.close(index2);
overTask(receiverUserId);
}
}
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);
}, function () { }, function () {
@ -908,9 +953,35 @@
} }
}); });
} }
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
}); });
}, function(index){ }
top.dialog.close(index);
// 接受任务
function receiveTask(receiverUserId) {
var layIndex;
top.restAjax.put(top.restAjax.path('api/receiveruser/update/{receiverUserId}', [receiverUserId]), {
isReceive: 1,
executeStatus: '进行中'
}, null, function (code, data) {
top.dialog.msg('任务接收成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.updating, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
//任务进行中
function ingTask(receiverUserId) {
var layIndex; var layIndex;
top.restAjax.put(top.restAjax.path('api/receiveruser/update/{receiverUserId}', [receiverUserId]), { top.restAjax.put(top.restAjax.path('api/receiveruser/update/{receiverUserId}', [receiverUserId]), {
executeStatus: '进行中' executeStatus: '进行中'
@ -924,6 +995,27 @@
}, function () { }, function () {
top.dialog.close(layIndex); top.dialog.close(layIndex);
}); });
}
// 任务完成
function overTask(receiverUserId) {
var layIndex;
top.restAjax.put(top.restAjax.path('api/receiveruser/update/{receiverUserId}', [receiverUserId]), {
executeStatus: '完成',
isReceive: 1
}, null, function (code, data) {
top.dialog.msg('提交成功', {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.updating, {
icon: 16,
time: 0,
shade: 0.3
});
}, function () {
top.dialog.close(layIndex);
}); });
} }