zhongshujie
2025-08-01 07d1135a1913a919679dc23f0a38b9b61987171f
src/pages/organizationDesign/OrganizationalStructureConfiguration/index.tsx
@@ -3,223 +3,183 @@
import { PageContainer, ProTable } from '@ant-design/pro-components';
import { Button, Col, DatePicker, Form, Input, Modal, Row, Select, Tabs } 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';
const OrganizationalStructureConfiguration: React.FC = () => {
  const [dialogTitle, setDialogTitle] = useState('');
  const [addDialogVisible, setAddDialogVisible] = useState(false);
  const actionRef = useRef(null);
  const { initialState, setInitialState } = useModel('@@initialState');
  const [formRef] = Form.useForm();
  useEffect(() => {
    console.log(initialState);
    formRef.setFieldsValue({
      name: initialState?.appInfo.org?.name,
    })
  }, [])
  const columns = [
    {
      title: '合同编号',
      key: 'code',
      dataIndex: 'code',
      align: 'center',
      search: false,
    },
    {
      title: '合同名称',
      key: 'name',
      dataIndex: 'name',
      align: 'center',
      search: false,
    },
    {
      title: '合同类型',
      key: 'type',
      dataIndex: 'type',
      align: 'center',
      valueEnum: {
        all: { text: '全部' },
        付小小: { text: '付小小' },
        曲丽丽: { text: '曲丽丽' },
        林东东: { text: '林东东' },
        陈帅帅: { text: '陈帅帅' },
        兼某某: { text: '兼某某' },
      },
    },
    {
      title: '签订日期',
      key: 'date1',
      dataIndex: 'date1',
      align: 'center',
      search: false,
    },
    {
      title: '生效日期',
      key: 'date2',
      dataIndex: 'date2',
      align: 'center',
      search: false,
    },
    {
      title: '终止日期',
      key: 'date3',
      dataIndex: 'date3',
      align: 'center',
      search: false,
    },
    {
      title: '状态',
      key: 'status',
      dataIndex: 'status',
      align: 'center',
      search: false,
    },
  ];
  const handleOk = () => {};
  const handleCancel = () => {
    setAddDialogVisible(false);
  };
  const getTableData = (params: { current: number; pageSize: number }) => {
    console.log(params, 'params');
    const body = {
      start: (params.current - 1) * params.pageSize,
      size: params.pageSize,
      filterList: [],
      searchList: [],
    };
    return postOaContractGetContractList(body).then((res) => {
      console.log(res, 'res');
      return {
        data: res.datas,
        total: res.data.totalSize,
      };
    });
  };
  return (
    <PageContainer>
      <Tabs style={{ minHeight: 500 }}>
        <Tabs.TabPane key="1" tab={`我的合同`}>
          <ProTable
            headerTitle="合同管理"
            actionRef={actionRef}
            rowKey="id"
            columns={columns}
            request={getTableData}
            toolBarRender={() => [
              <Button
                key="button"
                icon={<PlusOutlined />}
                onClick={() => {
                  setAddDialogVisible(true);
                  setDialogTitle('新建合同');
                }}
                type="primary"
      <div className={styles.addDialog}>
        <Form form={formRef} layout="vertical" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
          <Row>
            <Col span={12}>
              <Form.Item
                label="组织机构名称"
                name="name"
                rules={[{ required: true, message: '请输入机构名称' }]}
              >
                新建
              </Button>,
            ]}
          />
        </Tabs.TabPane>
        <Tabs.TabPane key="2" tab={`我的合同`}>
          我的合同
        </Tabs.TabPane>
        <Tabs.TabPane key="3" tab={`快到期合同`}>
          快到期合同
        </Tabs.TabPane>
      </Tabs>
      <Modal
        title={dialogTitle}
        width={900}
        onOk={handleOk}
        open={addDialogVisible}
        // 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="员工姓名"
                  name="name"
                  rules={[{ required: true, message: '请输入机构名称' }]}
                >
                  <Input suffix={<UserOutlined className="site-form-item-icon" />} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item
                  label="所属部门"
                  name="name"
                  rules={[{ required: true, message: '请输入机构名称' }]}
                >
                  <Input />
                </Form.Item>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <Form.Item
                  label="合同类型"
                  name="name"
                  rules={[{ required: true, message: '请输入机构名称' }]}
                >
                  <Select
                    defaultValue="lucy"
                    options={[
                      {
                        value: 'jack',
                        label: 'Jack',
                      },
                      {
                        value: 'lucy',
                        label: 'Lucy',
                      },
                      {
                        value: 'disabled',
                        disabled: true,
                        label: 'Disabled',
                      },
                      {
                        value: 'Yiminghe',
                        label: 'yiminghe',
                      },
                    ]}
                  />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="签订日期" name="name">
                  <DatePicker style={{ width: '100%' }} />
                </Form.Item>
              </Col>
            </Row>
            <Row>
              <Col span={12}>
                <Form.Item label="生效日期" name="name">
                  <DatePicker style={{ width: '100%' }} />
                </Form.Item>
              </Col>
              <Col span={12}>
                <Form.Item label="正常终止日期" name="name">
                  <DatePicker style={{ width: '100%' }} />
                </Form.Item>
              </Col>
            </Row>
            <Row>
              <Col span={24}>
                <Form.Item label="关联文件" name="name">
                  <DatePicker style={{ width: '100%' }} />
                </Form.Item>
              </Col>
            </Row>
            <Row>
              <Col span={24}>
                <Form.Item label="备注" name="name">
                  <TextArea rows={4} />
                </Form.Item>
              </Col>
            </Row>
          </Form>
        </div>
      </Modal>
                <Input suffix={<UserOutlined className="site-form-item-icon" />} />
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item
                label="公共部门性质"
                name="name"
                rules={[{ required: true, message: '请输入机构名称' }]}
              >
                <Select
                  defaultValue="lucy"
                  options={[
                    {
                      value: 'jack',
                      label: 'Jack',
                    },
                    {
                      value: 'lucy',
                      label: 'Lucy',
                    },
                    {
                      value: 'disabled',
                      disabled: true,
                      label: 'Disabled',
                    },
                    {
                      value: 'Yiminghe',
                      label: 'yiminghe',
                    },
                  ]}
                />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={12}>
              <Form.Item
                label="所在城市"
                name="city"
                rules={[{ required: true, message: '请输入机构名称' }]}
              >
                <Select
                  defaultValue="lucy"
                  options={[
                    {
                      value: 'jack',
                      label: 'Jack',
                    },
                    {
                      value: 'lucy',
                      label: 'Lucy',
                    },
                    {
                      value: 'disabled',
                      disabled: true,
                      label: 'Disabled',
                    },
                    {
                      value: 'Yiminghe',
                      label: 'yiminghe',
                    },
                  ]}
                />
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label="组织规模" name="name">
                <Select
                  defaultValue="lucy"
                  options={[
                    {
                      value: 'jack',
                      label: 'Jack',
                    },
                    {
                      value: 'lucy',
                      label: 'Lucy',
                    },
                    {
                      value: 'disabled',
                      disabled: true,
                      label: 'Disabled',
                    },
                    {
                      value: 'Yiminghe',
                      label: 'yiminghe',
                    },
                  ]}
                />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={12}>
              <Form.Item label="负责人" name="manager">
                <Input />
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label="联系电话" name="phone">
                <Input />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={12}>
              <Form.Item label="联系地址" name="address">
                <Input />
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label="电子邮箱" name="name">
                <Input />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={12}>
              <Form.Item label="网址" name="webSite">
                <Input />
              </Form.Item>
            </Col>
            <Col span={12}>
              <Form.Item label="上级机关" name="manageOrg">
                <Input />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={24}>
              <Form.Item label="组织职责" name="duty">
                <TextArea rows={4} />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={24}>
              <Form.Item label="组织文化" name="culture">
                <TextArea rows={4} />
              </Form.Item>
            </Col>
          </Row>
          <Row>
            <Col span={24}>
              <Form.Item label="组织核心价值观" name="name">
                <TextArea rows={4} />
              </Form.Item>
            </Col>
          </Row>
        </Form>
      </div>
    </PageContainer>
  );
};