zy-react-library 1.1.23 → 1.1.25
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,7 +1,18 @@
|
|
|
1
1
|
import type { FC } from "react";
|
|
2
|
-
import type { Params } from "../../../LeftTree/Department/Gwj";
|
|
3
2
|
import type { BasicSelectTreeProps } from "../../Basic";
|
|
4
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 请求参数
|
|
6
|
+
*/
|
|
7
|
+
export interface Params {
|
|
8
|
+
/** 企业id */
|
|
9
|
+
eqCorpinfoId?: string;
|
|
10
|
+
/** 父级部门id */
|
|
11
|
+
eqParentId?: string;
|
|
12
|
+
/** 企业类型 */
|
|
13
|
+
corpinfoTypeList?: number[];
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
/**
|
|
6
17
|
* 组件属性
|
|
7
18
|
*/
|
|
@@ -14,8 +25,8 @@ export interface DepartmentSelectTreeProps extends Omit<BasicSelectTreeProps, "t
|
|
|
14
25
|
isNeedCorpInfoId?: boolean;
|
|
15
26
|
/** 是否需要父级部门id,默认 false */
|
|
16
27
|
isNeedParentId?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
searchType?: "current" | "all";
|
|
28
|
+
/** 查询当前登陆人部门还是所有企业部门 */
|
|
29
|
+
searchType?: "current" | "all" | "company";
|
|
19
30
|
}
|
|
20
31
|
|
|
21
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as t}from"react";import a from"../../Basic/index.js";import{jsx as
|
|
1
|
+
import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as t}from"react";import a from"../../Basic/index.js";import{jsx as n}from"react/jsx-runtime";function i(i){const{params:o={},placeholder:s="部门",isNeedCorpInfoId:c=!1,isNeedParentId:p=!1,searchType:l="current",...m}=i,[d,f]=r([]);return t(()=>{(async()=>{if(f([]),"current"===l){if(c&&!o.eqCorpinfoId)return;if(p&&!o.eqParentId)return}let r="";"current"===l&&(r="/basicInfo/department/listTree"),"all"===l&&(r="/basicInfo/department/listAllTree"),"company"===l&&(r="/basicInfo/department/listAllTreeByCorpType");const{data:t}=await e(r,"post",o);f(t)})()},[JSON.stringify(o),c,p,l]),n(a,{treeData:d,placeholder:s,childrenKey:"childrenList",...m})}i.displayName="DepartmentSelectTree";export{i as default};
|
|
@@ -11,7 +11,7 @@ export interface UploadProps extends Omit<AntUploadProps, "fileList"> {
|
|
|
11
11
|
ratio?: `${number}*${number}`;
|
|
12
12
|
/** 是否显示提示,默认 true */
|
|
13
13
|
showTip?: boolean;
|
|
14
|
-
/** 文件大小限制(单位:MB
|
|
14
|
+
/** 文件大小限制(单位:MB),默认 10 */
|
|
15
15
|
size?: number;
|
|
16
16
|
/** 自定义提示内容 */
|
|
17
17
|
tipContent?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PlusOutlined as e,VideoCameraAddOutlined as t,UploadOutlined as i}from"@ant-design/icons";import{Upload as n,Modal as o,Button as l,message as r}from"antd";import{useState as s}from"react";import{jsxs as a,Fragment as d,jsx as c}from"react/jsx-runtime";const p=p=>{const{value:m=[],onChange:u,onPreview:f,onRemove:g,onGetRemoveFile:h,beforeUpload:v,maxCount:w,listType:y,accept:x,ratio:$="",showTip:j=!0,multiple:b=!0,size:C,tipContent:T,uploadButtonText:U,fileType:R,...F}=p,[z,L]=s(!1),[B,I]=s(""),M=".jpg,.jpeg,.png",O=".pdf,.doc,.docx",P=".mp4",A=R||(()=>{if(x){if("*"===x)return"document";const e=x.split(",");return e.some(e=>P.split(",").includes(e))?"video":e.some(e=>O.split(",").includes(e))?"document":e.some(e=>M.split(",").includes(e))?"image":"document"}return"image"})(),D="image"===A,G="video"===A,N="document"===A,S=y||("*"===x?"text":"image"===A?"picture-card":"text"),W=x?"*"===x?"":x:D?M:G?P:N?O:M,k=w||(G?1:D||N?4:1),q=C||(G?100:
|
|
1
|
+
import{PlusOutlined as e,VideoCameraAddOutlined as t,UploadOutlined as i}from"@ant-design/icons";import{Upload as n,Modal as o,Button as l,message as r}from"antd";import{useState as s}from"react";import{jsxs as a,Fragment as d,jsx as c}from"react/jsx-runtime";const p=p=>{const{value:m=[],onChange:u,onPreview:f,onRemove:g,onGetRemoveFile:h,beforeUpload:v,maxCount:w,listType:y,accept:x,ratio:$="",showTip:j=!0,multiple:b=!0,size:C,tipContent:T,uploadButtonText:U,fileType:R,...F}=p,[z,L]=s(!1),[B,I]=s(""),M=".jpg,.jpeg,.png",O=".pdf,.doc,.docx",P=".mp4",A=R||(()=>{if(x){if("*"===x)return"document";const e=x.split(",");return e.some(e=>P.split(",").includes(e))?"video":e.some(e=>O.split(",").includes(e))?"document":e.some(e=>M.split(",").includes(e))?"image":"document"}return"image"})(),D="image"===A,G="video"===A,N="document"===A,S=y||("*"===x?"text":"image"===A?"picture-card":"text"),W=x?"*"===x?"":x:D?M:G?P:N?O:M,k=w||(G?1:D||N?4:1),q=C||(G?100:10),E=U||(G?"上传视频":"上传附件"),H=W.replace(/\./g,"").split(",").join("、"),J=()=>T||`${[`最多上传${k}个文件`,W?`并且只能上传${H}格式的文件`:"可以上传任意格式的文件",q?`文件大小不能超过${q}M`:"",$?`只能上传${$}分辨率的图片`:""].filter(Boolean).join(",")}。`,K=D?c("div",{children:c(e,{style:{fontSize:32}})}):c(l,{type:"primary",icon:c(G?t:i,{}),children:E});return a(d,{children:[c(n,{fileList:m,multiple:b,maxCount:k,listType:S,accept:W,onChange:({file:e,fileList:t})=>{const i=W?W.split(","):[],n=$?$.split("*"):[],o=e.name.substring(e.name.lastIndexOf("."),e.name.length),l=1024*q*1024;if(i.length>0&&!i.includes(o))r.warning(`只能上传${H}格式的文件`);else if(l&&e.size>l)r.warning(`文件大小不能超过${q}M`);else if(2===n.length&&e.type?.startsWith("image/")){const i=i=>{const o=new Image;o.onload=()=>{if(o.width!==+n[0]||o.height!==+n[1]){r.warning(`只能上传${$}分辨率的图片`);const i=t.filter(t=>t.uid!==e.uid);return void u?.(i)}u?.(t)},o.src=i};if(e.url)i(e.url);else{const t=new FileReader;t.onload=e=>{i(e.target.result)},t.readAsDataURL(e)}}else u?.(t)},onPreview:e=>{D&&(I(e.url||e.thumbUrl),L(!0)),f?.(e)},onRemove:e=>(e.originFileObj||h?.(e),g?.(e)),beforeUpload:(e,t)=>!!v&&v(e,t),...F,children:m.length>=k?null:K}),j?J()&&c("div",{style:{marginTop:10,color:"#ff4d4f"},children:J()}):null,c(o,{open:z,title:"查看图片",footer:null,onCancel:()=>{L(!1)},children:c("img",{alt:"preview",style:{width:"100%",objectFit:"scale-down"},src:B})})]})};p.displayName="Upload";export{p as default};
|