@cloudbase/weda-ui 3.4.5 → 3.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/configs/components/form/input.json +48 -2
  2. package/dist/configs/components/form/richText.json +2 -1
  3. package/dist/configs/components/form/uploader.json +62 -14
  4. package/dist/configs/components/grid/col.js +4 -1
  5. package/dist/configs/components/grid/grid.js +8 -3
  6. package/dist/configs/components/grid/row.js +51 -3
  7. package/dist/configs/components/repeater.js +4 -1
  8. package/dist/configs/components/table.json +1 -0
  9. package/dist/configs/components/wd-bubble.js +6 -0
  10. package/dist/configs/components/wd-button.js +6 -0
  11. package/dist/configs/components/wd-divider.js +7 -18
  12. package/dist/configs/components/wd-icon.js +7 -0
  13. package/dist/configs/components/wd-image.js +7 -0
  14. package/dist/configs/components/wd-link.js +7 -2
  15. package/dist/configs/components/wd-text.js +14 -6
  16. package/dist/configs/index.js +0 -2
  17. package/dist/docs/common/componentList.js +1 -1
  18. package/dist/web/actions/showModal/index.js +1 -1
  19. package/dist/web/components/calendar/index.js +2 -2
  20. package/dist/web/components/flow/components/index.js +0 -4
  21. package/dist/web/components/flow/frame/index.js +4 -3
  22. package/dist/web/components/flow/frame/types.js +11 -5
  23. package/dist/web/components/flow/frame/utils.js +60 -1
  24. package/dist/web/components/flow/modules/chart/Chart.js +2 -3
  25. package/dist/web/components/flow/modules/combination/index.js +1 -1
  26. package/dist/web/components/flow/modules/operations/components/button/index.js +11 -0
  27. package/dist/web/components/flow/modules/operations/components/button/style.css +5 -0
  28. package/dist/web/components/flow/modules/operations/components/index.js +6 -0
  29. package/dist/web/components/flow/modules/operations/components/popup/index.js +100 -0
  30. package/dist/web/components/flow/modules/operations/components/popup/style.css +154 -0
  31. package/dist/web/components/flow/modules/operations/components/popup/types.js +1 -0
  32. package/dist/web/components/flow/modules/operations/components/user-select/index.js +43 -0
  33. package/dist/web/components/flow/modules/operations/components/user-select/style.css +4 -0
  34. package/dist/web/components/flow/modules/operations/components/user-select/types.js +1 -0
  35. package/dist/web/components/flow/modules/operations/config/approval-form-config.js +140 -0
  36. package/dist/web/components/flow/modules/operations/config/control-config.js +218 -0
  37. package/dist/web/components/flow/modules/operations/config/index.js +2 -0
  38. package/dist/web/components/flow/modules/operations/config/types.js +1 -0
  39. package/dist/web/components/flow/modules/operations/control.js +26 -0
  40. package/dist/web/components/flow/modules/operations/controls-items/add-assignee-btn.js +33 -0
  41. package/dist/web/components/flow/modules/operations/controls-items/apply-cc-btn.js +12 -0
  42. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/comment/index.js +188 -0
  43. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/comment/style.css +51 -0
  44. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/index.js +64 -0
  45. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/types.js +1 -0
  46. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/view-model.js +83 -0
  47. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/field/index.js +16 -0
  48. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/field/style.css +56 -0
  49. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/index.js +47 -0
  50. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/style.css +60 -0
  51. package/dist/web/components/flow/modules/operations/controls-items/cancel-apply-btn.js +15 -0
  52. package/dist/web/components/flow/modules/operations/controls-items/check-list-popup/index.js +11 -0
  53. package/dist/web/components/flow/modules/operations/controls-items/check-list-popup/style.css +26 -0
  54. package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +98 -0
  55. package/dist/web/components/flow/modules/operations/controls-items/index.js +18 -0
  56. package/dist/web/components/flow/modules/operations/controls-items/initiation-btn.js +25 -0
  57. package/dist/web/components/flow/modules/operations/controls-items/revoke-modal/index.js +50 -0
  58. package/dist/web/components/flow/modules/operations/controls-items/revoke-modal/style.css +28 -0
  59. package/dist/web/components/flow/modules/operations/controls-items/roll-back-modal.js +104 -0
  60. package/dist/web/components/flow/modules/operations/controls-items/types.js +1 -0
  61. package/dist/web/components/flow/modules/operations/index.js +2 -0
  62. package/dist/web/components/flow/modules/operations/style.css +20 -0
  63. package/dist/web/components/flow/modules/operations/view-model.js +137 -0
  64. package/dist/web/components/flow/services/ideData/instance.js +2 -2
  65. package/dist/web/components/flow/services/ideData/pageDetail.js +1 -0
  66. package/dist/web/components/form/uploader/index.css +19 -0
  67. package/dist/web/components/form/uploader/index.js +21 -3
  68. package/dist/web/components/form/uploader/uploader.h5.js +14 -8
  69. package/dist/web/components/form/uploader/uploader.pc.js +29 -16
  70. package/dist/web/components/form/uploaderFile/index.css +5 -2
  71. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +15 -12
  72. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +11 -8
  73. package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +0 -1
  74. package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +1 -1
  75. package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +9 -5
  76. package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +4 -2
  77. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -2
  78. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +4 -2
  79. package/dist/web/components/grid/col.js +81 -18
  80. package/dist/web/components/grid/grid.js +1 -1
  81. package/dist/web/components/grid/row.js +4 -2
  82. package/dist/web/components/index.js +1 -1
  83. package/dist/web/components/listView/index.js +4 -3
  84. package/dist/web/components/lottery/index.js +122 -123
  85. package/dist/web/components/table/ExportFileModalByApi/index.js +1 -1
  86. package/dist/web/components/table/ImportFileModal/index.js +1 -1
  87. package/dist/web/components/table/ImportFileModalByApi/index.js +1 -1
  88. package/dist/web/components/wd-bubble/wd-bubble.js +11 -3
  89. package/dist/web/components/wd-button/wd-button.js +22 -13
  90. package/dist/web/components/wd-divider/wd-divider.js +10 -7
  91. package/dist/web/components/wd-icon/wd-icon.js +12 -3
  92. package/dist/web/components/wd-image/index.js +12 -5
  93. package/dist/web/components/wd-link/wd-link.js +11 -3
  94. package/dist/web/components/wd-text/wd-text.js +15 -3
  95. package/dist/web/utils/hooks/use-cloud-id-temp-url.js +7 -3
  96. package/dist/web/utils/platform.js +0 -1
  97. package/dist/web/utils/tool.js +11 -0
  98. package/dist/web/utils/widget-api/index.js +3 -0
  99. package/package.json +5 -3
  100. package/dist/configs/components/auth.json +0 -17
  101. package/dist/web/components/flow/components/FlowUserSelect/index.css +0 -116
  102. package/dist/web/components/flow/components/FlowUserSelect/index.js +0 -115
  103. package/dist/web/components/flow/components/HighlightTextarea/index.css +0 -42
  104. package/dist/web/components/flow/components/HighlightTextarea/index.js +0 -131
  105. package/dist/web/components/flow/components/UserSelectModel/UserSelect.js +0 -72
  106. package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.css +0 -8
  107. package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.js +0 -82
  108. package/dist/web/components/flow/components/UserSelectModel/index.js +0 -18
  109. package/dist/web/components/flow/components/WedaUserTransfer/index.css +0 -3
  110. package/dist/web/components/flow/components/WedaUserTransfer/index.js +0 -162
  111. package/dist/web/components/flow/modules/control/ApprovalDrawer.css +0 -144
  112. package/dist/web/components/flow/modules/control/ApprovalDrawer.js +0 -178
  113. package/dist/web/components/flow/modules/control/ApprovalPopup.css +0 -115
  114. package/dist/web/components/flow/modules/control/ApprovalPopup.js +0 -240
  115. package/dist/web/components/flow/modules/control/Control.css +0 -29
  116. package/dist/web/components/flow/modules/control/Control.js +0 -105
  117. package/dist/web/components/flow/modules/control/ControlMobile.css +0 -101
  118. package/dist/web/components/flow/modules/control/ControlMobile.js +0 -148
  119. package/dist/web/components/flow/modules/control/FlowTaskInfoModal.css +0 -3
  120. package/dist/web/components/flow/modules/control/FlowTaskInfoModal.js +0 -31
  121. package/dist/web/components/flow/modules/control/constants/index.js +0 -35
  122. package/dist/web/components/flow/modules/control/index.js +0 -15
  123. package/dist/web/components/flow/modules/control/provider/index.js +0 -17
  124. package/dist/web/components/flow/modules/control/provider/useControlModel.js +0 -252
  125. package/dist/web/components/flow/modules/control/provider/useMobileModel.js +0 -84
  126. package/dist/web/components/flow/modules/control/provider/useRevokeAndBackHook.js +0 -84
  127. package/dist/web/components/flow/modules/control/utils/ControlModelUtils.js +0 -57
  128. package/dist/web/components/flow/modules/control/utils/index.js +0 -3
  129. package/dist/web/components/flow/modules/control/utils/tools.js +0 -3
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { Drawer, Button, Form } from 'tea-component';
3
+ import { FlowPopup, FlowUserSelect } from '../../../components';
4
+ import { FlowField } from '../field';
5
+ import { FlowComment } from '../comment';
6
+ import { useDrawerFormModel } from './view-model';
7
+ const FormComponents = {
8
+ FlowComment,
9
+ FlowUserSelect,
10
+ };
11
+ export * from './types';
12
+ /** 抽屉表单 */
13
+ export const DrawerForm = (props) => {
14
+ const drawerFormModel = useDrawerFormModel(props.formInfo, props.submit);
15
+ const commonProps = {
16
+ formInfo: props.formInfo,
17
+ drawerFormModel,
18
+ submitLoading: props.submitLoading,
19
+ visible: props.visible,
20
+ onClose: props.onClose,
21
+ };
22
+ if (props.isH5) {
23
+ return React.createElement(DrawerFormH5View, { ...commonProps });
24
+ }
25
+ return React.createElement(DrawerFormPCView, { ...commonProps });
26
+ };
27
+ DrawerForm.displayName = 'DrawerForm';
28
+ /** 抽屉表单PC视图 */
29
+ function DrawerFormPCView(props) {
30
+ const { drawerFormModel, formInfo, visible, onClose } = props;
31
+ return (React.createElement(Drawer, { showMask: true, destroyOnClose: true, size: "l", outerClickClosable: false, visible: visible, onClose: onClose, title: formInfo.formTitle, className: "weda-flow-approval-drawer", footer: React.createElement(React.Fragment, null,
32
+ React.createElement(Button, { type: "primary", onClick: drawerFormModel.onSubmitForm, loading: props.submitLoading }, "\u63D0\u4EA4"),
33
+ React.createElement(Button, { onClick: onClose }, "\u53D6\u6D88")) },
34
+ React.createElement(Form, null, formInfo.formItems.map((formItem) => {
35
+ var _a, _b;
36
+ if (formItem.hidden)
37
+ return;
38
+ if (formItem.readonly) {
39
+ return (React.createElement(Form.Item, { key: formItem.field, label: formItem.label },
40
+ React.createElement(Form.Text, null, formItem.content)));
41
+ }
42
+ const Component = FormComponents[formItem.component];
43
+ return (React.createElement(Form.Item, { label: formItem.label, key: formItem.field, required: formItem.required, showStatusIcon: false, message: ((_a = drawerFormModel.errorMap) === null || _a === void 0 ? void 0 : _a[formItem.field]) ||
44
+ formItem.help ||
45
+ '', status: ((_b = drawerFormModel.errorMap) === null || _b === void 0 ? void 0 : _b[formItem.field]) ? 'error' : 'success' },
46
+ React.createElement(Component, { ...formItem.props, onChange: (value) => drawerFormModel.onFormItemChange(value, formItem) })));
47
+ }))));
48
+ }
49
+ /** 抽屉表单H5视图 */
50
+ function DrawerFormH5View(props) {
51
+ const { drawerFormModel, formInfo, visible, onClose } = props;
52
+ return (React.createElement(FlowPopup, { destroyOnClose: true, closeable: true, position: "bottom", className: "weda-flow-approval-drawer-mobile", overlayStyle: { zIndex: 998 }, height: 550, visible: visible, onClose: onClose, title: formInfo.formTitle },
53
+ formInfo.formItems.map((formItem, index) => {
54
+ var _a, _b;
55
+ if (formItem.hidden)
56
+ return;
57
+ if (formItem.readonly) {
58
+ return (React.createElement(FlowField, { key: formItem.field, content: formItem.content, label: formItem.label, bordered: index !== formInfo.formItems.length - 1 }));
59
+ }
60
+ const Component = FormComponents[formItem.component];
61
+ return (React.createElement(FlowField, { key: formItem.field, label: formItem.label, required: formItem.required, errorMessage: ((_a = drawerFormModel.errorMap) === null || _a === void 0 ? void 0 : _a[formItem.field]) || '', bordered: index !== formInfo.formItems.length - 1, layout: ((_b = formItem === null || formItem === void 0 ? void 0 : formItem.extra) === null || _b === void 0 ? void 0 : _b.isH5Vertical) ? 'vertical' : 'horizontal', content: React.createElement(Component, { ...formItem.props, onChange: (value) => drawerFormModel.onFormItemChange(value, formItem) }) }));
62
+ }),
63
+ React.createElement(Button, { type: "primary", onClick: drawerFormModel.onSubmitForm, className: "submit", loading: props.submitLoading }, "\u63D0\u4EA4")));
64
+ }
@@ -0,0 +1,83 @@
1
+ import { useEffect, useState, useRef } from 'react';
2
+ /** 审批表单model */
3
+ export function useDrawerFormModel(formInfo, submit) {
4
+ const [visible, setVisible] = useState(false);
5
+ const onOpenDrawer = () => setVisible(true);
6
+ const onCloseDrawer = () => {
7
+ resetFormStatus();
8
+ setVisible(false);
9
+ };
10
+ /** 错误信息Map */
11
+ const [errorMap, setErrorMap] = useState({});
12
+ /** 存储表单值的对象 */
13
+ const formValueRef = useRef({});
14
+ useEffect(() => {
15
+ var _a;
16
+ // 初始化默认值
17
+ visible &&
18
+ ((_a = formInfo === null || formInfo === void 0 ? void 0 : formInfo.formItems) === null || _a === void 0 ? void 0 : _a.forEach((formItem) => {
19
+ var _a;
20
+ if (formItem.readonly)
21
+ return;
22
+ formValueRef.current[formItem.field] =
23
+ (_a = formItem === null || formItem === void 0 ? void 0 : formItem.defaultValue) !== null && _a !== void 0 ? _a : undefined;
24
+ }));
25
+ // eslint-disable-next-line react-hooks/exhaustive-deps
26
+ }, [visible]);
27
+ /** 提交表单值 */
28
+ const onSubmitForm = () => {
29
+ const { errorMap, hasError } = validateFormValues();
30
+ setErrorMap(errorMap);
31
+ if (hasError)
32
+ return;
33
+ submit === null || submit === void 0 ? void 0 : submit({
34
+ ...formValueRef.current,
35
+ ...(formInfo.submitDefaultValues || {}),
36
+ });
37
+ };
38
+ /** 表单项值变更 */
39
+ const onFormItemChange = (value, formItem) => {
40
+ const { field, transform, validate } = formItem;
41
+ const itemValue = { [field]: transform ? transform === null || transform === void 0 ? void 0 : transform(value) : value };
42
+ formValueRef.current = {
43
+ ...formValueRef.current,
44
+ ...itemValue,
45
+ };
46
+ setErrorMap({
47
+ ...errorMap,
48
+ [field]: (validate === null || validate === void 0 ? void 0 : validate(value)) || undefined,
49
+ });
50
+ };
51
+ /** 验证表单所有值 */
52
+ const validateFormValues = () => {
53
+ let newErrorMap = {};
54
+ let hasError = false;
55
+ formInfo.formItems.forEach((config) => {
56
+ var _a, _b;
57
+ if (config.readonly)
58
+ return;
59
+ const currentFieldValue = (_a = formValueRef.current) === null || _a === void 0 ? void 0 : _a[config.field];
60
+ const checkResult = (_b = config.validate) === null || _b === void 0 ? void 0 : _b.call(config, currentFieldValue);
61
+ newErrorMap = {
62
+ ...errorMap,
63
+ [config.field]: checkResult || '',
64
+ };
65
+ hasError = !!checkResult;
66
+ });
67
+ return { errorMap: newErrorMap, hasError };
68
+ };
69
+ /** 重置表单状态 */
70
+ const resetFormStatus = () => {
71
+ setErrorMap({});
72
+ formValueRef.current = {};
73
+ };
74
+ return {
75
+ visible,
76
+ errorMap,
77
+ onOpenDrawer,
78
+ onCloseDrawer,
79
+ resetFormStatus,
80
+ onSubmitForm,
81
+ onFormItemChange,
82
+ };
83
+ }
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import classNames from '../../../../../../../utils/classnames';
3
+ import './style.css';
4
+ export function FlowField(props) {
5
+ const { label = '', content = '', required = false, errorMessage = '', className = '', layout = 'horizontal', bordered = true, } = props;
6
+ const outerClassNames = classNames('weda-flow-field', className, {
7
+ ['bordered']: bordered,
8
+ ['vertical']: layout === 'vertical',
9
+ ['horizontal']: layout === 'horizontal',
10
+ });
11
+ return (React.createElement("div", { className: outerClassNames },
12
+ React.createElement("div", { className: `weda-flow-field-label ${required ? 'required' : ''}` }, label),
13
+ React.createElement("div", { className: "weda-flow-field-content" },
14
+ content,
15
+ errorMessage ? (React.createElement("div", { className: "weda-flow-field-error" }, errorMessage)) : null)));
16
+ }
@@ -0,0 +1,56 @@
1
+ .weda-flow-field {
2
+ padding: 12px 24px;
3
+ position: relative;
4
+ display: flex;
5
+ }
6
+
7
+ .weda-flow-field.bordered::after {
8
+ content: '';
9
+ border-bottom: 1px solid #dcdee6;
10
+ position: absolute;
11
+ box-sizing: border-box;
12
+ content: ' ';
13
+ pointer-events: none;
14
+ right: 16px;
15
+ bottom: 0;
16
+ left: 16px;
17
+ border-bottom: 1px solid #dcdee6;
18
+ transform: scaleY(0.5);
19
+ }
20
+
21
+ .weda-flow-field.vertical {
22
+ flex-direction: column;
23
+ }
24
+
25
+ .weda-flow-field.horizontal {
26
+ align-items: flex-start;
27
+ }
28
+
29
+ .weda-flow-field-label {
30
+ text-align: left;
31
+ word-wrap: break-word;
32
+ width: 6em;
33
+ color: #646566;
34
+ margin-right: 12px;
35
+ display: flex;
36
+ align-items: center;
37
+ position: relative;
38
+ }
39
+
40
+ .weda-flow-field-label.required::before {
41
+ position: absolute;
42
+ left: -7px;
43
+ color: #f44336;
44
+ font-size: 14px;
45
+ content: '*';
46
+ }
47
+
48
+ .weda-flow-field-content {
49
+ display: flex;
50
+ flex-direction: column;
51
+ }
52
+
53
+ .weda-flow-field-error {
54
+ color: #f44336;
55
+ font-size: 12px;
56
+ }
@@ -0,0 +1,47 @@
1
+ import React, { useState } from 'react';
2
+ import { message } from 'tea-component';
3
+ import { FlowButton } from '../../components';
4
+ import { DrawerForm } from './drawer-form';
5
+ import './style.css';
6
+ /**
7
+ * 审批类型弹窗 可用于同意、拒绝、处理、转办 这几个操作
8
+ */
9
+ export function ApprovalDrawer(props) {
10
+ const { isH5 } = props.flowFrameCommonProps.flowLocalProps;
11
+ const [submitLoading, setSubmitLoading] = useState(false);
12
+ const [visible, setVisible] = useState(false);
13
+ const onOpenDrawerForm = () => setVisible(true);
14
+ const onCloseDrawerForm = () => setVisible(false);
15
+ const onDrawerFormSubmit = (formValues) => {
16
+ let values = {};
17
+ Object.keys(formValues).forEach((key) => {
18
+ if (key === 'comment') {
19
+ values = {
20
+ ...values,
21
+ ...formValues.comment,
22
+ };
23
+ }
24
+ else {
25
+ values[key] = formValues[key];
26
+ }
27
+ });
28
+ props.flowControlModel.completeTask({
29
+ actionKey: props.actionKey,
30
+ afterAction: props.afterAction,
31
+ buttonAction: props.buttonAction,
32
+ data: values,
33
+ setLoadingState(state) {
34
+ setSubmitLoading(state);
35
+ },
36
+ successCallback() {
37
+ onCloseDrawerForm();
38
+ message.success({
39
+ content: `${props.label}成功`,
40
+ });
41
+ },
42
+ });
43
+ };
44
+ return (React.createElement(React.Fragment, null,
45
+ React.createElement(FlowButton, { ...props.buttonProps, buttonIcon: props.buttonIcon, id: props.id, onClick: onOpenDrawerForm }, props.label),
46
+ React.createElement(DrawerForm, { visible: visible, formInfo: props.approvalFormInfo, submit: onDrawerFormSubmit, isH5: isH5, submitLoading: submitLoading, onClose: onCloseDrawerForm })));
47
+ }
@@ -0,0 +1,60 @@
1
+ .weda-flow-approval-drawer.wedatea2td-drawer {
2
+ width: 500px !important;
3
+ top: 0 !important;
4
+ background-color: #fff;
5
+ }
6
+
7
+ .weda-flow-approval-drawer .wedatea2td-form {
8
+ display: block;
9
+ }
10
+
11
+ .weda-flow-approval-drawer .wedatea2td-form .wedatea2td-form__controls {
12
+ font-size: 12px;
13
+ }
14
+ .weda-flow-approval-drawer .wedatea2td-form .wedatea2td-form__label label {
15
+ color: #666;
16
+ }
17
+
18
+ .weda-flow-approval-drawer .wedatea2td-drawer__footer {
19
+ flex: 0 0 76px;
20
+ padding: 20px;
21
+ display: flex;
22
+ gap: 10px;
23
+ }
24
+
25
+ .weda-flow-approval-drawer .wedatea2td-drawer__footer button {
26
+ height: 36px;
27
+ width: 106px;
28
+ }
29
+ .weda-flow-approval-user-select .wedatea2td-form__label {
30
+ display: none;
31
+ }
32
+ .weda-flow-approval-user-select .wedatea2td-form__controls {
33
+ padding-top: 0;
34
+ }
35
+ .weda-flow-approval-user-select .wedatea2td-dropdown__header {
36
+ width: 100% !important;
37
+ }
38
+
39
+ /* 以下为移动视图样式 */
40
+
41
+ .weda-flow-approval-drawer-mobile {
42
+ z-index: 998 !important;
43
+ }
44
+
45
+ .weda-flow-approval-drawer-mobile .weda-flow-field {
46
+ margin-top: 12px;
47
+ }
48
+ .weda-flow-approval-drawer-mobile .weda-ui-user-select-input {
49
+ padding: 0;
50
+ }
51
+
52
+ .weda-flow-approval-drawer-mobile .submit {
53
+ position: absolute;
54
+ bottom: 30px;
55
+ height: 40px;
56
+ line-height: 40px;
57
+ width: 80%;
58
+ left: 50%;
59
+ transform: translateX(-50%);
60
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { getPageQuery } from '../../../../../utils/getPageQuery';
3
+ import { FlowButton } from '../components';
4
+ /**
5
+ * 取消申请
6
+ */
7
+ export function CancelApplyBtn(props) {
8
+ return (React.createElement(FlowButton, { ...props.buttonProps, buttonIcon: props.buttonIcon, id: props.id, onClick: navigateToFlowCenter }, props.label));
9
+ }
10
+ /** 返回流程中心 */
11
+ function navigateToFlowCenter() {
12
+ const { origin, pathname } = location;
13
+ const { envType } = getPageQuery();
14
+ window.location.href = `${origin}${pathname}#/flowCenter?envType=${envType}`;
15
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Button } from 'tea-component';
3
+ import { FlowPopup } from '../../components';
4
+ import './style.css';
5
+ /** 单双选弹窗(Popup)容器 */
6
+ export function FlowCheckListPopup(props) {
7
+ const { confirmButtonProps, confirmButtonText = '确认', ...restProps } = props;
8
+ return (React.createElement(FlowPopup, { position: "bottom", closeable: true, className: "weda-flow-checklist-popup", closeContentPosition: "top-left", closeContent: "\u53D6\u6D88", ...restProps },
9
+ React.createElement("div", { className: "weda-flow-checklist-body" }, props.children || null),
10
+ React.createElement(Button, { type: "link", className: "weda-flow-checklist-confirm", ...confirmButtonProps }, confirmButtonText)));
11
+ }
@@ -0,0 +1,26 @@
1
+ .weda-flow-checklist-popup {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+ .weda-flow-checklist-body {
6
+ flex: 1;
7
+ overflow-y: auto;
8
+ padding: 0 16px;
9
+ }
10
+ .weda-flow-checklist-body .wedatea2td-form-check-group {
11
+ display: block;
12
+ }
13
+ .weda-flow-checklist-body .wedatea2td-form-check {
14
+ border-bottom: 0.5px solid #e7e7e7;
15
+ padding: 12px 0;
16
+ position: relative;
17
+ display: flex;
18
+ margin: 0 !important;
19
+ }
20
+
21
+ .weda-flow-checklist-confirm {
22
+ position: absolute;
23
+ top: 20px;
24
+ right: 20px;
25
+ font-size: 14px;
26
+ }
@@ -0,0 +1,98 @@
1
+ import React, { useRef, useEffect, useState } from 'react';
2
+ import { Modal, SelectMultiple, Button, Form, Checkbox } from 'tea-component';
3
+ import { FlowCheckListPopup } from './check-list-popup';
4
+ /**
5
+ * 选择下一节点审批人弹窗
6
+ */
7
+ export const FlowTaskInfoModal = (props) => {
8
+ const { isH5, visible, flowTaskInfoList, selectedTaskIds, setSelectedTaskIds, onSubmitTaskIds, } = useFlowTaskInfoModel(props);
9
+ const options = flowTaskInfoList.map((item) => ({
10
+ text: item === null || item === void 0 ? void 0 : item.assigneeName,
11
+ value: item === null || item === void 0 ? void 0 : item.waitFlowTaskId,
12
+ }));
13
+ const renderModal = () => {
14
+ return (React.createElement(Modal, { visible: visible, caption: props.label, onClose: () => onSubmitTaskIds(), size: "auto" },
15
+ React.createElement(Modal.Body, null,
16
+ React.createElement(Form, { style: { marginBottom: '5px' } },
17
+ React.createElement(Form.Item, { label: "\u9009\u62E9\u5904\u7406\u4EBA" },
18
+ React.createElement(SelectMultiple, { searchable: true, matchButtonWidth: true, appearance: "button", size: "full", style: { width: 300 }, staging: false, options: options, value: selectedTaskIds, onChange: (value) => setSelectedTaskIds(value) })))),
19
+ React.createElement(Modal.Footer, null,
20
+ React.createElement(Button, { type: "primary", onClick: () => onSubmitTaskIds(false), disabled: !selectedTaskIds.length }, "\u786E\u5B9A"),
21
+ React.createElement(Button, { type: "weak", onClick: () => onSubmitTaskIds() }, "\u53D6\u6D88"))));
22
+ };
23
+ const renderPopup = () => {
24
+ return (React.createElement(FlowCheckListPopup, { visible: visible, onClose: () => onSubmitTaskIds(), title: props.label, overlayStyle: { zIndex: 998 }, height: 550, confirmButtonProps: {
25
+ disabled: !selectedTaskIds.length,
26
+ onClick: () => onSubmitTaskIds(false),
27
+ } },
28
+ React.createElement(Checkbox.Group, { value: selectedTaskIds, onChange: (value) => setSelectedTaskIds(value), layout: "column" }, options.map((option) => (React.createElement(Checkbox, { name: option.value, key: option.value }, option.text))))));
29
+ };
30
+ return React.createElement(React.Fragment, null,
31
+ " ",
32
+ isH5 ? renderPopup() : renderModal());
33
+ };
34
+ /** 下一节点审批人model */
35
+ function useFlowTaskInfoModel(params) {
36
+ const { flowRequest, isH5 } = params.flowFrameCommonProps.flowLocalProps;
37
+ const { onAfterFinishFlowAction } = params.flowControlModel;
38
+ /** 弹框是否可见 */
39
+ const [visible, setVisible] = useState(false);
40
+ /** 审批人列表 */
41
+ const [flowTaskInfoList, setFlowTaskInfoList] = useState([]);
42
+ /** 已选任务数组 */
43
+ const [selectedTaskIds, setSelectedTaskIds] = useState([]);
44
+ const timer = useRef(null);
45
+ useEffect(() => {
46
+ return () => {
47
+ cleanTiming();
48
+ };
49
+ }, []);
50
+ useEffect(() => {
51
+ if (params.flowControlModel.triggerFlowTaskInfo) {
52
+ const { toBeSubmittedFlowTaskInfo } = params.flowControlModel.triggerFlowTaskInfo || {};
53
+ setVisible(true);
54
+ setFlowTaskInfoList(toBeSubmittedFlowTaskInfo || []);
55
+ timingSubmit();
56
+ }
57
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58
+ }, [params.flowControlModel.triggerFlowTaskInfo]);
59
+ const cleanTiming = () => {
60
+ clearTimeout(timer.current);
61
+ };
62
+ /** 审批人列表提交 */
63
+ const submitFlowTaskList = async (flowTaskIds) => {
64
+ const result = await flowRequest({
65
+ action: 'SubmitFlowTaskList',
66
+ data: { flowTaskIds },
67
+ });
68
+ if (result === null || result === void 0 ? void 0 : result.status) {
69
+ setVisible(false);
70
+ setSelectedTaskIds([]);
71
+ cleanTiming();
72
+ // 执行完成后自定义动作
73
+ onAfterFinishFlowAction(params.actionKey, params.afterAction);
74
+ }
75
+ };
76
+ /** 定时提交 */
77
+ const timingSubmit = () => {
78
+ // eslint-disable-next-line rulesdir/no-timer
79
+ timer.current = setTimeout(() => {
80
+ submitFlowTaskList();
81
+ }, 600000);
82
+ };
83
+ /** 提交按钮动作 */
84
+ const onSubmitTaskIds = (isCancel = true) => {
85
+ const taskIds = isCancel
86
+ ? flowTaskInfoList.map((i) => i === null || i === void 0 ? void 0 : i.waitFlowTaskId)
87
+ : selectedTaskIds;
88
+ submitFlowTaskList(taskIds);
89
+ };
90
+ return {
91
+ isH5,
92
+ selectedTaskIds,
93
+ visible,
94
+ flowTaskInfoList,
95
+ setSelectedTaskIds,
96
+ onSubmitTaskIds,
97
+ };
98
+ }
@@ -0,0 +1,18 @@
1
+ import { AddAssigneeBtn } from './add-assignee-btn';
2
+ import { ApplyCcBtn } from './apply-cc-btn';
3
+ import { ApprovalDrawer } from './approval-drawer';
4
+ import { CancelApplyBtn } from './cancel-apply-btn';
5
+ import { FlowTaskInfoModal } from './flow-task-info-modal';
6
+ import { InitiationBtn } from './initiation-btn';
7
+ import { RevokeModal } from './revoke-modal';
8
+ import { RollbackModal } from './roll-back-modal';
9
+ export const CONTROL_COMPONENT = {
10
+ AddAssigneeBtn,
11
+ ApplyCcBtn,
12
+ ApprovalDrawer,
13
+ CancelApplyBtn,
14
+ FlowTaskInfoModal,
15
+ InitiationBtn,
16
+ RevokeModal,
17
+ RollbackModal,
18
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { message } from 'tea-component';
3
+ import { FlowButton } from '../components';
4
+ /**
5
+ * 发起阶段按钮、可用于保存草稿和提交申请两个操作
6
+ */
7
+ export function InitiationBtn(props) {
8
+ const { flowControlModel } = props;
9
+ const onClick = () => {
10
+ var _a;
11
+ const ccUserIds = (_a = flowControlModel.applyCcUser) === null || _a === void 0 ? void 0 : _a.join();
12
+ flowControlModel.completeTask({
13
+ actionKey: props.actionKey,
14
+ buttonAction: props.buttonAction,
15
+ afterAction: props.afterAction,
16
+ data: { ccUserIds },
17
+ successCallback: () => {
18
+ message.success({
19
+ content: `${props.label}成功`,
20
+ });
21
+ },
22
+ });
23
+ };
24
+ return (React.createElement(FlowButton, { ...props.buttonProps, buttonIcon: props.buttonIcon, id: props.id, onClick: onClick }, props.label));
25
+ }
@@ -0,0 +1,50 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Modal, message } from 'tea-component';
3
+ import { FlowPopup, FlowButton } from '../../components';
4
+ import './style.css';
5
+ export function RevokeModal(props) {
6
+ const { flowFrameCommonProps, flowControlModel } = props;
7
+ const { flowRequest, isH5, currentPageType } = flowFrameCommonProps.flowLocalProps;
8
+ const { flowDetail } = flowFrameCommonProps.commonFlowData;
9
+ const { onAfterFinishFlowAction } = flowControlModel;
10
+ const [visible, setVisible] = useState(false);
11
+ const onOpen = () => setVisible(true);
12
+ const onClose = () => setVisible(false);
13
+ /** 撤销请求 */
14
+ const revoke = async () => {
15
+ const result = await flowRequest({
16
+ action: 'Revoke',
17
+ data: {
18
+ flowCode: flowDetail.flowCode,
19
+ appVersion: flowDetail.flowVersion,
20
+ instanceId: flowDetail.instanceId,
21
+ revokeType: currentPageType === 'CREATE' ? 2 : 1,
22
+ taskId: currentPageType === 'DONE' ? flowDetail.taskId : undefined,
23
+ },
24
+ });
25
+ if (result) {
26
+ message.success({
27
+ content: `${props.label}成功`,
28
+ });
29
+ onAfterFinishFlowAction(props.actionKey, props.afterAction);
30
+ }
31
+ };
32
+ const renderModal = () => {
33
+ return (React.createElement(Modal, { visible: visible, caption: "\u64A4\u9500\u6D41\u7A0B\u63D0\u9192", onClose: onClose },
34
+ React.createElement(Modal.Body, null, "\u6D41\u7A0B\u6B63\u5728\u8FDB\u884C\u4E2D\uFF0C\u786E\u8BA4\u64A4\u9500\u6B64\u6D41\u7A0B\uFF1F"),
35
+ React.createElement(Modal.Footer, null,
36
+ React.createElement(Button, { type: "primary", onClick: revoke }, "\u786E\u5B9A"),
37
+ React.createElement(Button, { type: "weak", onClick: onClose }, "\u53D6\u6D88"))));
38
+ };
39
+ const renderPopup = () => {
40
+ return (React.createElement(FlowPopup, { visible: visible, onClose: onClose, title: "\u64A4\u9500\u6D41\u7A0B\u63D0\u9192", overlayStyle: { zIndex: 998 }, width: "80%", className: "weda-flow-revoke-popup" },
41
+ React.createElement("div", { className: "weda-flow-revoke-tip" },
42
+ React.createElement("div", { className: "weda-flow-revoke-content" }, "\u6D41\u7A0B\u6B63\u5728\u8FDB\u884C\u4E2D\uFF0C\u786E\u8BA4\u64A4\u9500\u6B64\u6D41\u7A0B\uFF1F"),
43
+ React.createElement("div", { className: "weda-flow-revoke-confirm" },
44
+ React.createElement(Button, { type: "text", onClick: onClose }, "\u53D6\u6D88"),
45
+ React.createElement(Button, { type: "link", onClick: revoke }, "\u786E\u8BA4")))));
46
+ };
47
+ return (React.createElement(React.Fragment, null,
48
+ React.createElement(FlowButton, { ...props.buttonProps, buttonIcon: props.buttonIcon, id: props.id, onClick: onOpen }, props.label),
49
+ isH5 ? renderPopup() : renderModal()));
50
+ }
@@ -0,0 +1,28 @@
1
+ .weda-flow-revoke-popup {
2
+ border-radius: 4px;
3
+ width: 80%;
4
+ }
5
+ .weda-flow-revoke-content {
6
+ color: #0009;
7
+ font-size: 16px;
8
+ line-height: 24px;
9
+ max-height: 288px;
10
+ overflow: auto;
11
+ padding: 0 24px;
12
+ text-align: center;
13
+ }
14
+
15
+ .weda-flow-revoke-confirm {
16
+ display: flex;
17
+ border-top: 1px solid #eee;
18
+ margin-top: 32px;
19
+ }
20
+
21
+ .weda-flow-revoke-confirm button {
22
+ width: 50%;
23
+ height: 56px;
24
+ }
25
+
26
+ .weda-flow-revoke-confirm button:first-child {
27
+ border-right: 1px solid #eee;
28
+ }