zy-react-library 1.1.1 → 1.1.2
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.
- package/README.md +5 -1
- package/components/Cascader/Area/index.js +11 -11
- package/components/Cascader/Basic/index.js +23 -30
- package/components/Cascader/Dictionary/index.js +42 -42
- package/components/Cascader/Industry/index.js +12 -11
- package/components/Editor/index.js +43 -63
- package/components/FormBuilder/FormBuilder.js +97 -87
- package/components/FormBuilder/FormItemsRenderer.js +579 -581
- package/components/FormBuilder/index.js +5 -3
- package/components/HeaderBack/index.js +39 -32
- package/components/HiddenInfo/gwj/index.js +507 -439
- package/components/Icon/AddIcon/index.js +6 -6
- package/components/Icon/BackIcon/index.js +6 -6
- package/components/Icon/DeleteIcon/index.js +6 -6
- package/components/Icon/DownloadIcon/index.js +6 -6
- package/components/Icon/EditIcon/index.js +6 -6
- package/components/Icon/ExportIcon/index.js +6 -6
- package/components/Icon/ImportIcon/index.js +6 -6
- package/components/Icon/LocationIcon/index.js +6 -6
- package/components/Icon/PrintIcon/index.js +6 -6
- package/components/Icon/ResetIcon/index.js +6 -6
- package/components/Icon/SearchIcon/index.js +6 -6
- package/components/Icon/VideoIcon/index.js +6 -6
- package/components/Icon/ViewIcon/index.js +6 -6
- package/components/ImportFile/index.js +94 -91
- package/components/LeftTree/Area/index.js +15 -15
- package/components/LeftTree/Basic/index.js +54 -65
- package/components/LeftTree/Department/Gwj/index.js +29 -32
- package/components/LeftTree/Dictionary/index.js +42 -42
- package/components/Map/MapSelector.js +280 -254
- package/components/Map/index.js +90 -77
- package/components/Page/index.js +43 -34
- package/components/Pdf/index.js +92 -90
- package/components/PreviewImg/index.js +26 -32
- package/components/PreviewPdf/index.js +78 -86
- package/components/Search/index.js +147 -141
- package/components/Select/Basic/index.js +70 -76
- package/components/Select/Dictionary/index.js +42 -42
- package/components/Select/Personnel/Gwj/index.js +45 -49
- package/components/SelectCreate/index.js +33 -40
- package/components/SelectTree/Area/index.js +11 -17
- package/components/SelectTree/Basic/index.js +105 -102
- package/components/SelectTree/Department/Gwj/index.js +40 -46
- package/components/SelectTree/Dictionary/index.js +42 -42
- package/components/SelectTree/HiddenLevel/Gwj/index.js +33 -35
- package/components/SelectTree/HiddenPart/Gwj/index.js +16 -19
- package/components/SelectTree/Industry/index.js +12 -18
- package/components/Signature/index.js +68 -62
- package/components/Table/index.js +77 -73
- package/components/Table/index.less +7 -1
- package/components/TooltipPreviewImg/index.js +28 -27
- package/components/Upload/index.js +229 -275
- package/components/Video/AliPlayer.js +182 -160
- package/components/Video/index.js +71 -90
- package/css/common.less +4 -0
- package/enum/dictionary/index.js +5 -3
- package/enum/formItemRender/index.js +37 -35
- package/enum/hidden/gwj/index.js +65 -26
- package/enum/uploadFile/gwj/index.js +166 -84
- package/hooks/useDeleteFile/index.js +24 -30
- package/hooks/useDictionary/index.js +28 -30
- package/hooks/useDownloadBlob/index.js +78 -77
- package/hooks/useDownloadFile/index.js +76 -79
- package/hooks/useGetFile/index.js +32 -32
- package/hooks/useGetUrlQuery/index.js +1 -2
- package/hooks/useGetUserInfo/index.js +19 -26
- package/hooks/useIdle/index.js +9 -11
- package/hooks/useImportFile/index.js +30 -28
- package/hooks/useIsExistenceDuplicateSelection/index.js +25 -18
- package/hooks/useTable/index.js +49 -38
- package/hooks/useUploadFile/index.js +142 -147
- package/hooks/useUrlQueryCriteria/index.js +20 -13
- package/package.json +14 -1
- package/regular/index.js +34 -39
- package/utils/index.js +515 -511
package/enum/hidden/gwj/index.js
CHANGED
|
@@ -1,31 +1,70 @@
|
|
|
1
1
|
// 隐患来源
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const HIDDEN_SOURCE_ENUM = [{
|
|
3
|
+
bianma: "1",
|
|
4
|
+
name: "隐患快报"
|
|
5
|
+
}, {
|
|
6
|
+
bianma: "2",
|
|
7
|
+
name: "清单排查"
|
|
8
|
+
}, {
|
|
9
|
+
bianma: "4",
|
|
10
|
+
name: "安全环保检查(监管端)"
|
|
11
|
+
}, {
|
|
12
|
+
bianma: "5",
|
|
13
|
+
name: "安全环保检查(企业端)"
|
|
14
|
+
}, {
|
|
15
|
+
bianma: "6",
|
|
16
|
+
name: "消防检查"
|
|
17
|
+
}];
|
|
9
18
|
|
|
10
19
|
// 隐患状态
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const HIDDEN_STATE_ENUM = [{
|
|
21
|
+
bianma: "100",
|
|
22
|
+
name: "待确认"
|
|
23
|
+
}, {
|
|
24
|
+
bianma: "200",
|
|
25
|
+
name: "待整改"
|
|
26
|
+
}, {
|
|
27
|
+
bianma: "201",
|
|
28
|
+
name: "确认打回"
|
|
29
|
+
}, {
|
|
30
|
+
bianma: "202",
|
|
31
|
+
name: "特殊处置"
|
|
32
|
+
}, {
|
|
33
|
+
bianma: "300",
|
|
34
|
+
name: "待验收"
|
|
35
|
+
}, {
|
|
36
|
+
bianma: "301",
|
|
37
|
+
name: "已验收"
|
|
38
|
+
}, {
|
|
39
|
+
bianma: "302",
|
|
40
|
+
name: "验收打回"
|
|
41
|
+
}, {
|
|
42
|
+
bianma: "400",
|
|
43
|
+
name: "归档"
|
|
44
|
+
}, {
|
|
45
|
+
bianma: "99",
|
|
46
|
+
name: "关闭"
|
|
47
|
+
}, {
|
|
48
|
+
bianma: "98",
|
|
49
|
+
name: "安全环保检查/清单排查暂存"
|
|
50
|
+
}, {
|
|
51
|
+
bianma: "102",
|
|
52
|
+
name: "安全环保检查,隐患带指派"
|
|
53
|
+
}, {
|
|
54
|
+
bianma: "97",
|
|
55
|
+
name: "已过期"
|
|
56
|
+
}, {
|
|
57
|
+
bianma: "101",
|
|
58
|
+
name: "忽略隐患"
|
|
59
|
+
}];
|
|
26
60
|
|
|
27
61
|
// 隐患整改类型
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
62
|
+
const HIDDEN_RECTIFICATION_TYPE_ENUM = [{
|
|
63
|
+
bianma: 1,
|
|
64
|
+
name: "立即整改"
|
|
65
|
+
}, {
|
|
66
|
+
bianma: 2,
|
|
67
|
+
name: "限期整改"
|
|
68
|
+
}];
|
|
69
|
+
|
|
70
|
+
export { HIDDEN_RECTIFICATION_TYPE_ENUM, HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM };
|
|
@@ -4,94 +4,174 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* 文件上传类型枚举
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
10: 10,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
7
|
+
const UPLOAD_FILE_TYPE_ENUM = {
|
|
8
|
+
10: 10,
|
|
9
|
+
// labor_contract_image - 劳动合同图片
|
|
10
|
+
11: 11,
|
|
11
|
+
// commercial_insurance_image - 商业保险图片
|
|
12
|
+
12: 12,
|
|
13
|
+
// certificate_information - 证书信息
|
|
14
|
+
13: 13,
|
|
15
|
+
// user_avatar - 用户头像
|
|
16
|
+
14: 14,
|
|
17
|
+
// id_card_photo - 身份证照片
|
|
18
|
+
15: 15,
|
|
19
|
+
// social_security_card_photo - 社保卡照片
|
|
20
|
+
16: 16,
|
|
21
|
+
// work_related_injury_insurance_certificate - 工伤保险凭证
|
|
22
|
+
19: 19,
|
|
23
|
+
// three_level_safety_education_training - 三级教育培训
|
|
24
|
+
601: 601,
|
|
25
|
+
// gate_access_vehicle_license_photo - 门口门禁车辆行驶证照片
|
|
26
|
+
602: 602,
|
|
27
|
+
// gate_access_vehicle_photo - 门口门禁车辆车辆照片
|
|
28
|
+
603: 603,
|
|
29
|
+
// gate_access_vehicle_attachment - 门口门禁车辆附件
|
|
30
|
+
604: 604,
|
|
31
|
+
// emission_standard_certificate - 排放标准证明
|
|
32
|
+
605: 605,
|
|
33
|
+
// motor_vehicle_registration_certificate_green_book - 机动车登记证书(绿本)
|
|
34
|
+
3: 3,
|
|
35
|
+
// hidden_danger_photo - 隐患照片
|
|
36
|
+
4: 4,
|
|
37
|
+
// hidden_danger_rectification_photo - 隐患整改照片
|
|
38
|
+
5: 5,
|
|
39
|
+
// hidden_danger_verification_photo - 隐患验证照片
|
|
40
|
+
6: 6,
|
|
41
|
+
// certificate_photo - 证书照片
|
|
42
|
+
7: 7,
|
|
43
|
+
// confined_space_plan - 受限空间平面图
|
|
44
|
+
8: 8,
|
|
45
|
+
// hidden_danger_rectification_plan - 隐患整改方案图
|
|
46
|
+
9: 9,
|
|
47
|
+
// confined_space_confirmation_signature - 有限空间确认人签字
|
|
48
|
+
17: 17,
|
|
49
|
+
// special_equipment_inspection_photo - 特种设备巡检照片
|
|
50
|
+
18: 18,
|
|
51
|
+
// personnel_certificate - 人员证书
|
|
52
|
+
20: 20,
|
|
53
|
+
// major_hazard_source_alarm_before_handling_photo - 重大危险源报警处置前照片
|
|
54
|
+
21: 21,
|
|
55
|
+
// major_hazard_source_alarm_after_handling_photo - 重大危险源报警处置后照片
|
|
56
|
+
22: 22,
|
|
57
|
+
// smart_access_control_external_vehicle_driver_license_photo - 智能门禁外来车辆驾驶证照片
|
|
58
|
+
23: 23,
|
|
59
|
+
// smart_access_control_external_vehicle_registration_photo - 智能门禁外来车辆行驶证照片
|
|
60
|
+
50: 50,
|
|
61
|
+
// safety_and_environmental_inspection_final_acceptance_image - 安全环保检查终验图片
|
|
62
|
+
101: 101,
|
|
63
|
+
// hidden_danger_extension_temporary_measures_attachment - 隐患延期临时措施附件
|
|
64
|
+
102: 102,
|
|
65
|
+
// hidden_danger_video - 隐患视频
|
|
66
|
+
105: 105,
|
|
67
|
+
// blind_plate_position_map - 盲板位置图
|
|
68
|
+
106: 106,
|
|
69
|
+
// temporary_disposal_information - 临时处置信息
|
|
70
|
+
107: 107,
|
|
71
|
+
// rectification_suggestions_and_plan - 整改建议及方案
|
|
72
|
+
108: 108,
|
|
73
|
+
// major_hidden_danger_investigation_report - 重大隐患上传隐患调查报告
|
|
74
|
+
109: 109,
|
|
75
|
+
// major_hidden_danger_safety_committee_or_party_committee_resolution_record - 重大隐患安委会或党委会决议记录
|
|
76
|
+
110: 110,
|
|
77
|
+
// significant_hidden_danger_rectification_temporary_disposal_measures - 较大隐患整改-临时处置措施
|
|
78
|
+
111: 111,
|
|
79
|
+
// significant_hidden_danger_rectification_hidden_danger_rectification_process_record - 较大隐患整改-隐患整改过程记录
|
|
80
|
+
112: 112,
|
|
81
|
+
// supplement_major_hidden_danger_information - 补充重大隐患信息
|
|
82
|
+
113: 113,
|
|
83
|
+
// safety_committee_office_meeting_record - 安委会办公室会议记录
|
|
84
|
+
114: 114,
|
|
85
|
+
// alarm_photo - 报警图片
|
|
86
|
+
115: 115,
|
|
87
|
+
// fire_equipment_type_qualification_photo - 消防器材类型合格表中照片
|
|
88
|
+
116: 116,
|
|
89
|
+
// hot_work_personnel_photo - 动火人图片
|
|
90
|
+
117: 117,
|
|
91
|
+
// safety_pledge_signature - 安全承诺书签名
|
|
92
|
+
118: 118,
|
|
93
|
+
// hot_work_unit_responsible_person_confirmation_signature - 动火单位负责人确认签字
|
|
94
|
+
119: 119,
|
|
95
|
+
// on_site_jurisdiction_unit_responsible_person_signature - 现场管辖单位负责人签字
|
|
96
|
+
120: 120,
|
|
97
|
+
// hot_work_permit_issuing_unit_signature - 动火许可证签发单位签字
|
|
98
|
+
121: 121,
|
|
99
|
+
// hot_work_permit_signature - 动火许可证签字
|
|
100
|
+
122: 122,
|
|
101
|
+
// pre_hot_work_jurisdiction_unit_confirmation_signature - 动火前管辖单位确认签字
|
|
102
|
+
123: 123,
|
|
103
|
+
// on_site_responsible_person_confirmation_signature - 现场负责人确实签字
|
|
104
|
+
124: 124,
|
|
105
|
+
// post_hot_work_site_jurisdiction_unit_confirmation - 动火后现场管辖单位确认
|
|
106
|
+
125: 125,
|
|
107
|
+
// delayed_fire_monitoring_pictures - 延迟监火图片
|
|
108
|
+
126: 126,
|
|
109
|
+
// safety_and_environmental_inspection_initiation_signature - 安全环保检查发起签字(弃用)
|
|
110
|
+
127: 127,
|
|
111
|
+
// inspector_confirmation_signature - 检查人确认签字(弃用)
|
|
112
|
+
128: 128,
|
|
113
|
+
// inspected_person_confirmation_signature - 被检查人确认签字(弃用)
|
|
114
|
+
129: 129,
|
|
115
|
+
// safety_and_environmental_inspection_appeal_signature - 安全环保检查申辩签字(弃用)
|
|
116
|
+
130: 130,
|
|
117
|
+
// hk_safety_committee_office_director_safety_director_issuance - (港股安委办主任)安全总监签发
|
|
118
|
+
131: 131,
|
|
119
|
+
// hot_work_contracting_unit_signature - 动火发包单位签字
|
|
120
|
+
132: 132,
|
|
121
|
+
// safety_director_approval - 安全总监审批
|
|
122
|
+
133: 133,
|
|
123
|
+
// branch_safety_director_approval - 分公司安全总监审批
|
|
124
|
+
134: 134,
|
|
125
|
+
// project_authority_review_signature - 项目主管部门负责人审核
|
|
126
|
+
135: 135,
|
|
127
|
+
// branch_manager_approval_signature - 分公司主要负责人签批
|
|
128
|
+
136: 136,
|
|
129
|
+
// accident_incident - 事故/事件
|
|
130
|
+
137: 137,
|
|
131
|
+
// accident_incident - 事故/事件
|
|
132
|
+
138: 138,
|
|
133
|
+
// hidden_disposal_plan - 隐患处置方案
|
|
134
|
+
139: 139,
|
|
135
|
+
// safety_environmental_inspection_inspection_signature - 安全环保检查-检查签字
|
|
136
|
+
140: 140,
|
|
137
|
+
// safety_environmental_inspection_inspection_situation - 安全环保检查-检查情况
|
|
138
|
+
141: 141,
|
|
139
|
+
// safety_environmental_inspection_inspector_signature - 安全环保检查-检查人签字
|
|
140
|
+
142: 142,
|
|
141
|
+
// safety_environmental_inspection_inspected_signature - 安全环保检查-被检查人签字
|
|
142
|
+
143: 143,
|
|
143
|
+
// safety_environmental_inspection_inspected_file - 安全环保检查-被检查文件
|
|
144
|
+
144: 144,
|
|
145
|
+
// safety_environmental_inspection_defense_signature - 安全环保检查-申辩签字
|
|
146
|
+
146: 146,
|
|
147
|
+
// safety_environmental_inspection_acceptance - 安全环保检查-验收
|
|
148
|
+
145: 145,
|
|
149
|
+
// qualified_list_inspection - 清单检查合格
|
|
150
|
+
147: 147,
|
|
151
|
+
// hidden_qualified_listInspection_signature - 隐患清单排查签字
|
|
152
|
+
148: 148,
|
|
153
|
+
// special_qualification - 相关方-专项资质
|
|
154
|
+
149: 149,
|
|
155
|
+
// safety_qualification - 相关方-安全资质(弃用,全部改成使用148)
|
|
156
|
+
150: 150,
|
|
157
|
+
// promise_bookmark_photo - 安全承诺签字
|
|
158
|
+
151: 151,
|
|
159
|
+
// project_related_materials - 相关方-项目相关资料
|
|
160
|
+
152: 152,
|
|
161
|
+
// legal_and_regulatory_database - 法律法规库
|
|
162
|
+
153: 153,
|
|
163
|
+
// regulations_resource_library - 安全生产操作规程资源库
|
|
164
|
+
154: 154,
|
|
165
|
+
// responsibility_based_resource_library - 安全生产责任制资源库
|
|
166
|
+
155: 155,
|
|
167
|
+
// institutional_resource_library - 安全生产管理制度资源库
|
|
168
|
+
156: 156 // security_management_agreement - 相关方-安全管理协议
|
|
89
169
|
};
|
|
90
170
|
|
|
91
171
|
/**
|
|
92
172
|
* 文件上传类型对应的 path 枚举
|
|
93
173
|
*/
|
|
94
|
-
|
|
174
|
+
const UPLOAD_FILE_PATH_ENUM = {
|
|
95
175
|
10: "labor_contract_image",
|
|
96
176
|
11: "commercial_insurance_image",
|
|
97
177
|
12: "certificate_information",
|
|
@@ -172,5 +252,7 @@ export const UPLOAD_FILE_PATH_ENUM = {
|
|
|
172
252
|
153: "regulations_resource_library",
|
|
173
253
|
154: "responsibility_based_resource_library",
|
|
174
254
|
155: "institutional_resource_library",
|
|
175
|
-
156: "security_management_agreement"
|
|
255
|
+
156: "security_management_agreement"
|
|
176
256
|
};
|
|
257
|
+
|
|
258
|
+
export { UPLOAD_FILE_PATH_ENUM, UPLOAD_FILE_TYPE_ENUM };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import { useState } from
|
|
1
|
+
import { request } from '@cqsjjb/jjb-common-lib/http';
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 删除文件
|
|
@@ -11,7 +11,7 @@ function useDeleteFile(returnType = "object") {
|
|
|
11
11
|
let requestCount = 0;
|
|
12
12
|
|
|
13
13
|
// 删除文件
|
|
14
|
-
const deleteFile =
|
|
14
|
+
const deleteFile = options => {
|
|
15
15
|
if (!options) {
|
|
16
16
|
console.error("请传入 options");
|
|
17
17
|
return;
|
|
@@ -22,10 +22,11 @@ function useDeleteFile(returnType = "object") {
|
|
|
22
22
|
if (requestCount > 0) {
|
|
23
23
|
setLoading(true);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
return new Promise((resolve, reject) => {
|
|
27
|
-
const {
|
|
28
|
-
|
|
26
|
+
const {
|
|
27
|
+
files = [],
|
|
28
|
+
single = true
|
|
29
|
+
} = options;
|
|
29
30
|
if (!files) {
|
|
30
31
|
console.error("请传入 files");
|
|
31
32
|
return;
|
|
@@ -71,31 +72,24 @@ function useDeleteFile(returnType = "object") {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
// 发送请求
|
|
74
|
-
request(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
})
|
|
86
|
-
.finally(() => {
|
|
87
|
-
// 减少请求数量并在没有进行中的请求时设置loading为false
|
|
88
|
-
requestCount--;
|
|
89
|
-
if (requestCount <= 0) {
|
|
90
|
-
setLoading(false);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
75
|
+
request(single ? `/basicInfo/imgFiles/delete?filePath=${files[0].filePath}` : `/basicInfo/imgFiles/ids?ids=${files.filter(f => f.id).map(f => f.id)}`, "delete").then(res => {
|
|
76
|
+
resolve(res.data);
|
|
77
|
+
}).catch(err => {
|
|
78
|
+
reject(err);
|
|
79
|
+
}).finally(() => {
|
|
80
|
+
// 减少请求数量并在没有进行中的请求时设置loading为false
|
|
81
|
+
requestCount--;
|
|
82
|
+
if (requestCount <= 0) {
|
|
83
|
+
setLoading(false);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
93
86
|
});
|
|
94
87
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
if (returnType === "array") return [loading, deleteFile];
|
|
89
|
+
return {
|
|
90
|
+
loading,
|
|
91
|
+
deleteFile
|
|
92
|
+
};
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
export default
|
|
95
|
+
export { useDeleteFile as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import { useState } from
|
|
3
|
-
import { DICTIONARY_APP_KEY_ENUM } from
|
|
1
|
+
import { request } from '@cqsjjb/jjb-common-lib/http';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { DICTIONARY_APP_KEY_ENUM } from '../../enum/dictionary/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* 获取数据字典
|
|
@@ -12,7 +12,7 @@ function useDictionary(returnType = "object") {
|
|
|
12
12
|
let requestCount = 0;
|
|
13
13
|
|
|
14
14
|
// 获取数据字典
|
|
15
|
-
const getDictionary =
|
|
15
|
+
const getDictionary = options => {
|
|
16
16
|
if (!options) {
|
|
17
17
|
console.error("请传入 options");
|
|
18
18
|
return;
|
|
@@ -23,10 +23,11 @@ function useDictionary(returnType = "object") {
|
|
|
23
23
|
if (requestCount > 0) {
|
|
24
24
|
setLoading(true);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
return new Promise((resolve, reject) => {
|
|
28
|
-
const {
|
|
29
|
-
|
|
27
|
+
const {
|
|
28
|
+
appKey = DICTIONARY_APP_KEY_ENUM.DEFAULT,
|
|
29
|
+
dictValue
|
|
30
|
+
} = options;
|
|
30
31
|
if (!Object.values(DICTIONARY_APP_KEY_ENUM).includes(appKey)) {
|
|
31
32
|
console.error("传入的 options.appKey 不在 DICTIONARY_APP_KEY_ENUM 中");
|
|
32
33
|
return;
|
|
@@ -37,30 +38,27 @@ function useDictionary(returnType = "object") {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// 发送请求
|
|
40
|
-
request(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (requestCount <= 0) {
|
|
55
|
-
setLoading(false);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
41
|
+
request("/config/dict-trees/list/by/dictValues", "get", {
|
|
42
|
+
appKey,
|
|
43
|
+
dictValue
|
|
44
|
+
}).then(res => {
|
|
45
|
+
resolve(res.data);
|
|
46
|
+
}).catch(err => {
|
|
47
|
+
reject(err);
|
|
48
|
+
}).finally(() => {
|
|
49
|
+
// 减少请求数量并在没有进行中的请求时设置loading为false
|
|
50
|
+
requestCount--;
|
|
51
|
+
if (requestCount <= 0) {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
58
55
|
});
|
|
59
56
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
if (returnType === "array") return [loading, getDictionary];
|
|
58
|
+
return {
|
|
59
|
+
loading,
|
|
60
|
+
getDictionary
|
|
61
|
+
};
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
export default
|
|
64
|
+
export { useDictionary as default };
|