封闭区域企业端
parent
42867900d1
commit
8c18350396
|
|
@ -34,7 +34,7 @@
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-signature-canvas": "^1.1.0-alpha.2",
|
"react-signature-canvas": "^1.1.0-alpha.2",
|
||||||
"zy-react-library": "^1.1.42"
|
"zy-react-library": "^1.1.45"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^5.4.1",
|
"@antfu/eslint-config": "^5.4.1",
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
- `/primeport/container/enterprise/enclosedArea/apply/personnelRecords/list` 封闭区域申请/人员封闭区域申请记录
|
- `/primeport/container/enterprise/enclosedArea/apply/personnelRecords/list` 封闭区域申请/人员封闭区域申请记录
|
||||||
- `/primeport/container/enterprise/enclosedArea/apply/vehicleRecords/list` 封闭区域申请/车辆封闭区域申请记录
|
- `/primeport/container/enterprise/enclosedArea/apply/vehicleRecords/list` 封闭区域申请/车辆封闭区域申请记录
|
||||||
- `/primeport/container/enterprise/enclosedArea/personnelAndVehicleStatistics/list` 区域人员及车辆统计
|
- `/primeport/container/enterprise/enclosedArea/personnelAndVehicleStatistics/list` 区域人员及车辆统计
|
||||||
|
- `/primeport/container/enterprise/enclosedArea/enterprisePersonnelPermissions/list` 企业人员权限
|
||||||
|
|
||||||
|
|
||||||
### 相关方端
|
### 相关方端
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { declareRequest } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
||||||
|
export const enterprisePersonnelPermissionsList = declareRequest(
|
||||||
|
"enterprisePersonnelPermissionsLoading",
|
||||||
|
`Post > @/primeport/`,
|
||||||
|
);
|
||||||
|
export const enterprisePersonnelPermissionsPersonnelRecordsList = declareRequest(
|
||||||
|
"enterprisePersonnelPermissionsLoading",
|
||||||
|
`Post > @/primeport/`,
|
||||||
|
);
|
||||||
|
export const enterprisePersonnelPermissionsInfo = declareRequest(
|
||||||
|
"enterprisePersonnelPermissionsLoading",
|
||||||
|
`Post > @/primeport/`,
|
||||||
|
);
|
||||||
|
export const enterprisePersonnelPermissionsSave = declareRequest(
|
||||||
|
"enterprisePersonnelPermissionsLoading",
|
||||||
|
`Post > @/primeport/`,
|
||||||
|
);
|
||||||
|
|
@ -28,3 +28,4 @@ export const NS_ENCLOSED_AREA = defineNamespace("enclosedArea");
|
||||||
export const NS_ENCLOSED_AREA_PERSONNEL_APPLY = defineNamespace("enclosedAreaPersonnelApply");
|
export const NS_ENCLOSED_AREA_PERSONNEL_APPLY = defineNamespace("enclosedAreaPersonnelApply");
|
||||||
export const NS_ENCLOSED_AREA_VEHICLE_APPLY = defineNamespace("enclosedAreaVehicleApply");
|
export const NS_ENCLOSED_AREA_VEHICLE_APPLY = defineNamespace("enclosedAreaVehicleApply");
|
||||||
export const NS_ENCLOSED_PERSONNEL_AND_VEHICLE_STATISTICS = defineNamespace("enclosedPersonnelAndVehicleStatistics");
|
export const NS_ENCLOSED_PERSONNEL_AND_VEHICLE_STATISTICS = defineNamespace("enclosedPersonnelAndVehicleStatistics");
|
||||||
|
export const NS_ENTERPRISE_PERSONNEL_PERMISSIONS = defineNamespace("enterprisePersonnelPermissions");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,219 @@
|
||||||
|
import useUrlState from "@ahooksjs/use-url-state";
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Button, Form, message, Modal, Space } from "antd";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import FormBuilder from "zy-react-library/components/FormBuilder";
|
||||||
|
import BackIcon from "zy-react-library/components/Icon/BackIcon";
|
||||||
|
import DepartmentLeftTree from "zy-react-library/components/LeftTree/Department/Gwj";
|
||||||
|
import Page from "zy-react-library/components/Page";
|
||||||
|
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 { NS_ENTERPRISE_PERSONNEL_PERMISSIONS } from "~/enumerate/namespace";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
const [authorizationScopeModalVisible, setAuthorizationScopeModalVisible] = useState(false);
|
||||||
|
const [currentInfo, setCurrentInfo] = useState({});
|
||||||
|
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const [urlState, setUrlState] = useUrlState({
|
||||||
|
departmentId: "",
|
||||||
|
backDepartmentIds: [],
|
||||||
|
}, {
|
||||||
|
navigateMode: "replace",
|
||||||
|
parseOptions: {
|
||||||
|
arrayFormat: "index",
|
||||||
|
},
|
||||||
|
stringifyOptions: {
|
||||||
|
arrayFormat: "index",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { tableProps, getData } = useTable(props["enterprisePersonnelPermissionsList"], {
|
||||||
|
form,
|
||||||
|
params: () => ({ departmentId: urlState.departmentId }),
|
||||||
|
manual: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, [urlState.departmentId]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page isShowAllAction={false}>
|
||||||
|
<div style={{ display: "flex", gap: 20 }}>
|
||||||
|
<div style={{ width: 300 }}>
|
||||||
|
<DepartmentLeftTree
|
||||||
|
onGetNodePaths={(event) => {
|
||||||
|
const departmentId = event.at(-1).departmentId;
|
||||||
|
setUrlState({
|
||||||
|
departmentId,
|
||||||
|
backDepartmentIds: [...urlState.backDepartmentIds, urlState.departmentId],
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{
|
||||||
|
backgroundColor: "rgb(241, 241, 242)",
|
||||||
|
width: 10,
|
||||||
|
marginTop: "-20px",
|
||||||
|
marginBottom: "-20px",
|
||||||
|
height: "calc(100vh - 112px)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div style={{ width: "calc(100% - 300px - 50px)" }}>
|
||||||
|
<Search labelCol={{ span: 4 }} options={[{ name: "todo1", label: "姓名" }]} onFinish={getData} form={form} />
|
||||||
|
<Table
|
||||||
|
toolBarRender={() => (
|
||||||
|
<>
|
||||||
|
{
|
||||||
|
urlState.departmentId !== "" && (
|
||||||
|
<Button
|
||||||
|
icon={<BackIcon />}
|
||||||
|
onClick={() => {
|
||||||
|
setUrlState({
|
||||||
|
departmentId: urlState.backDepartmentIds.at(-1),
|
||||||
|
backDepartmentIds: urlState.backDepartmentIds.slice(0, -1),
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
返回
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
columns={[
|
||||||
|
{ title: "部门", dataIndex: "todo1" },
|
||||||
|
{ title: "姓名", dataIndex: "todo2" },
|
||||||
|
{ title: "岗位", dataIndex: "todo3" },
|
||||||
|
{ title: "手机号", dataIndex: "todo4" },
|
||||||
|
{ title: "车辆数", dataIndex: "todo5" },
|
||||||
|
{ title: "封闭区域权限", dataIndex: "todo6", render: (_, record) => record.todo6 === 1 ? "开启" : "关闭" },
|
||||||
|
{ title: "是否录入人脸", dataIndex: "todo7", render: (_, record) => record.todo7 === 1 ? "是" : "否" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
width: 200,
|
||||||
|
fixed: "right",
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setAuthorizationScopeModalVisible(true);
|
||||||
|
setCurrentInfo(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
授权范围
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./personnelRecords?id=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
人员进出记录
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
authorizationScopeModalVisible && (
|
||||||
|
<AuthorizationScopeModal
|
||||||
|
info={currentInfo}
|
||||||
|
onCancel={() => {
|
||||||
|
setAuthorizationScopeModalVisible(false);
|
||||||
|
setCurrentInfo("");
|
||||||
|
}}
|
||||||
|
getData={getData}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const AuthorizationScopeModalComponent = (props) => {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const { data } = await props["enterprisePersonnelPermissionsInfo"]({ id: props.info.id });
|
||||||
|
form.setFieldsValue({ ...data });
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onSubmit = (values) => {
|
||||||
|
const performSave = async () => {
|
||||||
|
const { success } = await props["enterprisePersonnelPermissionsSave"]({
|
||||||
|
...values,
|
||||||
|
id: props.info.id,
|
||||||
|
});
|
||||||
|
if (success) {
|
||||||
|
message.success("操作成功");
|
||||||
|
props.onCancel();
|
||||||
|
props.getData();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (values.todo1 === 2) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: "提示",
|
||||||
|
content: `确定要给【${props.info.todo1}】用户关闭门禁权限吗?`,
|
||||||
|
onOk: performSave,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
performSave();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
open
|
||||||
|
title="授权"
|
||||||
|
maskClosable={false}
|
||||||
|
width={600}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
onOk={form.submit}
|
||||||
|
confirmLoading={props.enterprisePersonnelPermissions.enterprisePersonnelPermissionsLoading}
|
||||||
|
>
|
||||||
|
<FormBuilder
|
||||||
|
span={24}
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
showActionButtons={false}
|
||||||
|
loading={props.enterprisePersonnelPermissions.enterprisePersonnelPermissionsLoading}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "todo1",
|
||||||
|
label: "是否授权",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: [{ bianma: 1, name: "是" }, { bianma: 2, name: "否" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "todo2",
|
||||||
|
label: "封闭区域",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: [],
|
||||||
|
componentProps: { mode: "multiple" },
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AuthorizationScopeModal = Connect([NS_ENTERPRISE_PERSONNEL_PERMISSIONS], true)(AuthorizationScopeModalComponent);
|
||||||
|
|
||||||
|
export default Connect([NS_ENTERPRISE_PERSONNEL_PERMISSIONS], true)(List);
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
import { Form } from "antd";
|
||||||
|
import Page from "zy-react-library/components/Page";
|
||||||
|
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 useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
|
||||||
|
import useTable from "zy-react-library/hooks/useTable";
|
||||||
|
import { getLabelName } from "zy-react-library/utils";
|
||||||
|
import { NS_ENTERPRISE_PERSONNEL_PERMISSIONS } from "~/enumerate/namespace";
|
||||||
|
|
||||||
|
const ENTRY_AND_EXIT_STATUS_ENUM = [
|
||||||
|
{ bianma: "1", name: "进" },
|
||||||
|
{ bianma: "0", name: "出" },
|
||||||
|
];
|
||||||
|
|
||||||
|
function PersonnelRecords(props) {
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const query = useGetUrlQuery();
|
||||||
|
const { tableProps, getData } = useTable(props["enterprisePersonnelPermissionsPersonnelRecordsList"], {
|
||||||
|
form,
|
||||||
|
params: { id: query.id },
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Page headerTitle="人员进出记录">
|
||||||
|
<Search
|
||||||
|
options={[
|
||||||
|
{ name: "todo1", label: "进出港时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "todo2", label: "进出状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: ENTRY_AND_EXIT_STATUS_ENUM },
|
||||||
|
{ name: "todo3", label: "口门名称" },
|
||||||
|
]}
|
||||||
|
onFinish={getData}
|
||||||
|
form={form}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "姓名", dataIndex: "todo1" },
|
||||||
|
{ title: "区域名称", dataIndex: "todo2" },
|
||||||
|
{
|
||||||
|
title: "进出状态",
|
||||||
|
dataIndex: "todo3",
|
||||||
|
render: (_, record) => getLabelName({ list: ENTRY_AND_EXIT_STATUS_ENUM, status: record.todo3 }),
|
||||||
|
},
|
||||||
|
{ title: "进出港时间", dataIndex: "todo4", render: (_, record) => `${record.todo4} - ${record.todo5}` },
|
||||||
|
{ title: "口门名称", dataIndex: "todo6" },
|
||||||
|
{ title: "开门类型", dataIndex: "todo7" },
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_ENTERPRISE_PERSONNEL_PERMISSIONS], true)(PersonnelRecords);
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
function EnterprisePersonnelPermissions(props) {
|
||||||
|
return props.children;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EnterprisePersonnelPermissions;
|
||||||
Loading…
Reference in New Issue