Commit b8c12fea0641b80f1f1c7df584a5f9c9b741ff0e
1 parent
c7c71872
修改 周期性工作设置,添加验收类型:父级责任人验收/指定角色验收,并对接接口;
Showing
8 changed files
with
632 additions
and
290 deletions
src/components/FeeweeUpload/index.tsx
... | ... | @@ -3,17 +3,17 @@ |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | 4 | * @LastEditTime: 2021-03-11 12:55:38 |
5 | 5 | */ |
6 | -import React from 'react'; | |
7 | -import { message, Upload } from 'antd'; | |
8 | -import { UploadProps } from 'antd/lib/upload'; | |
9 | -import { RcFile, UploadFile } from 'antd/lib/upload/interface'; | |
10 | -import getFidFile from '@/utils/getFidFile'; | |
6 | +import React from "react"; | |
7 | +import { message, Upload } from "antd"; | |
8 | +import { UploadProps } from "antd/lib/upload"; | |
9 | +import { RcFile, UploadFile } from "antd/lib/upload/interface"; | |
10 | +import getFidFile from "@/utils/getFidFile"; | |
11 | 11 | |
12 | 12 | interface Props extends UploadProps { |
13 | - isFid?: boolean // 预览文件 路径是否为 fid 形式 | |
14 | - limitSize?: number // 限制文件大小,单位MB | |
15 | - limitUnit?: 'kb' | 'mb' | 'KB' | 'MB' // 限制大小单位, 默认MB | |
16 | - children?: React.ReactNode | |
13 | + isFid?: boolean; // 预览文件 路径是否为 fid 形式 | |
14 | + limitSize?: number; // 限制文件大小,单位MB | |
15 | + limitUnit?: "kb" | "mb" | "KB" | "MB"; // 限制大小单位, 默认MB | |
16 | + children?: React.ReactNode; | |
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
... | ... | @@ -29,17 +29,23 @@ interface Props extends UploadProps { |
29 | 29 | } |
30 | 30 | * @param {Props} props |
31 | 31 | */ |
32 | -export default function FeeweeUpload({ isFid = false, limitSize = undefined, limitUnit = 'MB', children, ...props }: Props) { | |
32 | +export default function FeeweeUpload({ | |
33 | + isFid = false, | |
34 | + limitSize = undefined, | |
35 | + limitUnit = "MB", | |
36 | + children, | |
37 | + ...props | |
38 | +}: Props) { | |
33 | 39 | const onPreview = (file: UploadFile) => { |
34 | 40 | if (props.onPreview) { |
35 | 41 | props.onPreview(file); |
36 | 42 | return; |
37 | 43 | } |
38 | 44 | getFidFile(file.response.data, isFid); |
39 | - } | |
45 | + }; | |
40 | 46 | |
41 | 47 | const beforeUpload = (file: RcFile, filelist: RcFile[]) => { |
42 | - if (limitSize !== undefined && typeof limitSize === 'number') { | |
48 | + if (limitSize !== undefined && typeof limitSize === "number") { | |
43 | 49 | const limit = isExceededSize(file, limitSize, limitUnit); |
44 | 50 | if (limit.success) { |
45 | 51 | return true; |
... | ... | @@ -50,27 +56,23 @@ export default function FeeweeUpload({ isFid = false, limitSize = undefined, lim |
50 | 56 | * 当表单中使用时,可以在getValueFromEvent回调函数中多添加2行判断函数: |
51 | 57 | * if (e.file.status === 'size_limit') { |
52 | 58 | * return e.fileList.filter((file: any) => file.uid !== e.file.uid); |
53 | - * } | |
54 | - */ | |
55 | - // @ts-ignore | |
56 | - file.status = 'size_limit'; | |
59 | + * } | |
60 | + */ | |
61 | + // @ts-ignore | |
62 | + file.status = "size_limit"; | |
57 | 63 | return false; |
58 | 64 | } |
59 | 65 | } |
60 | 66 | return props.beforeUpload ? props.beforeUpload(file, filelist) : true; |
61 | - } | |
67 | + }; | |
62 | 68 | |
63 | 69 | return ( |
64 | 70 | <> |
65 | - <Upload | |
66 | - {...props} | |
67 | - beforeUpload={beforeUpload} | |
68 | - onPreview={onPreview} | |
69 | - > | |
71 | + <Upload {...props} beforeUpload={beforeUpload} onPreview={onPreview}> | |
70 | 72 | {children} |
71 | 73 | </Upload> |
72 | 74 | </> |
73 | - ) | |
75 | + ); | |
74 | 76 | } |
75 | 77 | |
76 | 78 | /** |
... | ... | @@ -79,11 +81,14 @@ export default function FeeweeUpload({ isFid = false, limitSize = undefined, lim |
79 | 81 | * @param {'kb' | 'mb' | 'KB' | 'MB'} limitUnit |
80 | 82 | * @return {number} |
81 | 83 | */ |
82 | -function getLimitSize(limitSize: number, limitUnit: 'kb' | 'mb' | 'KB' | 'MB'): number { | |
83 | - if (limitUnit === 'kb' || limitUnit === 'KB') { | |
84 | +function getLimitSize( | |
85 | + limitSize: number, | |
86 | + limitUnit: "kb" | "mb" | "KB" | "MB" | |
87 | +): number { | |
88 | + if (limitUnit === "kb" || limitUnit === "KB") { | |
84 | 89 | return limitSize; |
85 | 90 | } |
86 | - if (limitUnit === 'mb' || limitUnit === 'MB') { | |
91 | + if (limitUnit === "mb" || limitUnit === "MB") { | |
87 | 92 | return limitSize * 1024; |
88 | 93 | } |
89 | 94 | return 0; |
... | ... | @@ -96,15 +101,20 @@ function getLimitSize(limitSize: number, limitUnit: 'kb' | 'mb' | 'KB' | 'MB'): |
96 | 101 | * @param {*} limitUnit |
97 | 102 | * @return {{ success: boolean, msg?: string }} |
98 | 103 | */ |
99 | -function isExceededSize(file: RcFile, limitSize: number, limitUnit: 'kb' | 'mb' | 'KB' | 'MB'): { success: boolean, msg?: string } { | |
104 | +function isExceededSize( | |
105 | + file: RcFile, | |
106 | + limitSize: number, | |
107 | + limitUnit: "kb" | "mb" | "KB" | "MB" | |
108 | +): { success: boolean; msg?: string } { | |
100 | 109 | const _limitSize = getLimitSize(limitSize, limitUnit); |
101 | 110 | |
102 | 111 | const fileSizeToKB = file.size / 1024; |
103 | 112 | if (fileSizeToKB <= _limitSize) { |
104 | - | |
105 | 113 | return { success: true }; |
106 | 114 | } else { |
107 | - | |
108 | - return { success: false, msg: `文件【${file.name}】大小不能超过${limitSize}${limitUnit}` }; | |
115 | + return { | |
116 | + success: false, | |
117 | + msg: `文件【${file.name}】大小不能超过${limitSize}${limitUnit}`, | |
118 | + }; | |
109 | 119 | } |
110 | -} | |
111 | 120 | \ No newline at end of file |
121 | +} | ... | ... |
src/pages/office/Work/WorkStandardSetting/components/CreateModal.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-08-11 15:51:56 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2022-03-22 17:56:55 | |
4 | + * @LastEditTime: 2022-05-06 11:16:11 | |
5 | 5 | */ |
6 | 6 | import React, { useState, useEffect, useRef } from "react"; |
7 | 7 | import { |
... | ... | @@ -16,6 +16,7 @@ import { |
16 | 16 | Button, |
17 | 17 | Spin, |
18 | 18 | notification, |
19 | + Radio, | |
19 | 20 | } from "antd"; |
20 | 21 | import { PlusOutlined, WarningOutlined } from "@ant-design/icons"; |
21 | 22 | import { useStore } from "../index"; |
... | ... | @@ -54,6 +55,7 @@ export default function CreateModal() { |
54 | 55 | view, |
55 | 56 | setView, |
56 | 57 | AuthType, |
58 | + ValidType, | |
57 | 59 | } = useStore(); |
58 | 60 | const [form] = Form.useForm(); |
59 | 61 | const [confirmLoading, setConfirmLoading] = useState(false); |
... | ... | @@ -205,7 +207,9 @@ export default function CreateModal() { |
205 | 207 | : undefined, |
206 | 208 | name: item.name, |
207 | 209 | remark: JSON.stringify(item.remarkList), |
208 | - validRoleList: item.validRoleList, | |
210 | + validType: item.validType, | |
211 | + validRoleList: | |
212 | + item.validType === ValidType.父级责任人验收 ? [] : item.validRoleList, | |
209 | 213 | // 将开始时间秒和毫秒置为0 |
210 | 214 | startTime: (item.startTime as Moment) |
211 | 215 | ?.set("second", 0) |
... | ... | @@ -653,17 +657,52 @@ export default function CreateModal() { |
653 | 657 | <Form.Item label="授权" name="auth"> |
654 | 658 | <AuthWork disabled={view} /> |
655 | 659 | </Form.Item> |
656 | - {( | |
657 | - view | |
658 | - ? !currentItem?.validRoleList || | |
659 | - (currentItem.validRoleList && | |
660 | - currentItem.validRoleList.length <= 0) | |
661 | - : currentBreadcrumb.pid | |
662 | - ) ? null : ( | |
663 | - <Form.Item label="验收角色" name="validRoleList"> | |
664 | - <ValidRoleComponent roles={roles} disabled={view} /> | |
665 | - </Form.Item> | |
666 | - )} | |
660 | + <Form.Item | |
661 | + label="验收类型" | |
662 | + name="validType" | |
663 | + rules={[ | |
664 | + { required: !!currentBreadcrumb.pid, message: "请选择验收类型" }, | |
665 | + ]} | |
666 | + > | |
667 | + <Radio.Group disabled={view}> | |
668 | + {currentBreadcrumb.pid ? ( | |
669 | + <Radio key={1} value={1}> | |
670 | + 父级责任人验收 | |
671 | + </Radio> | |
672 | + ) : null} | |
673 | + <Radio key={2} value={2}> | |
674 | + 指定角色验收 | |
675 | + </Radio> | |
676 | + </Radio.Group> | |
677 | + </Form.Item> | |
678 | + <Form.Item | |
679 | + noStyle | |
680 | + shouldUpdate={(pre, cur) => pre.validType !== cur.validType} | |
681 | + > | |
682 | + {({ getFieldValue }) => { | |
683 | + const validType = getFieldValue("validType"); | |
684 | + return ( | |
685 | + view | |
686 | + ? !currentItem?.validRoleList || | |
687 | + (currentItem.validRoleList && | |
688 | + currentItem.validRoleList.length <= 0) | |
689 | + : validType !== ValidType.指定角色验收 | |
690 | + ) ? null : ( | |
691 | + <Form.Item | |
692 | + label="验收角色" | |
693 | + name="validRoleList" | |
694 | + rules={[ | |
695 | + { | |
696 | + required: !!currentBreadcrumb.pid, | |
697 | + message: "请选择验收角色", | |
698 | + }, | |
699 | + ]} | |
700 | + > | |
701 | + <ValidRoleComponent roles={roles} disabled={view} /> | |
702 | + </Form.Item> | |
703 | + ); | |
704 | + }} | |
705 | + </Form.Item> | |
667 | 706 | {currentBreadcrumb.pitem?.ofProbation === false ? null : ( |
668 | 707 | <Form.Item |
669 | 708 | name="ofProbation" | ... | ... |
src/pages/office/Work/WorkStandardSetting/components/SuperiorWorkCard.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-11-11 09:15:18 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2021-12-20 10:28:07 | |
4 | + * @LastEditTime: 2022-05-06 11:08:02 | |
5 | 5 | */ |
6 | -import { Card, Col, Divider, Row } from 'antd'; | |
7 | -import React from 'react'; | |
8 | -import { SearchOutlined } from '@ant-design/icons'; | |
9 | -import { useStore } from '../index'; | |
6 | +import { Card, Col, Divider, Row } from "antd"; | |
7 | +import React from "react"; | |
8 | +import { SearchOutlined } from "@ant-design/icons"; | |
9 | +import { useStore } from "../index"; | |
10 | 10 | |
11 | 11 | export default function SuperiorWorkCard() { |
12 | - const { currentBreadcrumb, RuleType, setModal, setCurrentItem, setView, setVisible } = useStore(); | |
12 | + const { | |
13 | + currentBreadcrumb, | |
14 | + RuleType, | |
15 | + setModal, | |
16 | + setCurrentItem, | |
17 | + setView, | |
18 | + setVisible, | |
19 | + ValidType, | |
20 | + } = useStore(); | |
13 | 21 | |
14 | 22 | return currentBreadcrumb.pitem ? ( |
15 | 23 | <Card style={{ margin: "20px 0" }}> |
16 | 24 | <Row style={{ flexDirection: "column" }}> |
17 | 25 | <Row> |
18 | - <Col style={{ color: '#999' }}>上级工作项:</Col> | |
19 | - <Col style={{ color: '#333' }}> | |
26 | + <Col style={{ color: "#999" }}>上级工作项:</Col> | |
27 | + <Col style={{ color: "#333" }}> | |
20 | 28 | {currentBreadcrumb.pitem.name || "-"} |
21 | 29 | |
22 | - <a onClick={() => { setCurrentItem({ ...currentBreadcrumb.pitem, pid: currentBreadcrumb.pid }); setView(true); setVisible(true); }}>查看全部信息<SearchOutlined /></a> | |
30 | + <a | |
31 | + onClick={() => { | |
32 | + setCurrentItem({ | |
33 | + ...currentBreadcrumb.pitem, | |
34 | + pid: currentBreadcrumb.pid, | |
35 | + }); | |
36 | + setView(true); | |
37 | + setVisible(true); | |
38 | + }} | |
39 | + > | |
40 | + 查看全部信息 | |
41 | + <SearchOutlined /> | |
42 | + </a> | |
23 | 43 | </Col> |
24 | 44 | </Row> |
25 | 45 | <Row> |
... | ... | @@ -27,20 +47,39 @@ export default function SuperiorWorkCard() { |
27 | 47 | <Divider orientation="left">主要信息</Divider> |
28 | 48 | <div style={{ float: "left" }}> |
29 | 49 | <span className="span_limit_1"> |
30 | - <span style={{ color: '#999' }}>工作内容:</span> | |
31 | - <span style={{ color: '#333' }}><a onClick={() => setModal({ visible: true, type: "工作内容", name: currentBreadcrumb.pitem?.name || "", roles: [], remark: currentBreadcrumb.pitem?.remark || "" })}>查看<SearchOutlined /></a></span> | |
50 | + <span style={{ color: "#999" }}>工作内容:</span> | |
51 | + <span style={{ color: "#333" }}> | |
52 | + <a | |
53 | + onClick={() => setModal({ | |
54 | + visible: true, | |
55 | + type: "工作内容", | |
56 | + name: currentBreadcrumb.pitem?.name || "", | |
57 | + roles: [], | |
58 | + remark: currentBreadcrumb.pitem?.remark || "", | |
59 | + })} | |
60 | + > | |
61 | + 查看 | |
62 | + <SearchOutlined /> | |
63 | + </a> | |
64 | + </span> | |
32 | 65 | </span> |
33 | - {currentBreadcrumb.pitem.ruleType === RuleType["按滚动月设置"] || currentBreadcrumb.pitem.ruleType === RuleType["按小时设置"] ? null : ( | |
34 | - <> | |
35 | - <span className="span_limit_1"> | |
36 | - <span style={{ color: '#999' }}>开始时间:</span> | |
37 | - <span style={{ color: '#333' }}>{currentBreadcrumb.pitem.startHourStr || '-'}</span> | |
38 | - </span> | |
39 | - <span className="span_limit_1"> | |
40 | - <span style={{ color: '#999' }}>完成时间:</span> | |
41 | - <span style={{ color: '#333' }}>{currentBreadcrumb.pitem.endHourStr || '-'}</span> | |
42 | - </span> | |
43 | - </> | |
66 | + {currentBreadcrumb.pitem.ruleType === RuleType["按滚动月设置"] || | |
67 | + currentBreadcrumb.pitem.ruleType === | |
68 | + RuleType["按小时设置"] ? null : ( | |
69 | + <> | |
70 | + <span className="span_limit_1"> | |
71 | + <span style={{ color: "#999" }}>开始时间:</span> | |
72 | + <span style={{ color: "#333" }}> | |
73 | + {currentBreadcrumb.pitem.startHourStr || "-"} | |
74 | + </span> | |
75 | + </span> | |
76 | + <span className="span_limit_1"> | |
77 | + <span style={{ color: "#999" }}>完成时间:</span> | |
78 | + <span style={{ color: "#333" }}> | |
79 | + {currentBreadcrumb.pitem.endHourStr || "-"} | |
80 | + </span> | |
81 | + </span> | |
82 | + </> | |
44 | 83 | )} |
45 | 84 | </div> |
46 | 85 | </Col> |
... | ... | @@ -49,27 +88,70 @@ export default function SuperiorWorkCard() { |
49 | 88 | <Divider orientation="left">其他信息</Divider> |
50 | 89 | <div> |
51 | 90 | <span className="span_limit_1"> |
52 | - <span style={{ color: '#999' }}>工作类型:</span> | |
53 | - <span style={{ color: '#333' }}>{currentBreadcrumb.pitem.workTypeName || "-"}</span> | |
91 | + <span style={{ color: "#999" }}>工作类型:</span> | |
92 | + <span style={{ color: "#333" }}> | |
93 | + {currentBreadcrumb.pitem.workTypeName || "-"} | |
94 | + </span> | |
54 | 95 | </span> |
55 | 96 | <span className="span_limit_1"> |
56 | - <span style={{ color: '#999' }}>频率:</span> | |
57 | - <span style={{ color: '#333' }}>{currentBreadcrumb.pitem.ruleDesc || '-'}</span> | |
97 | + <span style={{ color: "#999" }}>频率:</span> | |
98 | + <span style={{ color: "#333" }}> | |
99 | + {currentBreadcrumb.pitem.ruleDesc || "-"} | |
100 | + </span> | |
58 | 101 | </span> |
59 | 102 | <span className="span_limit_1"> |
60 | - <span style={{ color: '#999' }}>验收角色:</span> | |
61 | - <span style={{ color: '#333' }}>{currentBreadcrumb.pitem?.validRoleList?.length ? ( | |
62 | - <a onClick={() => setModal({ visible: true, type: "验收角色", name: currentBreadcrumb.pitem?.name || "", remark: "", roles: currentBreadcrumb.pitem?.validRoleList || [] })}>查看<SearchOutlined /></a> | |
63 | - ) : "验收角色默认为上级工作项负责人"}</span> | |
103 | + <span style={{ color: "#999" }}>验收角色:</span> | |
104 | + <span style={{ color: "#333" }}> | |
105 | + {currentBreadcrumb.pitem?.validType == | |
106 | + ValidType.父级责任人验收 ? ( | |
107 | + "父级责任人验收" | |
108 | + ) : ( | |
109 | + <a | |
110 | + onClick={() => setModal({ | |
111 | + visible: true, | |
112 | + type: | |
113 | + currentBreadcrumb.pitem?.validType == | |
114 | + ValidType.指定角色验收 | |
115 | + ? "验收角色" | |
116 | + : "验收角色", // TODO: 后续如果有指定人员验收,此处修改 | |
117 | + name: currentBreadcrumb.pitem?.name || "", | |
118 | + remark: "", | |
119 | + roles: currentBreadcrumb.pitem?.validRoleList || [], | |
120 | + })} | |
121 | + > | |
122 | + {currentBreadcrumb.pitem?.validType == | |
123 | + ValidType.指定角色验收 | |
124 | + ? "验收角色" | |
125 | + : "验收角色"} | |
126 | + {/* TODO: 后续如果有指定人员验收,此处修改 */} | |
127 | + <SearchOutlined /> | |
128 | + </a> | |
129 | + )} | |
130 | + </span> | |
64 | 131 | </span> |
65 | 132 | <span className="span_limit_1"> |
66 | - <span style={{ color: '#999' }}>授权:</span> | |
67 | - <span style={{ color: '#333' }}> | |
68 | - { | |
69 | - currentBreadcrumb.pitem?.shopPostDtoList && currentBreadcrumb.pitem?.shopPostDtoList.length || currentBreadcrumb.pitem?.postList && currentBreadcrumb.pitem?.postList ? ( | |
70 | - <a onClick={() => setModal({ visible: true, type: "授权", name: currentBreadcrumb.pitem?.name, shopPostDtoList: currentBreadcrumb.pitem?.shopPostDtoList, postList: currentBreadcrumb.pitem?.postList })}>查看<SearchOutlined /></a> | |
71 | - ) : "暂无授权信息" | |
72 | - } | |
133 | + <span style={{ color: "#999" }}>授权:</span> | |
134 | + <span style={{ color: "#333" }}> | |
135 | + {(currentBreadcrumb.pitem?.shopPostDtoList && | |
136 | + currentBreadcrumb.pitem?.shopPostDtoList.length) || | |
137 | + (currentBreadcrumb.pitem?.postList && | |
138 | + currentBreadcrumb.pitem?.postList) ? ( | |
139 | + <a | |
140 | + onClick={() => setModal({ | |
141 | + visible: true, | |
142 | + type: "授权", | |
143 | + name: currentBreadcrumb.pitem?.name, | |
144 | + shopPostDtoList: | |
145 | + currentBreadcrumb.pitem?.shopPostDtoList, | |
146 | + postList: currentBreadcrumb.pitem?.postList, | |
147 | + })} | |
148 | + > | |
149 | + 查看 | |
150 | + <SearchOutlined /> | |
151 | + </a> | |
152 | + ) : ( | |
153 | + "暂无授权信息" | |
154 | + )} | |
73 | 155 | </span> |
74 | 156 | </span> |
75 | 157 | </div> |
... | ... | @@ -78,4 +160,4 @@ export default function SuperiorWorkCard() { |
78 | 160 | </Row> |
79 | 161 | </Card> |
80 | 162 | ) : null; |
81 | -} | |
82 | 163 | \ No newline at end of file |
164 | +} | ... | ... |
src/pages/office/Work/WorkStandardSetting/components/ValidRoleComponent.tsx
1 | -import SortTable from '@/pages/ehr/AuthenticationSetting/CertifySetting/components/SortTable'; | |
2 | -import { Popconfirm, Select } from 'antd'; | |
3 | -import React, { useEffect, useState } from 'react'; | |
1 | +import SortTable from "@/pages/ehr/AuthenticationSetting/CertifySetting/components/SortTable"; | |
2 | +import { Popconfirm, Select } from "antd"; | |
3 | +import React, { useEffect, useState } from "react"; | |
4 | 4 | |
5 | 5 | /* |
6 | 6 | * @Date: 2021-11-10 15:54:11 |
7 | 7 | * @LastEditors: wangqiang@feewee.cn |
8 | - * @LastEditTime: 2021-12-08 16:23:49 | |
8 | + * @LastEditTime: 2022-05-06 09:43:28 | |
9 | 9 | */ |
10 | 10 | interface ValidRoleComponentValue { |
11 | - roles: ExamSetting.Role[] | |
12 | - disabled?: boolean | |
13 | - value?: WorkStandardSetting.ValidRoleVO[] | |
14 | - onChange?: (value: WorkStandardSetting.ValidRoleVO[]) => void | |
11 | + roles: ExamSetting.Role[]; | |
12 | + disabled?: boolean; | |
13 | + value?: WorkStandardSetting.ValidRoleVO[]; | |
14 | + onChange?: (value: WorkStandardSetting.ValidRoleVO[]) => void; | |
15 | 15 | } |
16 | 16 | |
17 | -export default function ValidRoleComponent({ roles, disabled, value, onChange }: ValidRoleComponentValue) { | |
17 | +export default function ValidRoleComponent({ | |
18 | + roles, | |
19 | + disabled, | |
20 | + value, | |
21 | + onChange, | |
22 | +}: ValidRoleComponentValue) { | |
18 | 23 | let columns = [ |
19 | 24 | { |
20 | - title: '验收顺序', | |
21 | - dataIndex: 'sort', | |
22 | - className: 'drag-visible', | |
25 | + title: "验收顺序", | |
26 | + dataIndex: "sort", | |
27 | + className: "drag-visible", | |
23 | 28 | }, |
24 | 29 | { |
25 | - title: '验收角色', | |
26 | - dataIndex: 'roleName', | |
27 | - className: 'drag-visible', | |
30 | + title: "验收角色", | |
31 | + dataIndex: "roleName", | |
32 | + className: "drag-visible", | |
28 | 33 | }, |
29 | 34 | { |
30 | - title: '操作', | |
31 | - render: (record: WorkStandardSetting.ValidRoleVO) => | |
35 | + title: "操作", | |
36 | + render: (record: WorkStandardSetting.ValidRoleVO) => ( | |
32 | 37 | <Popconfirm |
33 | 38 | title={`是否删除【${record.roleName}】?`} |
34 | 39 | onConfirm={() => handleDelete(record.roleCode || "")} |
35 | 40 | okText="确定" |
36 | 41 | cancelText="取消" |
37 | 42 | > |
38 | - <a href="" style={{ color: 'red' }}>删除</a> | |
43 | + <a href="" style={{ color: "red" }}> | |
44 | + 删除 | |
45 | + </a> | |
39 | 46 | </Popconfirm> |
40 | - } | |
47 | + ), | |
48 | + }, | |
41 | 49 | ]; |
42 | 50 | |
43 | 51 | if (disabled) { |
44 | - columns = columns.filter(col => col.title !== "操作"); | |
52 | + columns = columns.filter((col) => col.title !== "操作"); | |
45 | 53 | } |
46 | 54 | |
47 | 55 | const handleDelete = (roleCode: string) => { |
48 | - const filterList = (value || []).filter(val => val.roleCode !== roleCode).map((val, i) => ({ ...val, sort: i + 1 })); | |
56 | + const filterList = (value || []) | |
57 | + .filter((val) => val.roleCode !== roleCode) | |
58 | + .map((val, i) => ({ ...val, sort: i + 1 })); | |
49 | 59 | onChange && onChange(filterList); |
50 | - } | |
60 | + }; | |
51 | 61 | |
52 | 62 | return ( |
53 | 63 | <> |
... | ... | @@ -57,12 +67,26 @@ export default function ValidRoleComponent({ roles, disabled, value, onChange }: |
57 | 67 | mode="multiple" |
58 | 68 | labelInValue |
59 | 69 | showSearch |
60 | - value={(value || []).map(role => ({ label: role.roleName!, value: role.roleCode! }))} | |
61 | - onChange={(val) => onChange && onChange(val.map((v, i) => ({ sort: i + 1, roleCode: v.value, roleName: v.label })))} | |
70 | + value={(value || []).map((role) => ({ | |
71 | + label: role.roleName!, | |
72 | + value: role.roleCode!, | |
73 | + }))} | |
74 | + onChange={(val) => onChange && | |
75 | + onChange( | |
76 | + val.map((v, i) => ({ | |
77 | + sort: i + 1, | |
78 | + roleCode: v.value, | |
79 | + roleName: v.label, | |
80 | + })) | |
81 | + )} | |
62 | 82 | optionFilterProp="children" |
63 | 83 | placeholder="请选择验收角色" |
64 | 84 | > |
65 | - {roles.map(role => <Select.Option key={role.roleCode} value={role.roleCode!}>{role.roleName}</Select.Option>)} | |
85 | + {roles.map((role) => ( | |
86 | + <Select.Option key={role.roleCode} value={role.roleCode!}> | |
87 | + {role.roleName} | |
88 | + </Select.Option> | |
89 | + ))} | |
66 | 90 | </Select> |
67 | 91 | ) : null} |
68 | 92 | <SortTable |
... | ... | @@ -75,4 +99,4 @@ export default function ValidRoleComponent({ roles, disabled, value, onChange }: |
75 | 99 | /> |
76 | 100 | </> |
77 | 101 | ); |
78 | -} | |
79 | 102 | \ No newline at end of file |
103 | +} | ... | ... |
src/pages/office/Work/WorkStandardSetting/components/WorkTableList.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-11-10 10:33:52 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2021-12-20 09:40:58 | |
4 | + * @LastEditTime: 2022-05-06 11:06:44 | |
5 | 5 | */ |
6 | -import { Divider, message, Popconfirm, Popover, Table } from 'antd'; | |
7 | -import React from 'react'; | |
8 | -import { useStore } from '../index'; | |
9 | -import { SearchOutlined } from '@ant-design/icons'; | |
10 | -import { deleteWorkApi } from '../api'; | |
11 | -import { number2text } from '@/utils/validate'; | |
6 | +import { Divider, message, Popconfirm, Popover, Table } from "antd"; | |
7 | +import React from "react"; | |
8 | +import { useStore } from "../index"; | |
9 | +import { SearchOutlined } from "@ant-design/icons"; | |
10 | +import { deleteWorkApi } from "../api"; | |
11 | +import { number2text } from "@/utils/validate"; | |
12 | 12 | |
13 | 13 | export default function WorkTableList() { |
14 | 14 | const { |
... | ... | @@ -22,16 +22,19 @@ export default function WorkTableList() { |
22 | 22 | currentBreadcrumb, |
23 | 23 | setCurrentBreadcrumb, |
24 | 24 | setModal, |
25 | + ValidType, | |
25 | 26 | } = useStore(); |
26 | 27 | const { list, loading, paginationConfig, setLoading } = pagination; |
27 | 28 | |
28 | 29 | const deleteItem = (id: number) => { |
29 | - deleteWorkApi(id).then(res => { | |
30 | - message.success(res.result); | |
31 | - setLoading(true); | |
32 | - }).catch(error => { | |
33 | - message.error(error.message); | |
34 | - }); | |
30 | + deleteWorkApi(id) | |
31 | + .then((res) => { | |
32 | + message.success(res.result); | |
33 | + setLoading(true); | |
34 | + }) | |
35 | + .catch((error) => { | |
36 | + message.error(error.message); | |
37 | + }); | |
35 | 38 | }; |
36 | 39 | |
37 | 40 | return ( |
... | ... | @@ -48,46 +51,82 @@ export default function WorkTableList() { |
48 | 51 | align="left" |
49 | 52 | width="40%" |
50 | 53 | render={(record: WorkStandardSetting.WorkItemVO) => ( |
51 | - <Popover placement="topLeft" content={( | |
52 | - <div> | |
53 | - <span> | |
54 | - <span style={{ color: '#999' }}>{record.pid ? "下级工作项名称:" : "工作名称:"}</span> | |
55 | - <span style={{ color: '#333' }}>{record.name || '-'}</span> | |
56 | - </span><br /> | |
57 | - {record.pid || record.ruleType === RuleType["按滚动月设置"] || record.ruleType === RuleType["按小时设置"] || record.ruleType === RuleType["按范围天"] ? null : ( | |
58 | - <> | |
59 | - <span> | |
60 | - <span style={{ color: '#999' }}>开始时间:</span> | |
61 | - <span style={{ color: '#333' }}>{record.startHourStr || '-'}</span> | |
62 | - </span><br /> | |
63 | - <span> | |
64 | - <span style={{ color: '#999' }}>完成时间:</span> | |
65 | - <span style={{ color: '#333' }}>{record.endHourStr || '-'}</span> | |
54 | + <Popover | |
55 | + placement="topLeft" | |
56 | + content={ | |
57 | + <div> | |
58 | + <span> | |
59 | + <span style={{ color: "#999" }}> | |
60 | + {record.pid ? "下级工作项名称:" : "工作名称:"} | |
66 | 61 | </span> |
67 | - </> | |
68 | - )} | |
69 | - </div> | |
70 | - )}> | |
62 | + <span style={{ color: "#333" }}>{record.name || "-"}</span> | |
63 | + </span> | |
64 | + <br /> | |
65 | + {record.pid || | |
66 | + record.ruleType === RuleType["按滚动月设置"] || | |
67 | + record.ruleType === RuleType["按小时设置"] || | |
68 | + record.ruleType === RuleType["按范围天"] ? null : ( | |
69 | + <> | |
70 | + <span> | |
71 | + <span style={{ color: "#999" }}>开始时间:</span> | |
72 | + <span style={{ color: "#333" }}> | |
73 | + {record.startHourStr || "-"} | |
74 | + </span> | |
75 | + </span> | |
76 | + <br /> | |
77 | + <span> | |
78 | + <span style={{ color: "#999" }}>完成时间:</span> | |
79 | + <span style={{ color: "#333" }}> | |
80 | + {record.endHourStr || "-"} | |
81 | + </span> | |
82 | + </span> | |
83 | + </> | |
84 | + )} | |
85 | + </div> | |
86 | + } | |
87 | + > | |
71 | 88 | <div style={{ float: "left" }}> |
72 | 89 | <span className="span_limit_1"> |
73 | - <span style={{ color: '#999' }}>{record.pid ? "下级工作项名称:" : "工作名称:"}</span> | |
74 | - <span style={{ color: '#333' }}>{record.name || '-'}</span> | |
90 | + <span style={{ color: "#999" }}> | |
91 | + {record.pid ? "下级工作项名称:" : "工作名称:"} | |
92 | + </span> | |
93 | + <span style={{ color: "#333" }}>{record.name || "-"}</span> | |
75 | 94 | </span> |
76 | 95 | {record.pid ? null : ( |
77 | 96 | <span className="span_limit_1"> |
78 | - <span style={{ color: '#999' }}>工作内容:</span> | |
79 | - <span style={{ color: '#333' }}><a onClick={() => setModal({ visible: true, type: "工作内容", name: record.name || "", roles: [], remark: record.remark || "" })}>查看<SearchOutlined /></a></span> | |
97 | + <span style={{ color: "#999" }}>工作内容:</span> | |
98 | + <span style={{ color: "#333" }}> | |
99 | + <a | |
100 | + onClick={() => setModal({ | |
101 | + visible: true, | |
102 | + type: "工作内容", | |
103 | + name: record.name || "", | |
104 | + roles: [], | |
105 | + remark: record.remark || "", | |
106 | + })} | |
107 | + > | |
108 | + 查看 | |
109 | + <SearchOutlined /> | |
110 | + </a> | |
111 | + </span> | |
80 | 112 | </span> |
81 | 113 | )} |
82 | - {record.pid || record.ruleType === RuleType["按滚动月设置"] || record.ruleType === RuleType["按小时设置"] || record.ruleType === RuleType["按范围天"] ? null : ( | |
114 | + {record.pid || | |
115 | + record.ruleType === RuleType["按滚动月设置"] || | |
116 | + record.ruleType === RuleType["按小时设置"] || | |
117 | + record.ruleType === RuleType["按范围天"] ? null : ( | |
83 | 118 | <> |
84 | 119 | <span className="span_limit_1"> |
85 | - <span style={{ color: '#999' }}>开始时间:</span> | |
86 | - <span style={{ color: '#333' }}>{record.startHourStr || '-'}</span> | |
120 | + <span style={{ color: "#999" }}>开始时间:</span> | |
121 | + <span style={{ color: "#333" }}> | |
122 | + {record.startHourStr || "-"} | |
123 | + </span> | |
87 | 124 | </span> |
88 | 125 | <span className="span_limit_1"> |
89 | - <span style={{ color: '#999' }}>完成时间:</span> | |
90 | - <span style={{ color: '#333' }}>{record.endHourStr || '-'}</span> | |
126 | + <span style={{ color: "#999" }}>完成时间:</span> | |
127 | + <span style={{ color: "#333" }}> | |
128 | + {record.endHourStr || "-"} | |
129 | + </span> | |
91 | 130 | </span> |
92 | 131 | </> |
93 | 132 | )} |
... | ... | @@ -98,74 +137,140 @@ export default function WorkTableList() { |
98 | 137 | <Table.Column |
99 | 138 | title="工作其他信息" |
100 | 139 | align="left" |
101 | - render={(record: WorkStandardSetting.WorkItemVO) => record.pid ? null : ( | |
102 | - <Popover placement="topLeft" content={( | |
103 | - <div> | |
104 | - <span> | |
105 | - <span style={{ color: '#999' }}>工作类型:</span> | |
106 | - <span style={{ color: '#333' }}>{record.workTypeName || "-"}</span> | |
107 | - </span><br /> | |
108 | - <span> | |
109 | - <span style={{ color: '#999' }}>频率:</span> | |
110 | - <span style={{ color: '#333' }}>{record.ruleDesc || '-'}</span> | |
111 | - </span> | |
112 | - </div> | |
113 | - )}> | |
140 | + render={(record: WorkStandardSetting.WorkItemVO) => (record.pid ? null : ( | |
141 | + <Popover | |
142 | + placement="topLeft" | |
143 | + content={ | |
144 | + <div> | |
145 | + <span> | |
146 | + <span style={{ color: "#999" }}>工作类型:</span> | |
147 | + <span style={{ color: "#333" }}> | |
148 | + {record.workTypeName || "-"} | |
149 | + </span> | |
150 | + </span> | |
151 | + <br /> | |
152 | + <span> | |
153 | + <span style={{ color: "#999" }}>频率:</span> | |
154 | + <span style={{ color: "#333" }}> | |
155 | + {record.ruleDesc || "-"} | |
156 | + </span> | |
157 | + </span> | |
158 | + </div> | |
159 | + } | |
160 | + > | |
114 | 161 | <div> |
115 | 162 | <span className="span_limit_1"> |
116 | - <span style={{ color: '#999' }}>工作类型:</span> | |
117 | - <span style={{ color: '#333' }}>{record.workTypeName || "-"}</span> | |
163 | + <span style={{ color: "#999" }}>工作类型:</span> | |
164 | + <span style={{ color: "#333" }}> | |
165 | + {record.workTypeName || "-"} | |
166 | + </span> | |
118 | 167 | </span> |
119 | 168 | <span className="span_limit_1"> |
120 | - <span style={{ color: '#999' }}>频率:</span> | |
121 | - <span style={{ color: '#333' }}>{record.ruleDesc || '-'}</span> | |
169 | + <span style={{ color: "#999" }}>频率:</span> | |
170 | + <span style={{ color: "#333" }}> | |
171 | + {record.ruleDesc || "-"} | |
172 | + </span> | |
122 | 173 | </span> |
123 | 174 | <span className="span_limit_1"> |
124 | - <span style={{ color: '#999' }}>验收角色:</span> | |
125 | - <span style={{ color: '#333' }}>{currentBreadcrumb.pid ? | |
126 | - "验收角色默认为上级工作项负责人" : ( | |
127 | - <a onClick={() => setModal({ visible: true, type: "验收角色", name: record.name || "", remark: "", roles: record.validRoleList || [] })}>查看<SearchOutlined /></a> | |
128 | - )}</span> | |
175 | + <span style={{ color: "#999" }}>验收类型:</span> | |
176 | + <span style={{ color: "#333" }}> | |
177 | + {/* {currentBreadcrumb.pid ? ( | |
178 | + "验收角色默认为上级工作项负责人" | |
179 | + ) : ( */} | |
180 | + {record.validType == ValidType.父级责任人验收 ? ( | |
181 | + "父级责任人验收" | |
182 | + ) : ( | |
183 | + <a | |
184 | + onClick={() => setModal({ | |
185 | + visible: true, | |
186 | + type: | |
187 | + record.validType == ValidType.指定角色验收 | |
188 | + ? "验收角色" | |
189 | + : "验收角色", // TODO: 后续如果有指定人员验收,此处修改 | |
190 | + name: record.name || "", | |
191 | + remark: "", | |
192 | + roles: record.validRoleList || [], | |
193 | + })} | |
194 | + > | |
195 | + {record.validType == ValidType.指定角色验收 | |
196 | + ? "验收角色" | |
197 | + : "验收角色"} | |
198 | + {/* TODO: 后续如果有指定人员验收,此处修改 */} | |
199 | + <SearchOutlined /> | |
200 | + </a> | |
201 | + )} | |
202 | + | |
203 | + {/* )} */} | |
204 | + </span> | |
129 | 205 | </span> |
130 | 206 | <span className="span_limit_1"> |
131 | - <span style={{ color: '#999' }}>授权:</span> | |
132 | - <span style={{ color: '#333' }}> | |
133 | - { | |
134 | - record.shopPostDtoList && record.shopPostDtoList.length || record.postList && record.postList ? ( | |
135 | - <a onClick={() => setModal({ visible: true, type: "授权", name: record.name, shopPostDtoList: record.shopPostDtoList, postList: record.postList })}>查看<SearchOutlined /></a> | |
136 | - ) : "暂无授权信息" | |
137 | - } | |
207 | + <span style={{ color: "#999" }}>授权:</span> | |
208 | + <span style={{ color: "#333" }}> | |
209 | + {(record.shopPostDtoList && | |
210 | + record.shopPostDtoList.length) || | |
211 | + (record.postList && record.postList) ? ( | |
212 | + <a | |
213 | + onClick={() => setModal({ | |
214 | + visible: true, | |
215 | + type: "授权", | |
216 | + name: record.name, | |
217 | + shopPostDtoList: record.shopPostDtoList, | |
218 | + postList: record.postList, | |
219 | + })} | |
220 | + > | |
221 | + 查看 | |
222 | + <SearchOutlined /> | |
223 | + </a> | |
224 | + ) : ( | |
225 | + "暂无授权信息" | |
226 | + )} | |
138 | 227 | </span> |
139 | 228 | </span> |
140 | 229 | </div> |
141 | 230 | </Popover> |
142 | - )} | |
231 | + ))} | |
143 | 232 | /> |
144 | 233 | <Table.Column |
145 | 234 | title="操作" |
146 | 235 | align="left" |
147 | 236 | width="20%" |
148 | - render={(record: WorkStandardSetting.WorkItemVO) => record.pid ? null : ( | |
237 | + render={(record: WorkStandardSetting.WorkItemVO) => (record.pid ? null : ( | |
149 | 238 | <> |
150 | 239 | <a |
151 | 240 | onClick={() => { |
152 | - const _currentBreadcurmb = { key: breadcrumbs.length + 1, name: `${number2text(breadcrumbs.length + 1)}级工作项`, pid: record.id, pitem: record }; | |
153 | - setBreadcrumbs(breadcrumbs.concat(_currentBreadcurmb)); | |
154 | - setCurrentBreadcrumb(_currentBreadcurmb); | |
155 | - }} | |
241 | + const _currentBreadcurmb = { | |
242 | + key: breadcrumbs.length + 1, | |
243 | + name: `${number2text(breadcrumbs.length + 1)}级工作项`, | |
244 | + pid: record.id, | |
245 | + pitem: record, | |
246 | + }; | |
247 | + setBreadcrumbs(breadcrumbs.concat(_currentBreadcurmb)); | |
248 | + setCurrentBreadcrumb(_currentBreadcurmb); | |
249 | + }} | |
156 | 250 | > |
157 | 251 | 下级工作安排 |
158 | 252 | </a> |
159 | 253 | <Divider type="vertical" /> |
160 | - <a onClick={() => { setCurrentItem({ ...record, pid: currentBreadcrumb.pid }); setEdit(true); setVisible(true); }}>编辑</a> | |
254 | + <a | |
255 | + onClick={() => { | |
256 | + setCurrentItem({ ...record, pid: currentBreadcrumb.pid }); | |
257 | + setEdit(true); | |
258 | + setVisible(true); | |
259 | + }} | |
260 | + > | |
261 | + 编辑 | |
262 | + </a> | |
161 | 263 | <Divider type="vertical" /> |
162 | - <Popconfirm title={`确定删除【${record.name}】工作项?`} onConfirm={() => deleteItem(record.id!)}> | |
264 | + <Popconfirm | |
265 | + title={`确定删除【${record.name}】工作项?`} | |
266 | + onConfirm={() => deleteItem(record.id!)} | |
267 | + > | |
163 | 268 | <a style={{ color: "#F0492C" }}>删除</a> |
164 | 269 | </Popconfirm> |
165 | 270 | </> |
166 | - )} | |
271 | + ))} | |
167 | 272 | /> |
168 | 273 | </Table> |
169 | 274 | </> |
170 | 275 | ); |
171 | -} | |
172 | 276 | \ No newline at end of file |
277 | +} | ... | ... |
src/pages/office/Work/WorkStandardSetting/index.tsx
1 | 1 | /* |
2 | 2 | * @Date: 2021-08-11 15:51:56 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2021-12-08 16:08:26 | |
4 | + * @LastEditTime: 2022-05-06 10:51:01 | |
5 | 5 | */ |
6 | 6 | import React, { useEffect } from "react"; |
7 | 7 | import { PageHeaderWrapper } from "@ant-design/pro-layout"; |
8 | 8 | import { Card, Row, Button, Select, Input, Breadcrumb, Divider } from "antd"; |
9 | -import { PlusOutlined, LeftCircleOutlined } from '@ant-design/icons'; | |
9 | +import { PlusOutlined, LeftCircleOutlined } from "@ant-design/icons"; | |
10 | 10 | import { createStore } from "@/hooks/moz"; |
11 | 11 | import store, { BreadcrumbItem } from "./store"; |
12 | 12 | import "./style.less"; |
13 | -import CreateModal from './components/CreateModal'; | |
14 | -import SettingItem from './components/SettingItem'; | |
15 | -import WorkTableList from './components/WorkTableList'; | |
16 | -import SuperiorWorkCard from './components/SuperiorWorkCard'; | |
17 | -import WorkViewModal from './components/WorkViewModal'; | |
13 | +import CreateModal from "./components/CreateModal"; | |
14 | +import SettingItem from "./components/SettingItem"; | |
15 | +import WorkTableList from "./components/WorkTableList"; | |
16 | +import SuperiorWorkCard from "./components/SuperiorWorkCard"; | |
17 | +import WorkViewModal from "./components/WorkViewModal"; | |
18 | 18 | |
19 | 19 | export const { Provider, useStore } = createStore(store); |
20 | 20 | |
... | ... | @@ -37,26 +37,29 @@ function WorkStandardSetting() { |
37 | 37 | |
38 | 38 | useEffect(() => { |
39 | 39 | setWorkName(undefined); |
40 | - setParams({ | |
41 | - name: undefined, | |
42 | - roleCode: undefined, | |
43 | - workTypeId: undefined, | |
44 | - pid: currentBreadcrumb.pid, | |
45 | - current: 1 | |
46 | - }, !workName); | |
40 | + setParams( | |
41 | + { | |
42 | + name: undefined, | |
43 | + roleCode: undefined, | |
44 | + workTypeId: undefined, | |
45 | + pid: currentBreadcrumb.pid, | |
46 | + current: 1, | |
47 | + }, | |
48 | + !workName | |
49 | + ); | |
47 | 50 | }, [currentBreadcrumb]); |
48 | 51 | |
49 | 52 | const breadcrumbClick = (breadcrumb: BreadcrumbItem, index: number) => { |
50 | 53 | setCurrentBreadcrumb(breadcrumb); |
51 | 54 | setBreadcrumbs(breadcrumbs.slice(0, index + 1)); |
52 | - } | |
55 | + }; | |
53 | 56 | |
54 | 57 | const getBack = () => { |
55 | 58 | const bread = [...breadcrumbs]; |
56 | 59 | bread.pop(); |
57 | 60 | setBreadcrumbs(bread); |
58 | 61 | setCurrentBreadcrumb(bread[bread.length - 1]); |
59 | - } | |
62 | + }; | |
60 | 63 | |
61 | 64 | return ( |
62 | 65 | <PageHeaderWrapper title="周期性工作设置"> |
... | ... | @@ -64,28 +67,87 @@ function WorkStandardSetting() { |
64 | 67 | <SettingItem /> |
65 | 68 | <Divider /> |
66 | 69 | <Row justify="space-between" style={{ marginTop: 10 }}> |
67 | - <Breadcrumb separator='>' style={{ flex: 1, display: "flex", justifyContent: "flex-start", flexWrap: "wrap" }}> | |
68 | - {breadcrumbs.map((breadcrumb, index) => | |
69 | - <Breadcrumb.Item onClick={() => breadcrumbClick(breadcrumb, index)} key={breadcrumb.key}><a>{breadcrumb.name}</a></Breadcrumb.Item>)} | |
70 | + <Breadcrumb | |
71 | + separator=">" | |
72 | + style={{ | |
73 | + flex: 1, | |
74 | + display: "flex", | |
75 | + justifyContent: "flex-start", | |
76 | + flexWrap: "wrap", | |
77 | + }} | |
78 | + > | |
79 | + {breadcrumbs.map((breadcrumb, index) => ( | |
80 | + <Breadcrumb.Item | |
81 | + onClick={() => breadcrumbClick(breadcrumb, index)} | |
82 | + key={breadcrumb.key} | |
83 | + > | |
84 | + <a>{breadcrumb.name}</a> | |
85 | + </Breadcrumb.Item> | |
86 | + ))} | |
70 | 87 | </Breadcrumb> |
71 | 88 | {breadcrumbs.length > 1 ? ( |
72 | - <Button icon={<LeftCircleOutlined />} type='link' onClick={getBack}>返回上一级</Button> | |
89 | + <Button icon={<LeftCircleOutlined />} type="link" onClick={getBack}> | |
90 | + 返回上一级 | |
91 | + </Button> | |
73 | 92 | ) : null} |
74 | 93 | </Row> |
75 | 94 | |
76 | 95 | <SuperiorWorkCard /> |
77 | 96 | |
78 | - <Row justify="space-between" style={{ marginBottom: 10, marginTop: 20 }}> | |
97 | + <Row | |
98 | + justify="space-between" | |
99 | + style={{ marginBottom: 10, marginTop: 20 }} | |
100 | + > | |
79 | 101 | <Row style={{ flex: 1, flexWrap: "wrap" }}> |
80 | - <Input allowClear placeholder="请输入工作项名称查询" value={workName} onChange={e => setWorkName(e.target.value)} style={{ maxWidth: 260, marginRight: 10, marginBottom: 10 }} /> | |
81 | - <Select allowClear placeholder='查询验收角色' showSearch optionFilterProp="children" value={innerParams.roleCode} onChange={roleCode => setParams({ roleCode, current: 1 }, true)} style={{ width: 260, marginRight: 10, marginBottom: 10 }}> | |
82 | - {roles.map(role => <Select.Option key={role.roleCode} value={role.roleCode!}>{role.roleName}</Select.Option>)} | |
102 | + <Input | |
103 | + allowClear | |
104 | + placeholder="请输入工作项名称查询" | |
105 | + value={workName} | |
106 | + onChange={(e) => setWorkName(e.target.value)} | |
107 | + style={{ maxWidth: 260, marginRight: 10, marginBottom: 10 }} | |
108 | + /> | |
109 | + <Select | |
110 | + allowClear | |
111 | + placeholder="查询验收角色" | |
112 | + showSearch | |
113 | + optionFilterProp="children" | |
114 | + value={innerParams.roleCode} | |
115 | + onChange={(roleCode) => setParams({ roleCode, current: 1 }, true)} | |
116 | + style={{ width: 260, marginRight: 10, marginBottom: 10 }} | |
117 | + > | |
118 | + {roles.map((role) => ( | |
119 | + <Select.Option key={role.roleCode} value={role.roleCode!}> | |
120 | + {role.roleName} | |
121 | + </Select.Option> | |
122 | + ))} | |
83 | 123 | </Select> |
84 | - <Select allowClear showSearch optionFilterProp="children" value={innerParams.workTypeId} onChange={workTypeId => setParams({ workTypeId, current: 1 }, true)} placeholder="请选择工作类型" style={{ width: 260, marginRight: 10, marginBottom: 10 }}> | |
85 | - {workTypeList.map(workType => <Select.Option key={workType.id} value={workType.id!}>{workType.name}</Select.Option>)} | |
124 | + <Select | |
125 | + allowClear | |
126 | + showSearch | |
127 | + optionFilterProp="children" | |
128 | + value={innerParams.workTypeId} | |
129 | + onChange={(workTypeId) => setParams({ workTypeId, current: 1 }, true)} | |
130 | + placeholder="请选择工作类型" | |
131 | + style={{ width: 260, marginRight: 10, marginBottom: 10 }} | |
132 | + > | |
133 | + {workTypeList.map((workType) => ( | |
134 | + <Select.Option key={workType.id} value={workType.id!}> | |
135 | + {workType.name} | |
136 | + </Select.Option> | |
137 | + ))} | |
86 | 138 | </Select> |
87 | 139 | </Row> |
88 | - <Button icon={(<PlusOutlined />)} type="primary" onClick={() => { setCurrentItem(undefined); setEdit(false); setVisible(true); }}>添加工作项</Button> | |
140 | + <Button | |
141 | + icon={<PlusOutlined />} | |
142 | + type="primary" | |
143 | + onClick={() => { | |
144 | + setCurrentItem(undefined); | |
145 | + setEdit(false); | |
146 | + setVisible(true); | |
147 | + }} | |
148 | + > | |
149 | + 添加工作项 | |
150 | + </Button> | |
89 | 151 | </Row> |
90 | 152 | <WorkTableList /> |
91 | 153 | <CreateModal /> | ... | ... |
src/pages/office/Work/WorkStandardSetting/interface.d.ts
1 | 1 | /* |
2 | 2 | * @Date: 2021-08-11 15:51:56 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2021-12-17 15:22:42 | |
4 | + * @LastEditTime: 2022-05-06 10:27:38 | |
5 | 5 | */ |
6 | 6 | declare namespace WorkStandardSetting { |
7 | 7 | interface QueryParams { |
8 | - name?: string // 工作项名称 | |
9 | - roleCode?: string // 验收角色码 | |
10 | - pid?: number // 父级工作项ID | |
11 | - workTypeId?: number // 工作类型ID | |
8 | + name?: string; // 工作项名称 | |
9 | + roleCode?: string; // 验收角色码 | |
10 | + pid?: number; // 父级工作项ID | |
11 | + workTypeId?: number; // 工作类型ID | |
12 | 12 | } |
13 | 13 | |
14 | 14 | interface WorkItemVO { |
15 | - pid?: number // 父工作项ID | |
16 | - pname?: string // 父工作项名称 | |
17 | - id?: number //工作项id | |
18 | - name?: string //工作项名称 | |
15 | + pid?: number; // 父工作项ID | |
16 | + pname?: string; // 父工作项名称 | |
17 | + id?: number; //工作项id | |
18 | + name?: string; //工作项名称 | |
19 | 19 | // validRoleName?: string //验收角色 |
20 | 20 | // validRoleCode?: string //验收角色名称 |
21 | - startTime?: number //开始时间 | |
22 | - endTime?: number //结束时间 | |
23 | - startHourStr?: string //开始时间点 | |
24 | - endHourStr?: string //结束时间点 | |
25 | - ruleType?: 1 | 2 | 3 | 4 | 5 | 6 //频率类型 1按天滚动 2按周 3按月 4按月滚动 5按小时 6按范围天 | |
26 | - ruleValue?: string //频率值 | |
27 | - ruleDesc?: string // 频率描述 | |
21 | + startTime?: number; //开始时间 | |
22 | + endTime?: number; //结束时间 | |
23 | + startHourStr?: string; //开始时间点 | |
24 | + endHourStr?: string; //结束时间点 | |
25 | + ruleType?: 1 | 2 | 3 | 4 | 5 | 6; //频率类型 1按天滚动 2按周 3按月 4按月滚动 5按小时 6按范围天 | |
26 | + ruleValue?: string; //频率值 | |
27 | + ruleDesc?: string; // 频率描述 | |
28 | 28 | |
29 | - workTypeId?: number // 工作类型ID | |
30 | - workTypeName?: string // 工作类型名称 | |
31 | - startMonthDate?: number // 滚动开始月 滚动月时必传 | |
32 | - rollCalcType?: 1 | 2 // 按月滚动类型 1正序 2倒叙 | |
33 | - calcNum?: number // 滚动月数 | |
34 | - workDay?: number // 工作时长 | |
35 | - remark?: string // 工作内容 | |
36 | - remarkList?: AwardItemVO[] // 工作内容暂存列表-编辑表单项目时使用 | |
37 | - validDay?: number // 验收时间 | |
38 | - ofProbation?: boolean // 是否派发试用期员工 | |
39 | - children?: WorkItemVO[] | |
40 | - attachList?: FileVO[] // 示例附件 | |
41 | - keepParent?: boolean // 是否和父工作频率保持一致 | |
42 | - validRoleList?: ValidRoleVO[] // 验收角色列表 | |
43 | - validTimeUnit?: 1 | 2 // 验收时间单位 1天 2小时 | |
44 | - workTimeUnit?: 1 | 2 // 工作执行时间单位 1天 2小时 | |
45 | - type?: number // 授权类型 | |
46 | - shopPostDtoList?: WorkShopStandardSetting.ShopPostVO[] // 门店岗位授权信息 | |
47 | - postList?: WorkShopStandardSetting.PostItem[] // 岗位授权信息 | |
29 | + workTypeId?: number; // 工作类型ID | |
30 | + workTypeName?: string; // 工作类型名称 | |
31 | + startMonthDate?: number; // 滚动开始月 滚动月时必传 | |
32 | + rollCalcType?: 1 | 2; // 按月滚动类型 1正序 2倒叙 | |
33 | + calcNum?: number; // 滚动月数 | |
34 | + workDay?: number; // 工作时长 | |
35 | + remark?: string; // 工作内容 | |
36 | + remarkList?: AwardItemVO[]; // 工作内容暂存列表-编辑表单项目时使用 | |
37 | + validDay?: number; // 验收时间 | |
38 | + ofProbation?: boolean; // 是否派发试用期员工 | |
39 | + children?: WorkItemVO[]; | |
40 | + attachList?: FileVO[]; // 示例附件 | |
41 | + keepParent?: boolean; // 是否和父工作频率保持一致 | |
42 | + validType?: number; // 验收类型 1父级责任人验收 2指定角色验收 | |
43 | + validRoleList?: ValidRoleVO[]; // 验收角色列表 | |
44 | + validTimeUnit?: 1 | 2; // 验收时间单位 1天 2小时 | |
45 | + workTimeUnit?: 1 | 2; // 工作执行时间单位 1天 2小时 | |
46 | + type?: number; // 授权类型 | |
47 | + shopPostDtoList?: WorkShopStandardSetting.ShopPostVO[]; // 门店岗位授权信息 | |
48 | + postList?: WorkShopStandardSetting.PostItem[]; // 岗位授权信息 | |
48 | 49 | } |
49 | 50 | |
50 | 51 | interface ValidRoleVO { |
51 | - roleCode?: string | |
52 | - roleName?: string | |
53 | - sort?: number | |
52 | + roleCode?: string; | |
53 | + roleName?: string; | |
54 | + sort?: number; | |
54 | 55 | } |
55 | 56 | |
56 | - interface AwardItemVO { // 奖励项 | |
57 | - punishDecisionItemId?: number // 奖励决定子项id | |
58 | - awardCode?: string | |
59 | - awardName?: string | |
57 | + interface AwardItemVO { | |
58 | + // 奖励项 | |
59 | + punishDecisionItemId?: number; // 奖励决定子项id | |
60 | + awardCode?: string; | |
61 | + awardName?: string; | |
60 | 62 | } |
61 | 63 | |
62 | 64 | interface WorkWeekVO { |
63 | - value?: number | |
64 | - desc?: string | |
65 | + value?: number; | |
66 | + desc?: string; | |
65 | 67 | } |
66 | 68 | |
67 | - interface ProportionVO { // 执行力集团最低要求 | |
68 | - workTimeProportion?: number // 及时执行率集团比最低要求 | |
69 | - workEffectProportion?: number // 执行效果集团比最低要求 | |
70 | - workAvgProportion?: number // 平均执行力集团比最低要求 | |
69 | + interface ProportionVO { | |
70 | + // 执行力集团最低要求 | |
71 | + workTimeProportion?: number; // 及时执行率集团比最低要求 | |
72 | + workEffectProportion?: number; // 执行效果集团比最低要求 | |
73 | + workAvgProportion?: number; // 平均执行力集团比最低要求 | |
71 | 74 | } |
72 | 75 | |
73 | 76 | interface FileVO { |
74 | - refreId?: number | |
75 | - fileType?: number // 文件类型 | |
76 | - fid?: string | |
77 | - fileName?: string | |
77 | + refreId?: number; | |
78 | + fileType?: number; // 文件类型 | |
79 | + fid?: string; | |
80 | + fileName?: string; | |
78 | 81 | } |
79 | 82 | } | ... | ... |
src/pages/office/Work/WorkStandardSetting/store.ts
1 | 1 | /* |
2 | 2 | * @Date: 2021-08-11 15:51:56 |
3 | 3 | * @LastEditors: wangqiang@feewee.cn |
4 | - * @LastEditTime: 2021-12-20 09:40:56 | |
4 | + * @LastEditTime: 2022-05-06 10:52:36 | |
5 | 5 | */ |
6 | -import useDebounce from '@/hooks/useDebounce'; | |
7 | -import useInitail from '@/hooks/useInitail'; | |
8 | -import usePagination from '@/hooks/usePagination'; | |
9 | -import { getRoleListApi } from '@/pages/ehr/StandardSetting/ExamSetting/api'; | |
6 | +import useDebounce from "@/hooks/useDebounce"; | |
7 | +import useInitail from "@/hooks/useInitail"; | |
8 | +import usePagination from "@/hooks/usePagination"; | |
9 | +import { getRoleListApi } from "@/pages/ehr/StandardSetting/ExamSetting/api"; | |
10 | 10 | import { useEffect, useState } from "react"; |
11 | -import { getWorkListApi, getWorkTypeListApi } from './api'; | |
11 | +import { getWorkListApi, getWorkTypeListApi } from "./api"; | |
12 | 12 | |
13 | 13 | export interface BreadcrumbItem { |
14 | - key?: number // 第几级工作项 | |
15 | - name?: string // 第几级工作项 | |
16 | - pid?: number // 上级工作项ID | |
17 | - pitem?: WorkStandardSetting.WorkItemVO // 上级工作数据 | |
14 | + key?: number; // 第几级工作项 | |
15 | + name?: string; // 第几级工作项 | |
16 | + pid?: number; // 上级工作项ID | |
17 | + pitem?: WorkStandardSetting.WorkItemVO; // 上级工作数据 | |
18 | 18 | } |
19 | 19 | |
20 | 20 | interface Modal { |
21 | - visible: boolean | |
22 | - name?: string | |
23 | - remark?: string | |
24 | - type?: "工作内容" | "验收角色" | "授权" | |
25 | - roles?: WorkStandardSetting.ValidRoleVO[] | |
26 | - shopPostDtoList?: WorkShopStandardSetting.ShopPostVO[] // 门店岗位授权信息 | |
27 | - postList?: WorkShopStandardSetting.PostItem[] // 岗位授权信息 | |
21 | + visible: boolean; | |
22 | + name?: string; | |
23 | + remark?: string; | |
24 | + type?: "工作内容" | "验收角色" | "授权"; | |
25 | + roles?: WorkStandardSetting.ValidRoleVO[]; | |
26 | + shopPostDtoList?: WorkShopStandardSetting.ShopPostVO[]; // 门店岗位授权信息 | |
27 | + postList?: WorkShopStandardSetting.PostItem[]; // 岗位授权信息 | |
28 | 28 | } |
29 | 29 | |
30 | 30 | export default function store() { |
31 | - const [breadcrumbs, setBreadcrumbs] = useState<BreadcrumbItem[]>([{ name: '一级工作项', key: 1 }]); | |
32 | - const [currentBreadcrumb, setCurrentBreadcrumb] = useState<BreadcrumbItem>({ name: '一级工作项', key: 1 }); | |
31 | + const [breadcrumbs, setBreadcrumbs] = useState<BreadcrumbItem[]>([ | |
32 | + { name: "一级工作项", key: 1 }, | |
33 | + ]); | |
34 | + const [currentBreadcrumb, setCurrentBreadcrumb] = useState<BreadcrumbItem>({ | |
35 | + name: "一级工作项", | |
36 | + key: 1, | |
37 | + }); | |
33 | 38 | // @ts-ignore |
34 | 39 | const pagination = usePagination(getWorkListApi); |
35 | 40 | const { data: roles } = useInitail(getRoleListApi, [], {}); |
... | ... | @@ -37,8 +42,14 @@ export default function store() { |
37 | 42 | const [edit, setEdit] = useState(false); // 新增false或编辑true |
38 | 43 | const [view, setView] = useState(false); // 是否是查看工作 |
39 | 44 | const [visible, setVisible] = useState(false); |
40 | - const [currentItem, setCurrentItem] = useState<WorkStandardSetting.WorkItemVO>(); | |
41 | - const [modal, setModal] = useState<Modal>({ visible: false, name: "", remark: "", roles: [] }); | |
45 | + const [currentItem, setCurrentItem] = | |
46 | + useState<WorkStandardSetting.WorkItemVO>(); | |
47 | + const [modal, setModal] = useState<Modal>({ | |
48 | + visible: false, | |
49 | + name: "", | |
50 | + remark: "", | |
51 | + roles: [], | |
52 | + }); | |
42 | 53 | const [workName, setWorkName] = useState<string>(); |
43 | 54 | const workNameDebounce = useDebounce(workName); |
44 | 55 | |
... | ... | @@ -48,7 +59,7 @@ export default function store() { |
48 | 59 | "按月设置", |
49 | 60 | "按滚动月设置", |
50 | 61 | "按小时设置", |
51 | - "按范围天" | |
62 | + "按范围天", | |
52 | 63 | } |
53 | 64 | |
54 | 65 | enum AuthType { |
... | ... | @@ -56,8 +67,13 @@ export default function store() { |
56 | 67 | "按岗位授权" = 3, |
57 | 68 | } |
58 | 69 | |
70 | + enum ValidType { | |
71 | + "父级责任人验收" = 1, | |
72 | + "指定角色验收", | |
73 | + } | |
74 | + | |
59 | 75 | useEffect(() => { |
60 | - pagination.setParams({ name: workNameDebounce, current: 1 }, true) | |
76 | + pagination.setParams({ name: workNameDebounce, current: 1 }, true); | |
61 | 77 | }, [workNameDebounce]); |
62 | 78 | |
63 | 79 | return { |
... | ... | @@ -82,5 +98,6 @@ export default function store() { |
82 | 98 | workName, |
83 | 99 | setWorkName, |
84 | 100 | AuthType, |
101 | + ValidType, | |
85 | 102 | }; |
86 | 103 | } | ... | ... |