From db8b368c5fd611732e26425c974dddd16ae09a82 Mon Sep 17 00:00:00 2001 From: liuwh <964324856@qq.com> Date: Sat, 14 Sep 2024 10:03:22 +0800 Subject: [PATCH] 修改提交 --- gz-customerSystem/src/components/NewTableSearch/index.jsx | 128 ++++++++++++++++++++++-------------------- 1 files changed, 67 insertions(+), 61 deletions(-) diff --git a/gz-customerSystem/src/components/NewTableSearch/index.jsx b/gz-customerSystem/src/components/NewTableSearch/index.jsx index 5964455..c2d55df 100644 --- a/gz-customerSystem/src/components/NewTableSearch/index.jsx +++ b/gz-customerSystem/src/components/NewTableSearch/index.jsx @@ -59,68 +59,74 @@ return ( <Form form={form} labelAlign="right" className="tableSearch"> - <Row gutter={[24, 16]}> - {itemData.map((x, t) => { - let placeholder = x.placeholder || setPlaceholder(x.name, x.type); - let allowClear = x.allowClear || true; - let dom = null; - let rules = {}; - if (x.type === 'Input') { - dom = <Input placeholder={placeholder} allowClear {...x} />; - rules = { max: x.max || 32, message: '搜索内容过长' }; - } - if (x.type === 'Select') { - dom = ( - <Select allowClear placeholder={placeholder} {...x}> - {x.selectdata?.map((y) => ( - <Option key={y.value}>{y.label}</Option> - ))} - </Select> - ); - } - if (x.type === 'RangePicker') { - rules = { type: 'array' }; - dom = ( - <RangePicker - style={{ width: '100%' }} - ranges={{ - '今日': [$$.myMoment(), $$.myMoment()], - '本月': [$$.myMoment().startOf('month'), $$.myMoment().endOf('month')], - }} - allowClear - {...x} - /> - ); - } - if (x.type === 'TreeSelect') { - dom = ( - <TreeSelect - showSearch - placeholder={placeholder} - dropdownStyle={{ maxHeight: 500, overflow: 'auto' }} - treeData={x.treedata} - treeDefaultExpandAll - allowClear - filterTreeNode={(inputValue, treeNode) => (treeNode.label.indexOf(inputValue) !== -1 ? true : false)} - {...x} - /> - ); - } - return ( - <> - <Col span={8} style={display && { display: searchMore ? 'block' : t < lineNum ? 'block' : 'none' }} key={t + 1}> - <Form.Item name={x.name} rules={[rules]} label={<div style={{ width: `${fontSize * labelLength}px` }}>{x.label}</div>}> - {dom} - </Form.Item> - </Col> - <Col span={8}></Col> - <Col span={8}></Col> - </> + + {itemData.map((x, t) => { + let placeholder = x.placeholder || setPlaceholder(x.name, x.type); + let allowClear = x.allowClear || true; + let dom = null; + let rules = {}; + if (x.type === 'Input') { + dom = <Input placeholder={placeholder} allowClear {...x} />; + rules = { max: x.max || 32, message: '搜索内容过长' }; + } + if (x.type === 'Select') { + dom = ( + <Select allowClear placeholder={placeholder} {...x}> + {x.selectdata?.map((y) => ( + <Option key={y.value}>{y.label}</Option> + ))} + </Select> ); - })} - </Row> + } + if (x.type === 'RangePicker') { + rules = { type: 'array' }; + dom = ( + <RangePicker + style={{ width: '100%' }} + ranges={{ + '今日': [$$.myMoment(), $$.myMoment()], + '本月': [$$.myMoment().startOf('month'), $$.myMoment().endOf('month')], + }} + allowClear + {...x} + /> + ); + } + if (x.type === 'TreeSelect') { + dom = ( + <TreeSelect + showSearch + placeholder={placeholder} + dropdownStyle={{ maxHeight: 500, overflow: 'auto' }} + treeData={x.treedata} + treeDefaultExpandAll + allowClear + filterTreeNode={(inputValue, treeNode) => (treeNode.label.indexOf(inputValue) !== -1 ? true : false)} + {...x} + /> + ); + } + return ( + <Row className='tableSearch-searchMore-row' gutter={[24, 16]} style={display && { display: searchMore ? 'block' : t < lineNum ? 'block' : 'none' }}> + <Col span={x.span || 8} key={t + 1}> + <Form.Item name={x.name} rules={[rules]} label={<div style={{ width: `${fontSize * labelLength}px` }}>{x.label}</div>}> + {dom} + </Form.Item> + </Col> + </Row> + // <div> + // <Col span={8} style={display && { display: searchMore ? 'block' : t < lineNum ? 'block' : 'none' }} key={t + 1}> + // <Form.Item name={x.name} rules={[rules]} label={<div style={{ width: `${fontSize * labelLength}px` }}>{x.label}</div>}> + // {dom} + // </Form.Item> + // </Col> + // <Col span={8}></Col> + // <Col span={8}></Col> + // </div> + ); + })} <Row style={{ marginTop: '16px' }}> - <Col span={24} style={{ textAlign: 'right' }}> + <Col span={24} style={{ textAlign: 'left' }}> <Button className="public-buttonMargin" onClick={handleReset}> 重置 </Button> @@ -129,7 +135,7 @@ </Button> {display && ( <span className="tableSearch-searchMore" onClick={() => setSearchMore(!searchMore)}> - {!searchMore ? '展开' : '折叠'} + {!searchMore ? '展开更多' : '收起更多'} <DownOutlined className={`tableSearch-searchMore-icon ${searchMore && 'tableSearch-searchMore-iconRotate'}`} /> </span> )} -- Gitblit v1.8.0