From 06404e701a89955958cbf56213e2eec618d8644d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 16 十二月 2020 18:36:16 +0800 Subject: [PATCH] 2020-12-16 --- src/tabviews/zshare/topSearch/index.jsx | 39 +++++++++++++++++++++------------------ 1 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 5b1dea1..161d170 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -8,6 +8,8 @@ import options from '@/store/options.js' import DateGroup from '@/tabviews/zshare/dategroup' import Utils from '@/utils/utils.js' +import zhCN from '@/locales/zh-CN/main.js' +import enUS from '@/locales/en-US/main.js' import './index.scss' const {MonthPicker, WeekPicker, RangePicker} = DatePicker @@ -17,10 +19,10 @@ BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� menuType: PropTypes.any, // 鑿滃崟鏉冮檺锛屾槸鍚︿负HS searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object // 瀛楀吀椤� } state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 style: null, // 鎼滅储鏉′欢绫诲瀷 label: null, // 鎻愮ず鏂囧瓧 @@ -46,7 +48,7 @@ if (fieldMap.has(item.field)) { item.field = item.field + '@tail@' } - fieldMap.set(item.field, true) + fieldMap.set(item.field, item) match[item.field] = item.match label[item.field] = item.label @@ -58,7 +60,7 @@ item.options.unshift({ key: Utils.getuuid(), Value: '', - Text: this.props.dict['main.all'] + Text: this.state.dict['main.all'] }) } @@ -101,7 +103,7 @@ let _groups = [] _list = _list.map(item => { if (item.type === 'link') { - let supItem = _list.filter(form => form.field === item.linkField)[0] + let supItem = fieldMap.get(item.linkField) if (!supItem) { notification.warning({ @@ -112,7 +114,7 @@ item.supInitVal = '' } else { item.supInitVal = supItem.initval - item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) + item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval || option.Value === '') } } else if (item.type === 'group' && item.Hide !== 'true') { _groups.push(fromJS(item).toJS()) @@ -263,7 +265,7 @@ searchlist: _searchlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { - item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) + item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '') } else { item.options = item.oriOptions } @@ -349,7 +351,7 @@ searchlist: _searchlist.map(item => { if (item.type === 'link') { if (item.supInitVal) { - item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) + item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '') } else { item.options = item.oriOptions } @@ -370,7 +372,7 @@ supfields.forEach(supfield => { formlist = formlist.map(item => { if (item.type === 'link' && item.linkField === supfield.field) { - item.options = item.oriOptions.filter(option => option.ParentID === supfield.initval) + item.options = item.oriOptions.filter(option => option.ParentID === supfield.initval || option.Value === '') item.initval = item.options[0] ? item.options[0].Value : '' if (this.props.form.getFieldValue(item.field) !== undefined) { @@ -397,7 +399,7 @@ let fieldsvalue = {} formlist = formlist.map(item => { if (item.type === 'link' && item.linkField === _field.field) { - item.options = item.oriOptions.filter(option => option.ParentID === value) + item.options = item.oriOptions.filter(option => option.ParentID === value || option.Value === '') item.initval = item.options[0] ? item.options[0].Value : '' if (this.props.form.getFieldValue(item.field) !== undefined) { @@ -429,6 +431,7 @@ getFields() { const { getFieldDecorator } = this.props.form + const { dict } = this.state const fields = [] this.state.searchlist.forEach((item, index) => { @@ -443,7 +446,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.input'] + item.label + '!' + message: dict['form.required.input'] + item.label + '!' } ] })(<Input placeholder="" autoComplete="off" />)} @@ -459,7 +462,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' + message: dict['form.required.select'] + item.label + '!' } ] })( @@ -487,7 +490,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' + message: dict['form.required.select'] + item.label + '!' } ] })( @@ -515,7 +518,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' + message: dict['form.required.select'] + item.label + '!' } ] })( @@ -533,7 +536,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' + message: dict['form.required.select'] + item.label + '!' } ] })( @@ -551,7 +554,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' + message: dict['form.required.select'] + item.label + '!' } ] })( @@ -581,7 +584,7 @@ rules: [ { required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' + message: dict['form.required.select'] + item.label + '!' } ] })( @@ -610,10 +613,10 @@ <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}> <Button type="primary" htmlType="submit"> - {this.props.dict['main.search']} + {dict['main.search']} </Button> <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> - {this.props.dict['main.reset']} + {dict['main.reset']} </Button> </Form.Item> </Col> -- Gitblit v1.8.0