From e4666c46c685ec7eabff25af9890d54c0ff2952b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 16 六月 2023 17:55:56 +0800 Subject: [PATCH] 2023-06-16 --- src/tabviews/custom/components/card/table-card/index.jsx | 18 ++++ src/tabviews/custom/components/card/prop-card/index.jsx | 15 +++ src/menu/components/share/actioncomponent/formconfig.jsx | 5 + src/tabviews/custom/components/card/double-data-card/index.jsx | 23 +++++ src/tabviews/custom/components/table/normal-table/index.jsx | 24 ++++++ src/menu/components/card/cardcellcomponent/dragaction/action.jsx | 5 + src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 34 ++++++++ src/tabviews/custom/components/table/edit-table/index.jsx | 24 ++++++ src/menu/components/share/actioncomponent/actionform/index.jsx | 12 ++ src/tabviews/custom/components/card/balcony/index.jsx | 15 +++ src/tabviews/zshare/actionList/normalbutton/index.jsx | 40 +++++++++ src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx | 6 src/tabviews/custom/components/card/data-card/index.jsx | 18 ++++ 13 files changed, 231 insertions(+), 8 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx index 0fb5013..9f0deab 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx @@ -39,6 +39,9 @@ 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') { @@ -53,7 +56,7 @@ 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>) diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index ddeb8b0..3a832cd 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -249,7 +249,7 @@ 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') @@ -308,6 +308,11 @@ 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)) @@ -618,6 +623,11 @@ } 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 = '鎵撳嵃' diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index d8fa383..31b4a64 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -276,7 +276,7 @@ ] }, { - type: 'radio', + type: formTypes.length ? 'select' : 'radio', key: 'formType', label: '琛ㄥ崟绫诲瀷', initVal: card.formType || 'switch', @@ -290,6 +290,9 @@ }, { value: 'counter', text: '璁℃暟鍣�' + }, { + value: 'count_line', + text: '璁℃暟鍣�(鏈湴)' }, ...formTypes] }, diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index 1697e66..9d68b21 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -140,6 +140,7 @@ 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') { @@ -176,6 +177,7 @@ 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() @@ -250,6 +252,19 @@ } } + 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 diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 9b84661..7005107 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -215,6 +215,7 @@ 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) { @@ -305,6 +306,7 @@ 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() @@ -377,6 +379,22 @@ } } + 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 diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index ddf5d2d..38f7251 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -205,6 +205,7 @@ 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) { @@ -284,6 +285,7 @@ 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() @@ -325,6 +327,27 @@ } } + 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] diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 592322d..681652b 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -157,6 +157,7 @@ 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') { @@ -192,6 +193,7 @@ 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() @@ -326,6 +328,19 @@ } } + 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 diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 16fc44e..e8d7904 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -117,6 +117,7 @@ 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) { @@ -157,6 +158,7 @@ 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() @@ -215,6 +217,22 @@ } } + 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 diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index d1281be..f21a620 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -502,6 +502,28 @@ } } + 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 @@ -520,6 +542,7 @@ 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) } @@ -533,6 +556,7 @@ 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) } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index ca20ae8..6a52bc5 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -606,6 +606,28 @@ } } + 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 @@ -668,6 +690,7 @@ 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) { @@ -722,6 +745,7 @@ 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() diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 1905369..d75ebe9 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -115,6 +115,7 @@ 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) { @@ -150,6 +151,7 @@ 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() @@ -208,6 +210,22 @@ } } + 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 @@ -219,6 +237,22 @@ } } + 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 diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 8b9b3ea..2c4b340 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -62,7 +62,7 @@ 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] @@ -109,7 +109,7 @@ 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] @@ -330,6 +330,9 @@ return } } else if (!['inner', 'outer', 'system', 'custom'].includes(btn.intertype)) { + if (btn.OpenType === 'form' && btn.formType === 'count_line') { + return + } // 鎺ュ彛绫诲瀷閿欒 notification.warning({ top: 92, @@ -3010,6 +3013,37 @@ }) } + 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 @@ -3020,6 +3054,8 @@ 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 { diff --git a/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx b/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx index 5c0bfe3..8fed290 100644 --- a/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx @@ -48,7 +48,7 @@ this.timer = setTimeout(() => { this.props.onChange(val) - }, 1000) + }, btn.formType === 'count_line' ? 100 : 1000) } plus = () => { @@ -71,7 +71,7 @@ this.timer = setTimeout(() => { this.props.onChange(val) - }, 1000) + }, btn.formType === 'count_line' ? 100 : 1000) } submit = () => { @@ -96,7 +96,7 @@ this.timer = setTimeout(() => { this.props.onChange(count) - }, 1000) + }, btn.formType === 'count_line' ? 100 : 1000) } render() { -- Gitblit v1.8.0