| | |
| | | import { postOaContractGetContractList } from '@/services/WebApi/contract'; |
| | | import { PlusOutlined } from '@ant-design/icons'; |
| | | import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons'; |
| | | import { PageContainer, ProTable } from '@ant-design/pro-components'; |
| | | import { Button, Col, Form, Input, Modal, Row, Select, Space } from 'antd'; |
| | | import { Button, Col, Form, Input, message, Modal, Row, Select, Space } from 'antd'; |
| | | import TextArea from 'antd/es/input/TextArea'; |
| | | import React, { useRef, useState } from 'react'; |
| | | import React, { useEffect, useRef, useState } from 'react'; |
| | | import styles from './index.less'; |
| | | import { postOaJobPositionDelJobPosition, postOaJobPositionGetJobPositionList, postOaJobPositionNewJobPosition, postOaJobPositionUpdateJobPosition } from '@/services/WebApi/oaJobPosition'; |
| | | import { useModel } from '@umijs/max'; |
| | | import modal from 'antd/es/modal'; |
| | | |
| | | const DepartmentalInformationConfiguration: React.FC = () => { |
| | | const postInformationConfiguration: React.FC = () => { |
| | | const { initialState, setInitialState } = useModel('@@initialState'); |
| | | |
| | | const [dialogTitle, setDialogTitle] = useState(''); |
| | | const [addDialogVisible, setAddDialogVisible] = useState(false); |
| | | const [currentEditJob, setCurrentEditJob] = useState(null); |
| | | |
| | | const actionRef = useRef(null); |
| | | const [formRef] = Form.useForm(); |
| | | |
| | | |
| | | useEffect(() => { |
| | | if (!addDialogVisible) { |
| | | formRef.resetFields(); |
| | | } |
| | | }, [addDialogVisible]) |
| | | |
| | | const columns = [ |
| | | { |
| | | title: '岗位名称', |
| | | key: 'code', |
| | | dataIndex: 'code', |
| | | key: 'name', |
| | | dataIndex: 'name', |
| | | align: 'center', |
| | | search: false, |
| | | }, |
| | | { |
| | | title: '岗位职责', |
| | | key: 'name', |
| | | dataIndex: 'name', |
| | | key: 'duty', |
| | | dataIndex: 'duty', |
| | | align: 'center', |
| | | search: false, |
| | | }, |
| | |
| | | search: false, |
| | | render: (_, rowData) => ( |
| | | <Space size="middle"> |
| | | <a onClick={() => {}} style={{ cursor: 'pointer', margin: ' 0 5px' }}> |
| | | <a onClick={() => { |
| | | formRef.setFieldsValue(rowData); |
| | | setDialogTitle('编辑岗位'); |
| | | setCurrentEditJob(rowData); |
| | | setAddDialogVisible(true); |
| | | }} style={{ cursor: 'pointer', margin: ' 0 5px' }}> |
| | | 编辑 |
| | | </a> |
| | | <a onClick={() => { |
| | | handleDelete(rowData.id) |
| | | }} style={{ cursor: 'pointer', margin: ' 0 5px', color: 'red' }}> 删除</a> |
| | | </Space> |
| | | ), |
| | | }, |
| | | ]; |
| | | const handleOk = () => {}; |
| | | |
| | | |
| | | const handleDelete = (id) => { |
| | | modal.confirm({ |
| | | title: '删除', |
| | | icon: <ExclamationCircleOutlined />, |
| | | content: '是否删除该岗位?', |
| | | okText: '确认', |
| | | cancelText: '取消', |
| | | onOk: () => { |
| | | postOaJobPositionDelJobPosition({ ids: [id] }).then((res) => { |
| | | message.success('删除成功'); |
| | | actionRef.current?.reload(); |
| | | }) |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const handleOk = () => { |
| | | formRef.validateFields().then((values) => { |
| | | const body = { |
| | | ...values, |
| | | orgId: initialState?.appInfo?.org?.id, |
| | | }; |
| | | |
| | | if (dialogTitle === '新建岗位') { |
| | | postOaJobPositionNewJobPosition(body).then((res) => { |
| | | console.log(res, 'res'); |
| | | actionRef.current?.reload(); |
| | | setAddDialogVisible(false); |
| | | message.success('添加成功'); |
| | | }) |
| | | } else { |
| | | body.id = currentEditJob.id |
| | | postOaJobPositionUpdateJobPosition(body).then((res) => { |
| | | actionRef.current?.reload(); |
| | | setAddDialogVisible(false); |
| | | message.success('编辑成功'); |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | |
| | | }; |
| | | const handleCancel = () => { |
| | | setAddDialogVisible(false); |
| | | }; |
| | |
| | | size: params.pageSize, |
| | | filterList: [], |
| | | searchList: [], |
| | | orgId: initialState?.appInfo?.org?.id, |
| | | }; |
| | | return postOaContractGetContractList(body).then((res) => { |
| | | return postOaJobPositionGetJobPositionList(body).then((res) => { |
| | | console.log(res, 'res'); |
| | | return { |
| | | data: res.datas, |
| | | total: res.data.totalSize, |
| | | total: res.totalSize, |
| | | }; |
| | | }); |
| | | }; |
| | |
| | | icon={<PlusOutlined />} |
| | | onClick={() => { |
| | | setAddDialogVisible(true); |
| | | setDialogTitle('新建合同'); |
| | | setDialogTitle('新建岗位'); |
| | | }} |
| | | type="primary" |
| | | > |
| | |
| | | |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label="岗位职责" name="name"> |
| | | <Form.Item label="岗位职责" name="duty"> |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label="工作内容" name="name"> |
| | | <Form.Item label="工作内容" name="description"> |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | ); |
| | | }; |
| | | |
| | | export default DepartmentalInformationConfiguration; |
| | | export default postInformationConfiguration; |