src/utils/utils-datamanage.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/billprint/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/menudesign/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/menudesign/printmenuform/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/utils/utils-datamanage.js
@@ -763,14 +763,9 @@ ` } // 测试系统打印查询语句 if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { _customScript && console.info(`${setting.$name ? `/*${setting.$name} 自定义脚本(同步查询)*/\n` : ''}${_dataresource ? '' : '/*不执行默认sql*/\n'}${_customScript}`) _dataresource && console.info(`${setting.$name ? `/*${setting.$name} 数据源(同步查询)*/\n` : ''}` + _dataresource) } return { name: dataName, $name: setting.$name, columns: columns, par_tablename: '', type: format === 'array' ? format : '', @@ -821,6 +816,12 @@ _sql = _sql.replace(/@time_id@/ig, `'${time_id}'`) _script = _script.replace(/@time_id@/ig, `'${time_id}'`) // 测试系统打印查询语句 if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { _script && console.info(`${item.$name ? `/*${item.$name} 自定义脚本(同步查询)*/\n` : ''}${_sql ? '' : '/*不执行默认sql*/\n'}${_script}`) _sql && console.info(`${item.$name ? `/*${item.$name} 数据源(同步查询)*/\n` : ''}` + _sql) } item.columns.forEach(cell => { LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) }) src/views/billprint/index.jsx
@@ -350,7 +350,20 @@ params.unshift(_pars) } if (config.everyPCount && !config.printPage) { // 兼容 config.printPage = 'page' } config.printPage = config.printPage || 'auto' if (config.printPage === 'auto') { config.everyPCount = 99999 } config.limit = config.everyPCount || 15 this.setState({ auto: config.printPage === 'auto', config }, () => { if (params.length === 0) { @@ -482,7 +495,7 @@ * @description 主表数据加载 */ loadmaindata = (params) => { const { components, everyPCount, firstCount, lastCount } = this.state.config const { components, limit } = this.state.config let deffers = params.map(item => { let componentId = item.componentId @@ -532,19 +545,11 @@ this.setState({loadingview: false, pages}) } let auto = true if (comps[comps.length - 1].wrap && comps[comps.length - 1].wrap.printHeight) { auto = false } while (!over) { let page = [] let count = 0 let _pageover = false let pagesover = false let limit = pageIndex === 1 ? (firstCount || 20) : (everyPCount || 20) comps.forEach((_item, index) => { let item = fromJS(_item).toJS() @@ -583,7 +588,11 @@ if (count >= limit) { _pageover = true } else if (_item.dataArray.length > 0) { _pageover = true } page.push(item) } _item.added = true @@ -615,95 +624,15 @@ } }) if (pagesover && lastCount && count > lastCount) { pagesover = false page = [] count = 0 _pageover = false if (pageIndex === 1) { limit = (everyPCount - firstCount) + (everyPCount - lastCount) if (limit <= 0) { limit = firstCount } } else { limit = lastCount } comps.forEach((_item, index) => { let item = fromJS(_item).toJS() if (item.wrap && item.wrap.printType === 'headerOrfooter') { // 页眉页脚 page.push(item) } else if (_pageover) { return } else if (item.subtype === 'datacard' || item.type === 'table') { if (_item.dataArray && _item.dataArray.length > 0) { if (item.subtype === 'datacard' && item.wrap.layout === 'flex') { if (!item.added && item.wrap.printHeight) { count += item.wrap.printHeight if (count >= limit) { _pageover = true } if (count <= limit) { _item.added = true page.push(item) } } else if (!item.added) { _item.added = true page.push(item) } } else { item.data = [] while (count + 1 <= limit && _item.dataArray.length > 0) { item.data.push(_item.dataArray.shift()) count++ } if (count >= limit) { _pageover = true } page.push(item) } _item.added = true } else if (!item.added) { _item.added = true page.push(item) } } else if (!item.added && item.wrap && item.wrap.printHeight) { if (item.wrap.empty === 'hidden' && (!item.data || item.data.length === 0)) { _item.added = true return } count += item.wrap.printHeight if (count >= limit) { _pageover = true } if (count <= limit) { _item.added = true page.push(item) } } else if (!item.added) { _item.added = true page.push(item) } if (index + 1 === length && !_pageover) { pagesover = true } }) } pages.push(page) pageIndex++ if (pageIndex >= 200 || pagesover) { if (pageIndex >= 2000 || pagesover) { over = true } } this.setState({loadingview: false, pages, auto}) this.setState({loadingview: false, pages}) }) } src/views/menudesign/index.jsx
@@ -452,9 +452,13 @@ config.parentId = 'BillPrintTemp' config.MenuName = MenuName config.MenuNo = MenuNo config.firstCount = config.firstCount || 15 if (config.everyPCount && !config.printPage) { config.printPage = 'page' } config.printPage = config.printPage || 'auto' config.everyPCount = config.everyPCount || 15 config.lastCount = config.lastCount || '' } config.open_edition = result.open_edition || '' @@ -609,7 +613,7 @@ const { MenuType, copyButtons, thawButtons } = this.state let config = fromJS(this.state.config).toJS() if (MenuType === 'billPrint' && (!config.firstCount || !config.everyPCount)) { if (MenuType === 'billPrint' && config.printPage === 'page' && !config.everyPCount) { notification.warning({ top: 92, message: '请完善基本信息!', src/views/menudesign/printmenuform/index.jsx
@@ -12,12 +12,12 @@ updateConfig: PropTypes.func } changeFirstCount = (val) => { if (typeof(val) !== 'number') { val = '' } this.props.updateConfig({...this.props.config, firstCount: val}) } // changeFirstCount = (val) => { // if (typeof(val) !== 'number') { // val = '' // } // this.props.updateConfig({...this.props.config, firstCount: val}) // } changeCount = (val) => { if (typeof(val) !== 'number') { @@ -40,12 +40,16 @@ this.props.updateConfig({...this.props.config, printHeight: val}) } changeLastCount = (val) => { if (typeof(val) !== 'number') { val = '' } this.props.updateConfig({...this.props.config, lastCount: val}) onPrintPageChange = (val) => { this.props.updateConfig({...this.props.config, printPage: val}) } // changeLastCount = (val) => { // if (typeof(val) !== 'number') { // val = '' // } // this.props.updateConfig({...this.props.config, lastCount: val}) // } pageSizeChange = (val) => { this.props.updateConfig({...this.props.config, pageSize: val}) @@ -185,6 +189,18 @@ </Form.Item> </Col> <Col span={24}> <Form.Item label="页面布局"> {getFieldDecorator('printPage', { initialValue: config.printPage || 'auto' })( <Radio.Group onChange={(e) => {this.onPrintPageChange(e.target.value)}}> <Radio value="auto">自适应</Radio> <Radio value="page">分页</Radio> </Radio.Group> )} </Form.Item> </Col> {/* <Col span={24}> <Form.Item label="首页数(条)"> {getFieldDecorator('firstCount', { initialValue: config.firstCount, @@ -196,11 +212,11 @@ ] })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeFirstCount}/>)} </Form.Item> </Col> <Col span={24}> </Col> */} {config.printPage === 'page' ? <Col span={24}> <Form.Item label="每页数(条)"> {getFieldDecorator('everyPCount', { initialValue: config.everyPCount, initialValue: config.everyPCount || 15, rules: [ { required: true, @@ -209,14 +225,14 @@ ] })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeCount}/>)} </Form.Item> </Col> <Col span={24}> </Col> : null} {/* <Col span={24}> <Form.Item label="尾页数(条)"> {getFieldDecorator('lastCount', { initialValue: config.lastCount })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeLastCount}/>)} </Form.Item> </Col> </Col> */} <Col span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="针对不规则纸张,可自定义设置打印高度和宽度,注:同时设置打印宽度和高度后方可生效。">