gm-printer 10.13.10 → 10.13.11-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/package.json +1 -1
- package/src/finance_voucher/components/finance_batch_printer.js +36 -0
- package/src/finance_voucher/components/table.js +343 -0
- package/src/finance_voucher/components/table_subtotal_tr.js +146 -0
- package/src/finance_voucher/finance_printer.js +313 -0
- package/src/index.js +4 -2
- package/src/printer/do_print.js +31 -1
- package/src/printer/index.js +8 -2
- package/src/printer/store.js +64 -0
package/.eslintcache
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"/Users/min/Documents/GMFE/gm-util/gm-printer/src/util.js":"1","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/get_css.js":"2","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/barcode.js":"3","/Users/min/Documents/GMFE/gm-util/gm-printer/src/index.js":"4","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/context_menu.js":"5","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/context_menu.js":"6","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/context_menu.js":"7","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/context_menu.js":"8","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/context_menu.js":"9","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor_special_table.js":"10","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/context_menu.js":"11","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/context_menu.js":"12","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/context_menu.js":"13","/Users/min/Documents/GMFE/gm-util/gm-printer/src/config.js":"14","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_store.js":"15","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_shadow_dom.js":"16","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/get_editor_css.js":"17","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_title.js":"18","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_store.js":"19","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_select.js":"20","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_edit_field.js":"21","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/component.js":"22","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/editor.js":"23","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/editor.js":"24","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/editor.js":"25","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/editor.js":"26","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/editor.js":"27","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor.js":"28","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account_statement/editor.js":"29","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/editor.js":"30","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/editor.js":"31","/Users/min/Documents/GMFE/gm-util/gm-printer/src/components/tooltip/index.js":"32","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_special_field.js":"33"},{"size":7133,"mtime":1638862566087,"results":"34","hashOfConfig":"35"},{"size":291,"mtime":1638935573926,"results":"36","hashOfConfig":"35"},{"size":523,"mtime":1638935549030,"results":"37","hashOfConfig":"35"},{"size":1093,"mtime":1638861826721,"results":"38","hashOfConfig":"35"},{"size":2293,"mtime":1638948548042,"results":"39","hashOfConfig":"35"},{"size":2292,"mtime":1638948522492,"results":"40","hashOfConfig":"35"},{"size":1078,"mtime":1638948543271,"results":"41","hashOfConfig":"35"},{"size":2040,"mtime":1638948515902,"results":"42","hashOfConfig":"35"},{"size":2991,"mtime":1638948535719,"results":"43","hashOfConfig":"35"},{"size":4379,"mtime":1638935458586,"results":"44","hashOfConfig":"35"},{"size":2521,"mtime":1638948507982,"results":"45","hashOfConfig":"35"},{"size":2943,"mtime":1638948502114,"results":"46","hashOfConfig":"35"},{"size":3732,"mtime":1639722598379,"results":"47","hashOfConfig":"35"},{"size":2833,"mtime":1638861837310,"results":"48","hashOfConfig":"35"},{"size":4212,"mtime":1638935746667,"results":"49","hashOfConfig":"35"},{"size":861,"mtime":1638931446915,"results":"50","hashOfConfig":"35"},{"size":178,"mtime":1638931439249,"results":"51","hashOfConfig":"35"},{"size":3272,"mtime":1638931374761,"results":"52","hashOfConfig":"35"},{"size":22984,"mtime":1639993458515,"results":"53","hashOfConfig":"35"},{"size":4898,"mtime":1639992402586,"results":"54","hashOfConfig":"35"},{"size":13268,"mtime":1638930638946,"results":"55","hashOfConfig":"35"},{"size":14787,"mtime":1638948621474,"results":"56","hashOfConfig":"35"},{"size":2165,"mtime":1638949854481,"results":"57","hashOfConfig":"35"},{"size":2165,"mtime":1638949840121,"results":"58","hashOfConfig":"35"},{"size":2223,"mtime":1638949823846,"results":"59","hashOfConfig":"35"},{"size":2226,"mtime":1638949842800,"results":"60","hashOfConfig":"35"},{"size":3367,"mtime":1638949855771,"results":"61","hashOfConfig":"35"},{"size":2305,"mtime":1638949843817,"results":"62","hashOfConfig":"35"},{"size":3294,"mtime":1638949855131,"results":"63","hashOfConfig":"35"},{"size":2850,"mtime":1638949842017,"results":"64","hashOfConfig":"35"},{"size":4157,"mtime":1638949853726,"results":"65","hashOfConfig":"35"},{"size":605,"mtime":1638949882777,"results":"66","hashOfConfig":"35"},{"size":1175,"mtime":1638949720500,"results":"67","hashOfConfig":"35"},{"filePath":"68","messages":"69","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"jpc0be",{"filePath":"70","messages":"71","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"72","messages":"73","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"74","messages":"75","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"76","messages":"77","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"78","messages":"79","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"80","messages":"81","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"82","messages":"83","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"84","messages":"85","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"86","messages":"87","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"88","messages":"89","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"90","messages":"91","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"92","messages":"93","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"94","messages":"95","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"96","messages":"97","errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"98","messages":"99","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"100","messages":"101","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"102","messages":"103","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"104","messages":"105","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"106","messages":"107","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"108","messages":"109","errorCount":1,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"110","messages":"111","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"112","messages":"113","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"114","messages":"115","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"116","messages":"117","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"118","messages":"119","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"120","messages":"121","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"122","messages":"123","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"124","messages":"125","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"126","messages":"127","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"128","messages":"129","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"130","messages":"131","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"132","messages":"133","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/min/Documents/GMFE/gm-util/gm-printer/src/util.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/get_css.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/barcode.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/index.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor_special_table.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/config.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_store.js",["134","135"],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_shadow_dom.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/get_editor_css.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_title.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_store.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_select.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_edit_field.js",["136","137","138"],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/component.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account_statement/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/components/tooltip/index.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_special_field.js",[],{"ruleId":"139","severity":2,"message":"140","line":10,"column":29,"nodeType":"141","endLine":10,"endColumn":35},{"ruleId":"139","severity":2,"message":"142","line":145,"column":63,"nodeType":"141","endLine":145,"endColumn":71},{"ruleId":"143","severity":1,"message":"144","line":265,"column":13,"nodeType":"145","endLine":265,"endColumn":49},{"ruleId":"143","severity":1,"message":"144","line":283,"column":13,"nodeType":"145","endLine":283,"endColumn":56},{"ruleId":"146","severity":2,"message":"147","line":436,"column":22,"nodeType":"148","messageId":"149","endLine":436,"endColumn":31},"react/prop-types","'config' is missing in props validation","Identifier","'mockData' is missing in props validation","react/jsx-handler-names","Handler function for onChange prop key must begin with 'handle'","JSXAttribute","gmfe/i18n-check","t函数的key只能为字符串常量(Literal),请使用单引号或双引号包裹","MemberExpression","isVariable"]
|
|
1
|
+
[{"/Users/min/Documents/GMFE/gm-util/gm-printer/src/util.js":"1","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/get_css.js":"2","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/barcode.js":"3","/Users/min/Documents/GMFE/gm-util/gm-printer/src/index.js":"4","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/context_menu.js":"5","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/context_menu.js":"6","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/context_menu.js":"7","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/context_menu.js":"8","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/context_menu.js":"9","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor_special_table.js":"10","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/context_menu.js":"11","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/context_menu.js":"12","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/context_menu.js":"13","/Users/min/Documents/GMFE/gm-util/gm-printer/src/config.js":"14","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_store.js":"15","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_shadow_dom.js":"16","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/get_editor_css.js":"17","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_title.js":"18","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_store.js":"19","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_select.js":"20","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_edit_field.js":"21","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/component.js":"22","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/editor.js":"23","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/editor.js":"24","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/editor.js":"25","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/editor.js":"26","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/editor.js":"27","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor.js":"28","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account_statement/editor.js":"29","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/editor.js":"30","/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/editor.js":"31","/Users/min/Documents/GMFE/gm-util/gm-printer/src/components/tooltip/index.js":"32","/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_special_field.js":"33","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/store.js":"34","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/index.js":"35","/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/do_print.js":"36","/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/finance_printer.js":"37","/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/components/table_subtotal_tr.js":"38","/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/components/table.js":"39","/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/components/finance_batch_printer.js":"40"},{"size":7133,"mtime":1638862566087,"results":"41","hashOfConfig":"42"},{"size":291,"mtime":1638935573926,"results":"43","hashOfConfig":"42"},{"size":523,"mtime":1638935549030,"results":"44","hashOfConfig":"42"},{"size":1139,"mtime":1644572548725,"results":"45","hashOfConfig":"46"},{"size":2293,"mtime":1638948548042,"results":"47","hashOfConfig":"42"},{"size":2292,"mtime":1638948522492,"results":"48","hashOfConfig":"42"},{"size":1078,"mtime":1638948543271,"results":"49","hashOfConfig":"42"},{"size":2040,"mtime":1638948515902,"results":"50","hashOfConfig":"42"},{"size":2991,"mtime":1638948535719,"results":"51","hashOfConfig":"42"},{"size":4379,"mtime":1638935458586,"results":"52","hashOfConfig":"42"},{"size":2521,"mtime":1638948507982,"results":"53","hashOfConfig":"42"},{"size":2943,"mtime":1638948502114,"results":"54","hashOfConfig":"42"},{"size":3732,"mtime":1639722598379,"results":"55","hashOfConfig":"42"},{"size":2833,"mtime":1638861837310,"results":"56","hashOfConfig":"42"},{"size":4212,"mtime":1638935746667,"results":"57","hashOfConfig":"42"},{"size":861,"mtime":1638931446915,"results":"58","hashOfConfig":"42"},{"size":178,"mtime":1638931439249,"results":"59","hashOfConfig":"42"},{"size":3272,"mtime":1638931374761,"results":"60","hashOfConfig":"42"},{"size":22984,"mtime":1639993458515,"results":"61","hashOfConfig":"42"},{"size":4898,"mtime":1639992402586,"results":"62","hashOfConfig":"42"},{"size":13268,"mtime":1638930638946,"results":"63","hashOfConfig":"42"},{"size":14787,"mtime":1638948621474,"results":"64","hashOfConfig":"42"},{"size":2165,"mtime":1638949854481,"results":"65","hashOfConfig":"42"},{"size":2165,"mtime":1638949840121,"results":"66","hashOfConfig":"42"},{"size":2223,"mtime":1638949823846,"results":"67","hashOfConfig":"42"},{"size":2226,"mtime":1638949842800,"results":"68","hashOfConfig":"42"},{"size":3367,"mtime":1638949855771,"results":"69","hashOfConfig":"42"},{"size":2305,"mtime":1638949843817,"results":"70","hashOfConfig":"42"},{"size":3294,"mtime":1638949855131,"results":"71","hashOfConfig":"42"},{"size":2850,"mtime":1638949842017,"results":"72","hashOfConfig":"42"},{"size":4157,"mtime":1638949853726,"results":"73","hashOfConfig":"42"},{"size":605,"mtime":1638949882777,"results":"74","hashOfConfig":"42"},{"size":1175,"mtime":1638949720500,"results":"75","hashOfConfig":"42"},{"size":14644,"mtime":1644994596691,"results":"76","hashOfConfig":"46"},{"size":332,"mtime":1644573509040,"results":"77","hashOfConfig":"46"},{"size":3936,"mtime":1644907222767,"results":"78","hashOfConfig":"46"},{"size":8868,"mtime":1644808947014,"results":"79","hashOfConfig":"46"},{"size":4281,"mtime":1644907171868,"results":"80","hashOfConfig":"46"},{"size":9440,"mtime":1644993553716,"results":"81","hashOfConfig":"46"},{"size":724,"mtime":1644808940649,"results":"82","hashOfConfig":"46"},{"filePath":"83","messages":"84","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"jpc0be",{"filePath":"85","messages":"86","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"87","messages":"88","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"89","messages":"90","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1qaimc",{"filePath":"91","messages":"92","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"93","messages":"94","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"95","messages":"96","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"97","messages":"98","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"99","messages":"100","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"101","messages":"102","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"103","messages":"104","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"105","messages":"106","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"107","messages":"108","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"109","messages":"110","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"111","messages":"112","errorCount":2,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"113","messages":"114","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"115","messages":"116","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"117","messages":"118","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"119","messages":"120","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"121","messages":"122","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"123","messages":"124","errorCount":1,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"125","messages":"126","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"127","messages":"128","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"129","messages":"130","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"131","messages":"132","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"133","messages":"134","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"135","messages":"136","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"137","messages":"138","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"139","messages":"140","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"141","messages":"142","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"143","messages":"144","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"145","messages":"146","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"147","messages":"148","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"149","messages":"150","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"151","messages":"152","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"153","messages":"154","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"155","messages":"156","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"157","messages":"158","errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"159","messages":"160","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"161","messages":"162","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/min/Documents/GMFE/gm-util/gm-printer/src/util.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/get_css.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/barcode.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/index.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor_special_table.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/context_menu.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/config.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_store.js",["163","164"],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/hoc_with_shadow_dom.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/get_editor_css.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_title.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_store.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_select.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_edit_field.js",["165","166","167"],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/component.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockout/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_stockin/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_statement/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_settle/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_salemenus/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_purchase/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account_statement/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor_account/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/editor/editor.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/components/tooltip/index.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/common/editor_special_field.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/store.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/index.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/printer/do_print.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/finance_printer.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/components/table_subtotal_tr.js",["168"],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/components/table.js",[],"/Users/min/Documents/GMFE/gm-util/gm-printer/src/finance_voucher/components/finance_batch_printer.js",[],{"ruleId":"169","severity":2,"message":"170","line":10,"column":29,"nodeType":"171","endLine":10,"endColumn":35},{"ruleId":"169","severity":2,"message":"172","line":145,"column":63,"nodeType":"171","endLine":145,"endColumn":71},{"ruleId":"173","severity":1,"message":"174","line":265,"column":13,"nodeType":"175","endLine":265,"endColumn":49},{"ruleId":"173","severity":1,"message":"174","line":283,"column":13,"nodeType":"175","endLine":283,"endColumn":56},{"ruleId":"176","severity":2,"message":"177","line":436,"column":22,"nodeType":"178","messageId":"179","endLine":436,"endColumn":31},{"ruleId":"176","severity":2,"message":"177","line":119,"column":14,"nodeType":"178","messageId":"179","endLine":119,"endColumn":23},"react/prop-types","'config' is missing in props validation","Identifier","'mockData' is missing in props validation","react/jsx-handler-names","Handler function for onChange prop key must begin with 'handle'","JSXAttribute","gmfe/i18n-check","t函数的key只能为字符串常量(Literal),请使用单引号或双引号包裹","MemberExpression","isVariable"]
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Printer from '../finance_printer'
|
|
3
|
+
import _ from 'lodash'
|
|
4
|
+
import PropTypes from 'prop-types'
|
|
5
|
+
|
|
6
|
+
class BatchPrinter extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props)
|
|
9
|
+
this.ready = 0
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
handleReady = () => {
|
|
13
|
+
this.ready++
|
|
14
|
+
if (this.ready === this.props.list.length) {
|
|
15
|
+
this.props.onReady()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
render() {
|
|
20
|
+
const { list } = this.props
|
|
21
|
+
return _.map(list, ({ config, data }, i) => (
|
|
22
|
+
<Printer key={i} data={data} config={config} onReady={this.handleReady} />
|
|
23
|
+
))
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
BatchPrinter.propTypes = {
|
|
28
|
+
list: PropTypes.array.isRequired,
|
|
29
|
+
onReady: PropTypes.func
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
BatchPrinter.defaultProps = {
|
|
33
|
+
onReady: _.noop
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default BatchPrinter
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import _ from 'lodash'
|
|
4
|
+
import {
|
|
5
|
+
dispatchMsg,
|
|
6
|
+
getDataKey,
|
|
7
|
+
getHeight,
|
|
8
|
+
getMultiNumber,
|
|
9
|
+
getTableColumnName,
|
|
10
|
+
getWidth,
|
|
11
|
+
isMultiTable
|
|
12
|
+
} from '../../util'
|
|
13
|
+
import { inject, observer } from 'mobx-react'
|
|
14
|
+
import classNames from 'classnames'
|
|
15
|
+
import { MULTI_SUFFIX } from '../../config'
|
|
16
|
+
import SpecialTr from '../../printer/table_special_tr'
|
|
17
|
+
import SubtotalTr from './table_subtotal_tr'
|
|
18
|
+
import PageSummary from '../../printer/page_summary'
|
|
19
|
+
|
|
20
|
+
@inject('printerStore')
|
|
21
|
+
@observer
|
|
22
|
+
class Table extends React.Component {
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props)
|
|
25
|
+
this.ref = React.createRef()
|
|
26
|
+
this.state = {
|
|
27
|
+
index: null
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
const { name, printerStore } = this.props
|
|
33
|
+
|
|
34
|
+
if (!printerStore.ready) {
|
|
35
|
+
const $table = this.ref.current.querySelector('table')
|
|
36
|
+
const tHead = $table.querySelector('thead')
|
|
37
|
+
const ths = tHead.querySelectorAll('th') || []
|
|
38
|
+
const trs = $table.querySelectorAll('tbody tr') || []
|
|
39
|
+
const detailsDiv = $table.querySelectorAll('tr td .b-table-details')
|
|
40
|
+
|
|
41
|
+
printerStore.setHeight(name, getHeight($table))
|
|
42
|
+
|
|
43
|
+
printerStore.setTable(name, {
|
|
44
|
+
head: {
|
|
45
|
+
height: getHeight(tHead),
|
|
46
|
+
widths: _.map(ths, th => getWidth(th))
|
|
47
|
+
},
|
|
48
|
+
body: {
|
|
49
|
+
heights: _.map(trs, tr => getHeight(tr)),
|
|
50
|
+
children: _.map(detailsDiv, div => getHeight(div))
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
handleClick = e => {
|
|
57
|
+
const { name } = this.props
|
|
58
|
+
const { index } = e.target.dataset
|
|
59
|
+
|
|
60
|
+
dispatchMsg('gm-printer-select', {
|
|
61
|
+
selected: getTableColumnName(name, index)
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
handleDragStart = e => {
|
|
66
|
+
const { name } = this.props
|
|
67
|
+
const { index } = e.target.dataset
|
|
68
|
+
|
|
69
|
+
this.setState({
|
|
70
|
+
index
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
dispatchMsg('gm-printer-select', {
|
|
74
|
+
selected: getTableColumnName(name, index)
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
handleSelectedRegion = () => {
|
|
79
|
+
const { name } = this.props
|
|
80
|
+
|
|
81
|
+
dispatchMsg('gm-printer-select-region', { selected: name })
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
handleDrop = e => {
|
|
85
|
+
const { index } = e.target.dataset
|
|
86
|
+
|
|
87
|
+
if (this.state.index !== index) {
|
|
88
|
+
dispatchMsg('gm-printer-table-drag', {
|
|
89
|
+
source: this.state.index,
|
|
90
|
+
target: index
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
handleDragOver = e => {
|
|
96
|
+
e.preventDefault()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
getColumns = () => {
|
|
100
|
+
const {
|
|
101
|
+
config: { columns, dataKey }
|
|
102
|
+
} = this.props
|
|
103
|
+
const columns1 = columns.map((val, index) => ({ ...val, index }))
|
|
104
|
+
// 如果是多列表格
|
|
105
|
+
if (isMultiTable(dataKey)) {
|
|
106
|
+
// 多栏商品的第二列有点特殊,都带 _MULTI_SUFFIX 后缀
|
|
107
|
+
let res = columns1
|
|
108
|
+
const colNumber = getMultiNumber(dataKey)
|
|
109
|
+
for (let i = 2; i <= colNumber; i++) {
|
|
110
|
+
const colNum = i > 2 ? i : '' // 栏数
|
|
111
|
+
const columnsI = columns.map((val, index) => {
|
|
112
|
+
const data = {
|
|
113
|
+
...val,
|
|
114
|
+
index,
|
|
115
|
+
text: val.text.replace(
|
|
116
|
+
/{{(price\()?列\.([^{{]+)}}/g,
|
|
117
|
+
(s, s1, s2) => {
|
|
118
|
+
if (s1) {
|
|
119
|
+
// 有price函数插进来
|
|
120
|
+
const mix_suffix = s2.replace(/\*/, () => `${MULTI_SUFFIX}*`)
|
|
121
|
+
return `{{${s1}列.${mix_suffix}${colNum}}}`
|
|
122
|
+
} else {
|
|
123
|
+
return `{{列.${s2}${MULTI_SUFFIX}${colNum}}}`
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
) // {{列.xx}} => {{列.xxMULTI_SUFFIXi}}
|
|
127
|
+
}
|
|
128
|
+
// 多栏商品的明细取 __details_MULTI_SUFFIX
|
|
129
|
+
if (val.specialDetailsKey)
|
|
130
|
+
data.specialDetailsKey =
|
|
131
|
+
val.specialDetailsKey + `${MULTI_SUFFIX}${colNum}`
|
|
132
|
+
return data
|
|
133
|
+
})
|
|
134
|
+
res = res.concat(columnsI)
|
|
135
|
+
}
|
|
136
|
+
return res
|
|
137
|
+
} else {
|
|
138
|
+
return columns1
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
renderDefault() {
|
|
143
|
+
let {
|
|
144
|
+
config,
|
|
145
|
+
config: { dataKey, arrange, customerRowHeight = 23 },
|
|
146
|
+
name,
|
|
147
|
+
range,
|
|
148
|
+
pageIndex,
|
|
149
|
+
printerStore
|
|
150
|
+
} = this.props
|
|
151
|
+
|
|
152
|
+
// 数据
|
|
153
|
+
dataKey = getDataKey(dataKey, arrange)
|
|
154
|
+
const tableData = printerStore.data._table[dataKey] || []
|
|
155
|
+
|
|
156
|
+
// 列
|
|
157
|
+
const columns = this.getColumns()
|
|
158
|
+
// 列宽固定(避免跳页bug)
|
|
159
|
+
const thWidths = printerStore.tablesInfo[name]?.head.widths || []
|
|
160
|
+
// 每页合计在前
|
|
161
|
+
const subtotalTrPageSummary = () => {
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
<SubtotalTr
|
|
165
|
+
range={range}
|
|
166
|
+
config={config}
|
|
167
|
+
printerStore={printerStore}
|
|
168
|
+
/>
|
|
169
|
+
<PageSummary {...this.props} />
|
|
170
|
+
</>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
// 合计在前
|
|
174
|
+
const PageSummarySubtotalTr = () => {
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
<PageSummary {...this.props} />
|
|
178
|
+
<SubtotalTr
|
|
179
|
+
range={range}
|
|
180
|
+
config={config}
|
|
181
|
+
printerStore={printerStore}
|
|
182
|
+
/>
|
|
183
|
+
</>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
const getTdStyle = (index, style = {}) => {
|
|
187
|
+
const width = thWidths[index]
|
|
188
|
+
const { fontSize } = style
|
|
189
|
+
let tdStyle = {}
|
|
190
|
+
let minWidth = 24
|
|
191
|
+
|
|
192
|
+
if (!width) return tdStyle
|
|
193
|
+
if (fontSize) minWidth = _.parseInt(fontSize) * 2
|
|
194
|
+
if (width >= 150) {
|
|
195
|
+
tdStyle = {
|
|
196
|
+
minWidth: width
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
tdStyle = {
|
|
200
|
+
minWidth,
|
|
201
|
+
width
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return tdStyle
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<table>
|
|
209
|
+
<thead>
|
|
210
|
+
<tr style={{ height: `${customerRowHeight}px` }}>
|
|
211
|
+
{_.map(columns, (col, i) => (
|
|
212
|
+
<th
|
|
213
|
+
key={i}
|
|
214
|
+
data-index={col.index}
|
|
215
|
+
data-name={getTableColumnName(name, col.index)}
|
|
216
|
+
draggable
|
|
217
|
+
style={{
|
|
218
|
+
...getTdStyle(i, col.headStyle),
|
|
219
|
+
...col.headStyle
|
|
220
|
+
}}
|
|
221
|
+
className={classNames({
|
|
222
|
+
active:
|
|
223
|
+
getTableColumnName(name, col.index) ===
|
|
224
|
+
printerStore.selected
|
|
225
|
+
})}
|
|
226
|
+
onClick={this.handleClick}
|
|
227
|
+
onDragStart={this.handleDragStart}
|
|
228
|
+
onDrop={this.handleDrop}
|
|
229
|
+
onDragOver={this.handleDragOver}
|
|
230
|
+
>
|
|
231
|
+
{col.head}
|
|
232
|
+
</th>
|
|
233
|
+
))}
|
|
234
|
+
</tr>
|
|
235
|
+
</thead>
|
|
236
|
+
<tbody>
|
|
237
|
+
{_.map(_.range(range.begin, range.end), i => {
|
|
238
|
+
const _special = tableData[i] && tableData[i]._special
|
|
239
|
+
if (_special)
|
|
240
|
+
return <SpecialTr key={i} config={config} data={_special} />
|
|
241
|
+
// 如果项为空对象展现一个占满一行的td
|
|
242
|
+
const isItemNone = !_.keys(tableData[i]).length
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
<tr style={{ height: `${customerRowHeight}px` }} key={i}>
|
|
246
|
+
{isItemNone ? (
|
|
247
|
+
<td colSpan='99' />
|
|
248
|
+
) : (
|
|
249
|
+
_.map(columns, (col, j) => {
|
|
250
|
+
return (
|
|
251
|
+
<td
|
|
252
|
+
key={j}
|
|
253
|
+
data-name={getTableColumnName(name, col.index)}
|
|
254
|
+
style={{
|
|
255
|
+
...getTdStyle(j, col.style),
|
|
256
|
+
...col.style
|
|
257
|
+
}}
|
|
258
|
+
className={classNames({
|
|
259
|
+
active:
|
|
260
|
+
getTableColumnName(name, col.index) ===
|
|
261
|
+
printerStore.selected
|
|
262
|
+
})}
|
|
263
|
+
dangerouslySetInnerHTML={{
|
|
264
|
+
__html: col.isSpecialColumn
|
|
265
|
+
? printerStore.templateSpecialDetails(
|
|
266
|
+
col,
|
|
267
|
+
dataKey,
|
|
268
|
+
i
|
|
269
|
+
)
|
|
270
|
+
: printerStore
|
|
271
|
+
.templateFinance(
|
|
272
|
+
col.text,
|
|
273
|
+
dataKey,
|
|
274
|
+
i,
|
|
275
|
+
pageIndex
|
|
276
|
+
)
|
|
277
|
+
.replace(/\(\)/g, '')
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
)
|
|
281
|
+
})
|
|
282
|
+
)}
|
|
283
|
+
</tr>
|
|
284
|
+
)
|
|
285
|
+
})}
|
|
286
|
+
{this.props.config.subtotal.isCommutationPlace
|
|
287
|
+
? PageSummarySubtotalTr()
|
|
288
|
+
: subtotalTrPageSummary()}
|
|
289
|
+
</tbody>
|
|
290
|
+
</table>
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
renderEmptyTable() {
|
|
295
|
+
return (
|
|
296
|
+
<table>
|
|
297
|
+
<thead />
|
|
298
|
+
<tbody>
|
|
299
|
+
<tr />
|
|
300
|
+
</tbody>
|
|
301
|
+
</table>
|
|
302
|
+
)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
render() {
|
|
306
|
+
let {
|
|
307
|
+
config: { className, dataKey, arrange },
|
|
308
|
+
name,
|
|
309
|
+
placeholder,
|
|
310
|
+
printerStore
|
|
311
|
+
} = this.props
|
|
312
|
+
dataKey = getDataKey(dataKey, arrange)
|
|
313
|
+
const tableData = printerStore.data._table[dataKey] || []
|
|
314
|
+
const active = printerStore.selectedRegion === name
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<div
|
|
318
|
+
ref={this.ref}
|
|
319
|
+
className={classNames(
|
|
320
|
+
'gm-printer-table',
|
|
321
|
+
'gm-printer-table-classname-' + (className || 'default'),
|
|
322
|
+
{ active }
|
|
323
|
+
)}
|
|
324
|
+
data-name={name}
|
|
325
|
+
data-placeholder={placeholder}
|
|
326
|
+
onClick={this.handleSelectedRegion}
|
|
327
|
+
>
|
|
328
|
+
{tableData.length ? this.renderDefault() : this.renderEmptyTable()}
|
|
329
|
+
</div>
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
Table.propTypes = {
|
|
335
|
+
config: PropTypes.object.isRequired,
|
|
336
|
+
name: PropTypes.string.isRequired,
|
|
337
|
+
range: PropTypes.object.isRequired,
|
|
338
|
+
pageIndex: PropTypes.number.isRequired,
|
|
339
|
+
placeholder: PropTypes.string,
|
|
340
|
+
printerStore: PropTypes.object
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export default Table
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import i18next from '../../../locales'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import _ from 'lodash'
|
|
5
|
+
import { MULTI_SUFFIX } from '../../config'
|
|
6
|
+
import Big from 'big.js'
|
|
7
|
+
import { coverDigit2Uppercase, getDataKey } from '../../util'
|
|
8
|
+
import { observer } from 'mobx-react'
|
|
9
|
+
import { get } from 'mobx'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 每页合计组件,分页计算后,根据range来统计每页合计数据
|
|
13
|
+
* @param props
|
|
14
|
+
* @returns {*}
|
|
15
|
+
*/
|
|
16
|
+
const SubtotalTr = props => {
|
|
17
|
+
const {
|
|
18
|
+
config: {
|
|
19
|
+
dataKey,
|
|
20
|
+
arrange,
|
|
21
|
+
subtotal,
|
|
22
|
+
subtotal: {
|
|
23
|
+
show,
|
|
24
|
+
isUpperCaseBefore, // 决定小写金额是否在前
|
|
25
|
+
isUpperLowerCaseSeparate, // 决定大小写金额是否分开在两端
|
|
26
|
+
style,
|
|
27
|
+
fields = [
|
|
28
|
+
{
|
|
29
|
+
name: i18next.t('出库金额'),
|
|
30
|
+
valueField: 'real_item_price'
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
displayName = false // 是否展示字段名
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
range,
|
|
37
|
+
printerStore: {
|
|
38
|
+
config: {
|
|
39
|
+
financeSpecialConfig: {
|
|
40
|
+
CapitalPrefix = '大写',
|
|
41
|
+
LowercasePrefix = '小写'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
printerStore
|
|
46
|
+
} = props
|
|
47
|
+
const tableData = printerStore.data._table[getDataKey(dataKey, arrange)] || []
|
|
48
|
+
// 计算合计
|
|
49
|
+
const sumData = (list, field) => {
|
|
50
|
+
return _.reduce(
|
|
51
|
+
list,
|
|
52
|
+
(a, b) => {
|
|
53
|
+
let result = a
|
|
54
|
+
|
|
55
|
+
const _origin = b._origin || {}
|
|
56
|
+
const _origin2 = b['_origin' + MULTI_SUFFIX] || {}
|
|
57
|
+
|
|
58
|
+
result = a.plus(_origin[field] || 0)
|
|
59
|
+
if (_origin2[field]) {
|
|
60
|
+
result = result.plus(_origin2[field])
|
|
61
|
+
}
|
|
62
|
+
return result
|
|
63
|
+
},
|
|
64
|
+
Big(0)
|
|
65
|
+
).toFixed(2)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 每页小计
|
|
69
|
+
// show 是否展示小计,fields<Array> 合计的字段和展现的name,displayName 是否显示名字
|
|
70
|
+
if (show && printerStore.ready) {
|
|
71
|
+
const list = tableData.slice(range.begin, range.end)
|
|
72
|
+
|
|
73
|
+
const sum = {}
|
|
74
|
+
|
|
75
|
+
_.each(fields, v => {
|
|
76
|
+
sum[v.name] = sumData(list, v.valueField)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// 定义每页小记的左右两侧内容
|
|
80
|
+
let subtotalLeftContent
|
|
81
|
+
let subtotalRightContent
|
|
82
|
+
|
|
83
|
+
for (const name in sum) {
|
|
84
|
+
const price = sum[name]
|
|
85
|
+
const priceUpperCase = get(subtotal, 'needUpperCase') // needUpperCase在初始模板中undefined,所以必须用这个方法
|
|
86
|
+
? coverDigit2Uppercase(price)
|
|
87
|
+
: ''
|
|
88
|
+
if (displayName) {
|
|
89
|
+
// 大写金额是否在前
|
|
90
|
+
if (isUpperCaseBefore) {
|
|
91
|
+
subtotalLeftContent = `${name}${priceUpperCase}`
|
|
92
|
+
subtotalRightContent = `(${LowercasePrefix || '小写'}:¥${price})`
|
|
93
|
+
} else {
|
|
94
|
+
subtotalLeftContent = `(${LowercasePrefix || '小写'}:¥${price})`
|
|
95
|
+
subtotalRightContent = `${name} ${priceUpperCase}`
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
if (isUpperCaseBefore) {
|
|
99
|
+
subtotalLeftContent = `${priceUpperCase}`
|
|
100
|
+
subtotalRightContent = `(${LowercasePrefix || '小写'}:¥${price})`
|
|
101
|
+
} else {
|
|
102
|
+
subtotalLeftContent = `(${LowercasePrefix || '小写'}:¥${price})`
|
|
103
|
+
subtotalRightContent = `${priceUpperCase}`
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<tr>
|
|
110
|
+
<td colSpan={99} style={{ fontWeight: 'bold', ...style }}>
|
|
111
|
+
{/* 大写金额和小写金额分开在表格的两侧,通过控制类名实现,添加类名后,覆盖原来的居中、靠右靠左 */}
|
|
112
|
+
<div
|
|
113
|
+
className={
|
|
114
|
+
isUpperLowerCaseSeparate
|
|
115
|
+
? 'gm-printer-subtotal-UpperLowerCaseSeparate-outer'
|
|
116
|
+
: ''
|
|
117
|
+
}
|
|
118
|
+
>
|
|
119
|
+
{i18next.t(`${CapitalPrefix || '大写'}:`)}
|
|
120
|
+
{/* {i18next.t('每页合计')}: */}
|
|
121
|
+
<span
|
|
122
|
+
className={
|
|
123
|
+
isUpperLowerCaseSeparate
|
|
124
|
+
? 'gm-printer-subtotal-UpperLowerCaseSeparate-inter'
|
|
125
|
+
: ''
|
|
126
|
+
}
|
|
127
|
+
>
|
|
128
|
+
<span> {subtotalLeftContent} </span>
|
|
129
|
+
<span> {subtotalRightContent} </span>
|
|
130
|
+
</span>
|
|
131
|
+
</div>
|
|
132
|
+
</td>
|
|
133
|
+
</tr>
|
|
134
|
+
)
|
|
135
|
+
} else {
|
|
136
|
+
return null
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
SubtotalTr.propTypes = {
|
|
141
|
+
config: PropTypes.object.isRequired,
|
|
142
|
+
range: PropTypes.object.isRequired,
|
|
143
|
+
printStore: PropTypes.object
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export default observer(SubtotalTr)
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import i18next from '../../locales'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import classNames from 'classnames'
|
|
4
|
+
import { inject, observer, Provider } from 'mobx-react'
|
|
5
|
+
import PropTypes from 'prop-types'
|
|
6
|
+
import PrinterStore from '../printer/store'
|
|
7
|
+
import Page from '../printer/page'
|
|
8
|
+
import _ from 'lodash'
|
|
9
|
+
import Panel from '../printer/panel'
|
|
10
|
+
import Table from './components/table'
|
|
11
|
+
import MergePage from '../printer/merge_page'
|
|
12
|
+
|
|
13
|
+
// Header Sign Footer 相对特殊,要单独处理
|
|
14
|
+
const Header = props => (
|
|
15
|
+
<Panel {...props} name='header' placeholder={i18next.t('页眉')} />
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
const Sign = props => (
|
|
19
|
+
<Panel
|
|
20
|
+
{...props}
|
|
21
|
+
style={{
|
|
22
|
+
...props.style,
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
left: 0,
|
|
25
|
+
right: 0
|
|
26
|
+
}}
|
|
27
|
+
name='sign'
|
|
28
|
+
placeholder={i18next.t('签名')}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
Sign.propTypes = {
|
|
33
|
+
style: PropTypes.object
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const Footer = props => (
|
|
37
|
+
<Panel
|
|
38
|
+
{...props}
|
|
39
|
+
style={{
|
|
40
|
+
...props.style,
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
bottom: 0,
|
|
43
|
+
left: 0,
|
|
44
|
+
right: 0
|
|
45
|
+
}}
|
|
46
|
+
name='footer'
|
|
47
|
+
placeholder={i18next.t('页脚')}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
Footer.propTypes = {
|
|
52
|
+
style: PropTypes.object
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@inject('printerStore')
|
|
56
|
+
@observer
|
|
57
|
+
class Printer extends React.Component {
|
|
58
|
+
constructor(props) {
|
|
59
|
+
super(props)
|
|
60
|
+
|
|
61
|
+
// 无实际意义,辅助 onReady,见 didMount
|
|
62
|
+
this.state = {}
|
|
63
|
+
|
|
64
|
+
props.printerStore.init(props.config, props.data)
|
|
65
|
+
props.printerStore.setSelected(props.selected)
|
|
66
|
+
props.printerStore.setSelectedRegion(props.selectedRegion)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
70
|
+
if (nextProps.selected !== this.props.selected) {
|
|
71
|
+
this.props.printerStore.setSelected(nextProps.selected)
|
|
72
|
+
}
|
|
73
|
+
if (nextProps.selectedRegion !== this.props.selectedRegion) {
|
|
74
|
+
this.props.printerStore.setSelectedRegion(nextProps.selectedRegion)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
componentDidMount() {
|
|
79
|
+
const { printerStore, config } = this.props
|
|
80
|
+
const batchPrintConfig = config.batchPrintConfig
|
|
81
|
+
|
|
82
|
+
// 连续打印不需要计算
|
|
83
|
+
if (batchPrintConfig !== 2) {
|
|
84
|
+
// didMount 代表第一次渲染完成
|
|
85
|
+
printerStore.setReady(true)
|
|
86
|
+
|
|
87
|
+
// 开始计算,获取各种数据
|
|
88
|
+
// printerStore.computedPages()
|
|
89
|
+
printerStore.financeComputedPages()
|
|
90
|
+
}
|
|
91
|
+
// Printer 不是立马就呈现出最终样式,有个过程。这个过程需要时间,什么 ready,不太清楚,估借 setState 来获取过程结束时刻
|
|
92
|
+
this.setState({}, () => {
|
|
93
|
+
this.props.onReady()
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
renderBefore() {
|
|
98
|
+
const { printerStore } = this.props
|
|
99
|
+
const { config } = printerStore
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Page>
|
|
103
|
+
<Header config={config.header} pageIndex={0} />
|
|
104
|
+
{_.map(config.contents, (content, index) => {
|
|
105
|
+
switch (content.type) {
|
|
106
|
+
case 'table':
|
|
107
|
+
// eslint-disable-next-line no-case-declarations
|
|
108
|
+
const list = printerStore.data._table[content.dataKey]
|
|
109
|
+
return (
|
|
110
|
+
<Table
|
|
111
|
+
key={`contents.table.${index}`}
|
|
112
|
+
name={`contents.table.${index}`}
|
|
113
|
+
config={content}
|
|
114
|
+
range={{ begin: 0, end: list?.length || 0 }}
|
|
115
|
+
pageIndex={0}
|
|
116
|
+
placeholder={`${i18next.t('区域')} ${index}`}
|
|
117
|
+
/>
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
default:
|
|
121
|
+
return (
|
|
122
|
+
<Panel
|
|
123
|
+
key={`contents.panel.${index}`}
|
|
124
|
+
name={`contents.panel.${index}`}
|
|
125
|
+
config={content}
|
|
126
|
+
pageIndex={0}
|
|
127
|
+
placeholder={`${i18next.t('区域')} ${index}`}
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
})}
|
|
132
|
+
<Sign config={config.sign} pageIndex={0} />
|
|
133
|
+
<Footer config={config.footer} pageIndex={0} />
|
|
134
|
+
</Page>
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
renderPage() {
|
|
139
|
+
const { printerStore } = this.props
|
|
140
|
+
const { config } = printerStore
|
|
141
|
+
console.log('printerStore', printerStore.pages)
|
|
142
|
+
return (
|
|
143
|
+
<>
|
|
144
|
+
{_.map(printerStore.pages, (page, i) => {
|
|
145
|
+
const isLastPage = i === printerStore.pages.length - 1
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<Page key={i}>
|
|
149
|
+
<Header config={config.header} pageIndex={i} />
|
|
150
|
+
|
|
151
|
+
{_.map(page, (panel, ii) => {
|
|
152
|
+
switch (panel.type) {
|
|
153
|
+
case 'table':
|
|
154
|
+
return (
|
|
155
|
+
<Table
|
|
156
|
+
key={`contents.table.${panel.index}.${ii}`}
|
|
157
|
+
name={`contents.table.${panel.index}`}
|
|
158
|
+
config={config.contents[panel.index]}
|
|
159
|
+
range={{
|
|
160
|
+
begin: panel.begin,
|
|
161
|
+
end: panel.end
|
|
162
|
+
}}
|
|
163
|
+
placeholder={`${i18next.t('区域')} ${panel.index}`}
|
|
164
|
+
pageIndex={i}
|
|
165
|
+
/>
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
default:
|
|
169
|
+
return (
|
|
170
|
+
<Panel
|
|
171
|
+
key={`contents.panel.${panel.index}`}
|
|
172
|
+
name={`contents.panel.${panel.index}`}
|
|
173
|
+
config={config.contents[panel.index]}
|
|
174
|
+
pageIndex={i}
|
|
175
|
+
placeholder={`${i18next.t('区域')} ${panel.index}`}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
})}
|
|
180
|
+
{isLastPage && (
|
|
181
|
+
<Sign
|
|
182
|
+
config={config.sign}
|
|
183
|
+
pageIndex={i}
|
|
184
|
+
style={{ bottom: config.footer.style.height }}
|
|
185
|
+
/>
|
|
186
|
+
)}
|
|
187
|
+
<Footer config={config.footer} pageIndex={i} />
|
|
188
|
+
</Page>
|
|
189
|
+
)
|
|
190
|
+
})}
|
|
191
|
+
</>
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
renderMerge() {
|
|
196
|
+
const { printerStore } = this.props
|
|
197
|
+
const { config } = printerStore
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<MergePage>
|
|
201
|
+
<Header config={config.header} pageIndex={0} />
|
|
202
|
+
{_.map(config.contents, (content, index) => {
|
|
203
|
+
switch (content.type) {
|
|
204
|
+
case 'table':
|
|
205
|
+
// eslint-disable-next-line no-case-declarations
|
|
206
|
+
const list = printerStore.data._table[content.dataKey]
|
|
207
|
+
return (
|
|
208
|
+
<Table
|
|
209
|
+
key={`contents.table.${index}`}
|
|
210
|
+
name={`contents.table.${index}`}
|
|
211
|
+
config={content}
|
|
212
|
+
range={{ begin: 0, end: list?.length || 0 }}
|
|
213
|
+
pageIndex={0}
|
|
214
|
+
placeholder={`${i18next.t('区域')} ${index}`}
|
|
215
|
+
/>
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
default:
|
|
219
|
+
return (
|
|
220
|
+
<Panel
|
|
221
|
+
key={`contents.panel.${index}`}
|
|
222
|
+
name={`contents.panel.${index}`}
|
|
223
|
+
config={content}
|
|
224
|
+
pageIndex={0}
|
|
225
|
+
placeholder={`${i18next.t('区域')} ${index}`}
|
|
226
|
+
/>
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
})}
|
|
230
|
+
<Sign config={config.sign} pageIndex={0} />
|
|
231
|
+
<Footer config={config.footer} pageIndex={0} />
|
|
232
|
+
</MergePage>
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
doRender() {
|
|
237
|
+
const { printerStore, config } = this.props
|
|
238
|
+
// batchPrintConfig: 1 不连续打印(纸张会间断)2 连续打印(纸张连续打,不间断)
|
|
239
|
+
const batchPrintConfig = config.batchPrintConfig
|
|
240
|
+
if (batchPrintConfig === 2) {
|
|
241
|
+
return this.renderMerge()
|
|
242
|
+
} else {
|
|
243
|
+
// renderBefore ,拿到各种数据,哪些模块哪些内容放合适位置,切割表格
|
|
244
|
+
// renderPage,最终渲染打印的页面
|
|
245
|
+
return !printerStore.ready ? this.renderBefore() : this.renderPage()
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
render() {
|
|
250
|
+
const {
|
|
251
|
+
selected,
|
|
252
|
+
data,
|
|
253
|
+
config,
|
|
254
|
+
onReady,
|
|
255
|
+
selectedRegion,
|
|
256
|
+
printerStore,
|
|
257
|
+
...rest
|
|
258
|
+
} = this.props
|
|
259
|
+
|
|
260
|
+
const {
|
|
261
|
+
size: { width },
|
|
262
|
+
className,
|
|
263
|
+
style
|
|
264
|
+
} = printerStore.config.page
|
|
265
|
+
// batchPrintConfig: 1 不连续打印(纸张会间断)2 连续打印(纸张连续打,不间断)
|
|
266
|
+
const batchPrintConfig = config.batchPrintConfig
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<div
|
|
270
|
+
{...rest}
|
|
271
|
+
className={classNames('gm-printer', className)}
|
|
272
|
+
style={Object.assign({}, style, {
|
|
273
|
+
width,
|
|
274
|
+
breakAfter: batchPrintConfig === 2 ? 'auto' : 'always'
|
|
275
|
+
})}
|
|
276
|
+
>
|
|
277
|
+
{this.doRender()}
|
|
278
|
+
</div>
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
Printer.propTypes = {
|
|
284
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
285
|
+
style: PropTypes.object,
|
|
286
|
+
printerStore: PropTypes.object,
|
|
287
|
+
selected: PropTypes.string,
|
|
288
|
+
selectedRegion: PropTypes.string,
|
|
289
|
+
data: PropTypes.object.isRequired,
|
|
290
|
+
config: PropTypes.object.isRequired,
|
|
291
|
+
onReady: PropTypes.func
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
Printer.defaultProps = {
|
|
295
|
+
onReady: _.noop
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
class WithStorePrinter extends React.Component {
|
|
299
|
+
constructor(props) {
|
|
300
|
+
super(props)
|
|
301
|
+
this.printerStore = new PrinterStore()
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
render() {
|
|
305
|
+
return (
|
|
306
|
+
<Provider printerStore={this.printerStore}>
|
|
307
|
+
<Printer {...this.props} />
|
|
308
|
+
</Provider>
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export default WithStorePrinter
|
package/src/index.js
CHANGED
|
@@ -16,7 +16,8 @@ import {
|
|
|
16
16
|
doPrint,
|
|
17
17
|
Printer,
|
|
18
18
|
getCSS,
|
|
19
|
-
getPrintContainerHTML
|
|
19
|
+
getPrintContainerHTML,
|
|
20
|
+
doBatchFinancePrint
|
|
20
21
|
} from './printer'
|
|
21
22
|
import { MULTI_SUFFIX, MULTI_SUFFIX3 } from './config'
|
|
22
23
|
|
|
@@ -41,5 +42,6 @@ export {
|
|
|
41
42
|
getCSS,
|
|
42
43
|
MULTI_SUFFIX,
|
|
43
44
|
MULTI_SUFFIX3,
|
|
44
|
-
getPrintContainerHTML
|
|
45
|
+
getPrintContainerHTML,
|
|
46
|
+
doBatchFinancePrint
|
|
45
47
|
}
|
package/src/printer/do_print.js
CHANGED
|
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom'
|
|
|
3
3
|
import Printer from './printer'
|
|
4
4
|
import getCSS from './get_css'
|
|
5
5
|
import BatchPrinter from './batch_printer'
|
|
6
|
+
import BatchFinancePrinter from '../finance_voucher/components/finance_batch_printer'
|
|
6
7
|
import { isZoom } from 'gm-util'
|
|
7
8
|
import { afterImgAndSvgLoaded } from '../util'
|
|
8
9
|
|
|
@@ -92,6 +93,25 @@ function toDoPrintBatch(list, isPrint = true) {
|
|
|
92
93
|
})
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
function toDoPrintFinanceBatch(list, isPrint = true) {
|
|
97
|
+
return new window.Promise(resolve => {
|
|
98
|
+
const $app = $printer.contentWindow.document.getElementById('appContainer')
|
|
99
|
+
ReactDOM.unmountComponentAtNode($app)
|
|
100
|
+
ReactDOM.render(
|
|
101
|
+
<BatchFinancePrinter
|
|
102
|
+
list={list}
|
|
103
|
+
onReady={() => {
|
|
104
|
+
afterImgAndSvgLoaded(() => {
|
|
105
|
+
isPrint && $printer.contentWindow.print()
|
|
106
|
+
resolve()
|
|
107
|
+
}, $app)
|
|
108
|
+
}}
|
|
109
|
+
/>,
|
|
110
|
+
$app
|
|
111
|
+
)
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
95
115
|
function doPrint({ data, config }, isTest) {
|
|
96
116
|
init({ isTest })
|
|
97
117
|
|
|
@@ -107,6 +127,16 @@ function doBatchPrint(
|
|
|
107
127
|
return toDoPrintBatch(list, extraCofnig.isPrint)
|
|
108
128
|
}
|
|
109
129
|
|
|
130
|
+
function doBatchFinancePrint(
|
|
131
|
+
list,
|
|
132
|
+
isTest,
|
|
133
|
+
extraCofnig = { isPrint: true, isTipZoom: true }
|
|
134
|
+
) {
|
|
135
|
+
init({ isTest, isTipZoom: extraCofnig.isTipZoom })
|
|
136
|
+
|
|
137
|
+
return toDoPrintFinanceBatch(list, extraCofnig.isPrint)
|
|
138
|
+
}
|
|
139
|
+
|
|
110
140
|
/**
|
|
111
141
|
* @description: 获取打印的html
|
|
112
142
|
*/
|
|
@@ -114,4 +144,4 @@ function getPrintContainerHTML() {
|
|
|
114
144
|
return $printer.contentWindow.document.getElementsByTagName('html')[0]
|
|
115
145
|
.innerHTML
|
|
116
146
|
}
|
|
117
|
-
export { doPrint, doBatchPrint, getPrintContainerHTML }
|
|
147
|
+
export { doPrint, doBatchPrint, getPrintContainerHTML, doBatchFinancePrint }
|
package/src/printer/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import Printer from './printer'
|
|
2
2
|
import BatchPrinter from './batch_printer'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
doPrint,
|
|
5
|
+
doBatchPrint,
|
|
6
|
+
getPrintContainerHTML,
|
|
7
|
+
doBatchFinancePrint
|
|
8
|
+
} from './do_print'
|
|
4
9
|
import getCSS from './get_css'
|
|
5
10
|
|
|
6
11
|
export {
|
|
@@ -9,5 +14,6 @@ export {
|
|
|
9
14
|
Printer,
|
|
10
15
|
BatchPrinter,
|
|
11
16
|
getCSS,
|
|
12
|
-
getPrintContainerHTML
|
|
17
|
+
getPrintContainerHTML,
|
|
18
|
+
doBatchFinancePrint
|
|
13
19
|
}
|
package/src/printer/store.js
CHANGED
|
@@ -299,6 +299,46 @@ class PrinterStore {
|
|
|
299
299
|
this.pages.push(page)
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
@action
|
|
303
|
+
financeComputedPages() {
|
|
304
|
+
// 当前在处理 contents 的索引
|
|
305
|
+
let index = 0
|
|
306
|
+
/** 一页承载的内容. [object, object, ...] */
|
|
307
|
+
let page = []
|
|
308
|
+
const pageFixLineNum = this.config.financeSpecialConfig.pageFixLineNum
|
|
309
|
+
while (index < this.config.contents.length) {
|
|
310
|
+
const content = this.config.contents[index]
|
|
311
|
+
// debugger
|
|
312
|
+
const table = this.tablesInfo[`contents.table.${index}`]
|
|
313
|
+
// 表格行的索引,用于table.slice(begin, end), 分割到不同页面中
|
|
314
|
+
let begin = 0
|
|
315
|
+
let end = 0
|
|
316
|
+
|
|
317
|
+
if (content.type === 'table') {
|
|
318
|
+
while (end < table.body.heights.length) {
|
|
319
|
+
end += pageFixLineNum
|
|
320
|
+
page.push({
|
|
321
|
+
type: 'table',
|
|
322
|
+
index,
|
|
323
|
+
begin,
|
|
324
|
+
end
|
|
325
|
+
})
|
|
326
|
+
this.pages.push(page)
|
|
327
|
+
page = []
|
|
328
|
+
begin = end
|
|
329
|
+
}
|
|
330
|
+
index++
|
|
331
|
+
} else {
|
|
332
|
+
page.push({
|
|
333
|
+
type: 'panel',
|
|
334
|
+
index
|
|
335
|
+
})
|
|
336
|
+
index++
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
// this.pages.push(page)
|
|
340
|
+
}
|
|
341
|
+
|
|
302
342
|
template(text, pageIndex) {
|
|
303
343
|
// 做好保护,出错就返回 text
|
|
304
344
|
try {
|
|
@@ -334,6 +374,30 @@ class PrinterStore {
|
|
|
334
374
|
}
|
|
335
375
|
}
|
|
336
376
|
|
|
377
|
+
/**
|
|
378
|
+
* 配送单的定制化需求:限制表格里的字的个数,超出显示'...'
|
|
379
|
+
*/
|
|
380
|
+
templateFinance(text, dataKey, index, pageIndex) {
|
|
381
|
+
// 做好保护,出错就返回 text
|
|
382
|
+
try {
|
|
383
|
+
const list = this.data._table[dataKey] || this.data._table.orders
|
|
384
|
+
|
|
385
|
+
let res = _.template(text, {
|
|
386
|
+
interpolate: /{{([\s\S]+?)}}/g
|
|
387
|
+
})({
|
|
388
|
+
...this.data.common,
|
|
389
|
+
[i18next.t('列')]: list[index],
|
|
390
|
+
[i18next.t('当前页码')]: pageIndex + 1,
|
|
391
|
+
[i18next.t('页码总数')]: this.pages.length,
|
|
392
|
+
price: price // 提供一个价格处理函数
|
|
393
|
+
})
|
|
394
|
+
res = res.length > 9 ? `${res.slice(0, 9)}...` : res
|
|
395
|
+
return res
|
|
396
|
+
} catch (err) {
|
|
397
|
+
return text
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
337
401
|
templateSpecialDetails(col, dataKey, index) {
|
|
338
402
|
// 做好保护,出错就返回 text
|
|
339
403
|
const { specialDetailsKey, text, detailLastColType, separator } = col
|