车辆app详情弹框
This commit is contained in:
parent
175249cba1
commit
03c237e6d9
|
|
@ -542,8 +542,9 @@
|
|||
var taskKey = task.checkerId + '_' + (task.processName || '');
|
||||
var isChecked = selectedTasks.has(taskKey) ? 'checked' : '';
|
||||
var canCheck = $('#taskStatus').val() === '0' ? '' : 'disabled';
|
||||
|
||||
html += '<div class="task-card">';
|
||||
// 判断是否是派车计划,拼接点击事件属性
|
||||
var clickEvent = 'onclick="viewTaskDetail(\'' + task.id + '\', \'' + (task.processName || '') + '\', \'' + task.isFinish + '\' )"';
|
||||
html += '<div class="task-card" ' + clickEvent + '>';
|
||||
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>';
|
||||
|
|
@ -580,65 +581,51 @@
|
|||
}
|
||||
|
||||
// 查看任务详情(页面跳转)
|
||||
function viewTaskDetail(id, processName) {
|
||||
function viewTaskDetail(id, processName, isFinish) {
|
||||
var uname = localStorage.getItem("uname");
|
||||
var pwd = localStorage.getItem("pwd");
|
||||
|
||||
|
||||
if (!uname || !pwd) {
|
||||
showAlert('未找到用户凭证,请重新登录');
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置导航标志,防止页面可见性检测干扰
|
||||
isNavigatingToDetail = true;
|
||||
|
||||
showLoading();
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: CAR_IP+"/login/userLogin",
|
||||
url: CAR_IP + "/login/userLogin",
|
||||
data: {
|
||||
username: uname,
|
||||
password: pwd
|
||||
},
|
||||
success: function(data) {
|
||||
success: function (data) {
|
||||
hideLoading();
|
||||
|
||||
|
||||
if (data.code == "200") {
|
||||
localStorage.setItem("token", data.token);
|
||||
|
||||
// 根据流程类型跳转到对应页面
|
||||
|
||||
var targetUrl = "";
|
||||
if (processName === '派车计划') {
|
||||
targetUrl = CAR_HTML_IP+ "page/car_demand_plan/child/dispatch_car_detail.html?id=" + id + "&token=" + data.token;
|
||||
targetUrl = CAR_HTML_IP + "page/car_demand_plan/child/dispatch_car_detail.html?id=" + id + "&isFinish=" + isFinish;
|
||||
} else if (processName === '用车计划') {
|
||||
targetUrl =CAR_HTML_IP+ "page/car_demand_plan/child/apply_plan_detail.html?id=" + id + "&token=" + data.token;
|
||||
targetUrl = CAR_HTML_IP + "page/car_demand_plan/child/apply_plan_detail.html?id=" + id + "&isFinish=" + isFinish;
|
||||
} else {
|
||||
isNavigatingToDetail = false; // 重置标志
|
||||
showAlert('暂不支持该类型任务的详情查看: ' + processName);
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用 window.open 打开新窗口,避免影响当前页面
|
||||
try {
|
||||
var newWindow = window.open(targetUrl, '_blank');
|
||||
// 检查新窗口是否成功打开
|
||||
if (!newWindow || newWindow.closed || typeof newWindow.closed == 'undefined') {
|
||||
// 如果弹窗被阻止,尝试在当前窗口打开
|
||||
window.location.href = targetUrl;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('打开详情页面失败:', e);
|
||||
isNavigatingToDetail = false;
|
||||
showAlert('打开详情页面失败,请稍后重试');
|
||||
}
|
||||
|
||||
// ✅ App + PC 通用跳转方式
|
||||
setTimeout(function () {
|
||||
window.location.href = targetUrl;
|
||||
}, 100);
|
||||
|
||||
} else {
|
||||
isNavigatingToDetail = false; // 重置标志
|
||||
showAlert("没有权限!");
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
error: function (XMLHttpRequest) {
|
||||
hideLoading();
|
||||
isNavigatingToDetail = false; // 重置标志
|
||||
showAlert("未连接到服务器,请检查网络!状态码:" + XMLHttpRequest.status);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue