| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- // 农村公路养护2020
- // 覆盖标准清单添加逻辑(实质上是覆盖获取对比节点片段方法)
- (() => {
- const functionMap = {
- /**
- * 获取操作<<农村公路养护预算费用库>>时的节点片段
- * 片段为主树根节点(与其他费用定额的添加逻辑一致)
- */
- budget() {
- return { parent: null, mainTreeFragment: projectObj.project.Bills.tree.roots };
- },
- /**
- * 获取操作<<农村公路小修工程量清单库>>时的节点片段
- * 1.主树焦点行必须在固定清单“小修费”的子节点xx项目清单范围内,范围内指清单本身及其所有后代节点
- * 小修费下某清单为xx项目清单的判定规则:小修费下名称不为“道路”、“桥梁”、“隧道”的清单
- * 2.若焦点行在无效范围中,插入时弹出提示
- */
- minorRepair() {
- const selected = projectObj.project.mainTree.selected;
- // 获取焦点所属的小修费下的xx项目(同时不为“道路”、“桥梁”、“隧道”)
- const targetNode = getTargetNode(selected);
- if (!targetNode) {
- return { errMsg: '当前位置不可添加小修工程量清单,请选中小修费下的项目名称,再添加工程量清单。' };
- }
- return { parent: targetNode, mainTreeFragment: targetNode.children || [] };
- function getTargetNode(node) {
- const exclusion = ['道路', '桥梁', '隧道'];
- while (node) {
- const isTheNode = node.parent && node.parent.getFlag() === fixedFlag.MINOR_REPAIR_FEE && !exclusion.includes(node.data.name);
- if (isTheNode) {
- return node;
- }
- node = node.parent;
- }
- return null;
- }
- },
- /**
- * 获取操作<<农村公路养护工程工程量清单>>的节点片段
- * 1.主树焦点行必须在固定清单“预防养护费”或者“修复养护费”下的建筑安装工程费清单范围内(多少层都可以,子代、孙子代...),范围内指清单本身及其所有后代节点
- * 2.若焦点行在无效范围中,插入时弹出提示
- */
- maintain() {
- const selected = projectObj.project.mainTree.selected;
- const targetNode = getTargetNode(selected);
- if (!targetNode) {
- return { errMsg: '当前位置不可添加养护工程量清单,请选中建筑安装工程费,再添加工程量清单。' };
- }
- return { parent: targetNode, mainTreeFragment: targetNode.children || [] };
- function getTargetNode(node) {
- const targetName = '建筑安装工程费';
- while (node) {
- const isTheNode = node.data.name === targetName && node.isBelongToFlags([fixedFlag.PREVENTIVE_MAINTENANCE_FEE, fixedFlag.REPAIR_MAINTENANCE_FEE]);
- if (isTheNode) {
- return node;
- }
- node = node.parent;
- }
- return null;
- }
- }
- };
- // 获取当前操作的清单库的方法
- function getFragmentFunction() {
- const selLibText = $('#stdBillsGuidanceLibSelect').find('option:selected').text();
- if (/农村公路养护预算费用/.test(selLibText)) {
- return functionMap.budget;
- } else if (/农村公路小修工程量清单/.test(selLibText)) {
- return functionMap.minorRepair;
- } else if (/农村公路养护工程工程量清单/.test(selLibText)) {
- return functionMap.maintain;
- } else {
- return functionMap.budget;
- }
- }
- // 获取对比的主树节点片段
- function overwrite() {
- if (typeof billsGuidance !== 'undefined') {
- billsGuidance.overwrite.getFragment = () => {
- // 不同的清单库插入获取片段都不同,先获取是哪个库进行操作
- const func = getFragmentFunction();
- return func();
- };
- }
- }
- overwrite();
- })();
- // 清单基数(仅能使用行引用)
- if (typeof baseFigureMap !== 'undefined') {
- baseFigureMap.budget = {};
- baseFigureMap.boq = {};
- }
- if (typeof baseFigureTemplate !== 'undefined') {
- baseFigureTemplate.budget = {};
- baseFigureTemplate.boq = {};
- }
- // 项目管理界面
- if (typeof projTreeObj !== 'undefined') {
- // 新建分段,隐藏项目类别、养护类别、费用标准
- $('#val-type-group').hide();
- $('#tender-engineering-group').hide();
- $('#tender-feeStandard-group').hide();
- // 项目管理隐藏项目类别列
- projTreeObj.setting.header = [
- {name: '工程列表', dataCode: 'name', width: 300, vAlign: 'center', hAlign: 'left'},
- {name: '总造价', dataCode: 'totalCost', width: 100, vAlign: 'center', hAlign: 'right', formatter: '0'},
- {name: '单价文件', dataCode: 'unitPriceFile', width: 140, vAlign: 'center', hAlign: 'left'},
- {name: '费率文件', dataCode: 'feeRateFile', width: 140, vAlign: 'center', hAlign: 'left'},
- {name: '创建日期', dataCode: 'createDateTime', width: 100, vAlign: 'center', hAlign: 'center'}
- ];
- }
- if (typeof module !== 'undefined') {
- // 农村公路养护(2020),项目属性-小数位数,清单和定额的合价应默认为2。(其他编办保持不变)
- const defaultDecimal = {
- bills: { unitPrice: 2, totalPrice: 2 },
- ration: { quantity: 3, unitPrice: 2, totalPrice: 2 },
- glj: { quantity: 3, unitPriceHasMix: 2, unitPrice: 3 },
- feeRate: 3,
- quantity_detail: 4,
- material:5,
- process: 6
- };
- module.exports = {
- progression: [],
- deficiency: {},
- defaultDecimal
- };
- }
|