85 lines
3.3 KiB
JavaScript
85 lines
3.3 KiB
JavaScript
let objParam, dataObj;
|
|
let form, table, upload, tableIns, layer;
|
|
let pageNum = 1;
|
|
let checkNowValue = '';
|
|
let checkType = '';
|
|
function setParams(params) {
|
|
objParam = JSON.parse(params);
|
|
$('#titleName').html(objParam.proName);
|
|
$('#code').html(objParam.code);
|
|
layui.use(["form", "table", 'upload', 'layer'], function () {
|
|
form = layui.form;
|
|
table = layui.table;
|
|
upload = layui.upload;
|
|
layer = layui.layer;
|
|
layui.use(["layer", 'element'], function () {
|
|
layer = layui.layer;
|
|
element = layui.element;
|
|
// tab 切换事件
|
|
element.on('tab(demo-filter-tab)', function (data) {
|
|
let value = $(this).attr('value');
|
|
if (value === '1') {
|
|
let src = '../car_demand_plan/child/apply_plan_detail.html';
|
|
if (objParam.code.indexOf('spec-') > -1) {
|
|
src = '../car_demand_plan/child/emerg_internal_car_detail.html';
|
|
}
|
|
$('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam)));
|
|
} else if (value === '2') {
|
|
let src = '../car_demand_plan/child/dispatch_input_detail.html';
|
|
$('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam)));
|
|
}
|
|
});
|
|
});
|
|
isExistData(objParam,1);
|
|
});
|
|
}
|
|
|
|
// 校验是否存在派车批次数据
|
|
function isExistData(obj, type) {
|
|
let flag = true;
|
|
let params = {
|
|
encryptedData: JSON.stringify({
|
|
'planId': obj.planId,
|
|
})
|
|
};
|
|
let url = ''
|
|
if (type === 1) {
|
|
url = dataUrl + 'backstage/supDispatchCar/getAllOutList'; // 详情-派车批次
|
|
}
|
|
ajaxRequest(url, "POST", params, false, function () {
|
|
}, function (result) {
|
|
if (result.code === 200) {
|
|
if (result.data.length === 0 && type === 1) {
|
|
flag = false;
|
|
} else if (result.data.length === 0 && type === 2) {
|
|
flag = false;
|
|
}
|
|
} else {
|
|
}
|
|
}, function (xhr, status, error) {
|
|
errorFn(xhr, status, error)
|
|
}, null);
|
|
let html = '<li value="1">需求计划</li>';
|
|
if (flag) {
|
|
html += '<li value="2">派车详情</li>';
|
|
}
|
|
$('#layui-tab-title').empty().append(html);
|
|
if (objParam.pageType === 1) { // 需求计划详情跳转
|
|
$('#layui-tab-title li').eq(0).addClass('layui-this');
|
|
let src = '../car_demand_plan/child/apply_plan_detail.html';
|
|
if (objParam.code.indexOf('spec-') > -1) {
|
|
src = '../car_demand_plan/child/emerg_internal_car_detail.html';
|
|
}
|
|
$('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam)));
|
|
} else if (objParam.pageType === 2) { // 派车详情跳转
|
|
$('#layui-tab-title li').eq(1).addClass('layui-this');
|
|
let src = '../car_demand_plan/child/dispatch_input_detail.html';
|
|
$('#indexIframe').attr('src', src + '?isPage=1' + '&obj=' + encodeURIComponent(JSON.stringify(objParam)));
|
|
}
|
|
}
|
|
|
|
// 关闭页面
|
|
function closePage(type) {
|
|
let index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe层的索引
|
|
parent.layer.close(index); // 再执行关闭
|
|
} |