import React, { useEffect, useState } from 'react' import { connect } from 'react-redux'; import moment from 'moment'; import ApproveModal from '../components/approveModal'; import { Tabs, Form, Input, DatePicker, Button, Table } from 'antd'; import { v1 } from 'uuid'; function MyApplication ({ loading, clientHeight, actions, dispatch, user }) { const { resourceConsumption } = actions const [query, setQuery] = useState({ page: 0, limit: 10 }); const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); const [formData, setFormData] = useState({}) useEffect(() => { resourceData() }, []) let resourceData = (params) => { let data = params || query dispatch(resourceConsumption.getApproveList({ applyById: user?.id, ...formData, ...data, })).then(res => { if (res.success) { setProTableList(res.payload.data) } }) } const columns = [{ title: '资源名称', dataIndex: 'resourceName', }, { title: '申请人', dataIndex: 'applyBy', render: (text, record) => record?.user?.name }, { title: '需求描述', dataIndex: 'requirements', }, { title: '数据类型', dataIndex: 'resourceType', }, { title: '令牌', dataIndex: 'token', render: (text, record) => text || '--' }, { title: '申请时间', dataIndex: 'applyAt', render: (text, record) => text && moment(text).format('YYYY-MM-DD HH:mm:ss') || '--', sorter: { compare: (a, b) => moment(b?.applyAt).valueOf() - moment(a?.applyAt).valueOf(), // multiple: 2, }, }, { title: '审批意见', dataIndex: 'result', render: (text, record) => record?.approveState == '审批中' ? record?.approveState : record?.approveState == '已审批' ? record?.token ? "审批通过" : "审批不通过" : "--" }, { title: '意见内容', dataIndex: 'approveRemarks', render: (text, record) => text || '--' }, { title: '审批时间', dataIndex: 'approveAt', render: (text, record) => text && moment(text).format('YYYY-MM-DD HH:mm:ss') || '--', sorter: { compare: (a, b) => moment(b?.approveAt).valueOf() - moment(a?.approveAt).valueOf(), // multiple: 2, }, }]; return <>