| | |
| | | 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 { useModel } from '@umijs/max'; |
| | | import { postOaJobLevelDelJobLevel, postOaJobLevelGetJobLevelList, postOaJobLevelNewJobLevel, postOaJobLevelUpdateJobLevel } from '@/services/WebApi/oaJobLevel'; |
| | | import { postOaJobGetJobList } from '@/services/WebApi/oaJob'; |
| | | import modal from 'antd/es/modal'; |
| | | import { postOaDepartmentDelDepartment } from '@/services/WebApi/oaDepartment'; |
| | | |
| | | const DepartmentalInformationConfiguration: React.FC = () => { |
| | | const jobLevelInformationConfiguration: React.FC = () => { |
| | | const { initialState, setInitialState } = useModel('@@initialState'); |
| | | |
| | | const [dialogTitle, setDialogTitle] = useState(''); |
| | | const [addDialogVisible, setAddDialogVisible] = useState(false); |
| | | |
| | | const [currentEditJob, setCurrentEditJob] = useState(null); |
| | | const [jobSelectOptions, setJobSelectOptions] = useState([]); |
| | | const actionRef = useRef(null); |
| | | const [formRef] = Form.useForm(); |
| | | |
| | |
| | | }, |
| | | { |
| | | title: '工资额', |
| | | key: 'name', |
| | | dataIndex: 'name', |
| | | key: 'salary', |
| | | dataIndex: 'salary', |
| | | 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 = () => {}; |
| | | |
| | | useEffect(() => { |
| | | getJobSelectOptions(); |
| | | }, []) |
| | | useEffect(() => { |
| | | if (!addDialogVisible) { |
| | | formRef.resetFields(); |
| | | } |
| | | }, [addDialogVisible]) |
| | | |
| | | |
| | | const handleDelete = (id) => { |
| | | modal.confirm({ |
| | | title: '删除', |
| | | icon: <ExclamationCircleOutlined />, |
| | | content: '是否删除该职级?', |
| | | okText: '确认', |
| | | cancelText: '取消', |
| | | onOk: () => { |
| | | postOaJobLevelDelJobLevel({ ids: [id] }).then((res) => { |
| | | message.success('删除成功'); |
| | | actionRef.current?.reload(); |
| | | }) |
| | | }, |
| | | }); |
| | | } |
| | | |
| | | const getJobSelectOptions = () => { |
| | | const body = { |
| | | start: 0, |
| | | size: 99, |
| | | filterList: [], |
| | | searchList: [], |
| | | orgId: initialState?.appInfo?.org?.id, |
| | | }; |
| | | postOaJobGetJobList(body).then((res) => { |
| | | console.log(res, 'res'); |
| | | const options = res.datas.map((item) => { |
| | | return { |
| | | ...item, |
| | | label: item.name, |
| | | value: item.id, |
| | | } |
| | | }) |
| | | console.log(options, 'res'); |
| | | |
| | | setJobSelectOptions(options) |
| | | }); |
| | | } |
| | | |
| | | |
| | | const handleOk = () => { |
| | | formRef.validateFields().then((values) => { |
| | | const body = { |
| | | ...values, |
| | | orgId: initialState?.appInfo?.org?.id, |
| | | }; |
| | | |
| | | if (dialogTitle === '新建职级') { |
| | | postOaJobLevelNewJobLevel(body).then((res) => { |
| | | console.log(res, 'res'); |
| | | actionRef.current?.reload(); |
| | | setAddDialogVisible(false); |
| | | message.success('添加成功'); |
| | | }) |
| | | } else { |
| | | body.id = currentEditJob.id |
| | | postOaJobLevelUpdateJobLevel(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 postOaJobLevelGetJobLevelList(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" |
| | | > |
| | |
| | | <Form form={formRef} layout="vertical" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}> |
| | | <Row> |
| | | <Col span={12}> |
| | | <Form.Item label="职级编号" name="name"> |
| | | <Form.Item label="职级编号" name="code"> |
| | | <Input /> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="工资额" name="name"> |
| | | <Form.Item label="工资额" name="salary"> |
| | | <Input /> |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label="所属单位" name="name"> |
| | | <Form.Item label="所属职位" name="jobId"> |
| | | <Select |
| | | defaultValue="lucy" |
| | | options={[ |
| | | { |
| | | value: 'jack', |
| | | label: 'Jack', |
| | | }, |
| | | { |
| | | value: 'lucy', |
| | | label: 'Lucy', |
| | | }, |
| | | { |
| | | value: 'disabled', |
| | | disabled: true, |
| | | label: 'Disabled', |
| | | }, |
| | | { |
| | | value: 'Yiminghe', |
| | | label: 'yiminghe', |
| | | }, |
| | | ]} |
| | | options={jobSelectOptions} |
| | | /> |
| | | </Form.Item> |
| | | </Col> |
| | | |
| | | |
| | | </Row> |
| | | |
| | | <Row> |
| | | <Col span={24}> |
| | | <Form.Item label="备注" name="name"> |
| | | <Form.Item label="备注" name="remarks"> |
| | | <TextArea rows={4} /> |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | ); |
| | | }; |
| | | |
| | | export default DepartmentalInformationConfiguration; |
| | | export default jobLevelInformationConfiguration; |