Pārlūkot izejas kodu

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/ConstructionOperation

vian 5 gadi atpakaļ
vecāks
revīzija
77dce56c26

+ 9 - 7
modules/reports/rpt_component/helper/jpc_helper_common_output.js

@@ -1,5 +1,6 @@
 let JV = require('../jpc_value_define');
 let JpcFieldHelper = require('./jpc_helper_field');
+const OFFSET_FLOAT = 0.0000000001;
 
 let JpcCommonOutputHelper = {
     createCommonOutputWithoutDecorate: function (node, value, forceCombine) {
@@ -43,13 +44,14 @@ let JpcCommonOutputHelper = {
         }
         return rst;
     },
-    formatCell: function (formatStr, rstCell) {
+    formatCell: function(formatStr, rstCell) {
         if (formatStr) {
-            if (!(isNaN(parseFloat(rstCell[JV.PROP_VALUE])))) {
-                let dotIdx = formatStr.indexOf(".");
+            const rstCellFloatVal = parseFloat(rstCell[JV.PROP_VALUE]);
+            if (!(isNaN(rstCellFloatVal))) {
+                const dotIdx = formatStr.indexOf('.');
                 if (dotIdx >= 0) {
-                    let tmpStr = parseFloat(rstCell[JV.PROP_VALUE]).toFixed(formatStr.length - dotIdx - 1);
-                    let digStr = formatStr.substr(dotIdx + 1, formatStr.length - dotIdx);
+                    let tmpStr = (rstCellFloatVal + OFFSET_FLOAT).toFixed(formatStr.length - dotIdx - 1);
+                    const digStr = formatStr.substr(dotIdx + 1, formatStr.length - dotIdx);
                     for (let sIdx = digStr.length - 1; sIdx >= 0; sIdx--) {
                         if (digStr[sIdx] === '#') {
                             if (tmpStr.length > 0 && tmpStr[tmpStr.length - 1] === '0') {
@@ -64,9 +66,9 @@ let JpcCommonOutputHelper = {
                     if (tmpStr[tmpStr.length - 1] === '.') tmpStr = tmpStr.substr(0, tmpStr.length - 1);
                     rstCell[JV.PROP_VALUE] = tmpStr;
                 } else {
-                    rstCell[JV.PROP_VALUE] = parseFloat(rstCell[JV.PROP_VALUE]).toFixed(0);
+                    rstCell[JV.PROP_VALUE] = (rstCellFloatVal + OFFSET_FLOAT).toFixed(0);
                 }
-                let commaIdx = formatStr.indexOf(",");
+                const commaIdx = formatStr.indexOf(',');
                 if (commaIdx >= 0) {
                     rstCell[JV.PROP_VALUE] = comdify(rstCell[JV.PROP_VALUE].toString());
                 }

+ 2 - 0
modules/reports/rpt_component/jpc_rte.js

@@ -2,9 +2,11 @@
  * Created by Tony on 2016/12/28.
  */
 let strUtil = require('../../../public/stringUtil');
+const scMathUtil = require('../../../public/scMathUtil').getUtil();
 let JV = require('./jpc_value_define');
 let JE = {
     $STR_UTIL: strUtil,
+    $SC_MATH_UTIL: scMathUtil,
     F: function(fID, $CURRENT_RPT) {
         let rst = null;
         if ($CURRENT_RPT && ($CURRENT_RPT.fields[JV.NODE_DETAIL_FIELDS][JV.PROP_ID + "_" + fID])) {

+ 11 - 6
modules/reports/util/rpt_excel_util.js

@@ -208,7 +208,7 @@ function writeStyles(stylesObj){
         let textRotation = 0;
         let newHorizontal = excelStyle[JV.CONTROL_PROPS[2]];
         let newVertical = excelStyle[JV.CONTROL_PROPS[3]];
-        if (excelStyle[JV.CONTROL_PROPS[5]]) {
+        if (excelStyle[JV.CONTROL_PROPS[5]] && !strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[JV.CONTROL_PROP_IDX_CLOSE_OUTPUT]])) {
             newVertical = excelStyle[JV.CONTROL_PROPS[5]];
         }
         if (parseInt(excelStyle.fontAngle) !== 0) {
@@ -255,7 +255,7 @@ function writeStyles(stylesObj){
         if (strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[0]])) {
             alignStr += ' shrinkToFit="1"';
         }
-        if (strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[4]])) {
+        if (strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[4]]) && !strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[6]])) {
             alignStr += ' wrapText="1"';
         }
         if (textRotation !== 0) {
@@ -352,19 +352,19 @@ function writeSheets(pageData, paperSize, sharedStrList, stylesObj, isSinglePage
     private_pushDftFont();
     private_buildFirstDftStyle();
     if (isSinglePage) {
-        rst.push(writeSheet(pageData, null, paperSize, sharedStrList, stylesObj, null));
+        rst.push(writeSheet(pageData, null, paperSize, sharedStrList, stylesObj, null, true));
     } else {
         for (let i = 0; i < pageData.items.length; i++) {
             let appointedMergeBand = null;
             if (custSheetMergeBands && custSheetMergeBands.length > i) {
                 appointedMergeBand = custSheetMergeBands[i];
             }
-            rst.push(writeSheet(pageData, pageData.items[i], paperSize, sharedStrList, stylesObj, appointedMergeBand));
+            rst.push(writeSheet(pageData, pageData.items[i], paperSize, sharedStrList, stylesObj, appointedMergeBand, i === 0));
         }
     }
     return rst;
 }
-function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, appointedMergeBand){
+function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, appointedMergeBand, isFirstSheet){
     let rst = [], xPos = [], yPos = [], yMultiPos = [], currentMergeBorder = null,
         headerStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     let currentPageMergePos = null; //在 JV.PAGING_OPTION_INFINITY 场合应用
@@ -749,6 +749,7 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, ap
                     let valIdx = private_getSharedStrIdx(theShtData.cells[cIdx][JV.PROP_VALUE]);
                     cellObj.v = valIdx;
                 }
+
                 rowIdx2 = theYPos.indexOf(theShtData.cells[cIdx][JV.PROP_AREA][JV.PROP_BOTTOM]);
                 colIdx2 = xPos.indexOf(theShtData.cells[cIdx][JV.PROP_AREA][JV.PROP_RIGHT]);
                 if ((rowIdx2 - rowIdx1 > 1) || (colIdx2 - colIdx1 > 1)) {
@@ -806,7 +807,11 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, ap
     rst.push('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">');
     let colStr = private_getCellIdxStr(xPos.length - 3);
     rst.push('<dimension ref="A1:' + colStr + '' + yPos.length + '"/>');
-    rst.push('<sheetViews><sheetView tabSelected="1" workbookViewId="0">');
+    if (isFirstSheet) {
+        rst.push('<sheetViews><sheetView tabSelected="1" workbookViewId="0">');
+    } else {
+        rst.push('<sheetViews><sheetView workbookViewId="0">');
+    }
     //rst.push('<selection sqref="A1:' + colStr + '1"/>');
     rst.push('<selection sqref="A1:A1"/>');
     rst.push('</sheetView></sheetViews>');

+ 11 - 6
modules/users/controllers/login_controller.js

@@ -143,6 +143,7 @@ class LoginController extends BaseController {
             } else {
                 // 获取数据库菜单列表
                 let menuPermissionList = await permissionModel.getList({isMenu:true});
+                let subList = [];
                 for (let menu of menuPermissionList) {
                     if (menu.pid === 0) {
                         menuData[menu.controller] = {
@@ -153,14 +154,18 @@ class LoginController extends BaseController {
                             children: {},
                         }
                     } else if (menu.pid !== 4) {
-                        let action = {
-                            title: menu.name,
-                            url: menu.url,
-                            name: menu.action,
-                        };
-                        menuData[menu.controller].children[menu.action] = action;
+                        subList.push(menu);//防止子节点ID比父节点ID小的问题
                     }
                 }
+                for(let s of subList){
+                    let action = {
+                     title: s.name,
+                     url: s.url,
+                     name: s.action,
+                     };
+                     menuData[s.controller].children[s.action] = action;
+                }
+
                 // 超级管理员二级菜单添加
                 menuData['manager'].children['admin'] = {
                     title: '超级管理员',

+ 2 - 1
package.json

@@ -36,6 +36,7 @@
     "ueditor": "^1.2.3"
   },
   "scripts": {
-    "start": "C:\\Users\\mai\\AppData\\Roaming\\npm\\babel-node.cmd operation.js"
+    "start": "C:\\Users\\mai\\AppData\\Roaming\\npm\\babel-node.cmd operation.js",
+    "dev_server":"SET NODE_ENV=qa&& babel-node operation.js"
   }
 }