From da34633b25d16359cd91a656acad5e811f9972b7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 14 三月 2023 18:09:54 +0800 Subject: [PATCH] 2023-03-14 --- src/components/normalform/modalform/index.jsx | 62 ++++++++++++++++++++++++------- 1 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index bc471f7..eb177a9 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -13,6 +13,7 @@ const { TextArea } = Input const MKRadio = asyncComponent(() => import('./mkRadio')) +const MKTable = asyncComponent(() => import('./mkTable')) const MKCheckbox = asyncComponent(() => import('./mkCheckbox')) const StyleInput = asyncComponent(() => import('./styleInput')) const MKFileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) @@ -56,6 +57,10 @@ required: item.required, message: item.label + '涓嶅彲涓虹┖!' }] + + if (item.rules) { + _rules.push(...item.rules) + } item.rules = _rules } else if (item.type === 'number') { @@ -66,13 +71,19 @@ validator: (rule, value, callback) => this.handleConfirmPassword(rule, value, callback, item) }] } else if (item.type === 'textarea') { - let _rules = [ + item.rules = [ { required: item.required, message: item.label + '涓嶅彲涓虹┖!' } ] - item.rules = _rules + } else if (item.type === 'table') { + item.rules = [ + { + required: item.required, + message: '璇锋坊鍔�' + item.label + '!' + } + ] } else { item.rules = [ { @@ -94,7 +105,6 @@ let supItem = fieldMap.get(key) let fields = [] - controlFields[key].forEach(item => { if (!fieldMap.has(item.field)) return @@ -102,7 +112,9 @@ if (cell.hidden) return - if (supItem.hidden) { + if (cell.skip && supItem.forbid) { // 涓婄骇琛ㄥ崟绂佺敤鏃讹紝姝よ〃鍗曚笉鍙楁帶鍒� + + } else if (supItem.hidden) { cell.hidden = true } else if (supItem.type === 'checkbox') { let vals = [...supItem.initval, ...item.values] @@ -253,20 +265,42 @@ content = (<MkEditIcon allowClear={item.allowClear}/>) } else if (item.type === 'source') { content = (<SourceComponent type="" placement="right"/>) + } else if (item.type === 'table') { + content = (<MKTable tip={item.tip || ''} columns={item.columns || []} actions={item.actions || []}/>) + } else if (item.type === 'hint') { + fields.push( + <Col span={24} key={index}> + <div style={{color: '#1890ff', borderBottom: '1px solid #e9e9e9', marginBottom: '15px', paddingLeft: '10px'}}>{item.label}</div> + </Col> + ) + return } if (!content) return - fields.push( - <Col span={item.span || 12} key={index}> - <Form.Item label={label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: item.rules - })(content)} - </Form.Item> - </Col> - ) + if (item.help) { + fields.push( + <Col span={item.span || 12} key={index}> + <Form.Item label={label} help={<span style={{fontSize: '12px'}}>{item.help}</span>}> + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: item.rules + })(content)} + </Form.Item> + </Col> + ) + } else { + fields.push( + <Col span={item.span || 12} key={index}> + <Form.Item label={label}> + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: item.rules + })(content)} + </Form.Item> + </Col> + ) + } }) return fields -- Gitblit v1.8.0