| | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import './index.scss' |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | |
| | | let tables = config.tables ? fromJS(config.tables).toJS() : [] |
| | | |
| | | window.GLOB.publicTables = tables |
| | | |
| | | this.setState({ |
| | | selectedTables: config.tables ? fromJS(config.tables).toJS() : [] |
| | | selectedTables: tables |
| | | }, () => { |
| | | this.gettableFields() |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('publicTableChange', this.publicTableChange) |
| | | this.gettables() |
| | | } |
| | | |
| | | publicTableChange = (table, type) => { |
| | | if (type === 'plus') { |
| | | this.onTableChange(table) |
| | | } else if (type === 'del') { |
| | | this.deleteTable(table) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | let _table = tables.filter(item => item.TbName === value)[0] |
| | | let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] |
| | | if (!isSelected) { |
| | | let _tables = [...selectedTables, _table] |
| | | |
| | | window.GLOB.publicTables = _tables |
| | | |
| | | this.setState({ |
| | | selectedTables: [...selectedTables, _table] |
| | | selectedTables: _tables |
| | | }) |
| | | |
| | | let _config = {...config, tables: [...selectedTables, _table]} |
| | | let _config = {...config, tables: _tables} |
| | | |
| | | Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { |
| | | if (res.status) { |
| | |
| | | let _tables = selectedTables.filter(item => item.TbName !== table.TbName) |
| | | let _fields = tableFields.filter(item => item.tableName !== table.TbName) |
| | | |
| | | window.GLOB.publicTables = _tables |
| | | |
| | | this.setState({ |
| | | selectedTables: _tables, |
| | | tableFields: _fields |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('publicTableChange', this.publicTableChange) |
| | | } |
| | | |
| | | render() { |
| | |
| | | {/* 表名添加 */} |
| | | <div className="ant-col ant-form-item-label"> |
| | | <label> |
| | | <Tooltip placement="topLeft" title="此处可以添加页面配置相关的常用表,可通过工具栏中的添加按钮,可批量添加表格相关字段。"> |
| | | <Tooltip placement="topLeft" title="此处可以添加页面配置相关的常用表。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 表名 |
| | | </Tooltip> |