Bladeren bron

Merge branch 'dev' of http://192.168.1.41:3000/outaozhen/cldV2react into dev

outaozhen 4 jaren geleden
bovenliggende
commit
9116b228f9

+ 5 - 3
src/components/Table/src/BasicTable.tsx

@@ -10,7 +10,7 @@ import { getAuthCache, getPermAuthCache, setAuthCache } from '@/utils/auth'
 import React, { useRef, useState, useLayoutEffect, useMemo } from 'react'
 import { useMount } from 'ahooks'
 import { useTableScroll } from './hooks/useTableScroll'
-import type { BasicTableProps } from '@/types/typing'
+import type { BasicTableProps, PermStateEnum } from '@/types/typing'
 import type { ParamsType } from '@ant-design/pro-provider'
 import type { DensitySize } from '@ant-design/pro-table/lib/components/ToolBar/DensityIcon'
 // import { Resizable } from 'react-resizable'
@@ -50,6 +50,7 @@ const BasicTable: {
   Summary: typeof import('rc-table/lib/Footer/Summary').default
 } = ({
   // resizable = false,
+  onPermChange,
   rowKey,
   headerTitle,
   params,
@@ -120,9 +121,10 @@ const BasicTable: {
       <>
         <PermSelect
           dataType={mainMenuType}
-          onConfirm={({ staffIds, dataPermission }) =>
+          onConfirm={({ staffIds, dataPermission }: PermStateEnum) => {
+            if (onPermChange) onPermChange({ staffIds, dataPermission })
             setState({ ...state, params: { ...state.params, staffIds, dataPermission } })
-          }
+          }}
         />
         <div className="ml-4">{headerTitle}</div>
       </>

+ 3 - 2
src/global.less

@@ -181,8 +181,9 @@ input:-webkit-autofill:active {
 .ant-select-selection-item {
   text-overflow: unset;
 }
-.ant-typography {
-  color: inherit;
+
+.ant-table-cell .ant-typography {
+  color: unset;
 }
 
 .my-drawer.ant-drawer-open {

+ 174 - 158
src/pages/Customer/Client/components/ClientDetail/Form.jsx

@@ -1,5 +1,5 @@
 import { Row, Col, Tooltip } from 'antd'
-import React, { useEffect } from 'react'
+import React, { useEffect, useMemo } from 'react'
 import EditableForm from '@/components/EditableForm'
 import ChangeCompanyInput from '@/pages/Customer/Company/components/ChangeCompany'
 import { connect } from 'umi'
@@ -12,7 +12,15 @@ import {
 } from '@/pages/Customer/Company/components/PersonLabel/const'
 
 const ContanctForm = props => {
-  const { client, personTagColorMap, personTags, teamTagColorMap, teamTags, dispatch } = props
+  const {
+    client,
+    personTagColorMap,
+    personTags,
+    teamTagColorMap,
+    teamTags,
+    dispatch,
+    filterTag = false
+  } = props
   const changeCopInputData = {
     customerName: client.companyName,
     customerId: client.companyId,
@@ -42,163 +50,171 @@ const ContanctForm = props => {
     }
   }, [])
 
-  const columns = [
-    {
-      dataIndex: 'clientName',
-      label: '姓名',
-      span: 24
-    },
-    {
-      dataIndex: 'districtIds',
-      label: '客户地区',
-      editCellType: 'cascader',
-      span: 24
-    },
-    {
-      dataIndex: 'companyName',
-      label: '单位名称',
-      editCellType: 'custom',
-      customCell: <ChangeCompanyInput dataSource={changeCopInputData} />,
-      span: 24
-    },
-    {
-      dataIndex: 'gender',
-      label: '性别',
-      editCellType: 'select',
-      span: 24
-    },
-    {
-      dataIndex: 'niceName',
-      label: '昵称',
-      span: 24
-    },
-    {
-      dataIndex: 'telephone',
-      label: '手机',
-      span: 24
-    },
-    {
-      dataIndex: 'qq',
-      label: 'QQ',
-      span: 24
-    },
-    {
-      dataIndex: 'phone',
-      label: '电话',
-      span: 24
-    },
-    {
-      dataIndex: 'email',
-      label: '邮箱',
-      span: 24
-    },
-    {
-      dataIndex: 'fax',
-      label: '传真',
-      span: 24
-    },
-    {
-      dataIndex: 'department',
-      label: '部门',
-      span: 24
-    },
-    {
-      dataIndex: 'position',
-      label: '职务',
-      span: 24
-    },
-    {
-      dataIndex: 'office',
-      label: '办公室',
-      span: 24,
-      editCellType: 'textarea'
-    },
-    {
-      dataIndex: 'address',
-      label: '客户地址',
-      span: 24,
-      editCellType: 'textarea'
-    },
-    {
-      dataIndex: 'ride',
-      label: '客户乘车',
-      span: 24,
-      editCellType: 'textarea'
-    },
-    {
-      dataIndex: 'landmarks',
-      label: '客户地标',
-      span: 24,
-      editCellType: 'textarea'
-    },
-    {
-      dataIndex: 'stay',
-      label: '客户住宿',
-      span: 24,
-      editCellType: 'textarea'
-    },
-    {
-      dataIndex: 'mark',
-      label: '备注',
-      span: 24,
-      editCellType: 'textarea'
-    },
-    {
-      dataIndex: 'tagIds',
-      label: '个人标签',
-      editCellType: 'custom',
-      customCell: (
-        <div className="editable-cell-value-wrap text-center flex flex-wrap items-center">
-          {client.tagIds?.map(item => (
-            <Tooltip title={personTags.find(i => i.id === item)?.name} key={client.id + item}>
-              <span
-                className="inline-block w-12px h-12px rounded-1/2 mr-3px"
-                style={{ backgroundColor: personTagColorMap[item] }}
-              />
-            </Tooltip>
-          ))}
-          <PersonLabel
-            dataId={client.id}
-            tagIds={client.tagIds}
-            tagType={TagTypeEnum.PERSONTAG}
-            tagColumn={TagDataTypeEnum.CLIENT}
-            checkCallBack={refreshClient}
-            modeType={LabelModeType.column}>
-            <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
-          </PersonLabel>
-        </div>
-      ),
-      span: 24
-    },
-    {
-      dataIndex: 'tagCooperationIds',
-      label: '协作标签',
-      editCellType: 'custom',
-      customCell: (
-        <div className="editable-cell-value-wrap text-center flex flex-wrap items-center">
-          {client.tagCooperationIds?.map(item => (
-            <Tooltip title={teamTags.find(i => i.id === item)?.name} key={client.id + item}>
-              <span
-                className="inline-block w-12px h-12px mr-3px"
-                style={{ backgroundColor: teamTagColorMap[item] }}
-              />
-            </Tooltip>
-          ))}
-          <PersonLabel
-            dataId={client.id}
-            tagIds={client.tagCooperationIds}
-            tagType={TagTypeEnum.TEAMTAG}
-            tagColumn={TagDataTypeEnum.CLIENT}
-            checkCallBack={refreshClient}
-            modeType={LabelModeType.column}>
-            <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
-          </PersonLabel>
-        </div>
-      ),
-      span: 24
+  const columns = useMemo(() => {
+    const pColumns = [
+      {
+        dataIndex: 'clientName',
+        label: '姓名',
+        span: 24
+      },
+      {
+        dataIndex: 'districtIds',
+        label: '客户地区',
+        editCellType: 'cascader',
+        span: 24
+      },
+      {
+        dataIndex: 'companyName',
+        label: '单位名称',
+        editCellType: 'custom',
+        customCell: <ChangeCompanyInput dataSource={changeCopInputData} />,
+        span: 24
+      },
+      {
+        dataIndex: 'gender',
+        label: '性别',
+        editCellType: 'select',
+        span: 24
+      },
+      {
+        dataIndex: 'niceName',
+        label: '昵称',
+        span: 24
+      },
+      {
+        dataIndex: 'telephone',
+        label: '手机',
+        span: 24
+      },
+      {
+        dataIndex: 'qq',
+        label: 'QQ',
+        span: 24
+      },
+      {
+        dataIndex: 'phone',
+        label: '电话',
+        span: 24
+      },
+      {
+        dataIndex: 'email',
+        label: '邮箱',
+        span: 24
+      },
+      {
+        dataIndex: 'fax',
+        label: '传真',
+        span: 24
+      },
+      {
+        dataIndex: 'department',
+        label: '部门',
+        span: 24
+      },
+      {
+        dataIndex: 'position',
+        label: '职务',
+        span: 24
+      },
+      {
+        dataIndex: 'office',
+        label: '办公室',
+        span: 24,
+        editCellType: 'textarea'
+      },
+      {
+        dataIndex: 'address',
+        label: '客户地址',
+        span: 24,
+        editCellType: 'textarea'
+      },
+      {
+        dataIndex: 'ride',
+        label: '客户乘车',
+        span: 24,
+        editCellType: 'textarea'
+      },
+      {
+        dataIndex: 'landmarks',
+        label: '客户地标',
+        span: 24,
+        editCellType: 'textarea'
+      },
+      {
+        dataIndex: 'stay',
+        label: '客户住宿',
+        span: 24,
+        editCellType: 'textarea'
+      },
+      {
+        dataIndex: 'mark',
+        label: '备注',
+        span: 24,
+        editCellType: 'textarea'
+      }
+    ]
+    if (!filterTag) {
+      pColumns.push(
+        {
+          dataIndex: 'tagIds',
+          label: '个人标签',
+          editCellType: 'custom',
+          customCell: (
+            <div className="editable-cell-value-wrap text-center flex flex-wrap items-center">
+              {client.tagIds?.map(item => (
+                <Tooltip title={personTags.find(i => i.id === item)?.name} key={client.id + item}>
+                  <span
+                    className="inline-block w-12px h-12px rounded-1/2 mr-3px"
+                    style={{ backgroundColor: personTagColorMap[item] }}
+                  />
+                </Tooltip>
+              ))}
+              <PersonLabel
+                dataId={client.id}
+                tagIds={client.tagIds}
+                tagType={TagTypeEnum.PERSONTAG}
+                tagColumn={TagDataTypeEnum.CLIENT}
+                checkCallBack={refreshClient}
+                modeType={LabelModeType.column}
+              >
+                <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
+              </PersonLabel>
+            </div>
+          ),
+          span: 24
+        },
+        {
+          dataIndex: 'tagCooperationIds',
+          label: '协作标签',
+          editCellType: 'custom',
+          customCell: (
+            <div className="editable-cell-value-wrap text-center flex flex-wrap items-center">
+              {client.tagCooperationIds?.map(item => (
+                <Tooltip title={teamTags.find(i => i.id === item)?.name} key={client.id + item}>
+                  <span
+                    className="inline-block w-12px h-12px mr-3px"
+                    style={{ backgroundColor: teamTagColorMap[item] }}
+                  />
+                </Tooltip>
+              ))}
+              <PersonLabel
+                dataId={client.id}
+                tagIds={client.tagCooperationIds}
+                tagType={TagTypeEnum.TEAMTAG}
+                tagColumn={TagDataTypeEnum.CLIENT}
+                checkCallBack={refreshClient}
+                modeType={LabelModeType.column}
+              >
+                <Add theme="filled" size="20" fill="#868e96" className="cursor-pointer" />
+              </PersonLabel>
+            </div>
+          ),
+          span: 24
+        }
+      )
     }
-  ]
-
+    return pColumns
+  }, [client, !filterTag ? teamTags : null, !filterTag ? personTags : null])
   return (
     <div>
       <Row>

+ 2 - 2
src/pages/Product/Cloud/model.js

@@ -25,7 +25,7 @@ export default {
         yield put({
           type: 'changeCompilationState',
           payload: {
-            key: payload?.projectPype,
+            key: payload?.projectType,
             data: response.data
           }
         })
@@ -37,7 +37,7 @@ export default {
         yield put({
           type: 'changeProvinceState',
           payload: {
-            key: payload?.projectPype,
+            key: payload?.projectType,
             data: response.data.map((item, idx) => ({ label: item, value: idx + 1 }))
           }
         })

+ 6 - 0
src/types/typing.d.ts

@@ -19,7 +19,13 @@ import type { ProFieldEmptyText } from '@ant-design/pro-field'
 import type { Bordered } from '@ant-design/pro-table/lib/typing'
 import type { ReactNode } from 'react-router/node_modules/@types/react'
 
+export type PermStateEnum = {
+  staffIds: string[] | null
+  dataPermission: string | null
+}
+
 export type BasicTableProps<T, U extends ParamsType, ValueType = 'text'> = {
+  onPermChange?: (map: PermStateEnum) => void
   /** @name 配置search栏tooltip的title属性 */
   searchTooptip?: boolean | string | ReactNode
   /** @name 启用列可伸缩功能 */