From 7b0dbecd1d6155d26ec67be0a47a16264c738c85 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 09 五月 2023 14:48:10 +0800 Subject: [PATCH] 2023-05-09 --- src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 73 +++++++++++++++++++++++------------- 1 files changed, 47 insertions(+), 26 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index bf2bcc7..4580eb7 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -122,7 +122,7 @@ { title: '鎶ラ敊缂栫爜', dataIndex: 'errorCode', - width: '12%', + width: '10%', editable: true, inputType: 'select', options: [ @@ -135,13 +135,24 @@ { title: '楠岃瘉绫诲瀷', dataIndex: 'verifyType', - width: '12%', - render: (text, record) => record.verifyType === 'logic' ? '閫昏緫楠岃瘉' : '鐗╃悊楠岃瘉', + width: '14%', + render: (text, record) => { + let names = { + physical: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級', + logic: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級', + physical_temp: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級', + logic_temp: '閫昏緫楠岃瘉锛堜粎涓存椂琛級', + } + + return names[text] || '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' + }, inputType: 'select', editable: true, options: [ - { value: 'physical', text: '鐗╃悊楠岃瘉' }, - { value: 'logic', text: '閫昏緫楠岃瘉' } + { value: 'physical', text: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' }, + { value: 'logic', text: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級' }, + { value: 'physical_temp', text: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級' }, + { value: 'logic_temp', text: '閫昏緫楠岃瘉锛堜粎涓存椂琛級' } ] }, { @@ -239,15 +250,22 @@ UNSAFE_componentWillMount() { const { card } = this.props - let _verify = fromJS(card.verify || {range: 1}).toJS() + let _verify = fromJS(card.verify || {}).toJS() let _columns = _verify.columns || [] + + delete _verify.dataresource // 鏃ф暟鎹吋瀹� _columns = _columns.map(col => { col.required = col.required || 'true' col.type = col.type || 'Nvarchar(50)' col.import = col.import || 'true' - col.required = col.required || 'true' + + if (col.type === 'text' || col.type === 'image') { + col.type = 'Nvarchar(50)' + } else if (col.type === 'number') { + col.type = 'Decimal(18,2)' + } if (/^Nvarchar/ig.test(col.type)) { col.limit = col.type.match(/\d+/)[0] @@ -259,6 +277,10 @@ return col }) + + if (!_verify.hasOwnProperty('range')) { + _verify.range = 1 + } this.setState({ verify: { @@ -353,7 +375,7 @@ let _columns = JSON.parse(JSON.stringify(verify.columns)) - let _cols = _columns.map(col => col.Column ) + let _cols = _columns.map(col => col.Column) columns.forEach(col => { if (col.field && !_cols.includes(col.field)) { @@ -442,23 +464,14 @@ changeColumns = (columns) => { const { verify } = this.state - if (columns[0] && (columns[0].type === 'image' || columns[0].type === 'text')) { - columns = columns.map(col => { - let _cell = { - uuid: Utils.getuuid(), - Column: col.Column, - Text: col.Text, - type: 'Nvarchar(50)', - limit: '50', - import: 'true', - required: 'true' - } - - return _cell - }) - } - columns = columns.map(col => { + col.type = col.type || 'Nvarchar(50)' + if (col.type === 'text' || col.type === 'image') { + col.type = 'Nvarchar(50)' + } else if (col.type === 'number') { + col.type = 'Decimal(18,2)' + } + if (/^Nvarchar/ig.test(col.type)) { col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000' } else if (/^Decimal/ig.test(col.type)) { @@ -469,6 +482,9 @@ } else { col.limit = '' } + + col.required = col.required || 'true' + col.import = col.import || 'true' return col }) @@ -757,13 +773,18 @@ <Form {...formItemLayout}> <Row gutter={24}> <Col span={8}> - <Form.Item label="琛ㄥ悕"> + <Form.Item label={ + <Tooltip placement="bottomLeft" title="瀵煎叆鏃跺伐浣滆〃鍚嶄笌excel涓繀椤讳竴鑷达紝娉細宸ヤ綔琛ㄥ悕涓篠heet1涓攅xcel涓粎鏈変竴涓伐浣滆〃鏃朵笉杩涜琛ㄥ悕楠岃瘉銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 宸ヤ綔琛� + </Tooltip> + }> {getFieldDecorator('sheet', { initialValue: verify.sheet || '', rules: [ { required: true, - message: '璇疯緭鍏ヨ〃鍚�!' + message: '璇疯緭鍏ュ伐浣滆〃鍚�!' } ] })(<Input placeholder="" autoComplete="off" />)} -- Gitblit v1.8.0