lanjianrong пре 4 година
родитељ
комит
38f52b7af1

+ 5 - 28
src/app.tsx

@@ -69,17 +69,11 @@ export const layout = ({ initialState, setInitialState }) => {
 
   return {
     logo,
-    // menu: {
-    //   params: {
-    //     userId: initialState?.currentUser?.staffId
-    //   },
-    //   request: (_, defaultMenuData) => {
-    //     console.log('defaultMenuData', defaultMenuData)
-
-    //     return defaultMenuData
-    //   }
-    // },
-    rightContentRender: () => <RightContent />,
+    rightContentRender: () => (
+      <ModalStore>
+        <RightContent />
+      </ModalStore>
+    ),
     disableContentMargin: false,
     waterMarkProps: {
       content: initialState?.currentUser?.username
@@ -92,25 +86,8 @@ export const layout = ({ initialState, setInitialState }) => {
         location.pathname !== loginPath &&
           tryChangeWorkStatus(initialState?.currentUser?.staffId, location.pathname)
       }
-
-      // if (
-      //   initialState?.currentUser?.staffId &&
-      //   location.pathname !== loginPath &&
-      //   PERMISSION_NEED_PATH.includes(location.pathname) &&
-      //   !initialState?.permData
-      // ) {
-      //   const permData = await initialState.fetchPermData()
-      //   permData && setInitialState({ ...initialState, permData })
-      // }
     },
     childrenRender: children => <ModalStore>{children}</ModalStore>,
-    // links: [
-    //   <div className="ant-menu-title-content">
-    //     <AddressBook theme="outline" className="anticon" />
-    //     <span className="ant-pro-menu-item-title">通讯录</span>
-    //   </div>
-    // ],
-    // menuHeaderRender: false,
     ...initialState?.settings,
     breakpoint: false,
     onCollapse

+ 2 - 2
src/components/ModalStore/index.tsx

@@ -18,7 +18,7 @@ import LockDetail from '@/pages/Product/Lock/LockStore/components/LockDetail'
 import ConnectClient from '@/pages/Customer/Client/components/ConnectClient'
 import ReceiveLock from '@/pages/Product/Lock/LockStore/components/ReceiveLock'
 import CustomPerm from '@/pages/Customer/Company/components/CustomPerm'
-import MessageDrawer from '@/pages/Hr/Notification/components/MessageDrawer'
+import MessageDetail from '@/pages/Hr/Notification/components/MessageDetail'
 import CloudDetail from '@/pages/Product/Cloud/components/Detail'
 import PersonalDetail from '@/pages/Product/Road/Personal/components/Detail'
 const modalMap = {
@@ -40,7 +40,7 @@ const modalMap = {
   M_OPREATE_LOCK: OpreateLock, // 操作锁库弹窗
   M_RECEIVE_LOCK: ReceiveLock, // 接受锁库弹窗
   M_CUSTOM_PERM: CustomPerm, // 自定义数据权限弹窗
-  D_NOTICE_DETAIL: MessageDrawer, // 通知详情
+  D_NOTICE_DETAIL: MessageDetail, // 通知详情
   D_CLOUD_DETAIL: CloudDetail, // 云版详情
   D_PERSONAL_DETAIL: PersonalDetail // 大司空2.0个人版详情
 }

+ 0 - 5
src/components/ModalStore/src/CreateProvider.tsx

@@ -80,8 +80,6 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
   }
 
   function push(key: string, compState: any) {
-    console.log(compState)
-
     // eslint-disable-next-line no-param-reassign
     key = compState?.dataId ? `${key}@${compState?.dataId}` : key
     const { visiblePropName, onClosePropName, destroyOnClose } = getModalConfig(key)
@@ -110,8 +108,6 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
         ...defaultProps,
         key
       }
-      // console.log(key)
-
       const nextModals = prevModals.slice()
 
       const index = nextModals.findIndex(item => item.key === key)
@@ -172,7 +168,6 @@ const ModalStore: React.FC<ModalStoreProps> = props => {
       return {
         ...item,
         maskStyle: { opacity: 0, animation: 'none' } as CSSProperties
-        // style: { transform: `translateX(-${(len - currentIdx) * 10}px)` }
       }
     }
     return item

+ 0 - 12
src/components/RightContent/Book/components/UserList/index.tsx

@@ -21,17 +21,6 @@ const UesrList: React.FC<UserListProps> = ({ onlineList }) => {
   const t = useRef()
   const [visible, setVisible] = useState(false)
   const intl = useIntl()
-  // const arr = []
-  // for (let i = 0; i < 100; i++) {
-  //   arr.push({
-  //     avatar: '/global/img/avtra',
-  //     department: '',
-  //     id: 'McjlQdO0O0Oi',
-  //     username: '杨卫东',
-  //     workStatus: 'menu.customer.client',
-  //     wsKey: '杨卫东'
-  //   })
-  // }
   const handleOnScroll = () => {
     if (!ref.current?.classList?.contains('scrolling')) {
       ref.current?.classList?.add('scrolling')
@@ -42,7 +31,6 @@ const UesrList: React.FC<UserListProps> = ({ onlineList }) => {
     }, 450)
   }
 
-  // const { run: tryHandleScroll } = useDebounceFn(handleOnScroll, { wait: 2500 })
   return (
     <>
       <span className="absolute top-70 left-[-0.75rem]" onClick={() => setVisible(!visible)}>

+ 1 - 1
src/components/RightContent/NoticeIcon/index.tsx

@@ -107,7 +107,7 @@ const NoticeIconView = () => {
         currentUser: { ...currentUser, unreadCount: currentUser.unreadCount - 1 }
       })
     }
-    dispatchModal('D_NOTICE_DETAIL', { item })
+    dispatchModal('D_NOTICE_DETAIL', { item, zIndex: 1051 })
   }
 
   const clearReadState = async (title: string, key: string) => {

+ 0 - 33
src/components/RightContent/index.tsx

@@ -30,40 +30,7 @@ const GlobalHeaderRight: React.FC = () => {
   }
   return (
     <Space className={className}>
-      {/* <HeaderSearch
-        className={`${styles.action} ${styles.search}`}
-        placeholder="站内搜索"
-        defaultValue="umi ui"
-        options={[
-          { label: <a href="https://umijs.org/zh/guide/umi-ui.html">umi ui</a>, value: 'umi ui' },
-          {
-            label: <a href="next.ant.design">Ant Design</a>,
-            value: 'Ant Design',
-          },
-          {
-            label: <a href="https://protable.ant.design/">Pro Table</a>,
-            value: 'Pro Table',
-          },
-          {
-            label: <a href="https://prolayout.ant.design/">Pro Layout</a>,
-            value: 'Pro Layout',
-          },
-        ]}
-        onSearch={value => {
-          console.log('input', value);
-        }}
-      /> */}
-      {/* <span
-        className={styles.action}
-        onClick={() => {
-          window.open('https://pro.ant.design/docs/getting-started');
-        }}
-      >
-        <QuestionCircleOutlined />
-      </span> */}
-      {/* {!isMobile() && <Book />} */}
       <Book />
-
       <Notify />
       <Avatar />
       {REACT_APP_ENV && REACT_APP_ENV !== 'prod' && (

+ 2 - 3
src/models/refresh.js

@@ -3,13 +3,12 @@ import { isObject, isUnDef } from '@/utils/is'
 export default {
   namespace: 'refresh',
   state: {
-    contactList: false,
     client: false,
     company: false,
     software: false,
     department: false,
-    staffList: false,
-    business: false,
+    staff: false, // 部门与员工
+    business: false, // 商机
     cloud: false,
     personal: false
   },

+ 11 - 17
src/pages/Hr/Employee/components/ChangeSupervisor/index.jsx

@@ -1,6 +1,6 @@
 import React from 'react'
 import { Switch, LinkInterrupt, LinkOne } from '@icon-park/react'
-import { Card, Tooltip } from 'antd'
+import { Card, Modal, Tooltip } from 'antd'
 import consts from '@/basic/consts'
 import { useDispatch } from 'dva'
 import styles from './index.less'
@@ -18,26 +18,22 @@ const ChangeSupervisor = props => {
   const dispatch = useDispatch()
   const dispatchModal = useModal()
   const {
-    dataSource: {
-      staffId,
-      clientId,
-      staffName,
-      targetName,
-      actionPayload = ChangeCompMap.STAFF.key,
-      title = '员工'
+    dataSource: { staffId, clientId, staffName, targetName, title = '员工' },
+    actionPayload = {
+      main: ChangeCompMap.STAFF.key
     }
   } = props
   const refreshStaff = () => {
     dispatch({
       type: 'refresh/commitAction',
-      payload: 'stafflist'
+      payload: actionPayload
     })
   }
   const handleConnectStaff = () => {
     dispatchModal('M_CONNECT_CLIENT', {
       onSelect: refreshStaff,
       id: clientId,
-      postUrl: actionPayload
+      preUrl: actionPayload.main
     })
   }
   const notValueRender = (
@@ -48,9 +44,9 @@ const ChangeSupervisor = props => {
   )
 
   const removeSupervisor = () => {
-    setModalProps({
+    Modal.confirm({
       title: '确认移除',
-      children: (
+      content: (
         <p>
           为{title}
           <span className="mr-3px ml-3px font-600">{targetName}</span>移除
@@ -58,13 +54,11 @@ const ChangeSupervisor = props => {
         </p>
       ),
       onOk: async () => {
-        await apiChangeSupervisor(actionPayload, { id: clientId, dataId: '0' })
+        // dataId - '0' - 移除上司
+        await apiChangeSupervisor(actionPayload.main, { id: clientId, dataId: '0' })
         refreshStaff()
-        toggleModal()
-      },
-      onCancel: () => toggleModal()
+      }
     })
-    toggleModal()
   }
   const normalValueRender = (
     <Card size="small">

+ 5 - 3
src/pages/Hr/Employee/components/EmployeeDetail/Form.jsx

@@ -4,7 +4,7 @@ import EditableForm from '@/components/EditableForm'
 import ChangeSupervisor from '@/pages/Hr/Employee/components/ChangeSupervisor'
 
 const EmployeeForm = props => {
-  const { staff } = props
+  const { staff, actionPayload } = props
   const changeCopInputData = {
     staffName: staff.supervisorName,
     staffId: staff.id,
@@ -33,7 +33,9 @@ const EmployeeForm = props => {
       dataIndex: 'supervisorName',
       label: '部门上司',
       editCellType: 'custom',
-      customCell: <ChangeSupervisor dataSource={changeCopInputData} />,
+      customCell: (
+        <ChangeSupervisor actionPayload={actionPayload} dataSource={changeCopInputData} />
+      ),
       span: 24
     },
     {
@@ -270,7 +272,7 @@ const EmployeeForm = props => {
       <EditableForm
         columns={columns}
         dataSource={staff}
-        type="employee"
+        type={actionPayload}
         tartgetUrl="/staff/change/department"
       />
     </div>

+ 1 - 6
src/pages/Hr/Employee/components/EmployeeDetail/TabList.jsx

@@ -17,12 +17,7 @@ const EmployeeTabList = props => {
                 renderItem={item => (
                   <List.Item>
                     <a>@{item.operatorName}</a> {item.content}
-                    <List.Item.Meta
-                      // avatar=
-                      // title=
-                      // description={ dayjsFormat(item.createTime, 'YYYY-MM-DD')}
-                      description={dayjsFormat(item.createTime)}
-                    />
+                    <List.Item.Meta description={dayjsFormat(item.createTime)} />
                   </List.Item>
                 )}
               />

+ 11 - 4
src/pages/Hr/Employee/components/EmployeeDetail/index.jsx

@@ -8,7 +8,8 @@ import EmployeeTabList from './TabList.jsx'
 import { apiStaffDetail } from '@/services/staff'
 
 const EmployeeDetail = props => {
-  const { visible, onClose, dispatch, shouldUpdate, dataId = '' } = props
+  const { visible, onClose, dispatch, refresh, updateKey = 'staff', dataId } = props
+  const shouldUpdate = refresh?.[dataId ?? updateKey] || false
   const [state, setState] = useState({
     loading: false,
     staff: {},
@@ -24,7 +25,10 @@ const EmployeeDetail = props => {
       if (shouldUpdate) {
         dispatch({
           type: 'refresh/commitAction',
-          payload: 'stafflist'
+          payload: {
+            main: updateKey,
+            target: dataId
+          }
         })
       }
       setState({ ...state, staff, log, loading: false })
@@ -42,7 +46,10 @@ const EmployeeDetail = props => {
         <Row>
           <Col span={12} className="sheet-box-left">
             <div className="sheet-left-panel pr-4">
-              <EmployeeForm staff={state.staff} />
+              <EmployeeForm
+                staff={state.staff}
+                actionPayload={{ main: updateKey, target: dataId }}
+              />
             </div>
           </Col>
           <Col span={12} className="sheet-box-right">
@@ -56,5 +63,5 @@ const EmployeeDetail = props => {
 }
 
 export default connect(({ refresh }) => ({
-  shouldUpdate: refresh.stafflist
+  refresh
 }))(EmployeeDetail)

+ 73 - 74
src/pages/Hr/Notification/components/AddMessage.jsx

@@ -44,81 +44,80 @@ const AddMessage = props => {
     return newValues
   }
   return (
-    <div>
-      <ModalForm
-        isKeyPressSubmit={false}
-        key="modalForm"
-        formRef={formRef}
-        trigger={
-          <Button type="primary">
-            <Plus className="mr-1" />
-            新建通知
-          </Button>
+    <ModalForm
+      isKeyPressSubmit={false}
+      formRef={formRef}
+      trigger={
+        <Button type="primary">
+          <Plus className="mr-1" />
+          新建通知
+        </Button>
+      }
+      initialValues={{ msgType: 'notification', refresh: 0 }}
+      onFinish={async values => {
+        try {
+          const nValues = handleFormValues(values)
+          await onConfirm(nValues)
+          formRef.current?.resetFields()
+          message.success('添加成功')
+          return true
+        } catch (error) {
+          return false
         }
-        initialValues={{ msgType: 'notification', refresh: 0 }}
-        onFinish={async values => {
-          try {
-            const nValues = handleFormValues(values)
-            await onConfirm(nValues)
-            formRef.current?.resetFields()
-            message.success('添加成功')
-            return true
-          } catch (error) {
-            return false
-          }
-        }}>
-        <ProFormText
-          name="title"
-          label="标题"
-          placeholder="请输入标题"
-          rules={[{ required: true, message: '请输入标题' }]}
-        />
-        <Form.Item
-          label="内容"
-          name="content"
-          rules={[{ required: true, message: '请输入通知内容' }]}>
-          <RighEditor />
-        </Form.Item>
-        <ProFormRadio.Group
-          label="类型"
-          name="msgType"
-          required
-          options={[
-            { label: '通知', value: msgTypeEnum.NotificationOne }
-            // { label: '消息', value: msgTypeEnum.Message }
-          ]}
-        />
-        <ProFormDependency name={['msgType']}>
-          {({ msgType }) =>
-            msgType === msgTypeEnum.NotificationOne ? (
-              <ProFormSelect
-                name="media"
-                label="通知类型"
-                rules={[{ required: true, message: '请选择类型' }]}
-                options={[
-                  { label: '版本更新', value: mediaType.VersionUpdate },
-                  { label: '节假通知', value: mediaType.HolidayNotice }
-                ]}
-              />
-            ) : null
-          }
-        </ProFormDependency>
-        <ProFormDependency name={['msgType', 'media']}>
-          {({ msgType, media }) =>
-            msgType === msgTypeEnum.NotificationOne && media === mediaType.VersionUpdate ? (
-              <ProFormRadio.Group
-                name="refresh"
-                rules={[{ required: true, message: '请选择刷新机制' }]}
-                options={[
-                  { label: '手动刷新', value: 0 },
-                  { label: '强制刷新', value: 1 }
-                ]}
-              />
-            ) : null
-          }
-        </ProFormDependency>
-      </ModalForm>
-    </div>
+      }}
+    >
+      <ProFormText
+        name="title"
+        label="标题"
+        placeholder="请输入标题"
+        rules={[{ required: true, message: '请输入标题' }]}
+      />
+      <Form.Item
+        label="内容"
+        name="content"
+        rules={[{ required: true, message: '请输入通知内容' }]}
+      >
+        <RighEditor />
+      </Form.Item>
+      <ProFormRadio.Group
+        label="类型"
+        name="msgType"
+        required
+        options={[
+          { label: '通知', value: msgTypeEnum.NotificationOne }
+          // { label: '消息', value: msgTypeEnum.Message }
+        ]}
+      />
+      <ProFormDependency name={['msgType']}>
+        {({ msgType }) =>
+          msgType === msgTypeEnum.NotificationOne ? (
+            <ProFormSelect
+              name="media"
+              label="通知类型"
+              rules={[{ required: true, message: '请选择类型' }]}
+              options={[
+                { label: '版本更新', value: mediaType.VersionUpdate },
+                { label: '节假通知', value: mediaType.HolidayNotice }
+              ]}
+            />
+          ) : null
+        }
+      </ProFormDependency>
+      <ProFormDependency name={['msgType', 'media']}>
+        {({ msgType, media }) =>
+          msgType === msgTypeEnum.NotificationOne && media === mediaType.VersionUpdate ? (
+            <ProFormRadio.Group
+              name="refresh"
+              rules={[{ required: true, message: '请选择刷新机制' }]}
+              options={[
+                { label: '手动刷新', value: 0 },
+                { label: '强制刷新', value: 1 }
+              ]}
+            />
+          ) : null
+        }
+      </ProFormDependency>
+    </ModalForm>
   )
 }
 

+ 39 - 0
src/pages/Hr/Notification/components/MessageDetail.jsx

@@ -0,0 +1,39 @@
+import MarkDown from 'react-markdown'
+import styles from '@/pages/Hr/Notification/index.less'
+import { Drawer, Tag, Typography } from 'antd'
+import { useIntl } from 'umi'
+import 'vditor/src/assets/scss/index.scss'
+
+const MessageDetail = props => {
+  const { item: { id, title, createTime, content, msgType } = {}, ...otherProps } = props
+  const intl = useIntl()
+  if (!id) return null
+  return (
+    <Drawer {...otherProps} className="zh-drawer">
+      <div className="px-5 vditor-reset h-full">
+        <div className="max-h-20vh">
+          <span className="pt-5 block">
+            <Tag color="purple">
+              {intl.formatMessage({ id: `component.globalHeader.${msgType}` })}
+            </Tag>
+          </span>
+          <h1 className={['text-xl pr-6 mt-3', styles.NotificationCont].join(' ')}>{title}</h1>
+          <span className="text-hex-aaa">{createTime}</span>
+          <div className="w-22 h-[1px] bg-hex-ddd mt-3 mb-5 " />
+        </div>
+        <div
+          className={[
+            'overflow-y-auto max-h-80vh py-3 px-4 bg-hex-f9f9f9 rounded-md boxShadow',
+            styles.NotificationCont
+          ].join(' ')}
+        >
+          <Typography.Paragraph>
+            <MarkDown>{content}</MarkDown>
+          </Typography.Paragraph>
+        </div>
+      </div>
+    </Drawer>
+  )
+}
+
+export default MessageDetail

+ 0 - 37
src/pages/Hr/Notification/components/MessageDrawer.jsx

@@ -1,37 +0,0 @@
-import MarkDown from 'react-markdown'
-import styles from '@/pages/Hr/Notification/index.less'
-import { Tag, Typography } from 'antd'
-import { useIntl } from 'umi'
-import 'vditor/src/assets/scss/index.scss'
-
-const MessageDrawer = props => {
-  const {
-    item: { title, createTime, content, msgType }
-  } = props
-  const intl = useIntl()
-  return (
-    <div className="px-5 vditor-reset h-full">
-      <div className="max-h-20vh">
-        <span className="pt-5 block">
-          <Tag color="purple">
-            {intl.formatMessage({ id: `component.globalHeader.${msgType}` })}
-          </Tag>
-        </span>
-        <h1 className={['text-xl pr-6 mt-3', styles.NotificationCont].join(' ')}>{title}</h1>
-        <span className="text-hex-aaa">{createTime}</span>
-        <div className="w-22 h-[1px] bg-hex-ddd mt-3 mb-5 " />
-      </div>
-      <div
-        className={[
-          'overflow-y-auto max-h-80vh py-3 px-4 bg-hex-f9f9f9 rounded-md boxShadow',
-          styles.NotificationCont
-        ].join(' ')}>
-        <Typography.Paragraph>
-          <MarkDown>{content}</MarkDown>
-        </Typography.Paragraph>
-      </div>
-    </div>
-  )
-}
-
-export default MessageDrawer

+ 1 - 1
src/pages/Hr/Notification/index.jsx

@@ -112,7 +112,7 @@ const Notification = () => {
                       <Tag color="purple">
                         {intl.formatMessage({ id: `component.globalHeader.${item.msgType}` })}
                       </Tag>{' '}
-                      '发布范围',
+                      &apos;发布范围&apos;,
                       <span className="ml-2">全公司</span>
                     </div>
                   }

+ 30 - 54
src/pages/Product/Cloud/components/CardDetail/index.jsx

@@ -1,4 +1,4 @@
-import { Card, Col, Row } from 'antd'
+import { Card } from 'antd'
 import React, { useState } from 'react'
 import { useModal } from '@/components/ModalStore'
 import styles from './index.less'
@@ -12,59 +12,35 @@ const CardClientDetail = props => {
   return (
     <div className="pt-3 border-t-1px border-hex-f3f3f3">
       <Card title="CLD客户" size="small" type="inner" className={styles.cardBoxBg}>
-        <Row>
-          <Col span={8} className="text-right py-3">
-            客户姓名:
-          </Col>
-          <Col span={16} className="py-3">
-            <span
-              onClick={() =>
-                dispatchModal('D_CLIENT_DETAIL', { dataId: client.id, orderIds: state.orderIds })
-              }
-              className="text-primary cursor-pointer hover:text-[#967bbd]">
-              {client.clientName}
-            </span>
-          </Col>
-          <Col span={8} className="text-right py-3">
-            单位名称:
-          </Col>
-          <Col span={16} className="py-3">
-            <span
-              onClick={() =>
-                dispatchModal('D_COMPANY_DETAIL', {
-                  dataId: client.companyId,
-                  orderIds: state.orderIds
-                })
-              }
-              className="text-primary cursor-pointer hover:text-[#967bbd]">
-              {client.companyName}
-            </span>
-          </Col>
-          <Col span={8} className="text-right py-3">
-            手机:
-          </Col>
-          <Col span={16} className="py-3">
-            {client.telephone}
-          </Col>
-          <Col span={8} className="text-right py-3">
-            QQ:
-          </Col>
-          <Col span={16} className="py-3">
-            {client.qq}
-          </Col>
-          <Col span={8} className="text-right py-3">
-            部门:
-          </Col>
-          <Col span={16} className="py-3">
-            {client.department}
-          </Col>
-          <Col span={8} className="text-right py-3">
-            职务:
-          </Col>
-          <Col span={16} className="py-3">
-            {client.position}
-          </Col>
-        </Row>
+        <div className="py-3">
+          客户姓名:
+          <span
+            onClick={() =>
+              dispatchModal('D_CLIENT_DETAIL', { dataId: client.id, orderIds: state.orderIds })
+            }
+            className="text-primary cursor-pointer hover:text-[#967bbd]"
+          >
+            {client.clientName}
+          </span>
+        </div>
+        <div className="py-3">
+          单位名称:
+          <span
+            onClick={() =>
+              dispatchModal('D_COMPANY_DETAIL', {
+                dataId: client.companyId,
+                orderIds: state.orderIds
+              })
+            }
+            className="text-primary cursor-pointer hover:text-[#967bbd]"
+          >
+            {client.companyName}
+          </span>
+        </div>
+        <div className="py-3">手机:{client.telephone}</div>
+        <div className="py-3">QQ:{client.qq}</div>
+        <div className="py-3">部门:{client.department}</div>
+        <div className="py-3">职务:{client.position}</div>
       </Card>
     </div>
   )