Pārlūkot izejas kodu

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhongzewei 7 gadi atpakaļ
vecāks
revīzija
3177575565

+ 197 - 51
modules/reports/controllers/rpt_controller.js

@@ -269,15 +269,17 @@ module.exports = {
         let params = JSON.parse(req.body.params),
         let params = JSON.parse(req.body.params),
             prj_id = params.prj_id,
             prj_id = params.prj_id,
             rpt_ids = params.rpt_ids.split(','),
             rpt_ids = params.rpt_ids.split(','),
+            pageSize = params.pageSize,
+            orientation = params.orientation,
             customizeCfg = params.custCfg,
             customizeCfg = params.custCfg,
             option = params.option;
             option = params.option;
         let user_id = req.session.sessionUser.id;
         let user_id = req.session.sessionUser.id;
-        let parallelFucs = [];
+        let parallelFunctions = [];
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         for (let id of rpt_ids) {
         for (let id of rpt_ids) {
-            parallelFucs.push((function (rpt_id) {
+            parallelFunctions.push((function (rpt_id) {
                 return function (cb) {
                 return function (cb) {
-                    getAllPagesCommon(user_id, prj_id, rpt_id, null, null, customizeCfg, dftOption, function (err, pageRst) {
+                    getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, function (err, pageRst) {
                         if(err){
                         if(err){
                             cb(err);
                             cb(err);
                         }
                         }
@@ -288,7 +290,7 @@ module.exports = {
                 }
                 }
             })(parseInt(id)));
             })(parseInt(id)));
         }
         }
-        async.parallel(parallelFucs, function (err, pageRstArray) {
+        async.parallel(parallelFunctions, function (err, pageRstArray) {
             if (err) {
             if (err) {
                 callback(req, res, '数据有误', null);
                 callback(req, res, '数据有误', null);
             } else {
             } else {
@@ -312,14 +314,107 @@ module.exports = {
         });
         });
     },
     },
 
 
-    getTestReportAllPages: function(req, res){
-        let rpt_id = req.body.ID;
-        let pageSize = req.body.pageSize;
-        getAllPagesCommonOrg(rpt_id, pageSize, JV.PAGING_OPTION_NORMAL, function(err, pageRst){
-            //fs.writeFileSync('D:/GitHome/ConstructionOperation/tmp/testRpt.js', JSON.stringify(pageRst));
-            callback(req, res, err, pageRst);
+    createExcelFilesInOneBook: function (req, res) {
+        let params = JSON.parse(req.body.params),
+            prj_id = params.prj_id,
+            rpt_ids = params.rpt_ids,
+            rptName = params.rptName,
+            pageSize = params.pageSize,
+            orientation = params.orientation,
+            customizeCfg = params.custCfg,
+            option = params.option;
+        let user_id = req.session.sessionUser.id;
+        let parallelFunctions = [];
+        let dftOption = option||JV.PAGING_OPTION_NORMAL;
+        for (let idx = 0; idx < rpt_ids.length; idx++) {
+            let r_id = rpt_ids[idx];
+            parallelFunctions.push((function (rpt_id) {
+                return function (cb) {
+                    getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, function (err, pageRst) {
+                        if(err){
+                            cb(err);
+                        }
+                        else{
+                            cb(err, pageRst);
+                        }
+                    })
+                }
+            })(parseInt(r_id)));
+        }
+        async.parallel(parallelFunctions, function (err, pageRstArray) {
+            if (err) {
+                callback(req, res, '数据有误', null);
+            } else {
+                rpt_xl_util.exportExcelInOneBook(pageRstArray, pageSize, rptName, function(uuidName){
+                    let fileRst = {uuid: uuidName, reportName: rptName};
+                    callback(req, res, err, fileRst);
+                });
+            }
+        })
+    },
+
+    createExcelFiles: function (req, res) {
+        let params = JSON.parse(req.body.params),
+            prj_id = params.prj_id,
+            rpt_ids = params.rpt_ids,
+            rpt_names = params.rpt_names,
+            pageSize = params.pageSize,
+            orientation = params.orientation,
+            isOneSheet = params.isOneSheet,
+            customizeCfg = params.custCfg,
+            option = params.option;
+        let user_id = req.session.sessionUser.id;
+        let parallelFunctions = [];
+        let dftOption = option||JV.PAGING_OPTION_NORMAL;
+        for (let idx = 0; idx < rpt_ids.length; idx++) {
+            let r_id = rpt_ids[idx];
+            let r_name = rpt_names[idx];
+            parallelFunctions.push((function (rpt_id, rpt_name) {
+                return function (cb) {
+                    getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, function (err, pageRst) {
+                        if(err){
+                            cb(err);
+                        }
+                        else{
+                            rpt_xl_util.exportExcel(pageRst, pageSize, rpt_name, isOneSheet, null, null, function(uuidName){
+                                let fileRst = {uuid: uuidName, reportName: rpt_name};
+                                cb(err, fileRst);
+                            })
+                        }
+                    })
+                }
+            })(parseInt(r_id), r_name));
+        }
+        async.parallel(parallelFunctions, function (err, fileRstArray) {
+            if (err) {
+                callback(req, res, '数据有误', null);
+            } else {
+                // console.log(err);
+                callback(req, res, err, fileRstArray);
+            }
         })
         })
     },
     },
+    getFileByUUID: function (req, res) {
+        let uuid = req.params.uuid,
+            rptName = req.params.rptName,
+            suffix = "." + req.params.suffix
+        ;
+        // let user_id = req.session.sessionUser.id; //未来要校验user id
+        try {
+            res.setHeader('Content-Type', 'application/vnd.openxmlformats');
+            let rptNameURI = encodeURI(rptName);
+            res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + suffix + "\"; filename*=utf-8''" + rptNameURI + suffix );
+            let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + uuid + suffix);
+            filestream.on('data', function(chunk) {
+                res.write(chunk);
+            });
+            filestream.on('end', function() {
+                res.end();
+            });
+        } catch (e) {
+            console.log(e);
+        }
+    },
     getExcel: function(req, res) {
     getExcel: function(req, res) {
         let prj_id = req.params.prj_id,
         let prj_id = req.params.prj_id,
             rpt_id = req.params.rpt_id,
             rpt_id = req.params.rpt_id,
@@ -327,16 +422,18 @@ module.exports = {
             orientation = req.params.orientation,
             orientation = req.params.orientation,
             rptName = req.params.rptName,
             rptName = req.params.rptName,
             isOneSheet = req.params.isOneSheet,
             isOneSheet = req.params.isOneSheet,
-            option = req.params.option;
+            option = req.params.option
+        ;
+        let customizeCfg = null;
         let user_id = req.session.sessionUser.id;
         let user_id = req.session.sessionUser.id;
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
-        getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, null, dftOption, function(err, pageRst){
+        getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, function(err, pageRst){
             try {
             try {
-                rpt_xl_util.exportExcel(pageRst, pageSize, rptName, isOneSheet, null, null, function(newName){
+                rpt_xl_util.exportExcel(pageRst, pageSize, rptName, isOneSheet, null, null, function(uuidName){
                     res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                     res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                     let rptNameURI = encodeURI(rptName);
                     let rptNameURI = encodeURI(rptName);
                     res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".xlsx\"; filename*=utf-8''" + rptNameURI + '.xlsx' );
                     res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".xlsx\"; filename*=utf-8''" + rptNameURI + '.xlsx' );
-                    let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + newName + '.xlsx');
+                    let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + uuidName + '.xlsx');
                     filestream.on('data', function(chunk) {
                     filestream.on('data', function(chunk) {
                         res.write(chunk);
                         res.write(chunk);
                     });
                     });
@@ -356,10 +453,10 @@ module.exports = {
             rptName = req.params.rptName,
             rptName = req.params.rptName,
             option = req.params.option;
             option = req.params.option;
         let user_id = req.session.sessionUser.id;
         let user_id = req.session.sessionUser.id;
-        let parallelFucs = [];
+        let parallelFunctions = [];
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         for (let id of rpt_ids) {
         for (let id of rpt_ids) {
-            parallelFucs.push((function (rpt_id) {
+            parallelFunctions.push((function (rpt_id) {
                 return function (cb) {
                 return function (cb) {
                     getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, null, null, dftOption, function (err, pageRst) {
                     getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, null, null, dftOption, function (err, pageRst) {
                         if(err){
                         if(err){
@@ -372,7 +469,7 @@ module.exports = {
                 }
                 }
             })(parseInt(id)));
             })(parseInt(id)));
         }
         }
-        async.parallel(parallelFucs, function (err, pageRstArray) {
+        async.parallel(parallelFunctions, function (err, pageRstArray) {
             if (err) {
             if (err) {
                 callback(req, res, '数据有误', null);
                 callback(req, res, '数据有误', null);
             } else {
             } else {
@@ -391,6 +488,82 @@ module.exports = {
             }
             }
         })
         })
     },
     },
+    createPdfFiles: function (req, res) {
+        let params = JSON.parse(req.body.params),
+            prj_id = params.prj_id,
+            rpt_ids = params.rpt_ids,
+            rpt_names = params.rpt_names,
+            pageSize = params.pageSize,
+            orientation = params.orientation,
+            customizeCfg = params.custCfg,
+            option = params.option;
+        let user_id = req.session.sessionUser.id;
+        let parallelFunctions = [];
+        let dftOption = option||JV.PAGING_OPTION_NORMAL;
+        for (let idx = 0; idx < rpt_ids.length; idx++) {
+            let r_id = rpt_ids[idx];
+            let r_name = rpt_names[idx];
+            parallelFunctions.push((function (rpt_id, rpt_name) {
+                return function (cb) {
+                    getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, customizeCfg, dftOption, function (err, pageRst) {
+                        if(err){
+                            cb(err);
+                        }
+                        else{
+                            rpt_pdf_util.export_pdf_file(pageRst, pageSize, rpt_name, function(uuidName){
+                                let fileRst = {uuid: uuidName, reportName: rpt_name};
+                                cb(err, fileRst);
+                            })
+                        }
+                    })
+                }
+            })(parseInt(r_id), r_name));
+        }
+        async.parallel(parallelFunctions, function (err, fileRstArray) {
+            if (err) {
+                callback(req, res, '数据有误', null);
+            } else {
+                // console.log(err);
+                callback(req, res, err, fileRstArray);
+            }
+        })
+    },
+    getPDF:function (req, res) {
+        let prj_id = req.params.prj_id,
+            rpt_id = req.params.rpt_id,
+            pageSize = req.params.size,
+            orientation = req.params.orientation,
+            rptName = req.params.rptName
+        ;
+        let user_id = req.session.sessionUser.id;
+        getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, null, JV.PAGING_OPTION_NORMAL, function(err, pageRst){
+            rpt_pdf_util.export_pdf_file(pageRst, pageSize, rptName,function (uuidName) {
+                res.setHeader('Content-Type', 'application/vnd.openxmlformats');
+                // res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".pdf");
+                let rptNameURI = encodeURI(rptName);
+                res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".pdf\"; filename*=utf-8''" + rptNameURI + ".pdf" );
+
+                let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + uuidName + '.pdf');
+                filestream.on('data', function(chunk) {
+                    res.write(chunk);
+                });
+                filestream.on('end', function() {
+                    res.end();
+                });
+            })
+
+        })
+
+    },
+
+    getTestReportAllPages: function(req, res){
+        let rpt_id = req.body.ID;
+        let pageSize = req.body.pageSize;
+        getAllPagesCommonOrg(rpt_id, pageSize, JV.PAGING_OPTION_NORMAL, function(err, pageRst){
+            //fs.writeFileSync('D:/GitHome/ConstructionOperation/tmp/testRpt.js', JSON.stringify(pageRst));
+            callback(req, res, err, pageRst);
+        })
+    },
     getTestExcel: function(req, res) {
     getTestExcel: function(req, res) {
         let rpt_id = req.params.id,
         let rpt_id = req.params.id,
             pageSize = req.params.size,
             pageSize = req.params.size,
@@ -401,10 +574,10 @@ module.exports = {
         getAllPagesCommonOrg(rpt_id, pageSize, dftOption, function(err, pageRst){
         getAllPagesCommonOrg(rpt_id, pageSize, dftOption, function(err, pageRst){
             fs.writeFileSync('D:/GitHome/ConstructionOperation/tmp/testRpt.js', JSON.stringify(pageRst));
             fs.writeFileSync('D:/GitHome/ConstructionOperation/tmp/testRpt.js', JSON.stringify(pageRst));
             try {
             try {
-                rpt_xl_util.exportExcel(pageRst, pageSize, rptName, isOneSheet, null, null, function(newName){
+                rpt_xl_util.exportExcel(pageRst, pageSize, rptName, isOneSheet, null, null, function(uuidName){
                     res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                     res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                     res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".xlsx");
                     res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".xlsx");
-                    let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + newName + '.xlsx');
+                    let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + uuidName + '.xlsx');
                     filestream.on('data', function(chunk) {
                     filestream.on('data', function(chunk) {
                         res.write(chunk);
                         res.write(chunk);
                     });
                     });
@@ -422,10 +595,10 @@ module.exports = {
             pageSize = req.params.size,
             pageSize = req.params.size,
             rptName = req.params.rptName,
             rptName = req.params.rptName,
             option = req.params.option;
             option = req.params.option;
-        let parallelFucs = [];
+        let parallelFunctions = [];
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         let dftOption = option||JV.PAGING_OPTION_NORMAL;
         for (let id of rpt_ids) {
         for (let id of rpt_ids) {
-            parallelFucs.push((function (rpt_id) {
+            parallelFunctions.push((function (rpt_id) {
                 return function (cb) {
                 return function (cb) {
                     getAllPagesCommonOrg(rpt_id, pageSize, dftOption, function (err, pageRst) {
                     getAllPagesCommonOrg(rpt_id, pageSize, dftOption, function (err, pageRst) {
                         if(err){
                         if(err){
@@ -438,7 +611,7 @@ module.exports = {
                 }
                 }
             })(parseInt(id)));
             })(parseInt(id)));
         }
         }
-        async.parallel(parallelFucs, function (err, pageRstArray) {
+        async.parallel(parallelFunctions, function (err, pageRstArray) {
             if (err) {
             if (err) {
                 callback(req, res, '数据有误', null);
                 callback(req, res, '数据有误', null);
             } else {
             } else {
@@ -457,46 +630,19 @@ module.exports = {
             }
             }
         })
         })
     },
     },
-    getPDF:function (req, res) {
-        let prj_id = req.params.prj_id,
-            rpt_id = req.params.rpt_id,
-            pageSize = req.params.size,
-            orientation = req.params.orientation,
-            rptName = req.params.rptName
-        ;
-        let user_id = req.session.sessionUser.id;
-        getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, null, JV.PAGING_OPTION_NORMAL, function(err, pageRst){
-            rpt_pdf_util.export_pdf_file(pageRst, pageSize, rptName,function (newName) {
-                res.setHeader('Content-Type', 'application/vnd.openxmlformats');
-                // res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".pdf");
-                let rptNameURI = encodeURI(rptName);
-                res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".pdf\"; filename*=utf-8''" + rptNameURI + ".pdf" );
-
-                let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + newName + '.pdf');
-                filestream.on('data', function(chunk) {
-                    res.write(chunk);
-                });
-                filestream.on('end', function() {
-                    res.end();
-                });
-            })
-
-        })
-
-    },
     getTestPDF:function (req, res) {
     getTestPDF:function (req, res) {
         let rpt_id = req.params.id,
         let rpt_id = req.params.id,
             pageSize = req.params.size,
             pageSize = req.params.size,
             rptName = req.params.rptName;
             rptName = req.params.rptName;
 
 
         getAllPagesCommonOrg(rpt_id, pageSize, JV.PAGING_OPTION_NORMAL, function(err, pageRst){
         getAllPagesCommonOrg(rpt_id, pageSize, JV.PAGING_OPTION_NORMAL, function(err, pageRst){
-            rpt_pdf_util.export_pdf_file(pageRst, pageSize, rptName,function (newName) {
+            rpt_pdf_util.export_pdf_file(pageRst, pageSize, rptName,function (uuidName) {
                 res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                 res.setHeader('Content-Type', 'application/vnd.openxmlformats');
                 // res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".pdf");
                 // res.setHeader("Content-Disposition", "attachment; filename=" + strUtil.getPinYinCamelChars(rptName) + ".pdf");
                 let rptNameURI = encodeURI(rptName);
                 let rptNameURI = encodeURI(rptName);
                 res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".pdf\"; filename*=utf-8''" + rptNameURI + ".pdf"  );
                 res.setHeader("Content-Disposition", "attachment; filename=\"" + rptNameURI + ".pdf\"; filename*=utf-8''" + rptNameURI + ".pdf"  );
 
 
-                let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + newName + '.pdf');
+                let filestream = fs.createReadStream(__dirname.slice(0, __dirname.length - 28) + '/tmp/' + uuidName + '.pdf');
                 filestream.on('data', function(chunk) {
                 filestream.on('data', function(chunk) {
                     res.write(chunk);
                     res.write(chunk);
                 });
                 });

+ 5 - 1
modules/reports/routes/report_router.js

@@ -27,10 +27,14 @@ module.exports =function (app) {
     rptRouter.post('/getReport', reportController.getReportAllPages);
     rptRouter.post('/getReport', reportController.getReportAllPages);
     rptRouter.post('/getReportSvg', reportController.getReportAllPagesSvg);
     rptRouter.post('/getReportSvg', reportController.getReportAllPagesSvg);
     rptRouter.post('/getMultiReports', reportController.getMultiReports);
     rptRouter.post('/getMultiReports', reportController.getMultiReports);
+    rptRouter.post('/createExcelFiles', reportController.createExcelFiles);
+    rptRouter.post('/createExcelFilesInOneBook', reportController.createExcelFilesInOneBook);
+    rptRouter.post('/createPdfFiles', reportController.createPdfFiles);
+
     rptRouter.get('/getExcelInOneBook/:prj_id/:rpt_ids/:size/:rptName/:option', reportController.getExcelInOneBook);
     rptRouter.get('/getExcelInOneBook/:prj_id/:rpt_ids/:size/:rptName/:option', reportController.getExcelInOneBook);
     rptRouter.get('/getExcel/:prj_id/:rpt_id/:size/:orientation/:rptName/:isOneSheet/:option', reportController.getExcel);
     rptRouter.get('/getExcel/:prj_id/:rpt_id/:size/:orientation/:rptName/:isOneSheet/:option', reportController.getExcel);
+    rptRouter.get('/getFileByUUID/:uuid/:rptName/:suffix', reportController.getFileByUUID);
     rptRouter.get('/getPDF/:prj_id/:rpt_id/:size/:orientation/:rptName', reportController.getPDF);
     rptRouter.get('/getPDF/:prj_id/:rpt_id/:size/:orientation/:rptName', reportController.getPDF);
-    // rptRouter.get('/getExcelInOneBook/:ids/:size/:rptName/:option', reportController.getExcelInOneBook);
 
 
     app.use("/report_api", rptRouter);
     app.use("/report_api", rptRouter);
 };
 };

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

@@ -9,6 +9,7 @@ let jpcCmnHelper = require('../rpt_component/helper/jpc_helper_common');
 let DPI = jpcCmnHelper.getScreenDPI()[0];
 let DPI = jpcCmnHelper.getScreenDPI()[0];
 let fsUtil = require('../../../public/fsUtil');
 let fsUtil = require('../../../public/fsUtil');
 const dftHeadXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
 const dftHeadXml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
+const uuidV1 = require('uuid/v1');
 
 
 function writeContentTypes(sheets, isSinglePage) {
 function writeContentTypes(sheets, isSinglePage) {
     let rst = [];
     let rst = [];
@@ -157,6 +158,9 @@ function writeStyles(stylesObj){
         if (strUtil.convertStrToBoolean(font[JV.FONT_PROPS[3]])) {
         if (strUtil.convertStrToBoolean(font[JV.FONT_PROPS[3]])) {
             rst.push('<b/>');
             rst.push('<b/>');
         }
         }
+        if (strUtil.convertStrToBoolean(font[JV.FONT_PROPS[4]])) {
+            rst.push('<i/>');
+        }
         if (strUtil.convertStrToBoolean(font[JV.FONT_PROPS[5]])) {
         if (strUtil.convertStrToBoolean(font[JV.FONT_PROPS[5]])) {
             rst.push('<u/>');
             rst.push('<u/>');
         }
         }
@@ -443,7 +447,8 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, ap
             if (sheetFont) {
             if (sheetFont) {
                 // if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
                 // if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.round(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
                 if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.floor(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
                 if (font[JV.FONT_PROPS[0]] === sheetFont[JV.FONT_PROPS[0]] && font.size === Math.floor(sheetFont[JV.FONT_PROPS[1]] * 3 / 4)
-                    && font[JV.FONT_PROPS[3]] === sheetFont[JV.FONT_PROPS[3]] && font[JV.FONT_PROPS[5]] === sheetFont[JV.FONT_PROPS[5]]) {
+                    && font[JV.FONT_PROPS[3]] === sheetFont[JV.FONT_PROPS[3]] && font[JV.FONT_PROPS[4]] === sheetFont[JV.FONT_PROPS[4]]
+                    && font[JV.FONT_PROPS[5]] === sheetFont[JV.FONT_PROPS[5]] ) {
                     hasFont = true;
                     hasFont = true;
                     rst = i;
                     rst = i;
                     break;
                     break;
@@ -460,6 +465,7 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj, ap
             font.charset = 134;
             font.charset = 134;
             font.colorIdx = "8";
             font.colorIdx = "8";
             font[JV.FONT_PROPS[3]] = sheetFont[JV.FONT_PROPS[3]]; //font bold
             font[JV.FONT_PROPS[3]] = sheetFont[JV.FONT_PROPS[3]]; //font bold
+            font[JV.FONT_PROPS[4]] = sheetFont[JV.FONT_PROPS[4]]; //font italic
             font[JV.FONT_PROPS[5]] = sheetFont[JV.FONT_PROPS[5]]; //font underline
             font[JV.FONT_PROPS[5]] = sheetFont[JV.FONT_PROPS[5]]; //font underline
             stylesObj.fonts.push(font);
             stylesObj.fonts.push(font);
             rst = stylesObj.fonts.length - 1;
             rst = stylesObj.fonts.length - 1;
@@ -818,7 +824,7 @@ function mergeProperties(orgObj, newObj) {
 module.exports = {
 module.exports = {
     exportExcel: function (pageData, paperSize, fName, options, custSheetNames, custSheetMergeBands, callback) {
     exportExcel: function (pageData, paperSize, fName, options, custSheetNames, custSheetMergeBands, callback) {
         let rptOptions = ({singlePage: false, fileName: 'report'});
         let rptOptions = ({singlePage: false, fileName: 'report'});
-        if (options === 'true') {
+        if (options === 'true' || options === true) {
             rptOptions.singlePage = true;
             rptOptions.singlePage = true;
         }
         }
         let isSinglePage = rptOptions.singlePage;
         let isSinglePage = rptOptions.singlePage;
@@ -891,7 +897,9 @@ module.exports = {
         zip_xl.file(file, data.join(''), {compression: 'DEFLATE'});
         zip_xl.file(file, data.join(''), {compression: 'DEFLATE'});
 
 
         if (fName) {
         if (fName) {
-            let newName = '' + (new Date()).valueOf();
+            // let newName = '' + (new Date()).valueOf();
+            let newName = uuidV1();
+
             zip.generateNodeStream({type:'nodebuffer',streamFiles:true})
             zip.generateNodeStream({type:'nodebuffer',streamFiles:true})
                 .pipe(fs.createWriteStream(__dirname.slice(0, __dirname.length - 21) + '/tmp/' + newName + '.xlsx'))
                 .pipe(fs.createWriteStream(__dirname.slice(0, __dirname.length - 21) + '/tmp/' + newName + '.xlsx'))
                 .on('finish', function () {
                 .on('finish', function () {

+ 5 - 4
modules/reports/util/rpt_pdf_util.js

@@ -10,22 +10,23 @@ let fs = require('fs');
 let jpcCmnHelper = require('../rpt_component/helper/jpc_helper_common');
 let jpcCmnHelper = require('../rpt_component/helper/jpc_helper_common');
 let DPI = jpcCmnHelper.getScreenDPI()[0];
 let DPI = jpcCmnHelper.getScreenDPI()[0];
 let JV = require('../rpt_component/jpc_value_define');
 let JV = require('../rpt_component/jpc_value_define');
+const uuidV1 = require('uuid/v1');
 
 
 // hwxsb.ttf: 华文中宋
 // hwxsb.ttf: 华文中宋
 // Smart.ttf: 宋体(常规)
 // Smart.ttf: 宋体(常规)
 // Smart-italic.ttf: 宋体(斜体)
 // Smart-italic.ttf: 宋体(斜体)
-//目前不支持下划线
+// 目前不支持下划线
 
 
-module.exports ={
+module.exports = {
     export_pdf_file:export_pdf_file
     export_pdf_file:export_pdf_file
 }
 }
 
 
-
 function export_pdf_file (pageData, paperSize, fName, callback) {
 function export_pdf_file (pageData, paperSize, fName, callback) {
     let offsetX= 10;
     let offsetX= 10;
     let offsetY=10;
     let offsetY=10;
     let doc = new pdf({autoFirstPage: false});
     let doc = new pdf({autoFirstPage: false});
-    let newName = '' + (new Date()).valueOf();
+    // let newName = '' + (new Date()).valueOf();
+    let newName = uuidV1();
     let stream = doc.pipe(fs.createWriteStream(__dirname.slice(0, __dirname.length - 21) + '/tmp/'+newName+'.pdf'));
     let stream = doc.pipe(fs.createWriteStream(__dirname.slice(0, __dirname.length - 21) + '/tmp/'+newName+'.pdf'));
     let pageObj = pageData;
     let pageObj = pageData;
     // doc.rect(5,5,1190,890).lineWidth(1).strokeColor('black').stroke();//边框
     // doc.rect(5,5,1190,890).lineWidth(1).strokeColor('black').stroke();//边框

+ 1 - 0
public/scHintBox.html

@@ -6,6 +6,7 @@
         2、有两个按钮的操作确认询问框。
         2、有两个按钮的操作确认询问框。
         3、有三个按钮的多分支选择询问框。
         3、有三个按钮的多分支选择询问框。
         4、输入文本值对话框。
         4、输入文本值对话框。
+   使用示例:ConstructionCost/test/public/test_Box.html (直接运行该文件查看效果)
 ----------------------------------------------------------------------------------------------------------------------->
 ----------------------------------------------------------------------------------------------------------------------->
 <div class="modal fade" id="hintBox_form" data-backdrop="static" style="z-index: 9999">
 <div class="modal fade" id="hintBox_form" data-backdrop="static" style="z-index: 9999">
     <div class="modal-dialog" role="document">
     <div class="modal-dialog" role="document">

+ 2 - 4
public/web/sheet/sheet_common.js

@@ -65,6 +65,7 @@ var sheetCommonObj = {
         var me = this, ch = GC.Spread.Sheets.SheetArea.colHeader;
         var me = this, ch = GC.Spread.Sheets.SheetArea.colHeader;
         for (var i = 0; i < setting.header.length; i++) {
         for (var i = 0; i < setting.header.length; i++) {
             sheet.setValue(0, i, setting.header[i].headerName, ch);
             sheet.setValue(0, i, setting.header[i].headerName, ch);
+            sheet.getCell(0, i, ch).wordWrap(true);
             sheet.setColumnWidth(i, setting.header[i].headerWidth?setting.header[i].headerWidth:100);
             sheet.setColumnWidth(i, setting.header[i].headerWidth?setting.header[i].headerWidth:100);
             sheet.setColumnVisible(i,setting.header[i].visible === false ? false:true);
             sheet.setColumnVisible(i,setting.header[i].visible === false ? false:true);
         }
         }
@@ -128,9 +129,6 @@ var sheetCommonObj = {
             vAlign = setting.header[col].vAlign?setting.header[col].vAlign:vAlign;
             vAlign = setting.header[col].vAlign?setting.header[col].vAlign:vAlign;
             me.setAreaAlign(sheet.getRange(-1, col, -1, 1), hAlign, vAlign);
             me.setAreaAlign(sheet.getRange(-1, col, -1, 1), hAlign, vAlign);
             if (setting.header[col].formatter) {
             if (setting.header[col].formatter) {
-                //var style = new GC.Spread.Sheets.Style();
-                //style.formatter = setting.header[col].formatter;
-                //sheet.setStyle(row,col,style,GC.Spread.Sheets.SheetArea.viewport);
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
                 sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
             }
             }
             if(setting.header[col].cellType === "checkBox"||setting.header[col].cellType === "button"){//clear and reset
             if(setting.header[col].cellType === "checkBox"||setting.header[col].cellType === "button"){//clear and reset
@@ -143,7 +141,7 @@ var sheetCommonObj = {
             if(setting.header[col].visible === false){
             if(setting.header[col].visible === false){
                 sheet.setColumnVisible(col,false);
                 sheet.setColumnVisible(col,false);
             }
             }
-
+            sheet.getCell(0, col, GC.Spread.Sheets.SheetArea.colHeader).wordWrap(true);
         }
         }
         for (var row = 0; row < data.length; row++) {
         for (var row = 0; row < data.length; row++) {
             //var cell = sheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport);
             //var cell = sheet.getCell(row, col, GC.Spread.Sheets.SheetArea.viewport);

+ 87 - 43
public/web/tree_sheet/tree_sheet_helper.js

@@ -150,10 +150,22 @@ var TREE_SHEET_HELPER = {
                     }
                     }
                     return data;
                     return data;
                 };
                 };
-                if(colSetting.data.field=="quantity"){
-                    let tag = node.data.quantityEXP?node.data.quantityEXP:'';
-                    sheet.setTag(iRow, iCol,tag);
+                if(sheet.name()=="mainSheet"){
+                    if(colSetting.data.field=="quantity"){
+                        let tag = node.data.quantityEXP?node.data.quantityEXP:'';
+                        sheet.setTag(iRow, iCol,tag);
+                    }
+                    if(colSetting.data.field=="code"){
+                        let tag = node.data.adjustState?node.data.adjustState:'';
+                        sheet.setTag(iRow, iCol,tag);
+                    }
+                    if(colSetting.data.field=="name"){
+                        let tag = node.data.itemCharacterText?node.data.itemCharacterText:'';
+                        sheet.setTag(iRow, iCol,tag);
+                    }
+
                 }
                 }
+
                 if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
                 if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
                     cell.value(colSetting.data.getText(node));
                     cell.value(colSetting.data.getText(node));
                 } else {
                 } else {
@@ -352,6 +364,22 @@ var TREE_SHEET_HELPER = {
                 hitinfo.sheet.repaint();
                 hitinfo.sheet.repaint();
             }
             }
         };
         };
+        TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
+            let text = hitinfo.sheet.getText(hitinfo.row, hitinfo.col);
+            let tag = hitinfo.sheet.getTag(hitinfo.row, hitinfo.col);
+            if(tag){
+                TREE_SHEET_HELPER.showTipsDiv(tag,setting,hitinfo);
+            }
+        };
+        TreeNodeCellType.prototype.processMouseLeave = function (hitinfo) {
+            let me = this;
+            TREE_SHEET_HELPER.tipDiv = 'hide';
+            if (me._toolTipElement) {
+                $(me._toolTipElement).hide();
+                me._toolTipElement = null;
+            };
+            TREE_SHEET_HELPER.tipDivCheck();//延时检查:当tips正在show的时候,就调用了hide方法,会导致tips一直存在,所以设置一个超时处理
+        };
 
 
         let TipCellType = function () {};
         let TipCellType = function () {};
         TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
         TipCellType.prototype = new GC.Spread.Sheets.CellTypes.Text();
@@ -380,52 +408,27 @@ var TREE_SHEET_HELPER = {
             if(hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){
             if(hitinfo.sheet.getCell(hitinfo.row,hitinfo.col).wordWrap()==true){
                 return;
                 return;
             }
             }
-            if(dataField === 'name' || dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'){
+            if(dataField === 'itemCharacterText' || dataField === 'jobContentText' || dataField === 'adjustState'){
                 if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
                 if((hitinfo.sheet.getParent() === projectObj.mainSpread||hitinfo.sheet.getParent() === tender_obj.tenderSpread) && textLength <= cellWidth)
                  return;
                  return;
             }
             }
-            if(dataField=="quantity"){
-                text = tag;
-            }else if(tag !== undefined && tag) {
-                text = tag;
-            }
-            if (setting.pos && text && text !== '') {
-                if (!this._toolTipElement) {
-                    let div = $('#autoTip')[0];
-                    if (!div) {
-                        div = document.createElement("div");
-                        $(div).css("position", "absolute")
-                            .css("border", "1px #C0C0C0 solid")
-                            .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
-                            .css("font", "9pt Arial")
-                            .css("background", "white")
-                            .css("padding", 5)
-                            .attr("id", 'autoTip');
-                        $(div).hide();
-                        document.body.insertBefore(div, null);
-                    }
-                    this._toolTipElement = div;
-                    //实时读取位置信息
-                    if(sheet && sheet.getParent().qo){
-                        setting.pos = SheetDataHelper.getObjPos(sheet.getParent().qo);
-                    }
-                    $(this._toolTipElement).text(text);
-                    //清单指引、清单库做特殊处理
-                    if($(sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
-                        $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
-                        let marginLeftMouse;
-                        if($(this._toolTipElement).width() < hitinfo.x){
-                            marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
-                        }
-                       $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
-                    }
-                    else {
-                        $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+
+            if(hitinfo.sheet.name()=="mainSheet"){
+                if(dataField=="quantity"){//显示工程量明细
+                    text = tag;
+                }if(dataField=="name"){//项目特征及内容隐藏时,显示特征及内容
+                    if(projectObj.ifItemCharHiden(setting)&&tag!=''){
+                        text = tag;
+                    }else if(textLength <= cellWidth){
+                        return;
                     }
                     }
-                    $(this._toolTipElement).show("fast");
-                    TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+                }
+                else if(tag !== undefined && tag) {
+                    text = tag;
                 }
                 }
             }
             }
+
+            TREE_SHEET_HELPER.showTipsDiv(text,setting,hitinfo);
         };
         };
         TipCellType.prototype.processMouseLeave = function (hitinfo) {
         TipCellType.prototype.processMouseLeave = function (hitinfo) {
             let me = this;
             let me = this;
@@ -460,6 +463,47 @@ var TREE_SHEET_HELPER = {
             TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
             TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, sheet, true);
         });
         });
     },
     },
+    showTipsDiv:function (text,setting,hitinfo) {
+        if (setting.pos && text && text !== '') {
+            if (!this._toolTipElement) {
+                let div = $('#autoTip')[0];
+                if (!div) {
+                    div = document.createElement("div");
+                    $(div).css("position", "absolute")
+                        .css("border", "1px #C0C0C0 solid")
+                        .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
+                        .css("font", "9pt Arial")
+                        .css("background", "white")
+                        .css("padding", 5)
+                        .attr("id", 'autoTip');
+                    $(div).hide();
+                    document.body.insertBefore(div, null);
+                }
+                this._toolTipElement = div;
+                //实时读取位置信息
+                if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
+                    setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
+                }
+                $(this._toolTipElement).text(text);
+                //清单指引、清单库做特殊处理
+                if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
+                    $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
+                    let marginLeftMouse;
+                    if($(this._toolTipElement).width() < hitinfo.x){
+                        marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
+                    }
+                    $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
+                }
+                else {
+                    $(this._toolTipElement).css("top", setting.pos.y + hitinfo.y + 15).css("left", setting.pos.x + hitinfo.x + 15);
+                }
+                $(this._toolTipElement).show("fast");
+                TREE_SHEET_HELPER.tipDiv = 'show';//做个标记
+            }
+        }
+    },
+
+
     tipDivCheck(){
     tipDivCheck(){
         setTimeout(function () {
         setTimeout(function () {
             let tips = $('#autoTip');
             let tips = $('#autoTip');

+ 1 - 1
test/public/test_Box.html

@@ -40,7 +40,7 @@
             });
             });
 
 
             $("#btnD").click(function(){
             $("#btnD").click(function(){
-                hintBox.valueBox('请输入新名称222:', '我的模板1xxxx', function () {
+                hintBox.valueBox('请输入新名称:', '111', function () {
                     let newName = hintBox.value;
                     let newName = hintBox.value;
 
 
                     if (newName == '') {
                     if (newName == '') {

+ 2 - 1
web/building_saas/main/js/models/main_consts.js

@@ -169,7 +169,8 @@ const rationType = {
 const rationPrefix = { //定额前缀,补/借
 const rationPrefix = { //定额前缀,补/借
     none: '',
     none: '',
     complementary: '补',
     complementary: '补',
-    borrow: '借'
+    borrow: '借',
+    replace: '换'
 };
 };
 const rationFrom = {
 const rationFrom = {
     std: 'std',
     std: 'std',

+ 15 - 5
web/building_saas/main/js/models/project_glj.js

@@ -177,12 +177,12 @@ ProjectGLJ.prototype.loadCacheData = function (resort) {
     }
     }
 };
 };
 
 
-ProjectGLJ.prototype.updatePriceFromRG = function (recode, updateField, newval) {
+ProjectGLJ.prototype.updatePriceFromRG = function (recode, updateField, newval,callback) {
     if (updateField == 'marketPrice') {
     if (updateField == 'marketPrice') {
-        this.updatePrice(recode, "market_price", newval,"rg");
+        this.updatePrice(recode, "market_price", newval,"rg",callback);
     }
     }
     if (updateField == 'basePrice') {
     if (updateField == 'basePrice') {
-        this.updatePrice(recode, "base_price", newval,"rg");
+        this.updatePrice(recode, "base_price", newval,"rg",callback);
     }
     }
 };
 };
 
 
@@ -257,6 +257,15 @@ ProjectGLJ.prototype.updateGLJProperty = function (node, updateField, newval) {
 
 
 }
 }
 
 
+ProjectGLJ.prototype.getPriceDecimal = function (glj) {//价格的小数位数,有无组成物,取值不同
+    if(notEditType.indexOf(glj.unit_price.type)!=-1&&glj.ratio_data.length>0){
+         return getDecimal("glj.unitPriceHasMix");
+    }else {
+        return getDecimal('glj.unitPrice');
+    }
+
+};
+
 ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb) {
 ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb) {
     let me = this;
     let me = this;
     let projectGljs = this.datas.gljList;
     let projectGljs = this.datas.gljList;
@@ -266,6 +275,7 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb
         if(glj.unit_price[updateField] == newval){
         if(glj.unit_price[updateField] == newval){
             return;
             return;
         }
         }
+        newval = scMathUtil.roundForObj(newval,this.getPriceDecimal(glj));
         let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id,unit_price_file_id:glj.unit_price.unit_price_file_id};
         let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id,unit_price_file_id:glj.unit_price.unit_price_file_id};
         let callback = function (data) {
         let callback = function (data) {
             if (updateField == 'base_price') {
             if (updateField == 'base_price') {
@@ -348,7 +358,6 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
 ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,sheetName,callback) {
 ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,sheetName,callback) {
     let me = this;
     let me = this;
     let projectGljs = me.datas.gljList;
     let projectGljs = me.datas.gljList;
-    let decimal = getDecimal('glj.unitPrice');
     let updateData = [];
     let updateData = [];
     let newValueMap = {};
     let newValueMap = {};
     let gljs=[];
     let gljs=[];
@@ -362,9 +371,10 @@ ProjectGLJ.prototype.batchUpdatePrice = function (changeInfo,sheetName,callback)
         let recode = sheetName =="materialTreeSheet"?projectGljObject.materialTree.items[ci.row].data:projectGljObject.projectGljSheetData[ci.row];
         let recode = sheetName =="materialTreeSheet"?projectGljObject.materialTree.items[ci.row].data:projectGljObject.projectGljSheetData[ci.row];
         if(dataCode=='basePrice'||dataCode=='marketPrice'){
         if(dataCode=='basePrice'||dataCode=='marketPrice'){
             let editField = dataCode === 'basePrice'?"base_price":"market_price";
             let editField = dataCode === 'basePrice'?"base_price":"market_price";
-            let newValue= scMathUtil.roundForObj(ci.value,decimal);
             let glj = _.find(projectGljs, {'id': recode.id});
             let glj = _.find(projectGljs, {'id': recode.id});
+            let newValue = ci.value;
             if(glj&&glj.unit_price[editField]!=newValue){
             if(glj&&glj.unit_price[editField]!=newValue){
+                newValue= scMathUtil.roundForObj(ci.value,this.getPriceDecimal(glj));
                 updateData.push({unit_price: glj.unit_price, field: editField, newval: newValue,project_id:glj.project_id});
                 updateData.push({unit_price: glj.unit_price, field: editField, newval: newValue,project_id:glj.project_id});
                 newValueMap[glj.id]={field:editField,value:newValue};
                 newValueMap[glj.id]={field:editField,value:newValue};
                 gljs.push(glj);
                 gljs.push(glj);

+ 2 - 2
web/building_saas/main/js/models/ration.js

@@ -544,7 +544,7 @@ var Ration = {
                 })
                 })
             }
             }
         };
         };
-        ration.prototype.addNewRation = function (itemQuery,rationType,callback=null) {
+        ration.prototype.addNewRation = function (itemQuery,rationType,callback=null,isEmpty=false) {
             let me = this;
             let me = this;
             let project = projectObj.project, sheetController = projectObj.mainController;
             let project = projectObj.project, sheetController = projectObj.mainController;
             let engineering = projectInfoObj.projectInfo.property.engineering;
             let engineering = projectInfoObj.projectInfo.property.engineering;
@@ -575,7 +575,7 @@ var Ration = {
             };
             };
             if(billItemID){
             if(billItemID){
                 let newData =  me.getTempRationData(me.getNewRationID(), billItemID, serialNo, rationType);
                 let newData =  me.getTempRationData(me.getNewRationID(), billItemID, serialNo, rationType);
-                let calQuantity = optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
+                let calQuantity =  isEmpty===true?false:optionsOprObj.getOption(optionsOprObj.optionsTypes.GENERALOPTS, 'rationQuanACToBillsQuan');
                 let brUpdate = [];
                 let brUpdate = [];
                 //更新兄弟节点的序列号
                 //更新兄弟节点的序列号
                 if (pre) {
                 if (pre) {

+ 1 - 1
web/building_saas/main/js/views/glj_view.js

@@ -737,7 +737,7 @@ var gljOprObj = {
             if (args.editingText == null) {
             if (args.editingText == null) {
                 updateField == 'marketPrice' ? newval = 0 : newval = "";
                 updateField == 'marketPrice' ? newval = 0 : newval = "";
             } else {
             } else {
-                var decimal = updateField == 'customQuantity' ? getDecimal("glj.quantity") : getDecimal("glj.unitPrice");
+                var decimal = updateField == 'customQuantity' ? getDecimal("glj.quantity") : 6;//对于市场价和定额价,这里只是中间的小数位数,后面更新前会根据有没有组成物再取值
                 newval = number_util.checkNumberValue(args.editingText, decimal);
                 newval = number_util.checkNumberValue(args.editingText, decimal);
                 if (newval == null) {
                 if (newval == null) {
                     me.sheet.getCell(args.row, args.col).value(recode[updateField]);
                     me.sheet.getCell(args.row, args.col).value(recode[updateField]);

+ 9 - 2
web/building_saas/main/js/views/main_tree_col.js

@@ -45,11 +45,18 @@ let MainTreeCol = {
             if(!isDef(node)){
             if(!isDef(node)){
                 return '';
                 return '';
             }
             }
+
+            let rst = '';
             if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
             if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
                 && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== ''){
                 && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== ''){
-                return node.data.prefix + node.data.code.replace(new RegExp(node.data.prefix, 'g'), '');
+                rst = node.data.prefix + node.data.code.replace(new RegExp(node.data.prefix, 'g'), '');
             }
             }
-            return isDef(node.data.code) ? node.data.code : '';
+            else
+                rst = isDef(node.data.code) ? node.data.code : '';
+
+            if (node.data.adjustState && rst != '')
+                rst = rst + rationPrefix.replace;
+            return rst;
         },
         },
         marketPrice:function (node) {
         marketPrice:function (node) {
             if((node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type!=rationType.ration)||node.sourceType==projectObj.project.ration_glj.getSourceType()){
             if((node.sourceType === projectObj.project.Ration.getSourceType()&&node.data.type!=rationType.ration)||node.sourceType==projectObj.project.ration_glj.getSourceType()){

+ 1 - 7
web/building_saas/main/js/views/project_glj_view.js

@@ -67,12 +67,7 @@ projectGljObject={
         this.projectGljSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onProjectGljSelectionChange);
         this.projectGljSheet.bind(GC.Spread.Sheets.Events.SelectionChanged,this.onProjectGljSelectionChange);
         this.projectGljSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onProjectGljEditStarting);
         this.projectGljSheet.bind(GC.Spread.Sheets.Events.EditStarting,this.onProjectGljEditStarting);
         this.projectGljSheet.name('projectGljSheet');
         this.projectGljSheet.name('projectGljSheet');
-
         this.projectGljSheet.setRowHeight(0, 45, 1);
         this.projectGljSheet.setRowHeight(0, 45, 1);
-        let cell = this.projectGljSheet.getCell(0, 9, GC.Spread.Sheets.SheetArea.colHeader);
-        // console.log(cell.value());
-        cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center).vAlign(GC.Spread.Sheets.VerticalAlign.center).wordWrap(true);
-        // cell.wordWrap(true);
     },
     },
     initMixRatio:function () {
     initMixRatio:function () {
         let me = projectGljObject;
         let me = projectGljObject;
@@ -893,8 +888,7 @@ projectGljObject={
             }
             }
             gljOprObj.refreshView();
             gljOprObj.refreshView();
         };
         };
-        if(dataCode=='basePrice'||dataCode=='marketPrice'){
-            value= scMathUtil.roundForObj(value,getDecimal('glj.unitPrice'));//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
+        if(dataCode=='basePrice'||dataCode=='marketPrice'){//修改市场价和修改定额价时需要重新记算很多受影响的树节点,现在改成与定字额工料机那里调相同的方法。
             let editField = dataCode === 'basePrice'?"base_price":"market_price";
             let editField = dataCode === 'basePrice'?"base_price":"market_price";
             projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',callback);
             projectObj.project.projectGLJ.updatePrice(recode,editField,value,'pg',callback);
         }else {
         }else {

+ 26 - 18
web/building_saas/main/js/views/project_view.js

@@ -523,14 +523,13 @@ var projectObj = {
         let project = projectObj.project;
         let project = projectObj.project;
         let node = project.mainTree.items[info.row];
         let node = project.mainTree.items[info.row];
         let fieldName = projectObj.mainController.setting.cols[info.col].data.field;
         let fieldName = projectObj.mainController.setting.cols[info.col].data.field;
-        let orgV = info.sheet.getValue(info.row, info.col);
-        let newV;
-        if(node && node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
-            && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== rationPrefix.none && fieldName === 'code'){
-            if(node.data.prefix){
-                newV = orgV.replace(new RegExp(node.data.prefix), '');
-            }
-            info.sheet.setValue(info.row, info.col, newV);
+        let value = info.sheet.getValue(info.row, info.col);
+        if(fieldName === 'code' && node && calcTools.isRationItem(node) && isDef(node.data.code)){
+            if (isDef(node.data.prefix) && node.data.prefix !== rationPrefix.none){
+                value = value.replace(new RegExp(node.data.prefix), '');
+            };
+            value = value.replace(new RegExp(rationPrefix.replace), '');
+            info.sheet.setValue(info.row, info.col, value);
         }
         }
         if(node&&fieldName =='quantity'&&(node.data.quantityEXP !==null||node.data.quantityEXP !==undefined)){
         if(node&&fieldName =='quantity'&&(node.data.quantityEXP !==null||node.data.quantityEXP !==undefined)){
             info.sheet.setValue(info.row, info.col, node.data.quantityEXP);
             info.sheet.setValue(info.row, info.col, node.data.quantityEXP);
@@ -838,7 +837,7 @@ var projectObj = {
                             newCol = codeCol;
                             newCol = codeCol;
                         }
                         }
                         sheet.setActiveCell(newRow, newCol);
                         sheet.setActiveCell(newRow, newCol);
-                    });
+                    },true);
                 }
                 }
             }
             }
             //在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
             //在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
@@ -1025,7 +1024,7 @@ var projectObj = {
                         return !project.Ration.canAdd(project.mainTree.selected);
                         return !project.Ration.canAdd(project.mainTree.selected);
                     },
                     },
                     callback: function (key, opt) {
                     callback: function (key, opt) {
-                        project.Ration.addNewRation(null,rationType.ration);
+                        project.Ration.addNewRation(null,rationType.ration,null,true);
                        // ProjectController.addRation(project, controller, rationType.ration);
                        // ProjectController.addRation(project, controller, rationType.ration);
                     }/*,
                     }/*,
                     visible: function(key, opt){
                     visible: function(key, opt){
@@ -1042,7 +1041,7 @@ var projectObj = {
                         return !project.Ration.canAdd(project.mainTree.selected);
                         return !project.Ration.canAdd(project.mainTree.selected);
                     },
                     },
                     callback: function (key, opt) {
                     callback: function (key, opt) {
-                        project.Ration.addNewRation(null,rationType.volumePrice);
+                        project.Ration.addNewRation(null,rationType.volumePrice,null,true);
                        // ProjectController.addRation(project, controller, rationType.volumePrice);
                        // ProjectController.addRation(project, controller, rationType.volumePrice);
                     }/*,
                     }/*,
                     visible: function(key, opt){
                     visible: function(key, opt){
@@ -1159,10 +1158,11 @@ var projectObj = {
                     name: '编辑工程内容',
                     name: '编辑工程内容',
                     icon: 'fa-edit',
                     icon: 'fa-edit',
                     visible: function(key, opt){
                     visible: function(key, opt){
-                         return project.Bills.isEngineerEst(project.mainTree.selected);//当焦点行是“专业工程暂估价”时,右键可见并有效。
+                         let  selected = project.mainTree.selected;
+                         return selected.sourceType==ModuleNames.bills&&project.Bills.isEngineerEst(selected);//当焦点行是“专业工程暂估价”时,右键可见并有效。
                     },
                     },
                     callback: function () {
                     callback: function () {
-                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.ENGINEERING_ESITIMATE);
+                        let node = project.mainTree.selected;//project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.ENGINEERING_ESITIMATE);
                         if(node){
                         if(node){
                             projectObj.editContent(node,'engineeringContent');
                             projectObj.editContent(node,'engineeringContent');
                         }
                         }
@@ -1172,10 +1172,11 @@ var projectObj = {
                     name: '编辑服务内容',
                     name: '编辑服务内容',
                     icon: 'fa-edit',
                     icon: 'fa-edit',
                     visible: function(key, opt){
                     visible: function(key, opt){
-                        return project.Bills.isTotalService(project.mainTree.selected);//当焦点行是“总承包服务费”时,右键可见并有效。
+                        let  selected = project.mainTree.selected;
+                        return selected.sourceType==ModuleNames.bills&&project.Bills.isTotalService(selected);//当焦点行是“总承包服务费”时,右键可见并有效。
                     },
                     },
                     callback: function () {
                     callback: function () {
-                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.TURN_KEY_CONTRACT);
+                        let node = project.mainTree.selected;//project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.TURN_KEY_CONTRACT);
                         if(node){
                         if(node){
                             projectObj.editContent(node,'serviceContent');
                             projectObj.editContent(node,'serviceContent');
                         }
                         }
@@ -1185,10 +1186,11 @@ var projectObj = {
                     name: '编辑签证及索赔依据',
                     name: '编辑签证及索赔依据',
                     icon: 'fa-edit',
                     icon: 'fa-edit',
                     visible: function(key, opt){
                     visible: function(key, opt){
-                        return project.Bills.isClaimVisa(project.mainTree.selected);//当焦点行是“签证及索赔计价”时,右键可见并有效。
+                        let  selected = project.mainTree.selected;
+                        return selected.sourceType==ModuleNames.bills&&project.Bills.isClaimVisa(selected);//当焦点行是“签证及索赔计价”时,右键可见并有效。
                     },
                     },
                     callback: function () {
                     callback: function () {
-                        let node = project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.CLAIM_VISA);
+                        let node = project.mainTree.selected;//project.Bills.getNodeByFlag(project.mainTree.selected,fixedFlag.CLAIM_VISA);
                         if(node){
                         if(node){
                             projectObj.editContent(node,'claimVisa');
                             projectObj.editContent(node,'claimVisa');
                         }
                         }
@@ -1600,7 +1602,13 @@ var projectObj = {
             let newValue = hintBox.value;
             let newValue = hintBox.value;
             projectObj.updateNodeField(node,newValue,fieldID);
             projectObj.updateNodeField(node,newValue,fieldID);
         });
         });
-    }
+    },
+    ifItemCharHiden:function (setting) {//项目特征及内容列是否隐藏
+        let col = _.find(setting.cols,function (item) {
+            return  item.data.field == "itemCharacterText";
+        })
+        return !col.visible;
+    },
 
 
 };
 };
 
 

+ 3 - 1
web/building_saas/main/js/views/quantity_edit_view.js

@@ -188,11 +188,13 @@ let quantityEditObj = {
     },
     },
     checkingAndUpdate(quantityEXP,node){
     checkingAndUpdate(quantityEXP,node){
         let me = this;
         let me = this;
-        quantityEXP = quantityEXP?quantityEXP.toUpperCase():'';//非空判断
         if(quantityEXP === node.data.quantityEXP){ //没有变化,不做任何操作
         if(quantityEXP === node.data.quantityEXP){ //没有变化,不做任何操作
             projectObj.mainController.refreshTreeNode([node]);
             projectObj.mainController.refreshTreeNode([node]);
             return true;
             return true;
         }
         }
+        quantityEXP = quantityEXP?quantityEXP.toUpperCase():'';//非空判断
+        quantityEXP =replaceAll('(','(',quantityEXP);//转换中文左右符号
+        quantityEXP =replaceAll(')',')',quantityEXP);
         let value = me.evalQuantityExp(quantityEXP,node);
         let value = me.evalQuantityExp(quantityEXP,node);
         if(value!=='evalError'){
         if(value!=='evalError'){
             if(node.data.hasOwnProperty('isFromDetail')&&node.data.isFromDetail==1){
             if(node.data.hasOwnProperty('isFromDetail')&&node.data.isFromDetail==1){

+ 83 - 18
web/building_saas/report/js/rpt_main.js

@@ -350,28 +350,63 @@ let rptControlObj = {
     },
     },
     getAllInOneBook: function () {
     getAllInOneBook: function () {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
+            let me = rptControlObj;
             let orgRptName = projectInfoObj.projectInfo.name;
             let orgRptName = projectInfoObj.projectInfo.name;
             let refRptTplIds = [];
             let refRptTplIds = [];
             for (let node of zTreeOprObj.checkedRptTplNodes) {
             for (let node of zTreeOprObj.checkedRptTplNodes) {
                 refRptTplIds.push(node.refId);
                 refRptTplIds.push(node.refId);
             }
             }
-            window.location = "/report_api/getExcelInOneBook/" + projectInfoObj.projectInfo.ID + "/" + refRptTplIds.join(",") + "/" +
-                rptControlObj.getCurrentPageSize() + "/" + orgRptName + "/" + 'normal';
+            let params = {};
+            params.prj_id = projectInfoObj.projectInfo.ID;
+            params.rpt_ids = refRptTplIds;
+            params.rptName = orgRptName;
+            params.pageSize = me.getCurrentPageSize();
+            params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
+            params.custCfg = zTreeOprObj.reportPageCfg;
+            params.option = "normal";
+            CommonAjax.postEx("report_api/createExcelFilesInOneBook", params, 20000, true, function(result){
+                    if (result) {
+                        let uuIdUrls = [];
+                        let uuIdUrl =  "/report_api/getFileByUUID/" + result.uuid + "/" + result.reportName + "/xlsx";
+                        uuIdUrls.push(uuIdUrl);
+                        downloadReport(uuIdUrls);
+                    } else {
+                        //
+                    }
+                }, null, null
+            );
         }
         }
     },
     },
     getAllIndividualExcelBook: function () {
     getAllIndividualExcelBook: function () {
         let me = rptControlObj;
         let me = rptControlObj;
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
-            let urls = [];
-            let orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
-            if (zTreeOprObj.checkedRptTplNodes.length > 1) orientation = null;
+            let rpt_ids = [], rpt_names = [];
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
-                let orgRptName = tplNode.name;
-                let url =  "/report_api/getExcel/" + projectInfoObj.projectInfo.ID + "/" + tplNode.refId + "/" +
-                    me.getCurrentPageSize() + "/" + orientation + "/" + orgRptName + "/" + true + "/" + 'normal';
-                urls.push(url);
+                rpt_ids.push(tplNode.refId);
+                rpt_names.push(tplNode.name)
             }
             }
-            downloadReport(urls);
+            let params = {};
+            params.prj_id = projectInfoObj.projectInfo.ID;
+            params.rpt_ids = rpt_ids;
+            params.rpt_names = rpt_names;
+            params.pageSize = me.getCurrentPageSize();
+            params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
+            params.isOneSheet = true;
+            params.custCfg = zTreeOprObj.reportPageCfg;
+            params.option = "normal";
+            CommonAjax.postEx("report_api/createExcelFiles", params, 20000, true, function(result){
+                    if (result) {
+                        let uuIdUrls = [];
+                        for (let uuIdObj of result) {
+                            let uuIdUrl =  "/report_api/getFileByUUID/" + uuIdObj.uuid + "/" + uuIdObj.reportName + "/xlsx";
+                            uuIdUrls.push(uuIdUrl);
+                        }
+                        downloadReport(uuIdUrls);
+                    } else {
+                        //
+                    }
+                }, null, null
+            );
         }
         }
     },
     },
     checkAndGetExcel: function () {
     checkAndGetExcel: function () {
@@ -393,17 +428,47 @@ let rptControlObj = {
         }
         }
     },
     },
     getPDF: function() {
     getPDF: function() {
+        // let me = rptControlObj;
+        // if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
+        //     let urls = [];
+        //     let orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
+        //     for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
+        //         let orgRptName = tplNode.name;
+        //         let url =  "/report_api/getPDF/" + projectInfoObj.projectInfo.ID + "/" + tplNode.refId + "/" +
+        //             me.getCurrentPageSize() + "/" + orientation + "/" + orgRptName
+        //             // + "/" + encodeURI(JSON.stringify(zTreeOprObj.reportPageCfg));
+        //         urls.push(url);
+        //     }
+        //     downloadReport(urls);
+        // }
         let me = rptControlObj;
         let me = rptControlObj;
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
-            let urls = [];
-            let orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
+            let rpt_ids = [], rpt_names = [];
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
-                let orgRptName = tplNode.name;
-                let url =  "/report_api/getPDF/" + projectInfoObj.projectInfo.ID + "/" + tplNode.refId + "/" +
-                    me.getCurrentPageSize() + "/" + orientation + "/" + orgRptName;
-                urls.push(url);
+                rpt_ids.push(tplNode.refId);
+                rpt_names.push(tplNode.name)
             }
             }
-            downloadReport(urls);
+            let params = {};
+            params.prj_id = projectInfoObj.projectInfo.ID;
+            params.rpt_ids = rpt_ids;
+            params.rpt_names = rpt_names;
+            params.pageSize = me.getCurrentPageSize();
+            params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:me.getCurrentOrientation());
+            params.custCfg = zTreeOprObj.reportPageCfg;
+            params.option = "normal";
+            CommonAjax.postEx("report_api/createPdfFiles", params, 20000, true, function(result){
+                    if (result) {
+                        let uuIdUrls = [];
+                        for (let uuIdObj of result) {
+                            let uuIdUrl =  "/report_api/getFileByUUID/" + uuIdObj.uuid + "/" + uuIdObj.reportName + "/pdf";
+                            uuIdUrls.push(uuIdUrl);
+                        }
+                        downloadReport(uuIdUrls);
+                    } else {
+                        //
+                    }
+                }, null, null
+            );
         }
         }
     },
     },
     firstPage: function(dom) {
     firstPage: function(dom) {
@@ -527,4 +592,4 @@ function downloadReport(urls) {
         }
         }
     }
     }
     private_download();
     private_download();
-}
+}

+ 2 - 0
web/building_saas/report/js/rpt_print.js

@@ -7,6 +7,8 @@ let rptPrintHelper = {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
         if (zTreeOprObj.checkedRptTplNodes && zTreeOprObj.checkedRptTplNodes.length > 0) {
             let rptIds = [];
             let rptIds = [];
             let params = {};
             let params = {};
+            params.pageSize = rptControlObj.getCurrentPageSize();
+            params.orientation = ((zTreeOprObj.checkedRptTplNodes.length > 1)?null:rptControlObj.getCurrentOrientation());
             params.custCfg = zTreeOprObj.reportPageCfg;
             params.custCfg = zTreeOprObj.reportPageCfg;
             params.prj_id = projectInfoObj.projectInfo.ID;
             params.prj_id = projectInfoObj.projectInfo.ID;
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {
             for (let tplNode of zTreeOprObj.checkedRptTplNodes) {