增加待办移动端适配

This commit is contained in:
syruan 2025-07-16 18:26:36 +08:00 committed by syruan
parent 8922b69069
commit 271569ba6e
7 changed files with 1167 additions and 14 deletions

View File

@ -37,7 +37,6 @@
<script src="${bonuspath}/static/js/jquery/jquery.md5.js"></script>
<script src="${bonuspath}/static/js/layui/layui.js"></script>
<script src="${bonuspath}/static/plugins/layer/2.1/layer.js"></script>
<script type="text/javascript" src="${bonuspath}/static/js/sys/login.js"></script>
<script>
// 显示用户协议
@ -811,21 +810,23 @@ body::before {
// 设置登录进行中状态
isLoginInProgress = true;
// 保存记住密码的凭
// 设置登录进行中状态并获取表单数
const username = $('#accountNameId').val().trim();
const password = $('#passwordId').val();
const remember = $('#rememberCheckbox').is(':checked');
// 保存记住密码的凭据
if (remember) {
saveCredentials(username, password, true);
}
// 执行原有的登录逻辑
dialogloading();
var loginname = $("#accountNameId").val();
var password = $("#passwordId").val();
let loginname = username;
let encodedPassword = password;
loginname = encodeURI(encodeURI(loginname));
password = encodeURI(encodeURI(password));
encodedPassword = encodeURI(encodeURI(encodedPassword));
localStorage.setItem("pwd", $.md5(password));
localStorage.setItem("uname", loginname);

View File

@ -0,0 +1,614 @@
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>待办任务 - 移动端</title>
<script src="${pageContext.request.contextPath}/static/js/jquery/jquery-2.0.3.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: #f5f5f5;
color: #333;
line-height: 1.4;
}
/* 头部 */
.mobile-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 15px;
text-align: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.mobile-header h1 {
font-size: 18px;
font-weight: 600;
}
/* 搜索区域 */
.search-container {
background: white;
padding: 15px;
margin-bottom: 10px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.search-row {
display: flex;
gap: 10px;
align-items: stretch;
}
.mobile-select {
flex: 0 0 80px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 6px;
background: white;
font-size: 14px;
height: 44px;
box-sizing: border-box;
}
.mobile-input {
flex: 1;
padding: 10px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
height: 44px;
box-sizing: border-box;
}
.btn {
padding: 10px 15px;
border: none;
border-radius: 6px;
font-size: 14px;
cursor: pointer;
height: 44px;
min-width: 44px;
box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn-primary {
background: #007bff;
color: white;
}
.btn-success {
background: #28a745;
color: white;
}
.btn-info {
background: #17a2b8;
color: white;
}
.btn-secondary {
background: #6c757d;
color: white;
}
.btn:disabled {
background: #ccc;
cursor: not-allowed;
}
/* 任务列表 */
.content {
padding: 0 15px;
}
.task-card {
background: white;
margin-bottom: 10px;
border-radius: 8px;
padding: 15px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.task-header {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.task-checkbox {
margin-right: 10px;
width: 18px;
height: 18px;
}
.task-title {
font-weight: 600;
color: #333;
flex: 1;
}
.task-info {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
font-size: 13px;
color: #666;
}
.task-creator {
font-size: 13px;
color: #888;
margin-bottom: 10px;
}
.task-actions {
text-align: right;
}
.btn-sm {
padding: 6px 12px;
font-size: 12px;
}
/* 分页 */
.pagination {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background: white;
margin: 10px 15px;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.page-info {
font-size: 14px;
color: #666;
}
/* 底部操作栏 */
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: white;
padding: 15px;
box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
z-index: 100;
}
.bottom-bar .btn {
width: 100%;
font-size: 16px;
padding: 12px;
}
/* 加载和提示 */
.loading {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(255,255,255,0.8);
display: none;
z-index: 999;
}
.loading-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.spinner {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid #007bff;
border-radius: 50%;
animation: spin 1s linear infinite;
margin: 0 auto 10px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.alert {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
z-index: 1001;
display: none;
min-width: 250px;
text-align: center;
}
.alert-message {
margin-bottom: 15px;
font-size: 14px;
}
.empty {
text-align: center;
padding: 40px;
color: #999;
}
/* 响应式调整 */
@media (max-width: 375px) {
.search-row {
flex-wrap: wrap;
}
.mobile-select {
flex: 1;
min-width: 0;
}
}
/* 避免底部操作栏遮挡内容 */
body {
padding-bottom: 80px;
}
</style>
</head>
<body>
<!-- 头部 -->
<div class="mobile-header">
<h1>待办任务列表</h1>
</div>
<!-- 搜索区域 -->
<div class="search-container">
<div class="search-row">
<select id="taskStatus" class="mobile-select">
<option value="0" selected>待办</option>
<option value="1">已办</option>
</select>
<input type="text" id="keyword" class="mobile-input" placeholder="请输入关键词搜索">
<button id="searchBtn" class="btn btn-primary">搜索</button>
</div>
</div>
<!-- 任务列表 -->
<div class="content">
<div id="taskList">
<!-- 动态加载 -->
</div>
</div>
<!-- 分页 -->
<div class="pagination">
<button id="prevBtn" class="btn btn-secondary">上一页</button>
<span id="pageInfo" class="page-info">1/1</span>
<button id="nextBtn" class="btn btn-secondary">下一页</button>
</div>
<!-- 底部操作栏 -->
<div class="bottom-bar">
<button id="batchBtn" class="btn btn-success" disabled>
批量审批 (<span id="selectedCount">0</span>)
</button>
</div>
<!-- 加载指示器 -->
<div id="loading" class="loading">
<div class="loading-content">
<div class="spinner"></div>
<p>加载中...</p>
</div>
</div>
<!-- 提示框 -->
<div id="alert" class="alert">
<div class="alert-message" id="alertMessage"></div>
<button id="alertBtn" class="btn btn-primary">确定</button>
</div>
<script>
// 全局变量
var bonuspath = '${pageContext.request.contextPath}';
var currentPage = 1;
var pageSize = 10;
var totalPages = 1;
var selectedTasks = new Set();
// 页面初始化
$(document).ready(function() {
bindEvents();
toggleBatchButton(); // 初始化按钮状态
loadTasks(1);
});
// 绑定事件
function bindEvents() {
// 搜索
$('#searchBtn').on('click', function() {
currentPage = 1;
selectedTasks.clear();
updateSelectedCount();
loadTasks(currentPage);
});
// 回车搜索
$('#keyword').on('keydown', function(e) {
if (e.which === 13) {
$('#searchBtn').click();
}
});
// 状态切换
$('#taskStatus').on('change', function() {
toggleBatchButton();
currentPage = 1;
selectedTasks.clear();
updateSelectedCount();
loadTasks(currentPage);
});
// 分页
$('#prevBtn').on('click', function() {
if (currentPage > 1) {
currentPage--;
loadTasks(currentPage);
}
});
$('#nextBtn').on('click', function() {
if (currentPage < totalPages) {
currentPage++;
loadTasks(currentPage);
}
});
// 批量审批
$('#batchBtn').on('click', function() {
if (selectedTasks.size === 0) {
showAlert('请先选择要审批的任务');
return;
}
batchApproval();
});
// 页面可见性变化刷新
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === "visible") {
loadTasks(currentPage);
}
});
}
// 加载任务列表
function loadTasks(page) {
showLoading();
var isFinish = $('#taskStatus').val();
var keyword = $('#keyword').val();
var data = {
pageNum: page,
pageSize: pageSize
};
if (keyword && keyword.trim()) {
data.keyWord = keyword.trim();
}
$.ajax({
type: 'POST',
url: bonuspath + '/backstage/rm/taskRecord/findUnFinishContentMobile?isFinish=' + isFinish,
data: JSON.stringify(data),
dataType: 'json',
contentType: 'application/json',
success: function(response) {
hideLoading();
console.log('接口返回数据:', response);
if (response && response.res === 1) {
console.log('任务数据:', response.obj.data);
console.log('分页数据:', response.obj.pagination);
renderTasks(response.obj.data || []);
updatePagination(response.obj.pagination || {});
} else {
console.log('加载失败:', response.resMsg);
showAlert(response.resMsg || '加载失败');
}
},
error: function() {
hideLoading();
showAlert('网络错误,请稍后重试');
}
});
}
// 渲染任务列表
function renderTasks(tasks) {
var html = '';
if (tasks.length === 0) {
html = '<div class="empty">暂无任务数据</div>';
} else {
tasks.forEach(function(task) {
var taskKey = task.checkerId + '_' + (task.processName || '');
var isChecked = selectedTasks.has(taskKey) ? 'checked' : '';
var canCheck = $('#taskStatus').val() === '0' ? '' : 'disabled';
html += '<div class="task-card">';
html += ' <div class="task-header">';
html += ' <input type="checkbox" class="task-checkbox" value="' + taskKey + '" ' + isChecked + ' ' + canCheck + '>';
html += ' <span class="task-title">' + ((task.processName || '') + '-' + (task.definitionName || '')) + '</span>';
html += ' </div>';
html += ' <div class="task-info">';
html += ' <span>创建时间: ' + (task.operationTime || '') + '</span>';
html += ' <span>计划编号: ' + (task.number || '') + '</span>';
html += ' </div>';
html += ' <div class="task-creator">创建人: ' + (task.creatorName || task.operationUserName || '') + '</div>';
html += ' <div class="task-actions">';
html += ' <button class="btn btn-info btn-sm" onclick="viewTaskDetail(\'' + task.id + '\', \'' + (task.processName || '') + '\')">查看详情</button>';
html += ' </div>';
html += '</div>';
});
}
$('#taskList').html(html);
bindTaskEvents();
}
// 绑定任务事件
function bindTaskEvents() {
$('.task-checkbox').on('change', function() {
var taskId = $(this).val();
if ($(this).is(':checked')) {
selectedTasks.add(taskId);
} else {
selectedTasks.delete(taskId);
}
updateSelectedCount();
});
}
// 查看任务详情(页面跳转)
function viewTaskDetail(id, processName) {
var uname = localStorage.getItem("uname");
var pwd = localStorage.getItem("pwd");
if (!uname || !pwd) {
showAlert('未找到用户凭证,请重新登录');
return;
}
showLoading();
$.ajax({
type: "post",
url: "http://10.1.0.142:1999/gz_car/login/userLogin",
data: {
username: uname,
password: pwd
},
success: function(data) {
hideLoading();
if (data.code == "200") {
localStorage.setItem("token", data.token);
// 根据流程类型跳转到对应页面
if (processName === '派车计划') {
window.open("http://10.1.0.142:1999/gz-car/page/car_demand_plan/child/dispatch_car_detail.html?id=" + id + "&token=" + data.token);
} else if (processName === '用车计划') {
window.open("http://10.1.0.142:1999/gz-car/page/car_demand_plan/child/apply_plan_detail.html?id=" + id + "&token=" + data.token);
} else {
showAlert('暂不支持该类型任务的详情查看: ' + processName);
}
} else {
showAlert("没有权限!");
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
hideLoading();
showAlert("未连接到服务器,请检查网络!状态码:" + XMLHttpRequest.status);
}
});
}
// 批量审批
function batchApproval() {
showLoading();
$.ajax({
type: 'POST',
url: bonuspath + '/backstage/rm/taskRecord/batchApproval',
traditional: true,
data: { ids: Array.from(selectedTasks) },
success: function(data) {
hideLoading();
showAlert('批量审批成功', function() {
selectedTasks.clear();
updateSelectedCount();
loadTasks(currentPage);
});
},
error: function() {
hideLoading();
showAlert('批量审批失败,请稍后重试');
}
});
}
// 更新分页
function updatePagination(pagination) {
currentPage = pagination.currentPage || 1;
totalPages = pagination.totalPages || 1;
$('#pageInfo').text(currentPage + '/' + totalPages);
$('#prevBtn').prop('disabled', currentPage <= 1);
$('#nextBtn').prop('disabled', currentPage >= totalPages);
}
// 切换批量按钮状态
function toggleBatchButton() {
var isFinish = $('#taskStatus').val();
$('#batchBtn').prop('disabled', isFinish === '1');
}
// 更新选中计数
function updateSelectedCount() {
$('#selectedCount').text(selectedTasks.size);
}
// 显示加载
function showLoading() {
$('#loading').show();
}
// 隐藏加载
function hideLoading() {
$('#loading').hide();
}
// 显示提示
function showAlert(message, callback) {
$('#alertMessage').text(message);
$('#alert').show();
$('#alertBtn').off('click').on('click', function() {
$('#alert').hide();
if (typeof callback === 'function') {
callback();
}
});
}
</script>
</body>
</html>

View File

@ -7,6 +7,7 @@
<%@include file="../systemset.jsp" %>
<link rel="stylesheet" href="${bonuspath}/static/plugins/zTree/3.5/zTreeStyle.css" />
<script src="${bonuspath}/static/plugins/zTree/3.5/jquery.ztree.all.min.js"></script>
<script src="${bonuspath}/static/js/mobile-detect.js"></script>
<style type="text/css">
.orgTree {
width:100% !important;
@ -72,6 +73,48 @@
</div>
</div>
<script type="text/javascript">
// 移动端检测和跳转
$(document).ready(function() {
console.log('开始移动端检测...');
console.log('用户代理:', navigator.userAgent);
console.log('当前URL:', window.location.href);
// 检测移动端并跳转
var isMobile = MobileDetect.isMobile();
console.log('移动端检测结果:', isMobile);
if (isMobile) {
var currentUrl = window.location.href;
console.log('当前URL分析:', currentUrl);
// 避免无限重定向 - 检查是否已经在移动端页面
if (currentUrl.indexOf('unFinishWorkList-mobile') !== -1) {
console.log('已在移动端页面,跳过跳转');
return;
}
// 构建移动端页面URL
var baseUrl = currentUrl.split('?')[0]; // 去掉查询参数
var queryParams = currentUrl.split('?')[1] || ''; // 保留查询参数
// 将 show 替换为 showMobile
var mobileUrl = baseUrl.replace('/show', '/showMobile');
if (queryParams) {
mobileUrl += '?' + queryParams;
}
console.log('准备跳转到移动端页面:', mobileUrl);
console.log('执行跳转到移动端页面');
setTimeout(function() {
window.location.href = mobileUrl;
}, 100);
return;
} else {
console.log('桌面设备,不进行跳转');
}
});
function edit(id,definitionId){
cleanForm();
$.ajax({

View File

@ -0,0 +1,364 @@
/* 移动端适配样式 */
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 14px;
line-height: 1.5;
color: #333;
background-color: #f5f5f5;
}
/* 容器 */
.mobile-container {
width: 100%;
max-width: 100%;
padding: 0;
margin: 0;
}
/* 头部 */
.mobile-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 50px;
background-color: #007bff;
color: white;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
z-index: 1000;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.mobile-header h1 {
font-size: 18px;
margin: 0;
font-weight: 500;
}
.back-btn {
background: none;
border: none;
color: white;
font-size: 16px;
padding: 5px;
cursor: pointer;
}
/* 内容区域 */
.mobile-content {
margin-top: 50px;
padding: 15px;
padding-bottom: 80px; /* 为底部按钮留空间 */
}
/* 搜索表单 */
.mobile-search-form {
background: white;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.mobile-form-group {
margin-bottom: 15px;
}
.mobile-form-group:last-child {
margin-bottom: 0;
}
.mobile-form-group label {
display: block;
margin-bottom: 5px;
font-weight: 500;
color: #555;
}
.mobile-form-control {
width: 100%;
padding: 10px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px; /* 防止iOS缩放 */
background-color: white;
}
.mobile-form-control:focus {
outline: none;
border-color: #007bff;
box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}
.mobile-select {
width: 100%;
padding: 10px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
background-color: white;
}
/* 按钮 */
.mobile-btn {
display: inline-block;
padding: 10px 16px;
border: none;
border-radius: 4px;
font-size: 14px;
text-align: center;
cursor: pointer;
text-decoration: none;
transition: all 0.2s;
min-height: 44px; /* iOS触摸目标最小尺寸 */
}
.mobile-btn-primary {
background-color: #007bff;
color: white;
}
.mobile-btn-primary:hover {
background-color: #0056b3;
}
.mobile-btn-success {
background-color: #28a745;
color: white;
}
.mobile-btn-success:hover {
background-color: #1e7e34;
}
.mobile-btn-full {
width: 100%;
margin-bottom: 10px;
}
/* 任务列表 */
.mobile-task-list {
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.mobile-task-item {
padding: 15px;
border-bottom: 1px solid #eee;
position: relative;
}
.mobile-task-item:last-child {
border-bottom: none;
}
.mobile-task-item.selected {
background-color: #e7f3ff;
}
.mobile-task-header {
display: flex;
align-items: flex-start;
margin-bottom: 8px;
}
.mobile-task-checkbox {
margin-right: 10px;
margin-top: 2px;
transform: scale(1.2);
}
.mobile-task-title {
flex: 1;
font-size: 16px;
font-weight: 500;
color: #333;
line-height: 1.4;
}
.mobile-task-meta {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
margin-top: 10px;
font-size: 13px;
color: #666;
}
.mobile-task-meta-item {
display: flex;
flex-direction: column;
}
.mobile-task-meta-label {
font-size: 12px;
color: #999;
margin-bottom: 2px;
}
.mobile-task-meta-value {
font-weight: 500;
}
/* 底部操作栏 */
.mobile-bottom-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: white;
padding: 15px;
border-top: 1px solid #eee;
box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
z-index: 1000;
}
.mobile-bottom-actions .mobile-btn {
margin-bottom: 0;
}
/* 加载状态 */
.mobile-loading {
text-align: center;
padding: 20px;
color: #666;
}
.mobile-loading::after {
content: "";
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid #ddd;
border-top-color: #007bff;
border-radius: 50%;
animation: mobile-spin 1s linear infinite;
margin-left: 10px;
}
@keyframes mobile-spin {
to {
transform: rotate(360deg);
}
}
/* 空状态 */
.mobile-empty {
text-align: center;
padding: 40px 20px;
color: #999;
}
.mobile-empty-icon {
font-size: 48px;
margin-bottom: 15px;
color: #ddd;
}
/* 分页 */
.mobile-pagination {
text-align: center;
padding: 20px;
}
.mobile-pagination .mobile-btn {
margin: 0 5px;
min-width: 44px;
}
/* 模态框 */
.mobile-modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 2000;
display: none;
}
.mobile-modal.show {
display: block;
}
.mobile-modal-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: white;
border-radius: 16px 16px 0 0;
padding: 20px;
max-height: 80vh;
overflow-y: auto;
}
.mobile-modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
}
.mobile-modal-title {
font-size: 18px;
font-weight: 500;
margin: 0;
}
.mobile-modal-close {
background: none;
border: none;
font-size: 24px;
color: #999;
cursor: pointer;
}
/* 响应式调整 */
@media (max-width: 480px) {
.mobile-content {
padding: 10px;
}
.mobile-search-form {
padding: 12px;
}
.mobile-task-meta {
grid-template-columns: 1fr;
}
.mobile-bottom-actions {
padding: 12px;
}
}
/* 横屏适配 */
@media (orientation: landscape) and (max-height: 500px) {
.mobile-header {
height: 44px;
}
.mobile-content {
margin-top: 44px;
padding-bottom: 70px;
}
.mobile-bottom-actions {
padding: 10px 15px;
}
}

View File

@ -0,0 +1,79 @@
/**
* 移动端检测工具
*/
var MobileDetect = {
/**
* 检测是否为移动设备
*/
isMobile: function() {
var userAgent = navigator.userAgent.toLowerCase();
console.log('开始移动端检测,用户代理:', userAgent);
var mobileKeywords = [
'android', 'iphone', 'ipod', 'ipad', 'windows phone', 'blackberry',
'bb10', 'opera mini', 'mobile', 'nokia', 'samsung', 'htc', 'lg'
];
// 检查用户代理字符串
for (var i = 0; i < mobileKeywords.length; i++) {
if (userAgent.indexOf(mobileKeywords[i]) !== -1) {
console.log('通过关键词检测到移动设备:', mobileKeywords[i]);
return true;
}
}
// 检查触摸支持
var hasTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
if (hasTouch) {
console.log('通过触摸支持检测到移动设备');
return true;
}
// 检查屏幕宽度
var screenWidth = window.screen ? window.screen.width : window.innerWidth;
if (screenWidth <= 768) {
console.log('通过屏幕宽度检测到移动设备, 宽度:', screenWidth);
return true;
}
console.log('检测结果: 桌面设备');
return false;
},
/**
* 重定向到移动端页面
*/
redirectToMobile: function(mobileUrl) {
if (this.isMobile()) {
// 避免无限重定向
var currentUrl = window.location.href;
if (currentUrl.indexOf(mobileUrl) === -1) {
window.location.href = mobileUrl;
return true;
}
}
return false;
},
/**
* 检测具体设备类型
*/
getDeviceType: function() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('ipad') !== -1) {
return 'tablet';
}
if (userAgent.indexOf('iphone') !== -1 || userAgent.indexOf('ipod') !== -1) {
return 'phone';
}
if (userAgent.indexOf('android') !== -1) {
if (userAgent.indexOf('mobile') !== -1) {
return 'phone';
}
return 'tablet';
}
return this.isMobile() ? 'mobile' : 'desktop';
}
};

View File

@ -51,6 +51,12 @@ public class ReturnMaterialTaskRecordController extends BaseController<ReturnMat
public String show(Model model) {
return "/rm/unFinishWorkList";
}
@RequestMapping("showMobile")
public String showMobile(Model model) {
return "/rm/unFinishWorkList-mobile";
}
@RequestMapping("detail")
public String openFrom(Model model) {
return "/rm/unFinishWorkListDetails";
@ -130,39 +136,80 @@ public class ReturnMaterialTaskRecordController extends BaseController<ReturnMat
//退租单备注修改
@RequestMapping(value = "saveMaterialRequisition", method = RequestMethod.POST)
@ResponseBody
public Map<String , Object> saveMaterialRequisition(ReturnMaterialTaskRecordBean o) {
public Map<String, Object> saveMaterialRequisition(ReturnMaterialTaskRecordBean o) {
Map<String, Object> map = new HashMap<String, Object>();
try {
List<ReturnMaterialTaskRecordBean> beanList = new ArrayList<ReturnMaterialTaskRecordBean>();
String[] remarkMachines = o.getRemarkMachine().split(",");
int res = service.updateRemarkbyTaskId(o); //更新WF_TASK_RECORD 的总备注
int res = service.updateRemarkbyTaskId(o); // 更新WF_TASK_RECORD 的总备注
beanList = service.findIdByTaskId(o);
boolean flag = true;
for(int i = 0;i < beanList.size();i++){
for (int i = 0; i < beanList.size(); i++) {
o.setId(beanList.get(i).getId());
if(remarkMachines.length > 0){
if (remarkMachines.length > 0) {
o.setRemarkMachine(remarkMachines[i]);
}
int res1 = service.updateRemarkMachinebyId(o);
if(res1 != -1){
if (res1 != -1) {
flag = true;
}else{
} else {
flag = false;
}
}
if(flag && res != -1){
if (flag && res != -1) {
map.put("res", "修改成功");
}else{
} else {
map.put("res", "修改失败");
}
} catch (Exception e) {
logger.error(e.toString(), e);
// logger.error(e.toString(), e);
}
return map;
}
// 移动端任务列表接口
@RequestMapping(value = "findUnFinishContentMobile", method = RequestMethod.POST)
@ResponseBody
public AjaxRes findUnFinishContentMobile(@RequestBody Page<TaskRecordBean> page, HttpServletRequest request,
TaskRecordBean o) {
AjaxRes ar = getAjaxRes();
try {
String isFinish = request.getParameter("isFinish");
String userId = UserShiroHelper.getRealCurrentUser().getId() + "";
page.setIsFinish(isFinish);
if (!"1".equals(userId)) {
page.setOperationUserId(userId);
}
// 调用服务获取数据
Page<TaskRecordBean> result = service.findUnFinishContent(page, o);
// 构造移动端响应数据
Map<String, Object> data = new HashMap<String, Object>();
data.put("data", result.getResults());
// 分页信息
Map<String, Object> pagination = new HashMap<String, Object>();
pagination.put("currentPage", result.getPageNum());
pagination.put("totalPages", result.getTotalPage());
pagination.put("totalRecords", result.getTotalRecord());
pagination.put("pageSize", result.getPageSize());
data.put("pagination", pagination);
ar.setSucceed(data);
} catch (Exception e) {
e.printStackTrace();
logger.error(e.toString(), e);
ar.setFailMsg("获取任务列表失败");
}
return ar;
}
// 待办详情
//待办详情
@RequestMapping(value = "findUnFinishContentDetails", method = RequestMethod.POST)
@ResponseBody

View File

@ -0,0 +1,5 @@
package com.bonus.rm.controller;
public class logger {
}