|
@@ -26,6 +26,8 @@
|
|
|
<a class="dropdown-item" href="javascript:void(0);" data-type="change_project">变更立项</a>
|
|
|
<a class="dropdown-item" href="javascript:void(0);" data-type="change_apply">变更申请</a>
|
|
|
<a class="dropdown-item" href="javascript:void(0);" data-type="change_plan">变更方案</a>
|
|
|
+ <a class="dropdown-item" href="javascript:void(0);" data-type="advance">预付款</a>
|
|
|
+ <a class="dropdown-item" href="javascript:void(0);" data-type="material">材料调差</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -71,7 +73,7 @@
|
|
|
padding: 0.175rem 0.5rem;
|
|
|
}
|
|
|
</style>
|
|
|
- <div id="divSelectableChanges" class="" style="display: none;">
|
|
|
+ <div id="divSelectableChanges" class="" style="display: none;min-width: 90px;">
|
|
|
<select id="optionSelectableChanges" class="form-control form-control-sm"></select>
|
|
|
</div>
|
|
|
<!-- <div class="dropdown" id="divSelectableChanges" style="display: none">-->
|
|
@@ -79,6 +81,28 @@
|
|
|
<!-- <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableChanges"></div>-->
|
|
|
<!-- </div>-->
|
|
|
</div>
|
|
|
+ <div class="d-inline-block">
|
|
|
+ <div class="dropdown" style="display: none" id="divSelectableAdvances">
|
|
|
+ <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentAdvance" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><%- advanceConst.typeCol[0].name %></button>
|
|
|
+ <div class="dropdown-menu" aria-labelledby="allPrepayButton" id="optionSelectableAdvances">
|
|
|
+ <% for (const type of advanceConst.typeCol) { %>
|
|
|
+ <a class="dropdown-item" href="javascript:void(0);" data-type="<%- type.key %>" <% if (type.value === 0) { %>style="display: none"<% } %>><%- type.name %></a>
|
|
|
+ <% } %>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="d-inline-block">
|
|
|
+ <div class="dropdown" id="divSelectableAdvancePays" style="display:none;">
|
|
|
+ <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentAdvancePay" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
|
|
+ <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableAdvancePays"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="d-inline-block">
|
|
|
+ <div class="dropdown" id="divSelectableMaterials" style="display:none;">
|
|
|
+ <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="btnCurrentMaterial" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
|
|
+ <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" id="optionSelectableMaterials"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<% if (ctx.session.sessionUser.accountId === ctx.tender.data.user_id) { %>
|
|
|
<div class="d-inline-block">
|
|
|
<button id="file-msg" class="btn btn-sm btn-primary" type="button" onclick="sendReportFileMsg();" <% if (!needFileMsg.stage.valid) { %>style="display: none;"<% } %>>同步档案系统</button>
|
|
@@ -246,6 +270,11 @@
|
|
|
let business_type = 'stage';
|
|
|
let CHANGE_LIST = [], current_change_id = -1, current_change_code = '';
|
|
|
let CHANGE_ID = -1, BUSINESS_ID = -1;
|
|
|
+ let current_advance_id = -1; // 预付款期id
|
|
|
+ let current_material_id = -1; // 材差期id
|
|
|
+ let current_material_order = -1; // 材差期order
|
|
|
+ let ADVANCE_LIST = [];
|
|
|
+ let MATERIAL_LIST = [];
|
|
|
|
|
|
const FOLDER_SEPERATER = '->';
|
|
|
|
|
@@ -397,6 +426,44 @@
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
+ function buildAdvancePaySelection(adList) {
|
|
|
+ $("#optionSelectableAdvancePays").empty();
|
|
|
+ $("#btnCurrentAdvancePay")[0].innerText = '';
|
|
|
+ let hasMatch = false;
|
|
|
+ if (current_advance_id !== -1) {}
|
|
|
+ for (const advance of adList) {
|
|
|
+ if (current_advance_id === advance.id) {
|
|
|
+ hasMatch = true; // 预付款有好几种类型,需要考虑不同类型的转换检测
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ adList.forEach((advance, adIndex) => {
|
|
|
+ let dispStr = '';
|
|
|
+ if (!hasMatch && adIndex === 0 || current_advance_id === advance.id) {
|
|
|
+ current_advance_id = advance.id;
|
|
|
+ $("#btnCurrentAdvancePay")[0].innerText = `第${adIndex + 1}期`;
|
|
|
+ dispStr = ';display:none';
|
|
|
+ }
|
|
|
+ const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentAdvance(this)" advance_id = "${advance.id}">第${adIndex + 1}期</a>`;
|
|
|
+ $("#optionSelectableAdvancePays").append(str);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function buildMaterialSelection() {
|
|
|
+ $("#optionSelectableMaterials").empty();
|
|
|
+ $("#btnCurrentMaterial")[0].innerText = '';
|
|
|
+ MATERIAL_LIST.forEach((materialAdj, maIndex) => {
|
|
|
+ let dispStr = '';
|
|
|
+ if (current_material_id === -1 && maIndex === 0 || current_material_id === materialAdj.id) {
|
|
|
+ current_material_id = materialAdj.id;
|
|
|
+ $("#btnCurrentMaterial")[0].innerText = `第${materialAdj.order}期`;
|
|
|
+ dispStr = ';display:none';
|
|
|
+ }
|
|
|
+ const str = `<a class="dropdown-item" style="cursor:pointer${dispStr}" onclick="changeCurrentMaterial(this)" material_id = "${materialAdj.id}">第${materialAdj.order}期</a>`;
|
|
|
+ $("#optionSelectableMaterials").append(str);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function changeCurrentStage(ele) {
|
|
|
// alert('you are selecting: ' + ele.innerText);
|
|
|
current_stage_order = parseInt(ele.attributes.stg_order.value);
|
|
@@ -461,6 +528,33 @@
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ function changeCurrentMaterial(ele) {
|
|
|
+ $('#optionSelectableMaterials a').show();
|
|
|
+ $(ele).hide();
|
|
|
+ current_material_id = +ele.attributes[3].value;
|
|
|
+ $('#optionSelectableMaterials').siblings('button').text($(ele).text());
|
|
|
+ // BUSINESS_ID = material_id;
|
|
|
+ buildMaterialSelection();
|
|
|
+ //还有必要触发归档报表刷新!
|
|
|
+ //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
|
|
|
+ const params = {tenderId: TENDER_ID, business_type, bzId: current_material_id};
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ CommonAjax.postXsrfEx("/tender/report_api/getReportArchive4bz", params, 10000, true, getCookie('csrfToken_j'),
|
|
|
+ function(result){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ ARCHIVE_LIST = result.data;
|
|
|
+ ARCHIVE_ENCRYPTION_LIST = result.encryptionData;
|
|
|
+ TOP_TREE_NODES = JSON.parse(JSON.stringify(result.rpt_tpl_data));
|
|
|
+ buildTplTree();
|
|
|
+ rptArchiveObj.iniPage();
|
|
|
+ }, function(err){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, function(ex){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
function sendReportFileMsg() {
|
|
|
if (!needFileMsg[business_type] || !needFileMsg[business_type].valid) return;
|
|
@@ -538,6 +632,27 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ function advancePayClick(ele = null) {
|
|
|
+ $('#optionSelectableAdvances a').show();
|
|
|
+ const thisEle = ele === null ? this : ele;
|
|
|
+ $(thisEle).hide();
|
|
|
+ $('#optionSelectableAdvances').siblings('button').text($(thisEle).text());
|
|
|
+ const type = $(thisEle).data('type');
|
|
|
+ const typeStr = ['start', 'material', 'safe', 'dust'];
|
|
|
+ const tIdx = typeStr.indexOf(type)
|
|
|
+ const adList = [];
|
|
|
+ ADVANCE_LIST.forEach(advance => {
|
|
|
+ if (advance.type === tIdx) {
|
|
|
+ adList.push(advance);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ buildAdvancePaySelection(adList);
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#optionSelectableAdvances a').on('click', function (){
|
|
|
+ advancePayClick(this);
|
|
|
+ });
|
|
|
+
|
|
|
$('#select-item a').on('click', function () {
|
|
|
$('#select-item a').show();
|
|
|
$(this).hide();
|
|
@@ -549,6 +664,9 @@
|
|
|
if (type === 'stage') {
|
|
|
$('#divSelectableStages').show();
|
|
|
$('#divSelectableChanges').hide();
|
|
|
+ $('#divSelectableAdvances').hide();
|
|
|
+ $('#divSelectableAdvancePays').hide();
|
|
|
+ $('#divSelectableMaterials').hide();
|
|
|
// const info = _.find(STAGE_LIST, { order: current_stage_order });
|
|
|
for (let i = STAGE_LIST.length; i > 0; i--) {
|
|
|
if (parseInt(STAGE_LIST[i - 1].status) === 3) {
|
|
@@ -580,9 +698,12 @@
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
);
|
|
|
- } else {
|
|
|
+ } else if (_.indexOf(type, 'change') !== -1) {
|
|
|
$('#divSelectableStages').hide();
|
|
|
+ $('#divSelectableAdvances').hide();
|
|
|
+ $('#divSelectableAdvancePays').hide();
|
|
|
$('#divSelectableChanges').show();
|
|
|
+ $('#divSelectableMaterials').hide();
|
|
|
// 下列树结构重新加载
|
|
|
//rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
|
|
|
const params = {tenderId: TENDER_ID, business_type: type};
|
|
@@ -613,6 +734,74 @@
|
|
|
$.bootstrapLoading.end();
|
|
|
}
|
|
|
);
|
|
|
+ } else if (type === 'advance') {
|
|
|
+ $('#divSelectableStages').hide();
|
|
|
+ $('#divSelectableChanges').hide();
|
|
|
+ $('#divSelectableAdvances').show();
|
|
|
+ $('#divSelectableAdvancePays').show();
|
|
|
+ $('#divSelectableMaterials').hide();
|
|
|
+ // 下列树结构重新加载
|
|
|
+ //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
|
|
|
+ const params = {tenderId: TENDER_ID, business_type: type};
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ // ARCHIVE_LIST = [];
|
|
|
+ // ARCHIVE_ENCRYPTION_LIST = [];
|
|
|
+ // TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
|
|
|
+ // rptArchiveObj.iniPage();
|
|
|
+ CommonAjax.postXsrfEx("/tender/report_api/getReportArchive4bz", params, 10000, true, getCookie('csrfToken_j'),
|
|
|
+ function(result){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ // console.log(result);
|
|
|
+ ARCHIVE_LIST = result.data;
|
|
|
+ ARCHIVE_ENCRYPTION_LIST = result.encryptionData;
|
|
|
+ ADVANCE_LIST = result.changes;
|
|
|
+ current_advance_id = ADVANCE_LIST.length > 0 ? ADVANCE_LIST[0].id : -1;
|
|
|
+ TOP_TREE_NODES = JSON.parse(JSON.stringify(result.rpt_tpl_data));
|
|
|
+ BUSINESS_ID = ADVANCE_LIST.length > 0 ? ADVANCE_LIST[0].id : -1;
|
|
|
+ advancePayClick( $('#optionSelectableAdvances a')[0]);
|
|
|
+ buildTplTree();
|
|
|
+ rptArchiveObj.iniPage();
|
|
|
+ current_stage_id = result.stgId;
|
|
|
+ }, function(err){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, function(ex){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else if (type === 'material') {
|
|
|
+ $('#divSelectableStages').hide();
|
|
|
+ $('#divSelectableChanges').hide();
|
|
|
+ $('#divSelectableAdvances').hide();
|
|
|
+ $('#divSelectableAdvancePays').hide();
|
|
|
+ $('#divSelectableMaterials').show();
|
|
|
+ // 下列树结构重新加载
|
|
|
+ //rptArchiveObj.onClick(null, null, rptArchiveObj.currentNode);
|
|
|
+ const params = {tenderId: TENDER_ID, business_type: type};
|
|
|
+ $.bootstrapLoading.start();
|
|
|
+ // ARCHIVE_LIST = [];
|
|
|
+ // ARCHIVE_ENCRYPTION_LIST = [];
|
|
|
+ // TOP_TREE_NODES = JSON.parse(JSON.stringify(ORG_TOP_TREE_NODES));
|
|
|
+ // rptArchiveObj.iniPage();
|
|
|
+ CommonAjax.postXsrfEx("/tender/report_api/getReportArchive4bz", params, 10000, true, getCookie('csrfToken_j'),
|
|
|
+ function(result){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ // console.log(result);
|
|
|
+ ARCHIVE_LIST = result.data;
|
|
|
+ ARCHIVE_ENCRYPTION_LIST = result.encryptionData;
|
|
|
+ MATERIAL_LIST = result.changes;
|
|
|
+ current_material_id = MATERIAL_LIST.length > 0 ? MATERIAL_LIST[0].id : -1;
|
|
|
+ TOP_TREE_NODES = JSON.parse(JSON.stringify(result.rpt_tpl_data));
|
|
|
+ // BUSINESS_ID = MATERIAL_LIST.length > 0 ? MATERIAL_LIST[0].id : -1;
|
|
|
+ buildMaterialSelection();
|
|
|
+ buildTplTree();
|
|
|
+ rptArchiveObj.iniPage();
|
|
|
+ current_stage_id = result.stgId;
|
|
|
+ }, function(err){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }, function(ex){
|
|
|
+ $.bootstrapLoading.end();
|
|
|
+ }
|
|
|
+ );
|
|
|
}
|
|
|
if (needFileMsg[type] && needFileMsg[type].valid) {
|
|
|
$('#file-msg').show();
|