Kaynağa Gözat

feat: 部门列表

outaozhen 5 yıl önce
ebeveyn
işleme
d7bb57ce03

+ 10 - 10
src/pages/Staff/Employee/index.jsx

@@ -9,70 +9,70 @@ const Employee = () => {
       dataIndex: 'jobNumber',
       key: 'jobNumber',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '姓名',
       dataIndex: 'username',
       key: 'username',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '手机',
       dataIndex: 'phone',
       key: 'phone',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: 'QQ',
       dataIndex: 'qq',
       key: 'qq',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '办事处/部门',
       dataIndex: 'category',
       key: 'category',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '岗位',
       dataIndex: 'position',
       key: 'position',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '聘用状态',
       dataIndex: 'nature',
       key: 'nature',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '入职时间',
       dataIndex: 'hiredate',
       key: 'hiredate',
       search: false,
-      width: 100
+      width: 50
     },
     {
       title: '离职时间',
       dataIndex: 'dimissionDate',
       key: 'dimissionDate',
       search: false,
-      width: 100
+      width: 50
     }
   ]
   return (
     <div className="h-full w-full flex flex-row">
       <RoleMenu />
       <div className="w-max-3/4">
-        <div className="ml-8 bg-white shadow-md shadow-hex-3e2c5a relative">
+        <div className="ml-8 shadow-hex-3e2c5a">
           <ProTable bordered columns={columns} search={{ filterType: 'light' }} />
         </div>
       </div>

+ 57 - 4
src/pages/Staff/RoleMenu/index.jsx

@@ -1,17 +1,70 @@
-import React from 'react'
-import { ModalForm, ProFormText } from '@ant-design/pro-form'
+import React, { useState, useEffect } from 'react'
+import { Button } from 'antd'
+import { PlusOutlined } from '@ant-design/icons'
+import consts from '@/consts'
+import { getDepartMentList } from '@/services/department'
+import { ModalForm, ProFormText, ProFormSelect } from '@ant-design/pro-form'
 
-const RoleMenu = () => {
+const RoleMenu = props => {
+  const [state, setState] = useState({
+    data: []
+  })
+  const initData = async id => {
+    setState({ ...state, loading: true })
+    const {
+      data: { data = [] },
+      code = -1
+    } = await getDepartMentList(id)
+    if (code === consts.RET_CODE.SUCCESS) {
+      setState({ ...state, data })
+    }
+  }
+
+  useEffect(() => {
+    initData()
+  }, [])
   return (
     <div className="h-full w-max-234px rounded-4px roleMenu">
       <div className="p-4 border-b-1 border-solid border-black border-opacity-10 bg-[#f7f9fa] flex justify-around items-center">
         <span className="text-[0.9375rem]">组织架构</span>
+        <ModalForm
+          title="创建部门"
+          width="500px"
+          trigger={
+            <Button size="small" type="primary" ghost>
+              <PlusOutlined />
+              创建部门
+            </Button>
+          }>
+          <ProFormText name="backstageMenuId" hidden />
+          <ProFormText name="name" label="新增部门" rules={[{ message: '请输入部门名称' }]} />
+          <ProFormSelect
+            width="md"
+            options={[
+              {
+                value: 'time',
+                label: '总部'
+              },
+              {
+                value: 'timea',
+                label: '研究中心'
+              }
+            ]}
+            name="unusedMode"
+            label="上级部门"
+          />
+        </ModalForm>
       </div>
       <div className="p-4 bg-white" style={{ height: 'calc(100% - 1rem*2 - 20px)' }}>
-        <div className="p-0 m-0 list-none text-primary flex flex-col flex-1">dads</div>
+        <ul className="p-0 m-0 list-none text-primary flex flex-col flex-1">
+          <li>全公司</li>
+        </ul>
       </div>
     </div>
   )
 }
 
 export default RoleMenu
+// export default connect(({ staff }) => ({
+//   departments: staff.departments
+// }))(RoleMenu)

+ 0 - 21
src/services/staff.js

@@ -1,27 +1,6 @@
 import request from '@/basic/utils/request'
 
 /**
- * 获取部门列表
- * @param {*} payload
- * @returns 结果集
- */
-export async function queryDepartment(payload) {
-  const data = await request.post('/department/list', {
-    data: payload
-  })
-  return data
-}
-
-/**
- * 新增部门
- * @param {string} data
- */
-export async function apiAddDepartment(payload) {
-  const data = await request.post('/department/add', { data: payload })
-  return data
-}
-
-/**
  * 获取员工列表
  * @param {*} payload
  * @returns 结果集