| | |
| | | .box404 { |
| | | max-height: calc(100vh - 110px); |
| | | text-align: center; |
| | | |
| | | .ant-result-title { |
| | | font-size: 18px; |
| | | color: #1890ff; |
| | | } |
| | | } |
| | | .ant-tabs-tabpane { |
| | | >.box404 { |
| | |
| | | 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' |
| | |
| | | |
| | | 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 |
| | |
| | | })(<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 || [] |
| | |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </div> |
| | |
| | | * @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})) |
| | | |
| | |
| | | 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 |
| | | }, { |
| | |
| | | initVal: card.blacklist || [], |
| | | multi: true, |
| | | required: false, |
| | | forbid: MenuType === 'billPrint', |
| | | options: _sysRoles |
| | | } |
| | | ] |
| | |
| | | |
| | | class LineChartDrawerForm extends Component { |
| | | static propTpyes = { |
| | | MenuType: PropTypes.any, |
| | | dict: PropTypes.object, |
| | | plot: PropTypes.object, |
| | | sysRoles: PropTypes.array, |
| | |
| | | } |
| | | |
| | | showDrawer = () => { |
| | | const { config, sysRoles } = this.props |
| | | const { config, sysRoles, MenuType } = this.props |
| | | |
| | | let fieldName = {} |
| | | config.columns.forEach(col => { |
| | |
| | | } |
| | | }) |
| | | |
| | | 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) |
| | | }) |
| | | } |
| | | |
| | |
| | | customs: [], |
| | | width: 24, |
| | | height: 400, |
| | | barSize: 35, |
| | | name: card.name |
| | | } |
| | | |
| | |
| | | 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() |
| | |
| | | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | } |
| | | |
| | |
| | | <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}/> |
| | |
| | | * @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})) |
| | |
| | | initVal: card.blacklist || [], |
| | | multi: true, |
| | | required: false, |
| | | forbid: MenuType === 'billPrint', |
| | | options: _sysRoles |
| | | } |
| | | ] |
| | |
| | | |
| | | class LineChartDrawerForm extends Component { |
| | | static propTpyes = { |
| | | MenuType: PropTypes.any, |
| | | dict: PropTypes.object, |
| | | plot: PropTypes.object, |
| | | sysRoles: PropTypes.array, |
| | |
| | | } |
| | | |
| | | 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) |
| | | }) |
| | | } |
| | | |
| | |
| | | <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}/> |
| | |
| | | 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 () { |
| | |
| | | } |
| | | } |
| | | |
| | | 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: { |
| | |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('supModule', { |
| | | initialValue: setting.supModule || [], |
| | | initialValue: supModule, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Cascader options={modules} expandTrigger="hover" placeholder="" /> |
| | | <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | })(<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" /> |
| | |
| | | { 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: '柱状图' }, |
| | |
| | | } |
| | | |
| | | 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 |
| | | } |
| | |
| | | }, () => { |
| | | if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | this.loadData() |
| | | } else if (_sync && !_data) { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | _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({}, () => { |
| | |
| | | }, () => { |
| | | 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 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | 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({}, () => { |
| | |
| | | }, () => { |
| | | if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | this.loadData() |
| | | } else if (_sync && !_data) { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | _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({}, () => { |
| | |
| | | }, () => { |
| | | 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() |
| | | } |
| | | }) |
| | | } |
| | |
| | | _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))) { |
| | |
| | | }) |
| | | |
| | | _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}) |
| | |
| | | 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() |
| | |
| | | if (plot.label === 'true') { |
| | | _chart.label(_valfield) |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | } |
| | | |
| | | chart.render() |
| | |
| | | }, () => { |
| | | 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() |
| | | } |
| | | }) |
| | | } |
| | |
| | | _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))) { |
| | |
| | | _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', |
| | |
| | | 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: { |
| | |
| | | config: null, // 页面配置信息,包括组件等 |
| | | mainSearch: null, |
| | | userConfig: null, // 用户自定义设置 |
| | | arr_field: '', // 使用 sPC_Get_TableData 时的查询字段集 |
| | | setting: null, // 页面全局设置:数据源、按钮及显示列固定、主键等 |
| | | data: null, // 列表数据集 |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 标签页控制 |
| | |
| | | let config = '' |
| | | let userConfig = null |
| | | |
| | | setTimeout(() => { // 延时加载状态 |
| | | this.setState({ |
| | | loadingview: false |
| | | }) |
| | | }, 1500) |
| | | |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | |
| | | userConfig = null |
| | | } |
| | | } |
| | | |
| | | |
| | | // 页面配置解析错误时提示 |
| | | if (!config) { |
| | | this.setState({ |
| | | viewlost: true |
| | | viewlost: true, |
| | | loadingview: false |
| | | }) |
| | | return |
| | | } |
| | |
| | | if (!config.enabled) { |
| | | this.setState({ |
| | | viewlost: true, |
| | | loadingview: false, |
| | | lostmsg: this.state.dict['main.view.unenabled'] |
| | | }) |
| | | return |
| | |
| | | }) |
| | | |
| | | 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({ |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | 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 => { |
| | |
| | | // 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' |
| | |
| | | /** |
| | | * @description 获取系统存储过程 sPC_Get_TableData 的参数 |
| | | */ |
| | | getDefaultParam = (component, mainSearch) => { |
| | | getDefaultParam = (component, mainSearch, BID) => { |
| | | const { columns, search, setting, dataName, format } = component |
| | | |
| | | let searchlist = [] |
| | |
| | | let _dataresource = setting.dataresource |
| | | let _customScript = setting.customScript |
| | | |
| | | |
| | | if (setting.queryType === 'statistics' || _customScript) { |
| | | let allSearch = Utils.getAllSearchOptions(searchlist) |
| | | let regoptions = allSearch.map(item => { |
| | |
| | | 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 = '' |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | if (!params || params.length === 0) return |
| | | let LText_field = [] |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | |
| | | 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) { |
| | |
| | | |
| | | 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" |
| | |
| | | ) |
| | | } 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} |
| | |
| | | ) |
| | | } 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} |
| | |
| | | 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' |
| | | |
| | |
| | | * @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 |
| | |
| | | } |
| | | |
| | | 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 }))) |
| | |
| | | } |
| | | } |
| | | |
| | | export default NewPageButton |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | dataManager: state.dataManager |
| | | } |
| | | } |
| | | |
| | | const mapDispatchToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(NewPageButton) |
| | |
| | | _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 |
| | | } |
| | |
| | | let _chart = chart |
| | | .interval() |
| | | .position(`${plot.Xaxis}*${_valfield}`) |
| | | .size(30) |
| | | .color(_typefield) |
| | | .adjust([ |
| | | { |
| | |
| | | let _chart = chart |
| | | .interval() |
| | | .position(`${plot.Xaxis}*${_valfield}`) |
| | | .size(30) |
| | | .color(_typefield) |
| | | .adjust('stack') |
| | | .shape(plot.shape || 'rect') |
| | |
| | | } |
| | | }) |
| | | |
| | | 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) { |
| | |
| | | } |
| | | } |
| | | 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() |
| | |
| | | } |
| | | |
| | | 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` |
| | |
| | | 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') |
| | |
| | | if (res.status) { |
| | | let temps = res.data.map(temp => { |
| | | return { |
| | | value: temp.PrintTempNO, |
| | | value: temp.ID, |
| | | text: temp.PN |
| | | } |
| | | }) |
| | |
| | | |
| | | 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` |
| | |
| | | } |
| | | }) |
| | | |
| | | if (plot.correction) { |
| | | delete plot.correction // 数据修正(已弃用) |
| | | plot.barSize = 35 |
| | | } |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | |
| | | 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() |
| | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | |
| | | if (plot.barSize || plot.correction) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | } |
| | | |
| | | chart.render() |
| | |
| | | icon: 'line-chart', |
| | | Hide: 'false', |
| | | blacklist: [], |
| | | correction: 7 |
| | | barSize: 35 |
| | | } |
| | | } |
| | | |
| | |
| | | fieldlen: _fieldlen, |
| | | key: cell.field, |
| | | required: cell.required === 'true' ? 'required' : '', |
| | | writein: cell.required !== 'false', |
| | | writein: cell.writein !== 'false', |
| | | value: cell.initval || '' |
| | | } |
| | | |
| | |
| | | ` |
| | | } |
| | | |
| | | 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) { |
| | |
| | | receiptKeys.push('bid') |
| | | } |
| | | |
| | | let _insertsql = '' |
| | | let _updatesql = '' |
| | | // 添加、修改、逻辑删除、物理删除 |
| | | if (_actionType === 'insert') { |
| | | if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { |
| | | let keys = [] |
| | | let values = [] |
| | | |
| | |
| | | |
| | | 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 = [] |
| | | |
| | |
| | | } |
| | | |
| | | _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 */ |
| | |
| | | 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 |
| | | } |
| | |
| | | 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' |
| | |
| | | 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' |
| | | |
| | |
| | | class BillPrint extends Component { |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | loadingview: true, |
| | | dataManager: false, |
| | | BID: '', |
| | | data: '', |
| | | tempId: '', |
| | |
| | | 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() |
| | | }) |
| | |
| | | } |
| | | |
| | | 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) |
| | | |
| | | // 页面配置解析错误时提示 |
| | | if (!config) { |
| | | this.setState({ |
| | | viewlost: true |
| | | viewlost: true, |
| | | loadingview: false |
| | | }) |
| | | return |
| | | } |
| | |
| | | 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 = [] |
| | | |
| | |
| | | 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, '/*') |
| | |
| | | // 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({ |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @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 |
| | |
| | | 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 |
| | |
| | | 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) |
| | | export default BillPrint |
| | |
| | | .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; |
| | | } |
| | | } |
| | |
| | | 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}》未设置主键!` |
| | | } |
| | | } |