Browse Source

为草图导出准备

TonyKang 5 years ago
parent
commit
c2b82039eb

+ 2 - 2
app/reports/rpt_component/helper/jpc_helper_discrete.js

@@ -103,10 +103,10 @@ const JpcDiscreteHelper = {
                                         signatureItem[JV.PROP_STYLE] = item[[JV.PROP_STYLE]];
                                         signatureItem[JV.PROP_AREA] = item[JV.PROP_AREA];
                                         signatureRst.push(signatureItem);
+                                        item[JV.PROP_VALUE] = '';
                                     }
-                                } else {
-                                    rst.push(item);
                                 }
+                                rst.push(item); // 不管是不是Pic,都得保留一个壳子
                             }
                         }
                     }

+ 2 - 2
app/reports/rpt_component/jpc_bill_tab.js

@@ -166,10 +166,10 @@ JpcBillTabSrv.prototype.createNew = function() {
                                 signatureItem[JV.PROP_STYLE] = cellItem[[JV.PROP_STYLE]];
                                 signatureItem[JV.PROP_AREA] = cellItem[JV.PROP_AREA];
                                 me.signatureRst.push(signatureItem);
+                                cellItem[JV.PROP_VALUE] = '';
                             }
-                        } else {
-                            rst.push(cellItem);
                         }
+                        rst.push(cellItem); // 不管是不是Pic,都得保留一个壳子
                     }
                 }
                 if (tab[JV.PROP_TEXT]) {

+ 2 - 1
app/reports/util/rpt_calculation_data_util.js

@@ -319,7 +319,8 @@ function filterData(sourceData, handleCfg, prjData) {
         let rst = false;
         if (arr.length > 0) {
             for (const arrItem of arr) {
-                if (arrItem[key]) {
+                if (arrItem[key] !== undefined) {
+                    // 可以为null值去判断
                     rst = private_chkVal(arrItem[key], compVal, compStr);
                 }
                 if (rst) {

+ 14 - 1
app/reports/util/rpt_excel_util.js

@@ -946,6 +946,7 @@ function writeWorkSheetRels(signSheetIdx) {
     rst.push('</Relationships>');
     return rst;
 }
+
 function writeImage(path, pic, baseDir) {
     let rst = null;
     if (pic) {
@@ -954,7 +955,9 @@ function writeImage(path, pic, baseDir) {
         // fs.createReadStream
     } else if (path) {
         const filePath = baseDir + '/app' + path;
+        // console.log(filePath);
         rst = fs.readFileSync(filePath);
+        // console.log(rst);
     }
     return rst;
 }
@@ -1236,10 +1239,13 @@ module.exports = {
         }
         resetDummuySignature(pageData, thisRoleRel); // 把草图转换一下roleRel
         // console.log(thisRoleRel);
+
+        const hasSignature = false; // 暂时不支持电子签名、草图导出excel
         // const hasSignature = checkAndSetSignatureCache(pageData, signKeyArr, signPathArr, thisRoleRel, signSheetIdxArr); // 因草图的关系,thisRoleRel是否为null就不是充要的条件
         // console.log('signKeyArr');
         // console.log(signKeyArr);
-        const hasSignature = false;
+        // console.log('signPathArr');
+        // console.log(signPathArr);
         // console.log('hasSignature: ' + hasSignature);
         if (isSinglePage) {
             sheets.push({ sheetName: '全部页' });
@@ -1259,11 +1265,13 @@ module.exports = {
         let data = writeContentTypes(sheets, isSinglePage, hasSignature);
         const zip = new JSZip();
         zip.file(file, data.join(''), { compression: 'DEFLATE' });
+        // console.log('step 1');
         // 2.
         const zip_rels = zip.folder('_rels');
         file = '.rels';
         data = writeRootRels();
         zip_rels.file(file, data.join(''), { compression: 'DEFLATE' });
+        // console.log('step 2');
         // 3.
         const zip_docProps = zip.folder('docProps');
         file = 'app.xml';
@@ -1272,6 +1280,7 @@ module.exports = {
         file = 'core.xml';
         data = writeCore();
         zip_docProps.file(file, data.join(''), { compression: 'DEFLATE' });
+        // console.log('step 3');
         // 4.
         const zip_xl = zip.folder('xl');
         file = 'workbook.xml';
@@ -1281,6 +1290,7 @@ module.exports = {
         file = 'workbook.xml.rels';
         data = writeXlRels(sheets, isSinglePage);
         zip_rels2.file(file, data.join(''), { compression: 'DEFLATE' });
+        // console.log('step 4');
         // 5.
         const zip_theme = zip_xl.folder('theme');
         file = 'theme1.xml';
@@ -1329,6 +1339,7 @@ module.exports = {
                 }
             }
         }
+        // console.log('step 5');
         // 6.
         const zip_xl_worksheets = zip_xl.folder('worksheets');
         const sharedStrList = [];
@@ -1345,6 +1356,7 @@ module.exports = {
                 zip_xl_worksheets.file(file, data[i].join(''), { compression: 'DEFLATE' });
             }
         }
+        // console.log('step 6');
         // 7.
         if (hasSignature) {
             const zip_xl_worksheets_rels = zip_xl_worksheets.folder('_rels');
@@ -1370,6 +1382,7 @@ module.exports = {
         file = 'styles.xml';
         data = writeStyles(stylesObj, hasSignature);
         zip_xl.file(file, data.join(''), { compression: 'DEFLATE' });
+        // console.log('step 7');
 
         if (fName) {
             // let newName = '' + (new Date()).valueOf();