From f830c733cbc071f023c9a9a4e1571b7c81d672bf Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 12 十一月 2020 11:47:33 +0800 Subject: [PATCH] 2020-11-12 --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 10 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 36 - src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx | 3 src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx | 5 src/tabviews/zshare/chartcomponent/index.jsx | 42 -- src/templates/sharecomponent/chartcomponent/index.jsx | 7 src/menu/components/chart/antv-bar/index.jsx | 11 src/views/billprint/index.scss | 173 +------------ src/menu/actioncomponent/verifyprint/index.jsx | 6 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 17 + src/views/billprint/index.jsx | 207 ++++++++++----- src/tabviews/subtable/index.jsx | 2 src/tabviews/subtabtable/index.jsx | 2 src/views/menudesign/index.jsx | 2 src/tabviews/custom/components/card/data-card/index.jsx | 6 src/index.js | 2 src/tabviews/custom/components/card/table-card/index.jsx | 6 src/tabviews/custom/components/card/cardcellList/index.jsx | 11 src/tabviews/custom/components/card/prop-card/index.jsx | 6 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 8 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx | 13 src/templates/zshare/formconfig.jsx | 10 src/menu/components/chart/antv-pie/chartcompile/index.jsx | 5 src/menu/datasource/verifycard/settingform/index.jsx | 16 src/tabviews/custom/components/chart/antv-pie/index.jsx | 29 - src/menu/components/chart/antv-pie/index.jsx | 2 src/menu/modelsource/option.jsx | 2 src/components/404/index.scss | 5 src/templates/sharecomponent/actioncomponent/index.jsx | 12 src/tabviews/custom/index.jsx | 51 ++- src/templates/zshare/createinterface/index.jsx | 41 ++ src/menu/components/card/data-card/wrapsetting/settingform/index.jsx | 4 src/templates/sharecomponent/chartgroupcomponent/index.jsx | 2 33 files changed, 358 insertions(+), 396 deletions(-) diff --git a/src/components/404/index.scss b/src/components/404/index.scss index b8e9a30..90c0bbd 100644 --- a/src/components/404/index.scss +++ b/src/components/404/index.scss @@ -1,6 +1,11 @@ .box404 { max-height: calc(100vh - 110px); text-align: center; + + .ant-result-title { + font-size: 18px; + color: #1890ff; + } } .ant-tabs-tabpane { >.box404 { diff --git a/src/index.js b/src/index.js index d7d92dc..5d93fdd 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ import React from 'react' import ReactDOM from 'react-dom' import Route from './router' -import {Provider} from 'react-redux' +import { Provider } from 'react-redux' import store from '@/store' import * as serviceWorker from './serviceWorker' import options from '@/store/options.js' diff --git a/src/menu/actioncomponent/verifyprint/index.jsx b/src/menu/actioncomponent/verifyprint/index.jsx index ecbed5d..6327b6a 100644 --- a/src/menu/actioncomponent/verifyprint/index.jsx +++ b/src/menu/actioncomponent/verifyprint/index.jsx @@ -47,9 +47,9 @@ componentDidMount() { let _sql = `select PrintTempNO,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate - where appkey= @appkey@ and Deleted=0 - union select ID,Images,a.PrintTempNO+PrintTempName as PN - from (select * from sPrintTemplate where appkey= '' and Deleted=0 ) a + where appkey= @appkey@ and Deleted=0 and typechartwo='' + union select a.PrintTempNO,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='') a left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b on a.PrintTempNO=b.PrintTempNO left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c diff --git a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx index 8f7a501..54cc70f 100644 --- a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx +++ b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx @@ -172,7 +172,7 @@ })(<InputNumber min={100} max={2000} precision={0} onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> : null} - <Col span={12}> + {MenuType !== 'billPrint' ? <Col span={12}> <Form.Item label="榛戝悕鍗�"> {getFieldDecorator('blacklist', { initialValue: wrap.blacklist || [] @@ -188,7 +188,7 @@ </Select> )} </Form.Item> - </Col> + </Col> : null} </Row> </Form> </div> diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx index 4bc2436..4b3fe02 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx @@ -8,7 +8,7 @@ * @param {object} card // 鍥捐〃瀵硅薄 * @param {Array} columns // 鏄剧ず鍒� */ -export function getBarOrLineChartOptionForm (card, columns, sysRoles = []) { +export function getBarOrLineChartOptionForm (card, columns, sysRoles = [], MenuType) { let shapes = [] let _sysRoles = sysRoles.map(item => ({...item, field: item.value, label: item.text})) @@ -279,13 +279,13 @@ required: true }, { type: 'number', - key: 'correction', - label: '鏁版嵁淇', - tooltip: '褰撴暟鎹」灏戜簬璁剧疆鍊兼椂锛岀郴缁熶細鑷姩淇锛堥伩鍏嶆煴褰㈠浘杩囧锛�,鍦ㄨ嚜瀹氫箟涓紝璁剧疆涓烘姌绾垮浘鏃跺け鏁堛��', + key: 'barSize', + label: '鏌卞舰瀹藉害', + tooltip: '绌哄�兼椂锛屽搴﹁嚜閫傚簲銆�', min: 5, - max: 30, + max: 100, decimal: 0, - initVal: card.correction, + initVal: card.barSize, forbid: !['bar'].includes(card.chartType), required: false }, { @@ -309,6 +309,7 @@ initVal: card.blacklist || [], multi: true, required: false, + forbid: MenuType === 'billPrint', options: _sysRoles } ] diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index 813701b..169aff2 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -12,6 +12,7 @@ class LineChartDrawerForm extends Component { static propTpyes = { + MenuType: PropTypes.any, dict: PropTypes.object, plot: PropTypes.object, sysRoles: PropTypes.array, @@ -67,7 +68,7 @@ } showDrawer = () => { - const { config, sysRoles } = this.props + const { config, sysRoles, MenuType } = this.props let fieldName = {} config.columns.forEach(col => { @@ -76,13 +77,18 @@ } }) + if (config.plot.correction) { + delete config.plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛� + config.plot.barSize = 35 + } + this.setState({ visible: true, view: 'normal', disabled: config.plot.datatype === 'statistics', fieldName: fieldName, plot: fromJS(config.plot).toJS(), - formlist: getBarOrLineChartOptionForm(config.plot, config.columns, sysRoles) + formlist: getBarOrLineChartOptionForm(config.plot, config.columns, sysRoles, MenuType) }) } diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 4c4453b..579d22f 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -44,6 +44,7 @@ customs: [], width: 24, height: 400, + barSize: 35, name: card.name } @@ -601,6 +602,10 @@ if (plot.label === 'true') { _chart.label('value') } + + if (plot.barSize || plot.correction) { + _chart.size(plot.barSize || 35) + } } else if (plot.adjust === 'stack') { let _chart = chart .interval() @@ -611,6 +616,10 @@ if (plot.label === 'true') { _chart.label('value') + } + + if (plot.barSize || plot.correction) { + _chart.size(plot.barSize || 35) } } @@ -750,7 +759,7 @@ <div className="mk-popover-control"> {menu && menu.MenuType !== 'billPrint' ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> : null} {menu && menu.MenuType !== 'billPrint' ? <Icon className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton} type="plus-square" /> : null} - {menu ? <ChartCompileForm config={card} sysRoles={menu.sysRoles} dict={this.state.dict} plotchange={this.updateComponent}/> : null} + {menu ? <ChartCompileForm config={card} sysRoles={menu.sysRoles} MenuType={menu.MenuType} dict={this.state.dict} plotchange={this.updateComponent}/> : null} <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx index 72807d9..5379e71 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/formconfig.jsx @@ -8,7 +8,7 @@ * @param {object} card // 鍥捐〃瀵硅薄 * @param {Array} columns // 鏄剧ず鍒� */ -export function getPieChartOptionForm (card, columns, sysRoles = []) { +export function getPieChartOptionForm (card, columns, sysRoles = [], MenuType) { let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype)) let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype)) let _sysRoles = sysRoles.map(item => ({...item, field: item.value, label: item.text})) @@ -204,6 +204,7 @@ initVal: card.blacklist || [], multi: true, required: false, + forbid: MenuType === 'billPrint', options: _sysRoles } ] diff --git a/src/menu/components/chart/antv-pie/chartcompile/index.jsx b/src/menu/components/chart/antv-pie/chartcompile/index.jsx index da4c13c..f883858 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/index.jsx @@ -9,6 +9,7 @@ class LineChartDrawerForm extends Component { static propTpyes = { + MenuType: PropTypes.any, dict: PropTypes.object, plot: PropTypes.object, sysRoles: PropTypes.array, @@ -23,12 +24,12 @@ } showDrawer = () => { - const { config, sysRoles } = this.props + const { config, sysRoles, MenuType } = this.props this.setState({ visible: true, plot: fromJS(config.plot).toJS(), - formlist: getPieChartOptionForm(config.plot, config.columns, sysRoles) + formlist: getPieChartOptionForm(config.plot, config.columns, sysRoles, MenuType) }) } diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 80d29c8..82d6720 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -426,7 +426,7 @@ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> {menu && menu.MenuType !== 'billPrint' ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> : null} - {menu ? <ChartCompileForm config={card} sysRoles={menu.sysRoles} dict={this.state.dict} plotchange={this.updateComponent}/> : null} + {menu ? <ChartCompileForm config={card} sysRoles={menu.sysRoles} MenuType={menu.MenuType} dict={this.state.dict} plotchange={this.updateComponent}/> : null} <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index d78158d..66c48d5 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -22,7 +22,8 @@ interType: this.props.setting.interType || 'system', laypage: this.props.setting.laypage || 'true', modules: [], - useMSearch: this.props.setting.useMSearch || 'false' + useMSearch: this.props.setting.useMSearch || 'false', + supModule: this.props.setting.supModule || [] } UNSAFE_componentWillMount () { @@ -172,10 +173,14 @@ } } + changeSupModule = (val) => { + this.setState({supModule: val}) + } + render() { const { setting, menu, columns, config } = this.props const { getFieldDecorator } = this.props.form - const { interType, modules, useMSearch, laypage } = this.state + const { interType, modules, useMSearch, laypage, supModule } = this.state const formItemLayout = { labelCol: { @@ -377,7 +382,7 @@ </Tooltip> }> {getFieldDecorator('supModule', { - initialValue: setting.supModule || [], + initialValue: supModule, rules: [ { required: true, @@ -385,7 +390,7 @@ } ] })( - <Cascader options={modules} expandTrigger="hover" placeholder="" /> + <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" /> )} </Form.Item> </Col> : null} @@ -419,7 +424,8 @@ })(<InputNumber min={1} max={500} precision={0} />)} </Form.Item> </Col> : null} - {!config.pageable || (config.pageable && laypage === 'false') ? <Col span={8}> + {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 2銆佹墦鍗版椂 */} + {((!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty')) || menu.MenuType === 'billPrint' ? <Col span={8}> <Form.Item label={ <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}> <Icon type="question-circle" /> diff --git a/src/menu/modelsource/option.jsx b/src/menu/modelsource/option.jsx index 0d3509e..c74af33 100644 --- a/src/menu/modelsource/option.jsx +++ b/src/menu/modelsource/option.jsx @@ -21,7 +21,7 @@ { type: 'menu', url: Mainsearch, component: 'search', subtype: 'mainsearch', title: '鎼滅储鏉′欢', width: 24, forbid: ['billPrint'] }, { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '鏁版嵁鍗�', config: `[{"uuid":"160135809128212dm7i29fim9ksto9od","setting":{"width":6},"style":{"paddingTop":"15px","marginTop":"4px","paddingRight":"15px","marginRight":"8px","marginLeft":"8px","backgroundColor":"rgba(255, 255, 255, 1)","borderColor":"#e8e8e8","paddingLeft":"15px","marginBottom":"4px","borderWidth":"1px","paddingBottom":"10px"},"backStyle":{},"elements":[{"datatype":"static","width":12,"marks":null,"height":1,"value":"鍏冲崟","style":{},"prefix":"","postfix":"","format":"","eleType":"text","uuid":"160231860159931untbea62sgokunc5s"},{"datatype":"dynamic","width":12,"marks":null,"style":{"color":"rgba(250, 219, 20, 1)","textAlign":"right"},"btnstyle":{},"eleType":"icon","icon":"question-circle","field":"nvarchar2","uuid":"1602318768361nv8ql4t47sgcsn88b0u"},{"datatype":"static","width":24,"marks":null,"height":1,"innerHeight":36,"value":"100","style":{"fontSize":"24px","fontWeight":"500","color":"rgba(0, 0, 0, 1)"},"prefix":"","btnstyle":{},"postfix":"","format":"","eleType":"text","uuid":"1602318817884v70gtgb65ubnm8mbcvv"},{"color":"#1890ff","width":24,"marks":null,"maxValue":100,"style":{"color":"rgba(250, 140, 22, 1)","paddingTop":"20px","paddingBottom":"10px"},"btnstyle":{},"eleType":"slider","field":"int1","uuid":"16023188871233rkktuvpp1h077igrsu"},{"eleType":"splitline","width":24,"color":"#e8e8e8","uuid":"1602320017038n31bk9o831ggug0tu0b","marks":null,"style":{"marginTop":"10px","marginBottom":"10px"},"btnstyle":{}},{"datatype":"static","width":12,"marks":null,"height":1,"value":"100","style":{"marginTop":"6px"},"prefix":"鍏冲崟","btnstyle":{},"postfix":"","format":"","eleType":"text","uuid":"1602320061243drd7lf3agvn04kgr175"}],"backElements":[]}]` }, { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '灞炴�у崱', config: `[{"uuid":"1603681387259qaqf1127f72esmtchge","setting":{"width":6,"type":"simple"},"style":{"paddingTop":"15px","marginTop":"8px","paddingRight":"15px","marginRight":"8px","marginLeft":"8px","borderColor":"#e8e8e8","paddingLeft":"15px","marginBottom":"8px","borderWidth":"1px","paddingBottom":"15px"},"backStyle":{},"elements":[{"datatype":"static","width":12,"marks":null,"height":1,"value":"瓒呮椂宸ュ崟","style":{"color":"rgba(67, 67, 67, 0.51)"},"prefix":"","postfix":"","format":"","eleType":"text","uuid":"1603681402945qnkgm7q8cng65evn5ev"},{"eleType":"icon","datatype":"static","width":12,"icon":"question-circle","tooltip":"瓒呮椂宸ュ崟","uuid":"1603681473384i2crkbtofg4pu76k06a","marks":null,"style":{"textAlign":"right","color":"rgba(250, 219, 20, 1)"}},{"datatype":"static","width":24,"marks":null,"height":1,"innerHeight":36,"value":"100","style":{"fontSize":"24px","color":"rgba(0, 0, 0, 1)"},"prefix":"","postfix":"","format":"","eleType":"number","uuid":"1603681539870d704ufqf98kc6t7537t"},{"color":"rgba(250, 219, 20, 1)","datatype":"static","width":24,"marks":null,"maxValue":100,"value":50,"style":{"paddingTop":"10px","paddingBottom":"10px"},"eleType":"slider","uuid":"1603683067556mvupau0odvrtv45u7o8"},{"eleType":"splitline","width":24,"color":"#e8e8e8","uuid":"1603683117981t9k55k8an430fuppmci","marks":null,"style":{"paddingTop":"5px","paddingBottom":"5px"}},{"datatype":"static","width":12,"marks":null,"height":1,"value":"100","style":{"color":"rgba(0, 0, 0, 0.65)","marginTop":"10px"},"prefix":"瓒呮椂宸ュ崟 ","postfix":"","format":"","eleType":"text","uuid":"1603683136553uvsmkfohkft9idbfkhu"}],"backElements":[]}]` }, - { type: 'menu', url: TableCard, component: 'table', subtype: 'tablecard', title: '琛ㄦ牸', width: 12, forbid: ['billPrint'] }, + { type: 'menu', url: TableCard, component: 'table', subtype: 'tablecard', title: '琛ㄦ牸', width: 12 }, { type: 'menu', url: line, component: 'line', subtype: 'line', title: '鎶樼嚎鍥�' }, { type: 'menu', url: line1, component: 'line', subtype: 'line1', title: '闃舵鎶樼嚎鍥�' }, { type: 'menu', url: bar, component: 'bar', subtype: 'bar', title: '鏌辩姸鍥�' }, diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 05728a2..64acb89 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -145,7 +145,16 @@ } if (card.col && card.col.type === 'number') { - val = val.toFixed(card.col.decimal || 0) + let decimal = card.col.decimal || 0 + + if (card.format === 'percent') { + decimal = decimal - 2 + } + if (decimal < 0) { + decimal = 0 + } + + val = val.toFixed(decimal) } else { val = '' + val } diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 4ac800b..712d50a 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -74,10 +74,6 @@ }, () => { if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') { this.loadData() - } else if (_sync && !_data) { - this.setState({ - loading: true - }) } }) } @@ -99,7 +95,7 @@ _data = nextProps.data[config.dataName] || [] } - this.setState({sync: false, loading: false, data: _data}) + this.setState({sync: false, data: _data}) } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { if (config.setting.syncRefresh === 'true') { this.setState({}, () => { diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 7073848..eb10b83 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -77,10 +77,6 @@ }, () => { if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true' && _config.setting.onload === 'true') { this.loadData() - } else if (_sync && !_data) { - this.setState({ - loading: true - }) } }) } @@ -115,7 +111,7 @@ } } - this.setState({sync: false, loading: false, data: _data}) + this.setState({sync: false, data: _data}) } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { if (config.wrap.datatype !== 'static' && config.setting.syncRefresh === 'true') { this.setState({}, () => { diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index abbc960..b0bae18 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -80,10 +80,6 @@ }, () => { if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') { this.loadData() - } else if (_sync && !_data) { - this.setState({ - loading: true - }) } }) } @@ -115,7 +111,7 @@ _data = nextProps.data[config.dataName] || [] } - this.setState({sync: false, loading: false, data: _data}) + this.setState({sync: false, data: _data}) } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { if (config.setting.syncRefresh === 'true') { this.setState({}, () => { diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index d16b55b..e249816 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -127,14 +127,8 @@ }, () => { if (config.setting.sync !== 'true' && config.setting.onload === 'true') { this.loadData() - } else if (config.setting.sync === 'true') { - if (!_data) { - this.setState({ - loading: true - }) - } else { - this.handleData() - } + } else if (config.setting.sync === 'true' && _data) { + this.handleData() } }) } @@ -158,7 +152,7 @@ _data = nextProps.data[config.dataName] || [] } - this.setState({sync: false, loading: false, data: _data}, () => { + this.setState({sync: false, data: _data}, () => { this.handleData() }) } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { @@ -351,22 +345,6 @@ }) _data = [..._mdata.values()] - } - - if (plot.correction && plot.chartType === 'bar' && _data.length > 0 && _data.length < plot.correction) { - if (plot.enabled !== 'true' || (plot.customs && plot.customs.filter(cell => cell.chartType !== 'bar').length === 0)) { - let _num = plot.correction - _data.length - for (let i = 0; i < _num; i++) { - let _val = Array( i + 2 ).join(' ') - let _cell = {} - _cell[plot.Xaxis] = _val - vFields.forEach(col => { - _cell[col.field] = '' - }) - - _data.push(_cell) - } - } } this.setState({empty: _data.length === 0}) @@ -1003,6 +981,10 @@ if (plot.label === 'true') { _chart.label(_valfield) } + + if (plot.barSize || plot.correction) { + _chart.size(plot.barSize || 35) + } } else if (plot.adjust === 'stack') { let _chart = chart .interval() @@ -1020,6 +1002,10 @@ if (plot.label === 'true') { _chart.label(_valfield) } + + if (plot.barSize || plot.correction) { + _chart.size(plot.barSize || 35) + } } chart.render() diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index ec05d38..1b755b4 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -72,14 +72,8 @@ }, () => { if (config.setting.sync !== 'true' && config.setting.onload === 'true') { this.loadData() - } else if (config.setting.sync === 'true') { - if (!_data) { - this.setState({ - loading: true - }) - } else { - this.handleData() - } + } else if (config.setting.sync === 'true' && _data) { + this.handleData() } }) } @@ -103,7 +97,7 @@ _data = nextProps.data[config.dataName] || [] } - this.setState({sync: false, loading: false, data: _data}, () => { + this.setState({sync: false, data: _data}, () => { this.handleData() }) } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { @@ -374,19 +368,13 @@ _chart.label(Y_axis, { offset: -30, content: (data) => { - let _label = '' let _val = '' if (plot.show !== 'value') { _val = `${(data[Y_axis] * 100).toFixed(2)}%` } else { _val = `${data[Y_axis]}` } - if (plot.label === 'inner') { - _label = _val - } else { - _label = `${data[X_axis]}: ${_val}` - } - return _label + return _val }, style: { textAlign: 'center', @@ -401,19 +389,14 @@ layout: { type: 'pie-spider' }, labelHeight: 20, content: (data) => { - let _label = '' let _val = '' if (plot.show !== 'value') { _val = `${(data[Y_axis] * 100).toFixed(2)}%` } else { _val = `${data[Y_axis]}` } - if (plot.label === 'inner') { - _label = _val - } else { - _label = `${data[X_axis]}: ${_val}` - } - return _label + + return `${data[X_axis]}: ${_val}` }, labelLine: { style: { diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 82880b1..f667bbb 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -43,8 +43,6 @@ config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 mainSearch: null, userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� - arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� @@ -67,12 +65,6 @@ let config = '' let userConfig = null - setTimeout(() => { // 寤舵椂鍔犺浇鐘舵�� - this.setState({ - loadingview: false - }) - }, 1500) - try { // 閰嶇疆淇℃伅瑙f瀽 config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) } catch (e) { @@ -89,11 +81,12 @@ userConfig = null } } - + // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� if (!config) { this.setState({ - viewlost: true + viewlost: true, + loadingview: false }) return } @@ -102,6 +95,7 @@ if (!config.enabled) { this.setState({ viewlost: true, + loadingview: false, lostmsg: this.state.dict['main.view.unenabled'] }) return @@ -146,16 +140,24 @@ }) let params = [] - config.components = this.formatSetting(config.components, params, mainSearch, permAction) + let BID = param && param.BID ? param.BID : '' + config.components = this.formatSetting(config.components, params, mainSearch, permAction, BID) this.setState({ - BID: param && param.BID ? param.BID : '', + BID: BID, userConfig: userConfig, - setting: config.setting, config, mainSearch }, () => { - this.loadmaindata(params) + if (!params || params.length === 0) { + setTimeout(() => { // 寤舵椂鍔犺浇鐘舵�� + this.setState({ + loadingview: false + }) + }, 1000) + } else { + this.loadmaindata(params) + } }) } else { this.setState({ @@ -207,7 +209,7 @@ } // 鏍煎紡鍖栭粯璁よ缃� - formatSetting = (components, params, mainSearch, permAction) => { + formatSetting = (components, params, mainSearch, permAction, BID) => { return components.map(component => { if (component.type === 'tabs') { component.subtabs = component.subtabs.map(tab => { @@ -266,7 +268,7 @@ // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ if (component.floor === 1 && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') { - let param = this.getDefaultParam(component, mainSearch) + let param = this.getDefaultParam(component, mainSearch, BID) params.push(param) } else if (component.floor === 1) { component.setting.sync = 'false' @@ -279,7 +281,7 @@ /** * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� */ - getDefaultParam = (component, mainSearch) => { + getDefaultParam = (component, mainSearch, BID) => { const { columns, search, setting, dataName, format } = component let searchlist = [] @@ -300,6 +302,7 @@ let _dataresource = setting.dataresource let _customScript = setting.customScript + if (setting.queryType === 'statistics' || _customScript) { let allSearch = Utils.getAllSearchOptions(searchlist) let regoptions = allSearch.map(item => { @@ -313,10 +316,11 @@ if (_dataresource && setting.queryType === 'statistics') { _dataresource = _dataresource.replace(item.reg, item.value) } - if (_customScript) { - _customScript = _customScript.replace(item.reg, item.value) - } + _customScript = _customScript.replace(item.reg, item.value) }) + + _dataresource = _dataresource.replace(/@BID@/ig, BID) + _customScript = _customScript.replace(/@BID@/ig, BID) } let _search = '' @@ -353,7 +357,6 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ loadmaindata = (params) => { - if (!params || params.length === 0) return let LText_field = [] let LText = params.map((item, index) => { let _sql = item.sql @@ -381,6 +384,8 @@ param.LText_field = Utils.formatOptions(param.LText_field) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + this.setState({loading: true, loadingview: false}) Api.getLocalConfig(param).then(result => { if (result.status) { @@ -511,11 +516,11 @@ render() { const { menuType, MenuNo } = this.props - const { loadingview, viewlost, config } = this.state + const { loadingview, viewlost, config, loading } = this.state return ( <div className="custom-page-wrap" id={this.state.ContainerId} style={config ? config.style : null}> - {loadingview && <Spin size="large" />} + {(loadingview || loading) ? <Spin size="large" /> : null} <Row>{this.getComponents()}</Row> {MenuNo && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button icon="copy" diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 5df98ae..cb53311 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -766,7 +766,7 @@ ) } else if (item.chartType === 'card') { return ( - <Col span={item.width} key={item.uuid}> + <Col className="card-view" span={item.width} key={item.uuid}> <CardComponent plot={item} config={config} diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 7602306..971d1d8 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -631,7 +631,7 @@ ) } else if (item.chartType === 'card') { return ( - <Col span={item.width} key={item.uuid}> + <Col className="card-view" span={item.width} key={item.uuid}> <CardComponent tableId="" plot={item} diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 0d53b5d..58da1e0 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import { Button, notification, Modal } from 'antd' @@ -47,7 +48,7 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId) => { - const { setting, btn, selectedData } = this.props + const { setting, btn, selectedData, dataManager } = this.props const _this = this if (triggerId && btn.uuid !== triggerId) return @@ -91,7 +92,7 @@ } if (btn.pageTemplate === 'billprint') { - let src = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp }))) + let src = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, dataManager: dataManager }))) window.open(src) } else if (btn.pageTemplate === 'billprintTemp') { let src = '#/menudesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'billPrint', MenuId: Id, MenuNo: MenuNo, MenuName: name || '鎵撳嵃', Remark: Remark }))) @@ -162,4 +163,14 @@ } } -export default NewPageButton \ No newline at end of file +const mapStateToProps = (state) => { + return { + dataManager: state.dataManager + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(NewPageButton) \ No newline at end of file diff --git a/src/tabviews/zshare/chartcomponent/index.jsx b/src/tabviews/zshare/chartcomponent/index.jsx index 4edb9b1..65a9f92 100644 --- a/src/tabviews/zshare/chartcomponent/index.jsx +++ b/src/tabviews/zshare/chartcomponent/index.jsx @@ -233,22 +233,6 @@ _data = [..._mdata.values()] } - if (plot.correction && plot.chartType === 'bar' && _data.length > 0 && _data.length < plot.correction) { - if (plot.enabled !== 'true' || (plot.customs && plot.customs.filter(cell => cell.chartType !== 'bar').length === 0)) { - let _num = plot.correction - _data.length - for (let i = 0; i < _num; i++) { - let _val = Array( i + 2 ).join(' ') - let _cell = {} - _cell[plot.Xaxis] = _val - _columns.forEach(col => { - _cell[col.field] = '' - }) - - _data.push(_cell) - } - } - } - this.setState({empty: _data.length === 0}) return _data } @@ -871,6 +855,7 @@ let _chart = chart .interval() .position(`${plot.Xaxis}*${_valfield}`) + .size(30) .color(_typefield) .adjust([ { @@ -893,6 +878,7 @@ let _chart = chart .interval() .position(`${plot.Xaxis}*${_valfield}`) + .size(30) .color(_typefield) .adjust('stack') .shape(plot.shape || 'rect') @@ -995,8 +981,10 @@ } }) - if (plot.label === 'true') { - let setting = { + if (plot.label !== 'false') { + _chart.label('percent', { + layout: { type: 'pie-spider' }, + labelHeight: 20, content: (data) => { let val = data[plot.Xaxis] if (val) { @@ -1006,20 +994,14 @@ } } return `${val}: ${(data.percent * 100).toFixed(2)}%` + }, + labelLine: { + style: { + lineWidth: 0.5, + }, } - } - - if (plot.labelLayout === 'overlap') { - setting.type = 'pie' - setting.layout = { - type: 'overlap' - } - setting.offset = 0 - } - - _chart.label('percent', setting) + }) } - } else { let _chart = chart .interval() diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 9d03aa8..4302d09 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -75,11 +75,11 @@ } getBillPrintTemp = () => { - let _sql = `select PrintTempNO,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate - where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' + let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate + where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' union select ID,Images,a.PrintTempNO+PrintTempName as PN - from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a - left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b on a.PrintTempNO=b.PrintTempNO left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` @@ -88,7 +88,7 @@ func: 'sPC_Get_SelectedList', LText: Utils.formatOptions(_sql), obj_name: 'data', - arr_field: 'PN,PrintTempNO,Images' + arr_field: 'PN,ID,Images' } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -100,7 +100,7 @@ if (res.status) { let temps = res.data.map(temp => { return { - value: temp.PrintTempNO, + value: temp.ID, text: temp.PN } }) diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 006c55d..6327b6a 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -47,10 +47,10 @@ componentDidMount() { let _sql = `select PrintTempNO,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate - where appkey= @appkey@ and Deleted=0 and typechartwo='' - union select ID,Images,a.PrintTempNO+PrintTempName as PN - from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='') a - left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + where appkey= @appkey@ and Deleted=0 and typechartwo='' + union select a.PrintTempNO,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='') a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b on a.PrintTempNO=b.PrintTempNO left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` diff --git a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx index 1ff3197..234bc0c 100644 --- a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx +++ b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx @@ -77,6 +77,11 @@ } }) + if (plot.correction) { + delete plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛� + plot.barSize = 35 + } + this.setState({ visible: true, view: 'normal', diff --git a/src/templates/sharecomponent/chartcomponent/index.jsx b/src/templates/sharecomponent/chartcomponent/index.jsx index c9b6726..da2b46f 100644 --- a/src/templates/sharecomponent/chartcomponent/index.jsx +++ b/src/templates/sharecomponent/chartcomponent/index.jsx @@ -420,6 +420,9 @@ if (plot.label === 'true') { _chart.label('value') } + if (plot.barSize || plot.correction) { + _chart.size(plot.barSize || 35) + } } else if (plot.adjust === 'stack') { let _chart = chart .interval() @@ -431,6 +434,10 @@ if (plot.label === 'true') { _chart.label('value') } + + if (plot.barSize || plot.correction) { + _chart.size(plot.barSize || 35) + } } chart.render() diff --git a/src/templates/sharecomponent/chartgroupcomponent/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/index.jsx index 6b25913..1ba31d0 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/index.jsx @@ -90,7 +90,7 @@ icon: 'line-chart', Hide: 'false', blacklist: [], - correction: 7 + barSize: 35 } } diff --git a/src/templates/zshare/createinterface/index.jsx b/src/templates/zshare/createinterface/index.jsx index 9efec6b..3bc051f 100644 --- a/src/templates/zshare/createinterface/index.jsx +++ b/src/templates/zshare/createinterface/index.jsx @@ -452,7 +452,7 @@ fieldlen: _fieldlen, key: cell.field, required: cell.required === 'true' ? 'required' : '', - writein: cell.required !== 'false', + writein: cell.writein !== 'false', value: cell.initval || '' } @@ -720,10 +720,10 @@ ` } - if (_initcolumnfields.length > 0) { - _sql += `select ${_initcolumnfields.join(',')} from ${setting.dataresource} where ${primaryKey}=@ID@ - ` - } + // if (_initcolumnfields.length > 0) { + // _sql += `select ${_initcolumnfields.join(',')} from (${setting.dataresource})tb where ${primaryKey}=@ID@ + // ` + // } // 鍘婚櫎绂佺敤鐨勯獙璇� if (verify.contrasts) { @@ -955,8 +955,10 @@ receiptKeys.push('bid') } + let _insertsql = '' + let _updatesql = '' // 娣诲姞銆佷慨鏀广�侀�昏緫鍒犻櫎銆佺墿鐞嗗垹闄� - if (_actionType === 'insert') { + if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { let keys = [] let values = [] @@ -991,10 +993,12 @@ keys = keys.join(',') values = values.join(',') - _sql += ` + _insertsql = ` /* 榛樿sql */ insert into ${btn.sql} (${keys}) select ${values};` - } else if (_actionType === 'update') { + } + + if (_actionType === 'update' || _actionType === 'audit' || _actionType === 'insertOrUpdate') { let _form = [] let _arr = [] @@ -1034,9 +1038,28 @@ } _form = _form.join(',') - _sql += ` + _updatesql = ` /* 榛樿sql */ update ${btn.sql} set ${_form} where ${primaryKey}=@${primaryKey}@;` + } + + if (_actionType === 'insert') { + _sql += _insertsql + } else if (_actionType === 'update' || _actionType === 'audit') { + _sql += _updatesql + } else if (_actionType === 'insertOrUpdate') { + _sql += ` + select @tbid='' + select @tbid='X' from ${btn.sql} where ${primaryKey}=@ID@ + if @tbid='' + begin + ${_insertsql} + end + else + begin + ${_updatesql} + end + ` } else if (_actionType === 'LogicDelete') { // 閫昏緫鍒犻櫎 _sql += ` /* 榛樿sql */ diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 824e11a..11d1285 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1741,13 +1741,13 @@ required: true }, { type: 'number', - key: 'correction', - label: '鏁版嵁淇', - tooltip: '褰撴暟鎹」灏戜簬璁剧疆鍊兼椂锛岀郴缁熶細鑷姩淇锛堥伩鍏嶆煴褰㈠浘杩囧锛�,鍦ㄨ嚜瀹氫箟涓紝璁剧疆涓烘姌绾垮浘鏃跺け鏁堛��', + key: 'barSize', + label: '鏌卞舰瀹藉害', + tooltip: '绌哄�兼椂锛屽搴﹁嚜閫傚簲銆�', min: 5, - max: 30, + max: 100, decimal: 0, - initVal: card.correction, + initVal: card.barSize, forbid: !['bar'].includes(card.chartType), required: false } diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 0dfa6b2..9565445 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -1,7 +1,6 @@ import React, { Component } from 'react' import { is, fromJS } from 'immutable' -import { connect } from 'react-redux' -import { Col, Row, Spin, notification } from 'antd' +import { Col, Row, Spin, notification, Button } from 'antd' import moment from 'moment' import Api from '@/api' @@ -9,6 +8,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import options from '@/store/options.js' +import UtilsDM from '@/utils/utils-datamanage.js' import NotFount from '@/components/404' import asyncComponent from '@/utils/asyncComponent' @@ -23,6 +23,8 @@ class BillPrint extends Component { state = { dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + loadingview: true, + dataManager: false, BID: '', data: '', tempId: '', @@ -32,10 +34,10 @@ UNSAFE_componentWillMount() { try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) - this.setState({ BID: param.id || '', tempId: param.tempId, + dataManager: param.dataManager }, () => { this.getMenuParam() }) @@ -62,39 +64,33 @@ } getMenuParam = () => { - const { tempId, BID } = this.state + const { tempId, BID, dataManager } = this.state - let param = { - func: 's_PrintTemplateMGetData', - Type: 'Y', - PrintTempNO: tempId + let _param = { + func: 'sPC_Get_LongParam', + MenuID: tempId } if (window.GLOB.mainSystemApi) { // 浠庡崟鐐圭櫥褰曟湇鍔″櫒鍙栨墦鍗伴厤缃俊鎭� - param.rduri = window.GLOB.mainSystemApi + _param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.getLocalConfig(_param).then(result => { if (result.status) { let config = '' try { - config = JSON.parse(window.decodeURIComponent(window.atob(result.ConfigParam))) + config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) } catch (e) { console.warn('Parse Failure') config = '' } - setTimeout(() => { // 寤舵椂鍔犺浇鐘舵�� - this.setState({ - loadingview: false - }) - }, 1500) - // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� if (!config) { this.setState({ - viewlost: true + viewlost: true, + loadingview: false }) return } @@ -103,15 +99,17 @@ if (!config.enabled) { this.setState({ viewlost: true, + loadingview: false, lostmsg: this.state.dict['main.view.unenabled'] }) return } let params = [] + let _pars = [] + + config.components = config.components.filter(item => !['tabs', 'search'].includes(item.type) && item.subtype !== 'tablecard') config.components = config.components.map(component => { - if (['tabs', 'search'].includes(component.type)) return null - if (component.action) component.action = [] if (component.search) component.search = [] @@ -143,7 +141,7 @@ component.setting.dataresource = '(' + component.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (dataManager) { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*') component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') _customScript = _customScript.replace(/\$@/ig, '/*') @@ -163,19 +161,35 @@ // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ if (component.dataName && component.setting.sync === 'true') { let param = this.getDefaultParam(component) - params.push(param) + _pars.push(param) } else { - component.setting.sync = 'false' + let arr_field = component.columns.map(col => col.field).join(',') + let param = UtilsDM.getQueryDataParams(component.setting, arr_field, [], component.setting.order || '', 1, 1000, BID, '', dataManager) + + param.componentId = component.uuid + + params.push(param) } + component.setting.sync = 'true' return component }) + _pars = this.getFormatParam(_pars) + + if (_pars) { + _pars.componentId = 'union' + params.unshift(_pars) + } + this.setState({ - setting: config.setting, config }, () => { - this.loadmaindata(params) + if (params.length === 0) { + this.setState({loadingview: false}) + } else { + this.loadmaindata(params) + } }) } else { notification.warning({ @@ -221,11 +235,8 @@ } } - /** - * @description 涓昏〃鏁版嵁鍔犺浇 - */ - loadmaindata = (params) => { - if (!params || params.length === 0) return + getFormatParam = (params) => { + if (!params || params.length === 0) return '' let LText_field = [] let LText = params.map((item, index) => { let _sql = item.sql @@ -254,36 +265,109 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param).then(result => { - if (result.status) { - delete result.status - delete result.message - delete result.ErrMesg - delete result.ErrCode + return param + } - this.setState({ - data: result, - loading: false + /** + * @description 涓昏〃鏁版嵁鍔犺浇 + */ + loadmaindata = (params) => { + let deffers = params.map(item => { + let componentId = item.componentId + delete item.componentId + return new Promise(resolve => { + Api.getLocalConfig(item).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + resolve(false) + } else { + res.componentId = componentId + resolve(res) + } }) - } else { - this.setState({ - data: '', - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + }) + }) + + Promise.all(deffers).then(results => { + let _results = results.filter(Boolean) + + this.setState({loadingview: false}) + + if (_results.length === results.length) { + console.log(_results) } + + // delete result.ErrCode + // delete result.ErrMesg + // delete result.message + // delete result.status }) } - getComponents = () => { - const { dataManager } = this.props - const { config, BID, data } = this.state + print = () => { + let bdhtml = window.document.body.innerHTML + let jubuData = document.getElementById('bill-print').innerHTML + window.document.body.innerHTML = jubuData + // document.getElementsByTagName('body')[0].style.zoom = 0.7 - if (!config || !config.components) return + try { + if (window.ActiveXObject) { + let hkeyRoot + let hkeyPath + let hkeyKey + // eslint-disable-next-line + let RegWsh = new ActiveXObject('WScript.Shell') + + hkeyRoot = 'HKEY_CURRENT_USER' + hkeyPath = '\\Software\\Microsoft\\Internet Explorer\\PageSetup\\' + + // 璁剧疆椤电湁/鑴氱殑瀛椾綋鏍峰紡 + hkeyKey = 'font' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, 'font-size: 12px; font-family: 榛戜綋; line-height: 24px') + + // 璁剧疆椤电湁 + hkeyKey = 'header' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '鎵撳嵃缂栧彿') + + // 璁剧疆椤佃剼 + hkeyKey = 'footer' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '&b绗� &p 椤�/鍏� &P 椤�') + + // 璁剧疆椤佃竟璺�(0.6 瑕佷箻浠� 2.5涓哄疄闄呮墦鍗扮殑灏哄) + hkeyKey = 'margin_bottom' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') + + hkeyKey = 'margin_left' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') + + hkeyKey = 'margin_right' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') + + hkeyKey = 'margin_top' + RegWsh.RegWrite(hkeyRoot + hkeyPath + hkeyKey, '0.6') + + window.print() + } else { + window.print() + } + } catch (e) { + notification.warning({ + top: 92, + message: '鎵撳嵃寮傚父锛�', + duration: 5 + }) + } + + window.document.body.innerHTML = bdhtml + window.location.reload() + } + + getComponents = () => { + const { config, BID, data, dataManager } = this.state return config.components.map(item => { if (!item) return null @@ -322,23 +406,14 @@ const { loadingview, viewlost, config } = this.state return ( - <div className="custom-page-wrap" id={this.state.ContainerId} style={config ? config.style : null}> + <div className="bill-print-wrap" > {loadingview && <Spin size="large" />} - <Row>{this.getComponents()}</Row> + {config ? <div id="bill-print" style={config.style}><Row>{this.getComponents()}</Row></div> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + {!loadingview && !viewlost ? <div className="print-button"><Button onClick={this.print}>鎵撳嵃</Button></div> : null} </div> ) } } -const mapStateToProps = (state) => { - return { - dataManager: state.dataManager - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(BillPrint) \ No newline at end of file +export default BillPrint \ No newline at end of file diff --git a/src/views/billprint/index.scss b/src/views/billprint/index.scss index fa70742..a42978b 100644 --- a/src/views/billprint/index.scss +++ b/src/views/billprint/index.scss @@ -1,160 +1,19 @@ -.pc-menu-view { - background: #000; - min-height: 100vh; - .menu-body { - width: 100vw; - height: 100vh; - overflow-x: hidden; - position: relative; - background: #ffffff; - padding: 50px 0px 0px 0px; +.bill-print-wrap { + width: 1200px; + margin: 0 auto; - - .menu-setting { - position: fixed; - left: 0; - top: 48px; - z-index: 10; - height: calc(100vh - 48px); - width: 300px; - background: #ffffff; - box-shadow: 0px 2px 5px #bcbcbc; - overflow-y: auto; - - > .ant-collapse { - .ant-collapse-item.ant-collapse-item-active { - border-bottom: 1px solid #d9d9d9; - } - .ant-collapse-header { - padding: 11px 16px 10px 40px; - border-bottom: 1px solid #d9d9d9; - background: #1890ff; - color: #ffffff; - } - .ant-collapse-content-box { - .ant-form-item { - margin-bottom: 10px; - } - .model-table-tablemanage-view { - >.ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - } - } - >.tables { - width: 66.66666667%!important; - } - >.ant-form-item-label { - width: 33.33333333%; - } - } - } - } - - >.ant-tabs { - >.ant-tabs-bar { - border-bottom: 1px solid #181F29; - margin-bottom: 0px; - min-height: 48px; - .ant-tabs-tab { - padding: 14px 16px; - color: rgba(255, 255, 255, 0.85); - } - .ant-tabs-tab-active.ant-tabs-tab { - color: #1890ff; - } - } - } - } - .menu-setting::-webkit-scrollbar { - width: 4px; - } - .menu-setting::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); - background: rgba(0, 0, 0, 0.08); - } - .menu-setting::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border-radius: 3px; - border: 1px solid rgba(0, 0, 0, 0.07); - background: rgba(0, 0, 0, 0); - } - - .menu-view { - position: relative; - width: calc(100vw - 300px); - margin-left: 300px; - height: calc(100vh - 50px); - overflow-y: auto; - - > .ant-card { - >.ant-card-head { - margin-bottom: 0px; - .ant-card-head-title { - color: #1890ff; - padding: 5px 0; - } - .ant-card-extra { - padding: 5px 0; - button { - margin-left: 20px; - } - .ant-switch.big { - min-width: 60px; - height: 28px; - line-height: 28px; - margin-top: -2px; - .ant-switch-inner { - font-size: 14px; - } - } - .ant-switch.big:after { - width: 24px; - height: 24px; - } - } - } - >.ant-card-body { - padding: 0px; - } - } - } - .menu-view.saving { - .anticon-tool { - display: none; - } - } - .menu-view::-webkit-scrollbar { - width: 7px; - } - .menu-view::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); - background: rgba(0, 0, 0, 0.08); - } - .menu-view::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border-radius: 3px; - border: 1px solid rgba(0, 0, 0, 0.07); - background: rgba(0, 0, 0, 0); - } + .ant-spin { + position: absolute; + top: 40vh; + z-index: 1; + left: calc(50vw - 20px); + } + .box404 { + margin-top: 10vh; + } + .print-button { + position: fixed; + right: 10px; + top: 45vh; } } diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index dced7f4..360391f 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -396,7 +396,7 @@ error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆鏁版嵁婧愶紒` } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.length === 0) { error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆鏁版嵁婧愶紒` - } else if (item.setting.interType && !item.setting.primaryKey) { + } else if (item.setting.interType && !item.setting.primaryKey && config.MenuType !== 'billPrint') { error = `缁勪欢銆�${item.name}銆嬫湭璁剧疆涓婚敭锛乣 } } -- Gitblit v1.8.0