|
@@ -158,6 +158,49 @@ const rptCustomObj = (function () {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+ // 变更令选择
|
|
|
+ const sChangeSelect = 'change_select';
|
|
|
+ const changeObj = {
|
|
|
+ changes: null,
|
|
|
+ latestPush: null,
|
|
|
+ loadChanges: async function () {
|
|
|
+ const self = this;
|
|
|
+ const result = await postDataAsync(`/tender/${window.location.pathname.split('/')[2]}/load`, { filter: 'change'});
|
|
|
+ this.changes = result.change;
|
|
|
+ const html = [];
|
|
|
+ for (const c of this.changes) {
|
|
|
+ html.push('<tr>', `<td class="text-center"><input type="checkbox" name="change-select-check" value="${c.cid}"></td>`, `<td>${c.code}</td>`, `<td>${c.name}</td>`, '</tr>');
|
|
|
+ }
|
|
|
+ $('#change-select-list').html(html.join(''));
|
|
|
+ $('[name=change-select-check]').click(function () {
|
|
|
+ const selectChange = $('[name=change-select-check]:checked');
|
|
|
+ const selectHtml = [];
|
|
|
+ for (const sc of selectChange) {
|
|
|
+ const c = self.changes.find(x => { return x.cid === sc.value });
|
|
|
+ selectHtml.push(`<tr><td class="text-center">${selectHtml.length + 1}</td><td>${c.code}</td><td>${c.name}</td></tr>`);
|
|
|
+ }
|
|
|
+ $('#change-select-result').html(selectHtml.join(''));
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ show: async function (title, resolve) {
|
|
|
+ this.latestPush = null;
|
|
|
+ $('#change-select-title').html(title);
|
|
|
+ if (!this.changes) {
|
|
|
+ await this.loadChanges();
|
|
|
+ }
|
|
|
+ if (resolve) {
|
|
|
+ setTimeout(() => { $("#change-select").modal('show'); }, 1000);
|
|
|
+ } else {
|
|
|
+ $('#change-select').modal('show');
|
|
|
+ }
|
|
|
+ $('#change-select-ok').unbind('click');
|
|
|
+ $('#change-select-ok').bind('click', () => {
|
|
|
+ rptCustomObj.resetChangeSelect(resolve);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const getStageFlowSelectHtml = function (select, id) {
|
|
|
const html = [];
|
|
|
html.push('<select style="width: 80%" id="' + id + '" sf-title="' + select.title + '">');
|
|
@@ -306,6 +349,9 @@ const rptCustomObj = (function () {
|
|
|
// $("#stage-select").modal('hide');
|
|
|
});
|
|
|
};
|
|
|
+ const initChangeSelect = function (gsSetting, rptName, resolve = null) {
|
|
|
+ changeObj.show('选择工程变更' + (rptName ? '-' + rptName : ''), resolve);
|
|
|
+ };
|
|
|
const init = function (cDefine, sfData, cSelect, rptName, resolve = null) {
|
|
|
stageFlow = sfData;
|
|
|
if (cDefine && cDefine[sAuditSelect] && cDefine[sAuditSelect].enable && cDefine[sAuditSelect].setting) {
|
|
@@ -327,6 +373,9 @@ const rptCustomObj = (function () {
|
|
|
} else {
|
|
|
$('#pnl_stage_select').hide();
|
|
|
}
|
|
|
+ if (cDefine && cDefine[sChangeSelect] && cDefine[sChangeSelect].enable) {
|
|
|
+ initChangeSelect(cDefine[sChangeSelect].setting, rptName, resolve);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const reloadReportData = function (result) {
|
|
@@ -565,6 +614,32 @@ const rptCustomObj = (function () {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const resetChangeSelect = function (resolve = null) {
|
|
|
+ const data = {}, hintObj = $('#change-select-hint');
|
|
|
+ if (!resolve) getCommonParams(data);
|
|
|
+ data[sChangeSelect] = [];
|
|
|
+ for (const sc of $('[name=change-select-check]:checked')) {
|
|
|
+ data[sChangeSelect].push(sc.value);
|
|
|
+ }
|
|
|
+ if (data[sChangeSelect].length === 0) {
|
|
|
+ hintObj.html('请至少选择一条变更令').show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (resolve) {
|
|
|
+ resolve(data);
|
|
|
+ } else {
|
|
|
+ postData('/report/cDefine', data, function (result) {
|
|
|
+ changeObj.latestSelect = data[sChangeSelect];
|
|
|
+ reloadReportData(result);
|
|
|
+ $('#change-select').modal('hide');
|
|
|
+ rptArchiveObj.toggleBtn(true);
|
|
|
+ if (PAGE_SHOW.showArchive) {
|
|
|
+ rptArchiveObj.showArchivedItem(zTreeOprObj.currentNode);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const _createTenderTreeForCross = function (tenders, category, rstItems) {
|
|
|
if (rstItems instanceof Array && rstItems.length === 0) {
|
|
|
//1. 先确定category方式(‘年份’、‘姓名’、‘类型’)及顺序
|
|
@@ -730,6 +805,9 @@ const rptCustomObj = (function () {
|
|
|
const stage_select = customSelects.stage_select.find(function (x) {
|
|
|
return x.id === rptId;
|
|
|
});
|
|
|
+ const change_select = customSelects.change_select.find(function (x) {
|
|
|
+ return x.id === rptId;
|
|
|
+ });
|
|
|
if (gather_select && gather_select.custom_define && gather_select.custom_define[sGatherSelect].enable) {
|
|
|
if (rptId === currentRptId) {
|
|
|
const data = {};
|
|
@@ -737,7 +815,7 @@ const rptCustomObj = (function () {
|
|
|
params.customSelect.push(data);
|
|
|
} else {
|
|
|
const chkNode = chkNodes.find(function (x) { return x.refId === rptId});
|
|
|
- const select = await comfirmSelectPromise(chkNode ? chkNode.name : '', gather_select)
|
|
|
+ const select = await comfirmSelectPromise(chkNode ? chkNode.name : '', gather_select);
|
|
|
params.customSelect.push(select);
|
|
|
$('#gather-select').modal('hide');
|
|
|
}
|
|
@@ -752,6 +830,17 @@ const rptCustomObj = (function () {
|
|
|
params.customSelect.push(select);
|
|
|
$('#stage-select').modal('hide');
|
|
|
}
|
|
|
+ } else if (change_select && change_select.custom_define && change_select.custom_define[sChangeSelect].enable ) {
|
|
|
+ if (rptId === currentRptId && changeObj.latestPush) {
|
|
|
+ const data = {};
|
|
|
+ data[sChangeSelect] = changeObj.latestSelect;
|
|
|
+ params.customSelect.push(data);
|
|
|
+ } else {
|
|
|
+ const chkNode = chkNodes.find(function (x) { return x.refId === rptId});
|
|
|
+ const select = await comfirmSelectPromise(chkNode ? chkNode.name : '', change_select);
|
|
|
+ params.customSelect.push(select);
|
|
|
+ $('#change-select').modal('hide');
|
|
|
+ }
|
|
|
} else {
|
|
|
params.customSelect.push(null);
|
|
|
}
|
|
@@ -815,7 +904,7 @@ const rptCustomObj = (function () {
|
|
|
|
|
|
return {
|
|
|
init,
|
|
|
- resetAuditSelect, resetGatherSelect, resetStageSelect,
|
|
|
+ resetAuditSelect, resetGatherSelect, resetStageSelect, resetChangeSelect,
|
|
|
initTenderTree,
|
|
|
initTenderTreeForCross,
|
|
|
getCustomSelect,
|