| | |
| | | */ |
| | | export default function (wrap, buttons, columns) { |
| | | let menu = window.GLOB.customMenu |
| | | let MenuType = menu.parentId === 'BillPrintTemp' ? 'billPrint' : '' |
| | | let MenuType = sessionStorage.getItem('MenuType') || 'custom' |
| | | |
| | | let modules = MenuUtils.getLinkModules(menu.components) || [] |
| | | let supmodules = MenuUtils.getSupModules(menu.components, '', menu.interfaces) |
| | |
| | | */ |
| | | export default function (wrap, subtype, columns = [], id = '', supNodes = [], setting, buttons = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let MenuType = '' |
| | | let MenuType = sessionStorage.getItem('MenuType') || 'custom' |
| | | let menu = window.GLOB.customMenu |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | let interfaces = [] |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | } |
| | | let modules = [] |
| | | if (subtype === 'propcard' || subtype === 'datacard') { |
| | |
| | | */ |
| | | export default function (wrap, columns = [], setting) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | // let MenuType = '' |
| | | // let menu = window.GLOB.customMenu |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | |
| | | // if (menu.parentId === 'BillPrintTemp') { |
| | | // MenuType = 'billPrint' |
| | | // } |
| | | |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | | if (roleList) { |
| | |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | }, |
| | | // { |
| | | // type: 'number', |
| | | // field: 'printHeight', |
| | | // label: '换算高度', |
| | | // initval: wrap.printHeight || '', |
| | | // tooltip: '当前数据卡高度相当于几条数据。', |
| | | // required: false, |
| | | // forbid: MenuType !== 'billPrint' |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'empty', |
| | |
| | | this.setState({loading: true}) |
| | | this.verifyRef.submitDataSource().then(res => { |
| | | |
| | | let MenuType = sessionStorage.getItem('MenuType') |
| | | |
| | | if (MenuType === 'billPrint') { |
| | | res.setting.supModule = ['empty'] |
| | | } |
| | | |
| | | if (res.columns) { |
| | | res.columns = res.columns.map(item => { |
| | | |
| | |
| | | modules: [], |
| | | innerRules: [], |
| | | innertip: '', |
| | | MenuType: '', |
| | | MenuType: sessionStorage.getItem('MenuType') || '', |
| | | ismain: false |
| | | } |
| | | |
| | |
| | | const { config, setting } = this.props |
| | | |
| | | let menu = window.GLOB.customMenu |
| | | let MenuType = '' |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | } |
| | | |
| | | let modules = MenuUtils.getSupModules(menu.components, config.uuid, menu.interfaces) |
| | | let ismain = false |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | this.setState({modules, innerRules, innertip, setting: _setting, ismain, MenuType}) |
| | | this.setState({modules, innerRules, innertip, setting: _setting, ismain}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Modal, Tooltip, notification } from 'antd' |
| | | import { QuestionCircleOutlined, PlusOutlined, CloseOutlined } from '@ant-design/icons' |
| | | |
| | | import SettingForm from './settingform' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | class ProcessComponent extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.any, |
| | | updateConfig: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | visible: false, |
| | | urlFields: this.props.config.urlFields || [] |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | editDataSource = () => { |
| | | this.setState({ |
| | | visible: true |
| | | }) |
| | | } |
| | | |
| | | verifySubmit = () => { |
| | | const { urlFields } = this.state |
| | | const { config } = this.props |
| | | |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | if (urlFields.filter(field => field === res.field).length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _urlFields = [...urlFields, res.field] |
| | | |
| | | this.setState({ |
| | | visible: false, |
| | | urlFields: _urlFields |
| | | }) |
| | | |
| | | if (window.GLOB.urlFields) { |
| | | window.GLOB.urlFields = _urlFields |
| | | } |
| | | |
| | | this.props.updateConfig({...config, urlFields: _urlFields}) |
| | | }) |
| | | } |
| | | |
| | | deleteField = (field) => { |
| | | let config = JSON.stringify(this.props.config) |
| | | const _this = this |
| | | |
| | | if (new RegExp(field, 'ig').test(config)) { |
| | | confirm({ |
| | | title: `配置中存在@${field}@,确定删除吗?`, |
| | | content: '', |
| | | onOk() { |
| | | _this.execDelete(field) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.execDelete(field) |
| | | } |
| | | } |
| | | |
| | | execDelete = (_field) => { |
| | | const { config } = this.props |
| | | let _urlFields = this.state.urlFields.filter(field => field !== _field) |
| | | |
| | | this.setState({ |
| | | urlFields: _urlFields |
| | | }) |
| | | |
| | | if (window.GLOB.urlFields) { |
| | | window.GLOB.urlFields = _urlFields |
| | | } |
| | | |
| | | this.props.updateConfig({...config, urlFields: _urlFields}) |
| | | } |
| | | |
| | | render () { |
| | | const { visible, urlFields } = this.state |
| | | |
| | | return ( |
| | | <div className="url-field-component"> |
| | | <div className="field-plus"> |
| | | <Tooltip placement="topLeft" title="页面可接收的参数字段,在查询数据源或自定义脚本中使用 @字段@ 接收。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | url变量 |
| | | </Tooltip> |
| | | <PlusOutlined title="添加" onClick={() => this.editDataSource()} /> |
| | | </div> |
| | | <div> |
| | | {urlFields.map((field, index) => { |
| | | return ( |
| | | <div className="field-item" key={index}> |
| | | <CloseOutlined title="删除" onClick={() => this.deleteField(field)} /> |
| | | {field} |
| | | </div> |
| | | ) |
| | | })} |
| | | </div> |
| | | <Modal |
| | | title="字段添加" |
| | | visible={visible} |
| | | width={500} |
| | | maskClosable={false} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | inputSubmit={this.verifySubmit} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default ProcessComponent |
New file |
| | |
| | | .url-field-component { |
| | | margin-bottom: 15px; |
| | | .field-plus { |
| | | line-height: 35px; |
| | | padding-left: 16px; |
| | | >.anticon-plus { |
| | | color: #26C281; |
| | | padding: 2px 5px; |
| | | margin-left: 5px; |
| | | } |
| | | } |
| | | .field-item { |
| | | position: relative; |
| | | border: 1px solid #e8e8e8; |
| | | padding: 5px 10px; |
| | | border-radius: 4px; |
| | | |
| | | >.anticon-close { |
| | | position: absolute; |
| | | right: 5px; |
| | | top: 3px; |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Input } from 'antd' |
| | | |
| | | // import './index.scss' |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | inputSubmit: PropTypes.func // 回车事件 |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | handleSubmit = (e) => { |
| | | e.preventDefault() |
| | | |
| | | if (this.props.inputSubmit) { |
| | | this.props.inputSubmit() |
| | | } |
| | | } |
| | | |
| | | componentDidMount() { |
| | | try { |
| | | let _input = document.getElementById('field') |
| | | if (_input.focus) { |
| | | _input.focus() |
| | | } |
| | | } catch (e) { |
| | | console.warn('focus error!') |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 14 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="url-field-form"> |
| | | <Form {...formItemLayout}> |
| | | <Form.Item label="字段名"> |
| | | {getFieldDecorator('field', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入字段名!' |
| | | }, |
| | | { |
| | | pattern: /^[a-zA-Z0-9_]*$/ig, |
| | | message: '字段可使用英文、数字或_' |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Form> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(SettingForm) |
| | |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <ColorSketch defaultValue={item.initval} onChange={(value) => this.change(value, item.field)}/> |
| | | <ColorSketch config={{initval: item.initval}} onChange={(value) => this.change(value, item.field)}/> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | _customScript = _customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | // _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') |
| | | // _customScript = _customScript.replace(/@select\$|\$select@/ig, '') |
| | | // _dataresource = _dataresource.replace(/\$sum@/ig, '/*') |
| | | // _dataresource = _dataresource.replace(/@sum\$/ig, '*/') |
| | | // _customScript = _customScript.replace(/\$sum@/ig, '/*') |
| | | // _customScript = _customScript.replace(/@sum\$/ig, '*/') |
| | | |
| | | let _search = '' |
| | | if (setting.queryType !== 'statistics' && _dataresource) { |
| | | _search = Utils.joinMainSearchkey(searchlist) |
| | |
| | | primaryKey: setting.primaryKey || '', |
| | | foreign_key: '', |
| | | sql: _dataresource, |
| | | script: _customScript, |
| | | // transaction: setting.transaction === 'true' |
| | | script: _customScript |
| | | } |
| | | } |
| | | |
| | |
| | | _dataresource = `select top 1000 ${setting.arr_field} from ${_dataresource} ` |
| | | } |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | _customScript && console.info(`${_dataresource ? '' : '/*不执行默认sql*/\n'}${_customScript}`) |
| | | _dataresource && console.info(_dataresource) |
| | | } |
| | | |
| | | return { |
| | | name: dataName, |
| | | columns: columns, |
| | | par_tablename: '', |
| | | order: setting.order || '', |
| | | type: format === 'array' ? format : '', |
| | | primaryKey: setting.primaryKey || '', |
| | | foreign_key: '', |
| | |
| | | let district = sessionStorage.getItem('district') || '' |
| | | let address = sessionStorage.getItem('address') || '' |
| | | |
| | | let regoptions = [ |
| | | { reg: /@pageSize@/ig, value: 9999 }, |
| | | { reg: /@pageIndex@/ig, value: 1}, |
| | | { reg: /@ID@/ig, value: `''`}, |
| | | { reg: /@BID@/ig, value: `'${BID || ''}'`}, |
| | | { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, |
| | | { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`}, |
| | | { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`}, |
| | | { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`}, |
| | | { reg: /@typename@/ig, value: `'admin'`}, |
| | | ] |
| | | |
| | | let LText = params.map((item, index) => { |
| | | let _sql = item.sql |
| | | let _script = item.script |
| | |
| | | ` |
| | | } |
| | | |
| | | _sql = _sql.replace(/@orderBy@/ig, item.order) |
| | | _script = _script.replace(/@orderBy@/ig, item.order) |
| | | |
| | | regoptions.forEach(cell => { |
| | | _sql = _sql.replace(cell.reg, cell.value) |
| | | _script = _script.replace(cell.reg, cell.value) |
| | | }) |
| | | |
| | | // 测试系统打印查询语句 |
| | | if (window.GLOB.debugger === true) { |
| | | _script && console.info(`${_sql ? '' : '/*不执行默认sql*/\n'}${_script}`) |
| | | _sql && console.info(_sql) |
| | | } |
| | | |
| | | item.columns.forEach(cell => { |
| | | LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`) |
| | | }) |
| | |
| | | try { |
| | | let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | |
| | | sessionStorage.setItem('MenuType', param.MenuType || 'custom') |
| | | |
| | | this.setState({ |
| | | MenuType: param.MenuType, |
| | | MenuId: param.MenuId || param.MenuID, |
| | |
| | | <Collapse accordion defaultActiveKey="basedata" bordered={false}> |
| | | {/* 基本信息 */} |
| | | <Panel header="基本信息" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | {config && MenuType === 'custom' ? <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={ParentId} |
| | | MenuName={config.MenuName} |
| | | MenuNo={config.MenuNo} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config && MenuType === 'home' ? <HomeForm |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config && MenuType === 'billPrint' ? <PrintMenuForm |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config ? <UrlFieldComponent |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} |
| | | {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> : null} |
| | | {config ? <NormalCss config={config} updateConfig={this.updateConfig}/> : null} |
| | | {config ? <> |
| | | {MenuType === 'custom' ? <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={ParentId} |
| | | MenuName={config.MenuName} |
| | | MenuNo={config.MenuNo} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {MenuType === 'home' ? <HomeForm |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {MenuType === 'billPrint' ? <PrintMenuForm |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | <UrlFieldComponent |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updateConfig}/> |
| | | <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> |
| | | <NormalCss config={config} updateConfig={this.updateConfig}/> |
| | | </> : null} |
| | | </Panel> |
| | | {/* 组件添加 */} |
| | | <Panel header="组件" key="component"> |
| | |
| | | <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel header="基本信息" forceRender className="basedata" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | {config ? <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | adapters={adapters} |
| | | updateConfig={(con) => { |
| | | this.updateConfig(con) |
| | | if (con.direction !== config.direction) { |
| | | this.changeView(con.direction) |
| | | } |
| | | }} |
| | | /> : null} |
| | | {config ? <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> : null} |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} |
| | | {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> : null} |
| | | {config ? <Paragraph style={{padding: '10px 0px 0px 18px'}} copyable={{ text: `${window.GLOB.baseurl}mob/index.html#/index/${sessionStorage.getItem('kei_no')}/${sessionStorage.getItem('typename')}/${sessionStorage.getItem('lang')}/${MenuId}/@BID@` }}>菜单链接</Paragraph> : null} |
| | | {config ? <NormalCss config={config} updateConfig={this.updateConfig}/> : null} |
| | | {config ? <> |
| | | <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | adapters={adapters} |
| | | updateConfig={(con) => { |
| | | this.updateConfig(con) |
| | | if (con.direction !== config.direction) { |
| | | this.changeView(con.direction) |
| | | } |
| | | }} |
| | | /> |
| | | <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updateConfig}/> |
| | | <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> |
| | | <Paragraph style={{padding: '10px 0px 0px 18px'}} copyable={{ text: `${window.GLOB.baseurl}mob/index.html#/index/${sessionStorage.getItem('kei_no')}/${sessionStorage.getItem('typename')}/${sessionStorage.getItem('lang')}/${MenuId}/@BID@` }}>菜单链接</Paragraph> |
| | | <NormalCss config={config} updateConfig={this.updateConfig}/> |
| | | </> : null} |
| | | </Panel> |
| | | {/* 组件添加 */} |
| | | <Panel header="组件" className="component" key="component"> |
| | |
| | | <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel header="基本信息" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | {config ? <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config ? <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> : null} |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} |
| | | {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> : null} |
| | | {config ? <NormalCss config={config} updateConfig={this.updateConfig}/> : null} |
| | | {config ? <> |
| | | <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updateConfig}/> |
| | | <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> |
| | | <NormalCss config={config} updateConfig={this.updateConfig}/> |
| | | </> : null} |
| | | </Panel> |
| | | {/* 组件添加 */} |
| | | <Panel header="组件" key="component"> |
| | |
| | | <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel header="基本信息" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | {config ? <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={ParentId} |
| | | MenuName={config.MenuName} |
| | | MenuNo={config.MenuNo} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {config ? <UrlFieldComponent |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> : null} |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} |
| | | {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> : null} |
| | | {config ? <> |
| | | <MenuForm |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={ParentId} |
| | | MenuName={config.MenuName} |
| | | MenuNo={config.MenuNo} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | <UrlFieldComponent |
| | | config={config} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updateConfig}/> |
| | | <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> |
| | | </> : null} |
| | | </Panel> |
| | | <Panel header="搜索" key="search"> |
| | | {Source.searchItems.map((item, index) => (<SourceElement key={index} content={item}/>))} |