From fe5b0a3f4564db409376f26a308176d0928766ec Mon Sep 17 00:00:00 2001 From: dushixiang <798148596@qq.com> Date: Sat, 20 Feb 2021 17:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=94=A8=E6=88=B7&=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E5=88=97=E8=A1=A8=E8=B5=84=E4=BA=A7=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/user/UserShareAsset.js | 85 +++++++++++++++---- .../components/user/UserShareSelectedAsset.js | 85 +++++++++++++++---- 2 files changed, 138 insertions(+), 32 deletions(-) diff --git a/web/src/components/user/UserShareAsset.js b/web/src/components/user/UserShareAsset.js index e412e71..8ed6e77 100644 --- a/web/src/components/user/UserShareAsset.js +++ b/web/src/components/user/UserShareAsset.js @@ -25,6 +25,8 @@ import {message} from "antd/es"; import {DeleteOutlined, ExclamationCircleOutlined, PlusOutlined, SyncOutlined, UndoOutlined} from '@ant-design/icons'; import {PROTOCOL_COLORS} from "../../common/constants"; import UserShareSelectedAsset from "./UserShareSelectedAsset"; +import {isEmpty} from "../../utils/utils"; +import dayjs from "dayjs"; const confirm = Modal.confirm; const {Search} = Input; @@ -34,6 +36,7 @@ const {Title, Text} = Typography; class UserShareAsset extends Component { inputRefOfName = React.createRef(); + inputRefOfIp = React.createRef(); changeOwnerFormRef = React.createRef(); state = { @@ -132,6 +135,17 @@ class UserShareAsset extends Component { this.loadTableData(query); }; + handleSearchByIp = ip => { + let query = { + ...this.state.queryParams, + 'pageIndex': 1, + 'pageSize': this.state.queryParams.pageSize, + 'ip': ip, + } + + this.loadTableData(query); + }; + handleTagsChange = tags => { let query = { ...this.state.queryParams, @@ -177,31 +191,53 @@ class UserShareAsset extends Component { ); } - }, { - title: '网络', - dataIndex: 'ip', - key: 'ip', - render: (text, record) => { - - return record['ip'] + ':' + record['port']; - } }, { title: '连接协议', dataIndex: 'protocol', key: 'protocol', render: (text, record) => { - - return ({text}); + const title = `${record['ip'] + ':' + record['port']}` + return ( + + {text} + + ) + } + }, { + title: '标签', + dataIndex: 'tags', + key: 'tags', + render: tags => { + if (!isEmpty(tags)) { + let tagDocuments = [] + let tagArr = tags.split(','); + for (let i = 0; i < tagArr.length; i++) { + if (tags[i] === '-') { + continue; + } + tagDocuments.push({tagArr[i]}) + } + return tagDocuments; + } } }, { title: '状态', dataIndex: 'active', key: 'active', render: text => { + if (text) { - return (); + return ( + + + + ) } else { - return (); + return ( + + + + ) } } }, { @@ -211,8 +247,15 @@ class UserShareAsset extends Component { }, { title: '创建日期', dataIndex: 'created', - key: 'created' - } + key: 'created', + render: (text, record) => { + return ( + + {dayjs(text).fromNow()} + + ) + } + }, ]; const selectedRowKeys = this.state.selectedRowKeys; @@ -229,10 +272,10 @@ class UserShareAsset extends Component {
- + 授权资产列表 - + + + } onClick={() => { this.inputRefOfName.current.setValue(''); + this.inputRefOfIp.current.setValue(''); this.loadTableData({ ...this.state.queryParams, pageIndex: 1,