Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.dfe3802a.js 5.4KB

pirms 3 mēnešiem
1
  1. import{y as m,_ as X,d as Y,D as Z,r as u,b as ee,o as ae,c as i,e as g,f as B,h as n,i as l,g as b,F as L,J as le,I as h,j as w,k as N,u as r,t as te,x as oe}from"./index.d340e473.js";import{h as ne,i as se,f as ie,c as R,b as de,e as ue,a as re}from"./uploadAction.95992a5e.js";const pe=s=>m.get("/api/v1/file-manage/documentation/group/list",{params:s}),ce=s=>m.get("/api/v1/file-manage/documentation/list",{params:s}),me=s=>m.post(`/api/v1/file-manage/documentation/delete/${s}`),fe=s=>m.post("/api/v1/file-manage/documentation/add",s),ve=s=>m.post("/api/v1/file-manage/documentation/group/add",s),_e=s=>m.post(`/api/v1/file-manage/documentation/group/delete/${s}`);const ye={class:"flex justify-between items-center tab-type-card"},ge=["onClick"],be=["onClick"],we={class:"el-upload__tip"},ke=Y({name:"documentation"}),xe=Object.assign(ke,{setup(s){const{proxy:k}=oe(),T=Z.dictStore.uploadUrl,f=u("1"),v=u([]),x=async()=>{const t=await pe();v.value=t.data,v.value&&v.value.length&&(f.value=v.value[0].id),_()},C=u(),I=ee([{label:"\u5E8F\u53F7",type:"index",width:"80"},{label:"\u6587\u6863\u540D\u79F0",key:"fileName",prop:"fileName",minWidth:"250",showOverflowTooltip:!0},{label:"\u4E0A\u4F20\u65F6\u95F4",key:"createOn",prop:"createOn",showOverflowTooltip:!0,width:"180"},{label:"\u4E0A\u4F20\u8005",key:"createBy",prop:"createBy",width:"160"},{label:"\u6587\u6863\u5927\u5C0F(KB)",key:"size",prop:"size",width:"120"},{label:"\u64CD\u4F5C",slot:"action",width:"160",fixed:"right"}]),F=u(0),V=u([]),_=async(t=C.value.pageParams)=>{const e={...t,groupId:f.value},o=await ce(e);V.value=o.data.records,F.value=o.data.total},G=()=>{C.value.pageSize=1,_()},O=async t=>{const e=await re(t.fileId),o=document.createElement("a");o.style.display="none",o.href=e,o.download=t.fileName,document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(e)},j=t=>{k.$messageBox.confirm("\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u9879\u5417?","\u63D0\u793A\uFF01",{type:"warning"}).then(async()=>{await me(t),k.$message.success("\u5220\u9664\u6210\u529F\uFF01"),await _()})},z=async t=>{await _e(t),k.$message.success("\u5220\u9664\u6210\u529F\uFF01"),await x()},p=u(!1),c=u(1),$=u(),d=u({uploadFile:[],name:""}),S={uploadFile:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u6587\u4EF6"}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5206\u7EC4\u540D\u79F0"}]},D=t=>{c.value=t,p.value=!0},q=async t=>{!t||await t.validate(async e=>{if(e){console.log(d.value);const o=c.value===1?await ve({name:d.value.name}):await fe({fileId:d.value.uploadFile[0].response.data.id,groupId:f.value});console.log(o),k.$message.success("\u63D0\u4EA4\u6210\u529F\uFF01"),c.value===1?await x():await _(),p.value=!1,d.value={uploadFile:[],name:""}}})};return ae(async()=>{await x()}),(t,e)=>{const o=i("el-tab-pane"),E=i("el-tabs"),y=i("el-button"),P=i("table-list"),J=i("el-card"),K=i("el-row"),M=i("el-input"),U=i("el-form-item"),W=i("el-upload"),A=i("el-form"),H=i("el-dialog");return g(),B(L,null,[n(K,null,{default:l(()=>[n(J,{class:"w-full mt-8 tab-card"},{header:l(()=>[b("div",ye,[n(E,{modelValue:f.value,"onUpdate:modelValue":e[0]||(e[0]=a=>f.value=a),type:"card",closable:"",onTabChange:G,onTabRemove:z},{default:l(()=>[(g(!0),B(L,null,le(v.value,a=>(g(),h(o,{key:a.id,label:a.name,name:a.id},null,8,["label","name"]))),128))]),_:1},8,["modelValue"]),b("div",null,[n(y,{type:"primary",size:"small",plain:"",onClick:e[1]||(e[1]=a=>D(2))},{default:l(()=>[w(" \u4E0A\u4F20\u6587\u6863 ")]),_:1}),n(y,{type:"primary",size:"small",icon:"plus",onClick:e[2]||(e[2]=a=>D(1))},{default:l(()=>[w(" \u65B0\u589E\u5206\u7C7B ")]),_:1})])])]),default:l(()=>[n(P,{ref_key:"tableListRef",ref:C,column:I,data:V.value,total:F.value,onGetTableData:_},{action:l(({scope:a})=>[b("a",{class:"text-primary",onClick:Q=>O(a.row)},"\u4E0B\u8F7D",8,ge),b("a",{class:"text-danger",onClick:Q=>j(a.row.id)},"\u5220\u9664",8,be)]),_:1},8,["column","data","total"])]),_:1})]),_:1}),n(H,{modelValue:p.value,"onUpdate:modelValue":e[7]||(e[7]=a=>p.value=a),title:c.value===1?"\u65B0\u589E\u5206\u7C7B":"\u4E0A\u4F20\u6587\u6863",width:"600px","destroy-on-close":"",onClose:e[8]||(e[8]=a=>p.value=!1)},{footer:l(()=>[n(y,{type:"primary",onClick:e[5]||(e[5]=a=>q($.value))},{default:l(()=>[w(" \u63D0\u4EA4 ")]),_:1}),n(y,{onClick:e[6]||(e[6]=a=>p.value=!1)},{default:l(()=>[w(" \u5173\u95ED ")]),_:1})]),default:l(()=>[n(A,{ref_key:"formRef",ref:$,model:d.value,rules:S,"label-width":"90px","label-suffix":":"},{default:l(()=>[c.value===1?(g(),h(U,{key:0,label:"\u5206\u7EC4\u540D\u79F0",prop:"name"},{default:l(()=>[n(M,{modelValue:d.value.name,"onUpdate:modelValue":e[3]||(e[3]=a=>d.value.name=a),maxlength:"50",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})):N("",!0),c.value===2?(g(),h(U,{key:1,label:"\u6587\u6863",prop:"uploadFile"},{default:l(()=>[n(W,{"file-list":d.value.uploadFile,"onUpdate:fileList":e[4]||(e[4]=a=>d.value.uploadFile=a),class:"w-full",action:r(T),"on-success":a=>r(ne)(a,d.value.uploadFile),"on-error":r(se),"before-upload":a=>r(ie)(a,{types:r(R)}),accept:r(R).map(a=>`.${a}`).join(","),limit:1,"on-preview":r(de)},{tip:l(()=>[b("div",we,"\u652F\u6301"+te(r(ue))+"\u6587\u4EF6",1)]),default:l(()=>[n(y,{type:"primary",class:"mr-4"},{default:l(()=>[w("\u4E0A\u4F20\u6587\u4EF6")]),_:1})]),_:1},8,["file-list","action","on-success","on-error","before-upload","accept","on-preview"])]),_:1})):N("",!0)]),_:1},8,["model"])]),_:1},8,["modelValue","title"])],64)}}}),Fe=X(xe,[["__scopeId","data-v-770d9f73"]]);export{Fe as default};