|
|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useEffect, useRef } from 'react'
|
|
|
+import React, { useEffect, useRef, useState } from 'react'
|
|
|
import styles from './index2.module.scss'
|
|
|
import { echartsFu1, echartsFu2, echartsFu4 } from './data'
|
|
|
import {
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
} from '@/store/action/A1dataSta'
|
|
|
import { cascaderObjFu } from '@/utils/history'
|
|
|
import { selectObj } from '@/utils/select'
|
|
|
+import { A5_APIGetDetail } from '@/store/action/A5ReportManage'
|
|
|
|
|
|
function A1dataSta() {
|
|
|
const echartRef1 = useRef<HTMLDivElement>(null)
|
|
|
@@ -19,6 +20,7 @@ function A1dataSta() {
|
|
|
const echartRef4 = useRef<HTMLDivElement>(null)
|
|
|
const echartRef5 = useRef<HTMLDivElement>(null)
|
|
|
const echartRef6 = useRef<HTMLDivElement>(null)
|
|
|
+ const [permissions, setPermissions] = useState<Record<number, number>>({})
|
|
|
|
|
|
const getLineChart = async () => {
|
|
|
const { data } = await A1_APIGetLineChart(14)
|
|
|
@@ -83,7 +85,7 @@ function A1dataSta() {
|
|
|
const { data } = await A1_APIGetCountDictTorn()
|
|
|
echartsFu2(
|
|
|
echartRef6.current!,
|
|
|
- '藏品类别',
|
|
|
+ '藏品完残程度',
|
|
|
0,
|
|
|
data.map((item: any) => ({
|
|
|
value: item.count,
|
|
|
@@ -92,17 +94,39 @@ function A1dataSta() {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ const getPermission = async () => {
|
|
|
+ const { data } = await A5_APIGetDetail()
|
|
|
+ const list = JSON.parse(data.rtf) || []
|
|
|
+ const temp: Record<number, number> = {}
|
|
|
+ list.forEach((item: any) => {
|
|
|
+ temp[item.id] = item.enabled
|
|
|
+ })
|
|
|
+ setPermissions(temp)
|
|
|
+ return temp
|
|
|
+ }
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
const dict = cascaderObjFu()
|
|
|
-
|
|
|
- getLineChart()
|
|
|
- getCountType(dict['文物类别'])
|
|
|
- getCountLevel()
|
|
|
- getCountOrder(selectObj['业务类型'])
|
|
|
- getCountTexture([...dict['单一质地'], ...dict['复合或组合质地']])
|
|
|
- getCountDictTorn(dict['完残程度'])
|
|
|
+ getPermission().then(per => {
|
|
|
+ per[1] && getLineChart()
|
|
|
+ per[2] && getCountType(dict['文物类别'])
|
|
|
+ per[3] && getCountLevel()
|
|
|
+ per[4] && getCountOrder(selectObj['业务类型'])
|
|
|
+ per[5] && getCountTexture([...dict['单一质地'], ...dict['复合或组合质地']])
|
|
|
+ per[6] && getCountDictTorn(dict['完残程度'])
|
|
|
+ })
|
|
|
}, [])
|
|
|
|
|
|
+ const panelConfigs = [
|
|
|
+ { permissionKey: 1, ref: echartRef1, className: 'A1box1rr' },
|
|
|
+ { permissionKey: 2, ref: echartRef2, className: 'A1box2rr' },
|
|
|
+ { permissionKey: 3, ref: echartRef3, className: 'A1box2rr' },
|
|
|
+ { permissionKey: 4, ref: echartRef4, className: 'A1box1rr' },
|
|
|
+ { permissionKey: 5, ref: echartRef5, className: 'A1box2rr' },
|
|
|
+ { permissionKey: 6, ref: echartRef6, className: 'A1box2rr' }
|
|
|
+ ]
|
|
|
+ const visiblePanels = panelConfigs.filter(panel => permissions[panel.permissionKey])
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.A1dataSta}>
|
|
|
<div className='pageTitle'>数据统计</div>
|
|
|
@@ -112,14 +136,9 @@ function A1dataSta() {
|
|
|
</h3>
|
|
|
|
|
|
<div className='A1box'>
|
|
|
- <div className='A1box1rr' ref={echartRef1}></div>
|
|
|
- <div className='A1box2rr' ref={echartRef2} style={{ width: 500 }}></div>
|
|
|
- <div className='A1box2rr' ref={echartRef3}></div>
|
|
|
- </div>
|
|
|
- <div className='A1box' style={{ marginTop: 30 }}>
|
|
|
- <div className='A1box1rr' ref={echartRef4}></div>
|
|
|
- <div className='A1box2rr' ref={echartRef5} style={{ width: 450 }}></div>
|
|
|
- <div className='A1box2rr' ref={echartRef6} style={{ width: 500 }}></div>
|
|
|
+ {visiblePanels.map(panel => (
|
|
|
+ <div key={panel.permissionKey} className={panel.className} ref={panel.ref}></div>
|
|
|
+ ))}
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|