From 3935fec99cc3ad5ec9394952a84bc2ffdaf9ef97 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 28 三月 2021 11:03:42 +0800 Subject: [PATCH] 2021-03-28 --- src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 2 src/templates/sharecomponent/columncomponent/columnform/index.scss | 8 ++ src/templates/sharecomponent/fieldscomponent/index.jsx | 2 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 26 ++++++ src/templates/modalconfig/source.jsx | 6 + src/tabviews/custom/components/share/normalTable/index.jsx | 51 +++++++----- src/menu/components/table/normal-table/columns/editColumn/index.scss | 8 ++ src/templates/zshare/formconfig.jsx | 4 src/tabviews/zshare/normalTable/index.jsx | 53 ++++++++----- src/templates/sharecomponent/columncomponent/columnform/index.jsx | 28 ++++++ 10 files changed, 138 insertions(+), 50 deletions(-) diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index d8da93d..46484ca 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -320,7 +320,7 @@ options: menulist }, { - type: 'text', + type: 'textarea', key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 09fa91d..43c63ac 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -7,6 +7,7 @@ import { formRule } from '@/utils/option.js' import './index.scss' +const { TextArea } = Input const columnTypeOptions = { text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'blacklist', 'perspective', 'rowspan'], number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], @@ -57,7 +58,7 @@ if (column.perspective === 'linkmenu') { _options.push('linkmenu', 'linkfields') } else if (column.perspective === 'linkurl') { - _options.push('linkurl') + _options.push('linkurl', 'linkfields') } } @@ -122,7 +123,7 @@ if (value === 'linkmenu') { _options.push('linkmenu', 'linkfields') } else if (value === 'linkurl') { - _options.push('linkurl') + _options.push('linkurl', 'linkfields') } this.setState({ @@ -298,6 +299,27 @@ </Form.Item> </Col> ) + } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 + fields.push( + <Col span={24} key={index} className="textarea"> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.input'] + item.label + '!' + } + ] + })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + ) } }) return fields diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.scss b/src/menu/components/table/normal-table/columns/editColumn/index.scss index fcf59ac..e450762 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.scss +++ b/src/menu/components/table/normal-table/columns/editColumn/index.scss @@ -16,4 +16,12 @@ padding-right: 3px; } } + .textarea { + .ant-form-item-label { + width: 12%; + } + .ant-form-item-control-wrapper { + width: 88%; + } + } } diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index a4103c1..f471844 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -507,21 +507,22 @@ const { tabviews } = this.props e.stopPropagation() + let __param = { + $searchkey: item.field, + $searchval: record[item.field] || '', + $BID: record.$$uuid + } + + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + __param[field] = record[field] || '' + }) + } + if (item.linkThdMenu) { let tabmenu = item.linkThdMenu - tabmenu.param = { - $searchkey: item.field, - $searchval: record[item.field] || '', - $BID: record.$$uuid - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - tabmenu.param[field] = record[field] || '' - }) - } - + tabmenu.param = __param tabmenu.selected = true let tabs = tabviews.filter((tab, i) => { @@ -537,26 +538,36 @@ tabs.push(tabmenu) this.props.modifyTabview(tabs) }) - } else { + } else if (item.linkurl) { let src = item.linkurl - if (item.linkurl.indexOf('paramsmain/') > -1) { + if (src.indexOf('paramsmain/') > -1) { try { let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/' let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1]))) - let dataparam = { - $searchkey: item.field, - $searchval: record[item.field] || '', - BID: record.$$uuid - } _param.UserID = sessionStorage.getItem('UserID') _param.LoginUID = sessionStorage.getItem('LoginUID') _param.User_Name = sessionStorage.getItem('User_Name') - _param.param = dataparam + _param.param = __param src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) } catch { console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') } + } else { + let con = '?' + + if (/\?/ig.test(src)) { + con = '&' + } + + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` } window.open(src) diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index bf37bf9..3746355 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -211,25 +211,26 @@ // 瀛楁閫忚 triggerLink = (e, item, record) => { - const { tabviews, MenuID, setting } = this.props + const { tabviews, MenuID } = this.props e.stopPropagation() + + let __param = { + $searchkey: item.field, + $searchval: record[item.field] || '', + $BID: record.$$uuid + } + + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + __param[field] = record[field] || '' + }) + } if (item.linkThdMenu) { let tabmenu = item.linkThdMenu - tabmenu.param = { - $searchkey: item.field, - $searchval: record[item.field] || '', - $BID: record.$$uuid - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - tabmenu.param[field] = record[field] || '' - }) - } - + tabmenu.param = __param tabmenu.selected = true let index = 0 @@ -255,26 +256,36 @@ } this.props.modifyTabview(tabs) }) - } else { + } else if (item.linkurl) { let src = item.linkurl - if (item.linkurl.indexOf('paramsmain/') > -1) { + if (src.indexOf('paramsmain/') > -1) { try { let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/' let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1]))) - let dataparam = { - $searchkey: item.field, - $searchval: record[item.field] || '', - BID: record[setting.primaryKey] - } _param.UserID = sessionStorage.getItem('UserID') _param.LoginUID = sessionStorage.getItem('LoginUID') _param.User_Name = sessionStorage.getItem('User_Name') - _param.param = dataparam + _param.param = __param src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) } catch { console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') } + } else { + let con = '?' + + if (/\?/ig.test(src)) { + con = '&' + } + + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` } window.open(src) diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index e368b9e..6e831de 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -30,6 +30,8 @@ options: [], orderType: 'asc', decimal: 0, + span: 12, + labelwidth: 33.3, min: '', max: '', readonly: 'false', @@ -46,6 +48,8 @@ options: [], orderType: 'asc', decimal: 0, + span: 12, + labelwidth: 33.3, min: '', max: '', readonly: 'false', @@ -62,6 +66,8 @@ options: [], orderType: 'asc', decimal: 0, + span: 12, + labelwidth: 33.3, min: '', max: '', readonly: 'false', diff --git a/src/templates/sharecomponent/columncomponent/columnform/index.jsx b/src/templates/sharecomponent/columncomponent/columnform/index.jsx index dc17190..8bfffcb 100644 --- a/src/templates/sharecomponent/columncomponent/columnform/index.jsx +++ b/src/templates/sharecomponent/columncomponent/columnform/index.jsx @@ -5,6 +5,7 @@ import { formRule } from '@/utils/option.js' import './index.scss' +const { TextArea } = Input const columnTypeOptions = { text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'fieldlength', 'blacklist', 'perspective', 'rowspan'], number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], @@ -37,7 +38,7 @@ if (card.perspective === 'linkmenu') { _options.push('linkmenu', 'linkfields') } else if (card.perspective === 'linkurl') { - _options.push('linkurl') + _options.push('linkurl', 'linkfields') } } @@ -77,7 +78,7 @@ if (card.perspective === 'linkmenu') { _options.push('linkmenu', 'linkfields') } else if (card.perspective === 'linkurl') { - _options.push('linkurl') + _options.push('linkurl', 'linkfields') } } @@ -110,7 +111,7 @@ if (value === 'linkmenu') { _options.push('linkmenu', 'linkfields') } else if (value === 'linkurl') { - _options.push('linkurl') + _options.push('linkurl', 'linkfields') } this.setState({ @@ -175,6 +176,27 @@ </Form.Item> </Col> ) + } else if (item.type === 'textarea') { // 鏂囨湰鎼滅储 + fields.push( + <Col span={24} key={index} className="textarea"> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.input'] + item.label + '!' + } + ] + })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + ) } else if (item.type === 'number') { fields.push( <Col span={12} key={index}> diff --git a/src/templates/sharecomponent/columncomponent/columnform/index.scss b/src/templates/sharecomponent/columncomponent/columnform/index.scss index fcf59ac..e450762 100644 --- a/src/templates/sharecomponent/columncomponent/columnform/index.scss +++ b/src/templates/sharecomponent/columncomponent/columnform/index.scss @@ -16,4 +16,12 @@ padding-right: 3px; } } + .textarea { + .ant-form-item-label { + width: 12%; + } + .ant-form-item-control-wrapper { + width: 88%; + } + } } diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index 4edb4e3..8447dd0 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -247,7 +247,7 @@ let _columns = [...columnsMap.values()] let lastItem = config.fields[config.fields.length - 1] - let span = lastItem ? lastItem.span : 12 + let span = lastItem ? lastItem.span || 12 : 12 _columns.forEach(item => { // 寰幆娣诲姞鏂板瀛楁 if (item.selected) { diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 0a321e4..1da9bb4 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1419,7 +1419,7 @@ options: menulist }, { - type: 'text', + type: 'textarea', key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', @@ -2427,7 +2427,7 @@ max: 24, precision: 0, label: '琛ㄥ崟瀹藉害', - initVal: card.span || ('textarea,hint,checkcard,brafteditor'.indexOf(card.type) > -1 ? 24 : 12), + initVal: card.span || (['textarea', 'hint', 'checkcard', 'brafteditor'].includes(card.type) ? 24 : 12), tooltip: '鏍呮牸甯冨眬鏁磋24绛夊垎銆�', required: true }, -- Gitblit v1.8.0