| | |
| | | 'header.menu.func.create': '创建存储过程', |
| | | 'header.menu.tab': '标签页', |
| | | 'header.menu.tab.subtable': '子表', |
| | | 'header.menu.datasource': '数据来源', |
| | | 'header.menu.maintable': '主表', |
| | | 'header.menu.query': '查询', |
| | | 'header.form.tabType': '标签类型', |
| | | 'header.form.search.placeholder': 'Please add search criteria', |
| | | 'header.form.modal.placeholder': 'Please add the form', |
| | |
| | | 'header.form.execError': 'Failure', |
| | | 'header.form.messageTip': '信息提示', |
| | | 'header.form.errorTime': '停留时间', |
| | | 'header.form.refresh': '刷新', |
| | | 'header.form.refresh.never': 'Don\'t refresh', |
| | | 'header.form.refresh.view': 'Refresh the page', |
| | | 'header.form.refresh.grid': 'Refresh the table', |
| | |
| | | 'header.menu.func.create': '创建存储过程', |
| | | 'header.menu.tab': '标签页', |
| | | 'header.menu.tab.subtable': '子表', |
| | | 'header.menu.datasource': '数据来源', |
| | | 'header.menu.maintable': '主表', |
| | | 'header.menu.query': '查询', |
| | | 'header.form.tabType': '标签类型', |
| | | 'header.form.search.placeholder': '请添加搜索条件', |
| | | 'header.form.modal.placeholder': '请添加表单', |
| | |
| | | 'header.form.execError': '执行失败', |
| | | 'header.form.messageTip': '信息提示', |
| | | 'header.form.errorTime': '停留时间', |
| | | 'header.form.refresh': '刷新', |
| | | 'header.form.refresh.never': '不刷新', |
| | | 'header.form.refresh.view': '刷新页面', |
| | | 'header.form.refresh.grid': '刷新表格', |
| | |
| | | * @description 触发按钮弹窗(标签页) |
| | | */ |
| | | triggerPopview = (btn, data) => { |
| | | const { setting } = this.state |
| | | |
| | | let _primaryId = '' |
| | | |
| | | if (data && data[0] && setting.primaryKey) { |
| | | _primaryId = data[0][setting.primaryKey] || '' |
| | | } |
| | | |
| | | if (btn.OpenType === 'popview') { |
| | | this.setState({ |
| | | popAction: btn, |
| | |
| | | param: { |
| | | btn: btn, |
| | | data: data, |
| | | primaryId: _primaryId, |
| | | arr_field: this.state.arr_field |
| | | } |
| | | } |
| | |
| | | tabParam: { |
| | | btn: btn, |
| | | data: data, |
| | | primaryId: _primaryId, |
| | | arr_field: this.state.arr_field |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | let _arrField = [] // 字段集 |
| | | console.log(this.props.param) |
| | | |
| | | if (this.props.param && this.props.param.arr_field) { |
| | | _arrField = this.props.param.arr_field |
| | | } else { |
| | |
| | | } |
| | | }) |
| | | |
| | | let _data = null |
| | | let _isCustomData = false |
| | | |
| | | if (this.props.param && this.props.param.data) { |
| | | _data = this.props.param.data[0] || null |
| | | } |
| | | |
| | | if ((config.setting.interType === 'inner' && config.setting.innerFunc) || (config.setting.interType === 'outer' && config.setting.interface)) { |
| | | _isCustomData = true |
| | | _data = null |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | setting: config.setting, |
| | | actions: config.action, |
| | | isLinkMain: _isLinkMain, |
| | | arr_field: _arrField, |
| | | data: _data, |
| | | data: config.setting.datatype === 'query' ? null : (this.props.param.data[0] || null), |
| | | BIDs: { |
| | | mainTable: (!_isCustomData && _data && _data[0] && _data[0][config.setting.primaryKey]) || '', |
| | | mainTabledata: (!_isCustomData && _data && _data[0]) || '' |
| | | mainTable: this.props.param.primaryId || '', |
| | | mainTabledata: config.setting.datatype === 'query' ? '' : (this.props.param.data[0] || '') |
| | | } |
| | | }, () => { |
| | | this.improveSelectOption(config.groups) |
| | | |
| | | if (_isCustomData) { |
| | | if (config.setting.datatype === 'query') { |
| | | this.loadmaindata() |
| | | } |
| | | }) |
| | |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import { getSearchForm, getActionForm, getColumnForm } from '@/templates/tableshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import ActionForm from './actionform' |
| | | import SettingForm from './settingform' |
| | |
| | | componentDidMount () { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | // LText: 'select TbName ,Remark from sDataDictionary where IsKey!=\'\' and Deleted =0', |
| | | LText: 'select TbName,Remark from (select TbName,Remark from sDataDictb where appkey= @appkey@ and Deleted=0 union select a.TbName,Remark from (select TbName,Remark from sDataDictb where appkey= \'\' and Deleted=0 ) a left join (select TbName from sDataDictb where appkey= @appkey@ and Deleted=0 ) b on a.TbName=b.TbName where b.TbName is null ) t', |
| | | LText: queryTableSql, |
| | | obj_name: 'data', |
| | | arr_field: 'TbName,Remark' |
| | | } |
| | |
| | | columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), |
| | | currentTabs: null, |
| | | selectTabs: [], |
| | | interReadonly: false |
| | | interReadonly: false, |
| | | primaryKey: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { config, data } = this.props |
| | | const { config, data, columns } = this.props |
| | | let _tabs = [] |
| | | let _select = [] |
| | | let _tabMap = new Map() |
| | |
| | | } |
| | | }) |
| | | |
| | | let primaryKey = data.primaryKey |
| | | if (primaryKey) { |
| | | let field = columns.filter(column => column.field === primaryKey) |
| | | if (field.length !== 1) { |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey) { |
| | | columns.forEach(col => { |
| | | if (col.field.toLowerCase() === 'id') { |
| | | primaryKey = col.field |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | interReadonly: data.sysInterface === 'true' |
| | | interReadonly: data.sysInterface === 'true', |
| | | primaryKey: primaryKey |
| | | }) |
| | | } |
| | | |
| | |
| | | render() { |
| | | const { data, dict, menu, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs } = this.state |
| | | const { interType, columns, selectTabs, primaryKey } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | let primaryKey = data.primaryKey |
| | | if (primaryKey) { |
| | | let field = columns.filter(column => column.field === primaryKey) |
| | | if (field.length !== 1) { |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey && columns.length === 0) { |
| | | primaryKey = 'ID' |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | |
| | | <Col span={12}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: primaryKey |
| | | initialValue: primaryKey || '' |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('commontable-setting-form')} |
| | | onChange={this.selectChange} |
| | | > |
| | | <Select.Option key='unset' value="">不设置</Select.Option> |
| | | {columns.length === 0 ? |
| | | <Select.Option key='id' value="ID">ID</Select.Option> : null |
| | | } |
| | | <Select.Option key='unset' value="">未设置</Select.Option> |
| | | {columns.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.field}>{option.label}</Select.Option> |
| | | )} |
| | |
| | | }, { |
| | | value: 'update', |
| | | text: this.props.dict['header.form.action.update'] |
| | | }], |
| | | returnoptions: [{ // 返回后-不刷新、刷新页面、刷新表格 |
| | | value: 'never', |
| | | text: this.props.dict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'grid', |
| | | text: this.props.dict['header.form.refresh.grid'] |
| | | }, { |
| | | value: 'view', |
| | | text: this.props.dict['header.form.refresh.view'] |
| | | }], |
| | | currentoptions: [{ // 不返回时-不刷新、刷新 |
| | | value: 'never', |
| | | text: this.props.dict['header.form.refresh.never'] |
| | | }, { |
| | | value: 'refresh', |
| | | text: this.props.dict['header.form.refresh'] |
| | | }] |
| | | } |
| | | |
| | |
| | | const { card } = this.props |
| | | let _intertype = '' |
| | | let _options = null |
| | | console.log(this.props.card.btnType) |
| | | let _success = 'close' |
| | | let _error = 'notclose' |
| | | |
| | | this.props.formlist.forEach(form => { |
| | | if (form.key === 'intertype') { |
| | | _intertype = form.initVal |
| | | } else if (form.key === 'afterExecSuccess') { |
| | | _success = form.initVal |
| | | } else if (form.key === 'afterExecError') { |
| | | _error = form.initVal |
| | | } |
| | | }) |
| | | |
| | | if (card.btnType === 'cancel') { |
| | | _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess'] |
| | | } else { |
| | | this.props.formlist.forEach(form => { |
| | | if (form.key === 'intertype') { |
| | | _intertype = form.initVal |
| | | } |
| | | }) |
| | | |
| | | } else if (card.btnType === 'confirm') { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError'] |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } else if (item.key === 'execSuccess' && card.btnType === 'cancel') { |
| | | item.label = '关闭后' |
| | | } else if (item.key === 'execSuccess' && card.btnType !== 'cancel') { |
| | | if (_success === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } else if (item.key === 'execError') { |
| | | if (_error === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && _intertype === 'inner') { |
| | | item.required = true |
| | | } |
| | | |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | |
| | | } |
| | | } |
| | | |
| | | selectChange = (key, value) => { |
| | | if (key === 'afterExecSuccess') { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'execSuccess') { |
| | | if (value === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | execSuccess: 'never' |
| | | }) |
| | | } else if (key === 'afterExecError') { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'execError') { |
| | | if (value === 'close') { |
| | | item.options = this.state.returnoptions |
| | | } else { |
| | | item.options = this.state.currentoptions |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | this.props.form.setFieldsValue({ |
| | | execError: 'never' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | | const { card } = this.props |
| | | |
| | | let value = e.target.value |
| | | |
| | | if (key === 'intertype') { |
| | | let _options = null |
| | | if (value === 'inner') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError'] |
| | | |
| | | if (card.btnType === 'confirm') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError'] |
| | | } |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'afterExecSuccess', 'afterExecError'] |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError'] |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | item.readonly = false |
| | | } else if (item.key === 'sysInterface') { |
| | | item.initVal = 'false' |
| | | } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && value === 'inner') { |
| | | item.required = true |
| | | } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && value === 'outer') { |
| | | item.required = false |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | |
| | | }) |
| | | } |
| | | this.setState({ |
| | | // interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'interface' && value === 'true') { |
| | | item.readonly = true |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | onChange={(val) => this.selectChange(item.key, val)} |
| | | disabled={!!item.readonly} |
| | | > |
| | | {item.options.map((option, index) => |
| | |
| | | } |
| | | </div> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={edit} /> |
| | | {type === 'action' && ['prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc ? |
| | | {type === 'action' && card.btnType === 'confirm' && card.intertype === 'inner' && !card.innerFunc ? |
| | | <Icon className="edit profile" title="校验规则" type="profile" onClick={profile} /> : null |
| | | } |
| | | {card.btnType !== 'confirm' && card.btnType !== 'cancel' && <Icon className="edit close" title="删除" type="close" onClick={del} />} |
| | |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getModalForm, getActionForm } from '@/templates/tableshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import ModalForm from '@/templates/ushare/modalform' |
| | | import ActionForm from './actionform' |
| | | import SettingForm from './settingform' |
| | | // import ModalForm from './modalform' |
| | | import DragElement from './dragelement' |
| | | import GroupForm from './groupform' |
| | | import TabForm from '@/templates/tableshare/tabform' |
| | |
| | | funcLoading: false, // 存储过程创建中 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false, // 验证信息模态框 |
| | | editgroup: null, |
| | | groupVisible: null |
| | | editgroup: null, // 当前编辑组 |
| | | groupVisible: false // 编辑组模态框 |
| | | } |
| | | |
| | | /** |
| | |
| | | componentDidMount () { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | // LText: 'select TbName ,Remark from sDataDictionary where IsKey!=\'\' and Deleted =0', |
| | | LText: 'select TbName,Remark from (select TbName,Remark from sDataDictb where appkey= @appkey@ and Deleted=0 union select a.TbName,Remark from (select TbName,Remark from sDataDictb where appkey= \'\' and Deleted=0 ) a left join (select TbName from sDataDictb where appkey= @appkey@ and Deleted=0 ) b on a.TbName=b.TbName where b.TbName is null ) t', |
| | | LText: queryTableSql, |
| | | obj_name: 'data', |
| | | arr_field: 'TbName,Remark' |
| | | } |
| | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | |
| | | // 数据来源为查询且未设置主键时,启用为false |
| | | if (_config.setting.datatype === 'query' && !_config.setting.primaryKey) { |
| | | _config.enabled = false |
| | | } else if (_config.setting.datatype === 'query' && _config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { |
| | | _config.enabled = false |
| | | } |
| | | |
| | | // 标签不合法时,启用状态为false |
| | | if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | |
| | | } |
| | | }) |
| | | } |
| | | let forminvalid = true |
| | | if (config.groups.length > 1) { |
| | | config.groups.forEach(group => { |
| | | if (group.sublist.length === 0) { |
| | | forminvalid = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { |
| | | if (config.setting.datatype === 'query' && config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置数据源,不可启用!', |
| | | message: '尚未设置数据源,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else if (config.setting.datatype === 'query' && config.setting.primaryKey) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未设置主键,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else if (!tabinvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单标签页设置错误(多行标签内,行标签不可为空),不可启用!', |
| | | message: '存在多余标签组,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else if (!forminvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '存在多余空表单组,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | |
| | | cursor: pointer; |
| | | display: none; |
| | | } |
| | | .edit.close { |
| | | left: 40px; |
| | | color: #ff4d4f; |
| | | } |
| | | .edit.profile { |
| | | left: 20px; |
| | | color: purple; |
| | | } |
| | | .edit.close { |
| | | left: 20px; |
| | | color: #ff4d4f; |
| | | } |
| | | .edit.profile + .edit.close { |
| | | left: 40px; |
| | | } |
| | | button { |
| | | cursor: move; |
| | | min-width: 65px; |
| | |
| | | columns: null, |
| | | currentTabs: null, |
| | | selectTabs: [], |
| | | interReadonly: false |
| | | interReadonly: false, |
| | | primaryKey: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { config, menu } = this.props |
| | | const { config } = this.props |
| | | |
| | | let _tabs = [] |
| | | let _select = [] |
| | |
| | | let _setting = config.setting |
| | | |
| | | try { |
| | | if (menu && menu.LongParam) { |
| | | _columns = menu.LongParam.columns.filter(item => item.field && item.type !== 'colspan') |
| | | } |
| | | config.groups.forEach(group => { |
| | | let list = group.sublist.filter(item => item.field) |
| | | _columns = [..._columns, ...list] |
| | |
| | | } |
| | | }) |
| | | |
| | | let primaryKey = _setting.primaryKey |
| | | if (primaryKey) { |
| | | let field = _columns.filter(column => column.field === primaryKey) |
| | | if (field.length !== 1) { |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey) { |
| | | _columns.forEach(col => { |
| | | if (col.field.toLowerCase() === 'id') { |
| | | primaryKey = col.field |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | currentTabs: _tabs, |
| | | selectTabs: _select, |
| | | columns: _columns, |
| | | setting: _setting, |
| | | interReadonly: _setting.sysInterface === 'true' |
| | | interType: _setting.interType || 'inner', |
| | | interReadonly: _setting.sysInterface === 'true', |
| | | datatype: _setting.datatype || 'maintable', |
| | | primaryKey: primaryKey |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | sourceChange = (e) => { |
| | | const { interType } = this.state |
| | | |
| | | this.setState({ |
| | | datatype: e.target.value |
| | | }, () => { |
| | | if (interType === 'inner') return |
| | | |
| | | let _type = this.props.form.getFieldValue('sysInterface') |
| | | if (_type === 'true') { |
| | | this.props.form.setFieldsValue({ |
| | | interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | }) |
| | | this.setState({ |
| | | interReadonly: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | interReadonly: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { dict, usefulFields, menu } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns, selectTabs, setting } = this.state |
| | | const { interType, columns, selectTabs, setting, datatype, primaryKey } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | let primaryKey = setting.primaryKey |
| | | if (primaryKey) { |
| | | let field = columns.filter(column => column.field === primaryKey) |
| | | if (field.length !== 1) { |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey && columns.length === 0) { |
| | | primaryKey = 'ID' |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={dict['header.menu.datasource']}> |
| | | {getFieldDecorator('datatype', { |
| | | initialValue: setting.datatype || 'maintable' |
| | | })( |
| | | <Radio.Group onChange={this.sourceChange}> |
| | | <Radio value="maintable">{dict['header.menu.maintable']}</Radio> |
| | | <Radio value="query">{dict['header.menu.query']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {datatype === 'query' ? <Col span={12}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: primaryKey || '' |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('commontable-setting-form')} |
| | | > |
| | | <Select.Option key='unset' value="">未设置</Select.Option> |
| | | {columns.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.field}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {datatype === 'query' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.intertype']}> |
| | | {getFieldDecorator('interType', { |
| | | initialValue: setting.interType || 'inner' |
| | | initialValue: interType |
| | | })( |
| | | <Radio.Group onChange={this.onChange}> |
| | | <Radio value="inner">{dict['header.form.interface.inner']}</Radio> |
| | |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {interType === 'outer' ? <Col span={12}> |
| | | </Col> : null} |
| | | {datatype === 'query' && interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.sysInterface']}> |
| | | {getFieldDecorator('sysInterface', { |
| | | initialValue: setting.sysInterface || 'false' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | {datatype === 'query' && interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.interface']}> |
| | | {getFieldDecorator('interface', { |
| | | initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (setting.interface || ''), |
| | |
| | | })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={12}> |
| | | {datatype === 'query' && interType !== 'outer' ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" overlayClassName="middle" title={`可自定义数据处理函数,函数名称需以${usefulFields.join(', ')}等字符开始;未设置时会调用系统函数,使用系统函数需完善数据源。`}> |
| | | <Icon type="question-circle" /> |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType !== 'outer' ? <Col span={24}> |
| | | {datatype === 'query' && interType !== 'outer' ? <Col span={24}> |
| | | <Form.Item help={'数据ID:' + menu.MenuID} label={ |
| | | <Tooltip placement="topLeft" title="使用系统函数时,需填写数据源,自定义函数时,可忽略。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {interType === 'outer' ? <Col span={12}> |
| | | {datatype === 'query' && interType === 'outer' ? <Col span={12}> |
| | | <Form.Item label={dict['header.form.outerFunc']}> |
| | | {getFieldDecorator('outerFunc', { |
| | | initialValue: setting.outerFunc || '', |
| | |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | |
| | | <Col span={12}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: primaryKey |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('commontable-setting-form')} |
| | | > |
| | | <Select.Option key='unset' value="">不设置</Select.Option> |
| | | {columns.length === 0 ? |
| | | <Select.Option key='id' value="ID">ID</Select.Option> : null |
| | | } |
| | | {columns.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.field}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="主表可选取关联标签,标签关联后,主表数据切换时,下级标签会跟随主表主键值变化。"> |
| | |
| | | execError: 'never', |
| | | errorTime: 15, |
| | | OpenType: 'exec', |
| | | icon: 'plus', |
| | | icon: '', |
| | | class: 'green', |
| | | verify: null |
| | | }, { |
| | |
| | | OpenType: 'exec', |
| | | pageTemplate: '', |
| | | url: '', |
| | | icon: 'rollback', |
| | | class: 'purple' |
| | | icon: '', |
| | | class: 'danger' |
| | | } |
| | | ], |
| | | tabs: [ |
| | |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getModalForm } from '@/templates/tableshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import ModalForm from '@/templates/ushare/modalform' |
| | | import DragElement from './dragelement' |
| | |
| | | componentDidMount () { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | // LText: 'select TbName ,Remark from sDataDictionary where IsKey!=\'\' and Deleted =0', |
| | | LText: 'select TbName,Remark from (select TbName,Remark from sDataDictb where appkey= @appkey@ and Deleted=0 union select a.TbName,Remark from (select TbName,Remark from sDataDictb where appkey= \'\' and Deleted=0 ) a left join (select TbName from sDataDictb where appkey= @appkey@ and Deleted=0 ) b on a.TbName=b.TbName where b.TbName is null ) t', |
| | | LText: queryTableSql, |
| | | obj_name: 'data', |
| | | arr_field: 'TbName,Remark' |
| | | } |
| | |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getSearchForm, getActionForm, getColumnForm } from '@/templates/tableshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import ActionForm from './actionform' |
| | | import SettingForm from './settingform' |
| | |
| | | componentDidMount () { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | // LText: 'select TbName ,Remark from sDataDictionary where IsKey!=\'\' and Deleted =0', |
| | | LText: 'select TbName,Remark from (select TbName,Remark from sDataDictb where appkey= @appkey@ and Deleted=0 union select a.TbName,Remark from (select TbName,Remark from sDataDictb where appkey= \'\' and Deleted=0 ) a left join (select TbName from sDataDictb where appkey= @appkey@ and Deleted=0 ) b on a.TbName=b.TbName where b.TbName is null ) t', |
| | | LText: queryTableSql, |
| | | obj_name: 'data', |
| | | arr_field: 'TbName,Remark' |
| | | } |
| | |
| | | state = { |
| | | interType: this.props.data.interType || 'inner', |
| | | columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), |
| | | interReadonly: this.props.data.sysInterface === 'true' |
| | | interReadonly: this.props.data.sysInterface === 'true', |
| | | primaryKey: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { data, columns } = this.props |
| | | |
| | | let primaryKey = data.primaryKey |
| | | if (primaryKey) { |
| | | let field = columns.filter(column => column.field === primaryKey) |
| | | if (field.length !== 1) { |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey) { |
| | | columns.forEach(col => { |
| | | if (col.field.toLowerCase() === 'id') { |
| | | primaryKey = col.field |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | primaryKey: primaryKey |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | render() { |
| | | const { data, dict, tabId, usefulFields } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType, columns } = this.state |
| | | const { interType, columns, primaryKey } = this.state |
| | | |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | let primaryKey = data.primaryKey |
| | | if (primaryKey) { |
| | | let field = columns.filter(column => column.field === primaryKey) |
| | | if (field.length !== 1) { |
| | | primaryKey = '' |
| | | } |
| | | } |
| | | if (!primaryKey && columns.length === 0) { |
| | | primaryKey = 'ID' |
| | | } |
| | | |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | |
| | | <Col span={12}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: primaryKey |
| | | initialValue: primaryKey || '' |
| | | })( |
| | | <Select |
| | | getPopupContainer={() => document.getElementById('subtable-setting-form')} |
| | | onChange={this.selectChange} |
| | | > |
| | | <Select.Option key='unset' value="">不设置</Select.Option> |
| | | {columns.length === 0 ? |
| | | <Select.Option key='id' value="ID">ID</Select.Option> : null |
| | | } |
| | | <Select.Option key='unset' value="">未设置</Select.Option> |
| | | {columns.map((option, index) => |
| | | <Select.Option id={option.uuid} title={option.label} key={index} value={option.field}>{option.label}</Select.Option> |
| | | )} |
| | |
| | | this.props.form.setFieldsValue({ |
| | | Column: '', |
| | | Text: '', |
| | | required: 'false', |
| | | required: 'true', |
| | | type: 'Nvarchar(50)' |
| | | }) |
| | | } |
| | |
| | | <Col span={7}> |
| | | <Form.Item label={'是否必填'}> |
| | | {getFieldDecorator('required', { |
| | | initialValue: 'false' |
| | | initialValue: 'true' |
| | | })( |
| | | <Select> |
| | | <Select.Option value="false"> 否 </Select.Option> |
| | |
| | | |
| | | const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | // 表单校验规则 |
| | | export const formRule = { |
| | | input: { |
| | | max: 100, |
| | |
| | | } |
| | | } |
| | | |
| | | // 系统模板 |
| | | export const sysTemps = [ |
| | | { |
| | | title: '基础表格', |
| | |
| | | } |
| | | ] |
| | | |
| | | // 日期默认值选择范围 |
| | | export const dateOptions = { |
| | | date: [ |
| | | {value: '', text: _dict['date.empty']}, |
| | |
| | | ] |
| | | } |
| | | |
| | | export const matchReg = { // 匹配规则 |
| | | // 匹配规则 |
| | | export const matchReg = { |
| | | text: [{ |
| | | value: 'like', |
| | | text: 'like' |
| | |
| | | }] |
| | | } |
| | | |
| | | // 按钮图标集 |
| | | export const btnIcons = [{ |
| | | value: '', |
| | | text: 'unset' |
| | |
| | | text: 'step-forward' |
| | | }] |
| | | |
| | | // 按钮颜色集 |
| | | export const btnClasses = [{ |
| | | value: 'default', |
| | | text: '默认(黑边白底)' |
| | |
| | | value: 'border-purple', |
| | | text: '白底紫框' |
| | | }] |
| | | |
| | | export const queryTableSql = 'select TbName,Remark from (select TbName,Remark from sDataDictb where appkey= @appkey@ and Deleted=0 union select a.TbName,Remark from (select TbName,Remark from sDataDictb where appkey= \'\' and Deleted=0 ) a left join (select TbName from sDataDictb where appkey= @appkey@ and Deleted=0 ) b on a.TbName=b.TbName where b.TbName is null ) t' |