| | |
| | | .ant-input[disabled] { |
| | | background-color: #fafafa!important; |
| | | } |
| | | .ant-btn[disabled] { |
| | | background-color: transparent!important; |
| | | border-color: rgba(0, 0, 0, 0.35)!important; |
| | | color: rgba(0, 0, 0, 0.35)!important; |
| | | } |
| | | .ant-btn.ant-btn-link { |
| | | border-width: 0; |
| | | } |
| | | .button-list { |
| | | .ant-btn.ant-btn-link { |
| | | border-width: 1px; |
| | | } |
| | | } |
| | |
| | | |
| | | const { TextArea } = Input |
| | | const actionTypeOptions = { |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'controlField', 'controlVal'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'controlField', 'controlVal'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'controlField', 'controlVal'], |
| | | excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width', 'controlField', 'controlVal'], |
| | | excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'resetPageIndex', 'pagination', 'search', 'width', 'controlField', 'controlVal'], |
| | | popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width', 'controlField', 'controlVal'], |
| | | tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width', 'controlField', 'controlVal'], |
| | | innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width', 'open', 'controlField', 'controlVal'], |
| | | funcbutton: ['label', 'OpenType', 'funcType', 'show', 'icon', 'class', 'width', 'controlField', 'controlVal'] |
| | | pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'icon', 'class', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'resetPageIndex', 'syncComponent', 'width'], |
| | | excelOut: ['label', 'OpenType', 'intertype', 'show', 'icon', 'class', 'execSuccess', 'execError', 'syncComponent', 'resetPageIndex', 'pagination', 'search', 'width'], |
| | | popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'popClose', 'resetPageIndex', 'width'], |
| | | tab: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'linkmenu', 'width'], |
| | | innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'icon', 'class', 'width', 'open'], |
| | | funcbutton: ['label', 'OpenType', 'funcType', 'show', 'icon', 'class', 'width'] |
| | | } |
| | | |
| | | class ActionForm extends Component { |
| | |
| | | interType: null, // 接口类型:内部、外部 |
| | | funcType: null, // 功能类型 |
| | | procMode: null, // 参数方式 |
| | | Ot: null, |
| | | requireOptions: [{ |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | |
| | | let _intertype = card.intertype || 'system' // 接口类型 |
| | | let _funcType = card.funcType || '' // 功能按钮默认类型 |
| | | let _procMode = card.procMode || 'system' // 参数请求方式 |
| | | let _Ot = card.Ot || 'requiredSgl' // 参数请求方式 |
| | | |
| | | let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate, _procMode) |
| | | let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate, _procMode, _Ot) |
| | | |
| | | this.setState({ |
| | | Ot: _Ot, |
| | | openType: _opentype, |
| | | interType: _intertype, |
| | | procMode: _procMode, |
| | |
| | | }) |
| | | } |
| | | |
| | | getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode) => { |
| | | getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode, _Ot) => { |
| | | let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 选项列表 |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面,可选模板(自定义时,可填入外部链接) |
| | |
| | | } |
| | | } |
| | | |
| | | if (_Ot !== 'notRequired' && _opentype !== 'excelOut') { |
| | | _options.push('controlField', 'controlVal') |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | |
| | | */ |
| | | optionChange = (key, value) => { |
| | | const { card, type } = this.props |
| | | const { openType, procMode } = this.state |
| | | const { openType, procMode, Ot } = this.state |
| | | |
| | | if (key === 'OpenType') { |
| | | let _options = this.getOptions(value, 'system', this.state.funcType, card.pageTemplate, 'system') |
| | | let _options = this.getOptions(value, 'system', this.state.funcType, card.pageTemplate, 'system', Ot) |
| | | |
| | | let _fieldval = {} |
| | | |
| | |
| | | this.props.form.setFieldsValue(_fieldval) |
| | | }) |
| | | } else if (key === 'funcType') { |
| | | let _options = this.getOptions(openType, this.state.interType, value, card.pageTemplate, procMode) |
| | | let _options = this.getOptions(openType, this.state.interType, value, card.pageTemplate, procMode, Ot) |
| | | let _fieldval = {} |
| | | |
| | | this.setState({ |
| | |
| | | }) |
| | | } else if (key === 'pageTemplate') { |
| | | let _fieldval = {} |
| | | let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode) |
| | | let _options = this.getOptions(openType, this.state.interType, this.state.funcType, value, procMode, Ot) |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | this.props.form.setFieldsValue(_fieldval) |
| | | }) |
| | | } else if (key === 'intertype') { |
| | | let _options = this.getOptions(openType, value, this.state.funcType, '', procMode) |
| | | let _options = this.getOptions(openType, value, this.state.funcType, '', procMode, Ot) |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | |
| | | }) |
| | | }) |
| | | } else if (key === 'procMode') { |
| | | let _options = this.getOptions(openType, this.state.interType, this.state.funcType, '', value) |
| | | let _options = this.getOptions(openType, this.state.interType, this.state.funcType, '', value, Ot) |
| | | |
| | | this.setState({ |
| | | procMode: value, |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'Ot') { |
| | | let _options = this.getOptions(openType, this.state.interType, this.state.funcType, '', procMode, value) |
| | | |
| | | this.setState({ |
| | | Ot: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'sysInterface') { |
| | | if (value === 'true') { |
| | | this.props.form.setFieldsValue({ |
| | |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '显示控制字段,可根据行数据控制按钮是否显示。', |
| | | tooltip: '禁用控制字段,可根据数据控制按钮是否禁用。', |
| | | initVal: card.controlField || '', |
| | | required: false, |
| | | forbid: card.$type !== 'tableButton', |
| | | // forbid: card.$type !== 'tableButton', |
| | | options: [{label: '无', field: ''}, ...columns] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会隐藏,多个值用逗号分隔。', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | forbid: card.$type !== 'tableButton', |
| | | // forbid: card.$type !== 'tableButton', |
| | | required: false |
| | | } |
| | | ] |
| | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getActionForm(card, functip, config.setting, usefulFields, this.props.type, menulist, modules) |
| | | formlist: getActionForm(card, functip, config.setting, usefulFields, this.props.type, menulist, modules, config.columns) |
| | | }) |
| | | } |
| | | |
| | |
| | | </Col> |
| | | ) |
| | | } else if (card.eleType === 'button') { |
| | | if (card.$type === 'tableButton' && card.controlField) { // 表格中按钮隐藏控制 |
| | | if (data[card.controlField] === card.controlVal) { |
| | | return null |
| | | } else if (card.controlVal && card.controlVal.split(',').includes(data[card.controlField])) { |
| | | return null |
| | | } |
| | | } |
| | | let _data = data.$$type === 'extendCard' ? [] : [data] |
| | | |
| | | if (['exec', 'prompt', 'pop'].includes(card.OpenType)) { |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Chart } from '@antv/g2' |
| | | // import { connect } from 'react-redux' |
| | | import DataSet from '@antv/data-set' |
| | | import { Spin, Empty, notification } from 'antd' |
| | | import moment from 'moment' |
| | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | // import { modifyTabview } from '@/store/action' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), null) |
| | | }) |
| | | |
| | | // if (plot.linkmenu && plot.linkmenu.length > 0) { |
| | | // let menu_id = plot.linkmenu.slice(-1)[0] |
| | | // let menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' |
| | | |
| | | // chart.on('element:dblclick', (ev) => { |
| | | // if (!menu) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '菜单已删除或没有访问权限!', |
| | | // duration: 5 |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | // try { |
| | | // let data = ev.data.data |
| | | // let primaryId = '' |
| | | // if (this.state.config.setting.primaryKey && data) { |
| | | // primaryId = data[this.state.config.setting.primaryKey] || '' |
| | | // } |
| | | |
| | | // let newtab = { |
| | | // ...menu, |
| | | // selected: true, |
| | | // param: { |
| | | // $BID: primaryId |
| | | // } |
| | | // } |
| | | |
| | | // let tabs = this.props.tabviews.filter(tab => { |
| | | // tab.selected = false |
| | | // return tab.MenuID !== newtab.MenuID |
| | | // }) |
| | | |
| | | // if (this.props.tabviews.length > tabs.length) { |
| | | // this.props.modifyTabview(fromJS(tabs).toJS()) |
| | | // } |
| | | |
| | | // this.setState({}, () => { |
| | | // tabs.push(newtab) |
| | | // this.props.modifyTabview(tabs) |
| | | // }) |
| | | // } catch { |
| | | // console.warn('菜单打开失败!') |
| | | // } |
| | | // }) |
| | | // } |
| | | |
| | | if (plot.interaction && plot.interaction.length) { |
| | | plot.interaction.forEach(t => { |
| | | chart.interaction(t) |
| | |
| | | } |
| | | } |
| | | |
| | | // const mapStateToProps = (state) => { |
| | | // return { |
| | | // tabviews: state.tabviews, |
| | | // permMenus: state.permMenus, |
| | | // } |
| | | // } |
| | | |
| | | // const mapDispatchToProps = (dispatch) => { |
| | | // return { |
| | | // modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) |
| | | // } |
| | | // } |
| | | |
| | | // export default connect(mapStateToProps, mapDispatchToProps)(LineChart) |
| | | export default LineChart |
| | |
| | | return component |
| | | } |
| | | |
| | | if (component.wrap.datatype === 'static') { |
| | | if (component.wrap && component.wrap.datatype === 'static') { |
| | | component.format = '' |
| | | } |
| | | |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | disabled: false, |
| | | loading: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { loading } = this.state |
| | | const { loading, disabled } = this.state |
| | | |
| | | if (show === 'actionList') { |
| | | return ( |
| | | <Button |
| | | icon={btn.icon} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | className={'mk-btn mk-' + btn.class} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{btn.label}</Button> |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | loading: false, |
| | | disabled: false, |
| | | primaryId: '', |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { loading } = this.state |
| | | const { loading, disabled } = this.state |
| | | |
| | | if (show === 'actionList') { |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | <Button |
| | | icon={btn.icon} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | className={'mk-btn mk-' + btn.class} |
| | | onClick={() => {this.actionTrigger()}} |
| | | >{btn.label}</Button> |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style} |
| | | icon={show === 'text' ? '' : (show === 'icon' ? (btn.icon || 'upload') : (btn.icon || ''))} |
| | | onClick={() => {this.actionTrigger()}} |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | disabled: false, |
| | | visible: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { disabled } = this.state |
| | | |
| | | if (show === 'actionList') { |
| | | return ( |
| | | <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | disabled={disabled} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{btn.label}</Button> |
| | | ) |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | style={btn.style} |
| | | disabled={disabled} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{show === 'icon' && btn.icon ? '' : btn.label}</Button> |
| | |
| | | btnconfig: null, |
| | | loading: false, |
| | | loadingNumber: '', |
| | | disabled: false, |
| | | checkParam: null |
| | | } |
| | | |
| | | moduleParams = null |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | |
| | | MKEmitter.addListener('triggerFormSubmit', this.actionSubmit) |
| | | } |
| | | MKEmitter.addListener('returnModuleParam', this.resetModuleParam) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | |
| | | |
| | | render() { |
| | | const { btn, show, style } = this.props |
| | | const { loadingNumber, loading, visible } = this.state |
| | | const { loadingNumber, loading, visible, disabled } = this.state |
| | | |
| | | if (show === 'actionList') { |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | |
| | | style={style} |
| | | icon={btn.icon} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | className={'mk-btn mk-' + btn.class} |
| | | onClick={() => {this.actionTrigger()}} |
| | | >{(loadingNumber ? `(${loadingNumber})` : '') + btn.label}</Button> |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style || style} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={() => {this.actionTrigger()}} |
| | |
| | | visible: false, |
| | | popData: null, |
| | | primaryId: '', |
| | | disabled: false, |
| | | loading: false, |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | MKEmitter.addListener('openNewTab', this.openNewTab) |
| | | MKEmitter.addListener('refreshPopButton', this.refreshPopButton) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { loading, popData, primaryId } = this.state |
| | | const { loading, popData, primaryId, disabled } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | {show === 'actionList' ? <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | disabled={disabled} |
| | | onClick={() => {this.actionTrigger()}} |
| | | loading={loading} |
| | | >{btn.label}</Button> : null} |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={() => {this.actionTrigger()}} |
| | |
| | | tabledata: null, |
| | | btnconfig: null, |
| | | loading: false, |
| | | disabled: false, |
| | | loadingNumber: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { loadingNumber, loading } = this.state |
| | | const { loadingNumber, loading, disabled } = this.state |
| | | |
| | | if (show === 'actionList') { |
| | | return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}> |
| | | <Button |
| | | icon={btn.icon} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | className={'mk-btn mk-' + btn.class} |
| | | onClick={() => {this.actionTrigger()}} |
| | | >{loadingNumber ? `(${loadingNumber})` : '' + btn.label}</Button> |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={() => {this.actionTrigger()}} |
| | |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | disabled: false, |
| | | primaryId: '' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { btn, selectedData } = this.props |
| | | let disabled = false |
| | | |
| | | if (btn.controlField && selectedData && selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | if (position === 'toolbar') { |
| | | MKEmitter.addListener('triggerBtnId', this.actionTrigger) |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { btn, selectedData } = this.props |
| | | |
| | | if (btn.controlField && !is(fromJS(nextProps.selectedData || []), fromJS(selectedData || []))) { |
| | | let disabled = false |
| | | |
| | | if (nextProps.selectedData && nextProps.selectedData.length > 0) { // 表格中按钮隐藏控制 |
| | | nextProps.selectedData.forEach(item => { |
| | | let s = item[btn.controlField] + '' |
| | | if (s === btn.controlVal || (btn.controlVal && btn.controlVal.split(',').includes(s))) { |
| | | disabled = true |
| | | } |
| | | }) |
| | | } |
| | | this.setState({disabled}) |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | render() { |
| | | const { btn, show } = this.props |
| | | const { disabled } = this.state |
| | | |
| | | if (show === 'actionList') { |
| | | return ( |
| | | <Button |
| | | className={'mk-btn mk-' + btn.class} |
| | | icon={btn.icon} |
| | | disabled={disabled} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{btn.label}</Button> |
| | | ) |
| | |
| | | type="link" |
| | | title={show === 'icon' ? btn.label : ''} |
| | | style={btn.style} |
| | | disabled={disabled} |
| | | icon={show === 'text' ? '' : (btn.icon || '')} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{show === 'icon' && btn.icon ? '' : btn.label}</Button> |
| | |
| | | position: null, // 按钮位置 |
| | | procMode: null, // 外部接口参数处理方式 |
| | | pageTemplate: null, |
| | | Ot: null, |
| | | requireOptions: [{ |
| | | value: 'notRequired', |
| | | text: this.props.dict['header.form.notRequired'] |
| | |
| | | let _funcType = card.funcType || '' // 功能按钮默认类型 |
| | | let _tabTemplate = card.tabTemplate // 按钮为标签页时,标签类型:三级菜单或表单标签页 |
| | | let _pageTemplate = card.pageTemplate // 新页面类型 |
| | | let _Ot = card.Ot || 'requiredSgl' |
| | | |
| | | if (_opentype === 'outerpage') { |
| | | card.pageTemplate = 'custom' |
| | |
| | | } |
| | | |
| | | let _tabs = this.props.tabs.filter(tab => tab.type === 'SubTable') |
| | | let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode) |
| | | let _options = this.getOptions(_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot) |
| | | |
| | | this.setState({ |
| | | Ot: _Ot, |
| | | openType: _opentype, |
| | | pageTemplate: _pageTemplate, |
| | | interType: _intertype, |
| | |
| | | } |
| | | } |
| | | |
| | | getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode) => { |
| | | getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate, _procMode, _Ot) => { |
| | | let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 选项列表 |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面,可选模板(自定义时,可填入外部链接) |
| | |
| | | _options.push('resetPageIndex') |
| | | } |
| | | |
| | | if (_Ot !== 'notRequired' && _opentype !== 'excelOut') { |
| | | _options.push('controlField', 'controlVal') |
| | | } |
| | | |
| | | return _options |
| | | } |
| | | |
| | |
| | | * @description 切换 |
| | | */ |
| | | optionChange = (key, value) => { |
| | | const { openType, funcType, procMode } = this.state |
| | | const { openType, funcType, procMode, Ot } = this.state |
| | | const { card } = this.props |
| | | |
| | | if (key === 'OpenType') { |
| | | let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system') |
| | | let _options = this.getOptions(value, 'system', '', this.state.pageTemplate, card.tabTemplate, 'system', Ot) |
| | | let _fieldval = {} |
| | | let _formlist = this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | |
| | | // this.props.form.setFieldsValue(_fieldval) |
| | | // }) |
| | | } else if (key === 'funcType') { |
| | | let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode) |
| | | let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate, procMode, Ot) |
| | | let _fieldval = {} |
| | | |
| | | this.setState({ |
| | |
| | | this.props.form.setFieldsValue(_fieldval) |
| | | }) |
| | | } else if (key === 'pageTemplate') { |
| | | let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, card.tabTemplate, procMode) |
| | | let _options = this.getOptions('innerpage', this.state.interType, this.state.funcType, value, card.tabTemplate, procMode, Ot) |
| | | let _fieldval = {} |
| | | |
| | | this.setState({ |
| | |
| | | }) |
| | | }) |
| | | } else if (key === 'intertype') { |
| | | let _options = this.getOptions(openType, value, funcType, '', '', procMode) |
| | | let _options = this.getOptions(openType, value, funcType, '', '', procMode, Ot) |
| | | |
| | | this.setState({ |
| | | interType: value, |
| | |
| | | }) |
| | | }) |
| | | } else if (key === 'procMode') { |
| | | let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value) |
| | | let _options = this.getOptions(openType, this.state.interType, funcType, '', '', value, Ot) |
| | | |
| | | this.setState({ |
| | | procMode: value, |
| | |
| | | if (item.key === 'innerFunc') { |
| | | item.required = true |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'Ot') { |
| | | let _options = this.getOptions(openType, this.state.interType, funcType, this.state.pageTemplate, card.tabTemplate, procMode, value) |
| | | |
| | | this.setState({ |
| | | Ot: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | return item |
| | | }) |
| | | }) |
| | |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | | > |
| | | {item.options.map((option, index) => |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> |
| | | {item.key === 'icon' && option.value && <Icon type={option.value} />} {option.text} |
| | | <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value || option.field}> |
| | | {item.key === 'icon' && option.value ? <Icon type={option.value} /> : null} {option.text || option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, functip, config, usefulFields, type, menulist = [], printTemps = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | |
| | | value: 'false', |
| | | text: '非必填' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '禁用控制字段,可根据数据控制按钮是否禁用。', |
| | | initVal: card.controlField || '', |
| | | required: false, |
| | | options: [{label: '无', field: ''}, ...columns] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | } |
| | | ] |
| | | } |
| | |
| | | |
| | | handleAdd = () => { |
| | | const { fields, type } = this.props |
| | | if (this.state.data.length >= 20) { |
| | | if (this.state.data.length >= 100) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '最多可添加20项!', |
| | | message: '最多可添加100项!', |
| | | duration: 5 |
| | | }) |
| | | return |