From 716b809c2af53a5617506512f97d96fbdfeecb71 Mon Sep 17 00:00:00 2001
From: zhongshujie <2862698242@qq.com>
Date: 星期五, 01 八月 2025 15:28:50 +0800
Subject: [PATCH] 人员需求分析审批

---
 config/routes.ts                                                            |    2 
 src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.less     |   10 
 src/pages/humanResourcePlanning/organizationalStrategyFormulation/index.tsx |  280 ++++++++++++++----
 src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.tsx      |  572 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 798 insertions(+), 66 deletions(-)

diff --git a/config/routes.ts b/config/routes.ts
index 06c47e3..2cc0277 100644
--- a/config/routes.ts
+++ b/config/routes.ts
@@ -66,7 +66,7 @@
     routes: [
       { path: '/humanResourcePlanning', redirect: '/admin/sub-page' },
       { path: '/humanResourcePlanning/organizationalStrategyFormulation', name: '缁勭粐鎴樼暐鍒跺畾', component: './humanResourcePlanning/organizationalStrategyFormulation' },
-      { path: '/humanResourcePlanning/personnelRequirementAnalysis', name: '浜哄憳闇�姹傚垎鏋�', component: './Admin' },
+      { path: '/humanResourcePlanning/personnelRequirementAnalysis', name: '浜哄憳闇�姹傚垎鏋�', component: './humanResourcePlanning/personnelRequirementAnalysis' },
       { path: '/humanResourcePlanning/analysisOfHumanResourceSupply', name: '浜哄姏璧勬簮渚涚粰鍒嗘瀽', component: './Admin' },
       { path: '/humanResourcePlanning/humanResourcesBudget', name: '浜哄姏璧勬簮棰勭畻', component: './Admin' },
       { path: '/humanResourcePlanning/jobAnalysis', name: '宸ヤ綔鍒嗘瀽', component: './Admin' },
diff --git a/src/pages/humanResourcePlanning/organizationalStrategyFormulation/index.tsx b/src/pages/humanResourcePlanning/organizationalStrategyFormulation/index.tsx
index 376e0c0..67496cd 100644
--- a/src/pages/humanResourcePlanning/organizationalStrategyFormulation/index.tsx
+++ b/src/pages/humanResourcePlanning/organizationalStrategyFormulation/index.tsx
@@ -1,94 +1,192 @@
 import {
   postOaStrategyPlanGetStrategyPlanList,
   postOaStrategyPlanNewStrategyPlan,
-} from '@/services/WebApi/strategyPlan';
-import { PlusOutlined } from '@ant-design/icons';
-import { PageContainer, ProTable } from '@ant-design/pro-components';
-import { Button, Col, DatePicker, Form, Modal, Row } from 'antd';
-import TextArea from 'antd/es/input/TextArea';
-import React, { useState } from 'react';
-import styles from './index.less';
+  postOaStrategyPlanUpdateStrategyPlan,
+  postOaStrategyPlanDelStrategyPlan
+} from "@/services/WebApi/strategyPlan";
+import { PlusOutlined, ExclamationCircleOutlined } from "@ant-design/icons";
+import { PageContainer, ProTable } from "@ant-design/pro-components";
+import {
+  Button,
+  Col,
+  DatePicker,
+  Form,
+  Input,
+  Modal,
+  Row,
+  message,
+} from "antd";
+import TextArea from "antd/es/input/TextArea";
+import dayjs from "dayjs";
+import React, { useEffect, useRef, useState } from "react";
+import styles from "./index.less";
 const organizationalStrategyFormulation: React.FC = () => {
-  const [dialogTitle, setDialogTitle] = useState('');
-  const [addDialogVisible, setAddDialogVisible] = useState(false);
+  const [dialogTitle, setDialogTitle] = useState("");
+  const [addDialogVisible, setAddDialogVisible] = useState({
+    open: false, // 鍒濆鐘舵��
+    type: "",
+  });
 
   const [formRef] = Form.useForm();
+  const tableRef = useRef(null);
+  const { confirm } = Modal;
   // 琛ㄥご
   const columns = [
     {
-      title: '鏃堕棿娈�',
-      dataIndex: ['beginDate', 'endDate'], // 鍖归厤鍚庣杩斿洖鐨勬暟鎹粨鏋�
-      key: 'dateRange',
-      valueType: 'dateRange', // 浣跨敤 antd 鐨� RangePicker
-      render: (_, record) => (
+      title: "鏃堕棿娈�",
+      dataIndex: ["beginDate", "endDate"], // 鍖归厤鍚庣杩斿洖鐨勬暟鎹粨鏋�
+      key: "dateRange",
+      width: 200,
+      valueType: "dateRange", // 浣跨敤 antd 鐨� RangePicker
+      render: (_: any, record: any) => (
         <span>
           {record.beginDate && record.endDate
-            ? `${record.beginDate.split('T')[0]} 鑷�${record.endDate.split('T')[0]}`
-            : '鏈缃�'}
+            ? `${record.beginDate} 鈥�${record.endDate}`
+            : "鏈缃�"}
         </span>
       ),
       search: {
-        transform: (values) => ({
+        transform: (values: any) => ({
           beginDate: values[0], // 杞崲涓哄悗绔渶瑕佺殑鏍煎紡
           endDate: values[1],
         }),
       },
     },
     {
-      title: '瀹炵幇鐨勭洰鏍�',
-      dataIndex: 'aim',
-      key: 'aim',
+      title: "瀹炵幇鐨勭洰鏍�",
+      dataIndex: "aim",
+      key: "aim",
       search: false,
     },
     {
-      title: '鏍稿績浠峰�艰',
-      dataIndex: 'coreValue',
-      key: 'coreValue',
+      title: "鏍稿績浠峰�艰",
+      dataIndex: "coreValue",
+      key: "coreValue",
       search: false,
     },
     {
-      title: '鎿嶄綔',
-      dataIndex: 'operate',
-      key: 'operate',
+      title: "鎿嶄綔",
+      width: 200,
+      dataIndex: "operate",
+      key: "operate",
       search: false,
-      render: (text: string) => <a>缂栬緫</a>,
+      render: (text: string, record: any) => {
+        return (
+          <div>
+            <Button
+              onClick={() => {
+                console.log(text, "text001");
+                console.log(record, "record001");
+                record.time = [dayjs(record.beginDate), dayjs(record.endDate)];
+                setAddDialogVisible({
+                  open: true,
+                  type: "edit",
+                });
+                setDialogTitle("缂栬緫缁勭粐鎴樼暐");
+                formRef.setFieldsValue(record);
+              }}
+              color="primary"
+              variant="text"
+            >
+              缂栬緫
+            </Button>
+            <Button onClick={() => {
+              confirm({
+                icon: <ExclamationCircleOutlined />,
+                content: "鏄惁鍒犻櫎璇ユ暟鎹�",
+                onOk() {
+                  postOaStrategyPlanDelStrategyPlan({
+                    ids: [record.id],
+                  }).then((res) => {
+                    message.success("鍒犻櫎鎴愬姛");
+                    tableRef?.current?.reload();
+                  });
+                  console.log('OK');
+                },
+                onCancel() {
+                  console.log('Cancel');
+                },
+              });
+
+            }} color="danger" variant="text">
+              鍒犻櫎
+            </Button>
+          </div>
+        );
+      },
     },
   ];
 
   // 琛ㄦ牸鍏ㄩ��
-  const rowSelection: TableProps<DataType>['rowSelection'] = {
+  const rowSelection: TableProps<DataType>["rowSelection"] = {
     onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => {
       // 褰撻�変腑琛屽彉鍖栨椂瑙﹀彂锛屾墦鍗伴�変腑鐨勮閿拰琛屾暟鎹�
-      console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
+      console.log(
+        `selectedRowKeys: ${selectedRowKeys}`,
+        "selectedRows: ",
+        selectedRows
+      );
     },
   };
 
+  useEffect(() => {
+    if (addDialogVisible && !addDialogVisible.open) {
+      formRef.resetFields();
+    }
+  }, [addDialogVisible.open]);
+
   // 琛ㄥ崟鎻愪氦
   const handleOk = () => {
-    const values = formRef.getFieldsValue();
-    const body = {
-      beginDate: values.time[0],
-      endDate: values.time[1],
-      aim: values.aim,
-      coreValue: values.coreValue,
-      direction: values.direction,
-      plan: values.plan,
-      guide: values.guide,
-      steps: values.steps,
-      orgId: 4,
-    };
-    postOaStrategyPlanNewStrategyPlan(body).then((res) => {
-      console.log(res, 'res');
-      setAddDialogVisible(false);
+    formRef.validateFields().then((values) => {
+      console.log(values, "values");
+      const recordId = values.id || null;
+      const body = {
+        beginDate: values.time[0],
+        endDate: values.time[1],
+        aim: values.aim,
+        coreValue: values.coreValue,
+        direction: values.direction,
+        plan: values.plan,
+        guide: values.guide,
+        steps: values.steps,
+        orgId: 4,
+        ...(recordId && { id: recordId }),
+      };
+      if (body.id) {
+        // 淇敼琛ㄥ崟
+        postOaStrategyPlanUpdateStrategyPlan(body).then((res) => {
+          console.log(res, "res");
+          message.success("鏇存柊鎴愬姛");
+          setAddDialogVisible({ open: false, type: "" });
+          // 鍒锋柊
+          tableRef.current.reload();
+        });
+      } else {
+        // 鏂板琛ㄥ崟
+        postOaStrategyPlanNewStrategyPlan(body).then((res) => {
+          console.log(res, "res");
+          message.success("鏂板缓鎴愬姛");
+          setAddDialogVisible({
+            open: false,
+            type: "add",
+          });
+          tableRef.current.reload();
+        });
+      }
     });
   };
+
+  // 寮规鍙栨秷
   const handleCancel = () => {
-    setAddDialogVisible(false);
+    setAddDialogVisible({
+      open: false,
+      type: "",
+    });
   };
 
   // 鑾峰彇琛ㄦ牸鏁版嵁
   const getTableData = (params: { current: number; pageSize: number }) => {
-    debugger;
+    console.log(params, "params001");
     const body = {
       start: (params.current - 1) * params.pageSize,
       size: params.pageSize,
@@ -97,23 +195,62 @@
       orgId: 4,
     };
     return postOaStrategyPlanGetStrategyPlanList(body).then((res) => {
-      return {
-        data: res.datas,
-        total: res.totalSize,
-      };
+      if (params.beginDate && params.endDate) {
+        let tableList = [];
+        res.datas.forEach((item: any) => {
+          item.beginDateWithinRange = isDateWithinRange(
+            item.beginDate,
+            params.beginDate,
+            params.endDate
+          );
+          item.endDateWithinRange = isDateWithinRange(
+            item.endDate,
+            params.beginDate,
+            params.endDate
+          );
+          item.beginDate = item.beginDate.split("T")[0];
+          item.endDate = item.endDate.split("T")[0];
+          if (item.beginDateWithinRange && item.endDateWithinRange) {
+            tableList.push(item);
+          }
+        });
+        return {
+          data: tableList,
+          total: tableList.length,
+        };
+      } else {
+        res.datas.forEach((item: any) => {
+          item.beginDate = item.beginDate.split("T")[0];
+          item.endDate = item.endDate.split("T")[0];
+        });
+        return {
+          data: res.datas,
+          total: res.totalSize,
+        };
+      }
     });
   };
 
-  // 鏌ヨ
+  // 鍒ゆ柇鏃ユ湡鏄惁鍦ㄨ寖鍥村唴
+  const isDateWithinRange = (dateStr: any, startStr: any, endStr: any) => {
+    const date = new Date(dateStr);
+    const start = new Date(startStr);
+    start.setHours(0, 0, 0, 0);
+    const end = new Date(endStr);
+    end.setHours(23, 59, 59, 999);
+    return date >= start && date <= end;
+  };
 
+  // 鏌ヨ
   const handleSearch = (params: { current: number; pageSize: number }) => {
-    console.log(params, 'params001');
+    console.log(params, "params001");
     debugger;
   };
 
   return (
     <PageContainer>
       <ProTable
+        actionRef={tableRef}
         headerTitle="缁勭粐鎴樼暐鍒跺畾琛�"
         columns={columns}
         rowKey="id"
@@ -125,8 +262,11 @@
             key="button"
             icon={<PlusOutlined />}
             onClick={() => {
-              setAddDialogVisible(true);
-              setDialogTitle('鏂板缓缁勭粐鎴樼暐');
+              setAddDialogVisible({
+                open: true,
+                type: "add",
+              });
+              setDialogTitle("鏂板缓缁勭粐鎴樼暐");
             }}
             type="primary"
           >
@@ -136,23 +276,31 @@
       ></ProTable>
 
       <Modal
-        title={dialogTitle}
+        title={addDialogVisible.type == "add" ? "鏂板缓缁勭粐鎴樼暐" : "缂栬緫缁勭粐鎴樼暐"}
         width={900}
         onOk={handleOk}
-        open={addDialogVisible}
+        open={addDialogVisible.open}
         // confirmLoading={confirmLoading}
         onCancel={handleCancel}
       >
         <div className={styles.addDialog}>
-          <Form form={formRef} layout="vertical" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
+          <Form
+            form={formRef}
+            layout="vertical"
+            labelCol={{ span: 6 }}
+            wrapperCol={{ span: 18 }}
+          >
             <Row>
               <Col span={12}>
                 <Form.Item
                   label="鏃堕棿娈�"
                   name="time"
-                  rules={[{ required: true, message: '璇疯緭鍏ユ椂闂存' }]}
+                  rules={[{ required: true, message: "璇疯緭鍏ユ椂闂存" }]}
                 >
-                  <DatePicker.RangePicker style={{ width: '100%' }} />
+                  <DatePicker.RangePicker style={{ width: "100%" }} />
+                </Form.Item>
+                <Form.Item name="id" hidden>
+                  <Input />
                 </Form.Item>
               </Col>
             </Row>
@@ -161,7 +309,9 @@
                 <Form.Item
                   label="缁勭粐闇�瑕佸疄鐜扮殑鐩爣"
                   name="aim"
-                  rules={[{ required: true, message: '璇疯緭鍏ョ粍缁囬渶瑕佸疄鐜扮殑鐩爣' }]}
+                  rules={[
+                    { required: true, message: "璇疯緭鍏ョ粍缁囬渶瑕佸疄鐜扮殑鐩爣" },
+                  ]}
                 >
                   <TextArea rows={4} />
                 </Form.Item>
@@ -172,7 +322,7 @@
                 <Form.Item
                   label="鏍稿績浠峰�艰"
                   name="coreValue"
-                  rules={[{ required: true, message: '璇疯緭鍏ユ牳蹇冧环鍊艰' }]}
+                  rules={[{ required: true, message: "璇疯緭鍏ユ牳蹇冧环鍊艰" }]}
                 >
                   <TextArea rows={4} />
                 </Form.Item>
@@ -183,7 +333,7 @@
                 <Form.Item
                   label="缁勭粐鐨勫彂灞曟柟鍚�"
                   name="direction"
-                  rules={[{ required: true, message: '璇疯緭鍏ョ粍缁囩殑鍙戝睍鏂瑰悜' }]}
+                  rules={[{ required: true, message: "璇疯緭鍏ョ粍缁囩殑鍙戝睍鏂瑰悜" }]}
                 >
                   <TextArea rows={4} />
                 </Form.Item>
@@ -194,7 +344,7 @@
                 <Form.Item
                   label="缁勭粐鐨勫彂灞曡鍒�"
                   name="plan"
-                  rules={[{ required: true, message: '璇疯緭鍏ョ粍缁囩殑鍙戝睍璁″垝' }]}
+                  rules={[{ required: true, message: "璇疯緭鍏ョ粍缁囩殑鍙戝睍璁″垝" }]}
                 >
                   <TextArea rows={4} />
                 </Form.Item>
@@ -205,7 +355,7 @@
                 <Form.Item
                   label="鎸囧鏂归拡"
                   name="guide"
-                  rules={[{ required: true, message: '璇疯緭鍏ユ寚瀵兼柟閽�' }]}
+                  rules={[{ required: true, message: "璇疯緭鍏ユ寚瀵兼柟閽�" }]}
                 >
                   <TextArea rows={4} />
                 </Form.Item>
@@ -216,7 +366,7 @@
                 <Form.Item
                   label="瀹炴柦鎺柦"
                   name="steps"
-                  rules={[{ required: true, message: '璇疯緭鍏ュ疄鏂芥帾鏂�' }]}
+                  rules={[{ required: true, message: "璇疯緭鍏ュ疄鏂芥帾鏂�" }]}
                 >
                   <TextArea rows={4} />
                 </Form.Item>
diff --git a/src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.less b/src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.less
new file mode 100644
index 0000000..613423e
--- /dev/null
+++ b/src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.less
@@ -0,0 +1,10 @@
+.title {
+    border: 1px solid #fafafa;
+    margin: 10px 0;
+    padding: 5px 10px;
+}
+
+.addDialog{
+    max-height: 600px;
+    overflow-y: auto;
+}
diff --git a/src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.tsx b/src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.tsx
new file mode 100644
index 0000000..bcb3bf4
--- /dev/null
+++ b/src/pages/humanResourcePlanning/personnelRequirementAnalysis/index.tsx
@@ -0,0 +1,572 @@
+import {
+    postOaResourceRequirementAnalysisGetResourceRequirementAnalysisList,
+    postOaResourceRequirementAnalysisNewApprove,
+    postOaResourceRequirementAnalysisNewResourceRequirementAnalysis,
+    postOaResourceRequirementAnalysisUpdateResourceRequirementAnalysis,
+    postOaResourceRequirementAnalysisDelResourceRequirementAnalysis
+} from "@/services/WebApi/resourceRequirementAnalysis";
+import { postOaDepartmentGetDepartmentList } from '@/services/WebApi/oaDepartment';
+import { postOaJobGetJobList } from '@/services/WebApi/oaJob';
+import { PageContainer, ProTable } from "@ant-design/pro-components";
+import { PlusOutlined, ExclamationCircleOutlined } from "@ant-design/icons";
+import styles from "./index.less";
+import dayjs from "dayjs";
+import React, { useEffect, useRef, useState } from "react";
+import {
+    Button,
+    Col,
+    Form,
+    Input,
+    Modal,
+    Row,
+    message,
+    Select,
+    Radio,
+    Divider
+} from "antd";
+import TextArea from "antd/es/input/TextArea";
+
+const personnelRequirementAnalysis: React.FC = () => {
+    const [dialogTitle, setDialogTitle] = useState("");
+    const [addDialogVisible, setAddDialogVisible] = useState({
+        open: false, // 鍒濆鐘舵��
+        type: "",    // examine 瀹℃壒   add 鏂板缓   modify 淇敼
+    });
+    const [currentTime, setCurrentTime] = useState('');
+    const [formRef] = Form.useForm();
+    const tableRef = useRef(null);
+    const { confirm } = Modal;
+
+    // 鍙渶瑕佸瓨鍌ㄥ師濮嬫暟鎹�
+    const [departments, setDepartments] = useState([]);
+    const [positions, setPositions] = useState([]);
+
+    useEffect(() => {
+        // 缁勪欢鎸傝浇鏃惰幏鍙栧綋鍓嶆椂闂�
+        const loadData = async () => {
+            try {
+                // 浣跨敤 Promise.all 骞惰璇锋眰锛屾晥鐜囨洿楂�
+                const [depData, posData] = await Promise.all([
+                    getDepList(),
+                    getPositionList()
+                ]);
+                setDepartments(depData.data);
+                setPositions(posData.data);
+                setCurrentTime(new Date().toLocaleString());
+
+            } catch (error) {
+                console.error("鑾峰彇鏁版嵁澶辫触:", error);
+            }
+        };
+        loadData();
+        setCurrentTime(new Date().toLocaleString());
+    }, []);
+
+    //鑾峰彇閮ㄩ棬鍒楄〃
+    const getDepList = () => {
+        const params = {
+            start: 0,
+            size: 99,
+            orgId: 5,
+            filterList: [],
+            searchList: [],
+        };
+        return postOaDepartmentGetDepartmentList(params).then((res) => {
+            console.log(res, 'res');
+            return {
+                data: res.datas,
+                total: res.totalSize,
+            };
+        });
+    };
+    // 鑾峰彇鑱屼綅鍒楄〃
+    const getPositionList = () => {
+        const params = {
+            start: 0,
+            size: 99,
+            orgId: 5,
+            filterList: [],
+            searchList: [],
+        };
+        return postOaJobGetJobList(params).then((res) => {
+            console.log(res, 'res');
+            return {
+                data: res.datas,
+                total: res.totalSize,
+            };
+        });
+    };
+
+    const handleEdit = (record: any, txt: any,) => {
+        setAddDialogVisible({
+            open: true,
+            type: "edit",
+        });
+        setDialogTitle(txt + "缁勭粐鎴樼暐");
+        // 鐢ㄤ簬鍙嶆樉鏁版嵁
+        formRef.setFieldsValue({
+            name: record.name,
+            department: record.department?.id,
+            position: record.job?.id,
+            currentStaffCount: record.job.currentStaffCount,
+            resourceCount: record.resourceCount,
+            remarks: record.remarks,
+            affect: record.affect,
+        });
+    };
+
+    const handleSubmit = async (record: any,) => {
+        const params = {
+           refId: record.id,
+           state: "涓嶉敊锛屽緢婊℃剰",
+           remarks:"",
+        };
+        return await postOaResourceRequirementAnalysisNewApprove(params).then((res) => {
+            console.log(res, 'res');
+            return {
+                data: res.datas,
+                total: res.totalSize,
+            };
+        });
+    };
+
+    // 琛ㄥご
+    const columns = [
+        {
+            title: "闇�姹傚垎鏋愬悕绉�",
+            dataIndex: "name",
+            key: "name",
+            formItemProps: {
+                labelWrap: true,
+                labelCol: { span: 8 },
+            },
+        },
+        {
+            title: "閮ㄩ棬",
+            dataIndex: "department",
+            key: "department",
+            search: false,
+            render: (text: string, record: any) => {
+                return (
+                    <div>
+                        {record.department.name}
+                    </div>
+                )
+            }
+        },
+        {
+            title: "鑱屼綅",
+            dataIndex: "position",
+            key: "position",
+            search: false,
+            render: (text: string, record: any) => {
+                return (
+                    <div>
+                        {record.job.name}
+                    </div>
+                )
+            }
+        },
+        {
+            title: "鐜版湁浜烘暟",
+            dataIndex: "currentStaffCount",
+            key: "currentStaffCount",
+            search: false,
+            render: (text: string, record: any) => {
+                return (
+                    <div>
+                        {record.job.currentStaffCount}
+                    </div>
+                )
+            }
+        },
+        {
+            title: "鏄惁鍙椾緵缁欏洜绱犲奖鍝�",
+            dataIndex: "affectByMarket",
+            key: "affectByMarket",
+            search: false,
+            render: (text: string, record: any) => {
+                return (
+                    <div>
+                        {record.affectByMarket == true ? "鏄�" : "鍚�"}
+                    </div>
+                )
+            }
+        },
+        {
+            title: "闇�姹備汉鏁�",
+            dataIndex: "resourceCount",
+            key: "resourceCount",
+            search: false,
+        },
+        {
+            title: "鐘舵��",
+            dataIndex: "affectByMarket",
+            key: "affectByMarket",
+            search: false,
+            render: (text: string, record: any) => {
+                // 鍋囪 record.approve 鐨勫�兼槸 true, false, 鎴� null
+                let statusText = "";
+                let color = "";
+                if (record.approve === true) {
+                    statusText = "宸插鎵�";
+                    color = "#3f7cb5";
+                } else if (record.approve === false) {
+                    statusText = "寰呭鎵�";
+                    color = "#ff1c1c";
+                } else {
+                    statusText = "鏈彁浜�";
+                    color = "#bab7aa";
+                }
+                return (
+                    <div style={{ color: color, fontWeight: 'bold' }}>
+                        {statusText}
+                    </div>
+                )
+            }
+        },
+        {
+            title: "鎿嶄綔",
+            width: 200,
+            dataIndex: "operate",
+            key: "operate",
+            search: false,
+            render: (text: string, record: any) => {
+                let statusText = "";
+                let type = ""
+                if (record.approve === true) {
+                    statusText = "鏌ョ湅";
+                    type
+                } else if (record.approve === false) {
+                    statusText = "瀹℃壒";
+                } else {
+                    statusText = "缂栬緫";
+                }
+                return (
+                    <div>
+                        <Button
+                            onClick={() => {
+                                console.log(record, "record001");
+                                record.time = [dayjs(record.beginDate), dayjs(record.endDate)];
+                                handleEdit(record, statusText,)
+                            }}
+                            color="primary"
+                            variant="text"
+                        >
+                            {statusText}
+                        </Button>
+                        <Button
+                            onClick={() => {
+                                console.log(record, "record001");
+                                handleSubmit(record)
+
+                            }}
+                            color="primary"
+                            variant="text"
+                        >
+                            鎻愪氦
+                        </Button>
+                        <Button onClick={() => {
+                            confirm({
+                                icon: <ExclamationCircleOutlined />,
+                                content: "鏄惁鍒犻櫎璇ユ暟鎹�",
+                                onOk() {
+                                    postOaResourceRequirementAnalysisDelResourceRequirementAnalysis({
+                                        ids: [record.id],
+                                    }).then((res) => {
+                                        message.success("鍒犻櫎鎴愬姛");
+                                        tableRef?.current?.reload();
+                                    });
+                                    console.log('OK');
+                                },
+                                onCancel() {
+                                    console.log('Cancel');
+                                },
+                            });
+
+                        }} color="danger" variant="text">
+                            鍒犻櫎
+                        </Button>
+                    </div>
+                );
+            },
+        },
+    ];
+    // 鍏ㄩ��
+    const rowSelection: TableProps<DataType>["rowSelection"] = {
+        onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => {
+            // 褰撻�変腑琛屽彉鍖栨椂瑙﹀彂锛屾墦鍗伴�変腑鐨勮閿拰琛屾暟鎹�
+            console.log(
+                `selectedRowKeys: ${selectedRowKeys}`,
+                "selectedRows: ",
+                selectedRows
+            );
+        },
+    };
+    // 鑾峰彇琛ㄦ牸鏁版嵁
+    const getTableData = (params: { current: number; pageSize: number }) => {
+        const body = {
+            start: (params.current - 1) * params.pageSize,
+            size: params.pageSize,
+            filterList: [],
+            searchList: [],
+            orgId: 5,
+        };
+        return postOaResourceRequirementAnalysisGetResourceRequirementAnalysisList(body).then((res) => {
+            return {
+                data: res.datas,
+                total: res.totalSize,
+            };
+        });
+    };
+
+    // 琛ㄥ崟鎻愪氦
+    const handleOk = () => {
+        formRef.validateFields().then((values) => {
+            console.log(values, "values");
+            debugger
+        });
+    };
+    // 琛ㄥ崟鍙栨秷
+    const handleCancel = () => {
+        setAddDialogVisible({
+            open: false,
+            type: "",
+        });
+    };
+
+
+
+    // 鏌ヨ
+    const handleSearch = (params: { current: number; pageSize: number }) => {
+        console.log(params, "params001");
+        debugger;
+    };
+
+    const radioOptions: CheckboxGroupProps<string>['options'] = [
+        { label: '瀹℃壒閫氳繃', value: 'true' },
+        { label: '瀹℃壒鎷掔粷', value: 'false' },
+    ];
+
+    const supplyOptions: CheckboxGroupProps<string>['options'] = [
+        { label: '鏄�', value: 'true' },
+        { label: '鍚�', value: 'false' },
+    ];
+
+    return (
+        <PageContainer>
+            <ProTable
+                actionRef={tableRef}
+                headerTitle="浜哄憳闇�姹傚垎鏋愯〃"
+                columns={columns}
+                rowKey="id"
+                rowSelection={rowSelection}
+                request={getTableData}
+                onSearch={handleSearch}
+                toolBarRender={() => [
+                    <Button
+                        key="button"
+                        icon={<PlusOutlined />}
+                        onClick={() => {
+                            setAddDialogVisible({
+                                open: true,
+                                type: "add",
+                            });
+                            setDialogTitle("鏂板缓浜哄憳闇�姹傚垎鏋愯〃");
+                        }}
+                        type="primary"
+                    >
+                        鏂板缓
+                    </Button>,
+                ]}>
+            </ProTable>
+            <Modal
+                title={addDialogVisible.type == "add" ? "鏂板缓浜哄憳闇�姹傚垎鏋�" : "缂栬緫浜哄憳闇�姹傚垎鏋�"}
+                width={900}
+                onOk={handleOk}
+                open={addDialogVisible.open}
+                // confirmLoading={confirmLoading}
+                onCancel={handleCancel}
+            >
+                <div className={styles.addDialog}>
+                    <Form
+                        form={formRef}
+                        layout="vertical"
+                        labelCol={{ span: 6 }}
+                        wrapperCol={{ span: 18 }}
+                    >
+                        <Row>
+                            <Col span={12}>
+                                <Form.Item
+                                    label="浜哄憳闇�姹傚垎鏋愬悕绉�"
+                                    labelCol={{ span: 12 }}
+                                    name="name"
+                                    rules={[
+                                        { required: true, message: "璇疯緭鍏ヤ汉鍛橀渶姹傚垎鏋愬悕绉�" },
+                                    ]}
+                                >
+                                    <Input placeholder="璇疯緭鍏ヤ汉鍛橀渶姹傚垎鏋愬悕绉�" />
+                                </Form.Item>
+                            </Col>
+                            <Col span={12}>
+                                <Form.Item
+                                    label="閮ㄩ棬"
+                                    name="department"
+                                    rules={[{ required: true, message: "璇烽�夋嫨閮ㄩ棬" }]}
+                                >
+                                    <Select
+                                        placeholder="璇烽�夋嫨閮ㄩ棬"
+                                        options={departments.map(dep => ({
+                                            value: dep.id,
+                                            label: dep.name,
+                                        }))}
+                                    />
+                                </Form.Item>
+                            </Col>
+                        </Row>
+                        <Row>
+                            <Col span={12}>
+                                <Form.Item
+                                    label="鑱屼綅"
+                                    name="position"
+                                    rules={[{ required: true, message: "璇烽�夋嫨鑱屼綅" }]}
+                                >
+                                    <Select
+                                        placeholder="璇烽�夋嫨鑱屼綅"
+                                        options={positions.map(dep => ({
+                                            value: dep.id,
+                                            label: dep.name,
+                                        }))}
+                                    />
+                                </Form.Item>
+                            </Col>
+                            <Col span={12}>
+                                <Form.Item
+                                    label="鐜版湁浜烘暟"
+                                    name="currentStaffCount"
+                                >
+                                    <Input placeholder="璇疯緭鍏ヤ汉鍛橀渶姹傚垎鏋愬悕绉�" />
+                                </Form.Item>
+                            </Col>
+                        </Row>
+                        <Row>
+                            <Col span={12}>
+                                <Form.Item
+                                    label="浜哄姏闇�姹傞娴嬫柟娉�"
+                                    name="demandForecastingMethod"
+                                    rules={[{ required: true, message: "璇烽�夋嫨浜哄姏闇�姹傞娴嬫柟娉�" }]}
+                                    labelCol={{ span: 12 }}
+                                >
+                                    <Select
+                                        defaultValue="a1"
+                                        style={{ width: '100%' }}
+                                    // onChange={handleChange}
+
+                                    // options={options}
+                                    />
+                                </Form.Item>
+                            </Col>
+                            <Col span={12}>
+                                <Form.Item
+                                    label="鏄惁鍙椾緵缁欏洜绱犲奖鍝�"
+                                    name="affectByMarket"
+                                    rules={[{ required: true, message: "璇烽�夋嫨鏄惁鍙椾緵缁欏洜绱犲奖鍝�" }]}
+                                    labelCol={{ span: 12 }}
+                                >
+                                    <Radio.Group block options={supplyOptions} defaultValue="true" />
+                                </Form.Item>
+                            </Col>
+                        </Row>
+                        <Row>
+                            <Col span={24}>
+                                <Form.Item
+                                    label="闇�姹備汉鏁�"
+                                    name="resourceCount"
+                                    rules={[{ required: true, message: "璇疯緭鍏ラ渶姹備汉鏁�" }]}
+                                >
+                                    <Input placeholder="璇疯緭鍏ヤ汉鍛橀渶姹傚垎鏋愬悕绉�" />
+                                </Form.Item>
+                            </Col>
+                        </Row>
+                        <Row>
+                            <Col span={24}>
+                                <Form.Item
+                                    label="褰卞搷鍥犵礌"
+                                    name="affect"
+                                    rules={[{ message: "璇疯緭鍏ュ奖鍝嶅洜绱�" }]}
+                                >
+                                    <TextArea rows={4} />
+                                </Form.Item>
+                            </Col>
+                        </Row>
+                        <Row>
+                            <Col span={24}>
+                                <Form.Item
+                                    label="澶囨敞"
+                                    name="remarks"
+                                    rules={[{ message: "璇疯緭鍏ュ娉�" }]}
+                                >
+                                    <TextArea rows={4} />
+                                </Form.Item>
+                            </Col>
+                        </Row>
+
+                        {/* 鏍规嵁琛ㄦ牸鐨則ype鏉ュ垽鏂槸鍚︽樉绀� */}
+                        {
+                            addDialogVisible.type == "examine" ? (
+                                <>
+                                    <Divider orientation="center">寰呭鐞嗙殑浜哄憳闇�姹傚垎鏋�</Divider>
+                                    <Row>
+                                        <Col span={24}>
+                                            <Form.Item
+                                                label="瀹℃壒璇存槑"
+                                                name="affect"
+                                                rules={[{ required: true, message: "璇疯緭鍏ュ鎵硅鏄�" }]}
+                                            >
+                                                <TextArea rows={4} />
+                                            </Form.Item>
+                                        </Col>
+                                    </Row>
+                                    <Row>
+                                        <Col span={12}>
+                                            <Form.Item
+                                                label="瀹℃壒浜虹瀛�"
+                                                name="affect"
+                                                rules={[{ required: true, message: "璇疯緭鍏ュ鎵硅鏄�" }]}
+                                            >
+                                                <TextArea rows={4} />
+                                            </Form.Item>
+                                        </Col>
+                                        <Col span={12}>
+                                            <Form.Item
+                                                label="瀹℃壒鏃堕棿"
+                                                name="affect"
+                                                rules={[{ required: true, message: "璇疯緭鍏ュ鎵硅鏄�" }]}
+                                            >
+                                                <div >{currentTime}</div>
+                                            </Form.Item>
+                                        </Col>
+                                    </Row>
+                                    <Row>
+                                        <Col span={12}>
+                                            <Form.Item
+                                                label="閫夋嫨瑕佹墽琛岀殑鎿嶄綔"
+                                                labelCol={{ span: 12 }}
+                                                name="remarks"
+                                                rules={[{ required: true, message: "璇烽�夋嫨瑕佹墽琛岀殑鎿嶄綔" }]}
+                                            >
+                                                <Radio.Group block options={radioOptions} defaultValue="" />
+                                            </Form.Item>
+                                        </Col>
+                                    </Row>
+                                </>
+                            ) : null
+                        }
+                    </Form>
+                </div>
+            </Modal>
+        </PageContainer>
+    );
+};
+
+export default personnelRequirementAnalysis;
\ No newline at end of file

--
Gitblit v1.9.1