| | |
| | | field: 'btnControl', |
| | | label: '按钮控制', |
| | | initval: setting.btnControl || 'show', |
| | | tooltip: '可设置按钮显示规则,一直显示或鼠标悬浮时显示。', |
| | | tooltip: '可设置按钮显示规则,始终显示或鼠标悬浮时显示。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'show', label: '正常显示'}, |
| | |
| | | field: 'btnControl', |
| | | label: '按钮控制', |
| | | initval: setting.btnControl || 'show', |
| | | tooltip: '可设置按钮显示规则,一直显示或鼠标悬浮时显示。', |
| | | tooltip: '可设置按钮显示规则,始终显示或鼠标悬浮时显示。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'show', label: '正常显示'}, |
| | |
| | | } |
| | | |
| | | state = { |
| | | view: 'normal', |
| | | view: 'base', |
| | | visible: false, |
| | | plot: null, |
| | | formlist: null, |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | view: 'base', |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot, config.columns), |
| | | formlist: getOptionForm(config.plot, config.columns) |
| | |
| | | } |
| | | |
| | | state = { |
| | | view: 'normal', |
| | | view: 'base', |
| | | visible: false, |
| | | plot: null, |
| | | formlist: null, |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | view: 'base', |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot, config.columns), |
| | | formlist: getOptionForm(config.plot, config.uuid) |
| | |
| | | } |
| | | |
| | | state = { |
| | | view: 'normal', |
| | | view: 'base', |
| | | ramp: 'false', |
| | | visible: false, |
| | | datatype: '', |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | view: 'base', |
| | | ramp: plot.ramp || 'false', |
| | | datatype: plot.datatype || 'query', |
| | | fieldName: fieldName, |
| | |
| | | plot: null, |
| | | formlist: null, |
| | | baseFormlist: null, |
| | | view: 'normal', |
| | | view: 'base', |
| | | colorColumns: [ |
| | | { |
| | | title: '指标', |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | view: 'base', |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot), |
| | | formlist: config.subtype === 'ratioboard' ? getRadioOptionForm(config.plot, config.columns) : getOptionForm(config.plot, config.columns) |
| | |
| | | plot: null, |
| | | formlist: null, |
| | | baseFormlist: null, |
| | | view: 'normal', |
| | | view: 'base', |
| | | colorColumns: [ |
| | | { |
| | | title: '指标', |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | view: 'base', |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot), |
| | | formlist: getOptionForm(config.plot, config.columns) |
| | |
| | | } |
| | | |
| | | state = { |
| | | view: 'normal', |
| | | view: 'base', |
| | | visible: false, |
| | | plot: null, |
| | | formlist: null, |
| | |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | view: 'normal', |
| | | view: 'base', |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot), |
| | | formlist: getOptionForm(config.plot, config.columns) |
| | |
| | | } else if (this.record.type === 'close' || this.record.type === 'reset') { |
| | | shows = ['typeName', 'label'] |
| | | } else { |
| | | shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload'] // 选项列表 |
| | | shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 选项列表 |
| | | |
| | | if (this.record.intertype === 'custom') { |
| | | shows.pop() |
| | |
| | | allowClear={item.allowClear} |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {option.text} |
| | | <Select.Option title={option.text || option.label} key={index} value={option.value}> |
| | | {option.text || option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | |
| | | export function getActionForm (card, functip, tableName, usefulFields, modules, anchors) { |
| | | export function getActionForm (card, functip, tableName, usefulFields, modules, anchors, uuid) { |
| | | const appType = sessionStorage.getItem('appType') |
| | | let viewType = sessionStorage.getItem('editMenuType') // 弹窗 popview |
| | | let _type = '提交' |
| | |
| | | menulist = [] |
| | | } |
| | | } |
| | | |
| | | let linkButtons = [] |
| | | let filterComponent = (components) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | filterComponent(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | filterComponent(item.components) |
| | | } else { |
| | | item.action && item.action.forEach(cell => { |
| | | if (cell.hidden === 'true' || cell.uuid === uuid) return |
| | | if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return |
| | | |
| | | linkButtons.push({ |
| | | value: cell.uuid, |
| | | label: cell.label + '(' + item.name + ')' |
| | | }) |
| | | }) |
| | | |
| | | if (item.type === 'card' && item.subcards) { |
| | | item.subcards.forEach(m => { |
| | | if ((item.subtype === 'datacard' || item.subtype === 'dualdatacard') && m.$cardType !== 'extendCard') return |
| | | m.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === uuid) return |
| | | if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return |
| | | |
| | | linkButtons.push({ |
| | | value: cell.uuid, |
| | | label: cell.label + '(' + item.name + ')' |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === uuid) return |
| | | if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return |
| | | |
| | | linkButtons.push({ |
| | | value: cell.uuid, |
| | | label: cell.label + '(' + item.name + ')' |
| | | }) |
| | | }) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | if(group.uuid === uuid) return |
| | | |
| | | if (item.subcards.length > 1) { |
| | | linkButtons.push({ |
| | | value: group.uuid, |
| | | label: group.subButton.label + '(' + item.name + '-' + group.setting.title + ')' |
| | | }) |
| | | } else { |
| | | linkButtons.push({ |
| | | value: group.uuid, |
| | | label: group.subButton.label + '(' + item.name + ')' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | filterComponent(window.GLOB.customMenu.components) |
| | | |
| | | let refresh = [] |
| | | if (viewType === 'popview') { // 弹窗标签 |
| | |
| | | options: anchors |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'preButton', |
| | | label: '前置按钮', |
| | | tooltip: '当前按钮执行前,需要执行的按钮。', |
| | | initVal: card.preButton || '', |
| | | required: false, |
| | | allowClear: true, |
| | | options: linkButtons |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'reload', |
| | | label: '上一页', |
| | |
| | | * @description 按钮编辑,获取按钮表单信息 |
| | | */ |
| | | handleAction = (card) => { |
| | | const { config } = this.props |
| | | const { config, group } = this.props |
| | | |
| | | let usefulFields = sessionStorage.getItem('permFuncField') |
| | | if (usefulFields) { |
| | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors) |
| | | formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors, group.uuid) |
| | | }) |
| | | } |
| | | |
| | |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) |
| | | const acTyOptions = { |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden'], |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton'], |
| | | excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], |
| | | excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], |
| | | popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], |
| | |
| | | return _list |
| | | } |
| | | |
| | | let tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components))) |
| | | let tabs = getTabs(window.GLOB.customMenu.components) |
| | | |
| | | let linkButtons = [] |
| | | let filterComponent = (components) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | filterComponent(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | filterComponent(item.components) |
| | | } else { |
| | | item.action && item.action.forEach(cell => { |
| | | if (cell.hidden === 'true' || cell.uuid === card.uuid) return |
| | | if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return |
| | | |
| | | linkButtons.push({ |
| | | value: cell.uuid, |
| | | label: cell.label + '(' + item.name + ')' |
| | | }) |
| | | }) |
| | | |
| | | if (item.type === 'card' && item.subcards) { |
| | | item.subcards.forEach(m => { |
| | | if ((item.subtype === 'datacard' || item.subtype === 'dualdatacard') && m.$cardType !== 'extendCard') return |
| | | m.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === card.uuid) return |
| | | if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return |
| | | |
| | | linkButtons.push({ |
| | | value: cell.uuid, |
| | | label: cell.label + '(' + item.name + ')' |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === card.uuid) return |
| | | if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return |
| | | |
| | | linkButtons.push({ |
| | | value: cell.uuid, |
| | | label: cell.label + '(' + item.name + ')' |
| | | }) |
| | | }) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | if(group.uuid === card.uuid) return |
| | | |
| | | if (item.subcards.length > 1) { |
| | | linkButtons.push({ |
| | | value: group.uuid, |
| | | label: group.subButton.label + '(' + item.name + '-' + group.setting.title + ')' |
| | | }) |
| | | } else { |
| | | linkButtons.push({ |
| | | value: group.uuid, |
| | | label: group.subButton.label + '(' + item.name + ')' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | filterComponent(window.GLOB.customMenu.components) |
| | | |
| | | let pageTemps = [ |
| | | { value: 'billprint', text: '单据打印' }, |
| | |
| | | forbid: viewType === 'popview' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'preButton', |
| | | label: '前置按钮', |
| | | tooltip: '当前按钮执行前,需要执行的按钮。', |
| | | initVal: card.preButton || '', |
| | | required: false, |
| | | allowClear: true, |
| | | options: linkButtons |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'btnControl', |
| | | label: '按钮控制', |
| | | initval: wrap.btnControl || 'show', |
| | | tooltip: '可设置按钮显示规则,始终显示或鼠标悬浮时显示。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'show', label: '正常显示'}, |
| | | {value: 'hover', label: '悬浮显示'}, |
| | | ], |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || (!appType ? 'true' : 'false'), |
| | |
| | | } |
| | | } |
| | | |
| | | if (cell.verify && cell.verify.invalid === 'true') { |
| | | if (item.wrap && item.wrap.datatype === 'static') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.sqlType === 'insert') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.Ot === 'notRequired') { |
| | | cell.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | |
| | | if (component.setting.interType !== 'system') { // 不使用系统函数时 |
| | | component.setting.sync = 'false' |
| | | component.setting.dataresource = '' |
| | | component.setting.laypage = component.setting.laypage === 'true' |
| | | return component |
| | | } |
| | |
| | | config.setting.customScript = config.setting.customScript.replace(reg, val) |
| | | }) |
| | | } |
| | | } else { |
| | | config.setting.dataresource = '' |
| | | } |
| | | |
| | | let _arrField = [] // 字段集 |
| | |
| | | } |
| | | } |
| | | |
| | | if (item.verify && item.verify.invalid === 'true') { |
| | | if (item.sqlType === 'insert') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.Ot === 'notRequired') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.intertype !== 'system' && item.procMode !== 'system') { |
| | | item.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置 |
| | | let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | mkFormSubmit = (btnId) => { |
| | | mkFormSubmit = (btnId, callback) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== btnId) return |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) |
| | | }, () => { |
| | | callback && callback() |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | mkFormSubmit = (btnId) => { |
| | | mkFormSubmit = (btnId, callback) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== btnId) return |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) |
| | | }, () => { |
| | | callback && callback() |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | mkFormSubmit = (btnId) => { |
| | | mkFormSubmit = (btnId, callback) => { |
| | | const { group } = this.state |
| | | |
| | | if (group.uuid !== btnId) return |
| | | |
| | | this.formRef.handleConfirm().then(res => { |
| | | MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) |
| | | }, () => { |
| | | callback && callback() |
| | | }) |
| | | } |
| | | |
| | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | |
| | | return ( |
| | | <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}> |
| | | <div className={'normal-timeline-box ' + (config.wrap.btnControl || '')} id={'anchor' + config.uuid} style={{...config.style}}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | |
| | | } |
| | | } |
| | | } |
| | | .normal-timeline-box.hover { |
| | | .card-item-box:not(:hover) { |
| | | button { |
| | | opacity: 0; |
| | | transition: opacity 0.3s; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .normal-timeline-box::after { |
| | | content: ' '; |
| | |
| | | } |
| | | } |
| | | |
| | | if (group.subButton.verify && group.subButton.verify.invalid === 'true') { |
| | | if (item.wrap.datatype === 'static') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } else if (group.subButton.sqlType === 'insert') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } else if (group.subButton.Ot === 'notRequired') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } else if (group.subButton.intertype !== 'system' && group.subButton.procMode !== 'system') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | group.fields = group.fields.map(cell => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { |
| | |
| | | cell.modal.$cache = item.$cache |
| | | cell.modal.$time = item.$time |
| | | cell.modal.uuid = cell.uuid + 'pop' |
| | | } |
| | | |
| | | if (cell.verify && cell.verify.invalid === 'true') { |
| | | if (item.wrap && item.wrap.datatype === 'static') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.sqlType === 'insert') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.Ot === 'notRequired') { |
| | | cell.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | |
| | | |
| | | if (component.setting.interType !== 'system') { // 不使用系统函数时 |
| | | component.setting.sync = 'false' |
| | | component.setting.dataresource = '' |
| | | component.setting.laypage = component.setting.laypage === 'true' |
| | | return component |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (group.subButton.verify && group.subButton.verify.invalid === 'true') { |
| | | if (item.wrap.datatype === 'static') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } else if (group.subButton.intertype !== 'system' && group.subButton.procMode !== 'system') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } else if (group.subButton.sqlType === 'insert') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } else if (group.subButton.Ot === 'notRequired') { |
| | | group.subButton.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | group.fields = group.fields.map(cell => { |
| | | // 数据源sql语句,预处理,权限黑名单字段设置为隐藏表单 |
| | | if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { |
| | |
| | | } else if (item.type === 'balcony' || item.subtype === 'propcard') { |
| | | cell.errorType = 'error2' |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (cell.verify && cell.verify.invalid === 'true') { |
| | | if (item.wrap && item.wrap.datatype === 'static') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.sqlType === 'insert') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.Ot === 'notRequired') { |
| | | cell.verify.invalid = 'false' |
| | | } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { |
| | | cell.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (component.setting.interType !== 'system') { // 不使用系统函数时 |
| | | component.setting.sync = 'false' |
| | | component.setting.dataresource = '' |
| | | component.setting.laypage = component.setting.laypage === 'true' |
| | | return component |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (item.verify && item.verify.invalid === 'true') { |
| | | if (item.sqlType === 'insert') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.Ot === 'notRequired') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.intertype !== 'system' && item.procMode !== 'system') { |
| | | item.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 打印机设置 |
| | | let _item = window.GLOB.UserCacheMap.get(Tab.uuid + item.uuid) |
| | | |
| | |
| | | config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) |
| | | config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) |
| | | }) |
| | | } else { |
| | | config.setting.dataresource = '' |
| | | } |
| | | |
| | | if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { |
| | |
| | | } |
| | | } |
| | | |
| | | if (item.verify && item.verify.invalid === 'true') { |
| | | if (item.sqlType === 'insert') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.Ot === 'notRequired') { |
| | | item.verify.invalid = 'false' |
| | | } else if (item.intertype !== 'system' && item.procMode !== 'system') { |
| | | item.verify.invalid = 'false' |
| | | } |
| | | } |
| | | |
| | | if (item.controlField) { |
| | | if (/,/ig.test(item.controlVal)) { |
| | | item.controlVals = item.controlVal.split(',') |
| | |
| | | config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) |
| | | config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) |
| | | }) |
| | | } else { |
| | | config.setting.dataresource = '' |
| | | } |
| | | |
| | | if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { |
| | |
| | | } |
| | | |
| | | moduleParams = null |
| | | preCallback = null |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData, BData, disabled } = this.props |
| | |
| | | } |
| | | |
| | | actionSubmit = (res) => { |
| | | const { btn, setting, BID } = this.props |
| | | const { btn } = this.props |
| | | const { selines } = this.state |
| | | |
| | | if (btn.uuid !== res.menuId) return |
| | | |
| | | let data = selines || [] |
| | | |
| | | if (setting.supModule && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 3 |
| | | }) |
| | | return |
| | | } else if (btn.Ot !== 'notRequired' && data.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | let valid = this.checkBtnData(data) |
| | | |
| | | if (!valid) { |
| | | this.preCallback && this.preCallback() |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | this.execSubmit(data, () => {}, res.form) |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮状态改变 |
| | | */ |
| | | updateStatus = () => { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false, |
| | | confirmLoading: false |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId, record, type) => { |
| | | const { BID, btn, selectedData, setting } = this.props |
| | | actionTrigger = (triggerId, record, type, callback) => { |
| | | const { btn, selectedData } = this.props |
| | | const { loading, disabled } = this.state |
| | | |
| | | if (type === 'preButton') { |
| | | if (btn.uuid !== triggerId) return |
| | | |
| | | this.preTrigger(callback) |
| | | return |
| | | } else { |
| | | this.preCallback = null |
| | | } |
| | | |
| | | if (loading || disabled) return |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | | if (setting.supModule && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) { |
| | | return |
| | | } |
| | | if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) return |
| | | if (btn.OpenType === 'form' && btn.formType === 'count_line') return |
| | | |
| | | this.setState({autoMatic: type === 'autoMatic'}) |
| | | |
| | | let _this = this |
| | | let data = record || selectedData || [] |
| | | |
| | | if (btn.Ot !== 'notRequired' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.intertype === 'system') { |
| | | // 使用内部接口时,操作类型和数据源不可为空 |
| | | if (!btn.sql || !btn.sqlType) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮操作类型错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } 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) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮内部函数不可为空!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } else if (btn.intertype === 'custom' || btn.intertype === 'outer') { |
| | | if (btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义脚本回调时,回调脚本不可为空!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.procMode === 'system' && data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用创建凭证函数,需要选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (btn.intertype === 'custom' && window.GLOB.systemType === 'production' && !btn.proInterface) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未设置正式系统接口地址!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } else if (!['inner', 'outer', 'system', 'custom'].includes(btn.intertype)) { |
| | | if (btn.OpenType === 'form' && btn.formType === 'count_line') { |
| | | return |
| | | } |
| | | // 接口类型错误 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '按钮接口类型错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | let valid = this.checkBtnData(data) |
| | | |
| | | if (!valid) return |
| | | |
| | | this.setState({ |
| | | selines: data |
| | |
| | | this.setState({}, () => { |
| | | MKEmitter.emit('mkFormSubmit', btn.uuid) |
| | | }) |
| | | return |
| | | } else if (btn.OpenType === 'prompt') { |
| | | this.setState({loading: true}) |
| | | confirm({ |
| | |
| | | let _change = { |
| | | prompt: '提示框', |
| | | exec: '直接执行', |
| | | pop: '弹窗(表单)' |
| | | pop: '弹窗(表单)', |
| | | formSubmit: '表单', |
| | | form: '表单', |
| | | } |
| | | MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]}) |
| | | } |
| | | } |
| | | |
| | | preTrigger = (callback) => { |
| | | const { btn, selectedData } = this.props |
| | | const { loading, disabled } = this.state |
| | | |
| | | if (loading || disabled) { |
| | | callback() |
| | | return |
| | | } else if (btn.OpenType === 'form') { |
| | | callback() |
| | | return |
| | | } |
| | | |
| | | let _this = this |
| | | let data = selectedData || [] |
| | | |
| | | let valid = this.checkBtnData(data) |
| | | |
| | | if (!valid) { |
| | | callback() |
| | | return |
| | | } |
| | | |
| | | this.preCallback = callback |
| | | |
| | | this.setState({ |
| | | selines: data |
| | | }) |
| | | |
| | | if (btn.OpenType === 'formSubmit') { |
| | | this.setState({}, () => { |
| | | MKEmitter.emit('mkFormSubmit', btn.uuid, callback) |
| | | }) |
| | | } else if (btn.OpenType === 'prompt') { |
| | | this.setState({loading: true}) |
| | | confirm({ |
| | | title: btn.tipTitle || '确定要执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(data, resolve) |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | callback() |
| | | _this.setState({loading: false}) |
| | | } |
| | | }) |
| | | } else if (btn.OpenType === 'exec') { |
| | | this.setState({loading: true}) |
| | | this.execSubmit(data, () => { this.setState({loading: false})}) |
| | | } else if (btn.OpenType === 'pop') { |
| | | let modal = this.state.btnconfig |
| | | if (!modal && btn.modal) { |
| | | modal = this.handleModelConfig(btn.modal) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true, |
| | | btnconfig: modal |
| | | }) |
| | | |
| | | if (modal) { |
| | | if (modal.setting.display === 'prompt' || modal.setting.display === 'exec') { |
| | | this.modelconfirm() |
| | | } else { |
| | | this.setState({ |
| | | visible: true |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮状态改变 |
| | | */ |
| | | updateStatus = () => { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false, |
| | | confirmLoading: false |
| | | }) |
| | | } |
| | | |
| | | checkBtnData = (data) => { |
| | | const { BID, btn, setting } = this.props |
| | | |
| | | if (setting.supModule && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (btn.Ot !== 'notRequired' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (btn.intertype === 'system') { |
| | | if (data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用创建凭证函数,需要选择行!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } |
| | | } else if (btn.intertype === 'custom' || btn.intertype === 'outer') { |
| | | if (btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用自定义脚本回调时,回调脚本不可为空!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (btn.procMode === 'system' && data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '使用创建凭证函数,需要选择行!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } else if (btn.intertype === 'custom' && window.GLOB.systemType === 'production' && !btn.proInterface) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未设置正式系统接口地址!', |
| | | duration: 5 |
| | | }) |
| | | return false |
| | | } |
| | | } |
| | | |
| | | return true |
| | | } |
| | | |
| | | getSystemParam = (data, formdata, retmsg) => { |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId || Utils.getguid() |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = Utils.getguid() |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | param.ID = primaryId |
| | | |
| | | if (retmsg) { |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 数据源 |
| | | param.LText = sql |
| | | param.$callbacksql = callbacksql |
| | | } else { |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 数据源 |
| | | param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 数据源 |
| | | if (btn.output) { |
| | | param.key_back_type = 'Y' |
| | | } |
| | |
| | | /** |
| | | * @description 按钮提交执行 |
| | | */ |
| | | execSubmit = (data, _resolve, formdata) => { |
| | | execSubmit = (data, _resolve, formdata, force) => { |
| | | const { setting, btn } = this.props |
| | | this.moduleParams = null |
| | | |
| | | if ( |
| | | (btn.intertype === 'system' || (btn.intertype === 'custom' && btn.procMode === 'system')) && |
| | | btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && btn.verify && btn.verify.invalid === 'true' && |
| | | setting.dataresource |
| | | ) { |
| | | if (btn.preButton && !force) { |
| | | this.trigger(btn.preButton, data, _resolve, formdata, 0) |
| | | } else if (btn.verify && btn.verify.invalid === 'true' && setting.dataresource) { |
| | | MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => { |
| | | this.moduleParams = param |
| | | let datasource = setting.dataresource |
| | | let customScript = setting.customScript || '' |
| | | let allSearch = Utils.getAllSearchOptions(param.search) |
| | | |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | |
| | | regoptions.push({ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `'${sessionStorage.getItem('User_Name') || ''}'` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `'${sessionStorage.getItem('Full_Name') || ''}'` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: setting.order |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 10 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }) |
| | | |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | |
| | | this.moduleParams = { |
| | | datasource, |
| | | customScript |
| | | } |
| | | |
| | | this.execRealSubmit(data, _resolve, formdata) |
| | | }) |
| | | } else { |
| | | this.execRealSubmit(data, _resolve, formdata) |
| | | } |
| | | } |
| | | |
| | | trigger = (btnId, data, resolve, formdata, times) => { |
| | | if (times > 50) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '前置按钮加载失败!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({loading: false}) |
| | | resolve() |
| | | return |
| | | } |
| | | times++ |
| | | |
| | | let node = document.getElementById('button' + btnId) |
| | | |
| | | if (node) { |
| | | MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', (res) => { |
| | | if (!res) { |
| | | this.setState({loading: false}) |
| | | resolve() |
| | | return |
| | | } |
| | | |
| | | if (res.status) { |
| | | this.execSubmit(data, resolve, formdata, true) |
| | | } else { |
| | | this.execError(res) |
| | | } |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.trigger(btnId, data, resolve, formdata, times) |
| | | }, 100) |
| | | } |
| | | } |
| | | |
| | |
| | | const { btn } = this.props |
| | | const { autoMatic } = this.state |
| | | |
| | | if (autoMatic) { |
| | | if (this.preCallback) { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | this.preCallback(res) |
| | | return |
| | | } else if (autoMatic) { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | |
| | | const { btn } = this.props |
| | | const { autoMatic } = this.state |
| | | |
| | | if (autoMatic) { |
| | | if (this.preCallback) { |
| | | this.setState({ |
| | | loading: false, |
| | | visible: false |
| | | }) |
| | | this.preCallback(res) |
| | | return |
| | | } else if (autoMatic) { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || '执行失败!', |
| | |
| | | visible: false, |
| | | confirmLoading: false |
| | | }) |
| | | |
| | | this.preCallback && this.preCallback() |
| | | } |
| | | |
| | | modelconfirm = () => { |
| | |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | _this.preCallback && _this.preCallback() |
| | | _this.setState({ loading: false }) |
| | | } |
| | | }) |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' |
| | | import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd' |
| | | import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | // const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) |
| | | // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | const UpdateTable = asyncComponent(() => import('./updatetable')) |
| | | const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | // const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { delActions, openEdition } = this.state |
| | | // submitConfig = () => { |
| | | // const { menu } = this.props |
| | | // const { delActions, openEdition } = this.state |
| | | |
| | | let _config = fromJS(this.state.config).toJS() |
| | | // let _config = fromJS(this.state.config).toJS() |
| | | |
| | | // 基本信息验证 |
| | | if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({activeKey: '0'}) |
| | | return |
| | | } |
| | | // // 基本信息验证 |
| | | // if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请完善菜单基本信息!', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({activeKey: '0'}) |
| | | // return |
| | | // } |
| | | |
| | | // 新建菜单,清除默认项 |
| | | if (_config.isAdd) { |
| | | _config.search = _config.search.filter(item => !item.origin) |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | _config.columns = _config.columns.filter(item => !item.origin) |
| | | _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | // // 新建菜单,清除默认项 |
| | | // if (_config.isAdd) { |
| | | // _config.search = _config.search.filter(item => !item.origin) |
| | | // _config.action = _config.action.filter(item => !item.origin) |
| | | // _config.columns = _config.columns.filter(item => !item.origin) |
| | | // _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | // } |
| | | |
| | | // 使用已有菜单时,默认添加关联标签id |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | if (item.OpenType === 'popview' && !item.linkTab) { |
| | | item.linkTab = Utils.getuuid() |
| | | } |
| | | return item |
| | | }) |
| | | // // 使用已有菜单时,默认添加关联标签id |
| | | // if (_config.type === 'user') { |
| | | // _config.action = _config.action.map(item => { |
| | | // if (item.OpenType === 'popview' && !item.linkTab) { |
| | | // item.linkTab = Utils.getuuid() |
| | | // } |
| | | // return item |
| | | // }) |
| | | |
| | | _config.tabgroups.forEach(group => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | if (!tab.linkTab) { |
| | | tab.linkTab = Utils.getuuid() |
| | | } |
| | | return tab |
| | | }) |
| | | }) |
| | | } |
| | | // _config.tabgroups.forEach(group => { |
| | | // group.sublist = group.sublist.map(tab => { |
| | | // if (!tab.linkTab) { |
| | | // tab.linkTab = Utils.getuuid() |
| | | // } |
| | | // return tab |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | // 按钮不存在时,去掉绑定的双击按钮 |
| | | if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | _config.setting.doubleClick = '' |
| | | } |
| | | // // 按钮不存在时,去掉绑定的双击按钮 |
| | | // if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | // _config.setting.doubleClick = '' |
| | | // } |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | | let vresult = this.verifyconfig(_config) |
| | | if (vresult !== true) { |
| | | _config.enabled = false |
| | | } |
| | | // // 未设置数据源或标签不合法时,启用状态为false |
| | | // let vresult = this.verifyconfig(_config) |
| | | // if (vresult !== true) { |
| | | // _config.enabled = false |
| | | // } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | // if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | // this.setState({ |
| | | // menucloseloading: true |
| | | // }) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: true |
| | | // }) |
| | | // } |
| | | |
| | | let _LongParam = '' |
| | | // let _LongParam = '' |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | // // 保存时删除配置类型,system 、user |
| | | // delete _config.type |
| | | // delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | | // try { |
| | | // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | // } catch (e) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '编译错误', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({ |
| | | // menucloseloading: false, |
| | | // menuloading: false |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | let _sort = 0 |
| | | // let btntabs = [] |
| | | // let _sort = 0 |
| | | // // let btntabs = [] |
| | | |
| | | let btnParam = { // 添加菜单按钮 |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | | ParentID: menu.MenuID, |
| | | MenuNo: _config.MenuNo, |
| | | Template: _config.Template || '', |
| | | PageParam: '', |
| | | LongParam: '', |
| | | LText: [] |
| | | } |
| | | // let btnParam = { // 添加菜单按钮 |
| | | // func: 'sPC_Button_AddUpt', |
| | | // Type: 40, // 添加菜单下的按钮type为40,按钮下的按钮type为60 |
| | | // ParentID: menu.MenuID, |
| | | // MenuNo: _config.MenuNo, |
| | | // Template: _config.Template || '', |
| | | // PageParam: '', |
| | | // LongParam: '', |
| | | // LText: [] |
| | | // } |
| | | |
| | | _config.action.forEach(item => { |
| | | if (item.hidden === 'true') return |
| | | _sort++ |
| | | // if (item.OpenType === 'popview') { |
| | | // btntabs.push({ |
| | | // uuid: item.uuid, |
| | | // linkTab: item.linkTab, |
| | | // label: item.label, |
| | | // sort: _sort |
| | | // }) |
| | | // } |
| | | // _config.action.forEach(item => { |
| | | // if (item.hidden === 'true') return |
| | | // _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.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) |
| | | btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | // btnParam.LText = btnParam.LText.join(' union all ') |
| | | // btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | |
| | | // let tabParam = { // 添加菜单tab页 |
| | | // func: 'sPC_sMenusTab_AddUpt', |
| | | // MenuID: menu.MenuID |
| | | // } |
| | | // // let tabParam = { // 添加菜单tab页 |
| | | // // func: 'sPC_sMenusTab_AddUpt', |
| | | // // MenuID: menu.MenuID |
| | | // // } |
| | | |
| | | // let _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(group => { |
| | | // group.sublist.forEach(item => { |
| | | // _sort++ |
| | | // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | // }) |
| | | // }) |
| | | // // 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(group => { |
| | | // // group.sublist.forEach(item => { |
| | | // // _sort++ |
| | | // // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | // // }) |
| | | // // }) |
| | | |
| | | // _LText = _LText.join(' union all ') |
| | | // // _LText = _LText.join(' union all ') |
| | | |
| | | // 清空菜单下关联的标签 |
| | | // if (!_LText) { |
| | | // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` |
| | | // } |
| | | // // 清空菜单下关联的标签 |
| | | // // if (!_LText) { |
| | | // // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` |
| | | // // } |
| | | |
| | | // tabParam.LText = Utils.formatOptions(_LText) |
| | | // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | // // tabParam.LText = Utils.formatOptions(_LText) |
| | | // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let _vals = this.getFuncNames(_config) |
| | | // let _vals = this.getFuncNames(_config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: _config.fstMenuId, |
| | | SndID: _config.ParentId, |
| | | ParentID: _config.ParentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: _config.MenuNo, |
| | | EasyCode: _config.easyCode || '', |
| | | Template: _config.Template || '', |
| | | MenuName: _config.MenuName, |
| | | PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), |
| | | LongParam: _LongParam, |
| | | LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | | LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_TrdMenu_AddUpt', |
| | | // FstID: _config.fstMenuId, |
| | | // SndID: _config.ParentId, |
| | | // ParentID: _config.ParentId, |
| | | // MenuID: menu.MenuID, |
| | | // MenuNo: _config.MenuNo, |
| | | // EasyCode: _config.easyCode || '', |
| | | // Template: _config.Template || '', |
| | | // MenuName: _config.MenuName, |
| | | // PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), |
| | | // LongParam: _LongParam, |
| | | // LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), |
| | | // LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) |
| | | // } |
| | | |
| | | if (menu.menuSort) { // 菜单新建时设置排序 |
| | | param.Sort = menu.menuSort |
| | | } |
| | | // 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') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | // 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') |
| | | // param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (openEdition) { // 版本管理 |
| | | param.open_edition = openEdition |
| | | } |
| | | // if (openEdition) { // 版本管理 |
| | | // param.open_edition = openEdition |
| | | // } |
| | | |
| | | setTimeout(() => { |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | | if (delActions.length > 0) { |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.card ? item.card.uuid : item.uuid |
| | | } |
| | | // setTimeout(() => { |
| | | // // 有按钮或标签删除时,先进行删除操作 |
| | | // // 删除成功后,保存页面配置 |
| | | // new Promise(resolve => { |
| | | // if (delActions.length > 0) { |
| | | // let deffers = delActions.map(item => { |
| | | // let _param = { |
| | | // func: 'sPC_MainMenu_Del', |
| | | // MenuID: item.card ? item.card.uuid : item.uuid |
| | | // } |
| | | |
| | | if (item.type === 'action') { |
| | | let _ParentParam = null |
| | | // 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 |
| | | } |
| | | // try { |
| | | // _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | // } catch (e) { |
| | | // console.warn('Stringify Failure') |
| | | // _ParentParam = null |
| | | // } |
| | | |
| | | if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | _param.ParentParam = _ParentParam |
| | | } |
| | | } |
| | | // if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | // _param.ParentParam = _ParentParam |
| | | // } |
| | | // } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getCloudConfig(_param).then(response => { |
| | | resolve(response) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let error = null |
| | | result.forEach(response => { |
| | | if (!response.status) { |
| | | error = response |
| | | } |
| | | }) |
| | | // return new Promise(resolve => { |
| | | // Api.getCloudConfig(_param).then(response => { |
| | | // resolve(response) |
| | | // }) |
| | | // }) |
| | | // }) |
| | | // Promise.all(deffers).then(result => { |
| | | // let error = null |
| | | // result.forEach(response => { |
| | | // if (!response.status) { |
| | | // error = response |
| | | // } |
| | | // }) |
| | | |
| | | if (error) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | this.setState({ |
| | | delActions: [] |
| | | }) |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } else if (delActions.length === 0) { |
| | | resolve(true) |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | // if (error) { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: error.message, |
| | | // duration: 5 |
| | | // }) |
| | | // resolve(false) |
| | | // } else { |
| | | // this.setState({ |
| | | // delActions: [] |
| | | // }) |
| | | // resolve(true) |
| | | // } |
| | | // }) |
| | | // } else if (delActions.length === 0) { |
| | | // resolve(true) |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | |
| | | return true |
| | | }).then(res => { |
| | | if (res === true || res === false) return res |
| | | // 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 { |
| | | return true |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | Api.getCloudConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | config: _config, |
| | | openEdition: response.open_edition || '', |
| | | originMenu: fromJS(_config).toJS() |
| | | }) |
| | | // let msg = res.filter(Boolean)[0] |
| | | // if (msg) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: msg, |
| | | // duration: 5 |
| | | // }) |
| | | // return false |
| | | // } else { |
| | | // return true |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | // Api.getCloudConfig(param).then(response => { |
| | | // if (response.status) { |
| | | // this.setState({ |
| | | // config: _config, |
| | | // openEdition: response.open_edition || '', |
| | | // originMenu: fromJS(_config).toJS() |
| | | // }) |
| | | |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, +sessionStorage.getItem('mkDelay')) |
| | | } |
| | | // this.submitAction(btnParam) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: response.message, |
| | | // duration: 5 |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // }, +sessionStorage.getItem('mkDelay')) |
| | | // } |
| | | |
| | | /** |
| | | * @description 保存或修改菜单按钮集 |
| | | */ |
| | | submitAction = (btnParam) => { |
| | | const { config } = this.state |
| | | // submitAction = (btnParam) => { |
| | | // const { config } = this.state |
| | | |
| | | new Promise(resolve => { |
| | | if (btnParam.LText) { |
| | | Api.getCloudConfig(btnParam).then(result => { |
| | | if (result.status) { |
| | | this.setState({ // 保存成功后清空复制列表 |
| | | copyActions: [] |
| | | }) |
| | | resolve(result) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } |
| | | }) |
| | | } else { |
| | | resolve(true) |
| | | } |
| | | }).then(response => { |
| | | if (response === false) return response |
| | | // new Promise(resolve => { |
| | | // if (btnParam.LText) { |
| | | // Api.getCloudConfig(btnParam).then(result => { |
| | | // if (result.status) { |
| | | // this.setState({ // 保存成功后清空复制列表 |
| | | // copyActions: [] |
| | | // }) |
| | | // resolve(result) |
| | | // } else { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: result.message, |
| | | // duration: 5 |
| | | // }) |
| | | // resolve(false) |
| | | // } |
| | | // }) |
| | | // } else { |
| | | // resolve(true) |
| | | // } |
| | | // }).then(response => { |
| | | // if (response === false) return response |
| | | |
| | | if (!this.state.originActions || this.state.originActions.length === 0) return 'true' |
| | | // if (!this.state.originActions || this.state.originActions.length === 0) return 'true' |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | | let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | if (!curBtn) return |
| | | if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | // let oriActions = [] |
| | | // this.state.originActions.forEach(item => { |
| | | // let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | // if (!curBtn) return |
| | | // if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | // if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | |
| | | oriActions.push({ |
| | | prebtn: item.prebtn, |
| | | curBtn: curBtn |
| | | }) |
| | | }) |
| | | // oriActions.push({ |
| | | // prebtn: item.prebtn, |
| | | // curBtn: curBtn |
| | | // }) |
| | | // }) |
| | | |
| | | if (oriActions.length === 0) return 'true' |
| | | // if (oriActions.length === 0) return 'true' |
| | | |
| | | oriActions.forEach(action => { |
| | | if (!action.prebtn || !action.prebtn.uuid) return |
| | | // oriActions.forEach(action => { |
| | | // if (!action.prebtn || !action.prebtn.uuid) return |
| | | |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: action.prebtn.uuid |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _temp = '' |
| | | // Api.getCloudConfig({ |
| | | // func: 'sPC_Get_LongParam', |
| | | // MenuID: action.prebtn.uuid |
| | | // }).then(result => { |
| | | // if (result.status && result.LongParam) { |
| | | // let _temp = '' |
| | | |
| | | let _subconfig = '' |
| | | try { |
| | | _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | _temp = _subconfig.type |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _subconfig = '' |
| | | } |
| | | // let _subconfig = '' |
| | | // try { |
| | | // _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | // _temp = _subconfig.type |
| | | // } catch (e) { |
| | | // console.warn('Parse Failure') |
| | | // _subconfig = '' |
| | | // } |
| | | |
| | | if (!_subconfig) return |
| | | // if (!_subconfig) return |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: this.props.menu.MenuID, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: config.MenuNo, |
| | | Template: _temp, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _temp}), |
| | | LongParam: result.LongParam |
| | | } |
| | | Api.getCloudConfig(param).then(() => {}) |
| | | } |
| | | }) |
| | | }) |
| | | return 'true' |
| | | }).then(response => { |
| | | if (response === 'true') { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | | } else { |
| | | this.setState({ |
| | | originActions: [], |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | this.props.reloadmenu() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_ButtonParam_AddUpt', |
| | | // ParentID: this.props.menu.MenuID, |
| | | // MenuID: action.curBtn.uuid, |
| | | // MenuNo: config.MenuNo, |
| | | // Template: _temp, |
| | | // MenuName: action.curBtn.label, |
| | | // PageParam: JSON.stringify({Template: _temp}), |
| | | // LongParam: result.LongParam |
| | | // } |
| | | // Api.getCloudConfig(param).then(() => {}) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // return 'true' |
| | | // }).then(response => { |
| | | // if (response === 'true') { |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '保存成功', |
| | | // duration: 2 |
| | | // }) |
| | | // if (this.state.closeVisible) { |
| | | // this.props.handleView() |
| | | // } else { |
| | | // this.setState({ |
| | | // originActions: [], |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // } |
| | | // this.props.reloadmenu() |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | /** |
| | | * @description 点击返回时,判断配置保存状态 |
| | | */ |
| | | cancelConfig = () => { |
| | | const { config, originMenu } = this.state |
| | | // const { config, originMenu } = this.state |
| | | |
| | | let _this = this |
| | | // let _this = this |
| | | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | onOk() { |
| | | _this.props.handleView() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | if (!is(fromJS(originMenu), fromJS(config))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleView() |
| | | } |
| | | } |
| | | // if (config.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.props.handleView() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | | // } else { |
| | | // if (!is(fromJS(originMenu), fromJS(config))) { |
| | | // this.setState({ |
| | | // closeVisible: true |
| | | // }) |
| | | // } else { |
| | | // this.props.handleView() |
| | | // } |
| | | // } |
| | | |
| | | this.props.handleView() |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | render () { |
| | | const { menu } = this.props |
| | | const { activeKey, config, chartview, openEdition } = this.state |
| | | const { activeKey, config, chartview } = this.state |
| | | |
| | | if (!config) return null |
| | | |
| | |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <Unattended config={config} updateConfig={this.updateconfig}/> |
| | | <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> |
| | | {/* <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} |
| | | {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} |
| | | <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> |
| | | {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> */} |
| | | <UpdateTable config={config}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> |
| | | {/* <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> */} |
| | | {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> */} |
| | | <Button onClick={this.cancelConfig}>关闭</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | |
| | | </div> |
| | | </DndProvider> |
| | | {/* 返回时未保存提示 */} |
| | | <Modal |
| | | {/* <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | 配置已修改,是否保存配置信息? |
| | | </Modal> |
| | | </Modal> */} |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Switch } from 'antd' |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | // const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) |
| | | const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | // const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const DragElement = asyncComponent(() => import('./dragelement')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | |
| | | }) |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | const { editAction } = this.props |
| | | const { config, menu, openEdition } = this.state |
| | | // submitConfig = () => { |
| | | // const { editAction } = this.props |
| | | // const { config, menu, openEdition } = this.state |
| | | |
| | | if (config.fields[0] && config.fields[0].origin) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请添加表单', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | // if (config.fields[0] && config.fields[0].origin) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请添加表单', |
| | | // duration: 10 |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | let _LongParam = '' |
| | | let _config = fromJS(config).toJS() |
| | | // let _LongParam = '' |
| | | // let _config = fromJS(config).toJS() |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | // try { |
| | | // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | // } catch (e) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '编译错误', |
| | | // duration: 10 |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: editAction.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: 'Modal', |
| | | MenuName: editAction.label, |
| | | PageParam: JSON.stringify({Template: 'Modal'}), |
| | | LongParam: _LongParam |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_ButtonParam_AddUpt', |
| | | // ParentID: menu.MenuID, |
| | | // MenuID: editAction.uuid, |
| | | // MenuNo: menu.MenuNo, |
| | | // Template: 'Modal', |
| | | // MenuName: editAction.label, |
| | | // PageParam: JSON.stringify({Template: 'Modal'}), |
| | | // LongParam: _LongParam |
| | | // } |
| | | |
| | | if (openEdition) { |
| | | param.open_edition = openEdition |
| | | } |
| | | // if (openEdition) { |
| | | // param.open_edition = openEdition |
| | | // } |
| | | |
| | | if (this.state.closeVisible) { |
| | | this.setState({ |
| | | closeloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | // if (this.state.closeVisible) { |
| | | // this.setState({ |
| | | // closeloading: true |
| | | // }) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: true |
| | | // }) |
| | | // } |
| | | |
| | | Api.getCloudConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | openEdition: response.open_edition || '', |
| | | menuloading: false, |
| | | closeloading: false, |
| | | closeVisible: false, |
| | | originConfig: _config, |
| | | config: _config |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | closeloading: false, |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | // Api.getCloudConfig(param).then(response => { |
| | | // if (response.status) { |
| | | // this.setState({ |
| | | // openEdition: response.open_edition || '', |
| | | // menuloading: false, |
| | | // closeloading: false, |
| | | // closeVisible: false, |
| | | // originConfig: _config, |
| | | // config: _config |
| | | // }) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '保存成功', |
| | | // duration: 2 |
| | | // }) |
| | | // } else { |
| | | // this.setState({ |
| | | // closeloading: false, |
| | | // menuloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: response.message, |
| | | // duration: 10 |
| | | // }) |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | cancelConfig = () => { |
| | | const { config, originConfig } = this.state |
| | | let _this = this |
| | | // const { config, originConfig } = this.state |
| | | // let _this = this |
| | | |
| | | let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | | if (isOrigin) { |
| | | confirm({ |
| | | content: '尚未提交,确定放弃保存吗?', |
| | | onOk() { |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | |
| | | if (!is(fromJS(config), fromJS(originConfig))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | // let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | | // if (isOrigin) { |
| | | // confirm({ |
| | | // content: '尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.handleViewBack() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | | // } else { |
| | | // if (!is(fromJS(config), fromJS(originConfig))) { |
| | | // this.setState({ |
| | | // closeVisible: true |
| | | // }) |
| | | // } else { |
| | | // this.handleViewBack() |
| | | // } |
| | | // } |
| | | this.handleViewBack() |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { editAction } = this.props |
| | | const { config, openEdition } = this.state |
| | | // const { editAction } = this.props |
| | | const { config } = this.state |
| | | |
| | | if (!config) return null |
| | | |
| | |
| | | <div className="setting"> |
| | | <Card title="表单配置" bordered={false} extra={ |
| | | <div> |
| | | <Button type="danger" onClick={this.clearConfig}>清空</Button> |
| | | <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> |
| | | <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/> |
| | | <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> |
| | | {/* <Button type="danger" onClick={this.clearConfig}>清空</Button> */} |
| | | {/* <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} |
| | | {/* <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/> */} |
| | | {/* <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/> */} |
| | | {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> */} |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |
| | | /> |
| | | </Modal> |
| | | <Modal |
| | | {/* <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | 配置已修改,是否保存配置信息? |
| | | </Modal> |
| | | </Modal> */} |
| | | <StyleController /> |
| | | </div> |
| | | ) |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' |
| | | import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd' |
| | | import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' |
| | | // import moment from 'moment' |
| | | |
| | |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | // const { confirm } = Modal |
| | | |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | // const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | // const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) |
| | | const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) |
| | | const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) |
| | | const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) |
| | |
| | | /** |
| | | * @description 标签页保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { delActions, openEdition } = this.state |
| | | let _config = fromJS(this.state.config).toJS() |
| | | let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig |
| | | // submitConfig = () => { |
| | | // const { delActions, openEdition } = this.state |
| | | // let _config = fromJS(this.state.config).toJS() |
| | | // let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig |
| | | |
| | | // 基本信息验证 |
| | | if (!_config.tabName || !_config.tabNo) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({activeKey: '0'}) |
| | | return |
| | | } |
| | | // // 基本信息验证 |
| | | // if (!_config.tabName || !_config.tabNo) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请完善菜单基本信息!', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({activeKey: '0'}) |
| | | // return |
| | | // } |
| | | |
| | | if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '此标签为复制标签,请修改标签名称和标签参数,不可以时间格式 YYYY-MM-DD HH:mm:ss 结尾!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | // if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '此标签为复制标签,请修改标签名称和标签参数,不可以时间格式 YYYY-MM-DD HH:mm:ss 结尾!', |
| | | // duration: 5 |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | if (_config.isAdd) { |
| | | if (_config.search[0] && _config.search[0].origin) { |
| | | _config.search = _config.search.filter(item => !item.origin) |
| | | } |
| | | if (_config.action[0] && _config.action[0].origin) { |
| | | _config.action = _config.action.filter(item => !item.origin) |
| | | } |
| | | if (_config.columns[0] && _config.columns[0].origin) { |
| | | _config.columns = _config.columns.filter(item => !item.origin) |
| | | } |
| | | } |
| | | // if (_config.isAdd) { |
| | | // if (_config.search[0] && _config.search[0].origin) { |
| | | // _config.search = _config.search.filter(item => !item.origin) |
| | | // } |
| | | // if (_config.action[0] && _config.action[0].origin) { |
| | | // _config.action = _config.action.filter(item => !item.origin) |
| | | // } |
| | | // if (_config.columns[0] && _config.columns[0].origin) { |
| | | // _config.columns = _config.columns.filter(item => !item.origin) |
| | | // } |
| | | // } |
| | | |
| | | if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | _config.setting.doubleClick = '' |
| | | } |
| | | // if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { |
| | | // _config.setting.doubleClick = '' |
| | | // } |
| | | |
| | | // 未设置数据源或主键时,启用状态为false |
| | | let result = this.verifyconfig(_config) |
| | | // // 未设置数据源或主键时,启用状态为false |
| | | // let result = this.verifyconfig(_config) |
| | | |
| | | if (result !== true) { |
| | | _config.enabled = false |
| | | } |
| | | // if (result !== true) { |
| | | // _config.enabled = false |
| | | // } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | // if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | // this.setState({ |
| | | // menucloseloading: true |
| | | // }) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: true |
| | | // }) |
| | | // } |
| | | |
| | | let _LongParam = '' |
| | | // let _LongParam = '' |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | // // 保存时删除配置类型,system 、user |
| | | // delete _config.type |
| | | // delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 5 |
| | | }) |
| | | // try { |
| | | // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | // } catch (e) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '编译错误', |
| | | // duration: 5 |
| | | // }) |
| | | |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | | // this.setState({ |
| | | // menucloseloading: false, |
| | | // menuloading: false |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | // let btnParam = { |
| | | // func: 'sPC_Button_AddUpt', |
| | | // Type: 40, |
| | | // ParentID: _config.uuid, |
| | | // MenuNo: _config.tabNo, |
| | | // Template: 'SubTable', |
| | | // PageParam: '', |
| | | // LongParam: '', |
| | | // LText: [] |
| | | // } |
| | | // // let btnParam = { |
| | | // // func: 'sPC_Button_AddUpt', |
| | | // // Type: 40, |
| | | // // ParentID: _config.uuid, |
| | | // // MenuNo: _config.tabNo, |
| | | // // Template: 'SubTable', |
| | | // // PageParam: '', |
| | | // // LongParam: '', |
| | | // // LText: [] |
| | | // // } |
| | | |
| | | // let btntabs = [] |
| | | // // let btntabs = [] |
| | | |
| | | // _config.action.forEach((item, index) => { |
| | | // if (item.hidden === 'true') return |
| | | // if (item.OpenType === 'popview') { |
| | | // btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) |
| | | // } |
| | | // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | // }) |
| | | // // _config.action.forEach((item, index) => { |
| | | // // if (item.hidden === 'true') return |
| | | // // if (item.OpenType === 'popview') { |
| | | // // btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) |
| | | // // } |
| | | // // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) |
| | | // // }) |
| | | |
| | | // btnParam.LText = btnParam.LText.join(' union all ') |
| | | // btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | // // btnParam.LText = btnParam.LText.join(' union all ') |
| | | // // btnParam.LText = Utils.formatOptions(btnParam.LText) |
| | | // // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) |
| | | |
| | | // let tabParam = { // 添加标签按钮tab页 |
| | | // func: 'sPC_sMenusTab_AddUpt', |
| | | // MenuID: _config.uuid, |
| | | // LText: btntabs.join(' union all ') |
| | | // } |
| | | // // let tabParam = { // 添加标签按钮tab页 |
| | | // // func: 'sPC_sMenusTab_AddUpt', |
| | | // // MenuID: _config.uuid, |
| | | // // LText: btntabs.join(' union all ') |
| | | // // } |
| | | |
| | | // tabParam.LText = Utils.formatOptions(tabParam.LText) |
| | | // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | // // tabParam.LText = Utils.formatOptions(tabParam.LText) |
| | | // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let param = { |
| | | func: 'sPC_Tab_AddUpt', |
| | | MenuID: _config.uuid, |
| | | MenuNo: _config.tabNo, |
| | | Template: 'SubTable', |
| | | MenuName: _config.tabName, |
| | | Remark: _config.Remark, |
| | | Sort: 0, |
| | | PageParam: JSON.stringify({Template: 'SubTable'}), |
| | | LongParam: _LongParam |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_Tab_AddUpt', |
| | | // MenuID: _config.uuid, |
| | | // MenuNo: _config.tabNo, |
| | | // Template: 'SubTable', |
| | | // MenuName: _config.tabName, |
| | | // Remark: _config.Remark, |
| | | // Sort: 0, |
| | | // PageParam: JSON.stringify({Template: 'SubTable'}), |
| | | // LongParam: _LongParam |
| | | // } |
| | | |
| | | if (openEdition) { |
| | | param.open_edition = openEdition |
| | | } |
| | | // if (openEdition) { |
| | | // param.open_edition = openEdition |
| | | // } |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | | if (delActions.length > 0) { |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.card.uuid |
| | | } |
| | | // // 有按钮或标签删除时,先进行删除操作 |
| | | // // 删除成功后,保存页面配置 |
| | | // new Promise(resolve => { |
| | | // if (delActions.length > 0) { |
| | | // let deffers = delActions.map(item => { |
| | | // let _param = { |
| | | // func: 'sPC_MainMenu_Del', |
| | | // MenuID: item.card.uuid |
| | | // } |
| | | |
| | | let _ParentParam = null |
| | | // let _ParentParam = null |
| | | |
| | | try { |
| | | _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | _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 |
| | | } |
| | | // if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮 |
| | | // _param.ParentParam = _ParentParam |
| | | // } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getCloudConfig(_param).then(response => { |
| | | resolve(response) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let error = null |
| | | result.forEach(response => { |
| | | if (!response.status) { |
| | | error = response |
| | | } |
| | | }) |
| | | // return new Promise(resolve => { |
| | | // Api.getCloudConfig(_param).then(response => { |
| | | // resolve(response) |
| | | // }) |
| | | // }) |
| | | // }) |
| | | // Promise.all(deffers).then(result => { |
| | | // let error = null |
| | | // result.forEach(response => { |
| | | // if (!response.status) { |
| | | // error = response |
| | | // } |
| | | // }) |
| | | |
| | | if (error) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | this.setState({ |
| | | delActions: [] |
| | | }) |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } else if (delActions.length === 0) { |
| | | resolve(true) |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | // if (error) { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: error.message, |
| | | // duration: 5 |
| | | // }) |
| | | // resolve(false) |
| | | // } else { |
| | | // this.setState({ |
| | | // delActions: [] |
| | | // }) |
| | | // resolve(true) |
| | | // } |
| | | // }) |
| | | // } else if (delActions.length === 0) { |
| | | // resolve(true) |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | |
| | | return true |
| | | }).then(res => { |
| | | if (res === true || res === false) return res |
| | | // 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 { |
| | | return true |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | // let msg = res.filter(Boolean)[0] |
| | | // if (msg) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: msg, |
| | | // duration: 5 |
| | | // }) |
| | | // return false |
| | | // } else { |
| | | // return true |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | |
| | | Api.getCloudConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | openEdition: response.open_edition || '', |
| | | config: _config, |
| | | originConfig: fromJS(_config).toJS() |
| | | }, () => { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.handleViewBack() |
| | | } |
| | | }) |
| | | this.submitAction() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | // Api.getCloudConfig(param).then(response => { |
| | | // if (response.status) { |
| | | // this.setState({ |
| | | // openEdition: response.open_edition || '', |
| | | // config: _config, |
| | | // originConfig: fromJS(_config).toJS() |
| | | // }, () => { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '保存成功', |
| | | // duration: 2 |
| | | // }) |
| | | // if (this.state.closeVisible) { |
| | | // this.handleViewBack() |
| | | // } |
| | | // }) |
| | | // this.submitAction() |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: response.message, |
| | | // duration: 5 |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | /** |
| | | * @description 保存或修改菜单按钮 |
| | | */ |
| | | submitAction = () => { |
| | | const { config } = this.state |
| | | // submitAction = () => { |
| | | // const { config } = this.state |
| | | |
| | | let oriActions = [] |
| | | this.state.originActions.forEach(item => { |
| | | let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | if (!curBtn) return |
| | | if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | // let oriActions = [] |
| | | // this.state.originActions.forEach(item => { |
| | | // let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在 |
| | | // if (!curBtn) return |
| | | // if (curBtn.OpenType !== item.prebtn.OpenType) return |
| | | // if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return |
| | | |
| | | oriActions.push({ |
| | | prebtn: item.prebtn, |
| | | curBtn: curBtn |
| | | }) |
| | | }) |
| | | // oriActions.push({ |
| | | // prebtn: item.prebtn, |
| | | // curBtn: curBtn |
| | | // }) |
| | | // }) |
| | | |
| | | if (oriActions.length === 0) return |
| | | // if (oriActions.length === 0) return |
| | | |
| | | oriActions.forEach(action => { |
| | | Api.getCloudConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: action.prebtn ? action.prebtn.uuid : '' |
| | | }).then(result => { |
| | | if (result.status && result.LongParam) { |
| | | let _LongParam = '' |
| | | // oriActions.forEach(action => { |
| | | // Api.getCloudConfig({ |
| | | // func: 'sPC_Get_LongParam', |
| | | // MenuID: action.prebtn ? action.prebtn.uuid : '' |
| | | // }).then(result => { |
| | | // if (result.status && result.LongParam) { |
| | | // let _LongParam = '' |
| | | |
| | | if (result.LongParam) { |
| | | try { |
| | | _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | // if (result.LongParam) { |
| | | // try { |
| | | // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | // } catch (e) { |
| | | // console.warn('Parse Failure') |
| | | // _LongParam = '' |
| | | // } |
| | | // } |
| | | |
| | | if (_LongParam) { |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: config.uuid, |
| | | MenuID: action.curBtn.uuid, |
| | | MenuNo: config.tabNo, |
| | | Template: _LongParam.type, |
| | | MenuName: action.curBtn.label, |
| | | PageParam: JSON.stringify({Template: _LongParam.type}), |
| | | LongParam: result.LongParam |
| | | } |
| | | Api.getCloudConfig(param).then(() => {}) |
| | | } |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | // if (_LongParam) { |
| | | // let param = { |
| | | // func: 'sPC_ButtonParam_AddUpt', |
| | | // ParentID: config.uuid, |
| | | // MenuID: action.curBtn.uuid, |
| | | // MenuNo: config.tabNo, |
| | | // Template: _LongParam.type, |
| | | // MenuName: action.curBtn.label, |
| | | // PageParam: JSON.stringify({Template: _LongParam.type}), |
| | | // LongParam: result.LongParam |
| | | // } |
| | | // Api.getCloudConfig(param).then(() => {}) |
| | | // } |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | cancelConfig = () => { |
| | | const { config, originConfig } = this.state |
| | | // const { config, originConfig } = this.state |
| | | |
| | | let _this = this |
| | | // let _this = this |
| | | |
| | | if (originConfig.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | onOk() { |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | if (!is(fromJS(originConfig), fromJS(config))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | // if (originConfig.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.handleViewBack() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | | // } else { |
| | | // if (!is(fromJS(originConfig), fromJS(config))) { |
| | | // this.setState({ |
| | | // closeVisible: true |
| | | // }) |
| | | // } else { |
| | | // this.handleViewBack() |
| | | // } |
| | | // } |
| | | this.handleViewBack() |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { activeKey, config, chartview, openEdition } = this.state |
| | | const { activeKey, config, chartview } = this.state |
| | | |
| | | if (!config) return null |
| | | |
| | |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> |
| | | {/* <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} |
| | | {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} |
| | | <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> |
| | | {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> */} |
| | | {/* <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> */} |
| | | {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> */} |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | |
| | | </Card> |
| | | </div> |
| | | </DndProvider> |
| | | <Modal |
| | | {/* <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | 配置已修改,是否保存配置信息? |
| | | </Modal> |
| | | </Modal> */} |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Row, Col, Tree } from 'antd' |
| | | import { Button, Card, Collapse, notification, Spin, Tooltip, Row, Col, Tree } from 'antd' |
| | | import { QuestionCircleOutlined, RedoOutlined, SearchOutlined, FileOutlined, FolderOpenOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | import './index.scss' |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | // const { confirm } = Modal |
| | | const { TreeNode } = Tree |
| | | |
| | | const UpdateTable = asyncComponent(() => import('./updatetable')) |
| | |
| | | /** |
| | | * @description 三级菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { delTabs, openEdition } = this.state |
| | | // submitConfig = () => { |
| | | // const { menu } = this.props |
| | | // const { delTabs, openEdition } = this.state |
| | | |
| | | let _config = fromJS(this.state.config).toJS() |
| | | // let _config = fromJS(this.state.config).toJS() |
| | | |
| | | // 基本信息验证 |
| | | if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请完善菜单基本信息!', |
| | | duration: 5 |
| | | }) |
| | | this.setState({activeKey: '0'}) |
| | | return |
| | | } |
| | | // // 基本信息验证 |
| | | // if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '请完善菜单基本信息!', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({activeKey: '0'}) |
| | | // return |
| | | // } |
| | | |
| | | // 新建验证 |
| | | if (_config.isAdd) { |
| | | _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | // // 新建验证 |
| | | // if (_config.isAdd) { |
| | | // _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) |
| | | // } |
| | | |
| | | // 使用已有菜单时,默认添加关联标签id |
| | | if (_config.type === 'user') { |
| | | _config.tabgroups.forEach(group => { |
| | | group.sublist = group.sublist.map(tab => { |
| | | if (!tab.linkTab) { |
| | | tab.linkTab = Utils.getuuid() |
| | | } |
| | | return tab |
| | | }) |
| | | }) |
| | | } |
| | | // // 使用已有菜单时,默认添加关联标签id |
| | | // if (_config.type === 'user') { |
| | | // _config.tabgroups.forEach(group => { |
| | | // group.sublist = group.sublist.map(tab => { |
| | | // if (!tab.linkTab) { |
| | | // tab.linkTab = Utils.getuuid() |
| | | // } |
| | | // return tab |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | // 未设置数据源或标签不合法时,启用状态为false |
| | | let vresult = this.verifyconfig(_config) |
| | | if (vresult !== true) { |
| | | _config.enabled = false |
| | | } |
| | | // // 未设置数据源或标签不合法时,启用状态为false |
| | | // let vresult = this.verifyconfig(_config) |
| | | // if (vresult !== true) { |
| | | // _config.enabled = false |
| | | // } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | // if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | // this.setState({ |
| | | // menucloseloading: true |
| | | // }) |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: true |
| | | // }) |
| | | // } |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | // // 保存时删除配置类型,system 、user |
| | | // delete _config.type |
| | | // delete _config.isAdd |
| | | |
| | | let _LongParam = '' |
| | | // let _LongParam = '' |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | } catch (e) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '编译错误', |
| | | duration: 5 |
| | | }) |
| | | this.setState({ |
| | | menucloseloading: false, |
| | | menuloading: false |
| | | }) |
| | | return |
| | | } |
| | | // try { |
| | | // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | | // } catch (e) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '编译错误', |
| | | // duration: 5 |
| | | // }) |
| | | // this.setState({ |
| | | // menucloseloading: false, |
| | | // menuloading: false |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | // let _sort = 0 |
| | | // let btntabs = [] |
| | | // // let _sort = 0 |
| | | // // let btntabs = [] |
| | | |
| | | // let tabParam = { // 添加菜单tab页 |
| | | // func: 'sPC_sMenusTab_AddUpt', |
| | | // MenuID: menu.MenuID |
| | | // } |
| | | // // let tabParam = { // 添加菜单tab页 |
| | | // // func: 'sPC_sMenusTab_AddUpt', |
| | | // // MenuID: menu.MenuID |
| | | // // } |
| | | |
| | | // let _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(group => { |
| | | // group.sublist.forEach(item => { |
| | | // _sort++ |
| | | // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | // }) |
| | | // }) |
| | | // // 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(group => { |
| | | // // group.sublist.forEach(item => { |
| | | // // _sort++ |
| | | // // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) |
| | | // // }) |
| | | // // }) |
| | | |
| | | // _LText = _LText.join(' union all ') |
| | | // // _LText = _LText.join(' union all ') |
| | | |
| | | // tabParam.LText = Utils.formatOptions(_LText) |
| | | // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | // // tabParam.LText = Utils.formatOptions(_LText) |
| | | // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) |
| | | |
| | | let _funcs = [] |
| | | let _tables = [] |
| | | // let _funcs = [] |
| | | // let _tables = [] |
| | | |
| | | if (_config.setting.tableName) { |
| | | _tables.push(_config.setting.tableName) |
| | | } |
| | | if (_config.setting.innerFunc) { |
| | | _funcs.push({func: _config.setting.innerFunc, label: _config.MenuName || ''}) |
| | | } |
| | | if (_config.setting.outerFunc) { |
| | | _funcs.push({func: _config.setting.outerFunc, label: _config.MenuName || ''}) |
| | | } |
| | | // if (_config.setting.tableName) { |
| | | // _tables.push(_config.setting.tableName) |
| | | // } |
| | | // if (_config.setting.innerFunc) { |
| | | // _funcs.push({func: _config.setting.innerFunc, label: _config.MenuName || ''}) |
| | | // } |
| | | // if (_config.setting.outerFunc) { |
| | | // _funcs.push({func: _config.setting.outerFunc, label: _config.MenuName || ''}) |
| | | // } |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: _config.fstMenuId, |
| | | SndID: _config.ParentId, |
| | | ParentID: _config.ParentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: _config.MenuNo, |
| | | EasyCode: _config.easyCode, |
| | | Template: _config.Template, |
| | | MenuName: _config.MenuName, |
| | | PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), |
| | | LongParam: _LongParam, |
| | | LText: _funcs.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`) |
| | | } |
| | | // let param = { |
| | | // func: 'sPC_TrdMenu_AddUpt', |
| | | // FstID: _config.fstMenuId, |
| | | // SndID: _config.ParentId, |
| | | // ParentID: _config.ParentId, |
| | | // MenuID: menu.MenuID, |
| | | // MenuNo: _config.MenuNo, |
| | | // EasyCode: _config.easyCode, |
| | | // Template: _config.Template, |
| | | // MenuName: _config.MenuName, |
| | | // PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), |
| | | // LongParam: _LongParam, |
| | | // LText: _funcs.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 |
| | | } |
| | | // 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') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | // 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') |
| | | // param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (openEdition) { // 版本管理 |
| | | param.open_edition = openEdition |
| | | } |
| | | // if (openEdition) { // 版本管理 |
| | | // param.open_edition = openEdition |
| | | // } |
| | | |
| | | // 有按钮或标签删除时,先进行删除操作 |
| | | // 删除成功后,保存页面配置 |
| | | new Promise(resolve => { |
| | | if (delTabs.length > 0) { |
| | | let deffers = delTabs.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item.uuid |
| | | } |
| | | // // 有按钮或标签删除时,先进行删除操作 |
| | | // // 删除成功后,保存页面配置 |
| | | // new Promise(resolve => { |
| | | // if (delTabs.length > 0) { |
| | | // let deffers = delTabs.map(item => { |
| | | // let _param = { |
| | | // func: 'sPC_MainMenu_Del', |
| | | // MenuID: item.uuid |
| | | // } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getCloudConfig(_param).then(response => { |
| | | resolve(response) |
| | | }) |
| | | }) |
| | | }) |
| | | Promise.all(deffers).then(result => { |
| | | let error = null |
| | | result.forEach(response => { |
| | | if (!response.status) { |
| | | error = response |
| | | } |
| | | }) |
| | | // return new Promise(resolve => { |
| | | // Api.getCloudConfig(_param).then(response => { |
| | | // resolve(response) |
| | | // }) |
| | | // }) |
| | | // }) |
| | | // Promise.all(deffers).then(result => { |
| | | // let error = null |
| | | // result.forEach(response => { |
| | | // if (!response.status) { |
| | | // error = response |
| | | // } |
| | | // }) |
| | | |
| | | if (error) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 5 |
| | | }) |
| | | resolve(false) |
| | | } else { |
| | | this.setState({ |
| | | delTabs: [] |
| | | }) |
| | | resolve(true) |
| | | } |
| | | }) |
| | | } else if (delTabs.length === 0) { |
| | | resolve(true) |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | // if (error) { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: error.message, |
| | | // duration: 5 |
| | | // }) |
| | | // resolve(false) |
| | | // } else { |
| | | // this.setState({ |
| | | // delTabs: [] |
| | | // }) |
| | | // resolve(true) |
| | | // } |
| | | // }) |
| | | // } else if (delTabs.length === 0) { |
| | | // resolve(true) |
| | | // } |
| | | // }).then(resp => { |
| | | // if (resp === false) return |
| | | |
| | | Api.getCloudConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | config: _config, |
| | | openEdition: response.open_edition || '', |
| | | originMenu: fromJS(_config).toJS(), |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | // Api.getCloudConfig(param).then(response => { |
| | | // if (response.status) { |
| | | // this.setState({ |
| | | // config: _config, |
| | | // openEdition: response.open_edition || '', |
| | | // originMenu: fromJS(_config).toJS(), |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 2 |
| | | }) |
| | | // notification.success({ |
| | | // top: 92, |
| | | // message: '保存成功', |
| | | // duration: 2 |
| | | // }) |
| | | |
| | | this.props.reloadmenu() |
| | | // this.props.reloadmenu() |
| | | |
| | | if (this.state.closeVisible) { |
| | | this.props.handleView() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | // if (this.state.closeVisible) { |
| | | // this.props.handleView() |
| | | // } |
| | | // } else { |
| | | // this.setState({ |
| | | // menuloading: false, |
| | | // menucloseloading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: response.message, |
| | | // duration: 5 |
| | | // }) |
| | | // } |
| | | // }) |
| | | // }) |
| | | // } |
| | | |
| | | /** |
| | | * @description 点击返回时,判断配置保存状态 |
| | | */ |
| | | cancelConfig = () => { |
| | | const { config, originMenu } = this.state |
| | | let _this = this |
| | | // const { config, originMenu } = this.state |
| | | // let _this = this |
| | | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | onOk() { |
| | | _this.props.handleView() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | if (!is(fromJS(originMenu), fromJS(config))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleView() |
| | | } |
| | | } |
| | | // if (config.isAdd) { |
| | | // confirm({ |
| | | // content: '菜单尚未提交,确定放弃保存吗?', |
| | | // onOk() { |
| | | // _this.props.handleView() |
| | | // }, |
| | | // onCancel() {} |
| | | // }) |
| | | // } else { |
| | | // if (!is(fromJS(originMenu), fromJS(config))) { |
| | | // this.setState({ |
| | | // closeVisible: true |
| | | // }) |
| | | // } else { |
| | | // this.props.handleView() |
| | | // } |
| | | // } |
| | | this.props.handleView() |
| | | } |
| | | |
| | | /** |
| | |
| | | } bordered={false} extra={ |
| | | <div> |
| | | <UpdateTable config={config}/> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> |
| | | {/* <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> */} |
| | | {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> */} |
| | | <Button onClick={this.cancelConfig}>关闭</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | |
| | | </div> |
| | | </DndProvider> |
| | | {/* 返回时未保存提示 */} |
| | | <Modal |
| | | {/* <Modal |
| | | bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} |
| | | closable={false} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | 配置已修改,是否保存配置信息? |
| | | </Modal> |
| | | </Modal> */} |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd' |
| | | import { Form, Row, Col, Select, Radio, Tooltip, Input } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | |
| | | } |
| | | |
| | | onOptionChange = (value, key) => { |
| | | const { verify, setting } = this.props |
| | | const { verify } = this.props |
| | | |
| | | let _verify = {...verify, [key]: value} |
| | | |
| | |
| | | if (this.state.selectTemp) { |
| | | this.setState({selectTemp: null}) |
| | | } |
| | | } |
| | | |
| | | if (verify.invalid !== 'true' && _verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中自定义脚本过于复杂,不能使用失效验证!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.props.onChange(_verify) |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {card.intertype !== 'inner' ? <Col span={8}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> |
| | | <Form.Item label={ |
| | | verify.limitText ? <Tooltip placement="bottomLeft" title={verify.limitText}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 失效验证 |
| | | </Tooltip> : '失效验证' |
| | | }> |
| | | <Radio.Group value={verify.invalid} disabled={verify.limitInvalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> |
| | | <Radio value="true">开启</Radio> |
| | | <Radio value="false">不开启</Radio> |
| | | </Radio.Group> |
| | |
| | | activeKey: 'base', |
| | | appType: sessionStorage.getItem('appType'), |
| | | notes: [], // 短信模板 |
| | | setting: null, |
| | | verify: {}, |
| | | fields: [], |
| | | usefulfields: '', |
| | |
| | | const { appType } = this.state |
| | | let _verify = fromJS(card.verify || {}).toJS() |
| | | |
| | | let _invalid = _verify.invalid |
| | | let _invalid = _verify.invalid || 'true' |
| | | |
| | | if (!_invalid) { // 选择行时,失效验证默认开启 |
| | | if (config.setting && config.setting.maxScript && config.setting.maxScript >= 300) { |
| | | _invalid = 'false' |
| | | } else { |
| | | _invalid = card.Ot !== 'notRequired' ? 'true' : 'false' |
| | | } |
| | | _verify.limitInvalid = false |
| | | if (config.wrap && config.wrap.datatype === 'static') { |
| | | _verify.limitInvalid = true |
| | | _verify.limitText = '静态数据源,不可使用失效验证' |
| | | _invalid = 'false' |
| | | } else if (config.setting && config.setting.maxScript && config.setting.maxScript >= 300) { |
| | | _verify.limitInvalid = true |
| | | _verify.limitText = '数据源中自定义脚本过于复杂,不能使用失效验证!' |
| | | _invalid = 'false' |
| | | } else if (card.sqlType === 'insert') { |
| | | _verify.limitInvalid = true |
| | | _verify.limitText = '按钮操作类型为《添加》时,不能使用失效验证!' |
| | | _invalid = 'false' |
| | | } else if (card.Ot === 'notRequired') { |
| | | _verify.limitInvalid = true |
| | | _verify.limitText = '按钮《不选择行》时,不能使用失效验证!' |
| | | _invalid = 'false' |
| | | } |
| | | |
| | | if (card.sqlType === 'custom') { // 自定义验证时,不使用默认sql |
| | | _verify.default = 'false' |
| | | } |
| | |
| | | this.setState({ |
| | | activeKey: activeKey, |
| | | verifyInter: verifyInter, |
| | | setting: config.setting || {}, |
| | | verify: _verify, |
| | | oriVerify: fromJS(_verify).toJS() |
| | | }) |
| | |
| | | |
| | | handleConfirm = () => { |
| | | const { card } = this.props |
| | | const { setting, activeKey } = this.state |
| | | const { activeKey } = this.state |
| | | let verify = fromJS(this.state.verify).toJS() |
| | | |
| | | if (activeKey === 'base') { |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '不执行默认sql时,必须设置自定义脚本!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '数据源中自定义脚本过于复杂,不能使用失效验证!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | delete verify.limitInvalid |
| | | delete verify.limitText |
| | | |
| | | if (msg) { |
| | | confirm({ |
| | |
| | | |
| | | render() { |
| | | const { card, columns } = this.props |
| | | const { activeKey, verifyInter, setting, verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state |
| | | const { activeKey, verifyInter, verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null} |
| | | </span> |
| | | } key="base"> |
| | | <BaseForm card={card} appType={appType} columns={columns} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> |
| | | <BaseForm card={card} appType={appType} columns={columns} unionFields={unionFields} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> |
| | | </TabPane> : null} |
| | | {verifyInter === 'system' ? <TabPane tab={ |
| | | <span> |
| | |
| | | * @return {Array} columns 显示列 |
| | | * @return {Boolean} retmsg 是否需要数据返回 |
| | | */ |
| | | export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams, getOptions) { |
| | | export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams) { |
| | | let primaryId = param.ID |
| | | let BID = param.BID || '' |
| | | let verify = btn.verify || {} |
| | |
| | | } |
| | | |
| | | // 失效验证,添加数据时不用 |
| | | if (btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && verify.invalid === 'true' && setting.dataresource) { |
| | | let datasource = setting.dataresource |
| | | let customScript = setting.customScript || '' |
| | | let search = moduleParams ? moduleParams.search : null |
| | | let orderBy = moduleParams ? moduleParams.orderBy : setting.order |
| | | |
| | | if (/\s/.test(datasource) && !/tb$/.test(datasource)) { // 拼接别名 |
| | | datasource = '(' + datasource + ') tb' |
| | | } |
| | | |
| | | if (getOptions && (setting.queryType === 'statistics' || customScript)) { |
| | | let allSearch = getOptions(search) |
| | | |
| | | let regoptions = allSearch.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | regoptions.push({ |
| | | reg: new RegExp('@userName@', 'ig'), |
| | | value: `'${userName}'` |
| | | }, { |
| | | reg: new RegExp('@fullName@', 'ig'), |
| | | value: `'${fullName}'` |
| | | }, { |
| | | reg: new RegExp('@orderBy@', 'ig'), |
| | | value: orderBy |
| | | }, { |
| | | reg: new RegExp('@pageSize@', 'ig'), |
| | | value: 999999 |
| | | }, { |
| | | reg: new RegExp('@pageIndex@', 'ig'), |
| | | value: 1 |
| | | }) |
| | | |
| | | regoptions.forEach(item => { |
| | | datasource = datasource.replace(item.reg, item.value) |
| | | customScript = customScript.replace(item.reg, item.value) |
| | | }) |
| | | } |
| | | if (verify.invalid === 'true' && moduleParams && moduleParams.dataresource) { |
| | | let datasource = moduleParams.dataresource |
| | | let customScript = moduleParams.customScript || '' |
| | | |
| | | if (customScript) { |
| | | _sql += ` |
| | |
| | | let hasvoucher = false |
| | | |
| | | // 凭证-显示列中选取,必须选行 |
| | | if (verify.voucher && verify.voucher.enabled && data) { |
| | | if (verify.voucher && verify.voucher.enabled) { |
| | | let _voucher = verify.voucher |
| | | |
| | | hasvoucher = true |
| | |
| | | _sql += ` |
| | | /* 创建凭证 */ |
| | | exec s_BVoucher_Create |
| | | @Bill ='${_data[_voucher.linkField.toLowerCase()]}', |
| | | @Bill ='${_data[_voucher.linkField.toLowerCase()] || ''}', |
| | | @BVoucherType ='${_voucher.BVoucherType}', |
| | | @VoucherTypeOne ='${_voucher.VoucherTypeOne}', |
| | | @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', |