| | |
| | | btnTab: null, // 打开新标签或当前页面刷新的按钮 |
| | | btnTabConfig: null, // 打开新标签按钮配置 |
| | | handleMVisible: false, // 添加或修改菜单模态框(角色权限分配等) |
| | | sysMenu: false // 添加或编辑菜单(角色权限分配等) |
| | | sysMenu: false, // 添加或编辑菜单(角色权限分配等) |
| | | optionLibs: [] // 自定义下拉选项库 |
| | | } |
| | | |
| | | /** |
| | |
| | | type: 'edit', |
| | | editMenu: _menu, |
| | | loading: false, |
| | | optionLibs: new Map(), // 编辑时,初始化为空 |
| | | tabview: _Template.length > 0 ? _menu.PageParam.Template : 'template' |
| | | }, () => { |
| | | document.getElementById('root').style.overflowY = 'hidden' |
| | |
| | | this.setState({ |
| | | loading: false, |
| | | tabview: template.type, |
| | | optionLibs: new Map(), // 新建时,初始化下拉选项库 |
| | | editMenu: { |
| | | ...editMenu, |
| | | type: template.type, |
| | |
| | | {this.state.tabview === 'CommonTable' && |
| | | <ComTableConfig |
| | | menu={this.state.editMenu} |
| | | optionLibs={this.state.optionLibs} |
| | | supMenuList={this.props.supMenuList} |
| | | reloadmenu={() => {this.props.reload()}} |
| | | handleView={this.handleView} |
| | |
| | | {this.state.tabview === 'Modal' && |
| | | <ModalConfig |
| | | menu={this.state.editMenu} |
| | | optionLibs={this.state.optionLibs} |
| | | editTab={this.state.editTab} |
| | | tabConfig={this.state.tabConfig} |
| | | editSubTab={this.state.editSubTab} |
| | |
| | | {this.state.tabview === 'SubTable' && |
| | | <SubTable |
| | | menu={this.state.editMenu} |
| | | optionLibs={this.state.optionLibs} |
| | | editTab={this.state.editTab} |
| | | editSubTab={this.state.editSubTab} |
| | | tabConfig={this.state.tabConfig} |
| | |
| | | {this.state.tabview === 'FormTab' && |
| | | <FormTabConfig |
| | | menu={this.state.editMenu} |
| | | optionLibs={this.state.optionLibs} |
| | | btnTab={this.state.btnTab} |
| | | config={this.state.subConfig} |
| | | handleView={this.handleView} |
| | |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.form.pagination': '分页', |
| | | 'header.form.regular': '正则校验', |
| | | 'header.form.quickadd': '快捷添加', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.form.pagination': '分页', |
| | | 'header.form.regular': '正则校验', |
| | | 'header.form.quickadd': '快捷添加', |
| | | 'header.modal.form.edit': '表单-编辑', |
| | | 'header.modal.search.edit': '搜索条件-编辑', |
| | | 'header.modal.action.edit': '按钮-编辑', |
| | |
| | | */ |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.state.config && this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { |
| | | this.refs.subTable.resetTable() |
| | | this.loadmaindata(nextProps.BID, 'refresh') |
| | | } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { |
| | | this.reloadtable() |
| | |
| | | } else if (btn.popClose === 'equaltab' && type === 'pop') { |
| | | this.reloadtable() |
| | | this.props.handleMainTable('equaltab') |
| | | } else if (btn.execSuccess === 'maingrid' && type === 'success') { |
| | | this.props.handleMainTable('maingrid') |
| | | } else if (btn.execSuccess === 'equaltab' && type === 'success') { |
| | | this.reloadtable() |
| | | this.props.handleMainTable('equaltab') |
| | | } |
| | | } |
| | | |
| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | supMenuList: PropTypes.array, |
| | | reloadmenu: PropTypes.func, |
| | | handleView: PropTypes.func |
| | |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false // 验证信息模态框 |
| | | profileVisible: false, // 验证信息模态框 |
| | | optionLibs: null // 自定义下拉选项库 |
| | | } |
| | | |
| | | /** |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu } = this.props |
| | | const { menu, optionLibs } = this.props |
| | | |
| | | let _LongParam = menu.LongParam |
| | | let _config = '' |
| | |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = _LongParam |
| | | _config.search.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: menu.MenuName, |
| | | type: 'search', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 配置默认值,兼容 |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | optionLibs: optionLibs, |
| | | originActions: _oriActions, |
| | | originMenu: JSON.parse(JSON.stringify(menu)), |
| | | selectedTables: _config.tables || [], |
| | |
| | | */ |
| | | handleSubmit = () => { |
| | | const { menu } = this.props |
| | | const { config, card, modaltype } = this.state |
| | | const { config, card, modaltype, optionLibs } = this.state |
| | | |
| | | if (modaltype === 'search') { |
| | | this.searchFormRef.handleConfirm().then(res => { |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(res.uuid, { |
| | | uuid: res.uuid, |
| | | label: res.label, |
| | | parname: menu.MenuName, |
| | | type: 'search', |
| | | options: res.options |
| | | }) |
| | | } |
| | | |
| | | let _search = config.search.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | |
| | | return |
| | | } |
| | | |
| | | if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) { |
| | | if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { |
| | | let param = { |
| | | func: 's_DataSrc_Save', |
| | | LText: setting.dataresource, |
| | |
| | | if ( |
| | | res.interType === 'inner' && |
| | | !res.innerFunc && |
| | | res.dataresource.length > 50 && |
| | | /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && |
| | | config.setting.dataresource !== res.dataresource |
| | | ) { |
| | | let param = { |
| | |
| | | */ |
| | | setSubConfig = (item, type) => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | const { config, originMenu, optionLibs } = this.state |
| | | |
| | | if (!originMenu.MenuID) { // menuID不存在时,为新建菜单,提示菜单尚未保存 |
| | | notification.warning({ |
| | |
| | | } |
| | | |
| | | let param = { |
| | | optionLibs: optionLibs, |
| | | editMenu: _originMenu, |
| | | editTab: !isbutton ? item : '', |
| | | tabConfig: null, |
| | |
| | | <SearchForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | optionLibs={this.state.optionLibs} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.searchFormRef = inst} |
| | | /> |
| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | btnTab: PropTypes.object, |
| | | config: PropTypes.any, |
| | | handleView: PropTypes.func |
| | |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false, // 验证信息模态框 |
| | | editgroup: null, // 当前编辑组 |
| | | groupVisible: false // 编辑组模态框 |
| | | groupVisible: false, // 编辑组模态框 |
| | | optionLibs: null // 自定义下拉选项库 |
| | | } |
| | | |
| | | /** |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, btnTab, config } = this.props |
| | | const { menu, btnTab, config, optionLibs } = this.props |
| | | |
| | | let _config = '' |
| | | let columns = [] |
| | |
| | | } |
| | | } else { |
| | | _config = config |
| | | |
| | | _config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: btnTab.label, |
| | | type: 'Modal', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (menu && menu.LongParam && menu.LongParam.columns) { |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | optionLibs: optionLibs, |
| | | columns: columns, |
| | | originMenu: JSON.parse(JSON.stringify(_config)), |
| | | selectedTables: _config.tables, |
| | |
| | | let _tabview = menu ? menu.LongParam.Template : '' |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: null, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | |
| | | * 3、添加或编辑列,保存时,如按钮位置设置为表格,则修改操作列显示状态 |
| | | */ |
| | | handleSubmit = () => { |
| | | const { config, modaltype } = this.state |
| | | const { btnTab } = this.props |
| | | const { config, modaltype, optionLibs } = this.state |
| | | |
| | | if (modaltype === 'search') { |
| | | this.modalFormRef.handleConfirm().then(res => { |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(res.uuid, { |
| | | uuid: res.uuid, |
| | | label: res.label, |
| | | parname: btnTab.label, |
| | | type: 'Modal', |
| | | options: res.options |
| | | }) |
| | | } |
| | | let _groups = config.groups.map(group => { |
| | | group.sublist = group.sublist.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | |
| | | |
| | | this.setState({ |
| | | config: {...config, groups: _groups}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | |
| | | return |
| | | } |
| | | |
| | | if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) { |
| | | if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { |
| | | let param = { |
| | | func: 's_DataSrc_Save', |
| | | LText: setting.dataresource, |
| | |
| | | if ( |
| | | res.interType === 'inner' && |
| | | !res.innerFunc && |
| | | res.dataresource.length > 50 && |
| | | /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && |
| | | config.setting.dataresource !== res.dataresource |
| | | ) { |
| | | let param = { |
| | |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: btn, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | optionLibs={this.state.optionLibs} |
| | | wrappedComponentRef={(inst) => this.modalFormRef = inst} |
| | | /> |
| | | </Modal> |
| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | editSubTab: PropTypes.any, |
| | | tabConfig: PropTypes.any, |
| | |
| | | selectedTables: [], // 已选表名 |
| | | originConfig: null, // 原始菜单 |
| | | groupVisible: false, // 全局配置模态框 |
| | | curgroup: null // 当前组,新建或编辑 |
| | | curgroup: null, // 当前组,新建或编辑 |
| | | optionLibs: null // 自定义下拉选项库 |
| | | } |
| | | |
| | | /** |
| | |
| | | * 4、设置按钮基本信息 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction, tabConfig, subTabConfig, subConfig} = this.props |
| | | const {menu, editAction, tabConfig, subTabConfig, subConfig, optionLibs} = this.props |
| | | |
| | | let _config = '' |
| | | let _tab = subTabConfig ? subTabConfig : tabConfig |
| | |
| | | |
| | | if (subConfig) { |
| | | _config = subConfig |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: editAction.label, |
| | | type: 'Modal', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | _config.fields.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: editAction.label, |
| | | type: 'Modal', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } |
| | |
| | | |
| | | this.setState({ |
| | | menu: _menu, |
| | | optionLibs: optionLibs, |
| | | config: _config, |
| | | selectedTables: _config.tables || [], |
| | | originConfig: JSON.parse(JSON.stringify(_config)), |
| | |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: editTab, |
| | | tabConfig: tabConfig, |
| | | editSubTab: editSubTab, |
| | |
| | | * 3、通过loading刷新 |
| | | */ |
| | | handleSubmit = () => { |
| | | const {editAction, optionLibs} = this.props |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(res.uuid, { |
| | | uuid: res.uuid, |
| | | label: res.label, |
| | | parname: editAction.label, |
| | | type: 'Modal', |
| | | options: res.options |
| | | }) |
| | | } |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | optionLibs: optionLibs, |
| | | visible: false |
| | | }) |
| | | }) |
| | |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | optionLibs={this.state.optionLibs} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | </Modal> |
| | |
| | | class SubTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | tabConfig: PropTypes.any, |
| | | editSubTab: PropTypes.any, |
| | |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false // 验证信息模态框 |
| | | profileVisible: false, // 验证信息模态框 |
| | | optionLibs: null // 自定义下拉选项库 |
| | | } |
| | | |
| | | /** |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { config, editTab, editSubTab } = this.props |
| | | const { config, editTab, editSubTab, optionLibs } = this.props |
| | | |
| | | let _config = null |
| | | |
| | |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify(config)) |
| | | |
| | | _config.search.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: _config.tabName, |
| | | type: 'search', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let _oriActions = [] |
| | |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | | optionLibs: optionLibs, |
| | | config: _config, |
| | | originConfig: _config, |
| | | selectedTables: _config.tables || [], |
| | |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: editSubTab ? editTab : null, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | |
| | | * 3、添加或编辑列,保存时,如按钮位置设置为表格,则修改操作列显示状态 |
| | | */ |
| | | handleSubmit = () => { |
| | | const { card, config, modaltype } = this.state |
| | | const { card, config, modaltype, optionLibs } = this.state |
| | | |
| | | if (modaltype === 'search') { |
| | | this.searchFormRef.handleConfirm().then(res => { |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(res.uuid, { |
| | | uuid: res.uuid, |
| | | label: res.label, |
| | | parname: config.tabName, |
| | | type: 'search', |
| | | options: res.options |
| | | }) |
| | | } |
| | | |
| | | let _search = config.search.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | |
| | | return |
| | | } |
| | | |
| | | if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) { |
| | | if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { |
| | | let param = { |
| | | func: 's_DataSrc_Save', |
| | | LText: setting.dataresource, |
| | |
| | | if ( |
| | | res.interType === 'inner' && |
| | | !res.innerFunc && |
| | | res.dataresource.length > 50 && |
| | | /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && |
| | | config.setting.dataresource !== res.dataresource |
| | | ) { |
| | | let param = { |
| | |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: editTab, |
| | | tabConfig: editSubTab ? tabConfig : originConfig, |
| | | editSubTab: _subtab, |
| | |
| | | import React, {Component} from 'react' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Table, Input, Button, Popconfirm, Form, Icon } from 'antd' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (this.props.type !== nextProps.type) { |
| | | this.resetColumn(nextProps.type) |
| | | } else if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | this.setState({ |
| | | dataSource: nextProps.data, |
| | | count: nextProps.data.length |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | value: 'sso', |
| | | text: Formdict['header.form.database.sso'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'quick', |
| | | label: Formdict['header.form.quickadd'], |
| | | initVal: '', |
| | | required: false, |
| | | options: [] |
| | | } |
| | | ] |
| | | } |
| | |
| | | label: Formdict['header.form.linkForm'], |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'quick', |
| | | label: Formdict['header.form.quickadd'], |
| | | initVal: '', |
| | | required: false, |
| | | options: [] |
| | | } |
| | | ] |
| | | } |
| | |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单 |
| | | card: PropTypes.object // 搜索条件信息 |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单 |
| | | optionLibs: PropTypes.any, // 自定义下拉集 |
| | | card: PropTypes.object // 搜索条件信息 |
| | | } |
| | | |
| | | state = { |
| | |
| | | * 2、下拉选择,根据数据源类型显示相关配置 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { formlist } = this.props |
| | | const { formlist, optionLibs } = this.props |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'match'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | _options = [..._options, 'resourceType', 'options', 'display', 'quick'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] |
| | | } |
| | |
| | | } else if (type === 'dateweek' || type === 'daterange') { |
| | | form.options = matchReg.daterange |
| | | } |
| | | } else if (form.key === 'quick') { |
| | | form.options = [...optionLibs.values()].filter(cell => cell.uuid !== this.props.card.uuid) |
| | | form.options = form.options.map(cell => { |
| | | return { |
| | | value: cell.uuid, |
| | | text: cell.label + '(' + cell.parname + ')' |
| | | } |
| | | }) |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | |
| | | let _options = ['label', 'field', 'initval', 'type', 'match'] |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '0') { // 下拉选择类型、选项为自定义资源 |
| | | _options = [..._options, 'resourceType', 'options', 'display'] |
| | | _options = [..._options, 'resourceType', 'options', 'display', 'quick'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && resourceType === '1') { // 下拉选择类型、选项为后台数据源中获取 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'display', 'database'] |
| | | } |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'quick') { |
| | | let option = this.props.optionLibs.get(value) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'options') { |
| | | form.initVal = option.options |
| | | } |
| | | |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | let _options = ['label', 'field', 'initval', 'type', 'match', 'resourceType', 'display'] |
| | | |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | _options = [..._options, 'options', 'quick'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } |
| | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.linkSubFields), fromJS(nextProps.linkSubFields)) || this.props.type !== nextProps.type) { |
| | | this.resetColumn(nextProps.type, nextProps.linkSubFields) |
| | | } else if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | nextProps.data.forEach(item => { |
| | | let _item = {key: Utils.getuuid()} |
| | | this.state.columns.forEach(col => { |
| | | _item[col.dataIndex] = item[col.dataIndex] || '' |
| | | if (col.dataIndex !== 'ParentID' && !_item[col.dataIndex]) { |
| | | _item[col.dataIndex] = item.Text |
| | | } |
| | | }) |
| | | _data.push(_item) |
| | | }) |
| | | this.setState({ |
| | | dataSource: _data, |
| | | count: nextProps.data.length |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | dict: PropTypes.object, // 字典项 |
| | | optionLibs: PropTypes.any, // 自定义下拉集 |
| | | formlist: PropTypes.any, |
| | | card: PropTypes.object |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { optionLibs } = this.props |
| | | let formlist = JSON.parse(JSON.stringify(this.props.formlist)) |
| | | |
| | | let type = '' |
| | |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] // 默认显示项 |
| | | |
| | | if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | _options = [..._options, 'resourceType', 'options', 'quick'] |
| | | } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (type === 'number') { |
| | |
| | | form.type = 'number' |
| | | form.initVal = form.initVal || 0 |
| | | form.required = true |
| | | } else if (form.key === 'quick') { |
| | | form.options = [...optionLibs.values()].filter(cell => cell.uuid !== this.props.card.uuid) |
| | | form.options = form.options.map(cell => { |
| | | return { |
| | | value: cell.uuid, |
| | | text: cell.label + '(' + cell.parname + ')' |
| | | } |
| | | }) |
| | | } |
| | | |
| | | form.show = _options.includes(form.key) |
| | | return form |
| | | }) |
| | |
| | | } |
| | | |
| | | openTypeChange = (key, value) => { |
| | | |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin'] |
| | | |
| | | if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'options'] |
| | | _options = [..._options, 'resourceType', 'options', 'quick'] |
| | | } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } else if (value === 'number') { |
| | |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (key === 'quick') { |
| | | let option = this.props.optionLibs.get(value) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'options') { |
| | | form.initVal = option.options |
| | | } |
| | | |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | if (key === 'resourceType') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden', 'readin'] |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | _options = [..._options, 'options', 'quick'] |
| | | } else if (value === '1') { |
| | | _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database'] |
| | | } |
| | |
| | | config.search.forEach(item => { |
| | | if (item.field) { |
| | | let type = '' |
| | | let _f = item.field |
| | | |
| | | if (item.type.match(/date/ig)) { |
| | | type = 'datetime=null' |
| | |
| | | type = 'nvarchar(50)=\'\'' |
| | | } |
| | | |
| | | if (_fields.has(item.field)) { |
| | | _f = _f + '1' |
| | | } |
| | | |
| | | _fields.set(item.field, true) |
| | | formParam = formParam + `mchr13k@${_f} ${type},` |
| | | item.field.split(',').forEach(cell => { |
| | | let _f = cell |
| | | if (_fields.has(cell)) { |
| | | _f = _f + '1' |
| | | } |
| | | |
| | | _fields.set(cell, true) |
| | | formParam = formParam + `mchr13k@${_f} ${type},` |
| | | }) |
| | | } |
| | | }) |
| | | } |