outaozhen 4 سال پیش
والد
کامیت
321d6d6d36
1فایلهای تغییر یافته به همراه60 افزوده شده و 34 حذف شده
  1. 60 34
      src/pages/Product/Road/Enterprise/index.jsx

+ 60 - 34
src/pages/Product/Road/Enterprise/index.jsx

@@ -1,14 +1,15 @@
 import BasicTable from '@/components/Table'
 import BasicTable from '@/components/Table'
 import { apiRoadAddCompany, queryRoadcompanyList } from '@/services/product'
 import { apiRoadAddCompany, queryRoadcompanyList } from '@/services/product'
-import { Button, Input, message } from 'antd'
+import { Button, Input, message, Tag } from 'antd'
 import React, { useState, useRef, useEffect } from 'react'
 import React, { useState, useRef, useEffect } from 'react'
-import { generateSortField } from '@/utils/utils'
+import { dayjsFormat, generateSortField } from '@/utils/utils'
 import consts from '@/consts'
 import consts from '@/consts'
-import { connect, useAccess } from 'umi'
+import { connect, useAccess, useDispatch } from 'umi'
 import { useModal } from '@/components/ModalStore'
 import { useModal } from '@/components/ModalStore'
 
 
-const Enterprise = ({ shouldUpdate }) => {
+const Enterprise = ({ compilationv2, shouldUpdate }) => {
   const hasAddPerm = useAccess()?.validatePermByType('enterprise_add') || false
   const hasAddPerm = useAccess()?.validatePermByType('enterprise_add') || false
+  const dispatch = useDispatch()
   const dispatchModal = useModal()
   const dispatchModal = useModal()
   const [state, setState] = useState({
   const [state, setState] = useState({
     params: {
     params: {
@@ -26,6 +27,14 @@ const Enterprise = ({ shouldUpdate }) => {
     return code === consts.RET_CODE.SUCCESS
     return code === consts.RET_CODE.SUCCESS
   }
   }
   useEffect(() => {
   useEffect(() => {
+    if (!compilationv2?.length) {
+      dispatch({
+        type: 'personal/fetchCompilationv2',
+        payload: {
+          projectType: 1
+        }
+      })
+    }
     if (shouldUpdate) {
     if (shouldUpdate) {
       tRef.current.reload()
       tRef.current.reload()
     }
     }
@@ -51,51 +60,71 @@ const Enterprise = ({ shouldUpdate }) => {
     },
     },
     {
     {
       title: '企业管理员',
       title: '企业管理员',
-      dataIndex: 'managerName',
-      key: 'managerName',
-      width: 110
-    },
-    {
-      title: '电话号码',
-      dataIndex: 'managerPhone',
-      key: 'managerPhone',
-      width: 110
+      dataIndex: 'role',
+      key: 'role',
+      width: 110,
+      renderText: (_, record) =>
+        record.members.map(item => {
+          return (
+            <span key={item.userID}>{record.members?.find(item => item.role === 'admin')?.memberName}</span>
+          )
+        })
     },
     },
+    // {
+    //   title: '电话号码',
+    //   dataIndex: 'managerPhone',
+    //   key: 'managerPhone',
+    //   width: 110
+    // },
     {
     {
       title: '授权数量',
       title: '授权数量',
-      dataIndex: 'numLicenses',
-      key: 'numLicenses',
+      dataIndex: 'licenceNum',
+      key: 'licenceNum',
       width: 110
       width: 110
     },
     },
     {
     {
       title: 'CLD客户',
       title: 'CLD客户',
-      dataIndex: 'client_name',
-      key: 'client_name',
-      width: 110
+      dataIndex: 'clientName',
+      key: 'clientName',
+      width: 110,
+      renderText: (_, record) => record.cld?.clientName
     },
     },
     {
     {
       title: 'CLD单位',
       title: 'CLD单位',
-      dataIndex: 'customer_name',
-      key: 'customer_name',
-      width: 110
+      dataIndex: 'customerName',
+      key: 'customerName',
+      width: 110,
+      renderText: (_, record) => record.cld?.customerName
     },
     },
     {
     {
       title: '最近使用',
       title: '最近使用',
-      dataIndex: 'latestUsed',
-      key: 'latestUsed',
-      width: 110
+      dataIndex: 'usedCptList',
+      key: 'usedCptList',
+      width: 110,
+      renderText: (_, record) => (
+        <div className="children:m-2px">
+          {record.usedCptList.map(item => {
+            return (
+              <Tag color="purple" key={item.compilationID}>
+                {compilationv2?.find(i => i.ID === item.compilationID)?.name}
+              </Tag>
+            )
+          })}
+        </div>
+      )
     },
     },
     {
     {
       title: '注册时间',
       title: '注册时间',
-      dataIndex: 'registerTime',
-      key: 'registerTime',
-      width: 110
+      dataIndex: 'createTime',
+      key: 'createTime',
+      width: 110,
+      renderText: text => dayjsFormat(text, 'YYYY-MM-DD HH:mm')
     }
     }
   ]
   ]
   return (
   return (
     <div>
     <div>
       <BasicTable
       <BasicTable
-        rowKey={record => record.client_id}
+        rowKey={record => record.ID}
         actionRef={tRef}
         actionRef={tRef}
         columns={columns}
         columns={columns}
         params={state.params}
         params={state.params}
@@ -113,11 +142,7 @@ const Enterprise = ({ shouldUpdate }) => {
         }}
         }}
         toolbar={{
         toolbar={{
           search: (
           search: (
-            <Input.Search
-              style={{ width: '250px' }}
-              allowClear={true}
-              placeholder="请输入手机、QQ进行搜索"
-            />
+            <Input.Search style={{ width: '250px' }} allowClear={true} placeholder="请输入手机、QQ进行搜索" />
           ),
           ),
           actions: [
           actions: [
             <Button
             <Button
@@ -148,6 +173,7 @@ const Enterprise = ({ shouldUpdate }) => {
   )
   )
 }
 }
 
 
-export default connect(({ refresh }) => ({
+export default connect(({ personal, refresh }) => ({
+  compilationv2: personal.compilationv2,
   shouldUpdate: refresh.enterprise
   shouldUpdate: refresh.enterprise
 }))(Enterprise)
 }))(Enterprise)