import{A as U}from"./index-2927ba89.js";import{a as f,E as k}from"./element-plus-91d6d961.js";import{H as h,_ as B,a0 as v,ah as m,o as g,c as V,V as l,P as o,a as z,T as p,S as E,h as P}from"./@vue-6dabbe94.js";const M=["src"],R={class:"dialog-footer"},q=h({name:"attachDetail"}),G=h({...q,emits:["reloadTable"],setup(H,{expose:b,emit:_}){const d=U(),{proxy:D}=P(),e=B({isShowDialog:!1,ruleForm:{id:null,fileName:"",fileDesc:""},rules:{fileName:{required:!0,message:"请输入文件名称",trigger:"blur"}}}),y=s=>{e.isShowDialog=!0,e.ruleForm.id=s},i=()=>{e.isShowDialog=!1},w=()=>{i(),F()},x=()=>{D.$refs.myRefForm.validate(s=>{if(s){let t={fileName:e.ruleForm.fileName,fileDesc:e.ruleForm.fileDesc};d.updateAttach(e.ruleForm.id,t).then(()=>{i(),F(),_("reloadTable")}).catch(r=>{f({showClose:!0,message:r.message?r.message:"系统错误",type:"error"})})}})},N=()=>{k.confirm("此操作将永久删除附件, 是否继续?","提示",{confirmButtonText:"删除",cancelButtonText:"取消",type:"warning"}).then(()=>{d.delAttach(e.ruleForm.id).then(()=>{i(),f.success("删除成功"),_("reloadTable")}).catch(s=>{f.error(s.message)})}).catch(()=>{})},C=()=>{e.ruleForm.id&&e.ruleForm.id!=null&&d.getAttach(e.ruleForm.id).then(s=>{e.ruleForm=s.data})};v(()=>{C()});const F=()=>{e.ruleForm={}};return b({openDialog:y}),(s,t)=>{const r=m("el-col"),n=m("el-input"),u=m("el-form-item"),S=m("el-row"),A=m("el-form"),c=m("el-button"),T=m("el-dialog");return g(),V("div",null,[l(T,{title:"图片详情",modelValue:e.isShowDialog,"onUpdate:modelValue":t[5]||(t[5]=a=>e.isShowDialog=a),width:"769px"},{footer:o(()=>[z("span",R,[l(c,{type:"danger",onClick:N},{default:o(()=>[p("删 除")]),_:1}),l(c,{onClick:w},{default:o(()=>[p("取 消")]),_:1}),l(c,{type:"primary",onClick:x},{default:o(()=>[p("保 存")]),_:1})])]),default:o(()=>[l(A,{model:e.ruleForm,"label-width":"80px",rules:e.rules,ref:"myRefForm"},{default:o(()=>[l(S,{gutter:35},{default:o(()=>[l(r,{class:"mb20"},{default:o(()=>[e.ruleForm.fileType=="image"?(g(),V("img",{key:0,alt:"fastcms",src:e.ruleForm.path},null,8,M)):E("",!0)]),_:1}),l(r,{class:"mb20"},{default:o(()=>[l(u,{label:"文件名称",prop:"fileName"},{default:o(()=>[l(n,{modelValue:e.ruleForm.fileName,"onUpdate:modelValue":t[0]||(t[0]=a=>e.ruleForm.fileName=a),placeholder:"请输入文件名称"},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{class:"mb20"},{default:o(()=>[l(u,{label:"文件描述",prop:"fileDesc"},{default:o(()=>[l(n,{modelValue:e.ruleForm.fileDesc,"onUpdate:modelValue":t[1]||(t[1]=a=>e.ruleForm.fileDesc=a),placeholder:"请输入文件描述",clearable:""},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{class:"mb20"},{default:o(()=>[l(u,{label:"文件路径",prop:"filePath"},{default:o(()=>[l(n,{modelValue:e.ruleForm.filePath,"onUpdate:modelValue":t[2]||(t[2]=a=>e.ruleForm.filePath=a),readonly:""},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{class:"mb20"},{default:o(()=>[l(u,{label:"文件大小",prop:"size"},{default:o(()=>[l(n,{modelValue:e.ruleForm.fileSize,"onUpdate:modelValue":t[3]||(t[3]=a=>e.ruleForm.fileSize=a),readonly:""},null,8,["modelValue"])]),_:1})]),_:1}),l(r,{class:"mb20"},{default:o(()=>[l(u,{label:"上传时间",prop:"size"},{default:o(()=>[l(n,{modelValue:e.ruleForm.created,"onUpdate:modelValue":t[4]||(t[4]=a=>e.ruleForm.created=a),readonly:""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])])}}});export{G as _};
