From ce70be666bcd78a7e16e739040488cf7e7256cc2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 31 五月 2021 15:49:43 +0800 Subject: [PATCH] 2021-05-31 --- src/templates/zshare/modalform/index.jsx | 46 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 20b9e85..6225afa 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -22,7 +22,7 @@ checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'fieldlength', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'width', 'multiple'], multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra'], link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter'], - fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'suffix'], + fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress'], switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra'], date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode'], datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType'], @@ -49,6 +49,7 @@ openType: null, resourceType: null, supField: '', + compress: 'false', display: 'text', enter: '', cFields: [], @@ -62,6 +63,7 @@ let resourceType = '' let supField = '' let display = '' + let compress = 'false' let enter = '' let cFields = [] let linkSubFields = [] @@ -69,6 +71,8 @@ formlist.forEach(cell => { if (cell.key === 'type') { type = cell.initVal + } else if (cell.key === 'compress') { + compress = cell.initVal } else if (cell.key === 'display') { display = cell.initVal } else if (cell.key === 'enter') { @@ -92,10 +96,11 @@ } }) - let _options = this.getOptions(type, resourceType, supField, display, enter) + let _options = this.getOptions(type, resourceType, supField, display, enter, compress) this.setState({ enter: enter, + compress: compress, openType: type, supField: supField, display: display, @@ -143,7 +148,7 @@ } } - getOptions = (type, resourceType, supField, display, enter) => { + getOptions = (type, resourceType, supField, display, enter, compress) => { let _options = ['label', 'field', 'type', 'blacklist', 'writein', ...fromJS(modalTypeOptions[type]).toJS()] if (type === 'hint') { @@ -169,6 +174,12 @@ } else if (resourceType === '1') { // 鏁版嵁婧� _options.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database') } + } + } else if (type === 'fileupload') { + if (compress === 'true') { + _options.push('limit', 'rduri', 'proRduri') + } else { + _options.push('suffix') } } @@ -201,7 +212,7 @@ fieldValue.enter = 'false' } - let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, enter) + let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, enter, this.state.compress) this.setState({ openType: value, @@ -314,10 +325,10 @@ } onChange = (e, key) => { - const { openType } = this.state + const { openType, compress } = this.state let value = e.target.value if (key === 'resourceType') { - let _options = this.getOptions(openType, value, this.state.supField, this.state.display, this.state.enter) + let _options = this.getOptions(openType, value, this.state.supField, this.state.display, this.state.enter, compress) this.setState({ resourceType: value, @@ -327,7 +338,7 @@ }) }) } else if (key === 'display') { - let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, value, this.state.enter) + let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, value, this.state.enter, compress) this.setState({ display: value, @@ -336,8 +347,18 @@ return form }) }) + } else if (key === 'compress') { + let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, this.state.display, this.state.enter, value) + + this.setState({ + compress: value, + formlist: this.state.formlist.map(form => { + form.show = _options.includes(form.key) + return form + }) + }) } else if (key === 'enter') { - let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, this.state.display, value) + let _options = this.getOptions(openType, this.state.resourceType, this.state.supField, this.state.display, value, compress) this.setState({ enter: value, @@ -620,7 +641,12 @@ } else if (item.type === 'textarea') { fields.push( <Col span={24} key={index}> - <Form.Item className="text-msg" label={item.label}> + <Form.Item className="text-msg" label={item.tooltip ? + <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> {getFieldDecorator(item.key, { initialValue: item.initVal, rules: [ @@ -629,7 +655,7 @@ message: this.props.dict['form.required.input'] + item.label + '!' } ] - })(<TextArea rows={4} />)} + })(<TextArea rows={item.rows || 4} />)} </Form.Item> </Col> ) -- Gitblit v1.8.0