zy-react-library 1.2.5 → 1.2.7

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.
@@ -1 +1 @@
1
- import{Modal as e,Form as i,Row as t,Col as n,Select as a,Input as r,Button as l,Spin as o}from"antd";import{useRef as d,useState as s,useEffect as c}from"react";import{dynamicLoadJs as u,dynamicLoadCss as p}from"../../utils/index.js";import w from"./CesiumMap.js";import"./index.less";import{jsxs as m,jsx as h}from"react/jsx-runtime";const g=g=>{const{visible:y,onClose:b,longitude:v,latitude:C,onConfirm:f,area:L="",showArea:M=!1,disable:B=!1,type:k="baidu"}=g,j=d(null),x=d(null),D=d(null),[G,O]=s(!1),[I,A]=s(v||""),[R,z]=s(C||""),[K,P]=s(""),[T,S]=s("");c(()=>{A(v||""),z(C||""),S(L||"")},[v,C,L]);const W=()=>{if(!window?.BMapGL?.Map)return void setTimeout(()=>{W()},50);const e=new window.BMapGL.Map(j.current);if(x.current=e,e.centerAndZoom(new window.BMapGL.Point(v||window.mapLongitude,C||window.mapLatitude),16),e.enableScrollWheelZoom(!0),v&&C){const i=new window.BMapGL.Point(v,C),t=new window.BMapGL.Marker(i);e.addOverlay(t)}B||e.addEventListener("click",i=>{e.clearOverlays();const t=new window.BMapGL.Point(i.latlng.lng,i.latlng.lat),n=new window.BMapGL.Marker(t);e.addOverlay(n),z(i.latlng.lat),A(i.latlng.lng)})},E=()=>{if(O(!0),j.current){if(!x.current){if("baidu"===k)return void W();"cesium"===k&&(()=>{const{init:e,flyTo:i,addMarkPoint:t,getLongitudeAndLatitude:n}=new w,{viewer:a}=e();x.current=a,i({longitude:v||window.mapLongitude,latitude:C||window.mapLatitude,height:9e5}),v&&C&&t({longitude:v,latitude:C}),n((e,i)=>{if(e)return;const{longitude:t,latitude:n}=i;z(n),A(t)})})()}O(!1)}},Z=()=>{P(""),x.current&&(x.current.destroy(),x.current=null),b&&b()};c(()=>{let e;return y&&(e=setTimeout(()=>{(()=>{if(window.mapLongitude||window.mapLatitude)return"baidu"===k?window.mapBaiDuKey?void(async()=>{window.BMapGL?E():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:`https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${window.mapBaiDuKey}&callback=initialize`,type:"script",attr:{type:"text/javascript"}}),E()):(await u(`https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${window.mapBaiDuKey}&callback=initialize`),E())})():void console.error("【Map】 请在window设置变量 mapBaiDuKey,以供地图初始化加载使用"):void("cesium"===k&&(async()=>{window.Cesium?E():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:"https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Cesium.js",type:"script",attr:{type:"text/javascript"}}),await window.base.loadDynamicResource({url:"https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Widgets/widgets.css",type:"link",attr:{rel:"stylesheet",type:"text/css"}}),E()):(await u("https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Cesium.js"),await p("https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Widgets/widgets.css"),E())})());console.error("【Map】 请在window设置变量 mapLongitude 和 mapLatitude,以供地图初始化坐标使用")})()},100)),()=>{e&&clearTimeout(e)}},[y]);const $=()=>{if(x.current){try{x.current.clearOverlays(),x.current.destroy(),x.current=null}catch(e){console.warn("Error destroying map on unmount:",e)}x.current=null}};return c(()=>()=>{$()},[]),m(e,{open:y,title:"坐标",onCancel:Z,width:1e3,destroyOnHidden:!1,maskClosable:!1,afterClose:$,footer:[h(l,{onClick:Z,children:"取消"},"back"),!B&&h(l,{type:"primary",onClick:()=>{f&&f(I,R,{area:T}),Z()},children:"确定"},"submit")],children:[m(i,{labelAlign:"right",labelCol:{span:6},wrapperCol:{span:18},children:[M&&h(t,{gutter:24,children:h(n,{span:12,children:h(i.Item,{label:"所属区域",children:m(a,{value:T,onChange:e=>S(e),allowClear:!0,children:[h(a.Option,{value:"1",children:"东港区"}),h(a.Option,{value:"2",children:"西港区"})]})})})}),!B&&"baidu"===k&&m(t,{gutter:24,children:[h(n,{span:12,children:h(i.Item,{label:"关键字搜索",children:h(r,{value:K,onChange:e=>P(e.target.value),allowClear:!0})})}),h(n,{span:12,children:m(i.Item,{label:" ",colon:!1,style:{textAlign:"right"},children:[h(l,{type:"primary",onClick:()=>{K&&x.current&&(D.current=new window.BMapGL.LocalSearch(x.current,{renderOptions:{map:x.current}}),D.current.search(K))},children:"搜索"}),h(l,{onClick:()=>{P(""),x.current&&D.current.search("")},style:{marginLeft:8},children:"重置"})]})})]}),m(t,{gutter:24,children:[h(n,{span:12,children:h(i.Item,{label:"经度",children:h(r,{disabled:!0,value:I})})}),h(n,{span:12,children:h(i.Item,{label:"纬度",children:h(r,{disabled:!0,value:R})})})]})]}),h("div",{ref:j,id:"map_container",style:{width:"100%",height:"500px",position:"relative"},children:h(o,{size:"large",tip:"地图正在加载中...",spinning:G,children:h("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3}})})})]})};g.displayName="MapSelector";export{g as default};
1
+ import{Modal as e,Form as i,Row as t,Col as n,Select as a,Input as r,Button as l,Spin as o}from"antd";import{useRef as d,useState as s,useEffect as c}from"react";import{dynamicLoadJs as u,dynamicLoadCss as p}from"../../utils/index.js";import w from"./CesiumMap.js";import"./index.less";import{jsxs as m,jsx as h}from"react/jsx-runtime";const g=g=>{const{visible:y,onClose:b,longitude:v,latitude:C,onConfirm:f,area:L="",showArea:M=!1,disable:B=!1,type:k="baidu"}=g,j=d(null),x=d(null),D=d(null),[G,O]=s(!1),[I,A]=s(v||""),[R,z]=s(C||""),[K,P]=s(""),[T,S]=s("");c(()=>{A(v||""),z(C||""),S(L||"")},[v,C,L]);const W=()=>{if(!window?.BMapGL?.Map)return void setTimeout(()=>{W()},50);const e=new window.BMapGL.Map(j.current);if(x.current=e,e.centerAndZoom(new window.BMapGL.Point(v||window.mapLongitude,C||window.mapLatitude),16),e.enableScrollWheelZoom(!0),v&&C){const i=new window.BMapGL.Point(v,C),t=new window.BMapGL.Marker(i);e.addOverlay(t)}B||e.addEventListener("click",i=>{e.clearOverlays();const t=new window.BMapGL.Point(i.latlng.lng,i.latlng.lat),n=new window.BMapGL.Marker(t);e.addOverlay(n),z(i.latlng.lat),A(i.latlng.lng)})},E=()=>{if(O(!0),j.current){if(!x.current){if("baidu"===k)return void W();"cesium"===k&&(()=>{const{init:e,flyTo:i,addMarkPoint:t,getLongitudeAndLatitude:n}=new w,{viewer:a}=e();x.current=a,i({longitude:v||window.mapLongitude,latitude:C||window.mapLatitude,height:9e5}),v&&C&&t({longitude:v,latitude:C}),B||n((e,i)=>{if(e)return;const{longitude:t,latitude:n}=i;z(n),A(t)})})()}O(!1)}},Z=()=>{P(""),x.current&&(x.current.destroy(),x.current=null),b&&b()};c(()=>{let e;return y&&(e=setTimeout(()=>{(()=>{if(window.mapLongitude||window.mapLatitude)return"baidu"===k?window.mapBaiDuKey?void(async()=>{window.BMapGL?E():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:`https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${window.mapBaiDuKey}&callback=initialize`,type:"script",attr:{type:"text/javascript"}}),E()):(await u(`https://api.map.baidu.com/api?v=1.0&type=webgl&ak=${window.mapBaiDuKey}&callback=initialize`),E())})():void console.error("【Map】 请在window设置变量 mapBaiDuKey,以供地图初始化加载使用"):void("cesium"===k&&(async()=>{window.Cesium?E():window?.base?.loadDynamicResource?(await window.base.loadDynamicResource({url:"https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Cesium.js",type:"script",attr:{type:"text/javascript"}}),await window.base.loadDynamicResource({url:"https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Widgets/widgets.css",type:"link",attr:{rel:"stylesheet",type:"text/css"}}),E()):(await u("https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Cesium.js"),await p("https://cesium.com/downloads/cesiumjs/releases/1.91/Build/Cesium/Widgets/widgets.css"),E())})());console.error("【Map】 请在window设置变量 mapLongitude 和 mapLatitude,以供地图初始化坐标使用")})()},100)),()=>{e&&clearTimeout(e)}},[y]);const $=()=>{if(x.current){try{x.current.clearOverlays(),x.current.destroy(),x.current=null}catch(e){console.warn("Error destroying map on unmount:",e)}x.current=null}};return c(()=>()=>{$()},[]),m(e,{open:y,title:"坐标",onCancel:Z,width:1e3,destroyOnHidden:!1,maskClosable:!1,afterClose:$,footer:[h(l,{onClick:Z,children:"取消"},"back"),!B&&h(l,{type:"primary",onClick:()=>{f&&f(I,R,{area:T}),Z()},children:"确定"},"submit")],children:[m(i,{labelAlign:"right",labelCol:{span:6},wrapperCol:{span:18},children:[M&&h(t,{gutter:24,children:h(n,{span:12,children:h(i.Item,{label:"所属区域",children:m(a,{value:T,onChange:e=>S(e),allowClear:!0,children:[h(a.Option,{value:"1",children:"东港区"}),h(a.Option,{value:"2",children:"西港区"})]})})})}),!B&&"baidu"===k&&m(t,{gutter:24,children:[h(n,{span:12,children:h(i.Item,{label:"关键字搜索",children:h(r,{value:K,onChange:e=>P(e.target.value),allowClear:!0})})}),h(n,{span:12,children:m(i.Item,{label:" ",colon:!1,style:{textAlign:"right"},children:[h(l,{type:"primary",onClick:()=>{K&&x.current&&(D.current=new window.BMapGL.LocalSearch(x.current,{renderOptions:{map:x.current}}),D.current.search(K))},children:"搜索"}),h(l,{onClick:()=>{P(""),x.current&&D.current.search("")},style:{marginLeft:8},children:"重置"})]})})]}),m(t,{gutter:24,children:[h(n,{span:12,children:h(i.Item,{label:"经度",children:h(r,{disabled:!0,value:I})})}),h(n,{span:12,children:h(i.Item,{label:"纬度",children:h(r,{disabled:!0,value:R})})})]})]}),h("div",{ref:j,id:"map_container",style:{width:"100%",height:"500px",position:"relative"},children:h(o,{size:"large",tip:"地图正在加载中...",spinning:G,children:h("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e3}})})})]})};g.displayName="MapSelector";export{g as default};
@@ -14,6 +14,7 @@ export declare const UPLOAD_FILE_TYPE_ENUM: {
14
14
  602: 602; // gate_access_vehicle_photo - 门口门禁车辆车辆照片
15
15
  606: 606; // gate_access_vehicle_applicant_signature - 门口门禁车辆申请人签字
16
16
  607: 607; // gate_access_vehicle_violation - 门口门禁车辆违规照片
17
+ 608: 608; // gate_access_face_photo - 门口门禁人脸照片
17
18
  603: 603; // gate_access_vehicle_attachment - 门口门禁车辆附件
18
19
  604: 604; // emission_standard_certificate - 排放标准证明
19
20
  605: 605; // motor_vehicle_registration_certificate_green_book - 机动车登记证书(绿本)
@@ -96,6 +97,12 @@ export declare const UPLOAD_FILE_TYPE_ENUM: {
96
97
  165: 165; // online_learning_sign_signature - 在线学习签到签字
97
98
  166: 166; // online_learning_exam_signature - 在线学习考试签字
98
99
  167: 167; // course_work_question_content - 课题工作题内容
100
+ 168: 168; // key_homework_safety_management_agreement - 重点作业安全管理协议
101
+ 169: 169; // key_homework_inspection_status_img - 重点作业检查情况图片
102
+ 170: 170; // key_homework_acceptance_pictures - 重点作业验收图片
103
+ 171: 171; // key_homework_attachment_inspected_person - 重点作业被检查人附件
104
+ 172: 172; // key_homework_hazard_pictures - 重点作业隐患图片
105
+ 173: 173; // key_homework_hazard_video - 重点作业隐患视频
99
106
  302: 302; // fire_safety_inspection_passed_images - 消防点检检查合格
100
107
  };
101
108
 
@@ -115,6 +122,7 @@ export declare const UPLOAD_FILE_PATH_ENUM: {
115
122
  602: "gate_access_vehicle_photo";
116
123
  606: "gate_access_vehicle_applicant_signature";
117
124
  607: "gate_access_vehicle_violation";
125
+ 608: "gate_access_face_photo";
118
126
  603: "gate_access_vehicle_attachment";
119
127
  604: "emission_standard_certificate";
120
128
  605: "motor_vehicle_registration_certificate_green_book";
@@ -197,5 +205,11 @@ export declare const UPLOAD_FILE_PATH_ENUM: {
197
205
  165: "online_learning_sign_signature";
198
206
  166: "online_learning_exam_signature";
199
207
  167: "course_work_question_content";
208
+ 168: "key_homework_safety_management_agreement";
209
+ 169: "key_homework_inspection_status_img";
210
+ 170: "key_homework_acceptance_pictures";
211
+ 171: "key_homework_attachment_inspected_person";
212
+ 172: "key_homework_hazard_pictures";
213
+ 173: "key_homework_hazard_video";
200
214
  302: "fire_safety_inspection_passed_images";
201
215
  };
@@ -1 +1 @@
1
- const e={10:10,11:11,12:12,13:13,14:14,15:15,16:16,19:19,601:601,602:602,606:606,607:607,603:603,604:604,605:605,3:3,4:4,5:5,6:6,7:7,8:8,9:9,17:17,18:18,20:20,21:21,22:22,23:23,50:50,101:101,102:102,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,146:146,145:145,147:147,148:148,149:149,150:150,151:151,152:152,153:153,154:154,155:155,156:156,157:157,158:158,159:159,160:160,161:161,162:162,163:163,164:164,165:165,166:166,167:167,302:302},_={10:"labor_contract_image",11:"commercial_insurance_image",12:"certificate_information",13:"user_avatar",14:"id_card_photo",15:"social_security_card_photo",16:"work_related_injury_insurance_certificate",19:"three_level_safety_education_training",601:"gate_access_vehicle_license_photo",602:"gate_access_vehicle_photo",606:"gate_access_vehicle_applicant_signature",607:"gate_access_vehicle_violation",603:"gate_access_vehicle_attachment",604:"emission_standard_certificate",605:"motor_vehicle_registration_certificate_green_book",3:"hidden_danger_photo",4:"hidden_danger_rectification_photo",5:"hidden_danger_verification_photo",6:"certificate_photo",7:"confined_space_plan",8:"hidden_danger_rectification_plan",9:"confined_space_confirmation_signature",17:"special_equipment_inspection_photo",18:"personnel_certificate",20:"major_hazard_source_alarm_before_handling_photo",21:"major_hazard_source_alarm_after_handling_photo",22:"smart_access_control_external_vehicle_driver_license_photo",23:"smart_access_control_external_vehicle_registration_photo",50:"safety_and_environmental_inspection_final_acceptance_image",101:"hidden_danger_extension_temporary_measures_attachment",102:"hidden_danger_video",105:"blind_plate_position_map",106:"temporary_disposal_information",107:"rectification_suggestions_and_plan",108:"major_hidden_danger_investigation_report",109:"major_hidden_danger_safety_committee_or_party_committee_resolution_record",110:"significant_hidden_danger_rectification_temporary_disposal_measures",111:"significant_hidden_danger_rectification_hidden_danger_rectification_process_record",112:"supplement_major_hidden_danger_information",113:"safety_committee_office_meeting_record",114:"alarm_photo",115:"fire_equipment_type_qualification_photo",116:"hot_work_personnel_photo",117:"safety_pledge_signature",118:"hot_work_unit_responsible_person_confirmation_signature",119:"on_site_jurisdiction_unit_responsible_person_signature",120:"hot_work_permit_issuing_unit_signature",121:"hot_work_permit_signature",122:"pre_hot_work_jurisdiction_unit_confirmation_signature",123:"on_site_responsible_person_confirmation_signature",124:"post_hot_work_site_jurisdiction_unit_confirmation",125:"delayed_fire_monitoring_pictures",126:"safety_and_environmental_inspection_initiation_signature",127:"inspector_confirmation_signature",128:"inspected_person_confirmation_signature",129:"safety_and_environmental_inspection_appeal_signature",130:"hk_safety_committee_office_director_safety_director_issuance",131:"hot_work_contracting_unit_signature",132:"safety_director_approval",133:"branch_safety_director_approval",134:"project_authority_review_signature",135:"branch_manager_approval_signature",136:"accident_incident",137:"accident_incident",138:"hidden_disposal_plan",139:"safety_environmental_inspection_inspection_signature",140:"safety_environmental_inspection_inspection_situation",141:"safety_environmental_inspection_inspector_signature",142:"safety_environmental_inspection_inspected_signature",143:"safety_environmental_inspection_inspected_file",144:"safety_environmental_inspection_defense_signature",145:"qualified_list_inspection",146:"safety_environmental_inspection_acceptance",147:"hidden_qualified_listInspection_signature",148:"special_qualification",149:"safety_qualification",150:"promise_bookmark_photo",151:"project_related_materials",152:"legal_and_regulatory_database",153:"regulations_resource_library",154:"responsibility_based_resource_library",155:"institutional_resource_library",156:"security_management_agreement",157:"supervision_personnel_vehicle",158:"supervision_personnel_vehicle_license",159:"special_operation_personnel_photo",160:"special_equipment_operator_photo",161:"main_responsible_person_photo",162:"photos_safety_production_management_personnel",163:"education_and_training_application",164:"cover_of_education_and_training_courses",165:"online_learning_sign_signature",166:"online_learning_exam_signature",167:"course_work_question_content",302:"fire_safety_inspection_passed_images"};export{_ as UPLOAD_FILE_PATH_ENUM,e as UPLOAD_FILE_TYPE_ENUM};
1
+ const e={10:10,11:11,12:12,13:13,14:14,15:15,16:16,19:19,601:601,602:602,606:606,607:607,608:608,603:603,604:604,605:605,3:3,4:4,5:5,6:6,7:7,8:8,9:9,17:17,18:18,20:20,21:21,22:22,23:23,50:50,101:101,102:102,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,146:146,145:145,147:147,148:148,149:149,150:150,151:151,152:152,153:153,154:154,155:155,156:156,157:157,158:158,159:159,160:160,161:161,162:162,163:163,164:164,165:165,166:166,167:167,168:168,169:169,170:170,171:171,172:172,173:173,302:302},_={10:"labor_contract_image",11:"commercial_insurance_image",12:"certificate_information",13:"user_avatar",14:"id_card_photo",15:"social_security_card_photo",16:"work_related_injury_insurance_certificate",19:"three_level_safety_education_training",601:"gate_access_vehicle_license_photo",602:"gate_access_vehicle_photo",606:"gate_access_vehicle_applicant_signature",607:"gate_access_vehicle_violation",608:"gate_access_face_photo",603:"gate_access_vehicle_attachment",604:"emission_standard_certificate",605:"motor_vehicle_registration_certificate_green_book",3:"hidden_danger_photo",4:"hidden_danger_rectification_photo",5:"hidden_danger_verification_photo",6:"certificate_photo",7:"confined_space_plan",8:"hidden_danger_rectification_plan",9:"confined_space_confirmation_signature",17:"special_equipment_inspection_photo",18:"personnel_certificate",20:"major_hazard_source_alarm_before_handling_photo",21:"major_hazard_source_alarm_after_handling_photo",22:"smart_access_control_external_vehicle_driver_license_photo",23:"smart_access_control_external_vehicle_registration_photo",50:"safety_and_environmental_inspection_final_acceptance_image",101:"hidden_danger_extension_temporary_measures_attachment",102:"hidden_danger_video",105:"blind_plate_position_map",106:"temporary_disposal_information",107:"rectification_suggestions_and_plan",108:"major_hidden_danger_investigation_report",109:"major_hidden_danger_safety_committee_or_party_committee_resolution_record",110:"significant_hidden_danger_rectification_temporary_disposal_measures",111:"significant_hidden_danger_rectification_hidden_danger_rectification_process_record",112:"supplement_major_hidden_danger_information",113:"safety_committee_office_meeting_record",114:"alarm_photo",115:"fire_equipment_type_qualification_photo",116:"hot_work_personnel_photo",117:"safety_pledge_signature",118:"hot_work_unit_responsible_person_confirmation_signature",119:"on_site_jurisdiction_unit_responsible_person_signature",120:"hot_work_permit_issuing_unit_signature",121:"hot_work_permit_signature",122:"pre_hot_work_jurisdiction_unit_confirmation_signature",123:"on_site_responsible_person_confirmation_signature",124:"post_hot_work_site_jurisdiction_unit_confirmation",125:"delayed_fire_monitoring_pictures",126:"safety_and_environmental_inspection_initiation_signature",127:"inspector_confirmation_signature",128:"inspected_person_confirmation_signature",129:"safety_and_environmental_inspection_appeal_signature",130:"hk_safety_committee_office_director_safety_director_issuance",131:"hot_work_contracting_unit_signature",132:"safety_director_approval",133:"branch_safety_director_approval",134:"project_authority_review_signature",135:"branch_manager_approval_signature",136:"accident_incident",137:"accident_incident",138:"hidden_disposal_plan",139:"safety_environmental_inspection_inspection_signature",140:"safety_environmental_inspection_inspection_situation",141:"safety_environmental_inspection_inspector_signature",142:"safety_environmental_inspection_inspected_signature",143:"safety_environmental_inspection_inspected_file",144:"safety_environmental_inspection_defense_signature",145:"qualified_list_inspection",146:"safety_environmental_inspection_acceptance",147:"hidden_qualified_listInspection_signature",148:"special_qualification",149:"safety_qualification",150:"promise_bookmark_photo",151:"project_related_materials",152:"legal_and_regulatory_database",153:"regulations_resource_library",154:"responsibility_based_resource_library",155:"institutional_resource_library",156:"security_management_agreement",157:"supervision_personnel_vehicle",158:"supervision_personnel_vehicle_license",159:"special_operation_personnel_photo",160:"special_equipment_operator_photo",161:"main_responsible_person_photo",162:"photos_safety_production_management_personnel",163:"education_and_training_application",164:"cover_of_education_and_training_courses",165:"online_learning_sign_signature",166:"online_learning_exam_signature",167:"course_work_question_content",168:"key_homework_safety_management_agreement",169:"key_homework_inspection_status_img",170:"key_homework_acceptance_pictures",171:"key_homework_attachment_inspected_person",172:"key_homework_hazard_pictures",173:"key_homework_hazard_video",302:"fire_safety_inspection_passed_images"};export{_ as UPLOAD_FILE_PATH_ENUM,e as UPLOAD_FILE_TYPE_ENUM};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.2.5",
4
+ "version": "1.2.7",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
package/utils/index.js CHANGED
@@ -1 +1 @@
1
- import{request}from"@cqsjjb/jjb-common-lib/http.js";import dayjs from"dayjs";import{ID_NUMBER}from"../regular/index.js";function serialNumber(e,t){return(e.current-1)*e.pageSize+(t+1)}function toArrayString(value){return value?eval(value).map(String):[]}function interceptTheSuffix(e,t){return e.substring(e.lastIndexOf("."),e.length).toLowerCase()===t.toLowerCase()}function image2Base64(e){return new Promise(t=>{const n=new Image;n.src=e,n.crossOrigin="Anonymous",n.onload=function(){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,n.width,n.height);const r=n.src.substring(n.src.lastIndexOf(".")+1).toLowerCase();t(e.toDataURL(`image/${r}`))}})}function image2Base642(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=e=>{t(e.target.result)},r.onerror=e=>{n(e)}})}function base642File(e,t="file"){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],i=r.split("/")[1],o=atob(n[1]);let a=o.length;const s=new Uint8Array(a);for(;a--;)s[a]=o.charCodeAt(a);return new File([s],`${t}.${i}`,{type:r})}function checkImgExists(e){return new Promise((t,n)=>{const r=new Image;r.src=e,r.onload=function(e){t(e)},r.onerror=function(e){n(e)}})}function getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)}function ArrayDeduplication(e){return[...new Set(e)]}function arrayObjectDeduplication(e,t){const n={};return e.reduce((e,r)=>(n[r[t]]||(n[r[t]]=!0,e.push(r)),e),[])}function findCharIndex(e){const{str:t,char:n,num:r}=e;let i=t.indexOf(n);if(-1===i)return-1;for(let e=0;e<r-1;e++)if(i=t.indexOf(n,i+1),-1===i)return-1;return i}function randoms(e,t){return Math.random()*(t-e+1)+e}function numFormat(e){if(e){const t=e.toString().split("."),n=t[0].split("").reverse();let r=[];for(let e=0;e<n.length;e++)e%3==0&&0!==e&&r.push(","),r.push(n[e]);return r.reverse(),r=t[1]?r.join("").concat(`.${t[1]}`):r.join(""),r}}function isEmpty(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}function getUrlParam(e){const t=new RegExp(`(^|&)${e}=([^&]*)(&|$)`),n=window.location.search.substr(1).match(t);return null!=n?decodeURI(n[2]):""}function paging(e){const{list:t,currentPage:n,pageSize:r}=e;return t.filter((e,t)=>t<+n*+r&&t>=(+n-1)*+r)}function getFileSuffix(e){return e.substring(e.lastIndexOf(".")+1)}function getFileName(e){return e?e.substring(e.lastIndexOf("/")+1):""}function readTxtDocument(e){return new Promise(t=>{const n=getFileUrl()+e,r=new XMLHttpRequest;r.open("get",n,!0),r.responseType="blob",r.onload=function(e){const n=new FileReader;n.readAsText(e.target.response,"GB2312"),n.onload=function(){t(n.result)}},r.send()})}function secondConversion(e){if(!e)return 0;const t=Number.parseInt((e/60/60).toString(),10),n=Number.parseInt((e/60%60).toString(),10),r=Number.parseInt((e%60).toString(),10);return t?`${t}小时${n}分钟${r}秒`:n?`${n}分钟${r}秒`:`${r}秒`}function addingPrefixToFile(e,t={}){if(!e)return[];const{pathKey:n="filePath",nameKey:r="fileName",idKey:i="id"}=t,o=getFileUrl();for(let t=0;t<e.length;t++)e[t].url=o+e[t][n],e[t].name=e[t][r]||getFileName(e[t][n]),e[t].id=e[t][i];return e}function getLabelName(e){const{status:t,list:n,idKey:r="bianma",nameKey:i="name"}=e;for(let e=0;e<n.length;e++)if(t?.toString()===n[e][r]?.toString())return n[e][i]}function calculateFileSize(e){return e>1024?`${(""+e/1024).substring(0,(""+e/1024).lastIndexOf(".")+3)}MB`:`${e}KB`}function idCardGetDateAndGender(e){let t="",n="";if(ID_NUMBER.test(e)){const r=e.substring(6,14),i=e.substring(16,17),o=`${r.substring(0,4)}-${r.substring(4,6)}-${r.substring(6,8)}`,a=new Date(o.replace(/-/g,"/")),s=a.getMonth()+1;let l;const c=a.getDate();let u;l=s<10?`0${s}`:s,u=c<10?`0${c}`:c,t=i%2==1?"1":"0",n=`${a.getFullYear()}-${l}-${u}`}return{sex:t,date:n}}function getMatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>n.includes(e[r]))}function getUnmatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>!n.includes(e[r]))}function listTransTree(e){const{json:t,idKey:n,parentIdKey:r,childrenKey:i}=e,o=[],a={};let s=0,l=0;const c=t.length;for(;s<c;s++)a[t[s][n]]=t[s];for(;l<c;l++){const e=t[l],n=a[e[r]];n?(!n[i]&&(n[i]=[]),n[i].push(e)):o.push(e)}return o}function isEmptyToWhether(e,t={}){const{yesText:n="是",noText:r="否",yesValue:i="1"}=t;return isEmpty(e)?"":e.toString()===i.toString()?n:r}function createGuid(e=32){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()));return t}function getIndexColumn(e){return{title:"序号",key:"index",width:70,render:(t,n,r)=>!1===e?r+1:serialNumber(e,r)}}function getTreeNodePaths(e){const{data:t,targetId:n,idKey:r,childrenKey:i,path:o=[],isIncludeOneself:a}=e;for(let e=0;e<t.length;e++){const s=t[e],l=[...o,s];if(s[r]===n)return a?l:o;if(s[i]&&s[i].length>0){const e=getTreeNodePaths({data:s[i],targetId:n,idKey:r,childrenKey:i,path:l,isIncludeOneself:a});if(e)return e}}return null}const processTreeDataByLevel=e=>{const{data:t,level:n,childrenKey:r,currentLevel:i=1}=e;return t.map(e=>{const t={...e};return n&&i>=n?(t.isLeaf=!0,delete t[r]):e[r]&&e[r].length>0?t[r]=processTreeDataByLevel({data:e[r],currentLevel:i+1,level:n,childrenKey:r}):t.isLeaf=!0,t})},processTreeDataForOnlyLastLevel=e=>{const{data:t,childrenKey:n,onlyLastLevel:r=!1}=e;return r?t.map(e=>{const t=e[n]&&e[n].length>0,i={...e,selectable:!t};return t&&(i[n]=processTreeDataForOnlyLastLevel({data:e[n],childrenKey:n,onlyLastLevel:r})),i}):t},validatorEndTime=(e,t="结束时间不能早于开始时间")=>({validator:(n,r)=>r&&e&&r<e?Promise.reject(t):Promise.resolve()}),validatorTimeGTCurrentDay=(e="需要大于当前时间")=>({validator:(t,n)=>n&&n<=dayjs().format("YYYY-MM-DD HH:mm:ss")?Promise.reject(e):Promise.resolve()});function dynamicLoadJs(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,document.body.appendChild(r)})}function dynamicLoadCss(e){return new Promise((t,n)=>{const r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}function normalizeEmptyHtml(e){if(!e)return"";const t=e.replace(/\s+/g,"").toLowerCase();return"<p><br></p>"===t||"<p></p>"===t||""===t?"":e}function getFileUrl(){return window.fileUrl||process.env.app.fileUrl}async function getFileUrlFromServer(){if(window.fileUrl)return;const{data:e}=await request("/basicInfo/imgFiles/getImagePath","get");window.fileUrl=e}export{ArrayDeduplication,addingPrefixToFile,arrayObjectDeduplication,base642File,calculateFileSize,checkImgExists,createGuid,dynamicLoadCss,dynamicLoadJs,findCharIndex,getDataType,getFileName,getFileSuffix,getFileUrl,getFileUrlFromServer,getIndexColumn,getLabelName,getMatchedItems,getTreeNodePaths,getUnmatchedItems,getUrlParam,idCardGetDateAndGender,image2Base64,image2Base642,interceptTheSuffix,isEmpty,isEmptyToWhether,listTransTree,normalizeEmptyHtml,numFormat,paging,processTreeDataByLevel,processTreeDataForOnlyLastLevel,randoms,readTxtDocument,secondConversion,serialNumber,toArrayString,validatorEndTime,validatorTimeGTCurrentDay};
1
+ import{request}from"@cqsjjb/jjb-common-lib/http.js";import dayjs from"dayjs";import{ID_NUMBER}from"../regular/index.js";function serialNumber(e,t){return(e.current-1)*e.pageSize+(t+1)}function toArrayString(value){return value?eval(value).map(String):[]}function interceptTheSuffix(e,t){return e.substring(e.lastIndexOf("."),e.length).toLowerCase()===t.toLowerCase()}function image2Base64(e){return new Promise(t=>{const n=new Image;n.src=e,n.crossOrigin="Anonymous",n.onload=function(){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0,n.width,n.height);const r=n.src.substring(n.src.lastIndexOf(".")+1).toLowerCase();t(e.toDataURL(`image/${r}`))}})}function image2Base642(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=e=>{t(e.target.result)},r.onerror=e=>{n(e)}})}function base642File(e,t="file"){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],i=r.split("/")[1],o=atob(n[1]);let a=o.length;const s=new Uint8Array(a);for(;a--;)s[a]=o.charCodeAt(a);return new File([s],`${t}.${i}`,{type:r})}function checkImgExists(e){return new Promise((t,n)=>{const r=new Image;r.src=e,r.onload=function(e){t(e)},r.onerror=function(e){n(e)}})}function getDataType(e){return Object.prototype.toString.call(e).slice(8,-1)}function ArrayDeduplication(e){return[...new Set(e)]}function arrayObjectDeduplication(e,t){const n={};return e.reduce((e,r)=>(n[r[t]]||(n[r[t]]=!0,e.push(r)),e),[])}function findCharIndex(e){const{str:t,char:n,num:r}=e;let i=t.indexOf(n);if(-1===i)return-1;for(let e=0;e<r-1;e++)if(i=t.indexOf(n,i+1),-1===i)return-1;return i}function randoms(e,t){return Math.random()*(t-e+1)+e}function numFormat(e){if(e){const t=e.toString().split("."),n=t[0].split("").reverse();let r=[];for(let e=0;e<n.length;e++)e%3==0&&0!==e&&r.push(","),r.push(n[e]);return r.reverse(),r=t[1]?r.join("").concat(`.${t[1]}`):r.join(""),r}}function isEmpty(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}function getUrlParam(e){const t=new RegExp(`(^|&)${e}=([^&]*)(&|$)`),n=window.location.search.substr(1).match(t);return null!=n?decodeURI(n[2]):""}function paging(e){const{list:t,currentPage:n,pageSize:r}=e;return t.filter((e,t)=>t<+n*+r&&t>=(+n-1)*+r)}function getFileSuffix(e){return e.substring(e.lastIndexOf(".")+1)}function getFileName(e){return e?e.substring(e.lastIndexOf("/")+1):""}function readTxtDocument(e){return new Promise(t=>{const n=getFileUrl()+e,r=new XMLHttpRequest;r.open("get",n,!0),r.responseType="blob",r.onload=function(e){const n=new FileReader;n.readAsText(e.target.response,"GB2312"),n.onload=function(){t(n.result)}},r.send()})}function secondConversion(e){if(!e)return 0;const t=Number.parseInt((e/60/60).toString(),10),n=Number.parseInt((e/60%60).toString(),10),r=Number.parseInt((e%60).toString(),10);return t?`${t}小时${n}分钟${r}秒`:n?`${n}分钟${r}秒`:`${r}秒`}function addingPrefixToFile(e,t={}){if(!e)return[];const{pathKey:n="filePath",nameKey:r="fileName",idKey:i="id"}=t,o=getFileUrl();for(let t=0;t<e.length;t++)e[t].url=o+e[t][n],e[t].name=e[t][r]||getFileName(e[t][n]),e[t].id=e[t][i];return e}function getLabelName(e){const{status:t,list:n,idKey:r="bianma",nameKey:i="name"}=e;for(let e=0;e<n.length;e++)if(t?.toString()===n[e][r]?.toString())return n[e][i]}function calculateFileSize(e){return e>1024?`${(""+e/1024).substring(0,(""+e/1024).lastIndexOf(".")+3)}MB`:`${e}KB`}function idCardGetDateAndGender(e){let t="",n="";if(ID_NUMBER.test(e)){const r=e.substring(6,14),i=e.substring(16,17),o=`${r.substring(0,4)}-${r.substring(4,6)}-${r.substring(6,8)}`,a=new Date(o.replace(/-/g,"/")),s=a.getMonth()+1;let l;const c=a.getDate();let u;l=s<10?`0${s}`:s,u=c<10?`0${c}`:c,t=i%2==1?"1":"0",n=`${a.getFullYear()}-${l}-${u}`}return{sex:t,date:n}}function getMatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>n.includes(e[r]))}function getUnmatchedItems(e){const{list:t,value:n,idKey:r="bianma"}=e;return t.filter(e=>!n.includes(e[r]))}function listTransTree(e){const{json:t,idKey:n,parentIdKey:r,childrenKey:i}=e,o=[],a={};let s=0,l=0;const c=t.length;for(;s<c;s++)a[t[s][n]]=t[s];for(;l<c;l++){const e=t[l],n=a[e[r]];n?(!n[i]&&(n[i]=[]),n[i].push(e)):o.push(e)}return o}function isEmptyToWhether(e,t={}){const{yesText:n="是",noText:r="否",yesValue:i="1"}=t;return isEmpty(e)?"":e.toString()===i.toString()?n:r}function createGuid(e=32){let t="";for(let n=0;n<e;n++)t+="abcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(36*Math.random()));return t}function getIndexColumn(e){return{title:"序号",key:"index",width:70,render:(t,n,r)=>!1===e?r+1:serialNumber(e,r)}}function getTreeNodePaths(e){const{data:t,targetId:n,idKey:r,childrenKey:i,path:o=[],isIncludeOneself:a}=e;for(let e=0;e<t.length;e++){const s=t[e],l=[...o,s];if(s[r]===n)return a?l:o;if(s[i]&&s[i].length>0){const e=getTreeNodePaths({data:s[i],targetId:n,idKey:r,childrenKey:i,path:l,isIncludeOneself:a});if(e)return e}}return null}function processTreeDataByLevel(e){const{data:t,level:n,childrenKey:r,currentLevel:i=1}=e;return t.map(e=>{const t={...e};return n&&i>=n?(t.isLeaf=!0,delete t[r]):e[r]&&e[r].length>0?t[r]=processTreeDataByLevel({data:e[r],currentLevel:i+1,level:n,childrenKey:r}):t.isLeaf=!0,t})}function processTreeDataForOnlyLastLevel(e){const{data:t,childrenKey:n,onlyLastLevel:r=!1}=e;return r?t.map(e=>{const t=e[n]&&e[n].length>0,i={...e,selectable:!t};return t&&(i[n]=processTreeDataForOnlyLastLevel({data:e[n],childrenKey:n,onlyLastLevel:r})),i}):t}function validatorEndTime(e,t="结束时间不能早于开始时间"){return{validator:(n,r)=>r&&e&&r<e?Promise.reject(t):Promise.resolve()}}function validatorTimeGTCurrentDay(e="需要大于当前时间"){return{validator:(t,n)=>n&&n<=dayjs().format("YYYY-MM-DD HH:mm:ss")?Promise.reject(e):Promise.resolve()}}function dynamicLoadJs(e){return new Promise((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,document.body.appendChild(r)})}function dynamicLoadCss(e){return new Promise((t,n)=>{const r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.href=e,r.onload=t,r.onerror=n,document.head.appendChild(r)})}function normalizeEmptyHtml(e){if(!e)return"";const t=e.replace(/\s+/g,"").toLowerCase();return"<p><br></p>"===t||"<p></p>"===t||""===t?"":e}function getFileUrl(){return window.fileUrl||process.env.app.fileUrl}async function getFileUrlFromServer(){if(window.fileUrl)return;const{data:e}=await request("/basicInfo/imgFiles/getImagePath","get");window.fileUrl=e}export{ArrayDeduplication,addingPrefixToFile,arrayObjectDeduplication,base642File,calculateFileSize,checkImgExists,createGuid,dynamicLoadCss,dynamicLoadJs,findCharIndex,getDataType,getFileName,getFileSuffix,getFileUrl,getFileUrlFromServer,getIndexColumn,getLabelName,getMatchedItems,getTreeNodePaths,getUnmatchedItems,getUrlParam,idCardGetDateAndGender,image2Base64,image2Base642,interceptTheSuffix,isEmpty,isEmptyToWhether,listTransTree,normalizeEmptyHtml,numFormat,paging,processTreeDataByLevel,processTreeDataForOnlyLastLevel,randoms,readTxtDocument,secondConversion,serialNumber,toArrayString,validatorEndTime,validatorTimeGTCurrentDay};