| | |
| | | let warning = null |
| | | if (['pop', 'prompt', 'exec', 'form'].includes(card.OpenType)) { |
| | | hasProfile = true |
| | | if (card.formType === 'count_line') { |
| | | hasProfile = false |
| | | } |
| | | } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { |
| | | hasProfile = true |
| | | } else if (card.funcType === 'print') { |
| | |
| | | if (card.OpenType === 'form') { |
| | | if (card.formType === 'switch') { |
| | | btnElement = (<Switch style={_style} className={card.size === 'large' ? 'ant-switch-large' : ''} size={card.size} checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''}/>) |
| | | } else if (card.formType === 'counter') { |
| | | } else if (card.formType === 'counter' || card.formType === 'count_line') { |
| | | btnElement = (<div style={_style} className={'mk-counter ' + card.size}><span><MinusOutlined /></span><span>1</span><span><PlusOutlined /></span></div>) |
| | | } else if (card.formType === 'radio') { |
| | | btnElement = (<Checkbox style={_style}></Checkbox>) |
| | |
| | | |
| | | if (this.record.formType === 'switch') { |
| | | shows.push('field', 'size', 'openVal', 'closeVal', 'openText', 'closeText') |
| | | } else if (this.record.formType === 'counter') { |
| | | } else if (this.record.formType === 'counter' || this.record.formType === 'count_line') { |
| | | shows.push('field', 'size', 'min', 'max', 'decimal') |
| | | } else if (this.record.formType === 'radio') { |
| | | shows.push('field', 'checkType', 'openVal', 'closeVal') |
| | |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | |
| | | if (this.record.formType === 'count_line') { |
| | | reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) |
| | | shows = shows.filter(op => ['label', 'OpenType', 'formType', 'Ot', 'width', 'title', 'hidden', 'field', 'size', 'min', 'max', 'decimal'].includes(op)) |
| | | } |
| | | } else if (openType === 'excelIn') { |
| | | reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') |
| | | reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) |
| | |
| | | } |
| | | |
| | | this.props.updRecord && this.props.updRecord(this.record) |
| | | } else if (key === 'formType') { |
| | | if (value === 'count_line') { |
| | | _fieldval.Ot = 'requiredSgl' |
| | | this.record.Ot = 'requiredSgl' |
| | | } |
| | | } else if (key === 'funcType') { |
| | | if (value === 'print') { |
| | | _fieldval.label = '打印' |
| | |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: formTypes.length ? 'select' : 'radio', |
| | | key: 'formType', |
| | | label: '表单类型', |
| | | initVal: card.formType || 'switch', |
| | |
| | | }, { |
| | | value: 'counter', |
| | | text: '计数器' |
| | | }, { |
| | | value: 'count_line', |
| | | text: '计数器(本地)' |
| | | }, |
| | | ...formTypes] |
| | | }, |
| | |
| | | MKEmitter.addListener('syncBalconyData', this.syncBalconyData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | |
| | | MKEmitter.removeListener('syncBalconyData', this.syncBalconyData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS() |
| | | _data[btn.field] = count |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | syncBalconyData = (menuId, data, checked) => { |
| | | const { syncConfig } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('mkCheckAll', this.mkCheckAll) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('mkCheckAll', this.mkCheckAll) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | item.children.forEach(cell => { |
| | | if (cell.$$uuid === uuid) { |
| | | cell[btn.field] = count |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected, card } = this.state |
| | | let _opens = [...this.state.opens] |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | |
| | | MKEmitter.removeListener('mkPublicData', this.mkPublicData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS() |
| | | _data[btn.field] = count |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(this.state.data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | let _selectedData = fromJS(this.state.selectedData).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | selectedData: _selectedData |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { config } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(this.state.data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | let _selectedData = fromJS(this.state.selectedData).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | selectedData: _selectedData |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { sync, config, setting, BID, BData } = this.state |
| | | |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | refreshLineData = (menuId, btn, uuid, count) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let _data = fromJS(data).toJS().forEach(item => { |
| | | if (item.$$uuid === uuid) { |
| | | item[btn.field] = count |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }) |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = selectedData && selectedData[0] ? selectedData[0] : null |
| | | if (btn.formType === 'counter') { |
| | | if (btn.formType === 'counter' || btn.formType === 'count_line') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | |
| | | |
| | | if (btn.OpenType === 'form') { |
| | | let data = nextProps.selectedData && nextProps.selectedData[0] ? nextProps.selectedData[0] : null |
| | | if (btn.formType === 'counter') { |
| | | if (btn.formType === 'counter' || btn.formType === 'count_line') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | |
| | | return |
| | | } |
| | | } else if (!['inner', 'outer', 'system', 'custom'].includes(btn.intertype)) { |
| | | if (btn.OpenType === 'form' && btn.formType === 'count_line') { |
| | | return |
| | | } |
| | | // 接口类型错误 |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | } |
| | | |
| | | changeLineCount = (count) => { |
| | | const { btn, selectedData } = this.props |
| | | const { disabled } = this.state |
| | | |
| | | if (disabled) return |
| | | |
| | | let data = selectedData || [] |
| | | |
| | | if (data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectline'], |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (data.length !== 1) { |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectSingleLine'], |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({count}, () => { |
| | | MKEmitter.emit('refreshLineData', btn.$menuId, btn, data[0].$$uuid, count) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { loadingNumber, loadingTotal, loading, disabled, hidden, check, count } = this.state |
| | |
| | | return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> |
| | | } else if (btn.formType === 'counter') { |
| | | return <MkCounter count={count} disabled={disabled} btn={btn} onChange={this.changeCount}/> |
| | | } else if (btn.formType === 'count_line') { |
| | | return <MkCounter count={count} disabled={disabled} btn={btn} onChange={this.changeLineCount}/> |
| | | } else if (btn.formType === 'radio') { |
| | | return <Checkbox className={btn.checkType || ''} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> |
| | | } else { |
| | |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(val) |
| | | }, 1000) |
| | | }, btn.formType === 'count_line' ? 100 : 1000) |
| | | } |
| | | |
| | | plus = () => { |
| | |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(val) |
| | | }, 1000) |
| | | }, btn.formType === 'count_line' ? 100 : 1000) |
| | | } |
| | | |
| | | submit = () => { |
| | |
| | | |
| | | this.timer = setTimeout(() => { |
| | | this.props.onChange(count) |
| | | }, 1000) |
| | | }, btn.formType === 'count_line' ? 100 : 1000) |
| | | } |
| | | |
| | | render() { |