|
@@ -4,11 +4,16 @@ import { Button, Modal } from 'antd'
|
|
|
import { A6FromDataType } from './type'
|
|
|
import { B2FromDataType } from '../B2exhiLog/type'
|
|
|
import { Loc_APIlist } from '@/store/action/A6record'
|
|
|
-import MyTable from '@/components/MyTable'
|
|
|
+
|
|
|
+type ListTimeType = {
|
|
|
+ time: string
|
|
|
+ num: number
|
|
|
+}
|
|
|
|
|
|
type ListType = {
|
|
|
id: string
|
|
|
- num: number
|
|
|
+ numAll: number
|
|
|
+ timeArr: ListTimeType[]
|
|
|
}
|
|
|
|
|
|
type Props = {
|
|
@@ -32,15 +37,26 @@ function LocStat({ type, apiObj, closeFu }: Props) {
|
|
|
if (res.code === 0) {
|
|
|
const listTemp: ListType[] = []
|
|
|
|
|
|
- const resList: any[] = res.data
|
|
|
- resList.forEach((obj: any) => {
|
|
|
- for (const k in obj) {
|
|
|
- listTemp.push({
|
|
|
- id: k,
|
|
|
- num: obj[k]
|
|
|
- })
|
|
|
+ const resObj: any = res.data || {}
|
|
|
+ // const resObj: any = {
|
|
|
+ // '广东省-珠海市': { am: 1, pm: 1 }
|
|
|
+ // }
|
|
|
+
|
|
|
+ for (const k1 in resObj) {
|
|
|
+ let objOne: any = {}
|
|
|
+ objOne.id = k1
|
|
|
+ let numAll = 0
|
|
|
+ let arr1: any = []
|
|
|
+ for (const k2 in resObj[k1]) {
|
|
|
+ numAll += resObj[k1][k2]
|
|
|
+ arr1.push({ time: k2, num: resObj[k1][k2] })
|
|
|
}
|
|
|
- })
|
|
|
+ objOne.timeArr = arr1
|
|
|
+ objOne.numAll = numAll
|
|
|
+ listTemp.push(objOne)
|
|
|
+ }
|
|
|
+ // console.log('-----', listTemp)
|
|
|
+
|
|
|
setList(listTemp)
|
|
|
}
|
|
|
}, [apiObj, type])
|
|
@@ -58,16 +74,38 @@ function LocStat({ type, apiObj, closeFu }: Props) {
|
|
|
[] // 设置footer为空,去掉 取消 确定默认按钮
|
|
|
}
|
|
|
>
|
|
|
- <MyTable
|
|
|
- list={list}
|
|
|
- columnsTemp={[
|
|
|
- ['txt', '地区', 'id'],
|
|
|
- ['txt', '预约记录', 'num']
|
|
|
- ]}
|
|
|
- lastBtn={[]}
|
|
|
- pagingInfo={false}
|
|
|
- />
|
|
|
-
|
|
|
+ <div className='LocList'>
|
|
|
+ {list && list.length ? (
|
|
|
+ list.map(item => (
|
|
|
+ <div key={item.id} className='LocRow'>
|
|
|
+ <div className='LocRow1'>
|
|
|
+ <div className='LocRow1Wei'>地区:</div>
|
|
|
+ <div>{item.id}</div> 
|
|
|
+ <div className='LocRow1Wei'>总人数:</div>
|
|
|
+ <div>{item.numAll}</div>
|
|
|
+ </div>
|
|
|
+ <div className='LocRow1'>
|
|
|
+ <div className='LocRow1Wei'>时段人数:</div>
|
|
|
+ {item.timeArr.map(item2 => (
|
|
|
+ <div key={item2.time}>
|
|
|
+ (
|
|
|
+ <span>
|
|
|
+ {item2.time === 'am'
|
|
|
+ ? '上午'
|
|
|
+ : item2.time === 'pm'
|
|
|
+ ? '下午'
|
|
|
+ : item2.time}
|
|
|
+ </span>
|
|
|
+ :{item2.num})
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))
|
|
|
+ ) : (
|
|
|
+ <div className='LocNull'>暂无数据</div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
<div className='Locbtn'>
|
|
|
<Button onClick={closeFu}>关闭</Button>
|
|
|
</div>
|