Sfoglia il codice sorgente

feat: 人资列表增加了通讯录内容

outaozhen 4 anni fa
parent
commit
e8283a4d73

+ 8 - 1
config/routes.js

@@ -260,7 +260,14 @@ export default [
     routes: [
       {
         path: '/hr',
-        redirect: '/hr/employee'
+        redirect: '/hr/addressbook'
+      },
+      {
+        path: '/hr/addressbook',
+        name: 'addressbook',
+        icon: 'icon-address-book-o',
+        component: './Hr/AddressBook'
+        // access: 'authRouteFilter'
       },
       {
         path: '/hr/employee',

+ 1 - 0
src/locales/zh-CN/menu.js

@@ -23,6 +23,7 @@ export default {
   'menu.saeaBorad': '财务费用',
   'menu.holidayborad': '考勤',
   'menu.hr': '人资',
+  'menu.hr.addressbook': '通讯录',
   'menu.hr.oldHr': 'CLD1.0人资',
   'menu.hr.employee': '部门与员工',
   'menu.hr.notification': '通知中心',

+ 93 - 0
src/pages/Hr/AddressBook/index.jsx

@@ -0,0 +1,93 @@
+import BasicTable from '@/components/Table'
+import consts from '@/consts'
+import { queryStaff } from '@/services/staff'
+import React, { useState } from 'react'
+import RoleMenu from '../Employee/components/RoleMenu'
+
+const AddressBook = () => {
+  const [state, setState] = useState({
+    params: { id: '0' }
+  })
+  const onSelect = id => {
+    setState({ ...state, params: { id } })
+  }
+  const columns = [
+    {
+      title: '工号',
+      dataIndex: 'jobNumber',
+      search: false,
+      width: 50
+    },
+    {
+      title: '姓名',
+      dataIndex: 'username',
+      search: false,
+      width: 50
+    },
+    {
+      title: '手机',
+      dataIndex: 'telephone',
+      search: false,
+      width: 50
+    },
+    {
+      title: 'QQ',
+      dataIndex: 'qq',
+      search: false,
+      width: 50
+    },
+    {
+      title: '部门',
+      dataIndex: 'departmentName',
+      search: false,
+      width: 50
+    },
+    {
+      title: '岗位',
+      dataIndex: 'position',
+      search: false,
+      width: 50
+    },
+    {
+      title: '生日',
+      dataIndex: 'birthday',
+      search: false,
+      width: 50
+    },
+    {
+      title: '入职时间',
+      dataIndex: 'hiredate',
+      search: false,
+      width: 50
+    }
+  ]
+  return (
+    <div className="h-full w-full flex flex-row">
+      <RoleMenu onSelect={onSelect} showType={false} />
+      <div style={{ width: 'calc(100% - 12rem)' }}>
+        <div className="ml-8 shadow-hex-3e2c5a">
+          {state.params.id && (
+            <BasicTable
+              columnStateType="ADDRESSBOOK"
+              params={{ departmentId: state.params.id }}
+              rowKey={record => record.id}
+              columns={columns}
+              request={async params => {
+                const { code = -1, data: { list = [], total = 0 } = { list: [], total: 0 } } =
+                  await queryStaff({ ...params })
+                return {
+                  data: list,
+                  success: code === consts.RET_CODE.SUCCESS,
+                  total
+                }
+              }}
+              search={false}
+            />
+          )}
+        </div>
+      </div>
+    </div>
+  )
+}
+
+export default AddressBook

+ 13 - 13
src/pages/Hr/Employee/components/RoleMenu/index.jsx

@@ -9,7 +9,7 @@ import './index.less'
 const { DirectoryTree } = Tree
 
 const RoleMenu = props => {
-  const { dispatch, departments = [], onSelect } = props
+  const { dispatch, departments = [], onSelect, showType } = props
   const hasPerm = useAccess()?.validatePermByType('employee_del_department')
   const newList = [...departments]
   newList.unshift({
@@ -44,14 +44,15 @@ const RoleMenu = props => {
           <div className="department-node">
             <div>{item.title}</div>
             <div className="extra">
-              <Popconfirm
-                title="确认删除吗?"
-                onText="确认"
-                cancelText="取消"
-                onConfirm={() => handleDelDepartment(item.id)}
-              >
-                <DeleteOutlined />
-              </Popconfirm>
+              {showType ? (
+                <Popconfirm
+                  title="确认删除吗?"
+                  onText="确认"
+                  cancelText="取消"
+                  onConfirm={() => handleDelDepartment(item.id)}>
+                  <DeleteOutlined />
+                </Popconfirm>
+              ) : null}
             </div>
           </div>
         )
@@ -86,7 +87,7 @@ const RoleMenu = props => {
     <div className="h-full w-12rem rounded-4px">
       <div className="p-4 pb-3 border-b-1 border-solid border-black border-opacity-10 bg-[#f7f9fa] flex justify-around items-center">
         <span className="text-[0.9375rem]">组织架构</span>
-        {hasPerm && (
+        {hasPerm && showType ? (
           <ModalForm
             title="创建部门"
             width="500px"
@@ -100,8 +101,7 @@ const RoleMenu = props => {
               await handleAddDepartment(values)
               message.success('添加成功')
               return true
-            }}
-          >
+            }}>
             <ProFormText name="backstageMenuId" hidden />
             <ProFormText name="name" label="新增部门" rules={[{ message: '请输入部门名称' }]} />
             <Form.Item label="上级部门" name="parentId">
@@ -114,7 +114,7 @@ const RoleMenu = props => {
               />
             </Form.Item>
           </ModalForm>
-        )}
+        ) : null}
       </div>
       <div className="py-4 pt-4 bg-white" style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
         {departments.length ? (

+ 12 - 18
src/pages/Hr/Employee/index.jsx

@@ -1,9 +1,7 @@
 import React, { useState } from 'react'
 import consts from '@/consts'
-import { message } from 'antd'
 import RoleMenu from '@/pages/Hr/Employee/components/RoleMenu'
 import { queryStaff } from '@/services/staff'
-import { connect } from 'umi'
 import BasicTable from '@/components/Table'
 import { useModal } from '@/components/ModalStore'
 
@@ -19,18 +17,17 @@ const Employee = props => {
       title: '工号',
       dataIndex: 'jobNumber',
       search: false,
-      width: 50
+      width: 100
     },
     {
       title: '姓名',
       dataIndex: 'username',
       search: false,
-      width: 50,
+      width: 80,
       render: (username, record) => (
         <span
           onClick={() => dispatchModal('D_EMPLOYEE_DETAIL', { dataId: record.id })}
-          className="text-primary cursor-pointer hover:text-[#967bbd]"
-        >
+          className="text-primary cursor-pointer hover:text-[#967bbd]">
           {username}
         </span>
       )
@@ -39,43 +36,43 @@ const Employee = props => {
       title: '手机',
       dataIndex: 'telephone',
       search: false,
-      width: 50
+      width: 120
     },
     {
       title: 'QQ',
       dataIndex: 'qq',
       search: false,
-      width: 50
+      width: 150
     },
     {
       title: '部门',
       dataIndex: 'departmentName',
       search: false,
-      width: 50
+      width: 70
     },
     {
       title: '岗位',
       dataIndex: 'position',
       search: false,
-      width: 50
+      width: 100
     },
     {
       title: '聘用状态',
       dataIndex: 'nature',
       search: false,
-      width: 50
+      width: 80
     },
     {
       title: '入职时间',
       dataIndex: 'hiredate',
       search: false,
-      width: 50
+      width: 150
     },
     {
       title: '离职时间',
       dataIndex: 'dimissionDate',
       search: false,
-      width: 50
+      width: 150
     }
   ]
   const onSelect = id => {
@@ -84,7 +81,7 @@ const Employee = props => {
 
   return (
     <div className="h-full w-full flex flex-row">
-      <RoleMenu onSelect={onSelect} />
+      <RoleMenu onSelect={onSelect} showType={true} />
       <div style={{ width: 'calc(100% - 12rem)' }}>
         <div className="ml-8 shadow-hex-3e2c5a">
           {state.params.id && (
@@ -111,7 +108,4 @@ const Employee = props => {
   )
 }
 
-// export default Employee
-export default connect(({ staff }) => ({
-  departments: staff.departments
-}))(Employee)
+export default Employee