init
parent
704c941658
commit
431600a4f0
|
|
@ -1,4 +1,5 @@
|
|||
import { Button, Form, message, Modal, Space } from "antd";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import TooltipPreviewImg from "zy-react-library/components/TooltipPreviewImg";
|
||||
|
|
@ -30,7 +31,7 @@ function List(props) {
|
|||
/>
|
||||
<Table
|
||||
toolBarRender={() => (
|
||||
<Button type="primary" onClick={() => props.history.push("./add")}>新增</Button>
|
||||
<Button type="primary" icon={<AddIcon />} onClick={() => props.history.push("./add")}>新增</Button>
|
||||
)}
|
||||
columns={[
|
||||
{ title: "证书名称", dataIndex: "name" },
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { Button, Form, message, Modal, Space, Tag } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import BackIcon from "zy-react-library/components/Icon/BackIcon";
|
||||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
|
|
@ -50,13 +52,14 @@ function OrganizationStructure() {
|
|||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
<Button>返回</Button>
|
||||
<Button icon={<BackIcon />}>返回</Button>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
import { Button, Form, message, Modal, Space, Tag } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import BackIcon from "zy-react-library/components/Icon/BackIcon";
|
||||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
|
||||
function Position() {
|
||||
function Post() {
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [form] = Form.useForm();
|
||||
|
|
@ -30,7 +32,7 @@ function Position() {
|
|||
<div style={{ flex: 1 }}>
|
||||
<Search
|
||||
options={[
|
||||
{ name: "name", label: "名称" },
|
||||
{ name: "name", label: "岗位名称" },
|
||||
{
|
||||
name: "name",
|
||||
label: "部门级别",
|
||||
|
|
@ -46,13 +48,14 @@ function Position() {
|
|||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
<Button>返回</Button>
|
||||
<Button icon={<BackIcon />}>返回</Button>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
|
|
@ -151,4 +154,4 @@ function AddModalComponent(props) {
|
|||
}
|
||||
|
||||
const AddModal = AddModalComponent;
|
||||
export default Position;
|
||||
export default Post;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { tools } from "@cqsjjb/jjb-common-lib";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { ID_NUMBER } from "zy-react-library/regular";
|
||||
|
|
@ -27,7 +28,7 @@ function Add() {
|
|||
labelCol={{ span: 6 }}
|
||||
options={[
|
||||
{ name: "roleId", label: "用户角色", render: FORM_ITEM_RENDER_ENUM.SELECT, items: [{ name: "一级部门", id: "1" }] },
|
||||
{ name: "departmentId", label: "所属部门" },
|
||||
{ name: "departmentId", label: "所属部门", render: ({ value, onChange }) => <DepartmentSelectTree value={value} onChange={onChange} /> },
|
||||
{
|
||||
name: "postId",
|
||||
label: "所属岗位",
|
||||
|
|
@ -65,6 +66,7 @@ function Add() {
|
|||
{
|
||||
name: "faceFile",
|
||||
label: "上传人脸照片",
|
||||
required: false,
|
||||
span: 24,
|
||||
render: ({ value, onChange }) => (
|
||||
<Upload
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
import { Button, Form, message, Modal, Space } from "antd";
|
||||
import { useState } from "react";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
|
||||
import ImportIcon from "zy-react-library/components/Icon/ImportIcon";
|
||||
import ImportFile from "zy-react-library/components/ImportFile";
|
||||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import Scheduling from "~/pages/Container/Enterprise/User/components/Scheduling";
|
||||
|
||||
function List(props) {
|
||||
const [importOpen, setImportOpen] = useState(false);
|
||||
const [schedulingOpen, setSchedulingOpen] = useState(false);
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(() => {}, { form });
|
||||
const onDelete = (id) => {
|
||||
|
|
@ -56,27 +56,6 @@ function List(props) {
|
|||
<Search
|
||||
options={[
|
||||
{ name: "name", label: "关键字", tip: "用户名/姓名" },
|
||||
{
|
||||
name: "name",
|
||||
label: "排班",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
label: " ",
|
||||
labelCol: { span: 1 },
|
||||
formItemProps: { colon: false },
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
label: "是否为隐患确认人",
|
||||
labelCol: { span: 8 },
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "是", id: "1" }, { name: "否", id: "0" }],
|
||||
},
|
||||
]}
|
||||
form={form}
|
||||
onFinish={getData}
|
||||
|
|
@ -86,6 +65,7 @@ function List(props) {
|
|||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
props.history.push("./add");
|
||||
}}
|
||||
|
|
@ -94,13 +74,14 @@ function List(props) {
|
|||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<ImportIcon />}
|
||||
onClick={() => {
|
||||
setImportOpen(true);
|
||||
}}
|
||||
>
|
||||
导入
|
||||
</Button>
|
||||
<Button type="primary" onClick={() => onExportExcel()}>导出Excel</Button>
|
||||
<Button type="primary" icon={<ExportIcon />} onClick={() => onExportExcel()}>导出Excel</Button>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
|
|
@ -108,21 +89,12 @@ function List(props) {
|
|||
{ title: "姓名", dataIndex: "name" },
|
||||
{ title: "部门", dataIndex: "name" },
|
||||
{ title: "岗位", dataIndex: "name" },
|
||||
{ title: "排班类型", dataIndex: "name" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 300,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => onResetPassword(record.id)}>重置密码</Button>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
setSchedulingOpen(true);
|
||||
}}
|
||||
>
|
||||
排班表
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
|
|
@ -147,7 +119,6 @@ function List(props) {
|
|||
onConfirm={onImportFileConfirm}
|
||||
onCancel={() => { setImportOpen(false); }}
|
||||
/>
|
||||
<Scheduling open={schedulingOpen} onCancel={() => setSchedulingOpen(false)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,122 +0,0 @@
|
|||
import { DoubleLeftOutlined, DoubleRightOutlined, LeftOutlined, RightOutlined } from "@ant-design/icons";
|
||||
import { Button, Calendar, Modal } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
function Scheduling(props) {
|
||||
const [workDateList, setWorkDateList] = useState([]);
|
||||
useEffect(() => {
|
||||
setWorkDateList([
|
||||
{ DATE: "2025-10-01", STATE: "2" },
|
||||
{ DATE: "2025-10-02", STATE: "1" },
|
||||
{ DATE: "2025-10-03", STATE: "1" },
|
||||
{ DATE: "2025-10-04", STATE: "2" },
|
||||
{ DATE: "2025-10-05", STATE: "1" },
|
||||
{ DATE: "2025-10-06", STATE: "1" },
|
||||
{ DATE: "2025-10-07", STATE: "2" },
|
||||
{ DATE: "2025-10-08", STATE: "1" },
|
||||
{ DATE: "2025-10-09", STATE: "1" },
|
||||
{ DATE: "2025-10-10", STATE: "2" },
|
||||
{ DATE: "2025-10-11", STATE: "1" },
|
||||
{ DATE: "2025-10-12", STATE: "1" },
|
||||
{ DATE: "2025-10-13", STATE: "2" },
|
||||
{ DATE: "2025-10-14", STATE: "1" },
|
||||
{ DATE: "2025-10-15", STATE: "1" },
|
||||
{ DATE: "2025-10-16", STATE: "2" },
|
||||
{ DATE: "2025-10-17", STATE: "1" },
|
||||
{ DATE: "2025-10-18", STATE: "1" },
|
||||
{ DATE: "2025-10-19", STATE: "2" },
|
||||
{ DATE: "2025-10-20", STATE: "1" },
|
||||
{ DATE: "2025-10-21", STATE: "1" },
|
||||
{ DATE: "2025-10-22", STATE: "2" },
|
||||
{ DATE: "2025-10-23", STATE: "1" },
|
||||
{ DATE: "2025-10-24", STATE: "1" },
|
||||
{ DATE: "2025-10-25", STATE: "2" },
|
||||
{ DATE: "2025-10-26", STATE: "1" },
|
||||
{ DATE: "2025-10-27", STATE: "1" },
|
||||
{ DATE: "2025-10-28", STATE: "2" },
|
||||
{ DATE: "2025-10-29", STATE: "1" },
|
||||
{ DATE: "2025-10-30", STATE: "1" },
|
||||
{ DATE: "2025-10-31", STATE: "2" },
|
||||
]);
|
||||
}, []);
|
||||
const cellRender = (current) => {
|
||||
return (
|
||||
workDateList.map((item) => {
|
||||
if (item.DATE === dayjs(current).format("YYYY-MM-DD")) {
|
||||
return (
|
||||
<span key={item.DATE}>
|
||||
{item.STATE === "1"
|
||||
? <span style={{ color: "#0bb20c" }}>上班</span>
|
||||
: item.STATE === "2"
|
||||
? <span style={{ color: "red" }}>休班</span>
|
||||
: null}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
);
|
||||
};
|
||||
const headerRender = ({ value, onChange }) => {
|
||||
const year = value.year();
|
||||
const month = value.month() + 1;
|
||||
|
||||
const onNextYear = () => {
|
||||
const nextValue = value.add(1, "year");
|
||||
onChange(nextValue);
|
||||
};
|
||||
|
||||
const onPrevYear = () => {
|
||||
const prevValue = value.subtract(1, "year");
|
||||
onChange(prevValue);
|
||||
};
|
||||
|
||||
const onNextMonth = () => {
|
||||
const nextValue = value.add(1, "month");
|
||||
onChange(nextValue);
|
||||
};
|
||||
|
||||
const onPrevMonth = () => {
|
||||
const prevValue = value.subtract(1, "month");
|
||||
onChange(prevValue);
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", padding: "10px 0" }}>
|
||||
<div>
|
||||
<Button onClick={onPrevYear} icon={<DoubleLeftOutlined style={{ fontSize: 12 }} />} iconPosition="start">前一年</Button>
|
||||
<Button onClick={onPrevMonth} style={{ marginLeft: 8 }} icon={<LeftOutlined style={{ fontSize: 12 }} />} iconPosition="start">前一月</Button>
|
||||
</div>
|
||||
<div style={{ fontSize: "16px", fontWeight: "bold" }}>
|
||||
{year}
|
||||
年
|
||||
{month}
|
||||
月
|
||||
</div>
|
||||
<div>
|
||||
<Button onClick={onNextMonth} icon={<RightOutlined style={{ fontSize: 12 }} />} iconPosition="end">后一月</Button>
|
||||
<Button onClick={onNextYear} style={{ marginLeft: 8 }} icon={<DoubleRightOutlined style={{ fontSize: 12 }} />} iconPosition="end">后一年</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={props.open}
|
||||
onCancel={props.onCancel}
|
||||
title="排班表"
|
||||
width={800}
|
||||
footer={[
|
||||
<Button key="cancel" onClick={props.onCancel}>
|
||||
关闭
|
||||
</Button>,
|
||||
]}
|
||||
>
|
||||
<Calendar cellRender={cellRender} headerRender={headerRender} />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default Scheduling;
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
import { Button, Form, message, Modal, Space, Tag } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import BackIcon from "zy-react-library/components/Icon/BackIcon";
|
||||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
|
||||
function Department() {
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(() => {
|
||||
}, { form });
|
||||
const onDelete = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定删除吗?",
|
||||
onOk: () => {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
},
|
||||
});
|
||||
};
|
||||
return (
|
||||
<div style={{ padding: 20 }}>
|
||||
<div style={{ display: "flex", gap: 20 }}>
|
||||
<LeftTree />
|
||||
<div style={{ flex: 1 }}>
|
||||
<Search
|
||||
options={[
|
||||
{ name: "name", label: "部门名称" },
|
||||
{
|
||||
name: "name",
|
||||
label: "部门级别",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
]}
|
||||
form={form}
|
||||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
<Button icon={<BackIcon />}>返回</Button>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
{ title: "部门名称", dataIndex: "name" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
setCurrentId(record.id);
|
||||
}}
|
||||
>
|
||||
修改
|
||||
</Button>
|
||||
<Button type="link" danger onClick={() => onDelete(record.id)}>删除</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
{...tableProps}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<AddModal
|
||||
currentId={currentId}
|
||||
open={addModalOpen}
|
||||
onCancel={() => {
|
||||
setAddModalOpen(false);
|
||||
setCurrentId("");
|
||||
}}
|
||||
getData={getData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AddModalComponent(props) {
|
||||
const [form] = Form.useForm();
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
console.log(props.currentId);
|
||||
}
|
||||
}, [props.currentId]);
|
||||
const onCancel = () => {
|
||||
form.resetFields();
|
||||
props.onCancel();
|
||||
};
|
||||
const onSubmit = async (values) => {
|
||||
console.log(values);
|
||||
onCancel();
|
||||
props.getData();
|
||||
};
|
||||
return (
|
||||
<Modal
|
||||
open={props.open}
|
||||
onCancel={onCancel}
|
||||
onOk={form.submit}
|
||||
title={props.currentId ? "修改" : "新增"}
|
||||
width={800}
|
||||
>
|
||||
<FormBuilder
|
||||
values={{
|
||||
regDepartment: "2",
|
||||
}}
|
||||
form={form}
|
||||
span={24}
|
||||
labelCol={{ span: 10 }}
|
||||
onFinish={onSubmit}
|
||||
showActionButtons={false}
|
||||
options={[
|
||||
{ name: "parentName", label: "上级部门", render: () => (<Tag color="processing">111</Tag>) },
|
||||
{ name: "department", label: "部门名称" },
|
||||
{ name: "level", label: "部门级别", required: false, render: FORM_ITEM_RENDER_ENUM.SELECT, items: [{ id: "1", name: "一级部门" }] },
|
||||
{ name: "sort", label: "部门排序", render: FORM_ITEM_RENDER_ENUM.NUMBER },
|
||||
{
|
||||
name: "regDepartment",
|
||||
label: "是否安全管理部门",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||
items: [{ id: "1", name: "是" }, { id: "2", name: "否" }],
|
||||
},
|
||||
{ name: "bz", label: "备注", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
]}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
const AddModal = AddModalComponent;
|
||||
export default Department;
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
import { Button, Form, message, Modal, Space, Tag } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import BackIcon from "zy-react-library/components/Icon/BackIcon";
|
||||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
|
||||
function Post() {
|
||||
const [addModalOpen, setAddModalOpen] = useState(false);
|
||||
const [currentId, setCurrentId] = useState("");
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(() => {
|
||||
}, { form });
|
||||
const onDelete = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定删除吗?",
|
||||
onOk: () => {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
},
|
||||
});
|
||||
};
|
||||
return (
|
||||
<div style={{ padding: 20 }}>
|
||||
<div style={{ display: "flex", gap: 20 }}>
|
||||
<LeftTree />
|
||||
<div style={{ flex: 1 }}>
|
||||
<Search
|
||||
options={[
|
||||
{ name: "name", label: "岗位名称" },
|
||||
]}
|
||||
form={form}
|
||||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
<Button icon={<BackIcon />}>返回</Button>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
{ title: "所属部门", dataIndex: "name" },
|
||||
{ title: "岗位名称", dataIndex: "name" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
setAddModalOpen(true);
|
||||
setCurrentId(record.id);
|
||||
}}
|
||||
>
|
||||
修改
|
||||
</Button>
|
||||
<Button type="link" danger onClick={() => onDelete(record.id)}>删除</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
{...tableProps}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<AddModal
|
||||
currentId={currentId}
|
||||
open={addModalOpen}
|
||||
onCancel={() => {
|
||||
setAddModalOpen(false);
|
||||
setCurrentId("");
|
||||
}}
|
||||
getData={getData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AddModalComponent(props) {
|
||||
const [form] = Form.useForm();
|
||||
useEffect(() => {
|
||||
if (props.currentId) {
|
||||
console.log(props.currentId);
|
||||
}
|
||||
}, [props.currentId]);
|
||||
const onCancel = () => {
|
||||
form.resetFields();
|
||||
props.onCancel();
|
||||
};
|
||||
const onSubmit = async (values) => {
|
||||
console.log(values);
|
||||
onCancel();
|
||||
props.getData();
|
||||
};
|
||||
return (
|
||||
<Modal
|
||||
open={props.open}
|
||||
onCancel={onCancel}
|
||||
onOk={form.submit}
|
||||
title={props.currentId ? "修改" : "新增"}
|
||||
width={800}
|
||||
>
|
||||
<FormBuilder
|
||||
values={{
|
||||
regPost: "2",
|
||||
}}
|
||||
form={form}
|
||||
span={24}
|
||||
labelCol={{ span: 10 }}
|
||||
onFinish={onSubmit}
|
||||
showActionButtons={false}
|
||||
options={[
|
||||
{ name: "parentName", label: "所属部门", render: () => (<Tag color="processing">111</Tag>) },
|
||||
{ name: "department", label: "岗位名称" },
|
||||
{
|
||||
name: "regPost",
|
||||
label: "是否监管岗位",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||
items: [{ id: "1", name: "是" }, { id: "2", name: "否" }],
|
||||
},
|
||||
{ name: "permission", label: "数据权限", required: false, dependencies: ["regPost"], hidden: formValues => !(formValues.regPost === "1") },
|
||||
{ name: "bz", label: "岗位职责", required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
]}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
const AddModal = AddModalComponent;
|
||||
export default Post;
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
import { tools } from "@cqsjjb/jjb-common-lib";
|
||||
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||
import HeaderBack from "zy-react-library/components/HeaderBack";
|
||||
import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj";
|
||||
import Upload from "zy-react-library/components/Upload";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import { ID_NUMBER, PHONE } from "zy-react-library/regular";
|
||||
|
||||
const { query } = tools.router;
|
||||
const WHETHER_ENUM = [
|
||||
{ id: "1", name: "是" },
|
||||
{ id: "0", name: "否" },
|
||||
];
|
||||
|
||||
function Add() {
|
||||
const onSubmit = (values) => {
|
||||
console.log(values);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<HeaderBack title={query.id ? "修改" : "新增"} />
|
||||
<div style={{ paddingBottom: 10 }}>
|
||||
<FormBuilder
|
||||
values={{
|
||||
isHeadOfDepartment: "0",
|
||||
isDeputyInCharge: "0",
|
||||
}}
|
||||
onFinish={onSubmit}
|
||||
labelCol={{ span: 6 }}
|
||||
options={[
|
||||
{ name: "roleId", label: "用户角色", required: false, render: FORM_ITEM_RENDER_ENUM.SELECT, items: [{ name: "一级部门", id: "1" }] },
|
||||
{ name: "departmentId", label: "所属部门", render: ({ value, onChange }) => <DepartmentSelectTree value={value} onChange={onChange} /> },
|
||||
{
|
||||
name: "postId",
|
||||
label: "所属岗位",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
{ name: "username", label: "用户名", tip: "* 如果修改手机号,登录密码则会变成初始密码“Aa@123456789”" },
|
||||
{ name: "name", label: "姓名" },
|
||||
{ name: "phone", label: "手机号", rules: [{ pattern: PHONE, message: "请输入正确的手机号" }] },
|
||||
{
|
||||
name: "personType",
|
||||
label: "人员类型",
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
{
|
||||
name: "userIdCard",
|
||||
label: "身份证号",
|
||||
required: false,
|
||||
rules: [{ pattern: ID_NUMBER, message: "请输入正确的身份证号" }],
|
||||
},
|
||||
{
|
||||
name: "nation",
|
||||
label: "民族",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
{
|
||||
name: "sex",
|
||||
label: "性别",
|
||||
required: false,
|
||||
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||
items: [{ name: "一级部门", id: "1" }],
|
||||
},
|
||||
{
|
||||
name: "faceFile",
|
||||
label: "上传人脸照片",
|
||||
required: false,
|
||||
span: 24,
|
||||
render: ({ value, onChange }) => (
|
||||
<Upload
|
||||
size={4}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
tipContent={(
|
||||
<div style={{ lineHeight: 1.6, color: "red", fontSize: 12 }}>
|
||||
<div>* 图像格式:JPG、JPEG、PNG</div>
|
||||
<div>* 图像大小:不超过4M。</div>
|
||||
<div>* 照片大小: 推荐 500*500</div>
|
||||
<div>* 人脸无遮挡(如戴帽子、口罩、眼镜等)、无修图</div>
|
||||
<div>* 人脸需双眼睁开、表情自然、露额,头发不要遮挡</div>
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ name: "sort", label: "部门排序", render: FORM_ITEM_RENDER_ENUM.NUMBER },
|
||||
{ name: "level", label: "部门级别", required: false, render: FORM_ITEM_RENDER_ENUM.SELECT, items: [{ name: "一级部门", id: "1" }] },
|
||||
{ name: "email", label: "邮箱", required: false, rules: [{ type: "email", message: "请输入正确的邮箱" }] },
|
||||
{ name: "isHeadOfDepartment", label: "是否为部门负责人", required: false, render: FORM_ITEM_RENDER_ENUM.RADIO, items: WHETHER_ENUM },
|
||||
{ name: "isDeputyInCharge", label: "是否为分管领导", required: false, render: FORM_ITEM_RENDER_ENUM.RADIO, items: WHETHER_ENUM },
|
||||
{ name: "bz", label: "备注", span: 24, required: false, render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Add;
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
import { Button, Form, message, Modal, Space } from "antd";
|
||||
import { useState } from "react";
|
||||
import AddIcon from "zy-react-library/components/Icon/AddIcon";
|
||||
import ExportIcon from "zy-react-library/components/Icon/ExportIcon";
|
||||
import ImportIcon from "zy-react-library/components/Icon/ImportIcon";
|
||||
import ImportFile from "zy-react-library/components/ImportFile";
|
||||
import LeftTree from "zy-react-library/components/LeftTree/Department/Gwj/index";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
|
||||
function List(props) {
|
||||
const [importOpen, setImportOpen] = useState(false);
|
||||
const [form] = Form.useForm();
|
||||
const { tableProps, getData } = useTable(() => {}, { form });
|
||||
const onDelete = (id) => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定删除吗?",
|
||||
onOk: () => {
|
||||
message.success("删除成功");
|
||||
getData();
|
||||
},
|
||||
});
|
||||
};
|
||||
const onExportExcel = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要导出到excel吗?",
|
||||
onOk: () => {
|
||||
|
||||
},
|
||||
});
|
||||
};
|
||||
const onResetPassword = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要重置密码为Aa@123456789吗?",
|
||||
onOk: () => {
|
||||
message.success("重置密码成功");
|
||||
},
|
||||
});
|
||||
};
|
||||
const onUnlock = (id) => {
|
||||
message.success("解锁成功");
|
||||
};
|
||||
const onImportFileConfirm = (values) => {
|
||||
console.log(values);
|
||||
message.success("导入成功");
|
||||
};
|
||||
return (
|
||||
<div style={{ padding: 20 }}>
|
||||
<div style={{ display: "flex", gap: 20 }}>
|
||||
<LeftTree />
|
||||
<div style={{ flex: 1 }}>
|
||||
<Search
|
||||
options={[
|
||||
{ name: "name", label: "关键字", tip: "用户名/姓名" },
|
||||
]}
|
||||
form={form}
|
||||
onFinish={getData}
|
||||
/>
|
||||
<Table
|
||||
toolBarRender={() => (
|
||||
<>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<AddIcon />}
|
||||
onClick={() => {
|
||||
props.history.push("./add");
|
||||
}}
|
||||
>
|
||||
新增
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<ImportIcon />}
|
||||
onClick={() => {
|
||||
setImportOpen(true);
|
||||
}}
|
||||
>
|
||||
导入
|
||||
</Button>
|
||||
<Button type="primary" icon={<ExportIcon />} onClick={() => onExportExcel()}>导出Excel</Button>
|
||||
</>
|
||||
)}
|
||||
columns={[
|
||||
{ title: "用户名", dataIndex: "name" },
|
||||
{ title: "姓名", dataIndex: "name" },
|
||||
{ title: "部门", dataIndex: "name" },
|
||||
{ title: "岗位", dataIndex: "name" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 300,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
<Button type="link" onClick={() => onResetPassword(record.id)}>重置密码</Button>
|
||||
<Button
|
||||
type="link"
|
||||
onClick={() => {
|
||||
props.history.push(`./add?id=${record.id}`);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button type="link" onClick={() => onUnlock(record.id)}>解锁</Button>
|
||||
<Button type="link" danger onClick={() => onDelete(record.id)}>删除</Button>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
]}
|
||||
{...tableProps}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<ImportFile
|
||||
visible={importOpen}
|
||||
templateUrl=""
|
||||
onConfirm={onImportFileConfirm}
|
||||
onCancel={() => { setImportOpen(false); }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default List;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
function User(props) {
|
||||
return (
|
||||
<div>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default User;
|
||||
Loading…
Reference in New Issue