|  | @@ -1,42 +1,79 @@
 | 
	
		
			
				|  |  |  import Header from '@/components/Header'
 | 
	
		
			
				|  |  | -import React from 'react'
 | 
	
		
			
				|  |  | -import { RouteProps } from 'react-router'
 | 
	
		
			
				|  |  | +import { tenderStore } from '@/store/mobx'
 | 
	
		
			
				|  |  | +import consts from '@/utils/consts'
 | 
	
		
			
				|  |  | +import dayjs from 'dayjs'
 | 
	
		
			
				|  |  | +import React, { useEffect, useState } from 'react'
 | 
	
		
			
				|  |  | +import { useActivate } from 'react-activation'
 | 
	
		
			
				|  |  | +import { Link } from 'react-router-dom'
 | 
	
		
			
				|  |  | +import { apiGetSafeSurvey } from './api'
 | 
	
		
			
				|  |  |  import './index.scss'
 | 
	
		
			
				|  |  | +import PieChart from './pieChart'
 | 
	
		
			
				|  |  | +interface charListType {
 | 
	
		
			
				|  |  | +  [key: string]: number
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +interface iRectifyData {
 | 
	
		
			
				|  |  | +  auditName: string
 | 
	
		
			
				|  |  | +  createTime: string
 | 
	
		
			
				|  |  | +  id: string
 | 
	
		
			
				|  |  | +  inspectionDetail: string
 | 
	
		
			
				|  |  | +  status: number
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +interface iSummaryState {
 | 
	
		
			
				|  |  | +  approvalTotal: number
 | 
	
		
			
				|  |  | +  rectifyTotal: number
 | 
	
		
			
				|  |  | +  rectifyedData: charListType
 | 
	
		
			
				|  |  | +  rectifyedTotal: number
 | 
	
		
			
				|  |  | +  rectifylist: iRectifyData[]
 | 
	
		
			
				|  |  | +  submitData: charListType
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +const Summary: React.FC<{}> = () => {
 | 
	
		
			
				|  |  | +  useEffect(() => {
 | 
	
		
			
				|  |  | +    initData()
 | 
	
		
			
				|  |  | +  }, [])
 | 
	
		
			
				|  |  | +  const [ state, setState ] = useState<iSummaryState>({
 | 
	
		
			
				|  |  | +    approvalTotal: 0,
 | 
	
		
			
				|  |  | +    rectifyTotal: 0,
 | 
	
		
			
				|  |  | +    rectifyedTotal: 0,
 | 
	
		
			
				|  |  | +    rectifyedData: {},
 | 
	
		
			
				|  |  | +    rectifylist: [],
 | 
	
		
			
				|  |  | +    submitData: {}
 | 
	
		
			
				|  |  | +  })
 | 
	
		
			
				|  |  | +  useActivate(() => initData())
 | 
	
		
			
				|  |  | +  const initData = async () => {
 | 
	
		
			
				|  |  | +    const { data, code = -1 } = await apiGetSafeSurvey(tenderStore.bid)
 | 
	
		
			
				|  |  | +    if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  | +      setState({ ...state, ...data })
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const Summary:React.FC<RouteProps> = (props) => {
 | 
	
		
			
				|  |  | -  // console.log(props.location?.state)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  // useActivate(() => {
 | 
	
		
			
				|  |  | -  //   BidHander()
 | 
	
		
			
				|  |  | -  // })
 | 
	
		
			
				|  |  | -  // useEffect(() => {
 | 
	
		
			
				|  |  | -  //   BidHander()
 | 
	
		
			
				|  |  | -  // }, [])
 | 
	
		
			
				|  |  | -  // const BidHander = () => {
 | 
	
		
			
				|  |  | -  //   if (Object.keys(props.location?.state as object).length) {
 | 
	
		
			
				|  |  | -  //     // console.log(props.location?.state)
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  //     const { id = '', name = '' } = props.location?.state as {id: string;name: string}
 | 
	
		
			
				|  |  | -  //     id && (tenderStore.saveBidsectionId(id))
 | 
	
		
			
				|  |  | -  //     name && (tenderStore.saveName(name))
 | 
	
		
			
				|  |  | -  //   }
 | 
	
		
			
				|  |  | -  // }
 | 
	
		
			
				|  |  | +  const handleDate = (createTime: string) => {
 | 
	
		
			
				|  |  | +    return dayjs(new Date()).diff(dayjs(createTime), 'day') + '天'
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |    return (
 | 
	
		
			
				|  |  |      <div className="wrap-contaniner">
 | 
	
		
			
				|  |  |        <Header title="巡检概况"></Header>
 | 
	
		
			
				|  |  |        <div className="wrap-content m-3 pi-flex-column pi-justify-start">
 | 
	
		
			
				|  |  |          <div className="pi-justify-start">
 | 
	
		
			
				|  |  |            <div className="pi-flex-twice card pi-flex-column">
 | 
	
		
			
				|  |  | -            <header className="card-title">整改中 (23) </header>
 | 
	
		
			
				|  |  | +            <header className="card-title">整改中 ({state.rectifyTotal}) </header>
 | 
	
		
			
				|  |  |              <div>
 | 
	
		
			
				|  |  | -              <p>检查路面清洗,路面污染严重</p>
 | 
	
		
			
				|  |  | -              <p>检查路面清洗,路面污染严重</p>
 | 
	
		
			
				|  |  | -              <p>检查路面清洗,路面污染严重</p>
 | 
	
		
			
				|  |  | -              <p>检查路面清洗,路面污染严重</p>
 | 
	
		
			
				|  |  | +              {state.rectifylist.map(item => {
 | 
	
		
			
				|  |  | +                return (
 | 
	
		
			
				|  |  | +                  <div key={item.id} className="pi-justify-between pi-lh-18 pi-height-18">
 | 
	
		
			
				|  |  | +                    <Link to={{ pathname: '/console/safe/content/detail/info', state: { saveId: item.id } }}>{item.inspectionDetail}</Link>
 | 
	
		
			
				|  |  | +                    <div className="pi-align-center">
 | 
	
		
			
				|  |  | +                      <span className="pi-mg-right-5">{item.auditName}</span>
 | 
	
		
			
				|  |  | +                      <span className="pi-badge danger">{handleDate(item.createTime)}</span>
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                  </div>
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  | +              })}
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  | -          <div className="pi-flex-treble pi-mg-left-30 card"></div>
 | 
	
		
			
				|  |  | +          <div className="pi-flex-treble pi-mg-left-30 card">
 | 
	
		
			
				|  |  | +              <PieChart></PieChart>
 | 
	
		
			
				|  |  | +          </div>
 | 
	
		
			
				|  |  |          </div>
 | 
	
		
			
				|  |  |          <div className="card h-400 mt-3"></div>
 | 
	
		
			
				|  |  |        </div>
 |