From a29d9d644a2a30e9ef4afcc6d728c20c218dc359 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 15 六月 2023 14:25:28 +0800 Subject: [PATCH] 2023-06-15 --- src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 82 ++++++++++++++++++++++++++-------------- 1 files changed, 53 insertions(+), 29 deletions(-) diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index f8b115b..67cb5a2 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -87,6 +87,8 @@ {value: '[7, -7]', label: '鍓嶅悗涓冨ぉ'}, {value: '[30, -30]', label: '鍓嶅悗30澶�'}, {value: '[90, -90]', label: '鍓嶅悗90澶�'}, + {value: '[180, -180]', label: '鍓嶅悗180澶�'}, + {value: '[365, -365]', label: '鍓嶅悗365澶�'}, {value: '[-1, -1]', label: '鏄庡ぉ'}, {value: '[-2, -2]', label: '鍚庡ぉ'} ] @@ -104,12 +106,13 @@ datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow', 'query', 'labelwidth'], + switch: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'openVal', 'closeVal', 'openText', 'closeText', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], + check: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'openVal', 'closeVal', 'checkTip', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query', 'labelwidth'] } class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� formlist: PropTypes.any, // 琛ㄥ崟 card: PropTypes.object, // 鎼滅储鏉′欢淇℃伅 inputSubmit: PropTypes.any // 鍥炶溅鎻愪氦浜嬩欢 @@ -119,7 +122,6 @@ openType: null, // 鎼滅储鏉′欢鏄剧ず绫诲瀷 resourceType: null, // 涓嬫媺鎼滅储鏃讹紝閫夐」鏉ユ簮绫诲瀷 formlist: null, // 琛ㄥ崟 - display: null, cFields: [], textTooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛岀患鍚堟悳绱�', } @@ -189,17 +191,28 @@ shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'database') } } else if (type === 'checkcard') { + reRequired.fields = false if (this.record.display === 'picture') { if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� - shows.push('options', 'picratio') + shows.push('options', 'fields', 'picratio') } else if (this.record.resourceType === '1') { // 鏁版嵁婧� - shows.push('dataSource', 'cardValField', 'urlField', 'orderBy', 'orderType', 'database', 'picratio') + shows.push('dataSource', 'cardValField', 'fields', 'urlField', 'orderBy', 'orderType', 'database', 'picratio') + } + } else if (this.record.display === 'color') { + if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� + shows.push('options', 'fields') + } else if (this.record.resourceType === '1') { // 鏁版嵁婧� + shows.push('dataSource', 'cardValField', 'colorField', 'fields', 'orderBy', 'orderType', 'database') } } else { + reRequired.fields = true if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� - shows.push('options', 'fields', 'backgroundColor', 'borderColor') + shows.push('options', 'fields', 'selectStyle', 'border') } else if (this.record.resourceType === '1') { // 鏁版嵁婧� - shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'backgroundColor', 'borderColor') + shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle', 'border') + } + if (this.record.selectStyle === 'custom') { + shows.push('backgroundColor') } } shows.push('linkField') @@ -217,22 +230,24 @@ } if (type === 'text') { - reOptions.match = matchReg.text + reOptions.match = matchReg.class1 } else if (type === 'multiselect') { - reOptions.match = matchReg.multiselect + reOptions.match = matchReg.class3 } else if (type === 'select' || type === 'link') { - reOptions.match = matchReg.select + reOptions.match = matchReg.class1 + } else if (type === 'switch' || type === 'check') { + reOptions.match = matchReg.class2 } else if (type === 'date') { - reOptions.match = matchReg.date + reOptions.match = matchReg.class4 } else if (type === 'datemonth') { - reOptions.match = matchReg.datemonth + reOptions.match = matchReg.class5 } else if (type === 'dateweek' || type === 'daterange' || type === 'range') { - reOptions.match = matchReg.daterange + reOptions.match = matchReg.class5 } else if (type === 'checkcard') { if (this.record.multiple === 'false') { - reOptions.match = matchReg.select + reOptions.match = matchReg.class1 } else if (this.record.multiple === 'true') { - reOptions.match = matchReg.multiselect + reOptions.match = matchReg.class3 } } @@ -257,7 +272,6 @@ } optionChange = (key, value) => { - let oriType = this.record.type this.record[key] = value let _fieldval = {} @@ -282,9 +296,6 @@ if (value === 'checkcard') { this.record.multiple = 'false' _fieldval.multiple = 'false' - _fieldval.ratio = 24 - } else if (oriType === 'checkcard') { - _fieldval.ratio = 6 } if (this.record.options.length > 0) { @@ -414,7 +425,11 @@ let resource = this.props.form.getFieldValue('dataSource') || '' - resource = `select '' as ${field},'鍏ㄩ儴' as ${text} union all \n${resource}` + if (field === text) { + resource = `select '' as ${field} union all \n${resource}` + } else { + resource = `select '' as ${field},'鍏ㄩ儴' as ${text} union all \n${resource}` + } this.props.form.setFieldsValue({dataSource: resource}) } @@ -427,7 +442,6 @@ getFields() { const { getFieldDecorator } = this.props.form - const { dict } = this.props const { formlist } = this.state const fields = [] @@ -444,7 +458,7 @@ if (item.type === 'text') { let type = this.record.type rules = [ - { required: item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] if (item.key === 'field' || item.key === 'datefield') { rules.push({ @@ -477,7 +491,7 @@ } } else if (item.type === 'number') { rules = [ - { required: item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] initVal = item.initVal @@ -488,7 +502,7 @@ } } else if (item.type === 'select') { // 涓嬫媺鎼滅储 rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] content = <Select @@ -506,10 +520,10 @@ </Select> } else if (item.type === 'radio') { rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] - content = <Radio.Group onChange={(e) => {this.optionChange(item.key, e.target.value)}}> + content = <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.optionChange(item.key, e.target.value)}}> {item.options.map(option => { return ( <Radio key={option.value} value={option.value}>{option.text}</Radio> @@ -518,7 +532,7 @@ </Radio.Group> } else if (item.type === 'codemirror') { rules = [ - { required: item.required, message: dict['form.required.input'] + item.label + '!' } + { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] span = 24 className = 'text-area' @@ -540,16 +554,20 @@ if (this.record.linkField) { type = 'link' } - content = <DataTable dict={dict} type={type} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/> + content = <DataTable type={type} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/> } } else if (item.type === 'fields') { span = 24 className = 'text-area' - content = <FieldsTable dict={dict} onChange={this.changeField}/> + rules = [ + { required: item.required, message: '璇锋坊鍔�' + item.label + '!' } + ] + + content = <FieldsTable onChange={this.changeField}/> } else if (item.type === 'checkbox') { rules = [ - { required: item.required, message: dict['form.required.select'] + item.label + '!' } + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } ] content = <Checkbox.Group style={{width: '105%'}} options={item.options} onChange={(values) => this.optionChange(item.key, values)}/> @@ -567,6 +585,10 @@ content = <Cascader options={item.options} placeholder="" /> } else if (item.type === 'color') { className = 'color-form-item' + rules = [ + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } + ] + content = <ColorSketch allowClear={true}/> } @@ -722,6 +744,8 @@ }) return } + } else if (values.type === 'switch' || values.type === 'check') { + values.initval = values.initval === values.openVal ? values.openVal : values.closeVal } ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => { -- Gitblit v1.8.0