zhongzewei před 6 roky
rodič
revize
bb0af819c0

+ 2 - 3
modules/pm/controllers/pm_controller.js

@@ -321,15 +321,14 @@ module.exports = {
         rationValuation = await engineeringLibModel.getLib(rationValuation);
         let absoluteUrl = compilationData.overWriteUrl ? request.app.locals.rootDir + compilationData.overWriteUrl : request.app.locals.rootDir;
         let overWriteUrl = fs.existsSync(absoluteUrl) && fs.statSync(absoluteUrl).isFile()? compilationData.overWriteUrl : null;
-        let valuationOpts = billValuation.map(data => {return {name: data.name, id: data.id}}).reverse();
+        //let valuationOpts = billValuation.map(data => {return {name: data.name, id: data.id}}).reverse();
         let renderData = {
             isFirst: isFirst,
             userAccount: request.session.userAccount,
             userID: request.session.sessionUser.id,
             compilationData: JSON.stringify(sessionCompilation),
             overWriteUrl: overWriteUrl,
-            billValuation: JSON.stringify(billValuation),
-            valuationOpts: valuationOpts,
+            billValuation: JSON.stringify(billValuation.reverse()), // 按最新排序
             rationValuation: JSON.stringify(rationValuation),
             engineeringList: JSON.stringify(engineering.List),
             compilationName: sessionCompilation.name,

+ 9 - 4
modules/pm/facade/pm_facade.js

@@ -1357,10 +1357,15 @@ async function importProject(importObj, userID, compilationID) {
     }
     //给单位工程设置一些数据
     async function setupTender(data) {
-        //小数位数
-        data.property.decimal = defaultDecimal;
-        //清单工程量精度
-        data.property.billsQuantityDecimal = billsQuantityDecimal;
+        //小数位数 需要修改,所以深拷贝
+        data.property.decimal = JSON.parse(JSON.stringify(defaultDecimal));
+        // 定额工程量、人材机消耗量精度设为最大6
+        data.property.decimal.ration.quantity = 6;
+        data.property.decimal.glj.quantity = 6;
+        //清单工程量精度 需要修改,所以深拷贝
+        data.property.billsQuantityDecimal = JSON.parse(JSON.stringify(billsQuantityDecimal));
+        // 清单工程量精度设置最大4
+        data.property.billsQuantityDecimal.forEach(data => data.decimal = 4);
         //呈现选项
         data.property.displaySetting = displaySetting;
 

+ 13 - 21
web/building_saas/main/js/models/exportStandardInterface.js

@@ -259,7 +259,7 @@ const XMLStandard = (function () {
         //单项工程定义
         function Engineering(source) {
             let attrs = [
-                {name: '编号', value: source.code, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
+                {name: '编号', value: '', required: true, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '金额', value: exportKind === _config.EXPORT_KIND.Tender ? source.summaryInfo.engineeringCost : '0', type: _config.TYPE.NUM2},
             ];
@@ -272,7 +272,7 @@ const XMLStandard = (function () {
                 '2': '简易计税',
             };
             let attrs = [
-                {name: '编号', value: source.code, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
+                {name: '编号', value: '', required: true, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '名称', value: source.name, required: true, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '专业', value: source.engineeringName, required: true, enumeration: [
                     '土建工程', '装饰工程', '安装工程', '市政工程', '园林绿化工程',
@@ -957,16 +957,6 @@ const XMLStandard = (function () {
         //记录拉取的单位工程项目详细数据,导出的时候,可能会导出多个文件,只有导出第一个文件的时候需要请求数据
         let tenderDetailMap = {};   //ID映射 ID: data
 
-        //自增编码
-        let incrementData = {
-            projectCode: 1,     //项目编号,单项工程、单位工程编号自动生成
-        };
-        function getIncreamentData(field) {
-            if (!incrementData[field]) {
-                incrementData[field] = 1;
-            }
-            return incrementData[field]++;
-        }
         //获取需要导出的项目数据
         //@param {Number}tenderID(当前界面的单位工程ID,后台根据这个单位工程,去找其建设项目下所有数据)
         //@return {Object}(eleObj)
@@ -1046,10 +1036,8 @@ const XMLStandard = (function () {
          * @param {Object}summaryInfo(项目汇总信息映射) {Object}engData(单项工程数据)
          * */
         async function loadEngineering(summaryInfo, engData) {
-            let source = {summaryInfo: summaryInfo[engData.ID], name: engData.name, code: getIncreamentData('projectCode')};
+            let source = {summaryInfo: summaryInfo[engData.ID], name: engData.name};
             let engineering = new Engineering(source);
-            //单项工程编号要唯一
-            _util.checkUnique(curProjectEle.constraints.engCode, source.code, '单项工程编号');
             //费用构成
             let feeForm = new FeeFrom(summaryInfo[engData.ID]);
             engineering.children.push(feeForm);
@@ -1099,7 +1087,6 @@ const XMLStandard = (function () {
             tenderGljs = allGljs.map(glj => glj.id);
             //单位工程
             let tenderSource = {
-                code: getIncreamentData('projectCode'),
                 name: tenderData.name,
                 engineeringName: tenderData.property.engineeringName,
                 summaryInfo: summaryInfo[tenderData.ID],
@@ -1107,8 +1094,6 @@ const XMLStandard = (function () {
                 taxType: tenderData.property.taxType
             };
             let tender = curTenderEle = new Tender(tenderSource);
-            //单位工程编号要唯一
-            _util.checkUnique(curProjectEle.constraints.tenderCode, tenderSource.code, '单位工程编号');
             //工程特征
             let featureObj = _util.arrayToObj(tenderData.property.projectFeature);
             let engFeature = new EngFeature({feature:featureObj, basicInformation: curPMData.project.property.basicInformation});
@@ -1839,6 +1824,10 @@ const XMLStandard = (function () {
             for (let node of filterNodes) {
                 let mainTreeNode = detail.mainTree.getNodeByID(node.data.ID),
                     serialNo = mainTreeNode ? mainTreeNode.serialNo() + 1 : 1;
+                // 规费和规费子项费用类别相同
+                let feeType = node === chargeNode || node.parent === chargeNode
+                    ? FEE_TYPE[chargeNode.getFlag()]
+                    : FEE_TYPE[node.getFlag()] || FEE_TYPE['0'];
                 let source = {
                     row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
                     code: node.data.code,
@@ -1847,7 +1836,7 @@ const XMLStandard = (function () {
                     calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
                     feeRate: node.data.feeRate ? node.data.feeRate : 100,
                     fees: node.data.fees,
-                    feeType: FEE_TYPE[node.getFlag()] || FEE_TYPE['0'],
+                    feeType: feeType,
                     remark: node.data.remark
                 };
                 source.calcBaseState = _util.transformCalcBaseState(detail, source.calcBase, CalcStateMap);
@@ -1926,8 +1915,9 @@ const XMLStandard = (function () {
                     let price = gljUtil.getGLJPrice(glj, detail.projectGLJ.datas,
                         curPMData.tender.property.calcOptions, detail.labourCoe.datas, curPMData.tender.property.decimal, false, _, scMathUtil);
                     //调整价
-                    let adjPrice = gljUtil.getAdjustPrice(glj, detail.projectGLJ.datas,
-                        curPMData.tender.property.calcOptions, detail.labourCoe.datas, curPMData.tender.property.decimal, false, _, scMathUtil);
+                    /*let adjPrice = gljUtil.getAdjustPrice(glj, detail.projectGLJ.datas,
+                        curPMData.tender.property.calcOptions, detail.labourCoe.datas, curPMData.tender.property.decimal, false, _, scMathUtil);*/
+                    let adjPrice = 0;
                     //获取人材机费用类别: 1=人工费 2=材料费 3=机械费 4=未计价费
                     let feeType = String(glj.type)[0];
                     if (feeType && !['1', '2', '3'].includes(feeType)) {
@@ -2043,6 +2033,8 @@ const XMLStandard = (function () {
          * */
         this.transformData = async function (tenderID, curExportKind) {
             if (curExportKind) {
+                // 更新缓存中的导出文件类型
+                _cache.setItem('exportKind', +curExportKind);
                 exportKind = parseInt(curExportKind);
             }
             let eleData = await loadProject(tenderID);

+ 4 - 5
web/building_saas/main/js/models/exportStdInterfaceBase.js

@@ -103,11 +103,11 @@ const XML_EXPORT_BASE = (() => {
      * @return {void}
      * */
     function Element(name, attrs) {
-        handleXMLEntity(attrs);
         this.name = name;
         let checkData = check(name, attrs);
         this.fail = checkData.failHints;
         this.attrs = checkData.filterAttrs;
+        handleXMLEntity(this.attrs);
         this.children = [];
         _cache.failList.push(...this.fail);
     }
@@ -126,8 +126,6 @@ const XML_EXPORT_BASE = (() => {
     // 对每个元素的所有属性值进行特殊字符处理
     function handleXMLEntity(attrs) {
         for (let attr of attrs) {
-            // 值统一转换成String
-            attr.value = !isDef(attr.value) ? '' : String(attr.value);
             if (!attr.value) {
                 continue;
             }
@@ -158,7 +156,8 @@ const XML_EXPORT_BASE = (() => {
         let rst = {failHints: [], filterAttrs: []};
         let dateReg = /([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))/;
         for (let data of datas) {
-            //data.value = typeof data.value === 'undefined' || data.value === null ? '' : String(data.value);
+            // 值统一转换成String
+            data.value = !isDef(data.value) ? '' : String(data.value);
             if (data.whiteSpace && data.whiteSpace === WHITE_SPACE.COLLAPSE) {  //处理空格相关
                 data.value = data.value.replace(/[\r,\n,\t]/g, ' ');
                 data.value = data.value.trim();
@@ -427,7 +426,7 @@ const XML_EXPORT_BASE = (() => {
         let newBase = [];
         let illegal = false;
         for (let base of bases) {
-            //行引用转换为名称
+            //行引用转换为名称.
             if (/F\d+/.test(base)) {
                 let rowCode = base.match(/\d+/)[0],
                     node = tenderDetail.mainTree.items[rowCode - 1];

+ 0 - 2
web/building_saas/main/js/views/export_view.js

@@ -198,7 +198,6 @@ const ExportView = (() => {
         });
         $('#export').on('hide.bs.modal', function() {
             resetState();
-            //xmlObj = null;
             STATE.checking = false;
             STATE.exporting = false;
             STATE.confirming = false;
@@ -212,7 +211,6 @@ const ExportView = (() => {
         });
         $('#export input[type="checkbox"]').click(function () {
             resetState();
-            //xmlObj = null;
         });
     }
     return {exportListener}

+ 0 - 9
web/building_saas/pm/html/project-management.html

@@ -243,9 +243,6 @@
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计价规则</label>
                         <div class="col">
                             <select class="form-control  form-control-sm" id="proj-valuation">
-                                <% for (let valuation of valuationOpts) { %>
-                                <option value="<%= valuation.id %>"><%= valuation.name %></option>
-                                <% } %>
                             </select>
                         </div>
                     </div>
@@ -351,9 +348,6 @@
                             <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计价规则</label>
                             <div class="col">
                                 <select class="form-control  form-control-sm" id="valuation">
-                                    <% for (let valuation of valuationOpts) { %>
-                                    <option value="<%= valuation.id %>"><%= valuation.name %></option>
-                                    <% } %>
                                 </select>
                             </div>
                         </div>
@@ -818,9 +812,6 @@
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计价规则</label>
                         <div class="col">
                             <select id="import-valuation" class="form-control form-control-sm">
-                                <% for (let valuation of valuationOpts) { %>
-                                <option value="<%= valuation.id %>"><%= valuation.name %></option>
-                                <% } %>
                             </select>
                         </div>
                     </div>

+ 5 - 0
web/building_saas/pm/js/pm_import.js

@@ -474,6 +474,11 @@ const importView = (() => {
                 alert(err);
             }
         });
+        // 导入窗口激活
+        $('#importInterface').on('show.bs.modal', function () {
+            // 恢复计价规则下拉
+            setValuationSels($('#import-valuation'), billValuation);
+        });
         //导入窗口消失后
         $('#importInterface').on('hidden.bs.modal', function () {
             importXML = null;

+ 14 - 4
web/building_saas/pm/js/pm_newMain.js

@@ -1838,6 +1838,8 @@ $(document).ready(function() {
             $('input[name="taxType"]:eq(0)').prop('checked', true);
         });
         projDialog.on('show.bs.modal', function () {
+            // 计价规则恢复默认选项
+            setValuationSels($('#proj-valuation'), billValuation);
             infoData = null;
             needfulInfoData = null;
             $('#add-proj-prev').hide();
@@ -1946,6 +1948,7 @@ $(document).ready(function() {
         let isExist = hasListName(nameList, pojName);
         if(!isExist){
             if(pojName !== ''){
+                console.log(curValuation);
                 //新建建设项目,显示计价规则、文件类型、计税方法选项
                 $('#newProjectSet').show();
                 $('input[name="fileKind-tender"]:eq(0)').prop('checked', true);
@@ -2042,6 +2045,8 @@ $(document).ready(function() {
     }
     // 新增单位工程弹层改变
     $('#add-tender-dialog').on('show.bs.modal', function() {
+        // 恢复计价规则
+        setValuationSels($('#valuation'), billValuation);
         //clear info
         curStep = 1; //当前在第几步
         infoData = null; //建设项目基本信息数据
@@ -2799,8 +2804,6 @@ function initProjects(callback) {
  * @return {void}
  */
 function init(refresh = false) {
-    /*billValuation = billValuation.replace(/\n/g, '\\n');
-    rationValuation = rationValuation.replace(/\n/g, '\\n');*/
     //init spread and pmTree
     if(refresh == false) socketObject.connect('pm');//socket 连接;
     if (isFirst) {
@@ -3179,6 +3182,15 @@ function AddSiblingsItem(selected, name, property, type, existCallback, sucCallb
     }
 }
 
+// 设置计价规则下拉
+function setValuationSels($sel, valuationData) {
+    let reducer = (acc, cur) => acc + `<option value="${cur.id}">${cur.name}</option>`;
+    let html = valuationData.reduce(reducer, '');
+    $sel.html(html);
+    curValuation = valuationData[0].id;
+    curValuationName = valuationData[0].name;
+}
+
 //根据工程专业名称+费用标准名称获取工程专业库
 function getEngineeringLib(cascadeName, engineeringList) {
     for(let eng of engineeringList){
@@ -3192,9 +3204,7 @@ function getEngineeringLib(cascadeName, engineeringList) {
 }
 
 function getEngineeringList(){
-    //let valuation = $("#valuation").val();
     let valuation = curValuation;
-    //let valuationType = $("input[name='valuation_type']:checked").val();
     let valuationType = curValutionType;
     let valuationData = valuationType === 'bill' ? billValuation : rationValuation;
     let engineeringList = [];