| | |
| | | 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 } from 'antd' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip, message } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | | import enUS from '@/locales/en-US/comtable.js' |
| | | import { getSearchForm, getActionForm, getColumnForm } from '@/templates/tableshare/formconfig' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getSearchForm, getActionForm, getColumnForm } from '@/templates/zshare/formconfig' |
| | | import { queryTableSql } from '@/utils/option.js' |
| | | |
| | | import ActionForm from './actionform' |
| | | import SettingForm from './settingform' |
| | | import TabForm from '@/templates/tableshare/tabform' |
| | | import SearchForm from '@/templates/tableshare/searchform' |
| | | import ColumnForm from '@/templates/tableshare/columnform' |
| | | import DragElement from '@/templates/tableshare/dragelement' |
| | | import ColspanForm from '@/templates/tableshare/colspanform' |
| | | import GridBtnForm from '@/templates/tableshare/gridbtnform' |
| | | import EditCard from '@/templates/tableshare/editcard' |
| | | import VerifyCard from '@/templates/tableshare/verifycard' |
| | | import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' |
| | | import MenuForm from '@/templates/tableshare/menuform' |
| | | import TabDragElement from '@/templates/tableshare/tabdragelement' |
| | | import SourceElement from '@/templates/tableshare/dragelement/source' |
| | | import TabForm from '@/templates/zshare/tabform' |
| | | import SearchForm from '@/templates/zshare/searchform' |
| | | import ColumnForm from '@/templates/zshare/columnform' |
| | | 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 MenuForm from '@/templates/zshare/menuform' |
| | | import TabDragElement from '@/templates/zshare/tabdragelement' |
| | | import EditComponent from '@/templates/zshare/editcomponent' |
| | | import SourceElement from '@/templates/zshare/dragelement/source' |
| | | import CreateFunc from '@/templates/zshare/createfunc' |
| | | import CreateInterface from '@/templates/zshare/createinterface' |
| | | import Source from './source' |
| | | import './index.scss' |
| | | |
| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | supMenuList: PropTypes.array, |
| | | optionLibs: PropTypes.any, |
| | | reloadmenu: PropTypes.func, |
| | | handleView: PropTypes.func |
| | | } |
| | |
| | | originActions: null, // 原始按钮信息,使用已有用户模板 |
| | | delActions: [], // 删除按钮列表 |
| | | copyActions: [], // 复制按钮组 |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false // 验证信息模态框 |
| | | profileVisible: false, // 验证信息模态框 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | thawButtons: [], // 已选择要解冻的按钮 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | sqlVerifing: false // sql验证 |
| | | } |
| | | |
| | | /** |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu } = this.props |
| | | const { menu, optionLibs } = this.props |
| | | |
| | | let _LongParam = menu.LongParam |
| | | let _config = '' |
| | |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = _LongParam |
| | | _config.search.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(menu.MenuID + item.uuid, { |
| | | uuid: menu.MenuID + item.uuid, |
| | | label: item.label, |
| | | parname: menu.MenuName, |
| | | type: 'search', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 配置默认值,兼容 |
| | |
| | | _config.tabgroups = _config.tabgroups || ['tabs'] |
| | | _config.setting.subtabs = _config.setting.subtabs || [] |
| | | _config.Template = 'CommonTable' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | | let _oriActions = [] |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | let uuid = Utils.getuuid() |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮。。。 |
| | | if (item.linkTab) { |
| | | item.linkTab = '' |
| | | } |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮(表单) |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | curuuid: uuid, |
| | | Template: 'Modal' |
| | | }) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { // 含有子配置项的按钮(标签后当前页打开) |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | | curuuid: uuid, |
| | | Template: item.tabTemplate |
| | | }) |
| | | } |
| | | |
| | |
| | | _config[group] = _config[group].map(tab => { |
| | | tab.uuid = Utils.getuuid() |
| | | |
| | | if (tab.linkTab) { |
| | | tab.linkTab = '' |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | }) |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | 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: this.state.dict['header.menu.supMenu'], |
| | | label: '二级菜单', |
| | | initVal: menu.ParentID, |
| | | required: true, |
| | | readonly: false, |
| | | options: this.props.supMenuList |
| | | options: menu.supMenuList |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | MenuID: 'currenttab', |
| | | text: this.state.dict['header.form.currenttab'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'easyCode', |
| | | label: this.state.dict['header.form.easyCode'], |
| | | initVal: _config.easyCode, |
| | | required: false, |
| | | readonly: false |
| | | } |
| | | ] |
| | | }) |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 加载或刷新标签信息 |
| | | */ |
| | | reloadTab = () => { |
| | | this.setState({ |
| | | loading: true, |
| | | tabviews: [] |
| | | }) |
| | | Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | | loading: false, |
| | | tabviews: res.UserTemp.map(temp => { |
| | | return { |
| | | uuid: temp.MenuID, |
| | | value: temp.MenuID, |
| | | text: temp.MenuName, |
| | | type: temp.Template, |
| | | MenuNo: temp.MenuNo |
| | | } |
| | | }) |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '刷新成功。', |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.setState({ |
| | | modaltype: 'search', |
| | | card: card, |
| | | formlist: getSearchForm(card) |
| | | formlist: getSearchForm(card, this.props.sysRoles) |
| | | }) |
| | | } |
| | | |
| | |
| | | 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> |
| | | <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p> |
| | | <p>{this.state.dict['model.tooltip.func.outface']}</p> |
| | | </div> |
| | | |
| | | this.setState({ |
| | |
| | | * @description 显示列与合并列编辑,获取表单信息 |
| | | */ |
| | | handleColumn = (card) => { |
| | | const { menu } = this.props |
| | | |
| | | if (card.type !== 'colspan') { |
| | | this.setState({ |
| | | modaltype: 'columns', |
| | | card: card, |
| | | formlist: getColumnForm(card) |
| | | 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: 5 |
| | | }) |
| | | } |
| | | |
| | | 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', |
| | |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: this.state.dict['header.form.equalTab'], |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchPass', |
| | | label: '主表搜索', |
| | | initVal: card.searchPass || 'false', |
| | | tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不使用' |
| | | }] |
| | | } |
| | | ] |
| | | }) |
| | |
| | | */ |
| | | handleSubmit = () => { |
| | | const { menu } = this.props |
| | | const { config, card, modaltype } = this.state |
| | | const { config, card, modaltype, optionLibs } = this.state |
| | | |
| | | if (modaltype === 'search') { |
| | | this.searchFormRef.handleConfirm().then(res => { |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(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: 5 |
| | | }) |
| | | return |
| | | } else if (labelrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '名称已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _search = _search.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | modaltype: '' |
| | | }) |
| | | if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: res.dataSource |
| | | } |
| | | 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) |
| | | |
| | | if (window.GLOB.mainSystemApi && res.database === 'sso') { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | Api.getLocalConfig(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, search: _search}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } |
| | | }) |
| | | } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { |
| | | this.actionFormRef.handleConfirm().then(res => { |
| | |
| | | // 解析配置,修改模态框标题名称 |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | |
| | | _LongParam.setting.title = res.label |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) |
| | | } catch { |
| | | console.warn('Stringify Failure') |
| | | _LongParam = '' |
| | | } |
| | | } else { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | // 解析配置,修改模态框标题名称 |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) |
| | | _temp = 'FormTab' |
| | | } catch { |
| | | console.warn('Stringify Failure') |
| | | _LongParam = '' |
| | | } |
| | | } else { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | }) |
| | | } 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: 5 |
| | | }) |
| | | return |
| | | } else if (labelrepet) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '名称已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _columns = _columns.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | |
| | | editModalCancel = () => { |
| | | const { config, card, modaltype } = this.state |
| | | |
| | | if (card.focus) { |
| | | if (card && card.focus) { |
| | | let _config = null |
| | | if (modaltype === 'search') { |
| | | let _search = config.search.filter(item => item.uuid !== card.uuid) |
| | |
| | | let btn = res // 按钮信息 |
| | | let newLText = '' // 创建存储过程sql |
| | | let DelText = '' // 删除存储过程sql |
| | | let isExit = false // 存储过程是否存在 |
| | | let sysTVPText = '' // 已有的存储过程语句(云端) |
| | | let localTVPText = '' // 已有的存储过程语句(本地) |
| | | |
| | | // 创建存储过程,必须填写内部函数名 |
| | | if (!btn.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请填写内部函数!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | // 创建中 |
| | | this.setState({ |
| | | funcLoading: true |
| | | }) |
| | | |
| | | new Promise(resolve => { |
| | | // 弹窗(表单)类按钮,先获取按钮配置信息,如果尚未配置按钮则会报错并终止。 |
| | |
| | | }).then(res => { |
| | | let _LongParam = '' |
| | | if (res.status && res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | |
| | | DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) |
| | | resolve(true) |
| | | } else { |
| | | resolve(false) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '弹窗(表单)按钮,请先配置表单信息!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } |
| | | }) |
| | | } else if (btn.OpenType === 'excelIn') { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善导入Excel验证信息!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } |
| | |
| | | resolve(true) |
| | | } |
| | | }).then(res => { |
| | | // 获取云端及本地,是否已存在该存储过程的信息 |
| | | if (res === false) return res |
| | | if (!res) return |
| | | |
| | | let sysDefer = new Promise(resolve => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_TVP', // 云端获取存储结果 |
| | | TVPName: btn.innerFunc |
| | | }).then(result => { |
| | | resolve(result) |
| | | }) |
| | | }) |
| | | this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { |
| | | if (result !== 'success') return |
| | | |
| | | let localDefer = new Promise(resolve => { |
| | | let _param = { // 获取本地存储过程信息 |
| | | func: 's_get_userproc', |
| | | LText: btn.innerFunc |
| | | } |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | Api.getLocalConfig(_param).then(result => { |
| | | resolve(result) |
| | | }) |
| | | }) |
| | | |
| | | return Promise.all([sysDefer, localDefer]) |
| | | }).then(res => { |
| | | // 云端结果与新语句不同时,更新云端信息 |
| | | if (res === false) return res |
| | | |
| | | let isError = false |
| | | |
| | | res.forEach((result, index) => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | isError = true |
| | | } else if (index === 0) { |
| | | sysTVPText = result.TVPText |
| | | } else { |
| | | if (result.Ltext) { // 本地存储过程是否存在 |
| | | isExit = true |
| | | let _action = config.action.map(item => { |
| | | if (item.uuid === btn.uuid) { |
| | | return btn |
| | | } else { |
| | | return item |
| | | } |
| | | localTVPText = Utils.formatOptions(result.Ltext) |
| | | } |
| | | }) |
| | | |
| | | if (isError) return false |
| | | |
| | | if ((newLText === localTVPText) && (newLText === sysTVPText)) { |
| | | return 'drop' |
| | | } else if (!localTVPText || (localTVPText === sysTVPText)) { |
| | | // 本地存储过程不存在,将新的存储过程更新至云端 |
| | | return Api.getSystemConfig({ |
| | | func: 'sPC_TVP_InUp', |
| | | TVPName: btn.innerFunc, |
| | | TVPText: newLText, |
| | | TypeName: 'P' |
| | | }) |
| | | } else { |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig({ // 添加现有的本地存储过程至云端 |
| | | func: 'sPC_TVP_InUp', |
| | | TVPName: btn.innerFunc, |
| | | TVPText: localTVPText, |
| | | TypeName: 'P' |
| | | }).then(result => { |
| | | if (result.status) { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_TVP_InUp', // 添加最新的存储过程至云端 |
| | | TVPName: btn.innerFunc, |
| | | TVPText: newLText, |
| | | TypeName: 'P' |
| | | }).then(response => { |
| | | resolve(response) |
| | | }) |
| | | } else { |
| | | resolve(result) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | // 云端信息更新后,判断是删除或是直接新建存储过程 |
| | | if (res === false || res === 'drop') return res |
| | | _action = _action.filter(item => !item.origin) |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else if (isExit) { |
| | | return 'drop' |
| | | } else { |
| | | return 'create' |
| | | } |
| | | }).then(res => { |
| | | // 删除存储过程 |
| | | if (res === false || res === 'create') return res |
| | | // 判断是否存在操作列 |
| | | let _hasGridbtn = _action.filter(act => act.position === 'grid').length > 0 |
| | | let _gridBtn = config.gridBtn |
| | | |
| | | let _param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: DelText, |
| | | TypeCharOne: 'proc' // 删除或创建存储过程 |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | }).then(res => { |
| | | // 根据上述操作结果,判断是否新建存储过程 |
| | | if (res === false || res === 'create') return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | return 'create' |
| | | } |
| | | }).then(res => { |
| | | // 新建存储过程 |
| | | if (res === false) return res |
| | | |
| | | let _param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: newLText, |
| | | TypeCharOne: 'proc' // 删除或创建存储过程 |
| | | } |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | }).then(res => { |
| | | // 处理新建结果 |
| | | if (res === false) return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '创建成功', |
| | | duration: 2 |
| | | }) |
| | | return true |
| | | } |
| | | }).then(res => { |
| | | // 新建成功后,更新页面按钮信息 |
| | | if (res === false) { |
| | | this.setState({ |
| | | funcLoading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let _action = config.action.map(item => { |
| | | if (item.uuid === btn.uuid) { |
| | | return btn |
| | | if (_gridBtn) { |
| | | _gridBtn.display = _hasGridbtn |
| | | } else { |
| | | return item |
| | | _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 |
| | | } |
| | | } |
| | | }) |
| | | _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}, |
| | | funcLoading: false |
| | | this.setState({ |
| | | config: {...config, action: _action, gridBtn: _gridBtn} |
| | | }) |
| | | }) |
| | | }) |
| | | }) |
| | |
| | | */ |
| | | tableCreatFunc = () => { |
| | | const { menu } = this.props |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | const { config } = this.state |
| | | |
| | | this.settingRef.handleConfirm().then(res => { |
| | | const setting = res |
| | | this.settingRef.handleConfirm().then(setting => { |
| | | |
| | | if (!(setting.interType === 'inner') || !setting.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '接口类型为-内部,且存在内部函数时,才可以创建存储过程!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) { |
| | | let param = { |
| | | func: 's_DataSrc_Save', |
| | | LText: setting.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({ |
| | | funcLoading: true |
| | | }) |
| | | |
| | | let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 创建存储过程sql |
| | | let _config = {...config, setting: setting} |
| | | let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, _config)) // 创建存储过程sql |
| | | let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc)) // 删除存储过程sql |
| | | |
| | | new Promise(resolve => { |
| | | let sysDefer = new Promise(resolve => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_TVP', // 云端获取存储结果 |
| | | TVPName: setting.innerFunc |
| | | }).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | resolve(result) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | let localDefer = new Promise(resolve => { |
| | | let _param = { // 获取本地存储过程信息 |
| | | func: 's_get_userproc', |
| | | LText: setting.innerFunc |
| | | } |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | Api.getLocalConfig(_param).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | resolve(result) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | Promise.all([sysDefer, localDefer]).then(result => { |
| | | resolve(result) |
| | | }) |
| | | }).then(res => { |
| | | // 获取云端及本地,是否已存在该存储过程的信息 |
| | | if (res === false) return res |
| | | if (res[0] === false || res[1] === false) return false |
| | | |
| | | let cloudfunc = '' |
| | | let localfunc = '' |
| | | res.forEach((item, index) => { |
| | | if (index === 0 && item.TVPText) { |
| | | cloudfunc = item.TVPText |
| | | } else if (index === 1 && item.Ltext) { |
| | | localfunc = Utils.formatOptions(item.Ltext) |
| | | } |
| | | }) |
| | | |
| | | if ((newLText === localfunc) && (newLText === cloudfunc)) { |
| | | return 'drop' |
| | | } else if (!localfunc || (cloudfunc === localfunc)) { |
| | | // 本地存储过程不存在,或云端和本地存储过程一致时,将新的存储过程更新至云端 |
| | | return Api.getSystemConfig({ |
| | | func: 'sPC_TVP_InUp', |
| | | TVPName: setting.innerFunc, |
| | | TVPText: newLText, |
| | | TypeName: 'P' |
| | | }) |
| | | } else { |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig({ // 添加现有的本地存储过程至云端 |
| | | func: 'sPC_TVP_InUp', |
| | | TVPName: setting.innerFunc, |
| | | TVPText: localfunc, |
| | | TypeName: 'P' |
| | | }).then(result => { |
| | | if (result.status) { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_TVP_InUp', // 添加最新的存储过程至云端 |
| | | TVPName: setting.innerFunc, |
| | | TVPText: newLText, |
| | | TypeName: 'P' |
| | | }).then(response => { |
| | | resolve(response) |
| | | }) |
| | | } else { |
| | | resolve(result) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | // 云端信息更新后,判断是删除或是直接新建存储过程 |
| | | if (res === false || res === 'drop') return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | return 'create' |
| | | } |
| | | }).then(res => { |
| | | // 删除存储过程 |
| | | if (res === false || res === 'create') return res |
| | | |
| | | let _param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: DelText, |
| | | TypeCharOne: 'proc' // 删除或创建存储过程 |
| | | } |
| | | |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | }).then(res => { |
| | | // 根据上述操作结果,判断是否新建存储过程 |
| | | if (res === false || res === 'create') return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | return 'create' |
| | | } |
| | | }).then(res => { |
| | | // 新建存储过程 |
| | | if (res === false) return res |
| | | |
| | | let _param = { |
| | | func: 'sPC_TableData_InUpDe', |
| | | LText: newLText, |
| | | TypeCharOne: 'proc' // 删除或创建存储过程 |
| | | } |
| | | _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) |
| | | |
| | | return Api.getLocalConfig(_param) |
| | | }).then(res => { |
| | | // 处理新建结果 |
| | | if (res === false) return res |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '创建成功', |
| | | duration: 2 |
| | | }) |
| | | return true |
| | | } |
| | | }).then(res => { |
| | | // 新建成功后,更新页面按钮信息 |
| | | if (res === false) { |
| | | this.refs.tableCreatFunc.exec(setting.innerFunc, newLText, DelText).then(result => { |
| | | if (result === 'success') { |
| | | this.setState({ |
| | | funcLoading: false |
| | | config: _config |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 创建按钮接口(写入) |
| | | */ |
| | | btnCreatInterface = () => { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | this.actionFormRef.handleConfirm().then(result => { |
| | | 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: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, setting: setting} |
| | | }) |
| | | |
| | | 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 } = this.state |
| | | const { config, thawButtons } = this.state |
| | | let _this = this |
| | | |
| | | confirm({ |
| | | content: `确定删除<<${element.card.label}>>吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let _config = null |
| | |
| | | // 删除按钮元素 |
| | | let _delActions = _this.state.delActions |
| | | if (element.type === 'action' || element.type === 'tabs') { |
| | | _delActions.push(element.card.uuid) |
| | | _delActions.push(element) |
| | | } |
| | | |
| | | _this.setState({ |
| | | config: _config, |
| | | delActions: _delActions |
| | | delActions: _delActions, |
| | | thawButtons: thawButtons.filter(key => key !== element.card.uuid) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | } |
| | | |
| | | /** |
| | | * @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: 5 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @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 { |
| | | let _verify = this.verifyRef.state.verify |
| | | |
| | | if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.verifyRef.handleConfirm().then(res => { |
| | | config.action = config.action.map(item => { |
| | | if (item.uuid === card.uuid) { |
| | | item.verify = _verify |
| | | item.verify = res |
| | | } |
| | | |
| | | return item |
| | |
| | | this.setState({ |
| | | profileVisible: false, |
| | | config: config, |
| | | card: '', |
| | | card: '' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | this.props.handleView({tabview: 'template'}) |
| | | } |
| | | |
| | | getFuncNames = (data, funcNames, tableNames) => { |
| | | data.forEach(item => { |
| | | if (item.subfuncs) { |
| | | this.getFuncNames(item.subfuncs, funcNames, tableNames) |
| | | } else { |
| | | if (item.tableName) { |
| | | tableNames.push(item.tableName) |
| | | } |
| | | if (item.innerFunc) { |
| | | funcNames.push({func: item.innerFunc, label: item.label || ''}) |
| | | } |
| | | |
| | | if (item.callbackFunc) { |
| | | funcNames.push({func: item.callbackFunc, label: item.label || ''}) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | return { |
| | | func: funcNames, |
| | | table: tableNames |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { originMenu, delActions } = this.state |
| | | const { originMenu, delActions, thawButtons } = this.state |
| | | |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | |
| | | if (config.isAdd) { |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | |
| | | } |
| | | } |
| | | |
| | | let btnNames = config.action.map(item => item.label) |
| | | btnNames = Array.from(new Set(btnNames)) |
| | | if (btnNames.length < config.action.length) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮名称不可相同!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let tabNames = [] |
| | | let tablength = 0 |
| | | config.tabgroups.forEach(group => { |
| | | config[group].forEach(tab => { |
| | | tabNames.push(tab.label) |
| | | }) |
| | | tablength += config[group].length |
| | | }) |
| | | tabNames = Array.from(new Set(tabNames)) |
| | | |
| | | if (tabNames.length < tablength) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '标签名称不可相同!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (config.type === 'user') { // 使用已有菜单时,默认添加关联标签id |
| | | config.action = config.action.map(item => { |
| | | if (item.OpenType === 'popview' && !item.linkTab) { |
| | | item.linkTab = Utils.getuuid() |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | config.tabgroups.forEach(group => { |
| | | config[group] = config[group].map(tab => { |
| | | if (!tab.linkTab) { |
| | | tab.linkTab = Utils.getuuid() |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | |
| | | subtype: 'btn', |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | tablename: tablename, |
| | | tableName: tablename, |
| | | intertype: item.intertype, |
| | | interface: item.interface || '', |
| | | innerFunc: item.innerFunc || '', |
| | |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | menucloseloading: false, |
| | |
| | | return |
| | | } |
| | | |
| | | let _sort = 0 |
| | | let btntabs = [] |
| | | |
| | | let btnParam = { // 添加菜单按钮 |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | |
| | | Template: menu.PageParam.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: config.action.map((item, index) => { |
| | | return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort` |
| | | }) |
| | | LText: [] |
| | | } |
| | | |
| | | _config.action.forEach(item => { |
| | | _sort++ |
| | | if (item.OpenType === 'popview') { |
| | | btntabs.push({ |
| | | uuid: item.uuid, |
| | | linkTab: item.linkTab, |
| | | label: item.label, |
| | | sort: _sort |
| | | }) |
| | | } |
| | | |
| | | btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) |
| | | }) |
| | | |
| | | btnParam.LText = btnParam.LText.join(' union all ') |
| | | btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | |
| | | |
| | | let tabParam = { // 添加菜单tab页 |
| | | func: 'sPC_sMenusTab_AddUpt', |
| | | MenuID: menu.MenuID, |
| | | LText: config.tabs.map((item, index) => { |
| | | return `select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` |
| | | }) |
| | | MenuID: menu.MenuID |
| | | } |
| | | tabParam.LText = tabParam.LText.join(' union all ') |
| | | tabParam.LText = Utils.formatOptions(tabParam.LText) |
| | | |
| | | let _LText = [] |
| | | |
| | | 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 => { |
| | | _sort++ |
| | | _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | }) |
| | | }) |
| | | |
| | | _LText = _LText.join(' union all ') |
| | | |
| | | tabParam.LText = Utils.formatOptions(_LText) |
| | | tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let _vals = this.getFuncNames(_config.funcs, [], []) |
| | | let _tables = Array.from(new Set(_vals.table)) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: res.fstMenuId, |
| | | SndID: res.parentId, |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | EasyCode: res.easyCode, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | Sort: (this.props.supMenuList.length + 1) * 10, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | LongParam: _LongParam, |
| | | LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | | LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) |
| | | } |
| | | |
| | | |
| | | if (menu.menuSort) { // 菜单新建时设置排序 |
| | | param.Sort = menu.menuSort |
| | | } |
| | | |
| | | param.LText = param.LText.join(' union all ') |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.LTexttb = param.LTexttb.join(' union all ') |
| | | param.LTexttb = Utils.formatOptions(param.LTexttb) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item |
| | | MenuID: item.card.uuid |
| | | } |
| | | |
| | | if (item.type === 'action') { |
| | | let _ParentParam = null |
| | | |
| | | try { |
| | | _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | _ParentParam = null |
| | | } |
| | | |
| | | if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | _param.ParentParam = _ParentParam |
| | | } |
| | | } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig(_param).then(response => { |
| | | resolve(response) |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | |
| | | |
| | | if (thawButtons.length > 0) { |
| | | let defers = thawButtons.map(item => { |
| | | return new Promise((resolve) => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_MainMenu_ReDel', |
| | | MenuID: item |
| | | }).then(res => { |
| | | if (res.status) { |
| | | resolve('') |
| | | } else { |
| | | resolve(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | return Promise.all(defers) |
| | | } else { |
| | | return true |
| | | } |
| | | }).then(res => { |
| | | if (res === true || res === false) return res |
| | | |
| | | let msg = res.filter(Boolean)[0] |
| | | if (msg) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else { |
| | | this.setState({ |
| | | thawButtons: [] |
| | | }) |
| | | return true |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | let localParam = JSON.parse(JSON.stringify(param)) |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | let _FMenu = originMenu.fstMenuList.filter(fstM => fstM.MenuID === res.fstMenuId)[0] |
| | | let _supMenuList = [] |
| | | if (_FMenu) { |
| | | _supMenuList = _FMenu.options |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | originMenu: { |
| | |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | ParentID: res.parentId, |
| | | fstMenuId: res.fstMenuId, |
| | | supMenuList: _supMenuList |
| | | } |
| | | }) |
| | | |
| | | this.props.reloadmenu() |
| | | |
| | | this.submitAction(btnParam, tabParam) |
| | | |
| | | localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' |
| | | delete localParam.LongParam |
| | | delete localParam.PageParam |
| | | delete localParam.Template |
| | | delete localParam.Sort |
| | | |
| | | Api.getLocalConfig(localParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | 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 { |
| | |
| | | } |
| | | }).then(response => { |
| | | if (response === false) return response |
| | | |
| | | if (!this.state.originActions || this.state.originActions.length === 0) return 'true' |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | |
| | | let _temp = '' |
| | | |
| | | if (result.LongParam) { |
| | | let _subconfig = '' |
| | | try { |
| | | _LongParam = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | _temp = _subconfig.type |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | console.warn('Parse Failure') |
| | | _subconfig = '' |
| | | } |
| | | |
| | | if (_temp === 'FormTab') { |
| | | try { |
| | | _subconfig.action = _subconfig.action.map(_btn => { |
| | | _btn.uuid = Utils.getuuid() |
| | | |
| | | return _btn |
| | | }) |
| | | _subconfig.tabgroups.forEach(_groupId => { |
| | | _subconfig[_groupId] = _subconfig[_groupId].map(_tab => { |
| | | _tab.uuid = Utils.getuuid() |
| | | |
| | | if (_tab.linkTab) { |
| | | _tab.linkTab = '' |
| | | } |
| | | |
| | | return _tab |
| | | }) |
| | | }) |
| | | _subconfig = window.btoa(window.encodeURIComponent(JSON.stringify(_subconfig))) |
| | | } catch { |
| | | console.warn('Stringify Failure') |
| | | _subconfig = '' |
| | | } |
| | | |
| | | _LongParam = _subconfig |
| | | } else if (_subconfig) { |
| | | _LongParam = result.LongParam |
| | | } |
| | | } |
| | | |
| | |
| | | ParentID: this.props.menu.MenuID, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: this.props.menu.MenuNo, |
| | | Template: _LongParam.type, |
| | | Template: _temp, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _LongParam.type}), |
| | | LongParam: result.LongParam |
| | | PageParam: JSON.stringify({Template: _temp}), |
| | | LongParam: _LongParam |
| | | } |
| | | Api.getSystemConfig(param).then(() => {}) |
| | | } |
| | |
| | | this.props.handleView() |
| | | } else { |
| | | this.setState({ |
| | | originActions: [], |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | |
| | | 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, tables: this.state.selectedTables, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | ParentID: res.parentId, |
| | | fstMenuId: res.fstMenuId |
| | | } |
| | | |
| | | if (!is(fromJS(originMenu), fromJS(_originMenu))) { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择表名!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | 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 |
| | | |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择添加字段', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | |
| | | |
| | | if (cell.type !== item.type) { // 数据类型修改 |
| | | if (cell.type === 'select') { |
| | | item.match = selectmatch[cell.datatype] |
| | | item.match = '=' |
| | | } else if (cell.type === 'daterange') { |
| | | item.match = datematch[cell.datatype] |
| | | item.match = 'between' |
| | | } else { |
| | | cell.type = 'text' |
| | | item.match = textmatch[cell.datatype] |
| | | item.match = 'like' |
| | | } |
| | | |
| | | item.type = cell.type |
| | |
| | | _columns.forEach(item => { |
| | | let _match = '' |
| | | if (item.type === 'select') { |
| | | _match = selectmatch[item.datatype] |
| | | _match = '=' |
| | | } else if (item.type === 'daterange') { |
| | | _match = datematch[item.datatype] |
| | | _match = 'between' |
| | | } else { |
| | | _match = textmatch[item.datatype] |
| | | _match = 'like' |
| | | } |
| | | |
| | | let newcard = { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | if ( |
| | | res.interType === 'inner' && |
| | | !res.innerFunc && |
| | | res.dataresource.length > 50 && |
| | | /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && |
| | | config.setting.dataresource !== res.dataresource |
| | | ) { |
| | | let param = { |
| | |
| | | Api.getLocalConfig(param) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false, |
| | | }) |
| | | |
| | | |
| | | if (res.interType === 'inner' && !res.innerFunc && /\s/.test(res.dataresource)) { |
| | | this.setState({ |
| | | sqlVerifing: true |
| | | }) |
| | | |
| | | let _dataresource = res.dataresource |
| | | |
| | | if (res.queryType === 'statistics') { |
| | | let fieldmap = new Map() |
| | | let options = config.search.map(item => { |
| | | let _field = item.key |
| | | let _val = '' |
| | | |
| | | if (fieldmap.has(_field)) { |
| | | _field = _field + '1' |
| | | } |
| | | |
| | | fieldmap.set(item.key, true) |
| | | |
| | | if (/date/.test(item.type)) { |
| | | _val = '1900-01-01' |
| | | } |
| | | |
| | | return { |
| | | reg: new RegExp('@' + _field + '@', 'ig'), |
| | | value: _val |
| | | } |
| | | }) |
| | | |
| | | options.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) |
| | | }) |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: _dataresource |
| | | } |
| | | 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).then(result => { |
| | | if (result.status) { |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } else { |
| | | this.setState({sqlVerifing: false}) |
| | | |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | config: {...config, setting: res}, |
| | | settingVisible: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | */ |
| | | setSubConfig = (item, type) => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | const { config, originMenu, optionLibs, activeKey } = 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, tables: this.state.selectedTables, easyCode: res.easyCode} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | ParentID: res.parentId, |
| | | fstMenuId: res.fstMenuId |
| | | } |
| | | |
| | | if (!is(fromJS(originMenu), fromJS(_originMenu))) { // 菜单信息变化时,提示保存 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.config.update'], |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | |
| | | isbutton = false |
| | | } |
| | | |
| | | // 保存当前打开页签 |
| | | _originMenu.activeKey = activeKey |
| | | |
| | | let param = { |
| | | optionLibs: optionLibs, |
| | | editMenu: _originMenu, |
| | | editTab: !isbutton ? item : '', |
| | | tabConfig: null, |
| | |
| | | }) |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | |
| | | 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 |
| | | }) |
| | | }) |
| | | } |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置数据源,不可启用!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } else if (!config.setting.primaryKey) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未设置主键,不可启用!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } else if (!tabinvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单标签页设置错误(多行标签内,行标签不可为空),不可启用!', |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | |
| | | |
| | | confirm({ |
| | | content: `确定新建标签组吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let newgroup = 'tabs' + Utils.getuuid() |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除标签组吗?`, |
| | | okText: this.state.dict['header.confirm'], |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | |
| | |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | 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() |
| | | } |
| | | |
| | | updateConfig = (res) => { |
| | | if (res.type === 'thaw') { |
| | | this.setState({ |
| | | thawButtons: res.thawButtons, |
| | | config: res.config |
| | | }) |
| | | } else if (res.type === 'paste') { |
| | | if (res.copyType === 'action') { |
| | | this.handleAction(res.content, 'copy') |
| | | } else if (res.copyType === 'columns') { |
| | | this.setState({ |
| | | config: res.config |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | render () { |
| | | const { modaltype } = this.state |
| | | const configAction = this.state.config.action.filter(_action => |
| | | const { modaltype, activeKey, config } = this.state |
| | | |
| | | const configAction = config.action.filter(_action => |
| | | !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') |
| | | ) |
| | | |
| | | let configTabs = [] |
| | | this.state.config.tabgroups.forEach(group => { |
| | | configTabs.push(...this.state.config[group]) |
| | | config.tabgroups.forEach(group => { |
| | | configTabs.push(...config[group]) |
| | | }) |
| | | |
| | | 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="0" bordered={false}> |
| | | <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel 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="common-basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | | {configAction.length > 0 ? |
| | | <p className="config-btn-title"> |
| | | <Tooltip placement="topLeft" title="点击按钮,可完成或查看按钮配置信息。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | {this.state.dict['header.menu.action.configurable']} |
| | | </p> : null |
| | | } |
| | | <div className="config-btn"> |
| | | {configAction.length > 0 ? |
| | | <p className="config-btn-title"> |
| | | <Tooltip placement="topLeft" title="点击按钮,可完成或查看按钮配置信息。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | {this.state.dict['header.menu.action.configurable']} |
| | | </p> : null |
| | | } |
| | | </div> |
| | | {configAction.map((item, index) => { |
| | | return ( |
| | | <div key={index}> |
| | |
| | | </Collapse> |
| | | </div> |
| | | <div className="setting"> |
| | | <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ |
| | | <Card title={ |
| | | <div> |
| | | {this.state.dict['header.menu.page.configurable']} |
| | | <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={this.reloadTab} /> |
| | | </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.updateConfig}/> |
| | | <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> |
| | |
| | | </Tooltip> |
| | | <DragElement |
| | | type="search" |
| | | list={this.state.config.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"> |
| | | <div className="action-list" id="action-list"> |
| | | <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《按钮》中,选择对应类型的按钮拖至此处添加,如选择按钮类型为表单、新标签页等含有配置页面的按钮,可在左侧工具栏-按钮-可配置按钮处,点击按钮完成相关配置。注:当设置按钮显示位置为表格时,显示列会增加操作列。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | <DragElement |
| | | type="action" |
| | | list={this.state.config.action} |
| | | setting={this.state.config.setting} |
| | | 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> |
| | |
| | | <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={this.state.config.columns} |
| | | setting={this.state.config.setting} |
| | | gridBtn={this.state.config.gridBtn} |
| | | list={config.columns} |
| | | setting={config.setting} |
| | | gridBtn={config.gridBtn} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleColumn} |
| | | deleteMenu={this.deleteElement} |
| | |
| | | /> |
| | | </div> |
| | | {/* 标签组 */} |
| | | {this.state.config.tabgroups.map((groupId, index) => { |
| | | {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={this.state.config[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>) |
| | |
| | | <Modal |
| | | title={this.state.dict['header.modal.search.edit']} |
| | | visible={modaltype === 'search'} |
| | | width={700} |
| | | width={750} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | confirmLoading={this.state.sqlVerifing} |
| | | 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} |
| | | /> |
| | |
| | | maskClosable={false} |
| | | onCancel={this.editModalCancel} |
| | | footer={[ |
| | | modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null, |
| | | 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> |
| | | <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['model.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | |
| | | card={this.state.card} |
| | | tabs={this.state.tabviews} |
| | | formlist={this.state.formlist} |
| | | setting={this.state.config.setting} |
| | | 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} |
| | | width={750} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | |
| | | <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} |
| | | /> |
| | |
| | | <ColspanForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | columns={this.state.config.columns} |
| | | 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} |
| | | width={750} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | |
| | | > |
| | | <GridBtnForm |
| | | dict={this.state.dict} |
| | | card={this.state.config.gridBtn} |
| | | 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} |
| | | width={750} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | onCancel={this.editModalCancel} |
| | |
| | | > |
| | | <TabForm |
| | | type="tabs" |
| | | tabs={this.state.tabviews} |
| | | 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']} |
| | | title={this.state.dict['model.edit']} |
| | | visible={this.state.tableVisible} |
| | | width={'65vw'} |
| | | maskClosable={false} |
| | |
| | | visible={this.state.profileVisible} |
| | | width={'75vw'} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | okText={this.state.dict['header.submit']} |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ profileVisible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | {this.state.card && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? |
| | | {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={this.state.config.columns} |
| | | 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 |
| | | } |
| | |
| | | <VerifyCardExcelIn |
| | | card={this.state.card} |
| | | dict={this.state.dict} |
| | | columns={config.columns} |
| | | wrappedComponentRef={(inst) => this.verifyRef = inst} |
| | | /> : null |
| | | } |
| | |
| | | </Modal> |
| | | {/* 设置全局配置及列表数据源 */} |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | | title={this.state.dict['model.edit']} |
| | | visible={this.state.settingVisible} |
| | | width={700} |
| | | width={750} |
| | | maskClosable={false} |
| | | // onOk={this.settingSave} |
| | | onCancel={() => { // 取消修改 |
| | | this.setState({ |
| | | settingVisible: false |
| | | }) |
| | | }} |
| | | footer={[ |
| | | <Button key="delete" className="mk-btn mk-purple" onClick={this.tableCreatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button>, |
| | | <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> |
| | | <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['model.confirm']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <SettingForm |
| | | dict={this.state.dict} |
| | | menu={this.props.menu} |
| | | data={this.state.config.setting} |
| | | columns={this.state.config.columns} |
| | | inputSubmit={this.settingSave} |
| | | data={config.setting} |
| | | columns={config.columns} |
| | | usefulFields={this.props.permFuncField} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | |
| | | |
| | | const mapStateToProps = (state) => { |
| | | return { |
| | | sysRoles: state.sysRoles, |
| | | permFuncField: state.permFuncField |
| | | } |
| | | } |