PageSourceSearch

https://knitlog.ai/assets/FileDriveView-BWxcBp_8.js

js knitlog.ai collected 2026-10-05 12:08:07 UTC 12,549 bytes, 1 lines download raw bytes

1import{a as be,u as ve}from"./state-CdWEjV8b.js";import{l as we,o as Pe,u as $e,g as Ee}from"./drive-pvvgwOtf.js";import{_ as Oe,P as Re,G as ue,L as pe,d as ae,N as Q,W as se,o as ne,H as Y}from"./index--ufHTY0T.js";import{J as me,i as _,r as z,j as ee,k as Fe,aJ as Ue,c as T,v as K,o as i,a as r,b as s,t as c,e as R,h as M,w as V,g as N,A as te,x as oe,n as y,F as x,z as X,u as I,T as Te,aS as xe,aT as Ae,a6 as Le}from"./vendor-DYd12rEM.js";import{a as Me}from"./router-JLuSCq_Z.js";import{D as Ve}from"./index-17oKpjxl.js";import fe from"./Loading-BOLnEgjm.js";import"./calendar-DlVrEelk.js";import"./i18n-message-CPotKUh9.js";const w=F=>(xe("data-v-4d72a25c"),F=F(),Ae(),F),Ne={class:"drive-wrapper flex flex-column"},ze={key:0,class:"title be-font text-grey-md bold size-18 flex y-center"},Be={class:"search"},je={key:0,class:"search-group"},He={class:"search-group-top reference"},We={class:"search-group-top--title"},Ge={class:"search-group-bottom--date"},Je={class:"search-group-bottom"},Qe=w(()=>s("i",{class:"font-icon-search"},null,-1)),Ye={class:"btn-text"},Ke={key:1,class:"icon-wrap"},Xe=w(()=>s("i",{class:"icon icon--robot-reference"},null,-1)),Ze=[Xe],qe=w(()=>s("i",{class:"font-icon-left-arrow"},null,-1)),et=[qe],tt={class:"be-list-wrapper"},at={class:"pagination-wrapper reference"},st={class:"pagination"},nt={class:"search-group flex flex-column x-center"},ot={class:"current-page-option flex y-center"},lt=w(()=>s("span",{class:"be-icon size-20 icon-grey-md icon-dropdown"},[s("i",{class:"font-icon-right-arrow"})],-1)),it=["onClick"],rt={class:"status"},ct=w(()=>s("div",{class:"line xs"},null,-1)),dt={class:"btn-wrap"},ut={class:"plan-wrapper flex flex-column gap-4"},pt={key:0,class:"none"},ft={class:"plan"},vt={class:"credit-wrapper flex y-center x-between gap-4"},mt=w(()=>s("i",{class:"font-icon-writing"},null,-1)),gt=["disabled"],ht={class:"be-table"},_t=w(()=>s("colgroup",null,[s("col",{style:{width:"441px"}}),s("col",{style:{width:"136px"}}),s("col",{style:{width:"200px"}}),s("col",{style:{width:"150px"}}),s("col",{style:{width:"200px"}})],-1)),Dt={class:"thead-row"},yt=["onClick"],It=w(()=>s("i",{class:"font-icon-refresh"},null,-1)),St=[It],kt=["onClick"],Ct={key:1,class:"none-data"},bt={colspan:"8"},wt={__name:"FileDrive",props:{fileData:Array,directoriesData:Object,searchFilter:Object,dateRange:Object,page:Object,creditAvailable:Number,fileStatusMap:Map,userData:Object},emits:["change","dateChange","upload","search"],setup(F,{emit:D}){const m=Me(),B=me("$modal"),{locale:Z}=be(),A=ve(),S=D,o=F,C=_(!1),p=_(!1),U=_(o.searchFilter),d=_([]),f=_([]),b=_(null),P=_(new Set),L=_(!1),g=_({}),$=z({isPageOption:!1}),E=e=>e===12?5:e;ee(()=>A.state.creditData,e=>{g.value=e==null?void 0:e.data.fileCredit},{immediate:!0}),ee(()=>o.fileStatusMap,e=>{if(!e)return;let t=0;f.value=f.value.filter(l=>{const h=e.get(l.fileId);return h&&(h.status===4||h.status===12)?(P.value.delete(l.fileId),t++,!1):!0}),t>0&&f.value.length===0&&H()},{deep:!0}),ee(()=>o.fileData,()=>{o.fileData&&o.fileData.length>0&&o.fileData.some(e=>e.status===1||e.status===3)&&he()},{immediate:!0}),Fe(()=>{window.addEventListener("click",W),window.addEventListener("touchstart",W)}),Ue(()=>{window.removeEventListener("click",W),window.removeEventListener("touchstart",W),H()});const u=T(()=>{var t,l;const e=((t=g.value)==null?void 0:t.remainCredit)/((l=g.value)==null?void 0:l.totalCredit)*100;return e>=70?"full":e>=30?"half":"handful"}),n=T(()=>{var e,t;return((t=(e=g.value)==null?void 0:e.totalCredit)==null?void 0:t.toString().length)>6}),le=T(()=>"----.--.-- ~ ----.--.--"),ge=T(()=>e=>(e/(1024*1024)).toFixed(2)),j=T(()=>{const e=new Set;return o.fileData&&o.fileData.forEach(t=>{let l=E(t.status);const h=k(t.fileId);h&&(l=h.status),(l===0||l===1||l===3||l===5)&&e.add(t.fileId)}),e}),ie=T(()=>{var e,t,l;return((e=g.value)==null?void 0:e.remainCredit)==null||((t=g.value)==null?void 0:t.remainCredit)===0||((l=o.userData)==null?void 0:l.isExpiredPlan)===!0}),he=()=>{if(!o.fileData)return;const e=new Set(f.value.map(t=>t.fileId));o.fileData.forEach(t=>{const l=new Date,h=new Date(t.regDate),O=l.getTime()-h.getTime(),G=24*60*60*1e3;O<=G&&O>=0&&(t.status===1||t.status===3)&&(e.has(t.fileId)||f.value.push({fileId:t.fileId,status:t.status,addedAt:Date.now()}))}),f.value.length>0&&!b.value?_e():f.value.length===0&&b.value&&H()},_e=()=>{b.value||(b.value=setInterval(()=>{if(f.value.length===0){H();return}
1f.value.forEach(e=>{if(P.value.has(e.fileId))return;P.value.add(e.fileId);const t={params:{fileId:e.fileId,status:e.status}};S("change","fileStatus",t),setTimeout(()=>{P.value.delete(e.fileId)},1e3)})},5e3))},H=async()=>{var e,t;b.value&&(clearInterval(b.value),b.value=null,P.value.clear(),g.value=await((t=(e=A.dispatch("storeCreditData",{currentCredit:null}))==null?void 0:e.data)==null?void 0:t.fileCredit))},k=e=>{var l;const t=(l=o.fileStatusMap)==null?void 0:l.get(e);return t?{...t,status:E(t.status)}:null},De=e=>{const t=k(e);return t?parseInt(t.completePage/t.totalPage*100)===100?99:parseInt(t.completePage/t.totalPage*100):0},ye=e=>{S("dateChange",e.start,e.end),C.value=!1},re=e=>{$.isPageOption=!$.isPageOption},Ie=(e,t)=>{S("change","pageOption",e),re()},Se=e=>{d.value=[],d.value=e.target.files;const t=50*1024*1024,l=new FormData;if(d.value.length>0)for(let h=0;h<d.value.length;h++){const O=d.value[h];if(O.size>t)return e.target.value="",B.open(se,ne.FILE_UPLOAD_ERROR);l.append("files",O)}l.append("currentDirId",o.directoriesData.currentId),S("upload",l),e.target.value=""},ke=e=>{S("change","current",e)},Ce=()=>{S("dateChange",null,null)},W=e=>{$.isPageOption=!1,e.target.className==="be-input"&&(C.value=!1)},ce=()=>{S("search")};return(e,t)=>{var q,de;const l=K("UiInput"),h=K("UiButton"),O=K("UiPagination"),G=K("UiTooltip");return i(),r("div",Ne,[s("div",{class:y(["search-wrapper",{isSearchHide:p.value}])},[p.value?R("",!0):(i(),r("h3",ze,c(e.$t("common.searchFilter")),1)),s("div",Be,[p.value?R("",!0):(i(),r("div",je,[s("div",He,[s("div",We,[M(l,{type:"text",modelValue:U.value.name,"onUpdate:modelValue":t[0]||(t[0]=a=>U.value.name=a),onEnter:ce},{label:V(()=>[N(c(e.$t("drive.search.name")),1)]),_:1},8,["modelValue"])]),s("div",Ge,[M(l,{"input-style":"date",type:"text",modelValue:le.value,"onUpdate:modelValue":t[1]||(t[1]=a=>le.value=a),"date-range":o.dateRange,onDateReset:Ce,onClick:t[2]||(t[2]=te(a=>C.value=!C.value,["stop"]))},{label:V(()=>[N(c(e.$t("drive.search.createdDate")),1)]),_:1},8,["modelValue","date-range"]),C.value?(i(),oe(Ve,{key:0,onSelectDateRange:t[3]||(t[3]=a=>ye(a))})):R("",!0)])]),s("div",Je,[M(h,{type:"icon primary sm",onClick:ce},{default:V(()=>[Qe,s("span",Ye,c(e.$t("common.search")),1)]),_:1})])])),p.value?R("",!0):(i(),r("span",Ke,Ze)),s("div",{class:"search-hide",onClick:t[4]||(t[4]=a=>p.value=!p.value)},et)])],2),s("div",tt,[s("div",at,[s("div",st,[s("div",nt,[s("div",{class:"be-dropdown status flex y-center",ref:"dropdown",onClick:t[5]||(t[5]=te(a=>re(),["stop","prevent"]))},[s("span",ot,c(e.$t("common.pageCount",{count:o.page.selectedOption})),1),lt,M(Te,{name:"slide"},{default:V(()=>[$.isPageOption?(i(),r("ul",{key:0,class:y(["list",{"is-show":$.isPageOption}])},[(i(!0),r(x,null,X(I(Re),a=>(i(),r("li",{key:a,onClick:te(v=>Ie(a,"page"),["stop"])},[s("span",rt,c(e.$t("common.pageCount",{count:a})),1)],8,it))),128))],2)):R("",!0)]),_:1})],512)]),ct,M(O,{total:o.page.totalLength,limit:o.page.limit,currentPage:o.page.currentPage,onChangePage:ke},null,8,["total","limit","currentPage"])]),s("div",dt,[L.value?(i(),oe(G,{key:0,class:y({"none-tooltip":!((q=g.value)!=null&&q.remainCredit)}),"arrow-position":"b-end","min-width":(de=g.value)!=null&&de.remainCredit?"165":"155"},{content:V(()=>{var a,v,J;return[s("div",ut,[(a=g.value)!=null&&a.remainCredit?(i(),r(x,{key:1},[s("span",ft,c(e.$t("plan.remainingFile")),1),s("div",vt,[s("span",{class:y(["credit",{over:n.value}])},c(I(ue)((v=g.value)==null?void 0:v.remainCredit))+"/"+c(I(ue)((J=g.value)==null?void 0:J.totalCredit)),3),s("i",{class:y(["icon",`icon--battery-${u.value}`])},null,2)])],64)):(i(),r("span",pt,c(e.$t("plan.notRemainFile")),1))])]}),_:1},8,["class","min-width"])):R("",!0),s("label",{for:"file_upload",class:y(["file-upload-btn",{disabled:ie.value,[I(Z)]:!0}]),onMouseover:t[6]||(t[6]=a=>L.value=!0),onMouseleave:t[7]||(t[7]=a=>L.value=!1)},[N(c(e.$t("drive.upload"))+" ",1),mt],34),s("input",{id:"file_upload",ref:"fileUpload",type:"file",hidden:!0,disabled:ie.value,accept:".pdf, application/pdf",onChange:Se},null,40,gt)])]),s("table",ht,[_t,s("thead",null,[s("tr",Dt,[(i(!0),r(x,null,X(I(pe),a=>(i(),r("th",{key:a.key},[s("span",null,c(e.$t(`drive.column.${a.title}`)),1)]))),128))])]),s("tbody",{class:y({noData:!o.fileData||o.fileData.length===0})},[o.fileData&&o.fileData.length>0?(i(!0),r(x,{key:0},X(o.fileData,a=>(i(),r("tr",{key:a.fileId},[(i(!0),r(x,null,X(I(pe),v=>(i(),r("td",{key:v.key,class:y({disabled:j.value.has(a.fileId)&&v.key!=="status"})},[v.key==="regDate"?(i(),r("span",{key:0,class:y({disabled:j.value.has(a.fileId)})},c(I(ae)(a[v.key],"time")),3)):v.key==="status"?(i(),r("span",{key:1,class:y(["drive-status",k(a.fileId)?I(Q)[k(a.fileId).status]:I(Q)[E(a[v.key])]])},[N(c(k(a.fileId)?e.$t(`drive.status.${I(Q)[k(a.fileId).status]}`):e.$t(`drive.status.${I(Q)[E(a[v.key])]}`))+" ",1),(k(a.fileId)?k(a.fileId).status===5:E(a[v.key])===5)?(i(),r("span",{key:0,class:"restart-btn",onClick:J=>S("retry",a.fileId)},St,8,yt)):k(a.fileId)&&k(a.fileId).status===3?(i(),r(x,{key:1},[N(" ("+c(De(a.fileId))+"%) ",1)],64)):R("",!0)],2)):v.key==="fileSize"?(i(),r("span",{key:2,class:y({disabled:j.value.has(a.fileId)})},c(`${ge.value(a[v.key])}MB`),3)):(i(),r("span",{key:3,class:y({title:v.key==="fileName",disabled:j.value.has(a.fileId)}),onClick:J=>I(m).push({name:"FileDriveDetail",params:{fileId:a.fileId}})},c(a[v.key]||"-"),11,kt))],2))),128))]))),128)):(i(),r("tr",Ct,[s("td",bt,c(e.$t("common.noData")),1)]))],2)])])])}}},Pt=Oe(wt,[["__scopeId","data-v-4d72a25c"]]),Lt={__name:"FileDriveView",setup(F){const D=me("$modal"),m=ve(),B=_([]),Z=_(null),A=_(0),S=_(new Map),o=_(null),C=z({currentId:null,directories:[]}),p=z({start:m.state.fileSearchData.startDate?m.state.fileSearchData.startDate:null,end:m.state.fileSearchData.endDate?m.state.fileSearchData.endDate:null}),U=z({name:m.state.fileSearchData.name?m.state.fileSearchData.name:""}),d=z({totalLength:0,limit:10,currentPage:m.state.currentPage?parseInt(m.state.currentPage):1,selectedOption:m.state.limitPage?parseInt(m.state.limitPage):10});Le(async()=>{await f(),o.value=await m.dispatch("storeUserData")});const f=async()=>{try{const u={params:{currentDirId:Z.value,page:d.currentPage,perPage:d.selectedOption,name:U.name,startDate:p.start&&ae(p.start),endDate:p.end&&ae(p.end)}},n=await we(u);n.code===Y.SUCCESS?(D.close(),C.currentId=n.data.currentDirId,C.directories=n.data.directories,B.value=n.data.files.file,d.totalLength=n.data.files.c
1ount,d.limit=d.selectedOption,A.value=n.data.parserCreditAvailable):(D.close(),alert(n.message),console.log(`Error: ${n}`))}catch(u){D.close(),console.error(`Error: ${u}`)}},b=async u=>{D.open(fe);try{const n=await $e(u,{headers:{"Content-Type":"multipart/form-data"}});n.code===Y.SUCCESS?(D.close(),await f()):(D.close(),D.open(se,ne.PARSER_CREDIT_ERROR),console.log(`Error: ${n}`))}catch(n){D.open(se,ne.PARSER_CREDIT_ERROR),console.error(`Error: ${n}`)}},P=async u=>{D.open(fe);try{const n=await Pe({fileId:u});n.code===Y.SUCCESS?(D.close(),await f()):(D.close(),alert(n.message),console.log(`Error: ${n}`))}catch(n){console.error(`Error: ${n}`)}},L=async u=>{try{const n=await Ee(u);n.code===Y.SUCCESS?S.value.set(n.data.fileId,n.data):(alert(n.message),console.log(`Error: ${n}`))}catch(n){console.error(`Error: ${n}`)}},g=async(u,n)=>{switch(u){case"current":d.currentPage=n;break;case"pageOption":d.selectedOption=n,d.currentPage=1;break;case"fileStatus":await L(n);break;case"load":await f();break}u!=="fileStatus"&&await f()},$=(u,n)=>{p.start=u,p.end=n},E=async()=>{m.commit("setPagination",{newPage:1,newLimit:d.selectedOption}),d.currentPage=1,m.commit("setFileSearchData",{name:U.name,startDate:p.start,endDate:p.end}),await f()};return(u,n)=>(i(),oe(Pt,{"file-data":B.value,"directories-data":C,"search-filter":U,"date-range":p,page:d,"credit-available":A.value,"file-status-map":S.value,"user-data":o.value,onChange:g,onDateChange:$,onUpload:b,onSearch:E,onRetry:P},null,8,["file-data","directories-data","search-filter","date-range","page","credit-available","file-status-map","user-data"]))}};export{Lt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.