|
|
@@ -35,9 +35,14 @@ let taxTypeMap = {
|
|
|
* */
|
|
|
let regions = [];
|
|
|
|
|
|
-function isDef(v) {
|
|
|
- return typeof v !== 'undefined' && v !== null;
|
|
|
-}
|
|
|
+const {
|
|
|
+ ValuationType: { BUDGET, BOQ },
|
|
|
+ BOQType: { TENDER, BIDDER },
|
|
|
+} = window.commonConstants;
|
|
|
+const {
|
|
|
+ similarEqual,
|
|
|
+ isDef
|
|
|
+} = window.commonUtil;
|
|
|
|
|
|
//操作状态
|
|
|
const STATE = {
|
|
|
@@ -1662,6 +1667,121 @@ const projTreeObj = {
|
|
|
|
|
|
};
|
|
|
|
|
|
+function changeValuationType(type) {
|
|
|
+ $('input[name="valuation_type"]:checked').prop('checked', false);
|
|
|
+ $(`input[name="valuation_type"][value="${type}"]`).prop('checked', true);
|
|
|
+ let targetData = type === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
|
|
|
+ let html = '';
|
|
|
+ for(let i = targetData.length - 1; i >=0; i--){
|
|
|
+ let valuation = targetData[i];
|
|
|
+ if (valuation === null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ html += `<option ${i === targetData.length -1 ? 'selected' : ''} value="${valuation.id}">${valuation.name}</option>`;
|
|
|
+ }
|
|
|
+ $("#valuation").html(html);
|
|
|
+ let engineeringList = getEngineeringList();
|
|
|
+ let engineeringHtml = getEngineeringHtml(engineeringList);
|
|
|
+ $("#tender-engineering").html(engineeringHtml);
|
|
|
+ changeEngineering();
|
|
|
+ $('#engineering-info').hide();
|
|
|
+}
|
|
|
+
|
|
|
+function changeEngineering(){
|
|
|
+ $('#engineering-info').hide();
|
|
|
+ initFeeStandardSel();
|
|
|
+}
|
|
|
+
|
|
|
+function changeFeeRate(engLib) {
|
|
|
+ if(engLib){
|
|
|
+ /*
|
|
|
+ if (engLib.fee_lib !== undefined && engLib.fee_lib.length > 0) {
|
|
|
+ $("#tender-fee-rate").children("option").first().val("newFeeRate-"+engLib.fee_lib[0].id);
|
|
|
+ }*/
|
|
|
+ //2018-08-29 费率改为和计税方式绑定在一起 所以在这里还不能确定标准费率库ID
|
|
|
+ $("#tender-fee-rate").children("option").first().val("newFeeRate@@");
|
|
|
+ $("#tender-engineering").parent().siblings('.hidden-area').slideDown('fast');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $("#tender-fee-rate").children("option").first().val($('#tender-name').val());
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function initFeeStandardSel() {
|
|
|
+ $('#tender-feeStandard').empty();
|
|
|
+ let feeStandards = [];
|
|
|
+ let engineeringList = getEngineeringList();
|
|
|
+ let currentEngName = $('#tender-engineering').val();
|
|
|
+ for(let eng of engineeringList){
|
|
|
+ if(eng.lib.name && eng.lib.name === currentEngName && eng.lib.feeName && eng.lib.feeName !== ''){
|
|
|
+ feeStandards.push(eng.lib.feeName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(let feeName of feeStandards){
|
|
|
+ let $opt = $(`<option value="${feeName}">${feeName}</option>`);
|
|
|
+ $('#tender-feeStandard').append($opt);
|
|
|
+ }
|
|
|
+ if(feeStandards.length > 0){
|
|
|
+ if($('#feeStandard-info').is(':visible')){
|
|
|
+ $('#feeStandard-info').hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let currentEngLib = getEngineeringLib(currentEngName + $('#tender-feeStandard').val(), engineeringList);
|
|
|
+ changeFeeRate(currentEngLib);
|
|
|
+ setTaxGroupHtml();
|
|
|
+ getStdCalcProgramFiles();
|
|
|
+}
|
|
|
+
|
|
|
+function changeFeeStandard() {
|
|
|
+ let currentEngLib = getEngineeringLib($('#tender-engineering').val() + $('#tender-feeStandard').val(), getEngineeringList());
|
|
|
+ changeFeeRate(currentEngLib);
|
|
|
+ setTaxGroupHtml();
|
|
|
+ getStdCalcProgramFiles();
|
|
|
+}
|
|
|
+
|
|
|
+function setTaxGroupHtml() {
|
|
|
+ let groups = getTaxGroupList();
|
|
|
+ let taxTypeArray = [];
|
|
|
+ let htmlString = "";
|
|
|
+ if(groups && groups.length > 0){
|
|
|
+ taxTypeArray = _.uniq(_.map(groups,'taxType'));
|
|
|
+ }
|
|
|
+ for(let t of taxTypeArray){
|
|
|
+ htmlString += "<option value='"+t+"'>"+taxTypeMap[t]+"</option>"
|
|
|
+ }
|
|
|
+ $('#taxType').html(htmlString);
|
|
|
+ if(taxTypeArray.length <2){
|
|
|
+ $('#taxType_div').hide();
|
|
|
+ }else {
|
|
|
+ $('#taxType_div').show();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getStdCalcProgramFiles(){
|
|
|
+ function getStdCPFilesHtml(taxGroups) {
|
|
|
+ let result = '';
|
|
|
+ if (taxGroups.length <= 0) {
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+
|
|
|
+ for (let group of taxGroups){
|
|
|
+ let groupString = ""; //把计算程序、清单模板、列设置的ID生成一个组合的值
|
|
|
+ let p_id = group.program_lib?group.program_lib.id:"";
|
|
|
+ let t_id = group.template_lib?group.template_lib.id:"";
|
|
|
+ let c_id = group.col_lib?group.col_lib.id:"";
|
|
|
+ let f_id = group.fee_lib?group.fee_lib.id:"";
|
|
|
+ groupString = p_id + "|-|" +t_id+"|-|"+c_id+"|-|"+f_id;
|
|
|
+ result += '<option value='+ groupString +'>'+ group.program_lib.name +'</option>';
|
|
|
+ };
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ let taxType = $("#taxType").val();
|
|
|
+ let stdCPHtml = getStdCPFilesHtml(getTaxGroupList(taxType));
|
|
|
+ $("#tender-calcProgram").html(stdCPHtml);
|
|
|
+ if ($("#tender-calcProgram")[0].options.length > 1)
|
|
|
+ $("#tender-calcProgram")[0].selectedIndex = 0;
|
|
|
+}
|
|
|
+
|
|
|
$(document).ready(function() {
|
|
|
// 分享给的一些事件监听
|
|
|
SHARE_TO.handleEventListener();
|
|
|
@@ -1720,8 +1840,8 @@ $(document).ready(function() {
|
|
|
bindInputs($('#project-name'), $('#folder-name'), $('#rename-name'));
|
|
|
//绑定新建窗口显示事件
|
|
|
bindModalShown($('#add-folder-dialog'), $('#add-project-dialog'), $('#add-tender-dialog'));
|
|
|
- //绑定新建建设项目、新建文件夹、重命名弹窗隐藏事件
|
|
|
- bindModalsHidden($('#add-project-dialog'), $('#add-folder-dialog'), $('#rename-dialog'));
|
|
|
+ //绑定新建建设项目、新建单位工程、新建文件夹、重命名弹窗隐藏事件
|
|
|
+ bindModalsHidden($('#add-project-dialog'), $('#add-tender-dialog'), $('#add-folder-dialog'), $('#rename-dialog'));
|
|
|
|
|
|
// 新建子菜单有效性刷新
|
|
|
$('#addMenuBtn').click(function () {
|
|
|
@@ -1747,22 +1867,7 @@ $(document).ready(function() {
|
|
|
// 选择计价方式
|
|
|
$("input[name='valuation_type']").click(function() {
|
|
|
let type = $(this).val();
|
|
|
- let targetData = type === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
|
|
|
- let html = '';
|
|
|
- for(let i = targetData.length - 1; i >=0; i--){
|
|
|
- let valuation = targetData[i];
|
|
|
- if (valuation === null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- html += `<option ${i === targetData.length -1 ? 'selected' : ''} value="${valuation.id}">${valuation.name}</option>`;
|
|
|
- }
|
|
|
- $("#valuation").html(html);
|
|
|
- //$("#tender-engineering").html('<option value="">请选择对应的工程专业</option>');
|
|
|
- let engineeringList = getEngineeringList();
|
|
|
- let engineeringHtml = getEngineeringHtml(engineeringList);
|
|
|
- $("#tender-engineering").html(engineeringHtml);
|
|
|
- changeEngineering();
|
|
|
- $('#engineering-info').hide();
|
|
|
+ changeValuationType(type);
|
|
|
});
|
|
|
|
|
|
//选择计价规则
|
|
|
@@ -1785,30 +1890,39 @@ $(document).ready(function() {
|
|
|
let pojName = $('#poj-name').val().trim();
|
|
|
let nameList = getNameList($('#poj-name-list').children());
|
|
|
let isExist = hasListName(nameList, pojName);
|
|
|
- if(!isExist){
|
|
|
- if(pojName !== ''){
|
|
|
+ if (!isExist) {
|
|
|
+ changeValuationType(BUDGET);
|
|
|
+ if (pojName !== '') {
|
|
|
replaceClass($('#poj-name-info'), 'text-danger', 'text-info');
|
|
|
setDangerInfo($('#poj-name-info'), `新建“${pojName}”`);
|
|
|
- }
|
|
|
- else {
|
|
|
+ if (!$('#tender-reserve').children().length) {
|
|
|
+ initProjectOptSet($('#tender-reserve'));
|
|
|
+ }
|
|
|
+ // 新建项目,需要选择项目类型了,单位工程就不需要选择项目类别
|
|
|
+ $('#val-type-group').hide();
|
|
|
+ } else {
|
|
|
+ $('#tender-reserve').empty();
|
|
|
$('#poj-name-info').hide();
|
|
|
}
|
|
|
//清空文件下拉
|
|
|
setFileOptions(null);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
+ $('#val-type-group').show();
|
|
|
+ $('#tender-reserve').empty();
|
|
|
//触发选项
|
|
|
let curName = $(this).val().trim();
|
|
|
- function getProjOpt(opts){
|
|
|
- for(let opt of opts){
|
|
|
- if($(opt).text().trim() === curName){
|
|
|
+ function getProjOpt(opts) {
|
|
|
+ for (let opt of opts) {
|
|
|
+ if ($(opt).text().trim() === curName) {
|
|
|
return $(opt);
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
let matchOpt = getProjOpt($('#poj-name-list').find('a'));
|
|
|
- if(matchOpt){
|
|
|
+ const projectID = matchOpt.data('id');
|
|
|
+ handleTenderValuationTypeViewState(projectID);
|
|
|
+ if (matchOpt) {
|
|
|
matchOpt.click();
|
|
|
}
|
|
|
$('#poj-name-info').hide();
|
|
|
@@ -1880,10 +1994,10 @@ $(document).ready(function() {
|
|
|
let selected = projTreeObj.tree.selected;
|
|
|
let projs = getProjs(selected);
|
|
|
setProjOptions(projs, selected);
|
|
|
- //恢复成默认选中预算项目类别。
|
|
|
- $($("input[name='valuation_type']")[0]).prop('checked', true);
|
|
|
- $($("input[name='valuation_type']")[1]).prop('checked', false);
|
|
|
- $($("input[name='valuation_type']")[0]).click();
|
|
|
+ $('#val-type-group').show();
|
|
|
+ const firstProj = selected && selected.data.projType === projectType.project ? selected: projs[0];
|
|
|
+ const firstProjID = firstProj && firstProj.data.ID || null;
|
|
|
+ handleTenderValuationTypeViewState(firstProjID);
|
|
|
//设置地区选项
|
|
|
if(regions.length > 0){
|
|
|
setRegionOpts(regions);
|
|
|
@@ -2148,101 +2262,6 @@ $(document).ready(function() {
|
|
|
projTreeObj.confirmFileChange();
|
|
|
});
|
|
|
|
|
|
- function changeEngineering(){
|
|
|
- $('#engineering-info').hide();
|
|
|
- initFeeStandardSel();
|
|
|
- }
|
|
|
-
|
|
|
- function changeFeeRate(engLib) {
|
|
|
- if(engLib){
|
|
|
- /*
|
|
|
- if (engLib.fee_lib !== undefined && engLib.fee_lib.length > 0) {
|
|
|
- $("#tender-fee-rate").children("option").first().val("newFeeRate-"+engLib.fee_lib[0].id);
|
|
|
- }*/
|
|
|
- //2018-08-29 费率改为和计税方式绑定在一起 所以在这里还不能确定标准费率库ID
|
|
|
- $("#tender-fee-rate").children("option").first().val("newFeeRate@@");
|
|
|
- $("#tender-engineering").parent().siblings('.hidden-area').slideDown('fast');
|
|
|
- }
|
|
|
- else {
|
|
|
- $("#tender-fee-rate").children("option").first().val($('#tender-name').val());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function initFeeStandardSel() {
|
|
|
- $('#tender-feeStandard').empty();
|
|
|
- let feeStandards = [];
|
|
|
- let engineeringList = getEngineeringList();
|
|
|
- let currentEngName = $('#tender-engineering').val();
|
|
|
- for(let eng of engineeringList){
|
|
|
- if(eng.lib.name && eng.lib.name === currentEngName && eng.lib.feeName && eng.lib.feeName !== ''){
|
|
|
- feeStandards.push(eng.lib.feeName);
|
|
|
- }
|
|
|
- }
|
|
|
- for(let feeName of feeStandards){
|
|
|
- let $opt = $(`<option value="${feeName}">${feeName}</option>`);
|
|
|
- $('#tender-feeStandard').append($opt);
|
|
|
- }
|
|
|
- if(feeStandards.length > 0){
|
|
|
- if($('#feeStandard-info').is(':visible')){
|
|
|
- $('#feeStandard-info').hide();
|
|
|
- }
|
|
|
- }
|
|
|
- let currentEngLib = getEngineeringLib(currentEngName + $('#tender-feeStandard').val(), engineeringList);
|
|
|
- changeFeeRate(currentEngLib);
|
|
|
- setTaxGroupHtml();
|
|
|
- getStdCalcProgramFiles();
|
|
|
- }
|
|
|
-
|
|
|
- function changeFeeStandard() {
|
|
|
- let currentEngLib = getEngineeringLib($('#tender-engineering').val() + $('#tender-feeStandard').val(), getEngineeringList());
|
|
|
- changeFeeRate(currentEngLib);
|
|
|
- setTaxGroupHtml();
|
|
|
- getStdCalcProgramFiles();
|
|
|
- }
|
|
|
-
|
|
|
- function setTaxGroupHtml() {
|
|
|
- let groups = getTaxGroupList();
|
|
|
- let taxTypeArray = [];
|
|
|
- let htmlString = "";
|
|
|
- if(groups && groups.length > 0){
|
|
|
- taxTypeArray = _.uniq(_.map(groups,'taxType'));
|
|
|
- }
|
|
|
- for(let t of taxTypeArray){
|
|
|
- htmlString += "<option value='"+t+"'>"+taxTypeMap[t]+"</option>"
|
|
|
- }
|
|
|
- $('#taxType').html(htmlString);
|
|
|
- if(taxTypeArray.length <2){
|
|
|
- $('#taxType_div').hide();
|
|
|
- }else {
|
|
|
- $('#taxType_div').show();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function getStdCalcProgramFiles(){
|
|
|
- function getStdCPFilesHtml(taxGroups) {
|
|
|
- let result = '';
|
|
|
- if (taxGroups.length <= 0) {
|
|
|
- return result;
|
|
|
- };
|
|
|
-
|
|
|
- for (let group of taxGroups){
|
|
|
- let groupString = ""; //把计算程序、清单模板、列设置的ID生成一个组合的值
|
|
|
- let p_id = group.program_lib?group.program_lib.id:"";
|
|
|
- let t_id = group.template_lib?group.template_lib.id:"";
|
|
|
- let c_id = group.col_lib?group.col_lib.id:"";
|
|
|
- let f_id = group.fee_lib?group.fee_lib.id:"";
|
|
|
- groupString = p_id + "|-|" +t_id+"|-|"+c_id+"|-|"+f_id;
|
|
|
- result += '<option value='+ groupString +'>'+ group.program_lib.name +'</option>';
|
|
|
- };
|
|
|
- return result;
|
|
|
- };
|
|
|
- let taxType = $("#taxType").val();
|
|
|
- let stdCPHtml = getStdCPFilesHtml(getTaxGroupList(taxType));
|
|
|
- $("#tender-calcProgram").html(stdCPHtml);
|
|
|
- if ($("#tender-calcProgram")[0].options.length > 1)
|
|
|
- $("#tender-calcProgram")[0].selectedIndex = 0;
|
|
|
- }
|
|
|
-
|
|
|
// 选择工程专业后动态更改费率文件等数据
|
|
|
$("#tender-engineering").change(function() {
|
|
|
changeEngineering()
|
|
|
@@ -2424,7 +2443,12 @@ function AddProject() {
|
|
|
}, 500);
|
|
|
};
|
|
|
let selectedItem = projTreeObj.tree.selected;
|
|
|
-
|
|
|
+ const property = {
|
|
|
+ valuationType: $('input[name="valuation-type"]:checked').val()
|
|
|
+ };
|
|
|
+ if (property.valuationType === BOQ) {
|
|
|
+ property.boqType = +$('input[name="boq-type-input"]:checked').val();
|
|
|
+ }
|
|
|
/*
|
|
|
* (1)、当前没有焦点行,新建建设项目为第一个节点。
|
|
|
(2)、当前定位在文件夹,新建建设项目为文件夹的最后一个子节点。
|
|
|
@@ -2432,28 +2456,70 @@ function AddProject() {
|
|
|
(4)、当前定位在单项工程或单位工程,新建项目为当前所属建设项目的后兄弟。
|
|
|
* */
|
|
|
if(!selectedItem){
|
|
|
- AddSiblingsItem(selectedItem, name, null, projectType.project, existCallback, sucCallback, errCB);
|
|
|
+ AddSiblingsItem(selectedItem, name, property, projectType.project, existCallback, sucCallback, errCB);
|
|
|
}
|
|
|
else {
|
|
|
if(selectedItem.data.projType === projectType.project){
|
|
|
- AddSiblingsItem(selectedItem, name, null, projectType.project, existCallback, sucCallback, errCB);
|
|
|
+ AddSiblingsItem(selectedItem, name, property, projectType.project, existCallback, sucCallback, errCB);
|
|
|
}
|
|
|
else if(selectedItem.data.projType === projectType.tender){
|
|
|
let proj = selectedItem.parent;
|
|
|
- AddSiblingsItem(proj, name, null, projectType.project, existCallback, sucCallback, errCB);
|
|
|
+ AddSiblingsItem(proj, name, property, projectType.project, existCallback, sucCallback, errCB);
|
|
|
}
|
|
|
else if(selectedItem.data.projType === projectType.folder){
|
|
|
- AddChildrenItem(selectedItem, name, null, projectType.project, existCallback, sucCallback, errCB);
|
|
|
+ AddChildrenItem(selectedItem, name, property, projectType.project, existCallback, sucCallback, errCB);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 创建建设项目可选项
|
|
|
+function initProjectOptSet($target) {
|
|
|
+ const html = `<div class="form-group row">
|
|
|
+ <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">项目类型</label>
|
|
|
+ <div class="col">
|
|
|
+ <div class="custom-control custom-radio custom-control-inline">
|
|
|
+ <input type="radio" value="${BUDGET}" name="valuation-type" checked id="type-budget" class="custom-control-input">
|
|
|
+ <label class="custom-control-label" for="type-budget">预算</label>
|
|
|
+ </div>
|
|
|
+ <div class="custom-control custom-radio custom-control-inline">
|
|
|
+ <input type="radio" value="${BOQ}" name="valuation-type" id="type-boq" class="custom-control-input">
|
|
|
+ <label class="custom-control-label" for="type-boq">工程量清单</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-group row hide-area" id="boq-type">
|
|
|
+ <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">清单类型</label>
|
|
|
+ <div class="col">
|
|
|
+ <div class="custom-control custom-radio custom-control-inline">
|
|
|
+ <input type="radio" value="${TENDER}" name="boq-type-input" checked id="boq-type-tender" class="custom-control-input">
|
|
|
+ <label class="custom-control-label" for="boq-type-tender">招标</label>
|
|
|
+ </div>
|
|
|
+ <div class="custom-control custom-radio custom-control-inline">
|
|
|
+ <input type="radio" value="${BIDDER}" name="boq-type-input" id="boq-type-bidder" class="custom-control-input">
|
|
|
+ <label class="custom-control-label" checked for="boq-type-bidder">投标</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>`;
|
|
|
+ //const $children = $(html);
|
|
|
+ $target.empty();
|
|
|
+ $target.append($(html));
|
|
|
+ $('input[name="valuation-type"]').on('change', function () {
|
|
|
+ const valuationType = $(this).val();
|
|
|
+ // 当项目类型是“工程量清单”时,清单类型可见可选
|
|
|
+ changeValuationType(valuationType);
|
|
|
+ valuationType === BOQ
|
|
|
+ ? $('#boq-type').removeClass('hide-area')
|
|
|
+ : $('#boq-type').addClass('hide-area');
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
function bindModalShown(folderDialog, projDialog, tenderDialog) {
|
|
|
folderDialog.on('shown.bs.modal', function () {
|
|
|
$('#folder-name').focus();
|
|
|
});
|
|
|
projDialog.on('shown.bs.modal', function () {
|
|
|
$('#project-name').focus();
|
|
|
+ initProjectOptSet($('#project-reserve'));
|
|
|
});
|
|
|
tenderDialog.on('shown.bs.modal', function () {
|
|
|
$('#tender-name').focus();
|
|
|
@@ -2461,10 +2527,14 @@ function bindModalShown(folderDialog, projDialog, tenderDialog) {
|
|
|
}
|
|
|
|
|
|
//新建建设项目、新建单项工程、新建文件夹、重命名弹窗隐藏事件
|
|
|
-function bindModalsHidden(projDialog, folderDialog, renameDialog){
|
|
|
+function bindModalsHidden(projDialog, tenderDialog, folderDialog, renameDialog){
|
|
|
projDialog.on('hidden.bs.modal', function () {
|
|
|
setDangerInfo($('#project-name-info'), '', false);
|
|
|
$('#project-name').val('');
|
|
|
+ $('#project-reserve').empty();
|
|
|
+ });
|
|
|
+ tenderDialog.on('hidden.bs.modal', function () {
|
|
|
+ $('#tender-reserve').empty();
|
|
|
});
|
|
|
folderDialog.on('hidden.bs.modal', function () {
|
|
|
setDangerInfo($('#folder-name-info'), '', false);
|
|
|
@@ -2523,7 +2593,7 @@ function setInitSummaryData(data) {
|
|
|
data.totalCost = 0;
|
|
|
}
|
|
|
|
|
|
-function AddTenderItems(selected, projName, tenderName, property, callback, errCB){
|
|
|
+function AddTenderItems(selected, projName, tenderName, projectProperty, property, callback, errCB){
|
|
|
const addPath = {p_t: 'p_t', t: 't'};
|
|
|
let path, updateDatas = [];
|
|
|
let tempProjs = getProjs(selected);
|
|
|
@@ -2552,7 +2622,7 @@ function AddTenderItems(selected, projName, tenderName, property, callback, errC
|
|
|
pre = selectedProj;
|
|
|
next = selectedProj ? selectedProj.nextSibling : projTreeObj.tree.firstNode();
|
|
|
}
|
|
|
- let updateProjs = GetUpdateData(pre, parent, next, projName, null, projID, {updateType: 'new', projectType: projectType.project});
|
|
|
+ let updateProjs = GetUpdateData(pre, parent, next, projName, projectProperty, projID, {updateType: 'new', projectType: projectType.project});
|
|
|
property.rootProjectID = projID;
|
|
|
let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: projID, NextSiblingID: -1,
|
|
|
name: tenderName, projType: projectType.tender, property: property}};
|
|
|
@@ -2840,6 +2910,27 @@ function setFileOptions(projID){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 根据建设项目是否有项目类型属性,控制新建单位时,单位工程项目类别选项的可见性和只读性
|
|
|
+// 主要是兼容性处理:新建分段时,如果建设项目已有项目类型,则分段的项目类型、清单类型同建设项目的,窗口中只读;如果建设项目中没有,则可选择(是为了兼容养护的旧项目)
|
|
|
+function handleTenderValuationTypeViewState(projectID) {
|
|
|
+ if (!projectID) {
|
|
|
+ return changeValuationType(BUDGET);
|
|
|
+ }
|
|
|
+ const projectNode = projTreeObj.tree.findNode(projectID) ;// 建设项目节点
|
|
|
+ if (!projectNode) {
|
|
|
+ return changeValuationType(BUDGET);
|
|
|
+ }
|
|
|
+ const projectValuationType = projectNode.data.property.valuationType;
|
|
|
+ if (projectValuationType) {
|
|
|
+ changeValuationType(projectValuationType);
|
|
|
+ $('input[name="valuation_type"]').attr('disabled', 'disabled');
|
|
|
+ } else {
|
|
|
+ //恢复成默认选中预算项目类别。
|
|
|
+ changeValuationType(BUDGET);
|
|
|
+ $('input[name="valuation_type"]').removeAttr('disabled');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//建设项目下拉框
|
|
|
function setProjOptions(projs, selected){
|
|
|
$("#poj-name-list").empty();
|
|
|
@@ -2849,13 +2940,16 @@ function setProjOptions(projs, selected){
|
|
|
$("#poj-name").val(firstProj.data.name);
|
|
|
setFileOptions(firstProj.data.ID);
|
|
|
for(let i = 0, len = projs.length; i < len; i++){
|
|
|
- let $proj = $(`<a class='text-ellipsis' title="${projs[i].data.name}">`).val(projs[i].data.ID).text(projs[i].data.name);
|
|
|
+ let $proj = $(`<a class='text-ellipsis' title="${projs[i].data.name}" data-id="${projs[i].data.ID}">`).val(projs[i].data.ID).text(projs[i].data.name);
|
|
|
$proj.addClass("dropdown-item");
|
|
|
$proj.attr("href", "javascript:void(0);");
|
|
|
$proj.click(function () {
|
|
|
$("#poj-name").val(projs[i].data.name);
|
|
|
setFileOptions(projs[i].data.ID);
|
|
|
$('#poj-name-info').hide();
|
|
|
+ $('#tender-reserve').empty();
|
|
|
+ $('#val-type-group').show();
|
|
|
+ handleTenderValuationTypeViewState(projs[i].data.ID);
|
|
|
});
|
|
|
$("#poj-name-list").append($proj);
|
|
|
}
|
|
|
@@ -2958,10 +3052,27 @@ function AddTender() {
|
|
|
//如果是新建费率的情况
|
|
|
if(feeFileObj.id.indexOf("newFeeRate")!=-1) feeFileObj.id +=feeLibID;
|
|
|
let valuationName = $("#valuation").children("option:selected").text();
|
|
|
- let valuationType = $("input[name='valuation_type']:checked").val();
|
|
|
+ const projectInfo = {};
|
|
|
+ // 单位工程项目类型、清单类型则跟着建设项目可选项走
|
|
|
+ const selectedItem = projTreeObj.tree.selected;
|
|
|
+ const tempProjs = getProjs(selectedItem);
|
|
|
+ const matchedProject = getNodeByName(projName, tempProjs);
|
|
|
+ let valuationType;
|
|
|
+ let boqType;
|
|
|
+ if (matchedProject) {
|
|
|
+ valuationType = matchedProject.data.property.valuationType || $("input[name='valuation_type']:checked").val();
|
|
|
+ boqType = matchedProject.data.property.boqType || null;
|
|
|
+ } else {
|
|
|
+ valuationType = $("input[name='valuation-type']:checked").val(); // 建设项目选项
|
|
|
+ projectInfo.valuationType = valuationType;
|
|
|
+ if (valuationType === BOQ) {
|
|
|
+ boqType = +$("input[name='boq-type-input']:checked").val(); // 建设项目选项
|
|
|
+ projectInfo.boqType = boqType;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
let engineering = undefined;
|
|
|
- let valuationData = valuationType === 'bill' ? JSON.parse(billValuation) : JSON.parse(rationValuation);
|
|
|
+ let valuationData = valuationType === BUDGET ? JSON.parse(billValuation) : JSON.parse(rationValuation);
|
|
|
let engineeringList = [];
|
|
|
for(let tmp of valuationData) {
|
|
|
if (tmp.id === valuation) {
|
|
|
@@ -3010,7 +3121,6 @@ function AddTender() {
|
|
|
STATE.addingTender = false;
|
|
|
}, 500);
|
|
|
};
|
|
|
- let selectedItem = projTreeObj.tree.selected;
|
|
|
//地区
|
|
|
let region = $('#regionDiv').find('select').val() || '全省';
|
|
|
let tenderInfo = {
|
|
|
@@ -3033,7 +3143,10 @@ function AddTender() {
|
|
|
progressiveLibID:progressiveLibID,
|
|
|
region: region
|
|
|
};
|
|
|
- AddTenderItems(selectedItem, projName, tenderName, tenderInfo, callback, errCB);
|
|
|
+ if (boqType) {
|
|
|
+ tenderInfo.boqType = boqType;
|
|
|
+ }
|
|
|
+ AddTenderItems(selectedItem, projName, tenderName, projectInfo, tenderInfo, callback, errCB);
|
|
|
|
|
|
} catch (error) {
|
|
|
alert(error);
|