| | |
| | | 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' }, |
| | |
| | | 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, |
| | |
| | | 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" |
| | |
| | | key="button" |
| | | icon={<PlusOutlined />} |
| | | onClick={() => { |
| | | setAddDialogVisible(true); |
| | | setDialogTitle('新建组织战略'); |
| | | setAddDialogVisible({ |
| | | open: true, |
| | | type: "add", |
| | | }); |
| | | setDialogTitle("新建组织战略"); |
| | | }} |
| | | type="primary" |
| | | > |
| | |
| | | ></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> |
| | |
| | | <Form.Item |
| | | label="组织需要实现的目标" |
| | | name="aim" |
| | | rules={[{ required: true, message: '请输入组织需要实现的目标' }]} |
| | | rules={[ |
| | | { required: true, message: "请输入组织需要实现的目标" }, |
| | | ]} |
| | | > |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | label="核心价值观" |
| | | name="coreValue" |
| | | rules={[{ required: true, message: '请输入核心价值观' }]} |
| | | rules={[{ required: true, message: "请输入核心价值观" }]} |
| | | > |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | label="组织的发展方向" |
| | | name="direction" |
| | | rules={[{ required: true, message: '请输入组织的发展方向' }]} |
| | | rules={[{ required: true, message: "请输入组织的发展方向" }]} |
| | | > |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | label="组织的发展计划" |
| | | name="plan" |
| | | rules={[{ required: true, message: '请输入组织的发展计划' }]} |
| | | rules={[{ required: true, message: "请输入组织的发展计划" }]} |
| | | > |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | label="指导方针" |
| | | name="guide" |
| | | rules={[{ required: true, message: '请输入指导方针' }]} |
| | | rules={[{ required: true, message: "请输入指导方针" }]} |
| | | > |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | |
| | | <Form.Item |
| | | label="实施措施" |
| | | name="steps" |
| | | rules={[{ required: true, message: '请输入实施措施' }]} |
| | | rules={[{ required: true, message: "请输入实施措施" }]} |
| | | > |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
New file |
| | |
| | | .title { |
| | | border: 1px solid #fafafa; |
| | | margin: 10px 0; |
| | | padding: 5px 10px; |
| | | } |
| | | |
| | | .addDialog{ |
| | | max-height: 600px; |
| | | overflow-y: auto; |
| | | } |
New file |
| | |
| | | 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> |
| | | |
| | | {/* 根据表格的type来判断是否显示 */} |
| | | { |
| | | 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; |