|
@@ -1,5 +1,5 @@
|
|
|
import Header from '@/components/Header'
|
|
|
-import React, { useEffect } from 'react'
|
|
|
+import React, { useState, useEffect } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import SvgIcon from '@/components/SvgIcon'
|
|
|
import './index.scss'
|
|
@@ -11,30 +11,39 @@ import { Tooltip } from 'antd'
|
|
|
import { observer } from 'mobx-react'
|
|
|
import { apiGetDashboard } from './api'
|
|
|
import consts from '@/utils/consts'
|
|
|
+import { DashboardState } from '@/types/dashboard'
|
|
|
|
|
|
-interface iState {
|
|
|
|
|
|
-}
|
|
|
const Index = () => {
|
|
|
+ const messageType = {
|
|
|
+ 1: {
|
|
|
+ title: '安全巡检',
|
|
|
+ class: 'badge-success',
|
|
|
+ path: '/console/safe/content/detail/info'
|
|
|
+ },
|
|
|
+ 2: {
|
|
|
+ title: '质量巡检',
|
|
|
+ class: 'badge-info',
|
|
|
+ path: '/console/quality/content/detail/info'
|
|
|
+ }
|
|
|
+ }
|
|
|
useEffect(() => {
|
|
|
initData()
|
|
|
-
|
|
|
}, [])
|
|
|
useEffect(() => {
|
|
|
- if(!userStore.projectInfo.id) {
|
|
|
+ if (!userStore.projectInfo.id) {
|
|
|
userStore.getProjectInfo()
|
|
|
}
|
|
|
}, [ userStore.projectInfo.id ])
|
|
|
- // const [state, setState] = useState(initialState)
|
|
|
+ const [ state, setState ] = useState<DashboardState>({ approverData: [], messageData: [], versionData: { id: '', name: '', createTime: '', content: '' } })
|
|
|
const initData = async () => {
|
|
|
const { code = -1, data } = await apiGetDashboard()
|
|
|
- if (code !== consts.RET_CODE.SUCCESS) {
|
|
|
- console.log(data)
|
|
|
-
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ setState(data)
|
|
|
}
|
|
|
}
|
|
|
return (
|
|
|
- <div className="wrap-contaniner hide-menu">
|
|
|
+ <div className="wrap-contaniner hide-menu dashborad-content">
|
|
|
<Header title="待办事项"></Header>
|
|
|
<div className={styles.content}>
|
|
|
<span>系统消息</span>
|
|
@@ -49,25 +58,34 @@ const Index = () => {
|
|
|
<span>需要你处理</span>
|
|
|
</div>
|
|
|
<div className={styles.cardBody}>
|
|
|
- <ul>
|
|
|
- <li className="pi-flex-column">
|
|
|
- <div className="pi-justify-between">
|
|
|
- <div>
|
|
|
- <span className={[ 'pi-pd-lr-15', 'badge-success' ].join(' ')}>质量巡检</span>
|
|
|
- <span className="pi-pd-lr-15">
|
|
|
- <span>WWUJ-1 </span>
|
|
|
- <Link to="/console/dashboard">施工质量事故</Link>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <ZhButton size="small">审批</ZhButton>
|
|
|
- </div>
|
|
|
- <div className="pi-justify-between mt-1 ">
|
|
|
- <span>张三-监理一</span>
|
|
|
- <span>{dayjsFormat(new Date(), 'MM-DD HH:mm')}</span>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- {/* <p className="pi-text-center pi-muted">暂时没有需要你处理的事项</p> */}
|
|
|
+ {
|
|
|
+ state.approverData.length ? (
|
|
|
+ <ul>
|
|
|
+ {
|
|
|
+ state.approverData.map(item => {
|
|
|
+ return (
|
|
|
+ <li className="pi-flex-column" key={item.id}>
|
|
|
+ <div className="pi-justify-between">
|
|
|
+ <div>
|
|
|
+ <span className={[ 'pi-pd-lr-15', messageType[item.dataType]?.class ].join(' ')}>{messageType[item.dataType]?.title}</span>
|
|
|
+ <span className="pi-pd-lr-15">
|
|
|
+ <span>WWUJ-1 </span>
|
|
|
+ <Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId } }}>{item.inspectionDetail}</Link>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <ZhButton size="small"><Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId } }}>审批</Link></ZhButton>
|
|
|
+ </div>
|
|
|
+ <div className="pi-justify-between mt-1 ">
|
|
|
+ <span>{item.name}-{item.position}</span>
|
|
|
+ <span>{dayjsFormat(item.createTime, 'MM-DD HH:mm')}</span>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </ul>
|
|
|
+ ) : <p className="pi-text-center pi-muted">暂时没有需要你处理的事项</p>
|
|
|
+ }
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className={[ styles.card, 'pi-flex-quintuple', 'pi-mg-lr-30' ].join(' ')}>
|
|
@@ -76,22 +94,34 @@ const Index = () => {
|
|
|
</div>
|
|
|
<div className={styles.cardBody}>
|
|
|
<ul>
|
|
|
- <li className="pi-flex-column">
|
|
|
- <div className="pi-justify-start">
|
|
|
- <span className={[ 'pi-pd-lr-15', 'badge-success' ].join(' ')}>质量巡检</span>
|
|
|
- <span className="pi-pd-lr-15">
|
|
|
- <span>WWUJ-1 </span>
|
|
|
- <Link to="/console/dashboard" className="pi-mg-lr-5">
|
|
|
- 施工质量事故
|
|
|
- </Link>
|
|
|
- <span>审批完成,待整改</span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <div className="pi-justify-between mt-1">
|
|
|
- <span>张三-监理一</span>
|
|
|
- <span>{dayjsFormat(new Date(), 'MM-DD HH:mm')}</span>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
+ {
|
|
|
+ state.messageData.map(item => (
|
|
|
+ <li className="pi-flex-column" key={item.id}>
|
|
|
+ <div className="pi-justify-start">
|
|
|
+ <span className={[ 'pi-pd-lr-15', messageType[item.dataType]?.class ].join(' ')}>{messageType[item.dataType]?.title}</span>
|
|
|
+ <span className="pi-pd-lr-15">
|
|
|
+ {
|
|
|
+ item.content.split('|').map((content, idx) => {
|
|
|
+ if (idx === 0) {
|
|
|
+ return <span>{content} </span>
|
|
|
+ } else if (idx === 1) {
|
|
|
+ return <Link to={{ pathname: messageType[item.dataType]?.path, state: { id: item.dataId } }} className="pi-mg-lr-5">
|
|
|
+ {content}
|
|
|
+ </Link>
|
|
|
+ } else {
|
|
|
+ return <span>{content}</span>
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div className="pi-justify-between mt-1">
|
|
|
+ <span>{item.title}</span>
|
|
|
+ <span>{dayjsFormat(item.createTime, 'MM-DD HH:mm')}</span>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ ))
|
|
|
+ }
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -126,7 +156,7 @@ const Index = () => {
|
|
|
</div>
|
|
|
<div className={[ styles.card, 'mt-2' ].join(' ')}>
|
|
|
<div className={styles.cardBody}>
|
|
|
- <span className="pi-link-blue">当前版本: 1.2.0</span>
|
|
|
+ <span className="pi-link-blue">当前版本: {state.versionData.name}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div></div>
|