| | |
| | | |
| | | if (!content) return |
| | | |
| | | if (item.help) { |
| | | fields.push( |
| | | <Col span={item.span || 12} key={index}> |
| | | <Form.Item label={label} help={<span style={{fontSize: '12px'}}>{item.help}</span>}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: item.rules |
| | | })(content)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | fields.push( |
| | | <Col span={item.span || 12} key={index}> |
| | | <Form.Item label={label}> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | | return fields |
| | |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { interType } = this.state |
| | | const { interType, callbackType } = this.state |
| | | const fields = [] |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | } else if (item.key === 'output') { |
| | | if (interType === 'system') { |
| | | if (interType === 'system' || ((interType === 'outer' || interType === 'custom') && callbackType === 'script')) { |
| | | _rules = [{ |
| | | pattern: /^@[0-9a-zA-Z_]+@?$/, |
| | | message: '变量以@符开头,可使用字母、数字以及_' |
| | |
| | | color: #1890ff; |
| | | cursor: pointer; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | float: none; |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | } |
| | | .textarea { |
| | | .ant-col-sm-7 { |
| | | width: 14%; |
| | |
| | | { max: formRule.func.max, message: formRule.func.maxMessage } |
| | | ) |
| | | } else if (item.key === 'output') { |
| | | if (this.record.intertype === 'system') { |
| | | if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { |
| | | rules = [{ |
| | | pattern: /^@[0-9a-zA-Z_]+@?$/, |
| | | message: '变量以@符开头,可使用字母、数字以及_' |
| | |
| | | ] |
| | | |
| | | let getTabs = (list) => { |
| | | return list.filter(item => { |
| | | if (item.type !== 'tabs') return false |
| | | let _list = [] |
| | | list.forEach(item => { |
| | | if (item.type !== 'tabs') return |
| | | |
| | | item.children = item.children.map(cell => { |
| | | cell.children = getTabs(cell.children) |
| | | return cell |
| | | _list.push({ |
| | | value: item.uuid, |
| | | label: item.name, |
| | | children: item.subtabs.map(cell => { |
| | | let children = getTabs(cell.components) |
| | | |
| | | if (children.length === 0) { |
| | | children = null |
| | | } |
| | | return { |
| | | value: cell.uuid, |
| | | label: cell.label, |
| | | children: children |
| | | } |
| | | }) |
| | | return item |
| | | }) |
| | | }) |
| | | return _list |
| | | } |
| | | |
| | | // if (type === 'editable') { |
| | |
| | | // } |
| | | // ] |
| | | // } |
| | | |
| | | let tabs = getTabs(JSON.parse(JSON.stringify(modules))) |
| | | let tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components))) |
| | | |
| | | let pageTemps = [ |
| | | { value: 'billprint', text: '单据打印' }, |
| | |
| | | editab.hide = res.hide || 'false' |
| | | editab.backgroundColor = res.backgroundColor |
| | | editab.controlVal = res.controlVal || '' |
| | | editab.selectVal = res.selectVal || '' |
| | | editab.blacklist = res.blacklist |
| | | |
| | | if (editab.uuid) { |
| | |
| | | field: 'controlVal', |
| | | label: '隐藏标记', |
| | | initval: tab.controlVal || '', |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。', |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。注:多个值请用逗号分隔。', |
| | | required: false, |
| | | // forbid: appType === 'mob', |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'selectVal', |
| | | label: '选中标记', |
| | | initval: tab.selectVal || '', |
| | | tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | | let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, uuid) || [] |
| | | modules.push({ |
| | | value: 'preview', |
| | | label: '上一页(url参数)' |
| | | }) |
| | | |
| | | if (roleList) { |
| | | try { |
| | |
| | | label: '上级组件', |
| | | initval: setting.supModule || [], |
| | | tooltip: '标签组可以选择上级组件,填入禁用字段,用于控制标签隐藏。', |
| | | help: '用于控制标签页隐藏。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: modules, |
| | | controlFields: [ |
| | | {field: 'controlField', notNull: true}, |
| | | ], |
| | | // forbid: appType === 'mob', |
| | | }, |
| | | { |
| | | type: 'text', |
| | |
| | | initval: setting.controlField || '', |
| | | tooltip: '用于控制标签隐藏的字段,在标签中填入隐藏标记。', |
| | | required: true, |
| | | // forbid: appType === 'mob', |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'selectField', |
| | | label: '选中字段', |
| | | initval: setting.selectField || '', |
| | | tooltip: '用于控制标签页初始化选中,在标签中填入选中标记,注:数据源于url参数。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | |
| | | editab.hide = res.hide || 'false' |
| | | editab.backgroundColor = res.backgroundColor |
| | | editab.controlVal = res.controlVal || '' |
| | | editab.selectVal = res.selectVal || '' |
| | | editab.blacklist = res.blacklist |
| | | |
| | | if (editab.uuid) { |
| | |
| | | field: 'controlVal', |
| | | label: '隐藏标记', |
| | | initval: tab.controlVal || '', |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。', |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。注:多个值请用逗号分隔。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'selectVal', |
| | | label: '选中标记', |
| | | initval: tab.selectVal || '', |
| | | tooltip: '当选中字段值与选中标记相等时,标签页默认选中。', |
| | | required: false |
| | | }, |
| | | { |
| | |
| | | */ |
| | | export function getTabsSetForm(setting, uuid) { |
| | | let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, uuid) || [] |
| | | modules.push({ |
| | | value: 'preview', |
| | | label: '上一页(url参数)' |
| | | }) |
| | | |
| | | const tabForm = [ |
| | | { |
| | |
| | | label: '上级组件', |
| | | initval: setting.supModule || [], |
| | | tooltip: '标签组可以选择上级组件,填入禁用字段,用于控制标签隐藏。', |
| | | help: '用于控制标签页隐藏。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: modules, |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'selectField', |
| | | label: '选中字段', |
| | | initval: setting.selectField || '', |
| | | tooltip: '用于控制标签页初始化选中,在标签中填入选中标记,注:数据源于url参数。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'color', |
| | | field: 'backgroundColor', |
| | | label: '背景(标题栏)', |
| | |
| | | if (config.setting.autoSwitch === 'true' && config.subtabs.length > 1 && config.setting.interval) { |
| | | this.autoSwitch(config.setting.interval) |
| | | } |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | |
| | | if (config.activeKey) { |
| | | let node = document.getElementById('tab' + config.activeKey) |
| | | node && node.click() |
| | | } |
| | | |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | /** |
| | |
| | | tabs: {...tabs, subtabs: []} |
| | | }) |
| | | } else { |
| | | let val = data[tabs.setting.controlField] === undefined ? '' : data[tabs.setting.controlField] + '' |
| | | let val = '' |
| | | Object.keys(data).forEach(key => { |
| | | if (key.toLowerCase() === tabs.setting.controlField) { |
| | | val = data[key] |
| | | } |
| | | }) |
| | | this.setState({ |
| | | tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => { |
| | | if (tab.controlVal === val) { |
| | | return false |
| | | } else if (/,/ig.test(tab.controlVal)) { |
| | | return tab.controlVal.split(',').includes(val) |
| | | return !tab.controlVal.split(',').includes(val) |
| | | } |
| | | return true |
| | | })} |
| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { permAction, param } = this.props |
| | | const { permAction } = this.props |
| | | |
| | | let _param = { |
| | | func: 'sPC_Get_LongParam', |
| | |
| | | let roleId = sessionStorage.getItem('role_id') || '' // 角色ID |
| | | let balMap = new Map() |
| | | let skip = config.permission === 'false' || window.GLOB.mkHS |
| | | config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip) |
| | | let param = this.props.param || {} // url参数 |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | |
| | | |
| | | component.search = component.search.map(item => { |
| | | item.oriInitval = item.initval |
| | | if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) { |
| | | if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | let params = [] |
| | | let BID = param && param.$BID ? param.$BID : '' |
| | | let BID = param.$BID || '' |
| | | let inherit = {} |
| | | |
| | | if (config.cacheUseful === 'true') { // 缓存继承 |
| | |
| | | } |
| | | if (config.urlFields) { |
| | | config.urlFields.forEach(field => { |
| | | let val = `'${param ? (param[field] || '') : ''}'` |
| | | let val = `'${param[field] || ''}'` |
| | | regs.push({ |
| | | reg: new RegExp('@' + field + '@', 'ig'), |
| | | value: val |
| | |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, roleId, permAction, balMap, skip) => { |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam) => { |
| | | return components.filter(item => { |
| | | |
| | | if (item.style && item.style.boxShadow) { |
| | |
| | | return true |
| | | }) |
| | | |
| | | if (item.setting.supModule) { |
| | | let pid = item.setting.supModule.pop() |
| | | item.setting.supModule = pid || '' |
| | | |
| | | if (item.setting.supModule) { |
| | | item.setting.controlField = item.setting.controlField.toLowerCase() |
| | | |
| | | if (item.setting.supModule === 'preview') { |
| | | item.setting.supModule = '' |
| | | let val = '' |
| | | Object.keys(urlparam).forEach(key => { |
| | | if (key.toLowerCase() === item.setting.controlField) { |
| | | val = urlparam[key] |
| | | } |
| | | }) |
| | | |
| | | item.subtabs = item.subtabs.filter(tab => { |
| | | if (tab.controlVal === val) { |
| | | return false |
| | | } else if (/,/ig.test(tab.controlVal)) { |
| | | return !tab.controlVal.split(',').includes(val) |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (item.setting.selectField) { |
| | | item.setting.selectField = item.setting.selectField.toLowerCase() |
| | | |
| | | let val = '' |
| | | Object.keys(urlparam).forEach(key => { |
| | | if (key.toLowerCase() === item.setting.selectField) { |
| | | val = urlparam[key] |
| | | } |
| | | }) |
| | | |
| | | let activeKey = '' |
| | | |
| | | item.subtabs.forEach(tab => { |
| | | if (!activeKey && tab.selectVal === val) { |
| | | activeKey = tab.uuid |
| | | } |
| | | }) |
| | | |
| | | item.activeKey = activeKey |
| | | } |
| | | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip) |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | }) |
| | | }) |
| | | item.parentIds = supIds |
| | | |
| | | return true |
| | | } else if (item.type === 'group') { |
| | | if ( |
| | | item.setting.blacklist && item.setting.blacklist.length > 0 && |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip) |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | | if ( |
| | | item.plot.blacklist && item.plot.blacklist.length > 0 && |
| | |
| | | } |
| | | }) |
| | | |
| | | if (btn.output) { |
| | | _backCustomScript += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` |
| | | } else { |
| | | _backCustomScript += ` |
| | | aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` |
| | | } |
| | | |
| | | let sql = [...lineMap.values()].map(item => (` |
| | | ${item.insert} |
| | |
| | | { max: formRule.func.max, message: formRule.func.maxMessage } |
| | | ) |
| | | } else if (item.key === 'output') { |
| | | if (this.record.intertype === 'system') { |
| | | if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { |
| | | rules = [{ |
| | | pattern: /^@[0-9a-zA-Z_]+@?$/, |
| | | message: '变量以@符开头,可使用字母、数字以及_' |
| | |
| | | type: 'text', |
| | | key: 'separator', |
| | | label: '连接符', |
| | | initVal: card.separator || card.separator === undefined ? '/' : '', |
| | | initVal: card.separator === undefined ? '/' : card.separator, |
| | | tooltip: '表单提交时信息之间的连接符。注:连接符为空时,初始化时填充其他表单无效。', |
| | | required: false, |
| | | readonly: false |
| | |
| | | let searchSum = 0 |
| | | let swipes = [] |
| | | |
| | | let check = (components) => { |
| | | let check = (components, level, sign) => { |
| | | components.forEach(item => { |
| | | if (error) return |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | check(tab.components) |
| | | check(tab.components, level + 1, tab.uuid) |
| | | }) |
| | | return |
| | | } else if (item.type === 'group') { |
| | | check(item.components) |
| | | check(item.components, level, sign) |
| | | return |
| | | } else if (item.type === 'navbar' && !item.wrap.MenuNo) { |
| | | error = `导航栏《${item.name}》未设置菜单参数!` |
| | |
| | | } |
| | | } |
| | | if (item.wrap && item.wrap.pagestyle === 'slide' && item.pageable && item.setting.laypage !== 'false') { |
| | | swipes.push(item.name) |
| | | // swipes.push(item.name) |
| | | swipes.push({level, name: item.name, sign}) |
| | | } |
| | | |
| | | item.errors && item.errors.forEach(err => { |
| | |
| | | }) |
| | | } |
| | | |
| | | check(config.components) |
| | | check(config.components, 1, 'view') |
| | | |
| | | // if (!error && viewType === 'userbind' && config.components.filter(item => item.type === 'login').length === 0) { |
| | | // error = '用户绑定页面必须添加登录。' |
| | |
| | | |
| | | if (!error && searchSum > 1) { |
| | | error = '搜索组件与导航栏的搜索功能不可同时使用。' |
| | | } else if (!error && swipes.length > 1) { |
| | | error = `页面中不可同时使用多个滑动加载组件。(${swipes.join('、')})` |
| | | } else if (!error && swipes.length > 0) { |
| | | swipes.forEach(cell => { |
| | | if (!error && cell.level > 2) { |
| | | error = `不可在多层标签页中使用滑动加载组件。(${cell.name})` |
| | | } |
| | | }) |
| | | if (!error) { |
| | | let levels = swipes.map(s => s.level) |
| | | levels = Array.from(new Set(levels)) |
| | | if (levels.length > 1) { |
| | | error = `不可在页面与标签页中同时使用滑动加载组件。(${swipes.map(s => s.name).join('、')})` |
| | | } |
| | | } |
| | | |
| | | if (!error) { |
| | | let signs = swipes.map(s => s.sign) |
| | | signs = Array.from(new Set(signs)) |
| | | if (signs.length !== swipes.length) { |
| | | error = `页面中(或同一标签页中)不可同时使用多个滑动加载组件。(${swipes.map(s => s.name).join('、')})` |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (show && error) { |