From 03177e1d421c090185dc3a5f57a9d3704334d94e Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 25 七月 2025 09:48:19 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/OAManage --- src/pages/HumanResourceManagement/nominationForAppointment/index.tsx | 359 ++++++++++++----------------------------------------------- 1 files changed, 77 insertions(+), 282 deletions(-) diff --git a/src/pages/HumanResourceManagement/nominationForAppointment/index.tsx b/src/pages/HumanResourceManagement/nominationForAppointment/index.tsx index bf36d47..371f033 100644 --- a/src/pages/HumanResourceManagement/nominationForAppointment/index.tsx +++ b/src/pages/HumanResourceManagement/nominationForAppointment/index.tsx @@ -1,289 +1,84 @@ -import { PageContainer } from '@ant-design/pro-components'; -import { Button, Card, Input, Pagination, Select, Table, TableProps, Tabs } from 'antd'; -import React, { useEffect, useRef, useState } from 'react'; -import Apply from './components/apply'; -import './index.less'; +import Apply from "@/components/ApplyIndex"; +import React from "react"; const NominationForAppointment: React.FC = () => { - const [activeKey, setActiveKey] = useState('wait'); // tabs閫変腑 - const tableRef = useRef<any>(null); // ref - - // 鐢宠 - const [visible, setVisible] = React.useState(false); - const [formData, setFormData] = React.useState<any>({}); - - // tableData - const [tableData, setTableData] = useState([]); - - // 閮ㄩ棬鏌ヨ鍊� - const [departmentValue, setDepartmentValue] = useState<string>(); - // 鑱屼綅鏌ヨ鍊� - const [positionValue, setPositionValue] = useState<string>(); - // 濮撳悕鏌ヨ鍊� - const [userNameValue, setUserNameValue] = useState<string>(); - - // checkBox閫変腑鍊� - const [checkedRows, setCheckedRows] = useState<React.Key[]>([]); - - // Tab閫夐」鍗℃暟鎹� - const TabsItems = [ - { - label: `寰呭鐞嗙殑`, - key: `wait`, - children: '', - }, - { - label: `鎵�鏈夌殑`, - key: `all`, - children: '', - }, - ]; - - // 閮ㄩ棬鍚嶇О鏁版嵁 - const departmentOptions = [ - { - value: 'jack', - label: 'Jack', - }, - { - value: 'lucy', - label: 'Lucy', - }, - { - value: 'tom', - label: 'Tom', - }, - ]; - - // 鑱屼綅鍚嶇О鏁版嵁 - const positionOptions = [ - { - value: 'jack', - label: 'Jack', - }, - { - value: 'lucy', - label: 'Lucy', - }, - { - value: 'tom', - label: 'Tom', - }, - ]; - - // 鎵撳紑鐢宠 - const openApply = () => { - setVisible(true); + const params = { + title: "浠昏亴鎻愬悕", + applyType: "nominationForAppointment", + formItems: [ + { + label: "鍚嶇О", + name: "applyName", + rules: [{ required: true, message: "璇疯緭鍏ュ悕绉�!" }], + type: "input", + pageType: "nominationForAppointment", + labelCol: 3, + width: 730, + }, + { + label: "鍛樺伐濮撳悕", + name: "employeeName", + rules: [{ required: true, message: "璇疯緭鍏ュ憳宸ュ鍚�!" }], + type: "input", + pageType: "dismissalApplication", + labelCol: 6, + width: 300, + }, + { + label: "浠昏亴鏂瑰紡", + name: "applyType", + rules: [{ required: true, message: "璇烽�夋嫨浠昏亴鏂瑰紡!" }], + type: "select", + pageType: "nominationForAppointment", + labelCol: 6, + width: 300, + }, + { + label: "鎵�灞炶亴浣�", + name: "position", + rules: [{ required: true, message: "璇烽�夋嫨鎵�灞炶亴浣�!" }], + type: "select", + pageType: "nominationForAppointment", + labelCol: 6, + width: 300, + }, + { + label: "鎵ц鏃堕棿", + name: "executionTime", + rules: [{ required: true, message: "璇烽�夋嫨鎵ц鏃堕棿!" }], + type: "date", + pageType: "nominationForAppointment", + labelCol: 6, + width: 300, + }, + { + label: "璇︾粏淇℃伅", + name: "detailInfo", + type: "textArea", + pageType: "nominationForAppointment", + labelCol: 3, + width: 730, + }, + { + label: "鑰冩牳淇℃伅", + name: "assessInfo", + type: "textArea", + pageType: "nominationForAppointment", + labelCol: 3, + width: 730, + }, + { + label: "浠昏亴鍘熺敱", + name: "reason", + type: "textArea", + pageType: "nominationForAppointment", + labelCol: 3, + width: 730, + }, + ], }; - // 鍏抽棴鐢宠 - const onCancelApply = () => { - setVisible(false); - setFormData({}); - }; - - const columns: any[] = [ - { - title: '浠昏亴鎻愬悕鍚嶇О', - key: 'name', - dataIndex: 'name', - align: 'center', - }, - { - title: '鍛樺伐濮撳悕', - key: 'employeeName', - dataIndex: 'employeeName', - align: 'center', - }, - { - title: '浠昏亴鏂瑰紡', - key: 'applyType', - dataIndex: 'applyType', - align: 'center', - }, - { - title: '鎵ц鏃堕棿', - key: 'executeTime', - dataIndex: 'executeTime', - align: 'center', - }, - { - title: '鐘舵��', - key: 'state', - dataIndex: 'state', - align: 'center', - }, - { - title: '鎿嶄綔', - dataIndex: 'operation', - align: 'center', - }, - ]; - - // Tabs鍒囨崲 - const onChangeTabs = (key: string) => { - setActiveKey(key); - }; - - // 鑱屼綅鍚嶇О鏌ヨ - const onChangeSelectPosition = (value: string) => { - setPositionValue(value); - }; - - // 閮ㄩ棬鍚嶇О鏌ヨ - const onChangeSelectDepartment = (value: string) => { - setDepartmentValue(value); - }; - - // 濮撳悕鏌ヨ - const changeUserName = (e: any) => { - setUserNameValue(e.target.value); - }; - - // 鑾峰彇浜哄憳鏁版嵁 - const getPersonalData = async () => { - const res = await new Promise((resolve, reject) => { - // Simulate an asynchronous operation, such as an API call - setTimeout(() => { - const success = true; - if (success) { - // If the operation is successful, resolve the Promise with data - const data = [ - { - name: 'Nomination 1', - employeeName: 'John', - applyType: 'Full-time', - executeTime: '2025-07-21', - state: 'Pending', - key: '1', - }, - { - name: 'Nomination 2', - employeeName: 'Jane', - applyType: 'Part-time', - executeTime: '2025-07-22', - state: 'Approved', - key: '2', - }, - ]; - resolve(data); - } else { - // If the operation fails, reject the Promise with an error - reject(new Error('Failed to fetch data')); - } - }, 1000); - }); - setTableData(res); - }; - - const rowSelection: TableProps['rowSelection'] = { - onChange: (selectedRowKeys: React.Key[], selectedRows: any[]) => { - setCheckedRows(selectedRows); - console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); - }, - }; - - useEffect(() => { - getPersonalData(); - }, []); - - return ( - <PageContainer className="nominationForAppointmentBox"> - <Tabs defaultActiveKey={activeKey} items={TabsItems} onChange={onChangeTabs} /> - <div className="searchTitle">浠昏亴鎻愬悕鏌ヨ</div> - <Card style={{ marginBottom: 20 }}> - <div className="searchBox"> - <div className="searchItem"> - <span>閮ㄩ棬鍚嶇О锛�</span> - <Select - style={{ width: 200 }} - value={departmentValue} - onChange={onChangeSelectDepartment} - options={departmentOptions} - allowClear - /> - </div> - <div className="searchItem"> - <span>鑱屼綅鍚嶇О锛�</span> - <Select - style={{ width: 200 }} - value={positionValue} - onChange={onChangeSelectPosition} - options={positionOptions} - allowClear - /> - </div> - <div className="searchItem"> - <span>鍛樺伐濮撳悕锛堟垨鎷奸煶棣栧瓧姣嶏級锛�</span> - <Input - style={{ width: 200 }} - value={userNameValue} - onChange={changeUserName} - allowClear - /> - </div> - <div className="searchBtn"> - <Button - type="primary" - onClick={() => { - tableRef?.current?.reload(); - }} - > - 鏌ヨ - </Button> - <Button - onClick={() => { - tableRef?.current?.reload(); - setDepartmentValue(''); - setPositionValue(''); - setUserNameValue(''); - }} - > - 閲嶇疆 - </Button> - </div> - </div> - </Card> - <div className="searchTitle"> - <span>浠昏亴鎻愬悕绠$悊</span> - <div className="btnClass"> - {checkedRows.length > 0 && ( - <Button - type="primary" - danger - onClick={() => { - console.log('鎵归噺鍒犻櫎', checkedRows); - // 鎵ц鎵归噺鍒犻櫎鎿嶄綔 - }} - > - 鎵归噺鍒犻櫎 - </Button> - )} - <Button style={{ marginLeft: 10 }} type="primary" onClick={openApply}> - 鐢宠 - </Button> - <Apply visible={visible} setFormData={setFormData} onCancel={onCancelApply} /> - </div> - </div> - <Card style={{ marginBottom: 5 }}> - <Table - rowSelection={{ type: 'checkbox', ...rowSelection }} - columns={columns} - dataSource={tableData} - pagination={false} - /> - </Card> - <Card className="paginationCard"> - <Pagination - total={50} - current={1} - pageSize={10} - size="small" - // onChange={handlePageChange} - /> - </Card> - </PageContainer> - ); + return <Apply {...params} />; }; export default NominationForAppointment; -- Gitblit v1.9.1