| | |
| | | 'header.form.intertype': 'Interface type', |
| | | 'header.form.interface': 'Address of the interface', |
| | | 'header.form.sysInterface': 'The system interface', |
| | | 'header.form.interface.inner': 'Internal', |
| | | 'header.form.interface.outer': 'External', |
| | | 'model.interface.system': '系统', |
| | | 'model.interface.inner': 'Internal', |
| | | 'model.interface.outer': 'External', |
| | | 'header.form.pageTemplate': 'The page template', |
| | | 'model.form.type': 'Type', |
| | | 'model.form.text': 'Text', |
| | |
| | | 'header.form.custom': '自定义', |
| | | 'header.form.datasource': '数据源', |
| | | 'model.form.tablename': 'Table name', |
| | | 'header.form.actionhelp.tablename': '使用系统函数时,请填写数据源。', |
| | | 'header.form.actionhelp.sqlType': '使用系统函数时,请选择类型。', |
| | | 'header.form.action.type': '操作类型', |
| | | 'header.form.action.insert': '添加', |
| | | 'header.form.action.update': '修改', |
| | |
| | | 'model.tooltip.action.guide': '在左侧工具栏《按钮》中,选择对应类型的按钮拖至此处添加,如选择按钮类型为表单、新标签页等含有配置页面的按钮,可在左侧工具栏-按钮-可配置按钮处,点击按钮完成相关配置。注:当设置按钮显示位置为表格时,显示列会增加操作列。', |
| | | 'model.tooltip.column.guide': '在左侧工具栏《显示列》中,选择对应类型的显示列拖至此处添加;或点击《添加显示列》按钮批量添加,选择批量添加时,需提前选择使用表。注:添加合并列时,需设置可选列。', |
| | | 'model.tooltip.tabs.guide': '在左侧工具栏《标签页》中,选择对应类型的标签页拖至此处添加。', |
| | | 'model.tooltip.func.innerface': '内部接口: 可自定义数据处理函数,函数名称需以@ableField等字符开始;未设置时会调用系统函数,使用系统函数需完善数据源及操作类型;', |
| | | 'model.tooltip.func.innerface': '内部接口: 可自定义数据处理函数,函数名称需以@ableField等字符开始;', |
| | | 'model.tooltip.func.outface': '外部接口: 可自定义数据处理函数,提交数据经过内部函数处理后,传入外部接口,未设置时,数据会直接传入外部接口。', |
| | | } |
| | |
| | | 'header.form.intertype': '接口类型', |
| | | 'header.form.interface': '接口地址', |
| | | 'header.form.sysInterface': '系统接口', |
| | | 'header.form.interface.inner': '内部', |
| | | 'header.form.interface.outer': '外部', |
| | | 'model.interface.system': '系统', |
| | | 'model.interface.inner': '内部', |
| | | 'model.interface.outer': '外部', |
| | | 'header.form.pageTemplate': '页面模板', |
| | | 'model.form.type': '类型', |
| | | 'model.form.text': '文本', |
| | |
| | | 'header.form.custom': '自定义', |
| | | 'header.form.datasource': '数据源', |
| | | 'model.form.tablename': '表名', |
| | | 'header.form.actionhelp.tablename': '使用系统函数时,请填写表名,使用自定义函数时,可忽略。', |
| | | 'header.form.actionhelp.sqlType': '使用系统函数时,请选择操作类型,使用自定义函数时,可忽略。', |
| | | 'header.form.action.type': '操作类型', |
| | | 'header.form.action.insert': '添加', |
| | | 'header.form.action.update': '修改', |
| | |
| | | 'model.tooltip.action.guide': '在左侧工具栏《按钮》中,选择对应类型的按钮拖至此处添加,如选择按钮类型为表单、新标签页等含有配置页面的按钮,可在左侧工具栏-按钮-可配置按钮处,点击按钮完成相关配置。注:当设置按钮显示位置为表格时,显示列会增加操作列。', |
| | | 'model.tooltip.column.guide': '在左侧工具栏《显示列》中,选择对应类型的显示列拖至此处添加;或点击《添加显示列》按钮批量添加,选择批量添加时,需提前选择使用表。注:添加合并列时,需设置可选列。', |
| | | 'model.tooltip.tabs.guide': '在左侧工具栏《标签页》中,选择对应类型的标签页拖至此处添加。', |
| | | 'model.tooltip.func.innerface': '内部接口: 可自定义数据处理函数,函数名称需以@ableField等字符开始;未设置时会调用系统函数,使用系统函数需完善数据源及操作类型;', |
| | | 'model.tooltip.func.innerface': '内部接口: 可自定义数据处理函数,函数名称需以@ableField等字符开始;', |
| | | 'model.tooltip.func.outface': '外部接口: 可自定义数据处理函数,提交数据经过内部函数处理后,传入外部接口,未设置时,数据会直接传入外部接口。', |
| | | } |
| | |
| | | }) |
| | | values.linkThdMenu = linkThdMenu |
| | | } |
| | | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.actionhelp.tablename'], |
| | | duration: 5 |
| | | }) |
| | | } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.actionhelp.sqlType'], |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | resolve(values) |
| | | } |
| | | |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | | } |
| | |
| | | text: '系统' |
| | | }, { |
| | | value: 'inner', |
| | | text: Formdict['header.form.interface.inner'] |
| | | text: Formdict['model.interface.inner'] |
| | | }, { |
| | | value: 'outer', |
| | | text: Formdict['header.form.interface.outer'] |
| | | text: Formdict['model.interface.outer'] |
| | | }] |
| | | }, |
| | | { |
| | |
| | | key: 'sqlType', |
| | | label: Formdict['header.form.action.type'], |
| | | initVal: card.sqlType || '', |
| | | tooltip: Formdict['header.form.actionhelp.sqlType'], |
| | | required: false, |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | |
| | | key: 'sql', |
| | | label: Formdict['model.form.tablename'], |
| | | initVal: card.sql || setting.tableName || '', |
| | | tooltip: Formdict['header.form.actionhelp.tablename'], |
| | | required: false |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import UtilsUpdate from '@/utils/utils-update.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | import { refreshTabView } from '@/store/action' |
| | |
| | | return |
| | | } |
| | | |
| | | if (!config.version || config.version < '1.0') { |
| | | // 兼容标签 |
| | | 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 = true |
| | | 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 => { |
| | | _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.fontWeight && _cell.bold === 'true') { |
| | | _cell.fontWeight = 'normal' |
| | | } |
| | | _cell.height = _cell.height || 1 |
| | | |
| | | return _cell |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // 版本兼容 |
| | | config = UtilsUpdate.updateCommonTable(config) |
| | | |
| | | // 权限过滤 |
| | | if (this.props.menuType !== 'HS') { |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import UtilsUpdate from '@/utils/utils-update.js' |
| | | import { modifyTabview } from '@/store/action' |
| | | |
| | | import SubSearch from '@/tabviews/zshare/topSearch' |
| | |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | | let colMap = new Map() |
| | | |
| | | // 旧版本兼容 |
| | | if (!config.version || config.version < '1.0') { |
| | | // 兼容图表 |
| | | if (!config.charts) { |
| | | config.expand = true |
| | | 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 => { |
| | | _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.fontWeight && _cell.bold === 'true') { |
| | | _cell.fontWeight = 'normal' |
| | | } |
| | | _cell.height = _cell.height || 1 |
| | | |
| | | return _cell |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // 版本兼容 |
| | | config = UtilsUpdate.updateSubTable(config) |
| | | |
| | | // 权限过滤 |
| | | if (this.props.menuType !== 'HS') { |
| | |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import UtilsUpdate from '@/utils/utils-update.js' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | |
| | | let _hideCol = [] // 隐藏及合并列中字段的uuid集 |
| | | let colMap = new Map() |
| | | |
| | | // 旧版本兼容 |
| | | if (!config.version || config.version < '1.0') { |
| | | // 兼容图表 |
| | | if (!config.charts) { |
| | | config.expand = true |
| | | 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 => { |
| | | _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.fontWeight && _cell.bold === 'true') { |
| | | _cell.fontWeight = 'normal' |
| | | } |
| | | _cell.height = _cell.height || 1 |
| | | |
| | | return _cell |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // 版本兼容 |
| | | config = UtilsUpdate.updateSubTable(config) |
| | | |
| | | // 仅支持exec、prompt、pop 三种类型按钮 |
| | | if (type === 'calendar') { |
| | |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | if (btn.intertype === 'inner' && !btn.innerFunc) { // 系统存储过程 |
| | | if (btn.intertype === 'system') { // 系统存储过程 |
| | | param.func = 'sPC_TableData_InUpDe' |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | |
| | | return |
| | | } |
| | | |
| | | if ( |
| | | btn.intertype === 'inner' && !btn.innerFunc && |
| | | ((setting.interType === 'inner' && setting.innerFunc) || setting.interType === 'outer') |
| | | ) { |
| | | if (btn.intertype === 'system' && setting.interType !== 'system') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '导出按钮配置错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.intertype === 'inner' && !btn.innerFunc) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '导出按钮配置错误!', |
| | |
| | | } |
| | | } |
| | | |
| | | if (btn.intertype === 'inner' && !btn.innerFunc && !viewParam.arr_field) { // 使用系统函数 |
| | | if (btn.intertype === 'system' && !viewParam.arr_field) { // 使用系统函数 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未设置显示列!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.intertype === 'inner' && !btn.innerFunc && btn.verify && btn.verify.enable === 'true') { |
| | | } else if (btn.intertype === 'system' && btn.verify && btn.verify.enable === 'true') { |
| | | this.setState({search: fromJS(viewParam.search).toJS()}) |
| | | } |
| | | |
| | | this.updateStatus('start', name) |
| | | |
| | | if (btn.pagination !== 'true') { |
| | | if (btn.intertype === 'inner' && !btn.innerFunc) { // 使用系统函数 |
| | | if (btn.intertype === 'system') { // 使用系统函数 |
| | | let param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | |
| | | }, () => { |
| | | this.execError({}) |
| | | }) |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 使用内部函数 |
| | | } else if (btn.intertype === 'inner') { // 使用内部函数 |
| | | let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) |
| | | param.func = btn.innerFunc |
| | | |
| | |
| | | getExcelOutData = (viewParam, pageIndex, pageSize, data) => { |
| | | const { btn } = this.props |
| | | let param = null |
| | | if (btn.intertype === 'inner' && !btn.innerFunc) { // 使用系统函数 |
| | | if (btn.intertype === 'system') { // 使用系统函数 |
| | | if (!viewParam.arr_field) { |
| | | this.execError({ErrCode: 'N', message: '未设置显示列!'}) |
| | | return |
| | | } |
| | | |
| | | param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | } else if (btn.intertype === 'inner' && btn.innerFunc) { // 使用内部函数 |
| | | } else if (btn.intertype === 'inner') { // 使用内部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | param.func = btn.innerFunc |
| | | |
| | |
| | | // 数据选择类型校验 |
| | | this.actionSettingError() |
| | | return |
| | | } else if (btn.intertype === 'inner') { |
| | | // 使用内部接口时,内部函数和数据源不可同时为空, 使用系统函数时,类型不可为空 |
| | | if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) { |
| | | } else if (btn.intertype === 'system') { |
| | | // 使用内部接口时,操作类型和数据源不可为空 |
| | | if (!btn.sql || !btn.sqlType) { |
| | | this.actionSettingError() |
| | | return |
| | | } else if (data.length === 0 && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | } else if (data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用创建凭证函数,需要选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } else if (btn.intertype === 'inner') { |
| | | // 使用内部接口时,内部函数不可为空 |
| | | if (!btn.innerFunc) { |
| | | this.actionSettingError() |
| | | return |
| | | } |
| | | } else if (btn.intertype === 'outer') { |
| | |
| | | this.actionSettingError() |
| | | return |
| | | } |
| | | } else if (!['inner', 'outer'].includes(btn.intertype)) { |
| | | } else if (!['inner', 'outer', 'system'].includes(btn.intertype)) { |
| | | // 接口类型错误 |
| | | this.actionSettingError() |
| | | return |
| | |
| | | */ |
| | | execSubmit = (data, _resolve, formdata) => { |
| | | const { setting, columns, btn } = this.props |
| | | if (btn.intertype === 'inner') { |
| | | if (btn.intertype === 'inner' || btn.intertype === 'system') { |
| | | // 执行方式为多行拼接,且打开方式为表单时,会转为循环发送请求 |
| | | // 打开方式为模态框,使用内部函数添加(有批量添加场景,已去除) |
| | | if ( |
| | |
| | | } |
| | | |
| | | new Promise(resolve => { |
| | | if (btn.intertype === 'inner' && !btn.innerFunc) { |
| | | if (btn.intertype === 'system') { // 使用系统时,直接从表格或表单中选取数据 |
| | | let printcell = {} |
| | | |
| | | printcell.printType = formdata.printType || '' |
| | |
| | | _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : '' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | | // 数据源 |
| | | if (_config.setting.interType === 'inner' && !_config.setting.innerFunc) { |
| | | _config.setting.interType = 'system' |
| | | } |
| | | |
| | | this.setState({ |
| | | openEdition: menu.open_edition || '', |
| | | optionLibs: optionLibs, |
| | |
| | | calvaild = false |
| | | } |
| | | |
| | | if (((config.setting.interType === 'inner' && !config.setting.innerFunc) || config.setting.interType === 'system') && config.setting.default !== 'false' && !config.setting.dataresource) { |
| | | if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) { |
| | | return '菜单尚未设置数据源,不可启用!' |
| | | } else if (config.columns.length === 0) { |
| | | return '菜单尚未设置数据字段,不可启用!' |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsUpdate from '@/utils/utils-update.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | |
| | |
| | | _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : '' |
| | | _config.easyCode = _config.easyCode || '' |
| | | |
| | | if (!_config.version || _config.version < '1.0') { |
| | | // 配置默认值,兼容 |
| | | _config.version = '1.0' |
| | | _config.Template = 'CommonTable' |
| | | |
| | | 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 |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // // 兼容接口类型 |
| | | // _config.action = _config.action.map(item => { |
| | | // if (item.intertype === 'inner' && !item.innerFunc) { |
| | | // item.intertype = 'system' |
| | | // } |
| | | // return item |
| | | // }) |
| | | } |
| | | // 版本兼容 |
| | | _config = UtilsUpdate.updateCommonTable(_config) |
| | | |
| | | let _oriActions = [] |
| | | if (_config.type === 'user') { |
| | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.actionhelp.tablename'], |
| | | message: '使用系统函数时,请填写表名,使用自定义函数时,可忽略。', |
| | | duration: 5 |
| | | }) |
| | | } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.actionhelp.sqlType'], |
| | | message: '使用系统函数时,请选择操作类型,使用自定义函数时,可忽略。', |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | |
| | | initialValue: interType |
| | | })( |
| | | <Radio.Group onChange={this.onChange}> |
| | | <Radio value="inner">{dict['header.form.interface.inner']}</Radio> |
| | | <Radio value="outer">{dict['header.form.interface.outer']}</Radio> |
| | | <Radio value="inner">{dict['model.interface.inner']}</Radio> |
| | | <Radio value="outer">{dict['model.interface.outer']}</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd' |
| | | import { btnIcons, btnClasses, formRule } from '@/utils/option.js' |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | const actionTypeOptions = { |
| | | pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'], |
| | | prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'], |
| | | exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'], |
| | | excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError'], |
| | | excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'], |
| | | popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'], |
| | | tab: ['label', 'Ot', 'OpenType', 'tabTemplate', 'icon', 'class', 'position'], |
| | | innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'], |
| | | funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | text: this.props.dict['header.form.requiredOnce'] |
| | | }], |
| | | insertUpdateOptions: [{ |
| | | value: '', |
| | | text: this.props.dict['model.empty'] |
| | | }, { |
| | | value: 'insert', |
| | | text: this.props.dict['header.form.action.insert'] |
| | | }, { |
| | |
| | | text: this.props.dict['header.form.action.audit'] |
| | | }], |
| | | deleteOptions: [{ |
| | | value: '', |
| | | text: this.props.dict['model.empty'] |
| | | }, { |
| | | value: 'LogicDelete', |
| | | text: this.props.dict['header.form.action.LogicDelete'] |
| | | }, { |
| | |
| | | const { card } = this.props |
| | | |
| | | let _menulist = this.props.formlist.filter(form => form.key === 'linkmenu')[0] || '' |
| | | let _opentype = card.OpenType // 打开方式 |
| | | let _tabType = card.tabType || 'SubTable' // 按钮为弹窗(标签)时,标签的类型 |
| | | let _options = null // 选项列表 |
| | | let _opentype = card.OpenType // 打开方式 |
| | | let _tabType = card.tabType || 'SubTable' // 按钮为弹窗(标签)时,标签的类型 |
| | | let _intertype = card.intertype || 'system' // 接口类型 |
| | | let _funcType = card.funcType || '' // 功能按钮默认类型 |
| | | let _tabTemplate = card.tabTemplate // 按钮为标签页时,标签类型:三级菜单或表单标签页 |
| | | |
| | | if (card.execMode) { // 转换打印时打开方式 |
| | | if (card.execMode) { // 转换打印时打开方式 |
| | | _opentype = 'funcbutton' |
| | | } else if (_opentype === 'outerpage') { |
| | | card.pageTemplate = 'custom' |
| | |
| | | } |
| | | |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面,可选模板(自定义时,可填入外部链接) |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | if (card.pageTemplate === 'custom') { |
| | | _options.push('url', 'joint') |
| | | } |
| | | } else if (_opentype === 'blank' || _opentype === 'tab') { // 新标签或当前页面替换 |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabTemplate'] |
| | | if (card.tabTemplate === 'ThdMenu') { |
| | | _options.push('linkmenu') |
| | | } |
| | | } else if (_opentype === 'popview') { // 模态框标签页 |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (_opentype === 'excelOut') { // 导入导出 |
| | | if (card.intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] |
| | | } |
| | | } else if (_opentype === 'excelIn') { // 导入导出 |
| | | if (card.intertype === 'outer') { |
| | | _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (_opentype === 'funcbutton') { |
| | | if (!card.funcType) { |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (card.funcType === 'changeuser') { |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (card.funcType === 'print') { |
| | | if (card.intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } |
| | | } else { |
| | | if (card.intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } |
| | | } |
| | | let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate, _tabTemplate) |
| | | |
| | | this.setState({ |
| | | openType: _opentype, |
| | | menulist: _menulist.options || [], |
| | | interType: card.intertype || 'inner', |
| | | interType: _intertype, |
| | | position: card.position || 'toolbar', |
| | | funcType: card.funcType, |
| | | funcType: _funcType, |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'class') { |
| | | item.options = btnClasses |
| | |
| | | } |
| | | } |
| | | |
| | | getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate) => { |
| | | let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 选项列表 |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面,可选模板(自定义时,可填入外部链接) |
| | | if (_pageTemplate === 'custom') { |
| | | _options.push('url', 'joint') |
| | | } |
| | | } else if (_opentype === 'blank' || _opentype === 'tab') { // 新标签或当前页面替换 |
| | | if (_tabTemplate === 'ThdMenu') { |
| | | _options.push('linkmenu') |
| | | } |
| | | } else if (_opentype === 'excelOut') { // 导入导出 |
| | | if (_intertype === 'outer') { |
| | | _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') |
| | | } else if (_intertype === 'inner') { |
| | | _options.push('innerFunc') |
| | | } |
| | | } else if (_opentype === 'excelIn') { // 导入导出 |
| | | if (_intertype === 'outer') { |
| | | _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') |
| | | } else if (_intertype === 'inner') { |
| | | _options.push('innerFunc') |
| | | } |
| | | } else if (_opentype === 'funcbutton') { |
| | | if (_funcType === 'print') { |
| | | if (_intertype === 'outer') { |
| | | _options.push('execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'execSuccess', 'execError') |
| | | } else if (_intertype === 'inner') { |
| | | _options.push('execMode', 'intertype', 'innerFunc', 'Ot', 'execSuccess', 'execError') |
| | | } else if (_intertype === 'system') { |
| | | _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError') |
| | | } |
| | | } |
| | | } else if (_opentype !== 'popview') { // 打开方式不是弹窗页面时 |
| | | if (_intertype === 'outer') { |
| | | _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') |
| | | } else if (_intertype === 'inner') { |
| | | _options.push('innerFunc') |
| | | } else { |
| | | _options.push('sql', 'sqlType') |
| | | } |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | | /** |
| | | * @description 下拉切换 |
| | | * 1、打开方式切换,重置可见表单和表单值 |
| | |
| | | const { card } = this.props |
| | | |
| | | if (key === 'OpenType') { |
| | | let _options = null |
| | | if (value === 'innerpage') { |
| | | _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] |
| | | if (card.pageTemplate === 'custom') { |
| | | _options.push('url', 'joint') |
| | | } |
| | | } else if (value === 'blank' || value === 'tab') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabTemplate'] |
| | | if (card.tabTemplate === 'ThdMenu') { |
| | | _options.push('linkmenu') |
| | | } |
| | | } else if (value === 'popview') { |
| | | _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] |
| | | } else if (value === 'excelOut') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] |
| | | } |
| | | } else if (value === 'excelIn') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (value === 'funcbutton') { |
| | | if (!this.state.funcType) { |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (this.state.funcType === 'changeuser') { |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (this.state.funcType === 'print') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } |
| | | } else { |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | |
| | | let _options = this.getOptions(value, this.state.interType, this.state.funcType, card.pageTemplate, card.tabTemplate) |
| | | let _fieldval = {} |
| | | |
| | | let _formlist = this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | |
| | | this.props.form.setFieldsValue(_fieldval) |
| | | }) |
| | | } else if (key === 'funcType') { |
| | | let _options = null |
| | | if (!value) { |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (value === 'changeuser') { |
| | | _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] |
| | | } else if (value === 'print') { |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } |
| | | let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate) |
| | | let _fieldval = {} |
| | | |
| | | this.setState({ |
| | | funcType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | |
| | | } |
| | | |
| | | onChange = (e, key) => { |
| | | const { openType } = this.state |
| | | const { openType, funcType } = this.state |
| | | let value = e.target.value |
| | | |
| | | if (key === 'intertype') { |
| | | let _options = null |
| | | if (openType === 'excelOut') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] |
| | | } |
| | | } else if (openType === 'excelIn') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] |
| | | } |
| | | } else if (openType === 'funcbutton') { |
| | | if (value === 'outer') { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] |
| | | } |
| | | } else { |
| | | if (value === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] |
| | | } |
| | | } |
| | | let _options = this.getOptions(openType, value, funcType, '', '') |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'interface') { |
| | | if (item.key === 'innerFunc') { |
| | | item.required = value === 'inner' |
| | | } else if (item.key === 'interface') { |
| | | item.readonly = false |
| | | } else if (item.key === 'sysInterface') { |
| | | item.initVal = 'false' |
| | |
| | | if (values.OpenType === 'excelIn') { |
| | | values.position = 'toolbar' |
| | | } else if (values.OpenType === 'excelOut') { |
| | | if (values.intertype === 'inner' && !values.innerFunc) { |
| | | if ((setting.interType === 'inner' && setting.innerFunc) || setting.interType === 'outer') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '表格数据查询未使用数据源,导出Excel使用内部接口时,需自定义内部函数!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | if (values.intertype === 'system' && setting.interType !== 'system') { // 导出excel需使用查询数据源 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '表格数据查询未使用系统函数,导出Excel不可使用系统函数!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | values.position = 'toolbar' |
| | |
| | | }) |
| | | values.linkThdMenu = linkThdMenu |
| | | } |
| | | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.actionhelp.tablename'], |
| | | duration: 5 |
| | | }) |
| | | } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.actionhelp.sqlType'], |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | resolve(values) |
| | | } |
| | | resolve(values) |
| | | } else { |
| | | reject(err) |
| | | } |
| | |
| | | newcard.tabType = 'SubTable' |
| | | newcard.icon = '' |
| | | newcard.class = 'default' |
| | | newcard.intertype = 'inner' |
| | | newcard.intertype = 'system' |
| | | newcard.method = 'POST' |
| | | newcard.position = 'toolbar' |
| | | newcard.execSuccess = 'grid' |
| | |
| | | })(<InputNumber min={0} max={100} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | {card.intertype === 'inner' && !card.innerFunc ? <Col span={8}> |
| | | {card.intertype === 'system' ? <Col span={8}> |
| | | <Form.Item label={'默认sql'}> |
| | | <Radio.Group value={verify.default} onChange={this.onOptionChange}> |
| | | <Radio value="true">执行</Radio> |
| | |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab={ |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 唯一性验证 |
| | | {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null} |
| | |
| | | pagination={false} |
| | | /> |
| | | </TabPane> : null} |
| | | {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab={ |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 自定义脚本 |
| | | {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} |
| | |
| | | }) |
| | | } |
| | | |
| | | if (card.intertype !== 'inner' || card.innerFunc) { |
| | | if (card.intertype !== 'system') { |
| | | _verify.enable = 'false' |
| | | } |
| | | |
| | | let defaultscript = '' |
| | | if (!_verify.script && card.intertype === 'inner' && !card.innerFunc) { |
| | | if (!_verify.script && card.intertype === 'system') { |
| | | let search = this.formatSearch(config.search) |
| | | search = Utils.joinMainSearchkey(search) |
| | | search = search ? 'where ' + search : '' |
| | |
| | | pagination={false} |
| | | /> |
| | | </TabPane> |
| | | {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab={ |
| | | {card.intertype === 'system' ? <TabPane tab={ |
| | | <span> |
| | | 自定义脚本 |
| | | {verify.enable === 'true' ? <span className="count-tip">1</span> : null} |
| | |
| | | sql: '' |
| | | }) |
| | | this.props.scriptSubmit(values) |
| | | }, () => { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | |
| | | } |
| | | |
| | | changeTab = (val) => { |
| | | const { activeKey } = this.state |
| | | const { activeKey, setting } = this.state |
| | | |
| | | this.setState({loading: true}) |
| | | if (activeKey === 'setting') { |
| | | this.settingForm.handleConfirm().then(res => { |
| | | if (res.interType !== 'system' && val === 'scripts') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用系统接口时,才可以设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({loading: false}) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | setting: res |
| | | }, () => { |
| | | this.sqlverify(() => { // 验证成功 |
| | | if (res.interType === 'system') { // 系统接口,sql验证 |
| | | this.sqlverify(() => { // 验证成功 |
| | | this.setState({ |
| | | activeKey: val, |
| | | loading: false |
| | | }) |
| | | }, () => { // 验证失败 |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }, activeKey) |
| | | } else { |
| | | this.setState({ |
| | | activeKey: val, |
| | | loading: false |
| | | }) |
| | | }, () => { // 验证失败 |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }, true) |
| | | } |
| | | }) |
| | | }, () => { |
| | | this.setState({loading: false}) |
| | | }) |
| | | } else if (activeKey === 'columns') { |
| | | if (setting.interType !== 'system' && val === 'scripts') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用系统接口时,才可以设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({loading: false}) |
| | | return |
| | | } else if (setting.interType !== 'system') { |
| | | this.setState({ |
| | | activeKey: val, |
| | | loading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.sqlverify(() => { // 验证成功 |
| | | this.setState({ |
| | | activeKey: val, |
| | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }, true) |
| | | }, activeKey) |
| | | } else if (activeKey === 'scripts') { |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | }, true) |
| | | }, activeKey) |
| | | } |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | setting: res |
| | | }, () => { |
| | | this.sqlverify(() => { resolve({setting: res, columns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting: res, columns, scripts }) }, reject, 'submit') |
| | | }) |
| | | }, () => { |
| | | reject() |
| | | }) |
| | | } else if (activeKey === 'columns') { |
| | | this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, 'submit') |
| | | } else if (activeKey === 'scripts') { |
| | | let _loading = false |
| | | if (this.scriptsForm && this.scriptsForm.state.editItem) { |
| | |
| | | return |
| | | } |
| | | |
| | | this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, false) |
| | | this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, 'submit') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | sqlverify = (resolve, reject, change = false, testScripts) => { |
| | | sqlverify = (resolve, reject, type, testScripts) => { |
| | | const { searches } = this.props |
| | | const { columns, setting, scripts, activeKey } = this.state |
| | | const { columns, setting, scripts } = this.state |
| | | let _scripts = [] |
| | | |
| | | if (testScripts) { |
| | |
| | | _scripts = scripts.filter(item => item.status !== 'false') |
| | | } |
| | | |
| | | if (!change && setting.interType === 'system' && !setting.innerFunc && setting.execute === 'false' && _scripts.length === 0) { |
| | | if (type === 'submit' && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,请添加自定义脚本!', |
| | |
| | | } |
| | | |
| | | // 不使用默认sql切换 |
| | | if (change && activeKey === 'setting' && setting.interType === 'system' && setting.execute === 'false') { |
| | | if (type === 'setting' && setting.interType === 'system' && setting.execute === 'false') { |
| | | resolve() |
| | | } else if (change && activeKey === 'scripts' && _scripts.length === 0) { |
| | | } else if (type === 'scripts' && _scripts.length === 0) { |
| | | resolve() |
| | | } else if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { |
| | | } else if (setting.interType === 'system' && (setting.execute !== 'false' || _scripts.length > 0)) { |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | LText: SettingUtils.getDebugSql(setting, _scripts, columns, searches) |
| | |
| | | if (values.interType === 'system' && values.execute !== 'false' && !values.dataresource) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请填写内部函数或数据源!', |
| | | message: '请填写数据源!', |
| | | duration: 5 |
| | | }) |
| | | reject() |
| | |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | |
| | | rules.push({ |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '内部函数!' |
| | | }, { |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }) |
| | |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '表名!' |
| | | }, |
| | | } |
| | | ] |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | |
| | | _setting.sysInterface = _setting.sysInterface || 'false' // 是否为系统接口 |
| | | _setting.interface = _setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (_setting.interface || '') |
| | | |
| | | if (_setting.interType === 'inner' && !_setting.innerFunc) { // 修改已有数据 |
| | | _setting.interType = 'system' |
| | | } |
| | | |
| | | // 显示列字段,用于查询 |
| | | let columns = [] |
| | | let arr_field = [] |
| | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsUpdate from '@/utils/utils-update.js' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import SearchComponent from '@/templates/sharecomponent/searchcomponent' |
| | |
| | | |
| | | let _activeKey = editSubTab ? editSubTab.activeKey : editTab.activeKey |
| | | |
| | | if (!_config.version || _config.version < '1.0') { |
| | | // 配置默认值,兼容 |
| | | _config.version = '1.0' |
| | | |
| | | // 兼容图表 |
| | | 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 |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | // 版本兼容 |
| | | _config = UtilsUpdate.updateSubTable(_config) |
| | | |
| | | this.setState({ |
| | | openEdition: editSubTab ? (editSubTab.open_edition || '') : (editTab.open_edition || ''), |
| | |
| | | type: 'view', |
| | | subtype: 'view', |
| | | uuid: _config.uuid, |
| | | intertype: _config.setting.interType || 'inner', |
| | | intertype: _config.setting.interType || 'system', |
| | | interface: _config.setting.interface || '', |
| | | tableName: _config.setting.tableName || '', |
| | | innerFunc: _config.setting.innerFunc || '', |
| | |
| | | _config.action.forEach(item => { |
| | | let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') |
| | | |
| | | if (item.OpenType === 'excelOut' && item.intertype === 'inner' && !item.innerFunc) { |
| | | if (item.OpenType === 'excelOut' && item.intertype === 'system') { |
| | | tablename = _config.setting.tableName || '' |
| | | } |
| | | |
| | |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'inner', text: Formdict['header.form.interface.inner'] }, |
| | | { value: 'outer', text: Formdict['header.form.interface.outer'] } |
| | | { value: 'inner', text: Formdict['model.interface.inner'] }, |
| | | { value: 'outer', text: Formdict['model.interface.outer'] } |
| | | ] |
| | | }, |
| | | { |
| | |
| | | type: 'radio', |
| | | key: 'intertype', |
| | | label: Formdict['header.form.intertype'], |
| | | initVal: card.intertype || 'inner', |
| | | initVal: card.intertype || 'system', |
| | | required: true, |
| | | options: [{ |
| | | value: 'system', |
| | | text: Formdict['model.interface.system'] |
| | | }, { |
| | | value: 'inner', |
| | | text: Formdict['header.form.interface.inner'] |
| | | text: Formdict['model.interface.inner'] |
| | | }, { |
| | | value: 'outer', |
| | | text: Formdict['header.form.interface.outer'] |
| | | text: Formdict['model.interface.outer'] |
| | | }] |
| | | }, |
| | | { |
| | |
| | | key: 'sqlType', |
| | | label: Formdict['header.form.action.type'], |
| | | initVal: card.sqlType || '', |
| | | tooltip: Formdict['header.form.actionhelp.sqlType'], |
| | | required: false, |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sql', |
| | | label: Formdict['model.form.tablename'], |
| | | initVal: card.sql || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sql', |
| | | label: Formdict['model.form.tablename'], |
| | | initVal: card.sql || config.setting.tableName || '', |
| | | tooltip: Formdict['header.form.actionhelp.tablename'], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: Formdict['header.form.innerFunc'], |
| | | initVal: card.innerFunc || '', |
| | | tooltip: functip, |
| | | fields: permFuncField, |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | let display = false |
| | | if (card.intertype === 'inner' && !card.innerFunc) { |
| | | display = true |
| | | } |
| | | |
| | | return ( |
| | | <div id="verify-card-box-tab"> |
| | | {display ? <Tabs defaultActiveKey="1" className="verify-card-box"> |
| | | {card.intertype === 'system' ? <Tabs defaultActiveKey="1" className="verify-card-box"> |
| | | <TabPane tab="基础验证" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | |
| | | </Form> |
| | | </TabPane> |
| | | </Tabs> : null} |
| | | {!display ? <Tabs defaultActiveKey="7" className="verify-card-box"> |
| | | {!card.intertype !== 'system' ? <Tabs defaultActiveKey="7" className="verify-card-box"> |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
New file |
| | |
| | | import { fromJS } from 'immutable' |
| | | import Utils from './utils.js' |
| | | |
| | | export default class UpdateUtils { |
| | | /** |
| | | * @description 升级主表信息 |
| | | * @param {Object} config 页面配置信息 |
| | | * @return {Object} config |
| | | */ |
| | | static updateCommonTable (config) { |
| | | if (!config.version || config.version < '1.0') { |
| | | // 兼容标签 |
| | | 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 = true |
| | | 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 => { |
| | | _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.fontWeight && _cell.bold === 'true') { |
| | | _cell.fontWeight = 'normal' |
| | | } |
| | | _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 |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (config.version < '1.1') { |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc) { |
| | | config.setting.interType = 'system' |
| | | } |
| | | // 兼容接口类型 |
| | | config.action = config.action.map(item => { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | item.intertype = 'system' |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | config.version = '1.1' |
| | | config.Template = 'CommonTable' |
| | | |
| | | return config |
| | | } |
| | | |
| | | /** |
| | | * @description 升级子表信息 |
| | | * @param {Object} config 页面配置信息 |
| | | * @return {Object} config |
| | | */ |
| | | static updateSubTable (config) { |
| | | if (!config.version || config.version < '1.0') { |
| | | // 兼容图表 |
| | | 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 |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (config.version < '1.1') { |
| | | if (config.setting.interType === 'inner' && !config.setting.innerFunc) { |
| | | config.setting.interType = 'system' |
| | | } |
| | | // 兼容接口类型 |
| | | config.action = config.action.map(item => { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | item.intertype = 'system' |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | config.version = '1.1' |
| | | config.Template = 'SubTable' |
| | | |
| | | return config |
| | | } |
| | | } |
| | |
| | | let _sqlInsert = '' |
| | | let _sqlBottom = '' |
| | | |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | if (item.intertype === 'system') { |
| | | let _uniquesql = '' |
| | | if (btn.uniques && btn.uniques.length > 0) { |
| | | btn.uniques.forEach(unique => { |