Files
weiyu/deploy/server/admin/591.d475fbbc.async.js

1 line
8.9 KiB
JavaScript
Raw Normal View History

2025-07-12 18:44:46 +08:00
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[591],{16570:function(e,t,a){a(44194);var i=a(34353),n=a(54881),r=a(43906),o=a(31549);t.Z=function(e){var t,a,l=e.file,s=e.onDelete,d=e.showDelete,u=void 0===d||d,f=(0,r.useIntl)();return(0,o.jsxs)("div",{style:{position:"relative",width:"50px",height:"50px",border:"1px solid #f0f0f0",borderRadius:"4px",overflow:"hidden"},title:f.formatMessage({id:null!=l&&null!==(t=l.fileType)&&void 0!==t&&t.startsWith("image/")?"upload.preview.image":"upload.preview.file"}),children:[u&&(0,o.jsx)(i.ZP,{type:"text",size:"small",icon:(0,o.jsx)(n.Z,{}),onClick:function(){return s(l.uid)},style:{position:"absolute",top:0,right:0,padding:"2px",background:"rgba(255, 255, 255, 0.8)",border:"none",borderRadius:"0 4px 0 4px",zIndex:1}}),(0,o.jsx)("div",{onClick:function(){return window.open(l.fileUrl,"_blank")},style:{width:"100%",height:"100%",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:null!=l&&null!==(a=l.fileType)&&void 0!==a&&a.startsWith("image/")?(0,o.jsx)("img",{src:null==l?void 0:l.fileUrl,alt:null==l?void 0:l.fileName,style:{width:"100%",height:"100%",objectFit:"cover"}}):(0,o.jsx)("div",{style:{fontSize:"12px",padding:"4px",textAlign:"center",wordBreak:"break-all",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:l.fileName})}),(0,o.jsx)("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"rgba(0, 0, 0, 0.5)",color:"#fff",fontSize:"10px",padding:"2px",textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:l.fileName})]},l.uid)}},80591:function(e,t,a){var i=a(90819),n=a.n(i),r=a(89933),o=a.n(r),l=a(76711),s=a.n(l),d=a(73193),u=a.n(d),f=a(45332),c=a.n(f),p=a(44194),g=a(42085),m=a(47944),h=a(50220),v=a(39686),y=a(34353),x=a(28977),w=a.n(x),b=a(18232),M=a(55567),j=a(81343),k=a(16570),T=a(43906),U=a(53818),S=a(9942),N=a(31549),O=h.Z.Dragger;t.Z=function(e){var t=e.type,a=e.acceptType,i=e.isModalOpen,r=e.attachments,l=e.handleSubmit,d=e.handleCancel,f=(0,T.useIntl)(),x=(0,U.j)((function(e){return e.currentKbase})),C=(0,S.u)((function(e){return e.currentOrg})),D=(0,p.useState)([]),L=c()(D,2),Z=L[0],I=L[1],z=(0,p.useState)({file:null,fileName:"test.pdf",fileType:"application/pdf",isAvatar:"false",kbType:t,categoryUid:"",kbUid:null==x?void 0:x.uid,orgUid:null==C?void 0:C.uid,channel:b.XtJ,extra:{autoGenerateLlmQa:"false",autoLlmSplit:"false"}}),A=c()(z,2),F=A[0],E=A[1],P=(0,p.useState)([]),W=c()(P,2),B=W[0],R=W[1],Y=(0,p.useState)(!1),H=c()(Y,2),_=H[0],G=H[1];(0,p.useEffect)((function(){console.log("UploadDrag currentKbase",x),x&&E((function(e){return u()(u()({},e),{},{kbUid:null==x?void 0:x.uid})}))}),[x]);var J=(0,p.useMemo)((function(){return{name:"file",multiple:!0,accept:a,action:(0,j.M$)(),headers:{Authorization:"Bearer "+localStorage.getItem(b.LA8)},data:u()({},F),fileList:B,showUploadList:!0,beforeUpload:function(e){if(e.size>10485760)return M.yw.error(f.formatMessage({id:"upload.size.limit",defaultMessage:"文件大小不能超过10MB"})),h.Z.LIST_IGNORE;if(a&&"*"!==a){var t,i=a.split(","),n="."+(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase());if(!i.some((function(t){return"*"===t||(t.startsWith(".")?n===t:e.type===t)})))return M.yw.error(f.formatMessage({id:"upload.type.invalid",defaultMessage:"不支持的文件类型: {fileType},请选择 {acceptTypes} 格式的文件"},{fileType:e.type||n,acceptTypes:a})),h.Z.LIST_IGNORE}return R((function(t){return[].concat(s()(t),[u()(u()({},e),{},{status:"done",name:e.name,uid:e.uid,originFileObj:e})])})),!1},onRemove:function(e){R((function(t){return t.filter((function(t){return t.uid!==e.uid}))}))},onChange:function(e){var t;("uploading"===e.file.status&&M.yw.loading(f.formatMessage({id:"upload.uploading"},{filename:e.file.name})),"done"===e.file.status)?200===(null===(t=e.file.response)||void 0===t?void 0:t.code)?(M.yw.destroy(),M.yw.success(f.formatMessage({id:"upload.success"},{filename:e.file.name})),I((function(t){return[].concat(s()(