From f895e8af9e6a393f71fec0dc26fdf1b9b6616cb4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 11 十二月 2020 18:53:04 +0800 Subject: [PATCH] 2020-12-11 --- src/templates/zshare/verifycard/index.jsx | 53 +++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 1745fd7..40fcbbb 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -44,6 +44,7 @@ systemScripts: [], columnsFields: [], unionFields: [], + uniqueFields: [], // 鍞竴鎬ч獙璇侊紝琛ㄥ崟瀛楁 uniqueColumns: [ { title: '鍚嶇О', @@ -220,9 +221,18 @@ title: 'SQL', dataIndex: 'sql', width: '45%', - render: (text) => ( - <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph> - ) + render: (text) => { + let title = text.match(/^\s*\/\*.+\*\//) + title = title && title[0] ? title[0] : '' + text = title ? text.replace(title, '') : text + + return ( + <div> + {title ? <span style={{color: '#a50'}}>{title}</span> : null} + <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> + </div> + ) + } }, { title: '缁撴灉澶勭悊', @@ -283,9 +293,18 @@ title: 'SQL', dataIndex: 'sql', width: '60%', - render: (text) => ( - <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph> - ) + render: (text) => { + let title = text.match(/^\s*\/\*.+\*\//) + title = title && title[0] ? title[0] : '' + text = title ? text.replace(title, '') : text + + return ( + <div> + {title ? <span style={{color: '#a50'}}>{title}</span> : null} + <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> + </div> + ) + } }, { title: '鎵ц浣嶇疆', @@ -580,6 +599,12 @@ } }) + let uniqueFields = fromJS(_fields).toJS() + + if (!hasBid) { // 鍞竴鎬ч獙璇佹坊鍔燘ID + uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) + } + if (!hasBid && (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate')) { // 琛ㄥ崟涓鍔燘ID _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) fieldArr.push('bid') @@ -599,14 +624,17 @@ } let unionFields = fromJS(_fields).toJS() + let formArr = _fields.map(_f => _f.field.toLowerCase()) if (hasColumn) { columns.forEach(_f => { + if (_f.field && !formArr.includes(_f.field.toLowerCase())) { + formArr.push(_f.field.toLowerCase()) + unionFields.push(_f) + } if (!_f.field || fieldArr.includes(_f.field.toLowerCase())) return fieldArr.push(_f.field.toLowerCase()) - - unionFields.push(_f) _usefulfields.push(_f.field) if (_f.datatype) { // 鑷畾涔夊瓧娈� @@ -799,7 +827,7 @@ usefulfields: _usefulfields.join(', '), uniqueColumns: this.state.uniqueColumns.map(col => { if (col.dataIndex === 'field') { - col.options = _fields + col.options = uniqueFields } return col }), @@ -809,7 +837,8 @@ } return col }), - unionFields + unionFields, + uniqueFields }) }) } @@ -1304,7 +1333,7 @@ render() { const { card } = this.props - const { verify, fields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state + const { verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -1492,7 +1521,7 @@ } key="2"> <UniqueForm btn={card} - fields={card.Ot !== 'requiredOnce' ? fields : columnsFields} + fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields} dict={this.props.dict} uniqueChange={this.uniqueChange} /> -- Gitblit v1.8.0