From 7a2e1070c994039a2115be55953cd879f78f654d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 06 八月 2023 16:10:20 +0800 Subject: [PATCH] 2023-08-06 --- src/tabviews/custom/components/module/voucher/resetAttach/index.jsx | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/src/tabviews/custom/components/module/voucher/resetAttach/index.jsx b/src/tabviews/custom/components/module/voucher/resetAttach/index.jsx index fcbcb81..f90ba2e 100644 --- a/src/tabviews/custom/components/module/voucher/resetAttach/index.jsx +++ b/src/tabviews/custom/components/module/voucher/resetAttach/index.jsx @@ -41,6 +41,7 @@ list = list.map(item => { item.icon = this.getIcon(item.attachments_url) + item.name = this.getName(item.attachments_url) return item }) @@ -74,6 +75,7 @@ file.attachments = file.attachments.map(item => { item.id = item.attach_id item.icon = this.getIcon(item.attachments_url) + item.name = this.getName(item.attachments_url) item.data_code = file.data_code item.data_name = file.data_name item.BID = file.id @@ -152,6 +154,7 @@ } item.icon = this.getIcon(res.url) + item.name = this.getName(res.url) list.push(item) @@ -162,6 +165,14 @@ deleteFile = (id) => { this.setState({list: this.state.list.filter(item => item.id !== id)}) + } + + getName = (url) => { + if (!url || !/\//.test(url)) return url + + let names = url.split('/') + + return names[names.length - 1] } getIcon = (url) => { @@ -256,7 +267,7 @@ <img src={item.icon} alt=""/> <div className="attach-msg"> <div>{item.attachments_title}</div> - <div>{item.data_name ? item.data_name + ' / ' : ''}{item.attachments_url}</div> + <div>{item.data_name ? item.data_name + ' / ' : ''}{item.name}</div> </div> <div> <DeleteOutlined onClick={() => this.deleteFile(item.id)}/> -- Gitblit v1.8.0