chenlei hace 1 mes
padre
commit
cb110cd494

+ 9 - 6
src/pages/A_workbench/A1dataSta/index2.module.scss

@@ -17,18 +17,21 @@
 
   :global {
     .A1box {
-      margin: 10px 0;
+      margin: 30px 0 0;
       display: flex;
-      align-items: center;
+      align-items: stretch;
       gap: 20px;
+      flex-wrap: wrap;
     }
     .A1box1rr {
-      flex: 1;
-      height: 300px;
+      flex: 2 1 450px;
+      min-width: 400px;
+      height: 350px;
     }
     .A1box2rr {
-      width: 370px;
-      height: 300px;
+      flex: 1 1 430px;
+      min-width: 300px;
+      height: 350px;
     }
   }
 }

+ 36 - 17
src/pages/A_workbench/A1dataSta/index2.tsx

@@ -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>
   )

+ 1 - 1
src/pages/A_workbench/A4voucher/index.tsx

@@ -215,7 +215,7 @@ function A4voucher() {
 
   return (
     <div className={styles.A4voucher}>
-      <div className='pageTitle'>凭证管理</div>
+      <div className='pageTitle'>凭证签章管理</div>
 
       {/* 第一行 */}
       <div className='C1top'>

+ 0 - 0
src/pages/A_workbench/A5ReportManage/index.module.scss


+ 101 - 0
src/pages/A_workbench/A5ReportManage/index.tsx

@@ -0,0 +1,101 @@
+import React, { useEffect, useMemo } from 'react'
+import MyTable from '@/components/MyTable'
+import styles from './index.module.scss'
+import { Switch } from 'antd'
+import { A5_APIGetDetail, A5_APISave } from '@/store/action/A5ReportManage'
+
+const A5tableC = [
+  ['txt', '视图类型', 'label'],
+  ['txtChange', '状态', 'enabled', { 0: '禁用', 1: '启用' }]
+]
+
+function A5ReportManage() {
+  const [list, setList] = React.useState<{ id: number; label: string; enabled: 0 | 1 }[]>([
+    // {
+    //   id: 1,
+    //   label: '近14天已登记藏品数量',
+    //   enabled: 1
+    // },
+    // {
+    //   id: 2,
+    //   label: '已处理订单数量',
+    //   enabled: 1
+    // },
+    // {
+    //   id: 3,
+    //   label: '藏品类别',
+    //   enabled: 1
+    // },
+    // {
+    //   id: 4,
+    //   label: '藏品级别',
+    //   enabled: 1
+    // },
+    // {
+    //   id: 5,
+    //   label: '藏品质地',
+    //   enabled: 1
+    // },
+    // {
+    //   id: 6,
+    //   label: '完残程度',
+    //   enabled: 1
+    // }
+  ])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: (typeof list)[number]) => {
+          console.log(item.label, Boolean(item.enabled))
+          return (
+            <Switch
+              defaultChecked={Boolean(item.enabled)}
+              onChange={i => {
+                const index = list.findIndex(v => v.id === item.id)
+                const temp = [...list]
+                temp[index].enabled = i ? 1 : 0
+                saveDetail(temp)
+              }}
+            />
+          )
+        }
+      }
+    ]
+  }, [list])
+
+  const getDetail = async () => {
+    const { data } = await A5_APIGetDetail()
+    setList(JSON.parse(data.rtf) || [])
+  }
+
+  const saveDetail = async (arr: any[]) => {
+    await A5_APISave({
+      id: 50002,
+      rtf: JSON.stringify(arr)
+    })
+  }
+
+  useEffect(() => {
+    getDetail()
+  }, [])
+
+  return (
+    <div className={styles.Z2numRule}>
+      <div className='pageTitle'>可视化试图管理</div>
+      <MyTable
+        emptyText={true}
+        yHeight={680}
+        list={list}
+        columnsTemp={A5tableC}
+        lastBtn={tableLastBtn}
+        pagingInfo={false}
+      />
+    </div>
+  )
+}
+
+const MemoA5ReportManage = React.memo(A5ReportManage)
+
+export default MemoA5ReportManage

+ 7 - 2
src/pages/Layout/data.ts

@@ -26,7 +26,7 @@ const tabLeftArr: RouterType = [
       },
       {
         id: 140,
-        name: '凭证管理',
+        name: '凭证签章管理',
         path: '/voucher',
         Com: React.lazy(() => import('../A_workbench/A4voucher'))
       }
@@ -275,7 +275,12 @@ const tabLeftArr: RouterType = [
         path: '/flowSet',
         Com: React.lazy(() => import('../Z_system/Z3flowSet'))
       },
-
+      {
+        id: 150,
+        name: '可视化视图管理',
+        path: '/reportManage',
+        Com: React.lazy(() => import('../A_workbench/A5ReportManage'))
+      },
       {
         id: 740,
         name: '组织管理',

+ 12 - 0
src/store/action/A5ReportManage.ts

@@ -0,0 +1,12 @@
+import http from '@/utils/http'
+
+/**
+ * 配置-详情
+ */
+export const A5_APIGetDetail = () => {
+  return http.get(`/cms/dict/config/50002`)
+}
+
+export const A5_APISave = (data: any) => {
+  return http.post(`/cms/dict/config/save`, data)
+}

+ 2 - 2
src/utils/http.ts

@@ -15,8 +15,8 @@ const toErrPageFu = (path: string, txt: string) => {
 
 export const envFlag = process.env.NODE_ENV === 'development'
 
-// const baseUrlTemp = 'https://sit-leshancms.4dage.com' // 测试环境
-const baseUrlTemp = 'http://192.168.20.61:8109' // 线下环境
+const baseUrlTemp = 'https://sit-leshancms.4dage.com' // 测试环境
+// const baseUrlTemp = 'http://192.168.20.61:8109' // 线下环境
 
 const baseFlag = baseUrlTemp.includes('https://')