From 65da4dae29c621df1764cb5523c64e92be8b180a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 02 十月 2024 15:40:40 +0800 Subject: [PATCH] 2024-10-02 --- src/menu/datasource/verifycard/excelout/index.jsx | 2 src/menu/components/editor/braft-editor/index.jsx | 3 src/views/billprint/index.jsx | 120 ++++++----- src/views/menudesign/index.scss | 7 public/manifest.json | 2 src/menu/datasource/verifycard/index.scss | 12 + src/menu/datasource/verifycard/index.jsx | 29 ++ src/views/menudesign/printmenuform/index.jsx | 401 ++++++++++++++++++++++------------------ 8 files changed, 339 insertions(+), 237 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index 8d62453..3027059 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -6,5 +6,5 @@ "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff", - "mk_version": "20240910" + "mk_version": "20241002" } diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx index 1b2c190..ba699ef 100644 --- a/src/menu/components/editor/braft-editor/index.jsx +++ b/src/menu/components/editor/braft-editor/index.jsx @@ -109,8 +109,9 @@ card.name = card.wrap.name card.errors = [] + card.$tables = [] - if (card.wrap.datatype !== 'static') { + if (card.wrap.datatype === 'dynamic') { card.$c_ds = true card.errors = checkComponent(card) diff --git a/src/menu/datasource/verifycard/excelout/index.jsx b/src/menu/datasource/verifycard/excelout/index.jsx index 32adf68..a1fe536 100644 --- a/src/menu/datasource/verifycard/excelout/index.jsx +++ b/src/menu/datasource/verifycard/excelout/index.jsx @@ -69,7 +69,7 @@ } render() { - return (<DownloadOutlined className="columns-out" onClick={this.actionTrigger}/>) + return (<DownloadOutlined className="columns-out" title="涓嬭浇" onClick={this.actionTrigger}/>) } } diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index a2f6111..500966b 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -1186,6 +1186,33 @@ }) } + tolowercase = (type) => { + const that = this + confirm({ + content: type === 'sub' ? '纭畾灏嗗瓙琛ㄥ瓧娈佃浆涓哄皬鍐欏悧锛�' : '纭畾灏嗗瓧娈佃浆涓哄皬鍐欏悧锛�', + onOk() { + that.execlowercase(type) + }, + onCancel() {} + }) + } + + execlowercase = (type) => { + const { subColumns, columns } = this.state + + if (type === 'sub') { + this.setState({subColumns: fromJS(subColumns).toJS().map(col => { + col.field = col.field.toLowerCase() + return col + })}) + } else { + this.setState({columns: fromJS(columns).toJS().map(col => { + col.field = col.field.toLowerCase() + return col + })}) + } + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -1233,6 +1260,7 @@ type="fields" updatefield={this.updatefields} /> + <SwapOutlined className="columns-lowercase" title="杞皬鍐�" onClick={() => this.tolowercase()}/> <ExcelOut data={columns} setting={setting}/> <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.datasource = inst} data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> </TabPane> : <TabPane tab={ @@ -1257,6 +1285,7 @@ type="fields" updatefield={this.updateSubfields} /> + <SwapOutlined className="columns-lowercase" title="杞皬鍐�" onClick={() => this.tolowercase('sub')}/> <ExcelOut data={subColumns} setting={setting}/> <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} searchKey={searchKey} type="datasourcefield" wrappedComponentRef={(inst) => this.subdatasource = inst} data={subColumns} columns={colColumns} onChange={(subColumns) => this.setState({subColumns})}/> </TabPane> : null} diff --git a/src/menu/datasource/verifycard/index.scss b/src/menu/datasource/verifycard/index.scss index 3239de2..b87af52 100644 --- a/src/menu/datasource/verifycard/index.scss +++ b/src/menu/datasource/verifycard/index.scss @@ -146,6 +146,16 @@ margin-right: 5px; cursor: pointer; } + .columns-lowercase { + float: right; + position: relative; + z-index: 2; + right: 30px; + height: 0px; + top: -15px; + color: orange; + cursor: pointer; + } .columns-out { float: right; position: relative; @@ -159,7 +169,7 @@ .ant-table-thead { .copy-control { top: -18px; - right: 30px; + right: 55px; .anticon-copy { margin-right: 12px; } diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 183f6cb..25fbfea 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -1043,63 +1043,79 @@ } } - while (!over) { - let page = [] - let count = 0 - let _pageover = false - - comps.forEach(comp => { - let item = fromJS(comp).toJS() - - if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 - item.data = item.dataArray || null - setData(item) - page.push(item) - comp.added = true - } - - if (_pageover) return - - if (item.$page && comp.dataArray.length > 0) { - item.data = [] - - while (count + 1 <= limit && comp.dataArray.length > 0) { - item.data.push(comp.dataArray.shift()) - count++ - } - - if (count >= limit || comp.dataArray.length > 0) { - _pageover = true - } - - if (comp.dataArray.length === 0) { + if (this.state.config.printPage === 'custom' && this.state.config.printScripts) { + try { + // eslint-disable-next-line + let func = new Function('components', 'pages', 'notification', this.state.config.printScripts) + func(comps, pages, notification) + } catch (e) { + console.warn(e) + + notification.warning({ + top: 92, + message: '鑷畾涔夎剼鏈墽琛岄敊璇紒', + duration: 5 + }) + } + } else { + while (!over) { + let page = [] + let count = 0 + let _pageover = false + + comps.forEach(comp => { + let item = fromJS(comp).toJS() + + if (item.wrap.printType === 'headerOrfooter') { // 椤电湁椤佃剼 + item.data = item.dataArray || null + setData(item) + page.push(item) comp.added = true } - - setData(item) - page.push(item) - } else if (!comp.added) { - if (item.wrap.printHeight) { - count += item.wrap.printHeight - if (count >= limit) { - _pageover = true - return + + if (_pageover) return + + if (item.$page && comp.dataArray.length > 0) { + item.data = [] + + while (count + 1 <= limit && comp.dataArray.length > 0) { + item.data.push(comp.dataArray.shift()) + count++ } + + if (count >= limit || comp.dataArray.length > 0) { + _pageover = true + } + + if (comp.dataArray.length === 0) { + comp.added = true + } + + setData(item) + page.push(item) + } else if (!comp.added) { + if (item.wrap.printHeight) { + count += item.wrap.printHeight + if (count >= limit) { + _pageover = true + return + } + } + + item.data = item.dataArray || null + + setData(item) + page.push(item) + comp.added = true } - - item.data = item.dataArray || null - - setData(item) - page.push(item) - comp.added = true + }) + + pages.push(page) + pageIndex++ + + if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) { + over = true } - }) - - pages.push(page) - pageIndex++ - - if (pageIndex >= 2000 || comps.findIndex(comp => !comp.added) === -1) { - over = true } } diff --git a/src/views/menudesign/index.scss b/src/views/menudesign/index.scss index dd386c7..5521e68 100644 --- a/src/views/menudesign/index.scss +++ b/src/views/menudesign/index.scss @@ -17,6 +17,13 @@ top: calc(50vh - 70px); z-index: 10; } + .mini-radio { + white-space: nowrap; + span.ant-radio + * { + padding-right: 0px; + padding-left: 4px; + } + } .mk-hidden { text-decoration: line-through!important; span { diff --git a/src/views/menudesign/printmenuform/index.jsx b/src/views/menudesign/printmenuform/index.jsx index 5809dcd..5aff337 100644 --- a/src/views/menudesign/printmenuform/index.jsx +++ b/src/views/menudesign/printmenuform/index.jsx @@ -1,14 +1,20 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, InputNumber, Select, Radio, Tooltip, Input } from 'antd' +import { Form, Row, Col, InputNumber, Select, Radio, Tooltip, Input, Modal } from 'antd' import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons' +import CodeMirror from '@/templates/zshare/codemirror' // import './index.scss' class MainSearch extends Component { static propTpyes = { config: PropTypes.object, updateConfig: PropTypes.func + } + + state = { + visible: false, + printScripts: '' } selectChange = (key, value) => { @@ -76,9 +82,22 @@ }) } + onScriptChange = (val) => { + this.setState({printScripts: val}) + } + + submit = () => { + const { config } = this.props + const { printScripts } = this.state + + this.setState({visible: false}) + this.props.updateConfig({...config, printScripts}) + } + render() { const { config } = this.props const { getFieldDecorator } = this.props.form + const { visible, printScripts } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -91,186 +110,206 @@ } return ( - <Form {...formItemLayout}> - <Row> - <Col span={24}> - <Form.Item label="鑿滃崟鍚嶇О"> - <span style={{display: 'inline-block', wordBreak: 'break-all', lineHeight: 1.5}}> - {config.MenuName} - </span> - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鑿滃崟鍙傛暟"> - <span style={{display: 'inline-block', wordBreak: 'break-all', lineHeight: 1.5}}> - {config.MenuNo} - </span> - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鎵撳嵃灏哄"> - {getFieldDecorator('pageSize', { - initialValue: config.pageSize || 'A4', - rules: [ - { - required: true, - message: '璇烽�夋嫨鎵撳嵃灏哄!' - } - ] - })( - <Select onChange={(val) => this.selectChange('pageSize', val)}> - <Select.Option value="A3">A3</Select.Option> - <Select.Option value="A4">A4</Select.Option> - <Select.Option value="A5">A5</Select.Option> - </Select> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鎵撳嵃甯冨眬"> - {getFieldDecorator('pageLayout', { - initialValue: config.pageLayout || 'vertical', - rules: [ - { - required: true, - message: '璇烽�夋嫨鎵撳嵃甯冨眬!' - } - ] - })( - <Radio.Group onChange={(e) => this.selectChange('pageLayout', e.target.value)}> - <Radio value="vertical">绾靛悜</Radio> - <Radio value="horizontal">妯悜</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鎵撳嵃杈硅窛"> - {getFieldDecorator('pagePadding', { - initialValue: config.pagePadding || 'default', - rules: [ - { - required: true, - message: '璇烽�夋嫨鎵撳嵃杈硅窛!' - } - ] - })( - <Radio.Group onChange={(e) => this.selectChange('pagePadding', e.target.value)}> - <Radio value="default">榛樿</Radio> - <Radio value="without">鏃�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="椤甸潰甯冨眬"> - {getFieldDecorator('printPage', { - initialValue: config.printPage || 'auto' - })( - <Radio.Group onChange={(e) => this.selectChange('printPage', e.target.value)}> - <Radio value="auto">鑷�傚簲</Radio> - <Radio value="page">鍒嗛〉</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - {config.printPage === 'page' ? <Col span={24}> - <Form.Item label="姣忛〉鏁�(鏉�)"> - {getFieldDecorator('everyPCount', { - initialValue: config.everyPCount || 15, - rules: [ - { - required: true, - message: '璇疯緭鍏ユ瘡椤垫暟!' - } - ] - })(<InputNumber min={1} max={1000} precision={1} onChange={(val) => this.selectChange('everyPCount', val)}/>)} - </Form.Item> - </Col> : null} - <Col span={24}> - <Form.Item label={ - <Tooltip placement="topLeft" title="閽堝涓嶈鍒欑焊寮狅紝鍙嚜瀹氫箟璁剧疆鎵撳嵃楂樺害鍜屽搴︼紝娉細鍚屾椂璁剧疆鎵撳嵃瀹藉害鍜岄珮搴﹀悗鏂瑰彲鐢熸晥銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鑷畾涔� - </Tooltip> - }> - {getFieldDecorator('printCustom', { - initialValue: config.printCustom || 'false' - })( - <Radio.Group onChange={(e) => this.selectChange('printCustom', e.target.value)}> - <Radio value="false">涓嶅惎鐢�</Radio> - <Radio value="true">鍚敤</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - {config.printCustom === 'true' ? <Col span={24}> - <Form.Item label="鎵撳嵃瀹藉害"> - {getFieldDecorator('printWidth', { - initialValue: config.printWidth || '' - })(<InputNumber min={10} max={9999} precision={0} onChange={(val) => this.selectChange('printWidth', val)}/>)} - </Form.Item> - </Col> : null} - {config.printCustom === 'true' ? <Col span={24}> - <Form.Item label="鎵撳嵃楂樺害"> - {getFieldDecorator('printHeight', { - initialValue: config.printHeight || '' - })(<InputNumber min={10} max={9999} precision={0} onChange={(val) => this.selectChange('printHeight', val)}/>)} - </Form.Item> - </Col> : null} - <Col span={24}> - <Form.Item label="鍥炶皟"> - {getFieldDecorator('callback', { - initialValue: config.callback || 'false' - })( - <Radio.Group onChange={(e) => this.selectChange('callback', e.target.value)}> - <Radio value="false">涓嶅惎鐢�</Radio> - <Radio value="true">鍚敤</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - {config.callback === 'true' ? <Col span={24}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鍥炶皟鍑芥暟鎵ц鎴愬姛鍚庨粯璁や細鍒锋柊婧愯彍鍗曢〉锛岃繑鍥炰俊鎭紙@retmsg锛変腑鍚湁锛園no_target_menu@锛夊彲闃绘姝ら」鍒锋柊銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鍥炶皟鍑芥暟 - </Tooltip> - }> - s_print_proc <EditOutlined style={{cursor: 'pointer'}} onClick={() => {window.open('#/proc/s_print_proc')}}/> - </Form.Item> - </Col> : null} - {config.callback === 'true' ? <Col span={24}> - <Form.Item label="鍥炶皟鍙傛暟"> - {getFieldDecorator('callNo', { - initialValue: config.callNo || '', - rules: [ - { - required: true, - message: '璇峰~鍐欏洖璋冨弬鏁�!' - }, - { - pattern: /^[a-zA-Z0-9_]+$/, - message: '鍥炶皟鍙傛暟鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯' - } - ] - })(<Input onChange={(e) => this.selectChange('callNo', e.target.value)}/>)} - </Form.Item> - </Col> : null} - <Col span={24}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鍙嚜瀹氫箟鍦ㄦ祻瑙堝櫒鏍囬鏍忎腑鏄剧ず鐨勭綉椤垫爣棰樸��"> - <QuestionCircleOutlined className="mk-form-tip" /> - 缃戦〉鏍囬 - </Tooltip> - }> - {getFieldDecorator('webTitle', { - initialValue: config.webTitle || '' - })(<Input onChange={(e) => this.selectChange('webTitle', e.target.value)}/>)} - </Form.Item> - </Col> - </Row> - </Form> + <> + <Form {...formItemLayout}> + <Row> + <Col span={24}> + <Form.Item label="鑿滃崟鍚嶇О"> + <span style={{display: 'inline-block', wordBreak: 'break-all', lineHeight: 1.5}}> + {config.MenuName} + </span> + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鑿滃崟鍙傛暟"> + <span style={{display: 'inline-block', wordBreak: 'break-all', lineHeight: 1.5}}> + {config.MenuNo} + </span> + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鎵撳嵃灏哄"> + {getFieldDecorator('pageSize', { + initialValue: config.pageSize || 'A4', + rules: [ + { + required: true, + message: '璇烽�夋嫨鎵撳嵃灏哄!' + } + ] + })( + <Select onChange={(val) => this.selectChange('pageSize', val)}> + <Select.Option value="A3">A3</Select.Option> + <Select.Option value="A4">A4</Select.Option> + <Select.Option value="A5">A5</Select.Option> + </Select> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鎵撳嵃甯冨眬"> + {getFieldDecorator('pageLayout', { + initialValue: config.pageLayout || 'vertical', + rules: [ + { + required: true, + message: '璇烽�夋嫨鎵撳嵃甯冨眬!' + } + ] + })( + <Radio.Group onChange={(e) => this.selectChange('pageLayout', e.target.value)}> + <Radio value="vertical">绾靛悜</Radio> + <Radio value="horizontal">妯悜</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鎵撳嵃杈硅窛"> + {getFieldDecorator('pagePadding', { + initialValue: config.pagePadding || 'default', + rules: [ + { + required: true, + message: '璇烽�夋嫨鎵撳嵃杈硅窛!' + } + ] + })( + <Radio.Group onChange={(e) => this.selectChange('pagePadding', e.target.value)}> + <Radio value="default">榛樿</Radio> + <Radio value="without">鏃�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="椤甸潰甯冨眬"> + {getFieldDecorator('printPage', { + initialValue: config.printPage || 'auto' + })( + <Radio.Group className="mini-radio" onChange={(e) => this.selectChange('printPage', e.target.value)}> + <Radio value="auto">鑷�傚簲</Radio> + <Radio value="page">鍒嗛〉</Radio> + <Radio value="custom">鑷畾涔�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + {config.printPage === 'custom' ? <Col span={24}> + <Form.Item label="鑷畾涔夎剼鏈�"> + <EditOutlined style={{color: '#1890ff'}} onClick={() => this.setState({visible: true, printScripts: config.printScripts || ''})} /> + </Form.Item> + </Col> : null} + {config.printPage === 'page' ? <Col span={24}> + <Form.Item label="姣忛〉鏁�(鏉�)"> + {getFieldDecorator('everyPCount', { + initialValue: config.everyPCount || 15, + rules: [ + { + required: true, + message: '璇疯緭鍏ユ瘡椤垫暟!' + } + ] + })(<InputNumber min={1} max={1000} precision={1} onChange={(val) => this.selectChange('everyPCount', val)}/>)} + </Form.Item> + </Col> : null} + <Col span={24}> + <Form.Item label={ + <Tooltip placement="topLeft" title="閽堝涓嶈鍒欑焊寮狅紝鍙嚜瀹氫箟璁剧疆鎵撳嵃楂樺害鍜屽搴︼紝娉細鍚屾椂璁剧疆鎵撳嵃瀹藉害鍜岄珮搴﹀悗鏂瑰彲鐢熸晥銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鑷畾涔� + </Tooltip> + }> + {getFieldDecorator('printCustom', { + initialValue: config.printCustom || 'false' + })( + <Radio.Group onChange={(e) => this.selectChange('printCustom', e.target.value)}> + <Radio value="false">涓嶅惎鐢�</Radio> + <Radio value="true">鍚敤</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + {config.printCustom === 'true' ? <Col span={24}> + <Form.Item label="鎵撳嵃瀹藉害"> + {getFieldDecorator('printWidth', { + initialValue: config.printWidth || '' + })(<InputNumber min={10} max={9999} precision={0} onChange={(val) => this.selectChange('printWidth', val)}/>)} + </Form.Item> + </Col> : null} + {config.printCustom === 'true' ? <Col span={24}> + <Form.Item label="鎵撳嵃楂樺害"> + {getFieldDecorator('printHeight', { + initialValue: config.printHeight || '' + })(<InputNumber min={10} max={9999} precision={0} onChange={(val) => this.selectChange('printHeight', val)}/>)} + </Form.Item> + </Col> : null} + <Col span={24}> + <Form.Item label="鍥炶皟"> + {getFieldDecorator('callback', { + initialValue: config.callback || 'false' + })( + <Radio.Group onChange={(e) => this.selectChange('callback', e.target.value)}> + <Radio value="false">涓嶅惎鐢�</Radio> + <Radio value="true">鍚敤</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + {config.callback === 'true' ? <Col span={24}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鍥炶皟鍑芥暟鎵ц鎴愬姛鍚庨粯璁や細鍒锋柊婧愯彍鍗曢〉锛岃繑鍥炰俊鎭紙@retmsg锛変腑鍚湁锛園no_target_menu@锛夊彲闃绘姝ら」鍒锋柊銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍥炶皟鍑芥暟 + </Tooltip> + }> + s_print_proc <EditOutlined style={{cursor: 'pointer'}} onClick={() => {window.open('#/proc/s_print_proc')}}/> + </Form.Item> + </Col> : null} + {config.callback === 'true' ? <Col span={24}> + <Form.Item label="鍥炶皟鍙傛暟"> + {getFieldDecorator('callNo', { + initialValue: config.callNo || '', + rules: [ + { + required: true, + message: '璇峰~鍐欏洖璋冨弬鏁�!' + }, + { + pattern: /^[a-zA-Z0-9_]+$/, + message: '鍥炶皟鍙傛暟鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯' + } + ] + })(<Input onChange={(e) => this.selectChange('callNo', e.target.value)}/>)} + </Form.Item> + </Col> : null} + <Col span={24}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鍙嚜瀹氫箟鍦ㄦ祻瑙堝櫒鏍囬鏍忎腑鏄剧ず鐨勭綉椤垫爣棰樸��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 缃戦〉鏍囬 + </Tooltip> + }> + {getFieldDecorator('webTitle', { + initialValue: config.webTitle || '' + })(<Input onChange={(e) => this.selectChange('webTitle', e.target.value)}/>)} + </Form.Item> + </Col> + </Row> + </Form> + <Modal + title="鑷畾涔夎剼鏈�" + wrapClassName="normal-css-modal" + visible={visible} + width={800} + maskClosable={false} + onOk={this.submit} + onCancel={() => { this.setState({ visible: false })}} + destroyOnClose + > + <CodeMirror mode="text/javascript" theme="cobalt" value={printScripts} onChange={this.onScriptChange} /> + </Modal> + </> ) } } -- Gitblit v1.8.0