| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip, message } from 'antd' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Icon, Switch, Tooltip, Col } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import { getSearchForm, getActionForm, getColumnForm } from '@/templates/zshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getMainMenuForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import ActionForm from './actionform' |
| | | import SettingForm from './settingform' |
| | | import TabForm from '@/templates/zshare/tabform' |
| | | import SearchForm from '@/templates/zshare/searchform' |
| | | import ColumnForm from '@/templates/zshare/columnform' |
| | | import PasteForm from '@/templates/zshare/pasteform' |
| | | import DragElement from '@/templates/zshare/dragelement' |
| | | import ColspanForm from '@/templates/zshare/colspanform' |
| | | import GridBtnForm from '@/templates/zshare/gridbtnform' |
| | | import EditCard from '@/templates/zshare/editcard' |
| | | import VerifyCard from '@/templates/zshare/verifycard' |
| | | import VerifyCardExcelIn from '@/templates/zshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/zshare/verifycardexcelout' |
| | | import VerifyCardPrint from '@/templates/zshare/verifycardprint' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import SearchComponent from '@/templates/sharecomponent/searchcomponent' |
| | | import ActionComponent from '@/templates/sharecomponent/actioncomponent' |
| | | import ColumnComponent from '@/templates/sharecomponent/columncomponent' |
| | | |
| | | import MenuForm from '@/templates/zshare/menuform' |
| | | import TabDragElement from '@/templates/zshare/tabdragelement' |
| | | import TransferForm from '@/components/transferform' |
| | | import SourceElement from '@/templates/zshare/dragelement/source' |
| | | import CreateFunc from '@/templates/zshare/createfunc' |
| | | import CreateInterface from '@/templates/zshare/createinterface' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import Source from './source' |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { Option } = Select |
| | | const { confirm } = Modal |
| | | const CommonDict = (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | | const ChartGroupComponent = asyncComponent(() => import('@/templates/sharecomponent/chartgroupcomponent')) |
| | | const ChartComponent = asyncComponent(() => import('@/templates/sharecomponent/chartcomponent')) |
| | | const CardComponent = asyncComponent(() => import('@/templates/sharecomponent/cardcomponent')) |
| | | const TabsComponent = asyncComponent(() => import('@/templates/sharecomponent/tabscomponent')) |
| | | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: CommonDict, // 字典 |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | config: null, // 页面配置 |
| | | tableVisible: false, // 数据表字段模态框 |
| | | addType: '', // 添加类型-搜索条件或显示列 |
| | | tableColumns: [], // 表格显示列 |
| | | tableFields: [], // 表格显示列 |
| | | fields: null, // 搜索条件及显示列,可选字段 |
| | | menuformlist: null, // 基本信息表单字段 |
| | | formlist: null, // 搜索条件、按钮、显示列表单字段 |
| | | modaltype: '', // 模态框类型,控制模态框显示 |
| | | card: null, // 编辑元素 |
| | | menuloading: false, // 菜单保存中 |
| | | menucloseloading: false, // 菜单关闭时,选择保存 |
| | | loading: false, // 加载中,页面spin |
| | | settingVisible: false, // 全局配置模态框 |
| | | closeVisible: false, // 关闭模态框 |
| | | tables: [], // 可用表名 |
| | | selectedTables: [], // 已选表名 |
| | | originMenu: null, // 原始菜单 |
| | | originActions: null, // 原始按钮信息,使用已有用户模板 |
| | | delActions: [], // 删除按钮列表 |
| | | copyActions: [], // 复制按钮组 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false, // 验证信息模态框 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | thawBtnVisible: false, // 解冻按钮弹窗 |
| | | thawbtnlist: null, // 解冻按钮列表 |
| | | thawButtons: [], // 已选择要解冻的按钮 |
| | | activeKey: '0' // 默认展开基本信息 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | chartview: null, // 当前视图 |
| | | pasteContent: null, // 粘贴配置信息 |
| | | openEdition: '' // 编辑版本标记,防止多人操作 |
| | | } |
| | | |
| | | /** |
| | |
| | | let _config = '' |
| | | |
| | | if (!_LongParam) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | _config = fromJS(Source.baseConfig).toJS() |
| | | if (!menu.isSubtable) { // 不是选择主子表时,隐藏标签页 |
| | | _config.tabs = [] |
| | | _config.tabgroups = [{ uuid: 'tabs', sublist: [] }] |
| | | } |
| | | _config.isAdd = true |
| | | } else { |
| | |
| | | }) |
| | | } |
| | | |
| | | // 配置默认值,兼容 |
| | | _config.tabs = _config.tabs || [] |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | _config.Template = 'CommonTable' |
| | | if (!_config.version || _config.version < '1.0') { |
| | | // 配置默认值,兼容 |
| | | _config.version = '1.0' |
| | | _config.Template = 'CommonTable' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | | if (!_config.tabgroups) { |
| | | _config.tabgroups = [{ uuid: 'tabs', sublist: [] }] |
| | | } else if (typeof(_config.tabgroups[0]) === 'string') { |
| | | let _tabgroups = [] |
| | | _config.tabgroups.forEach(groupId => { |
| | | let _group = { |
| | | uuid: groupId, |
| | | sublist: fromJS(_config[groupId]).toJS() |
| | | } |
| | | |
| | | delete _config[groupId] |
| | | |
| | | _tabgroups.push(_group) |
| | | }) |
| | | |
| | | _config.tabgroups = _tabgroups |
| | | } |
| | | |
| | | // 兼容图表 |
| | | if (!_config.charts) { |
| | | _config.expand = false |
| | | _config.charts = [{ |
| | | uuid: Utils.getuuid(), |
| | | label: '', |
| | | title: '', |
| | | chartType: 'table', |
| | | icon: 'table', |
| | | Hide: 'false', |
| | | blacklist: [] |
| | | }] |
| | | } else { |
| | | _config.charts.forEach(card => { |
| | | if (card.chartType === 'card') { |
| | | card.details = card.details.map(_cell => { |
| | | if (!_cell.fontSize) { |
| | | _cell.fontSize = 14 |
| | | } |
| | | if (!_cell.width) { |
| | | _cell.width = 100 |
| | | } else if (_cell.width === 'helf') { |
| | | _cell.width = 50 |
| | | } else if (_cell.width === 'third') { |
| | | _cell.width = 33 |
| | | } |
| | | |
| | | if (_cell.bold === 'true') { |
| | | _cell.fontWeight = 'normal' |
| | | } |
| | | |
| | | if (!_cell.height) { |
| | | _cell.height = 1 |
| | | } |
| | | |
| | | return _cell |
| | | }) |
| | | |
| | | if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { |
| | | card.avatar.widthType = 'ratio' |
| | | card.avatar.width = 32 |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let _oriActions = [] |
| | | if (_config.type === 'user') { |
| | |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮(表单) |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | prebtn: fromJS(item).toJS(), |
| | | curuuid: uuid, |
| | | Template: 'Modal' |
| | | }) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { // 含有子配置项的按钮(标签后当前页打开) |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | prebtn: fromJS(item).toJS(), |
| | | curuuid: uuid, |
| | | Template: item.tabTemplate |
| | | }) |
| | |
| | | |
| | | // 重置标签ID |
| | | _config.tabgroups.forEach(group => { |
| | | _config[group] = _config[group].map(tab => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | tab.uuid = Utils.getuuid() |
| | | |
| | | if (tab.linkTab) { |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | chartview: _config.charts[0].uuid, |
| | | config: _config, |
| | | openEdition: menu.open_edition || '', |
| | | activeKey: menu.activeKey || '0', |
| | | optionLibs: optionLibs, |
| | | originActions: _oriActions, |
| | | originMenu: JSON.parse(JSON.stringify(menu)), |
| | | selectedTables: _config.tables || [], |
| | | menuformlist: [ |
| | | { |
| | | type: 'select', |
| | | key: 'fstMenuId', |
| | | label: '一级菜单', |
| | | initVal: menu.fstMenuId, |
| | | required: true, |
| | | readonly: false, |
| | | options: menu.fstMenuList |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'parentId', |
| | | label: '二级菜单', |
| | | initVal: menu.ParentID, |
| | | required: true, |
| | | readonly: false, |
| | | options: menu.supMenuList |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'menuName', |
| | | label: this.state.dict['header.menu.menuName'], |
| | | initVal: menu.MenuName, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'menuNo', |
| | | label: this.state.dict['header.menu.menuNo'], |
| | | initVal: menu.MenuNo, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'opentype', |
| | | label: this.state.dict['header.menu.openType'], |
| | | initVal: menu.PageParam.OpenType, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'newtab', |
| | | text: this.state.dict['header.form.tab'] |
| | | }, { |
| | | MenuID: 'newpage', |
| | | text: this.state.dict['header.form.newpage'] |
| | | }, { |
| | | MenuID: 'currenttab', |
| | | text: this.state.dict['header.form.currenttab'] |
| | | }] |
| | | } |
| | | ] |
| | | originMenu: fromJS(menu).toJS(), |
| | | menuformlist: getMainMenuForm(menu, _config) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 加载完成后 |
| | | * 1、获取系统可使用表 |
| | | * 2、根据配置信息中已使用表获取相关字段信息 |
| | | * 3、获取所有标签页信息 |
| | | * @description 加载完成后, 获取所有标签页信息 |
| | | */ |
| | | componentDidMount () { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: queryTableSql, |
| | | obj_name: 'data', |
| | | arr_field: 'TbName,Remark' |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | tables: res.data |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let deffers = this.state.selectedTables.map(item => { |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => { |
| | | res.TBName = item.TbName |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(response => { |
| | | let _columns = [] |
| | | response.forEach(res => { |
| | | if (res.status) { |
| | | let tabmsg = { |
| | | tableName: res.TBName, |
| | | columns: res.FDName.map(item => { |
| | | let _type = item.FieldType.toLowerCase() |
| | | let _decimal = 0 |
| | | if (/^nvarchar/.test(_type)) { |
| | | _type = 'text' |
| | | } else if (/^int/.test(_type)) { |
| | | _type = 'number' |
| | | } else if (/^decimal/.test(_type)) { |
| | | _decimal = _type.split(',')[1] |
| | | _decimal = parseInt(_decimal) |
| | | if (_decimal > 4) { |
| | | _decimal = 4 |
| | | } |
| | | _type = 'number' |
| | | } else if (/^decimal/.test(_type)) { |
| | | _decimal = _type.split(',')[1] |
| | | _decimal = parseInt(_decimal) |
| | | if (_decimal > 4) { |
| | | _decimal = 4 |
| | | } |
| | | _type = 'number' |
| | | } else if (/^datetime/.test(_type)) { |
| | | _type = 'datetime' |
| | | } else if (/^date/.test(_type)) { |
| | | _type = 'date' |
| | | } else { |
| | | _type = 'text' |
| | | } |
| | | |
| | | return { |
| | | field: item.FieldName, |
| | | label: item.FieldDec, |
| | | type: _type, |
| | | datatype: _type, |
| | | decimal: _decimal |
| | | } |
| | | }) |
| | | } |
| | | _columns.push(tabmsg) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | tableColumns: _columns |
| | | }) |
| | | }) |
| | | |
| | | Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | tabviews: res.UserTemp.map(temp => { |
| | | return { |
| | | uuid: temp.MenuID, |
| | | value: temp.MenuID, |
| | | text: temp.MenuName, |
| | | type: temp.Template, |
| | | MenuNo: temp.MenuNo |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | this.reloadTab(false) |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * @description 加载或刷新标签信息 |
| | | */ |
| | | reloadTab = () => { |
| | | reloadTab = (type) => { |
| | | this.setState({ |
| | | loading: true, |
| | | loading: type, |
| | | tabviews: [] |
| | | }) |
| | | Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { |
| | |
| | | } |
| | | }) |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '刷新成功。', |
| | | duration: 2 |
| | | }) |
| | | |
| | | if (type) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '刷新成功。', |
| | | duration: 2 |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 元素添加或拖动时顺序变化 |
| | | */ |
| | | handleList = (type, list, card) => { |
| | | const { config } = this.state |
| | | |
| | | if (type === 'tabs') { // 标签页调整顺序或添加元素 |
| | | if (list.length > config[card.groupId].length) { |
| | | list = list.filter(item => !item.origin) |
| | | this.handleTab(card) |
| | | } |
| | | |
| | | this.setState({config: {...config, [card.groupId]: list}}) |
| | | } else { |
| | | if (list.length > config[type].length) { |
| | | list = list.filter(item => !item.origin) |
| | | if (type === 'search') { |
| | | this.handleSearch(card) |
| | | } else if (type === 'action') { |
| | | this.handleAction(card) |
| | | } else if (type === 'columns') { |
| | | this.handleColumn(card) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, [type]: list } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件编辑,获取搜索条件表单信息 |
| | | */ |
| | | handleSearch = (card) => { |
| | | this.setState({ |
| | | modaltype: 'search', |
| | | card: card, |
| | | formlist: getSearchForm(card, this.props.sysRoles) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮编辑,获取按钮表单信息 |
| | | */ |
| | | handleAction = (card, type) => { |
| | | let ableField = this.props.permFuncField.join(', ') |
| | | let functip = <div> |
| | | <p style={{marginBottom: '5px'}}>{this.state.dict['header.modal.func.innerface'].replace('@ableField', ableField)}</p> |
| | | <p>{this.state.dict['header.modal.func.outface']}</p> |
| | | </div> |
| | | |
| | | this.setState({ |
| | | modaltype: type === 'copy' ? 'actionCopy' : 'actionEdit', |
| | | card: card, |
| | | formlist: getActionForm(card, functip, this.state.config, this.props.permFuncField) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 显示列与合并列编辑,获取表单信息 |
| | | */ |
| | | handleColumn = (card) => { |
| | | const { menu } = this.props |
| | | |
| | | if (card.type !== 'colspan') { |
| | | let menulist = menu.fstMenuList.map(item => { |
| | | return { |
| | | value: item.MenuID, |
| | | label: item.text, |
| | | isLeaf: false |
| | | } |
| | | }) |
| | | |
| | | if ((card.type === 'text' || card.type === 'number') && card.linkmenu && card.linkmenu.length > 0) { |
| | | let _param = { |
| | | func: 'sPC_Get_FunMenu', |
| | | ParentID: card.linkmenu[0], |
| | | systemType: options.systemType, |
| | | debug: 'Y' |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(_param).then(result => { |
| | | if (result.status) { |
| | | menulist = menulist.map(item => { |
| | | if (item.value === card.linkmenu[0]) { |
| | | item.children = result.data.map(item => { |
| | | let submenu = { |
| | | value: item.ParentID, |
| | | label: item.MenuNameP, |
| | | children: item.FunMenu.map(cell => { |
| | | return { |
| | | value: cell.MenuID, |
| | | label: cell.MenuName, |
| | | MenuID: cell.MenuID, |
| | | MenuName: cell.MenuName, |
| | | MenuNo: cell.MenuNo, |
| | | Ot: cell.Ot, |
| | | PageParam: cell.PageParam, |
| | | LinkUrl: cell.LinkUrl, |
| | | disabled: cell.MenuID === menu.MenuID |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return submenu |
| | | }) |
| | | } |
| | | return item |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: false, |
| | | modaltype: 'columns', |
| | | card: card, |
| | | formlist: getColumnForm(card, this.props.sysRoles, menulist) |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | modaltype: 'columns', |
| | | card: card, |
| | | formlist: getColumnForm(card, this.props.sysRoles, menulist) |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | modaltype: 'colspan', |
| | | card: card |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 标签编辑,筛选可选的下级标签与已关联的下级标签 |
| | | */ |
| | | handleTab = (card) => { |
| | | const { config } = this.state |
| | | |
| | | let menus = [ |
| | | {value: '', text: '空'}, |
| | | {value: 'mainTable', text: '主表'} |
| | | ] |
| | | let equalTabs = [] |
| | | let supMenu = card.supMenu || '' |
| | | let equalTab = card.equalTab || [] |
| | | let isuptab = true |
| | | let equalTabIds = [] |
| | | |
| | | config.tabgroups.forEach((groupId, i) => { |
| | | if (groupId === card.groupId) { |
| | | isuptab = false |
| | | config[card.groupId].forEach(tab => { // 可关联的同级标签 |
| | | if (tab.uuid === card.uuid) return |
| | | |
| | | equalTabIds.push(tab.uuid) |
| | | equalTabs.push(tab) |
| | | }) |
| | | } else if (isuptab) { |
| | | config[groupId].forEach(tab => { |
| | | menus.push({ |
| | | value: tab.uuid, |
| | | text: tab.label |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { |
| | | supMenu = '' |
| | | } |
| | | |
| | | if (equalTab.length > 0) { |
| | | equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) |
| | | } |
| | | |
| | | |
| | | this.setState({ |
| | | modaltype: 'tabs', |
| | | card: card, |
| | | formlist: [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: this.state.dict['header.menu.tabName'], |
| | | initVal: card.label || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: this.state.dict['header.form.tabType'], |
| | | initVal: card.type || 'SubTable', |
| | | required: true, |
| | | options: [{ |
| | | value: 'SubTable', |
| | | text: this.state.dict['header.menu.tab.subtable'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: this.state.dict['header.form.linkTab'], |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: this.state.dict['header.menu.icon'], |
| | | initVal: card.icon || '', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | value: 'table', |
| | | text: 'table' |
| | | }, { |
| | | value: 'bar-chart', |
| | | text: 'bar-chart' |
| | | }, { |
| | | value: 'pie-chart', |
| | | text: 'pie-chart' |
| | | }, { |
| | | value: 'line-chart', |
| | | text: 'line-chart' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: this.state.dict['header.form.supTab'], |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: this.state.dict['header.form.equalTab'], |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | } |
| | | ] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 操作列编辑 |
| | | */ |
| | | handleGridBtn = () => { |
| | | this.setState({ |
| | | modaltype: 'gridbtn' |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索、按钮、显示列修改后提交保存 |
| | | * 1、搜索条件保存 |
| | | * 2、按钮包括正常编辑和复制,复制时,末尾添加,如按钮为表单(保存至数据库),复制按钮id存于复制列表(点击不保存时删除) |
| | | * 3、如按钮位置设置为表格,则修改操作列显示状态 |
| | | */ |
| | | handleSubmit = () => { |
| | | const { menu } = this.props |
| | | 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(menu.MenuID + res.uuid, { |
| | | uuid: menu.MenuID + res.uuid, |
| | | label: res.label, |
| | | parname: menu.MenuName, |
| | | type: 'search', |
| | | options: res.options |
| | | }) |
| | | } |
| | | |
| | | let fieldrepet = false // 字段重复 |
| | | let labelrepet = false // 提示文字重复 |
| | | |
| | | let _search = config.search.map(item => { |
| | | if (item.uuid !== res.uuid && res.field && item.field) { |
| | | if (item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | } |
| | | |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (fieldrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (labelrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '名称已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _search = _search.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | | let _action = config.action.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | _action = _action.filter(item => !item.origin) |
| | | |
| | | if (modaltype === 'actionCopy') { |
| | | _action.push(res) |
| | | } |
| | | |
| | | // 复制按钮前后皆为表单时,复制表单配置信息,id存于复制列表 |
| | | if (res.OpenType === 'pop' && card.originCard && card.originCard.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: card.originCard.uuid |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | // 解析配置,修改模态框标题名称 |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | if (_LongParam && _LongParam.type === 'Modal') { |
| | | try { |
| | | _LongParam.setting.title = res.label |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) |
| | | } catch { |
| | | console.warn('Stringify Failure') |
| | | _LongParam = '' |
| | | } |
| | | } else { |
| | | _LongParam = '' |
| | | } |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: res.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: 'Modal', |
| | | MenuName: res.label, |
| | | PageParam: JSON.stringify({Template: 'Modal'}), |
| | | LongParam: _LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | copyActions: [...this.state.copyActions, res.uuid] |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } else if ( |
| | | (res.OpenType === 'tab' || res.OpenType === 'blank') && |
| | | card.originCard && |
| | | (card.originCard.OpenType === 'tab' || card.originCard.OpenType === 'blank') |
| | | ) { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: card.originCard.uuid |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | // 解析配置,修改模态框标题名称 |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | let _temp = '' |
| | | if (_LongParam && _LongParam.type === 'FormTab') { |
| | | try { |
| | | _LongParam.action = _LongParam.action.map(_btn => { |
| | | _btn.uuid = Utils.getuuid() |
| | | |
| | | return _btn |
| | | }) |
| | | _LongParam.tabgroups.forEach(_groupId => { |
| | | _LongParam[_groupId] = _LongParam[_groupId].map(_tab => { |
| | | _tab.uuid = Utils.getuuid() |
| | | |
| | | return _tab |
| | | }) |
| | | }) |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) |
| | | _temp = 'FormTab' |
| | | } catch { |
| | | console.warn('Stringify Failure') |
| | | _LongParam = '' |
| | | } |
| | | } else { |
| | | _LongParam = '' |
| | | } |
| | | |
| | | if (!_temp) return |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: res.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: _temp, |
| | | MenuName: res.label, |
| | | PageParam: JSON.stringify({Template: _temp}), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (!response.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | copyActions: [...this.state.copyActions, res.uuid] |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 判断是否存在操作列 |
| | | let _hasGridbtn = _action.filter(act => act.position === 'grid').length > 0 |
| | | let _gridBtn = config.gridBtn |
| | | |
| | | if (_gridBtn) { |
| | | _gridBtn.display = _hasGridbtn |
| | | } else { |
| | | _gridBtn = { |
| | | display: _hasGridbtn, |
| | | Align: 'center', |
| | | IsSort: 'false', |
| | | uuid: Utils.getuuid(), |
| | | label: this.state.dict['header.form.column.action'], |
| | | type: 'action', |
| | | style: 'button', |
| | | show: 'horizontal', |
| | | Width: 120 |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, action: _action, gridBtn: _gridBtn}, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } else if (modaltype === 'columns' || modaltype === 'colspan') { |
| | | this.columnFormRef.handleConfirm().then(res => { |
| | | let fieldrepet = false // 字段重复 |
| | | let labelrepet = false // 提示文字重复 |
| | | |
| | | let _columns = config.columns.map(item => { |
| | | if (item.uuid !== res.uuid && res.field && item.field) { |
| | | if (item.field === res.field) { |
| | | fieldrepet = true |
| | | } else if (item.label === res.label) { |
| | | labelrepet = true |
| | | } |
| | | } |
| | | |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (fieldrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '字段已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (labelrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '名称已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _columns = _columns.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: {...config, columns: _columns}, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } else if (modaltype === 'gridbtn') { |
| | | this.gridBtnFormRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | | config: {...config, gridBtn: res}, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } else if (modaltype === 'tabs') { |
| | | this.tabsFormRef.handleConfirm().then(res => { |
| | | let _tabgroup = config[res.groupId].map(item => { |
| | | if (item.uuid === res.uuid) { |
| | | return res |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | _tabgroup = _tabgroup.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: {...config, [res.groupId]: _tabgroup}, |
| | | modaltype: '' |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 取消保存,如果元素为新添元素,则从序列中删除 |
| | | */ |
| | | editModalCancel = () => { |
| | | const { config, card, modaltype } = this.state |
| | | |
| | | if (card && card.focus) { |
| | | let _config = null |
| | | if (modaltype === 'search') { |
| | | let _search = config.search.filter(item => item.uuid !== card.uuid) |
| | | _config = {...config, search: _search} |
| | | } else if (modaltype === 'actionEdit') { |
| | | let _action = config.action.filter(item => item.uuid !== card.uuid) |
| | | _config = {...config, action: _action} |
| | | } else if (modaltype === 'columns' || modaltype === 'colspan') { |
| | | let _columns = config.columns.filter(item => item.uuid !== card.uuid) |
| | | _config = {...config, columns: _columns} |
| | | } else if (modaltype === 'tabs') { |
| | | let _tabgroup = config[card.groupId].filter(item => item.uuid !== card.uuid) |
| | | _config = {...config, [card.groupId]: _tabgroup} |
| | | } else { |
| | | _config = config |
| | | } |
| | | |
| | | this.setState({ |
| | | card: null, |
| | | config: _config, |
| | | modaltype: '' |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | card: null, |
| | | modaltype: '' |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮-创建存储过程 |
| | | */ |
| | | creatFunc = () => { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | | let btn = res // 按钮信息 |
| | | let newLText = '' // 创建存储过程sql |
| | | let DelText = '' // 删除存储过程sql |
| | | |
| | | // 创建存储过程,必须填写内部函数名 |
| | | if (!btn.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请填写内部函数!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | // 弹窗(表单)类按钮,先获取按钮配置信息,如果尚未配置按钮则会报错并终止。 |
| | | // 获取信息后生成删除和创建存储过程的语句 |
| | | if (btn.OpenType === 'pop') { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: btn.uuid |
| | | }).then(res => { |
| | | let _LongParam = '' |
| | | if (res.status && res.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | let fields = [] |
| | | if (_LongParam.groups.length > 0) { |
| | | _LongParam.groups.forEach(group => { |
| | | fields = [...fields, ...group.sublist] |
| | | }) |
| | | } else { |
| | | fields = _LongParam.fields |
| | | } |
| | | |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | | name: config.setting.tableName || '', |
| | | fields: fields, |
| | | menuNo: menu.MenuNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '弹窗(表单)按钮,请先配置表单信息!', |
| | | duration: 10 |
| | | }) |
| | | resolve(false) |
| | | } |
| | | }) |
| | | } else if (btn.OpenType === 'excelIn') { |
| | | if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | | menuNo: menu.MenuNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getexcelInfunc(_param, btn, menu)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善导入Excel验证信息!', |
| | | duration: 10 |
| | | }) |
| | | resolve(false) |
| | | } |
| | | } else if (btn.OpenType === 'excelOut') { |
| | | let _param = { |
| | | innerFunc: btn.innerFunc |
| | | } |
| | | |
| | | newLText = Utils.formatOptions(Utils.getTableFunc(_param, menu, config )) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) |
| | | resolve(true) |
| | | } else { |
| | | let _param = { |
| | | funcName: btn.innerFunc, |
| | | name: config.setting.tableName || '', |
| | | fields: '', |
| | | menuNo: menu.MenuNo |
| | | } |
| | | newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, config)) |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } |
| | | }).then(res => { |
| | | if (!res) return |
| | | |
| | | this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { |
| | | if (result !== 'success') return |
| | | |
| | | let _action = config.action.map(item => { |
| | | if (item.uuid === btn.uuid) { |
| | | return btn |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | _action = _action.filter(item => !item.origin) |
| | | |
| | | // 判断是否存在操作列 |
| | | let _hasGridbtn = _action.filter(act => act.position === 'grid').length > 0 |
| | | let _gridBtn = config.gridBtn |
| | | |
| | | if (_gridBtn) { |
| | | _gridBtn.display = _hasGridbtn |
| | | } else { |
| | | _gridBtn = { |
| | | display: _hasGridbtn, |
| | | Align: 'center', |
| | | IsSort: 'false', |
| | | uuid: Utils.getuuid(), |
| | | label: this.state.dict['header.form.column.action'], |
| | | type: 'action', |
| | | style: 'button', |
| | | show: 'horizontal', |
| | | Width: 120 |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, action: _action, gridBtn: _gridBtn} |
| | | }) |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 创建表格存储过程 |
| | | */ |
| | | tableCreatFunc = () => { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | |
| | | this.settingRef.handleConfirm().then(setting => { |
| | | |
| | | if (!(setting.interType === 'inner') || !setting.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '接口类型为-内部,且存在内部函数时,才可以创建存储过程!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _config = {...config, setting: setting} |
| | | let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, _config)) // 创建存储过程sql |
| | | let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 删除存储过程sql |
| | | |
| | | this.refs.tableCreatFunc.exec(setting.innerFunc, newLText, DelText).then(result => { |
| | | if (result === 'success') { |
| | | this.setState({ |
| | | config: _config |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 创建按钮接口(写入) |
| | | */ |
| | | btnCreatInterface = () => { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | this.actionFormRef.handleConfirm().then(result => { |
| | | if (!['pop', 'exec', 'prompt'].includes(result.OpenType) || result.funcType || result.intertype !== 'inner' || result.innerFunc ) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '打开方式为 弹窗(表单)、提示框或直接执行,且使用系统函数时,才可以创建接口!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _menu = { |
| | | type: 'main', |
| | | MenuID: menu.MenuID, |
| | | menuName: res.menuName, |
| | | menuNo: res.menuNo |
| | | } |
| | | |
| | | this.refs.btnCreatInterface.triggerInInterface(result, config, _menu) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 创建表格接口(读出) |
| | | */ |
| | | tableCreatInterface = () => { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | this.settingRef.handleConfirm().then(setting => { |
| | | if (setting.interType !== 'inner' || setting.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '接口类型为-内部,且不存在内部函数时,才可以创建接口!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _config = {...config, setting: setting} |
| | | let _menu = { |
| | | type: 'main', |
| | | MenuID: menu.MenuID, |
| | | menuName: res.menuName, |
| | | menuNo: res.menuNo |
| | | } |
| | | |
| | | this.refs.tableCreatInterface.triggerOutInterface(_menu, _config) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | deleteElement = (element) => { |
| | | const { config, thawButtons } = this.state |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: `确定删除<<${element.card.label}>>吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let _config = null |
| | | |
| | | if (element.type === 'tabs') { |
| | | let _tabgroup = config[element.card.groupId].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | _config = {...config, [element.card.groupId]: _tabgroup} |
| | | } else { |
| | | let list = config[element.type].filter(item => { |
| | | if (item.uuid === element.card.uuid) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | }) |
| | | |
| | | _config = {...config, [element.type]: list} |
| | | |
| | | // 删除按钮时判断是否存在操作列 |
| | | if (element.type === 'action' && _config.gridBtn) { |
| | | _config.gridBtn.display = _config.action.filter(act => act.position === 'grid').length > 0 |
| | | } |
| | | } |
| | | |
| | | // 删除按钮元素 |
| | | let _delActions = _this.state.delActions |
| | | if (element.type === 'action' || element.type === 'tabs') { |
| | | _delActions.push(element) |
| | | } |
| | | |
| | | _this.setState({ |
| | | config: _config, |
| | | delActions: _delActions, |
| | | thawButtons: thawButtons.filter(key => key !== element.card.uuid) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 验证信息配置 |
| | | */ |
| | | profileAction = (element) => { |
| | | this.setState({ |
| | | profileVisible: true, |
| | | card: element |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮双击触发子配置 |
| | | */ |
| | | btnDoubleClick = (element) => { |
| | | if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) { |
| | | this.setSubConfig(element, 'button') |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '此按钮无子配置项!', |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 验证信息保存 |
| | | */ |
| | | verifySubmit = () => { |
| | | const { card } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (card.OpenType === 'excelIn') { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else if (card.execMode) { |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }) |
| | | } else { |
| | | let _verify = this.verifyRef.state.verify |
| | | let _loading = this.verifyRef.state.updateloading |
| | | |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (card.OpenType === 'excelOut') { |
| | | let _cols = _verify.columns.map(col => col.Column) |
| | | let _vcols = Array.from(new Set(_cols)) |
| | | if (_cols.length > _vcols.length) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: 'Excel列字段名,不可重复!', |
| | | duration: 10 |
| | | }) |
| | | |
| | | return |
| | | } |
| | | } |
| | | |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = _verify |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (_loading) { |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单切换模板 |
| | | */ |
| | | changeTemplate = () => { |
| | | this.props.handleView({tabview: 'template'}) |
| | | } |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { originMenu, delActions, thawButtons } = this.state |
| | | const { originMenu, delActions, thawButtons, openEdition } = this.state |
| | | |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | let config = fromJS(this.state.config).toJS() |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | if (config.isAdd) { |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | | config.search = config.search.filter(item => !item.origin) |
| | | config.action = config.action.filter(item => !item.origin) |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | config.tabgroups[0].sublist = config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | |
| | | if (config.type === 'user') { // 使用已有菜单时,默认添加关联标签id |
| | |
| | | }) |
| | | |
| | | config.tabgroups.forEach(group => { |
| | | config[group] = config[group].map(tab => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | if (!tab.linkTab) { |
| | | tab.linkTab = Utils.getuuid() |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | | if (_config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { |
| | | let vresult = this.verifyconfig(_config) |
| | | if (vresult !== true) { |
| | | _config.enabled = false |
| | | } else if (!_config.setting.primaryKey) { |
| | | _config.enabled = false |
| | | } else if (_config.tabgroups.length > 1) { |
| | | _config.tabgroups.forEach(group => { |
| | | if (_config[group].length === 0) { |
| | | _config.enabled = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | _config.funcs = [] // 页面及子页面存储过程集 |
| | |
| | | } |
| | | }) |
| | | |
| | | _config.tabgroups.forEach(groupId => { |
| | | if (_config[groupId].length === 0) return |
| | | |
| | | _config[groupId].forEach(tab => { |
| | | _config.tabgroups.forEach(group => { |
| | | group.sublist.forEach(tab => { |
| | | _config.funcs.push({ |
| | | type: 'tab', |
| | | subtype: 'tab', |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | menucloseloading: false, |
| | |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | | ParentID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | MenuNo: res.MenuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | |
| | | btntabs.forEach(item => { |
| | | _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) |
| | | }) |
| | | _config.tabgroups.forEach(groupId => { |
| | | _config[groupId].forEach(item => { |
| | | _config.tabgroups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | _sort++ |
| | | _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | }) |
| | |
| | | SndID: res.parentId, |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | MenuNo: res.MenuNo, |
| | | EasyCode: res.easyCode, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | MenuName: res.MenuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam, |
| | | LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (openEdition) { // 版本管理 |
| | | param.open_edition = openEdition |
| | | } |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.card.uuid |
| | | MenuID: item.card ? item.card.uuid : item.uuid |
| | | } |
| | | |
| | | if (item.type === 'action') { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else { |
| | |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | let localParam = JSON.parse(JSON.stringify(param)) |
| | | let localParam = fromJS(param).toJS() |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | openEdition: response.open_edition || '', |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | MenuName: res.MenuName, |
| | | MenuNo: res.MenuNo, |
| | | ParentID: res.parentId, |
| | | fstMenuId: res.fstMenuId, |
| | | supMenuList: _supMenuList |
| | | } |
| | | }) |
| | | |
| | | |
| | | this.props.reloadmenu() |
| | | |
| | | this.submitAction(btnParam, tabParam) |
| | |
| | | delete localParam.PageParam |
| | | delete localParam.Template |
| | | delete localParam.Sort |
| | | delete localParam.EasyCode |
| | | delete localParam.open_edition |
| | | |
| | | Api.getLocalConfig(localParam) |
| | | } else { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.basemsg'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | }) |
| | | } |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | |
| | | |
| | | return _btn |
| | | }) |
| | | _subconfig.tabgroups.forEach(_groupId => { |
| | | _subconfig[_groupId] = _subconfig[_groupId].map(_tab => { |
| | | _tab.uuid = Utils.getuuid() |
| | | |
| | | if (_tab.linkTab) { |
| | | _tab.linkTab = '' |
| | | |
| | | // 兼容已有结构 |
| | | if (!_subconfig.tabgroups) { |
| | | _subconfig.tabgroups = [{ uuid: 'tabs', sublist: [] }] |
| | | } else if (typeof(_subconfig.tabgroups[0]) === 'string') { |
| | | let _tabgroups = [] |
| | | _subconfig.tabgroups.forEach(groupId => { |
| | | let _group = { |
| | | uuid: groupId, |
| | | sublist: fromJS(_subconfig[groupId]).toJS() |
| | | } |
| | | delete _subconfig[groupId] |
| | | _tabgroups.push(_group) |
| | | }) |
| | | _subconfig.tabgroups = _tabgroups |
| | | } |
| | | |
| | | _subconfig.tabgroups.forEach(group => { |
| | | group.sublist = group.sublist.map(_tab => { |
| | | _tab.uuid = Utils.getuuid() |
| | | _tab.linkTab = Utils.getuuid() |
| | | |
| | | return _tab |
| | | }) |
| | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleView() |
| | |
| | | }) |
| | | } else { |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | MenuName: res.MenuName, |
| | | MenuNo: res.MenuNo, |
| | | ParentID: res.parentId, |
| | | fstMenuId: res.fstMenuId |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 筛选可用字段集 |
| | | */ |
| | | queryField = (type) => { |
| | | const {selectedTables, tableColumns, config} = this.state |
| | | // 判断是否已选择表名 |
| | | if (selectedTables.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择表名!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 表字段集转为map数据 |
| | | let columns = new Map() |
| | | tableColumns.forEach(table => { |
| | | table.columns.forEach(column => { |
| | | columns.set(column.field, column) |
| | | }) |
| | | }) |
| | | |
| | | if (type === 'search') { |
| | | // 添加搜索条件,字段集中存在搜索条件字段,使用搜索条件对象替换字段集,设置数据类型 |
| | | config.search.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } else if (type === 'columns') { |
| | | // 添加显示列,字段集中存在显示列字段,使用显示列对象替换字段集,设置数据类型 |
| | | config.columns.forEach(item => { |
| | | if (columns.has(item.field)) { |
| | | let _datatype = columns.get(item.field).datatype |
| | | columns.set(item.field, {...item, selected: true, datatype: _datatype}) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 显示字段集弹窗 |
| | | this.setState({ |
| | | addType: type, |
| | | tableVisible: true, |
| | | fields: [...columns.values()] |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 添加字段集 |
| | | */ |
| | | addFieldSubmit = () => { |
| | | const {addType, config} = this.state |
| | | |
| | | // 字段集为空,关闭弹窗 |
| | | if (!this.state.fields || this.state.fields.length === 0) { |
| | | this.setState({ |
| | | tableVisible: false, |
| | | addType: '' |
| | | }) |
| | | } |
| | | |
| | | const textmatch = { // 选择text时匹配规则 |
| | | text: 'like', |
| | | number: 'like', |
| | | datetime: 'like', |
| | | date: 'like' |
| | | } |
| | | const selectmatch = { // 选择select时匹配规则 |
| | | text: '=', |
| | | number: '=', |
| | | datetime: '=', |
| | | date: '=' |
| | | } |
| | | const datematch = { // 选择dateRange时匹配规则 |
| | | text: 'between', |
| | | number: 'between', |
| | | datetime: 'between', |
| | | date: 'between' |
| | | } |
| | | |
| | | // 获取已选字段集合 |
| | | let cards = this.refs.searchcard.state.selectCards |
| | | |
| | | if (cards.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择添加字段', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let columnsMap = new Map() |
| | | cards.forEach(card => { |
| | | columnsMap.set(card.field, card) |
| | | }) |
| | | |
| | | if (addType === 'search') { |
| | | let _search = config.search.filter(item => !item.origin) |
| | | |
| | | // 重置原有搜素条件 |
| | | _search = _search.map(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | |
| | | if (cell.type !== item.type) { // 数据类型修改 |
| | | if (cell.type === 'select') { |
| | | item.match = selectmatch[cell.datatype] |
| | | } else if (cell.type === 'daterange') { |
| | | item.match = datematch[cell.datatype] |
| | | } else { |
| | | cell.type = 'text' |
| | | item.match = textmatch[cell.datatype] |
| | | } |
| | | |
| | | item.type = cell.type |
| | | item.initval = '' |
| | | } |
| | | columnsMap.delete(item.field) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | let _columns = [...columnsMap.values()] |
| | | |
| | | // 顺序添加新增搜索 |
| | | _columns.forEach(item => { |
| | | let _match = '' |
| | | if (item.type === 'select') { |
| | | _match = selectmatch[item.datatype] |
| | | } else if (item.type === 'daterange') { |
| | | _match = datematch[item.datatype] |
| | | } else { |
| | | _match = textmatch[item.datatype] |
| | | } |
| | | |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | label: item.label, |
| | | field: item.field, |
| | | initval: '', |
| | | type: item.type || 'text', |
| | | resourceType: '0', |
| | | setAll: 'false', |
| | | options: [], |
| | | orderType: 'asc', |
| | | match: _match, |
| | | display: 'dropdown' |
| | | } |
| | | |
| | | _search.push(newcard) |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search} |
| | | }) |
| | | } else { |
| | | let _columns = config.columns.filter(item => !item.origin) |
| | | |
| | | // 重置原有显示列类型 |
| | | _columns = _columns.map(item => { |
| | | if (columnsMap.has(item.field)) { |
| | | let cell = columnsMap.get(item.field) |
| | | |
| | | if (cell.type) { |
| | | item.type = cell.type |
| | | } |
| | | |
| | | columnsMap.delete(item.field) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | let _cols = [...columnsMap.values()] |
| | | |
| | | // 添加显示列 |
| | | _cols.forEach(item => { |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | Align: 'left', |
| | | label: item.label, |
| | | field: item.field, |
| | | Hide: 'false', |
| | | IsSort: item.type === 'picture' ? 'false' : 'true', |
| | | type: item.type, |
| | | Width: 120 |
| | | } |
| | | |
| | | _columns.push(newcard) |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: {...config, columns: _columns} |
| | | }) |
| | | } |
| | | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '操作成功', |
| | | duration: 2 |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表名切换时,添加表名,新增时查询表相关字段 |
| | | */ |
| | | onTableChange = (value) => { |
| | | const {tables, selectedTables, tableColumns} = this.state |
| | | |
| | | let _table = tables.filter(item => item.TbName === value)[0] |
| | | let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] |
| | | if (!isSelected) { |
| | | this.setState({ |
| | | selectedTables: [...selectedTables, _table] |
| | | }) |
| | | Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { |
| | | if (res.status) { |
| | | let tabmsg = { |
| | | tableName: _table.name, |
| | | columns: res.FDName.map(item => { |
| | | let _type = item.FieldType.toLowerCase() |
| | | let _decimal = 0 |
| | | if (/^nvarchar/.test(_type)) { |
| | | _type = 'text' |
| | | } else if (/^int/.test(_type)) { |
| | | _type = 'number' |
| | | } else if (/^decimal/.test(_type)) { |
| | | _decimal = _type.split(',')[1] |
| | | _decimal = parseInt(_decimal) |
| | | _type = 'number' |
| | | } else if (/^datetime/.test(_type)) { |
| | | _type = 'datetime' |
| | | } else if (/^date/.test(_type)) { |
| | | _type = 'date' |
| | | } else { |
| | | _type = 'text' |
| | | } |
| | | |
| | | return { |
| | | field: item.FieldName, |
| | | label: item.FieldDec, |
| | | type: _type, |
| | | datatype: _type, |
| | | decimal: _decimal |
| | | } |
| | | }) |
| | | } |
| | | this.setState({ |
| | | tableColumns: [...tableColumns, tabmsg] |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 删除表名以及表相关字段 |
| | | */ |
| | | deleteTable = (table) => { |
| | | const {selectedTables, tableColumns} = this.state |
| | | |
| | | this.setState({ |
| | | selectedTables: selectedTables.filter(item => item.TbName !== table.TbName), |
| | | tableColumns: tableColumns.filter(item => item.tableName !== table.TbName) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 页面配置信息模态框显示 |
| | | */ |
| | | changeSetting = () => { |
| | | this.setState({ |
| | | settingVisible: true |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 保存页面配置信息 |
| | | */ |
| | | settingSave = () => { |
| | | const { menu } = this.props |
| | | const {config} = this.state |
| | | |
| | | this.settingRef.handleConfirm().then(res => { |
| | | if ( |
| | | res.interType === 'inner' && |
| | | !res.innerFunc && |
| | | /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && |
| | | config.setting.dataresource !== res.dataresource |
| | | ) { |
| | | let param = { |
| | | func: 's_DataSrc_Save', |
| | | LText: res.dataresource, |
| | | MenuID: menu.MenuID |
| | | } |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getLocalConfig(param) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false, |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (item, type) => { |
| | | const { menu } = this.props |
| | | const { config, originMenu, optionLibs, activeKey } = this.state |
| | | const { config, originMenu, optionLibs, activeKey, openEdition } = this.state |
| | | |
| | | if (!originMenu.MenuID) { // menuID不存在时,为新建菜单,提示菜单尚未保存 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.config.notsave'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | MenuName: res.MenuName, |
| | | MenuNo: res.MenuNo, |
| | | ParentID: res.parentId, |
| | | fstMenuId: res.fstMenuId |
| | | } |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.config.update'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | |
| | | isbutton = false |
| | | } |
| | | |
| | | // 保存当前打开页签 |
| | | _originMenu.activeKey = activeKey |
| | | _originMenu.activeKey = activeKey // 保存当前打开页签 |
| | | _originMenu.open_edition = openEdition // 更新版本号 |
| | | |
| | | let param = { |
| | | optionLibs: optionLibs, |
| | |
| | | editAction: isbutton ? item : '', |
| | | subConfig: '', |
| | | tabview: _view |
| | | } |
| | | |
| | | // 当子表使用主页搜索条件时,将主页搜索向下传递 |
| | | if (param.editTab && param.editTab.searchPass === 'true') { |
| | | param.editTab.mainsearch = fromJS(_config.search).toJS() |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | param.subConfig = _LongParam |
| | | } |
| | | |
| | | if (param.editTab) { |
| | | param.editTab.open_edition = res.open_edition || '' |
| | | } else if (param.editAction) { |
| | | param.editAction.open_edition = res.open_edition || '' |
| | | } else if (param.btnTab) { |
| | | param.btnTab.open_edition = res.open_edition || '' |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } else { |
| | | this.setState({ |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.config.update'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | }) |
| | | } |
| | |
| | | onEnabledChange = () => { |
| | | const { config } = this.state |
| | | |
| | | let _enabled = !config.enabled |
| | | let result = this.verifyconfig(config) |
| | | if (_enabled && result !== true) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, enabled: _enabled} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 校验配置信息的合法性 |
| | | */ |
| | | verifyconfig = (config) => { |
| | | let tabinvalid = true |
| | | if (config.tabgroups.length > 1) { |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group].length === 0) { |
| | | if (group.sublist.length === 0) { |
| | | tabinvalid = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置数据源,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | let charterr = '' |
| | | config.charts.forEach(chart => { |
| | | if (!charterr && ['line', 'bar', 'pie'].includes(chart.chartType) && !chart.Xaxis) { |
| | | charterr = '图表' + (chart.title ? '《' + chart.title + '》' : '') + '坐标轴未设置,不可启用!' |
| | | } |
| | | }) |
| | | |
| | | let hasKey = false |
| | | config.columns.forEach(col => { |
| | | if (config.setting.primaryKey === col.field) { |
| | | hasKey = true |
| | | } |
| | | }) |
| | | |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.default !== 'false' && !config.setting.dataresource) { |
| | | return '菜单尚未设置数据源,不可启用!' |
| | | } else if (!config.setting.primaryKey) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置主键,不可启用!', |
| | | duration: 10 |
| | | }) |
| | | return '菜单尚未设置主键,不可启用!' |
| | | } else if (!hasKey) { |
| | | return '显示列中不存在主键字段,不可启用!' |
| | | } else if (!tabinvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单标签页设置错误(多行标签内,行标签不可为空),不可启用!', |
| | | duration: 10 |
| | | }) |
| | | return '菜单标签页设置错误(存在多行标签时,行标签不可为空)!' |
| | | } else if (charterr) { |
| | | return charterr |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | return true |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 显示隐藏显示列字段名 |
| | | */ |
| | | onColumnNameChange = () => { |
| | | const { showColumnName, config } = this.state |
| | | |
| | | if (!showColumnName) { |
| | | let fields = [] |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | fields.push(col.field) |
| | | } |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let textArea = document.createElement('textarea') |
| | | textArea.value = fields |
| | | document.body.appendChild(textArea) |
| | | textArea.select() |
| | | |
| | | try { |
| | | document.execCommand('copy') |
| | | document.body.removeChild(textArea) |
| | | } catch (err) { |
| | | document.body.removeChild(textArea) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 增加标签页分组 |
| | | */ |
| | | addTabGroup = () => { |
| | | let _this = this |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | confirm({ |
| | | content: `确定新建标签组吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let newgroup = 'tabs' + Utils.getuuid() |
| | | |
| | | _config.tabgroups.push(newgroup) |
| | | _config[newgroup] = [] |
| | | |
| | | _this.setState({ |
| | | config: _config |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 删除标签页分组 |
| | | */ |
| | | delTabGroup = (groupId) => { |
| | | let _this = this |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | confirm({ |
| | | content: `确定删除标签组吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | |
| | | _config.tabgroups = _config.tabgroups.filter(group => group !== groupId) |
| | | delete _config[groupId] |
| | | |
| | | _this.setState({ |
| | | config: _config |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 解冻按钮 |
| | | */ |
| | | handleThaw = () => { |
| | | const { menu } = this.props |
| | | |
| | | this.setState({ |
| | | thawBtnVisible: true |
| | | }) |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_FrozenMenu', |
| | | ParentID: menu.MenuID, |
| | | TYPE: 40 |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let _list = [] |
| | | |
| | | res.data.forEach(menu => { |
| | | let _conf = '' |
| | | |
| | | if (menu.ParentParam) { |
| | | try { |
| | | _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _conf = '' |
| | | } |
| | | } |
| | | |
| | | if (_conf) { |
| | | _list.push({ |
| | | key: menu.MenuID, |
| | | title: menu.MenuName, |
| | | btnParam: _conf |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | thawbtnlist: _list |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 解冻按钮提交 |
| | | */ |
| | | thawBtnSubmit = () => { |
| | | const { thawButtons, config, thawbtnlist } = this.state |
| | | // 三级菜单解除冻结 |
| | | if (this.refs.trawmenu.state.targetKeys.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['form.required.select'] + this.state.dict['header.form.thawbutton'], |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | |
| | | thawbtnlist.forEach(item => { |
| | | if (this.refs.trawmenu.state.targetKeys.includes(item.key)) { |
| | | config.action.push(item.btnParam) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys], |
| | | config: config, |
| | | thawBtnVisible: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleGroup = (index, type) => { |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (type === 'up') { |
| | | config.tabgroups.splice(index, 0, config.tabgroups.splice(index - 1, 1)[0]) |
| | | } else { |
| | | config.tabgroups.splice(index, 0, config.tabgroups.splice(index + 1, 1)[0]) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: config |
| | | }) |
| | | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '调整成功', |
| | | duration: 2 |
| | | }) |
| | | } |
| | | |
| | | copycolumn = () => { |
| | | const { config } = this.state |
| | | |
| | | let oInput = document.createElement('input') |
| | | let val = { |
| | | copyType: 'columns', |
| | | columns: config.columns |
| | | } |
| | | |
| | | oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val))) |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | oInput.className = 'oInput' |
| | | oInput.style.display = 'none' |
| | | |
| | | message.success('复制成功。') |
| | | |
| | | document.body.removeChild(oInput) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.props.handleView() |
| | | } |
| | | |
| | | pasteSubmit = () => { |
| | | const { config } = this.state |
| | | /** |
| | | * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等 |
| | | */ |
| | | editConfig = (res) => { |
| | | if (res.type === 'thaw') { |
| | | this.setState({ |
| | | thawButtons: res.thawButtons, |
| | | config: res.config |
| | | }) |
| | | } else if (res.type === 'paste') { |
| | | this.setState({ |
| | | pasteContent: res.content |
| | | }, () => { |
| | | this.setState({ |
| | | pasteContent: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | this.pasteFormRef.handleConfirm().then(res => { |
| | | if (res.copyType === 'action') { |
| | | this.setState({ |
| | | modaltype: '' |
| | | }, () => { |
| | | this.handleAction(res, 'copy') |
| | | }) |
| | | } else if (res.copyType === 'columns') { |
| | | if (config.columns && config.columns.length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '显示列已存在!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | modaltype: '', |
| | | config: {...config, columns: res.columns} |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '配置信息格式错误!', |
| | | duration: 10 |
| | | }) |
| | | } |
| | | /** |
| | | * @description 更新搜索条件配置信息 |
| | | */ |
| | | updatesearch = (config, options) => { |
| | | const { optionLibs } = this.state |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | optionLibs: options || optionLibs |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新按钮配置信息 |
| | | */ |
| | | updateaction = (config, copyId, delcard) => { |
| | | const { copyActions, delActions } = this.state |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | copyActions: copyId ? [...copyActions, copyId] : copyActions, |
| | | delActions: delcard ? [...delActions, delcard] : delActions |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新图表组配置信息 |
| | | */ |
| | | updatechartgroup = (config, _chartview) => { |
| | | this.setState({ |
| | | config: config, |
| | | chartview: _chartview |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新常用表信息,快捷添加后更新配置信息 |
| | | */ |
| | | updatetable = (config, fields) => { |
| | | const { tableFields } = this.state |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | tableFields: fields ? fields : tableFields |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新标签配置信息 |
| | | */ |
| | | updatetabs = (config, delcards) => { |
| | | const { delActions } = this.state |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | delActions: delcards ? [...delActions, ...delcards] : delActions |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 更新配置信息 |
| | | */ |
| | | updateconfig = (config) => { |
| | | this.setState({ |
| | | config: config |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const { modaltype, activeKey, config } = this.state |
| | | const { activeKey, config, chartview } = this.state |
| | | |
| | | const configAction = config.action.filter(_action => |
| | | !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') |
| | | ) |
| | | const confActions = config.action.filter(_action => !_action.origin && ['pop', 'popview', 'blank', 'tab'].includes(_action.OpenType)) |
| | | |
| | | let configTabs = [] |
| | | config.tabgroups.forEach(group => { |
| | | configTabs.push(...config[group]) |
| | | configTabs.push(...group.sublist) |
| | | }) |
| | | |
| | | let hasbtncrtinter = false |
| | | if (modaltype === 'actionEdit' && config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.dataresource) { |
| | | hasbtncrtinter = true |
| | | } |
| | | |
| | | return ( |
| | | <div className="common-table-board"> |
| | | {/* <div className="ant-modal-mask"></div> */} |
| | | <DndProvider backend={HTML5Backend}> |
| | | {/* 工具栏 */} |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="common-basedata"> |
| | | <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="main-basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | |
| | | wrappedComponentRef={(inst) => this.menuformRef = inst} |
| | | /> |
| | | {/* 表名添加 */} |
| | | <div className="ant-col ant-form-item-label"> |
| | | <label> |
| | | <Tooltip placement="topLeft" title="此处可以添加配置相关的常用表,在添加搜索条件和显示列时,可通过工具栏中的添加按钮,批量添加表格相关字段。"> |
| | | <Icon type="question-circle" /> |
| | | {this.state.dict['header.menu.table.add']} |
| | | </Tooltip> |
| | | </label> |
| | | </div> |
| | | <Select |
| | | showSearch |
| | | className="tables" |
| | | style={{ width: '100%' }} |
| | | optionFilterProp="children" |
| | | value={this.state.dict['header.menu.table.placeholder']} |
| | | onChange={this.onTableChange} |
| | | showArrow={false} |
| | | getPopupContainer={() => document.getElementById('common-basedata')} |
| | | filterOption={(input, option) => { |
| | | return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 || |
| | | option.props.value.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| | | }} |
| | | > |
| | | {this.state.tables.map((table, index) => ( |
| | | <Option key={index} title={table.TbName} value={table.TbName}>{table.Remark}</Option> |
| | | ))} |
| | | </Select> |
| | | {this.state.selectedTables.length > 0 && <List |
| | | size="small" |
| | | bordered |
| | | dataSource={this.state.selectedTables} |
| | | renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}> |
| | | {item.Remark + ' (' + item.TbName + ')'} |
| | | <Icon type="close" onClick={() => this.deleteTable(item)}/> |
| | | <div className="bottom-mask"></div> |
| | | </List.Item>} |
| | | />} |
| | | <TableComponent |
| | | config={config} |
| | | containerId="main-basedata" |
| | | updatetable={this.updatetable} |
| | | /> |
| | | </Panel> |
| | | {/* 搜索条件添加 */} |
| | | <Panel header={this.state.dict['header.menu.search']} key="1"> |
| | | <div className="search-element"> |
| | | {Source.searchItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | {Source.searchItems.map((item, index) => (<SourceElement key={index} content={item}/>))} |
| | | </div> |
| | | <Button type="primary" block onClick={() => this.queryField('search')}>{this.state.dict['header.menu.search.add']}</Button> |
| | | <FieldsComponent |
| | | config={config} |
| | | type="search" |
| | | tableFields={this.state.tableFields} |
| | | updatefield={this.updateconfig} |
| | | /> |
| | | </Panel> |
| | | {/* 按钮添加 */} |
| | | <Panel header={this.state.dict['header.menu.action']} key="2"> |
| | | <div className="search-element"> |
| | | {Source.actionItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | {Source.actionItems.map((item, index) => (<SourceElement key={index} content={item}/>))} |
| | | </div> |
| | | <div className="config-btn"> |
| | | {configAction.length > 0 ? |
| | | {confActions.length > 0 ? |
| | | <p className="config-btn-title"> |
| | | <Tooltip placement="topLeft" title="点击按钮,可完成或查看按钮配置信息。"> |
| | | <Icon type="question-circle" /> |
| | |
| | | {this.state.dict['header.menu.action.configurable']} |
| | | </p> : null |
| | | } |
| | | <div className="thawbutton" title={this.state.dict['header.form.thawbutton']} onClick={this.handleThaw}> |
| | | <Icon type="unlock" /> |
| | | </div> |
| | | </div> |
| | | {configAction.map((item, index) => { |
| | | {confActions.map((item, index) => { |
| | | return ( |
| | | <div key={index}> |
| | | <Button |
| | |
| | | {/* 添加显示列 */} |
| | | <Panel header={this.state.dict['header.menu.column']} key="3"> |
| | | <div className="search-element"> |
| | | {Source.columnItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | {Source.columnItems.map((item, index) => (<SourceElement key={index} content={item}/>))} |
| | | </div> |
| | | <Button type="primary" block onClick={() => this.queryField('columns')}>{this.state.dict['header.menu.column.add']}</Button> |
| | | <FieldsComponent |
| | | config={config} |
| | | type="columns" |
| | | tableFields={this.state.tableFields} |
| | | updatefield={this.updateconfig} |
| | | /> |
| | | </Panel> |
| | | {/* 添加标签 */} |
| | | <Panel header={this.state.dict['header.menu.tab']} key="4"> |
| | | <div className="search-element"> |
| | | {Source.tabItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | {Source.tabItems.map((item, index) => (<SourceElement key={index} content={item}/>))} |
| | | </div> |
| | | {configTabs.length > 0 ? |
| | | <p className="config-btn-title"> |
| | |
| | | <Card title={ |
| | | <div> |
| | | {this.state.dict['header.menu.page.configurable']} |
| | | <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={this.reloadTab} /> |
| | | <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={() => this.reloadTab(true)} /> |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <EditComponent dict={this.state.dict} type="maintable" config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <Icon type="setting" onClick={this.changeSetting} /> |
| | | <div className="search-list"> |
| | | <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《搜索》中,选择对应搜索框拖至此处添加;或点击按钮《添加搜索条件》批量添加,选择批量添加时,需提前选择使用表。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | <DragElement |
| | | type="search" |
| | | list={config.search} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleSearch} |
| | | deleteMenu={this.deleteElement} |
| | | placeholder={this.state.dict['header.form.search.placeholder']} |
| | | /> |
| | | </div> |
| | | <div className="action-list" id="action-list"> |
| | | <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《按钮》中,选择对应类型的按钮拖至此处添加,如选择按钮类型为表单、新标签页等含有配置页面的按钮,可在左侧工具栏-按钮-可配置按钮处,点击按钮完成相关配置。注:当设置按钮显示位置为表格时,显示列会增加操作列。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | <div className="copybutton" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({modaltype: 'paste'})}}> |
| | | <Icon type="snippets" /> |
| | | </div> |
| | | <DragElement |
| | | type="action" |
| | | list={config.action} |
| | | setting={config.setting} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleAction} |
| | | copyElement={(val) => this.handleAction(val, 'copy')} |
| | | deleteMenu={this.deleteElement} |
| | | profileMenu={this.profileAction} |
| | | doubleClickCard={this.btnDoubleClick} |
| | | placeholder={this.state.dict['header.form.action.placeholder']} |
| | | /> |
| | | </div> |
| | | {/* 显示列 */} |
| | | <div className="column-list"> |
| | | <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《显示列》中,选择对应类型的显示列拖至此处添加;或点击《添加显示列》按钮批量添加,选择批量添加时,需提前选择使用表。注:添加合并列时,需设置可选列。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | {config.columns && config.columns.length > 0 ? <Icon className="column-copy" title="copy" type="copy" onClick={this.copycolumn} /> : null} |
| | | <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} /> |
| | | <DragElement |
| | | type="columns" |
| | | list={config.columns} |
| | | setting={config.setting} |
| | | gridBtn={config.gridBtn} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleColumn} |
| | | deleteMenu={this.deleteElement} |
| | | handleGridBtn={this.handleGridBtn} |
| | | showfield={this.state.showColumnName} |
| | | placeholder={this.state.dict['header.form.column.placeholder']} |
| | | /> |
| | | <SettingComponent |
| | | type="main" |
| | | config={config} |
| | | MenuID={this.props.menu.MenuID} |
| | | menuformRef={this.menuformRef} |
| | | permFuncField={this.props.permFuncField} |
| | | updatesetting={this.updateconfig} |
| | | /> |
| | | <SearchComponent |
| | | menu={{MenuID: this.props.menu.MenuID, MenuName: this.props.menu.MenuName}} |
| | | config={config} |
| | | pasteContent={this.state.pasteContent} |
| | | sysRoles={this.props.sysRoles} |
| | | optionLibs={this.state.optionLibs} |
| | | updatesearch={this.updatesearch} |
| | | /> |
| | | <div className="chart-view" style={{position: 'relative'}}> |
| | | {/* 视图组 权限 会员等级20+ */} |
| | | {this.props.memberLevel >= 20 ? <ChartGroupComponent |
| | | config={config} |
| | | sysRoles={this.props.sysRoles} |
| | | updatechartgroup={this.updatechartgroup} |
| | | /> : null} |
| | | {config.charts.map(item => { |
| | | if (!config.expand && chartview !== item.uuid) return '' |
| | | |
| | | if (item.chartType === 'table') { |
| | | return ( |
| | | <Col span={item.width || 24} key={item.uuid}> |
| | | {config.charts.length > 1 && item.title ? <p className="chart-title">{item.title}</p> : null} |
| | | <ActionComponent |
| | | type="main" |
| | | menu={{ MenuID: this.props.menu.MenuID, MenuName: this.props.menu.MenuName, MenuNo: this.props.menu.MenuNo }} |
| | | config={config} |
| | | tabs={this.state.tabviews} |
| | | menuformRef={this.menuformRef} |
| | | pasteContent={this.state.pasteContent} |
| | | usefulFields={this.props.permFuncField} |
| | | setSubConfig={(_btn) => this.setSubConfig(_btn, 'button')} |
| | | updateaction={this.updateaction} |
| | | /> |
| | | <ColumnComponent |
| | | config={config} |
| | | menu={this.props.menu} |
| | | sysRoles={this.props.sysRoles} |
| | | pasteContent={this.state.pasteContent} |
| | | updatecolumn={this.updateconfig} |
| | | /> |
| | | </Col> |
| | | ) |
| | | } else if (item.chartType === 'card') { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <CardComponent |
| | | card={item} |
| | | config={config} |
| | | plotchange={this.updateconfig} |
| | | /> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | return ( |
| | | <Col span={item.width} key={item.uuid}> |
| | | <ChartComponent |
| | | plot={item} |
| | | config={config} |
| | | plotchange={this.updateconfig} |
| | | /> |
| | | </Col> |
| | | ) |
| | | } |
| | | })} |
| | | </div> |
| | | {/* 标签组 */} |
| | | {config.tabgroups.map((groupId, index) => { |
| | | return ( |
| | | <div key={index} className="tab-list"> |
| | | {index === 0 ? <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《标签页》中,选择对应类型的标签页拖至此处添加。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> : null} |
| | | {index !== (config.tabgroups.length - 1) ? |
| | | <Icon type="arrow-down" onClick={() => {this.handleGroup(index, 'down')}} /> : null |
| | | } |
| | | {index !== 0 ? <Icon type="arrow-up" onClick={() => {this.handleGroup(index, 'up')}} /> : null} |
| | | {index === 0 ? <Icon type="plus" onClick={this.addTabGroup} /> : null} |
| | | {index !== 0 ? <Icon type="delete" onClick={() => {this.delTabGroup(groupId)}} /> : null} |
| | | <TabDragElement |
| | | type="tabs" |
| | | groupId={groupId} |
| | | list={config[groupId]} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleTab} |
| | | deleteMenu={this.deleteElement} |
| | | doubleClickCard={(tab) => this.setSubConfig(tab, 'tab')} |
| | | placeholder={this.state.dict['header.form.tab.placeholder']} |
| | | /> |
| | | </div>) |
| | | })} |
| | | <TabsComponent |
| | | config={config} |
| | | tabs={this.state.tabviews} |
| | | setSubConfig={(item) => this.setSubConfig(item, 'tab')} |
| | | updatetabs={this.updatetabs} |
| | | /> |
| | | </Card> |
| | | </div> |
| | | </DndProvider> |
| | | {/* 编辑搜索条件 */} |
| | | <Modal |
| | | title={this.state.dict['header.modal.search.edit']} |
| | | visible={modaltype === 'search'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | | <SearchForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | inputSubmit={this.handleSubmit} |
| | | optionLibs={this.state.optionLibs} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.searchFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 编辑按钮:复制、编辑 */} |
| | | <Modal |
| | | title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} |
| | | visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} |
| | | width={800} |
| | | maskClosable={false} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | hasbtncrtinter ? <CreateInterface key="interface" dict={this.state.dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null, |
| | | modaltype === 'actionEdit' ? <CreateFunc key="create" dict={this.state.dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null, |
| | | <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <ActionForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | tabs={this.state.tabviews} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | setting={config.setting} |
| | | wrappedComponentRef={(inst) => this.actionFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 显示列编辑 */} |
| | | <Modal |
| | | title={this.state.dict['header.modal.column.edit']} |
| | | visible={modaltype === 'columns'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | | <ColumnForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | MenuID={this.props.menu.MenuID} |
| | | inputSubmit={this.handleSubmit} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.columnFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 合并列编辑 */} |
| | | <Modal |
| | | title={this.state.dict['header.modal.colspan.edit']} |
| | | visible={modaltype === 'colspan'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | | <ColspanForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | inputSubmit={this.handleSubmit} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.columnFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 操作列编辑 */} |
| | | <Modal |
| | | title={this.state.dict['header.modal.gridbtn.edit']} |
| | | visible={modaltype === 'gridbtn'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | | <GridBtnForm |
| | | dict={this.state.dict} |
| | | inputSubmit={this.handleSubmit} |
| | | card={config.gridBtn} |
| | | wrappedComponentRef={(inst) => this.gridBtnFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 标签编辑 */} |
| | | <Modal |
| | | title={this.state.dict['header.modal.tabs.edit']} |
| | | visible={modaltype === 'tabs'} |
| | | width={700} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | | > |
| | | <TabForm |
| | | type="tabs" |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | tabs={this.state.tabviews} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | wrappedComponentRef={(inst) => this.tabsFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 根据字段名添加显示列及搜索条件 */} |
| | | <Modal |
| | | wrapClassName="common-table-fields-modal" |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | cancelText={this.state.dict['header.close']} |
| | | onOk={this.addFieldSubmit} |
| | | onCancel={() => { // 取消添加 |
| | | this.setState({ |
| | | tableVisible: false, |
| | | addType: '' |
| | | }) |
| | | }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.addType && this.state.fields.length > 0 ? |
| | | <EditCard data={this.state.fields} ref="searchcard" type={this.state.addType} dict={this.state.dict} /> : null |
| | | } |
| | | {(!this.state.fields || this.state.fields.length === 0) && |
| | | <Empty /> |
| | | } |
| | | </Modal> |
| | | {/* 按钮使用系统存储过程时,验证信息模态框 */} |
| | | <Modal |
| | | wrapClassName="common-table-fields-modal" |
| | | title={'验证信息'} |
| | | maskClosable={false} |
| | | visible={this.state.profileVisible} |
| | | width={'75vw'} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.card && !this.state.card.execMode && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? |
| | | <VerifyCard |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.execMode ? |
| | | <VerifyCardPrint |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelIn' ? |
| | | <VerifyCardExcelIn |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | {this.state.card && this.state.card.OpenType === 'excelOut' ? |
| | | <VerifyCardExcelOut |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | | </Modal> |
| | | {/* 设置全局配置及列表数据源 */} |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | maskClosable={false} |
| | | onCancel={() => { // 取消修改 |
| | | this.setState({ |
| | | settingVisible: false |
| | | }) |
| | | }} |
| | | footer={[ |
| | | <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, |
| | | <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, |
| | | <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | dict={this.state.dict} |
| | | menu={this.props.menu} |
| | | inputSubmit={this.settingSave} |
| | | data={config.setting} |
| | | columns={config.columns} |
| | | usefulFields={this.props.permFuncField} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | | </Modal> |
| | | {/* 返回时未保存提示 */} |
| | | <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | |
| | | > |
| | | {this.state.dict['header.menu.config.placeholder']} |
| | | </Modal> |
| | | {/* 解冻按钮模态框 */} |
| | | <Modal |
| | | title={this.state.dict['header.form.thawbutton']} |
| | | okText={this.state.dict['header.confirm']} |
| | | cancelText={this.state.dict['header.cancel']} |
| | | visible={this.state.thawBtnVisible} |
| | | onOk={this.thawBtnSubmit} |
| | | onCancel={() => {this.setState({thawBtnVisible: false, thawbtnlist: null})}} |
| | | destroyOnClose |
| | | > |
| | | {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} |
| | | </Modal> |
| | | {/* 按钮配置信息粘贴复制 */} |
| | | <Modal |
| | | title={this.state.dict['header.form.paste']} |
| | | visible={modaltype === 'paste'} |
| | | width={600} |
| | | maskClosable={false} |
| | | onOk={this.pasteSubmit} |
| | | onCancel={() => {this.setState({modaltype: ''})}} |
| | | destroyOnClose |
| | | > |
| | | <PasteForm |
| | | dict={this.state.dict} |
| | | wrappedComponentRef={(inst) => this.pasteFormRef = inst} |
| | | /> |
| | | </Modal> |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | sysRoles: state.sysRoles, |
| | | permFuncField: state.permFuncField |
| | | permFuncField: state.permFuncField, |
| | | memberLevel: state.memberLevel |
| | | } |
| | | } |
| | | |