From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/tabviews/custom/components/module/voucher/loadFromTemp/index.jsx | 69 +++++++++++++++++++++++++++------- 1 files changed, 54 insertions(+), 15 deletions(-) diff --git a/src/tabviews/custom/components/module/voucher/loadFromTemp/index.jsx b/src/tabviews/custom/components/module/voucher/loadFromTemp/index.jsx index 07abbbb..a04a8ae 100644 --- a/src/tabviews/custom/components/module/voucher/loadFromTemp/index.jsx +++ b/src/tabviews/custom/components/module/voucher/loadFromTemp/index.jsx @@ -1,28 +1,65 @@ import React, {Component} from 'react' -import { Button, Modal } from 'antd' +import { Button, Modal, notification, Empty, Input } from 'antd' import './index.scss' + +const { Search } = Input class LoadFromTemp extends Component { state = { visible: false, tempId: '', + searchkey: '', + temps: [] } submit = () => { - const { name, typeChar, typeName } = this.state + const { tempId } = this.state + + if (!tempId) { + notification.warning({ + top: 92, + message: '璇烽�夋嫨妯℃澘锛�', + duration: 5 + }) + return + } this.setState({visible: false}) - this.props.onChange(name, typeChar, typeName) + this.props.onChange(tempId) } trigger = () => { - this.setState({visible: true, tempId: ''}) + const { tempTypes } = this.props + let temps = [] + + tempTypes.forEach(item => { + if (item.temp_list && item.temp_list.length > 0) { + item.temp_list.forEach(cell => { + temps.push({ + id: cell.temp_id, + voucher_text: cell.voucher_text || '', + data_name: item.data_name || '' + }) + }) + } + }) + + this.setState({visible: true, tempId: '', temps, searchkey: ''}) + } + + checkItem = (id) => { + this.setState({tempId: id}) } render() { - const { tempTypes } = this.props - const { visible, tempId } = this.state + const { visible, tempId, temps, searchkey } = this.state + + let _temps = temps + + if (searchkey) { + _temps = temps.filter(item => item.voucher_text.indexOf(searchkey) > -1 || item.data_name.indexOf(searchkey) > -1) + } return ( <> @@ -31,28 +68,30 @@ title="浠庢ā鏉夸腑鍔犺浇" wrapClassName="mk-temp-list-wrap" visible={visible} - width={600} + width={700} maskClosable={false} onOk={this.submit} onCancel={() => { this.setState({ visible: false })}} destroyOnClose > {visible ? <div className="document-wrap"> + <Search placeholder="" defaultValue="" style={{ minWidth: '200px' }} onSearch={(val) => this.setState({searchkey: val, tempId: ''})}/> <div className="document-title"> - <div className="folder-box">鏂囦欢澶�</div> + <div className="folder-box">妯℃澘绫诲瀷</div> <div className="folder"> - <span>鏂囦欢</span> + 妯℃澘鍚嶇О </div> </div> <div className="document-body"> - <div className="file-wrap"> - {tempTypes.map(doc => { - return <div className="file-item" key={doc.id}> - <span onClick={() => this.checkItem(doc.id)} className={'square-select' + (tempId === doc.id ? ' active' : '')}></span> - <span className="file-name">{doc.attachments_title}</span> + {_temps.length ? <div className="file-wrap"> + {_temps.map(doc => { + return <div className="file-item" onClick={() => this.checkItem(doc.id)} key={doc.id}> + <span className={'square-select' + (tempId === doc.id ? ' active' : '')}></span> + <span className="folder-name">{doc.data_name}</span> + <span className="file-name">{doc.voucher_text}</span> </div> })} - </div> + </div> : <Empty style={{padding: '10px 0px'}} description={null}/>} </div> </div> : null} </Modal> -- Gitblit v1.8.0