You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 line
5.5KB

  1. import{s as c,_ as X,d as Y,B as Z,r as u,b as ee,o as ae,c as i,e as g,f as L,h as n,i as l,g as b,F as N,H as le,G as F,j as w,k as R,u as r,t as te,q as oe}from"./index.a2494fc2.js";import{h as ne,i as se,f as ie,c as T,b as de,e as ue,a as re}from"./uploadAction.0eabe13b.js";const pe=s=>c.get("/api/v1/file-manage/documentation/group/list",{params:s}),me=s=>c.get("/api/v1/file-manage/documentation/list",{params:s}),ce=s=>c.post(`/api/v1/file-manage/documentation/delete/${s}`),fe=s=>c.post("/api/v1/file-manage/documentation/add",s),ve=s=>c.post("/api/v1/file-manage/documentation/group/add",s),_e=s=>c.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(),G=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(),h=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"}]),V=u(0),$=u([]),_=async(t=C.value.pageParams)=>{const e={...t,groupId:f.value},o=await me(e);$.value=o.data.records,V.value=o.data.total},I=()=>{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 ce(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),m=u(1),D=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"}]},B=t=>{m.value=t,p.value=!0},q=async t=>{!t||await t.validate(async e=>{if(e){console.log(d.value);const o=m.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"),m.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"),H=i("el-card"),K=i("el-row"),M=i("el-input"),U=i("el-form-item"),W=i("el-upload"),A=i("el-form"),J=i("el-dialog");return g(),L(N,null,[n(K,null,{default:l(()=>[n(H,{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:I,onTabRemove:z},{default:l(()=>[(g(!0),L(N,null,le(v.value,a=>(g(),F(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=>B(2))},{default:l(()=>e[9]||(e[9]=[w(" \u4E0A\u4F20\u6587\u6863 ")])),_:1}),n(y,{type:"primary",size:"small",icon:"plus",onClick:e[2]||(e[2]=a=>B(1))},{default:l(()=>e[10]||(e[10]=[w(" \u65B0\u589E\u5206\u7C7B ")])),_:1})])])]),default:l(()=>[n(P,{ref_key:"tableListRef",ref:C,column:h,data:$.value,total:V.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(J,{modelValue:p.value,"onUpdate:modelValue":e[7]||(e[7]=a=>p.value=a),title:m.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(D.value))},{default:l(()=>e[12]||(e[12]=[w(" \u63D0\u4EA4 ")])),_:1}),n(y,{onClick:e[6]||(e[6]=a=>p.value=!1)},{default:l(()=>e[13]||(e[13]=[w(" \u5173\u95ED ")])),_:1})]),default:l(()=>[n(A,{ref_key:"formRef",ref:D,model:d.value,rules:S,"label-width":"90px","label-suffix":":"},{default:l(()=>[m.value===1?(g(),F(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})):R("",!0),m.value===2?(g(),F(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(G),"on-success":a=>r(ne)(a,d.value.uploadFile),"on-error":r(se),"before-upload":a=>r(ie)(a,{types:r(T)}),accept:r(T).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(()=>e[11]||(e[11]=[w("\u4E0A\u4F20\u6587\u4EF6")])),_:1})]),_:1},8,["file-list","action","on-success","on-error","before-upload","accept","on-preview"])]),_:1})):R("",!0)]),_:1},8,["model"])]),_:1},8,["modelValue","title"])],64)}}}),Ve=X(xe,[["__scopeId","data-v-770d9f73"]]);export{Ve as default};