|
|
@@ -14,7 +14,10 @@ let isSaving = false;
|
|
|
let projectProperty = [];
|
|
|
let fileDelObj = null;
|
|
|
let curStep = 1; //当前在第几步
|
|
|
-let infoData = null; //建设项目基本信息数据
|
|
|
+let infoData = null; //建设项目基本信息数据 (完整)
|
|
|
+//需要的建设项目基本信息 (根据文件类型,因为需要切换文件类型获取不同的基本信息
|
|
|
+//为了减少请求,infoData获取完整的基本信息数据,needfulInfoData标记当前文件类型所需基本信息数据)
|
|
|
+let needfulInfoData = null;
|
|
|
let featureData = null; //工程特征数据
|
|
|
let projectType = {
|
|
|
folder: 'Folder',
|
|
|
@@ -1627,8 +1630,8 @@ $(document).ready(function() {
|
|
|
if (!validRequiredData($('#projInfoStep'))) {
|
|
|
return;
|
|
|
}
|
|
|
- if (infoData && Array.isArray(infoData)) {
|
|
|
- updateRequiredData($('#projInfoStep'), infoData);
|
|
|
+ if (needfulInfoData && Array.isArray(needfulInfoData)) {
|
|
|
+ updateRequiredData($('#projInfoStep'), needfulInfoData);
|
|
|
}
|
|
|
AddProject();
|
|
|
});
|
|
|
@@ -1662,13 +1665,16 @@ $(document).ready(function() {
|
|
|
let requiredData = null;
|
|
|
if (!infoData) {
|
|
|
try {
|
|
|
+ let fileKind = $('input[name="fileKind"]:checked').val();
|
|
|
infoData = await ajaxPost('/pm/api/getBasicInfo', {user_id: userID});
|
|
|
+ //第一次默认是投标
|
|
|
+ needfulInfoData = getNeedfulBasicInfo(infoData, fileKind);
|
|
|
console.log(infoData);
|
|
|
} catch (err) {
|
|
|
$('#add-project-dialog').modal('hide');
|
|
|
}
|
|
|
}
|
|
|
- requiredData = getRequired([], infoData);
|
|
|
+ requiredData = getRequired([], needfulInfoData);
|
|
|
if (requiredData.length > 0) {
|
|
|
$('#add-proj-next').show();
|
|
|
} else {
|
|
|
@@ -1684,8 +1690,24 @@ $(document).ready(function() {
|
|
|
$('#addProjOk').show();
|
|
|
$('#projInfoStep').show();
|
|
|
$('#project-required-warn').show();
|
|
|
- showRequiredInfo($('#projInfoStep'), infoData);
|
|
|
+ showRequiredInfo($('#projInfoStep'), needfulInfoData);
|
|
|
}
|
|
|
+ //新建建设项目-文件类型选择 (影响到基本信息数据)
|
|
|
+ $('input[name="fileKind"]').click(function () {
|
|
|
+ if (infoData && infoData.length) {
|
|
|
+ let fileKind = $(this).val();
|
|
|
+ needfulInfoData = getNeedfulBasicInfo(infoData, fileKind);
|
|
|
+ }
|
|
|
+ let requiredData = getRequired([], needfulInfoData);
|
|
|
+ if (requiredData.length > 0) {
|
|
|
+ $('#addProjOk').hide();
|
|
|
+ $('#add-proj-next').show();
|
|
|
+ } else {
|
|
|
+ $('#projInfoStep').empty();
|
|
|
+ $('#add-proj-next').hide();
|
|
|
+ $('#addProjOk').show();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
//新建建设项目、新建单项工程、新建文件夹、重命名弹窗隐藏事件
|
|
|
function bindModalsHidden(projDialog, engDialog, folderDialog, renameDialog){
|
|
|
@@ -1698,6 +1720,9 @@ $(document).ready(function() {
|
|
|
});
|
|
|
projDialog.on('show.bs.modal', function () {
|
|
|
infoData = null;
|
|
|
+ needfulInfoData = null;
|
|
|
+ $('#add-proj-prev').hide();
|
|
|
+ $('#add-proj-next').hide();
|
|
|
showProjFirstStep();
|
|
|
});
|
|
|
engDialog.on('hidden.bs.modal', function () {
|
|
|
@@ -1895,6 +1920,7 @@ $(document).ready(function() {
|
|
|
//clear info
|
|
|
curStep = 1; //当前在第几步
|
|
|
infoData = null; //建设项目基本信息数据
|
|
|
+ needfulInfoData = null;
|
|
|
featureData = null; //工程特征数据
|
|
|
$('#poj-name-info').hide();
|
|
|
$('#eng-name-info').hide();
|
|
|
@@ -1927,6 +1953,14 @@ $(document).ready(function() {
|
|
|
$('#tender-name')[0].focus();
|
|
|
}, 300);
|
|
|
});
|
|
|
+ //新建单位工程-文件类型选择变换(影响到基本信息数据)
|
|
|
+ $('input[name="fileKind-tender"]').click(function () {
|
|
|
+ if (infoData && infoData.length) {
|
|
|
+ let fileKind = $(this).val();
|
|
|
+ needfulInfoData = getNeedfulBasicInfo(infoData, fileKind);
|
|
|
+ $('#infoStep').empty(); //清空设置的基本信息必填数据
|
|
|
+ }
|
|
|
+ });
|
|
|
//新建单位工程-下一步
|
|
|
$('#add-tender-next').click(async function() {
|
|
|
if (curStep === 1) {
|
|
|
@@ -1979,7 +2013,7 @@ $(document).ready(function() {
|
|
|
return false;
|
|
|
}
|
|
|
let path = getAddPath();
|
|
|
- let infoRequired = getRequired([], infoData);
|
|
|
+ let infoRequired = getRequired([], needfulInfoData);
|
|
|
let featureRequired = getRequired([], featureData);
|
|
|
if (path === addPath.p_e_t && infoRequired.length > 0) {
|
|
|
showInfoStep();
|
|
|
@@ -2036,7 +2070,9 @@ $(document).ready(function() {
|
|
|
$('#add-tender-cancel').show();
|
|
|
if (!infoData) {
|
|
|
try {
|
|
|
+ let fileKind = $('input[name="fileKind-tender"]:checked').val();
|
|
|
infoData = await ajaxPost('/pm/api/getBasicInfo', {user_id: userID});
|
|
|
+ needfulInfoData = getNeedfulBasicInfo(infoData, fileKind);
|
|
|
} catch (err) {
|
|
|
$('#add-tender-dialog').modal('hide');
|
|
|
}
|
|
|
@@ -2052,7 +2088,7 @@ $(document).ready(function() {
|
|
|
$('#add-tender-dialog').modal('hide');
|
|
|
}
|
|
|
}
|
|
|
- let infoRequired = getRequired([], infoData),
|
|
|
+ let infoRequired = getRequired([], needfulInfoData),
|
|
|
featureRequired = getRequired([], featureData),
|
|
|
path = getAddPath();
|
|
|
if (path === addPath.p_e_t && infoRequired.length > 0 || featureRequired.length > 0) {
|
|
|
@@ -2075,7 +2111,7 @@ $(document).ready(function() {
|
|
|
$('#add-tender-next').hide();
|
|
|
$('#add-tender-confirm').show();
|
|
|
}
|
|
|
- showRequiredInfo($('#infoStep'), infoData);
|
|
|
+ showRequiredInfo($('#infoStep'), needfulInfoData);
|
|
|
}
|
|
|
//显示新建单位工程-工厂特征内容
|
|
|
function showFeatureStep() {
|
|
|
@@ -2175,8 +2211,8 @@ $(document).ready(function() {
|
|
|
if (!validRequiredData($('#featureStep'))) {
|
|
|
return;
|
|
|
}
|
|
|
- if (infoData && Array.isArray(infoData)) {
|
|
|
- updateRequiredData($('#infoStep'), infoData);
|
|
|
+ if (needfulInfoData && Array.isArray(needfulInfoData)) {
|
|
|
+ updateRequiredData($('#infoStep'), needfulInfoData);
|
|
|
}
|
|
|
if (featureData && Array.isArray(featureData)) {
|
|
|
updateRequiredData($('#featureStep'), featureData);
|
|
|
@@ -2421,6 +2457,22 @@ function changeFeeRate(engLib) {
|
|
|
$("#tender-fee-rate").children("option").first().val($('#tender-name').val());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+//根据文件类型筛选新的基本信息数据
|
|
|
+function getNeedfulBasicInfo(info, fileKind) {
|
|
|
+ let strMap = {
|
|
|
+ 1: 'tender', //投标
|
|
|
+ 2: 'bid', //招标
|
|
|
+ 3: 'control' //控制价
|
|
|
+ };
|
|
|
+ let needfulData = info.filter(data => !data.fileKind || data.fileKind === strMap[fileKind]);
|
|
|
+ needfulData.forEach(nData => {
|
|
|
+ let needfulSub = nData.items.filter(sData => !sData.fileKind || sData.fileKind === strMap[fileKind]);
|
|
|
+ nData.items = needfulSub;
|
|
|
+ });
|
|
|
+ return needfulData;
|
|
|
+}
|
|
|
+
|
|
|
function getRequired(rst, datas) {
|
|
|
if (!datas) {
|
|
|
return rst;
|
|
|
@@ -2444,7 +2496,12 @@ async function changeFeature() {
|
|
|
let feeName = $('#tender-feeStandard').val();
|
|
|
featureData = await ajaxPost('/pm/api/getProjectFeature',
|
|
|
{user_id: userID, valuationID: valuation, engineeringName: engineeringName, feeName: feeName});
|
|
|
- let infoRequired = getRequired([], infoData),
|
|
|
+ updateAddState(needfulInfoData, featureData);
|
|
|
+}
|
|
|
+
|
|
|
+//更新当前新建单位工程是否需要下一步
|
|
|
+function updateAddState(needfulInfoData, featureData) {
|
|
|
+ let infoRequired = getRequired([], needfulInfoData),
|
|
|
featureRequired = getRequired([], featureData),
|
|
|
path = getAddPath();
|
|
|
if (path === addPath.p_e_t && infoRequired.length > 0 || featureRequired.length > 0) {
|
|
|
@@ -2543,31 +2600,6 @@ function getWorkBookWidth(){
|
|
|
return workBookWidth = $(window).width() - $('.pm-side').width() - 90;
|
|
|
}
|
|
|
|
|
|
-/*function prepareInitialTimer(title, content) {
|
|
|
- $('#progress .modal-title').text(title);
|
|
|
- $('#progress .modal-body h5').text(content);
|
|
|
- $('#progressBar').css('width', `0%`);
|
|
|
- let outer = setInterval(function () {
|
|
|
- let curWidth = parseInt($('#progressBar')[0].style.width.replace('%', ''));
|
|
|
- curWidth = parseInt(curWidth + 2);
|
|
|
- $('#progressBar').css('width', `${curWidth}%`);
|
|
|
- if (curWidth >= 80) {
|
|
|
- clearInterval(outer);
|
|
|
- }
|
|
|
- }, 100);
|
|
|
- let inner = setInterval(function () {
|
|
|
- let curWidth = parseFloat($('#progressBar')[0].style.width.replace('%', ''));
|
|
|
- if (curWidth >= 80) {
|
|
|
- curWidth = parseFloat(curWidth + 0.1);
|
|
|
- $('#progressBar').css('width', `${curWidth}%`);
|
|
|
- if (curWidth >= 95) {
|
|
|
- clearInterval(inner);
|
|
|
- }
|
|
|
- }
|
|
|
- }, 500);
|
|
|
- return {outer, inner};
|
|
|
-}*/
|
|
|
-
|
|
|
function initProjects(callback) {
|
|
|
GetAllProjectData(function (datas) {
|
|
|
//设置工程专业
|
|
|
@@ -2678,7 +2710,7 @@ function AddProject() {
|
|
|
(3)、当前定位在建设项目,新建建设项目为其后兄弟。
|
|
|
(4)、当前定位在单项工程或单位工程,新建项目为当前所属建设项目的后兄弟。
|
|
|
* */
|
|
|
- let property = {basicInformation: infoData ? infoData : [],
|
|
|
+ let property = {basicInformation: needfulInfoData ? needfulInfoData : [],
|
|
|
fileKind: fileKind,
|
|
|
taxType: taxType,
|
|
|
valuation: valuation,
|
|
|
@@ -2795,7 +2827,7 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
|
|
|
}
|
|
|
let fileKind = $('input[name="fileKind-tender"]:checked').val();
|
|
|
let updateProjs = GetUpdateData(pre, parent, next, projName, {
|
|
|
- basicInformation: infoData ? infoData : [],
|
|
|
+ basicInformation: needfulInfoData ? needfulInfoData : [],
|
|
|
fileKind: parseInt(fileKind), taxType: curTaxType, valuationType: curValutionType, valuation: curValuation, valuationName: curValuationName},
|
|
|
projID, {updateType: 'new', projectType: projectType.project});
|
|
|
let updateEng = {updateType: 'new', updateData: {ID: engID, ParentID: projID, NextSiblingID: -1, name: engName, projType: projectType.engineering}};
|