|
@@ -158,6 +158,9 @@ const rptCustomObj = (function () {
|
|
|
},
|
|
|
};
|
|
|
|
|
|
+ // 材差 - 期选择
|
|
|
+ const sMaterialSumSelect = 'material_sum_select';
|
|
|
+
|
|
|
// 变更令选择
|
|
|
const sChangeSelect = 'change_select';
|
|
|
const changeObj = {
|
|
@@ -364,6 +367,32 @@ const rptCustomObj = (function () {
|
|
|
const initChangeSelect = function (gsSetting, rptName, resolve = null) {
|
|
|
changeObj.show('选择工程变更' + (rptName ? '-' + rptName : ''), resolve);
|
|
|
};
|
|
|
+ const initMaterialSumSelect = function (gsSetting, gsSelect, rptName, resolve = null) {
|
|
|
+ const setting = JSON.parse(gsSetting);
|
|
|
+ $('#material-sum-select-count').html(gsSelect && gsSelect.materials ? gsSelect.materials.length : 0);
|
|
|
+ $('#material-sum-select-title').html((setting.title || '请选择材差期') + (rptName ? '-' + rptName : ''));
|
|
|
+ // 初始化选择结果
|
|
|
+ $('#material-sum-select-hint').attr('min-select', setting.min).attr('max-select', setting.max).hide();
|
|
|
+ for (const sc of $('[name=material-sum-select-check]')) {
|
|
|
+ sc.checked = false;
|
|
|
+ }
|
|
|
+ if (gsSelect && gsSelect.materials) {
|
|
|
+ for (const s of gsSelect.materials) {
|
|
|
+ $('#material-sum-select-' + s)[0].checked = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (resolve) {
|
|
|
+ setTimeout(() => { $("#material-sum-select").modal('show'); }, 1000);
|
|
|
+ } else {
|
|
|
+ $("#material-sum-select").modal('show');
|
|
|
+ }
|
|
|
+
|
|
|
+ $('#material-sum-select-ok').unbind('click');
|
|
|
+ $('#material-sum-select-ok').bind('click', () => {
|
|
|
+ rptCustomObj.resetMaterialSumSelect(resolve);
|
|
|
+ // $("#stage-select").modal('hide');
|
|
|
+ });
|
|
|
+ };
|
|
|
const init = function (cDefine, sfData, cSelect, rptName, resolve = null) {
|
|
|
stageFlow = sfData;
|
|
|
if (cDefine && cDefine[sAuditSelect] && cDefine[sAuditSelect].enable && cDefine[sAuditSelect].setting) {
|
|
@@ -385,6 +414,12 @@ const rptCustomObj = (function () {
|
|
|
} else {
|
|
|
$('#pnl_stage_select').hide();
|
|
|
}
|
|
|
+ if (cDefine && cDefine[sMaterialSumSelect] && cDefine[sMaterialSumSelect].enable && cDefine[sMaterialSumSelect].setting) {
|
|
|
+ $('#pnl_material_sum_select').show();
|
|
|
+ initMaterialSumSelect(cDefine[sMaterialSumSelect].setting, cSelect ? cSelect[sMaterialSumSelect] : null, rptName, resolve);
|
|
|
+ } else {
|
|
|
+ $('#pnl_material_sum_select').hide();
|
|
|
+ }
|
|
|
if (cDefine && cDefine[sChangeSelect] && cDefine[sChangeSelect].enable) {
|
|
|
initChangeSelect(cDefine[sChangeSelect].setting, rptName, resolve);
|
|
|
}
|
|
@@ -626,6 +661,44 @@ const rptCustomObj = (function () {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const resetMaterialSumSelect = function (resolve = null) {
|
|
|
+ const data = {}, hintObj = $('#material-sum-select-hint');
|
|
|
+ if (!resolve) getCommonParams(data);
|
|
|
+ data[sMaterialSumSelect] = {
|
|
|
+ materials: [],
|
|
|
+ };
|
|
|
+ for (const mc of $('[name=material-sum-select-check]:checked')) {
|
|
|
+ data[sMaterialSumSelect].materials.push(parseInt($(mc).attr('material-order')));
|
|
|
+ }
|
|
|
+ if (data[sMaterialSumSelect].materials.length < parseInt(hintObj.attr('min-select'))) {
|
|
|
+ hintObj.html('请至少选择' + hintObj.attr('min-select') + '期数据').show();
|
|
|
+ return;
|
|
|
+ } else if (data[sMaterialSumSelect].materials.length > parseInt(hintObj.attr('max-select'))) {
|
|
|
+ hintObj.html('最多只能选择' + hintObj.attr('max-select') + '期数据').show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ hintObj.hide();
|
|
|
+ if (resolve) {
|
|
|
+ resolve(data);
|
|
|
+ } else {
|
|
|
+ postData('/report/cDefine', data, function (result) {
|
|
|
+ reloadReportData(result);
|
|
|
+ const material_sum_select = customSelects[sMaterialSumSelect].find(function (x) {
|
|
|
+ return x.id === zTreeOprObj.currentNode.refId;
|
|
|
+ });
|
|
|
+ if (material_sum_select) {
|
|
|
+ material_sum_select.masterial_sum_select = data[sMaterialSumSelect];
|
|
|
+ }
|
|
|
+ $('#material-sum-select-count').html(data[sMaterialSumSelect].materials.length);
|
|
|
+ $('#material-sum-select').modal('hide');
|
|
|
+ rptArchiveObj.toggleBtn(true);
|
|
|
+ if (PAGE_SHOW.showArchive) {
|
|
|
+ rptArchiveObj.showArchivedItem(zTreeOprObj.currentNode);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const resetChangeSelect = function (resolve = null) {
|
|
|
const data = {}, hintObj = $('#change-select-hint');
|
|
|
if (!resolve) getCommonParams(data);
|
|
@@ -822,6 +895,9 @@ const rptCustomObj = (function () {
|
|
|
const change_select = customSelects.change_select.find(function (x) {
|
|
|
return x.id === rptId;
|
|
|
});
|
|
|
+ const material_sum_select = customSelects.material_sum_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 = {};
|
|
@@ -855,6 +931,17 @@ const rptCustomObj = (function () {
|
|
|
params.customSelect.push(select);
|
|
|
$('#change-select').modal('hide');
|
|
|
}
|
|
|
+ } else if (material_sum_select && material_sum_select.custom_define && material_sum_select.custom_define[sMaterialSumSelect].enable) {
|
|
|
+ if (rptId === currentRptId) {
|
|
|
+ const data = {};
|
|
|
+ data[sMaterialSumSelect] = material_sum_select[sMaterialSumSelect];
|
|
|
+ params.customSelect.push(data);
|
|
|
+ } else {
|
|
|
+ const chkNode = chkNodes.find(function (x) { return x.refId === rptId});
|
|
|
+ const select = await comfirmSelectPromise(chkNode ? chkNode.name : '', material_sum_select);
|
|
|
+ params.customSelect.push(select);
|
|
|
+ $('#material-sum-select').modal('hide');
|
|
|
+ }
|
|
|
} else {
|
|
|
params.customSelect.push(null);
|
|
|
}
|
|
@@ -918,7 +1005,7 @@ const rptCustomObj = (function () {
|
|
|
|
|
|
return {
|
|
|
init,
|
|
|
- resetAuditSelect, resetGatherSelect, resetStageSelect, resetChangeSelect,
|
|
|
+ resetAuditSelect, resetGatherSelect, resetStageSelect, resetChangeSelect, resetMaterialSumSelect,
|
|
|
initTenderTree,
|
|
|
initTenderTreeForCross,
|
|
|
getCustomSelect,
|