import{S as j,E as d}from"./index.BKEMpsLA.js";import{a as E,r,w as y,aj as s,J as L,o as z,K as t,S as l,u as A,P as v,b as V}from"./vue.YrNK8sx4.js";import{_ as I}from"./_plugin-vue_export-helper.DlAUqK2U.js";const O={class:"dialog-footer"},T=E({__name:"index",props:{visible:{type:Boolean}},emits:["update:visible","confirm"],setup(x,{expose:C,emit:h}){const b=x,u=h,n=r(b.visible),P=r("http://1.94.168.85:8086/api/system/upload/");y(()=>b.visible,o=>{n.value=o}),y(()=>n.value,o=>{u("update:visible",o)});const g=r([]),a=r({damage_type:0,condition:"",photos:[]}),k=o=>o.type==="image/jpeg"||o.type==="image/png"?o.size/1024/1024<5?!0:(d.error("图片大小不能超过5MB！"),!1):(d.error("只能上传JPG/PNG格式的图片！"),!1),w=(o,e)=>{o.code===2e3?(a.value.photos.push(o.data.url),d.success("上传成功")):d.error(o.msg||"上传失败")},B=o=>{d.error("上传失败："+(o.message||"未知错误"))},G=o=>{const e=a.value.photos.findIndex(p=>p.filename===o.name);e!==-1&&a.value.photos.splice(e,1)},m=()=>{a.value={damage_type:0,condition:"",photos:[]},g.value=[],u("update:visible",!1)},N=()=>{u("confirm",a.value),m()};return C({dialogVisible:n}),(o,e)=>{const p=s("el-input"),c=s("el-form-item"),f=s("el-option"),U=s("el-select"),_=s("el-button"),J=s("el-upload"),M=s("el-form"),S=s("el-dialog");return z(),L(S,{modelValue:n.value,"onUpdate:modelValue":e[2]||(e[2]=i=>n.value=i),title:"异常操作",width:"500px","close-on-click-modal":!1,onClose:m},{footer:t(()=>[V("span",O,[l(_,{onClick:m},{default:t(()=>e[5]||(e[5]=[v("取消")])),_:1}),l(_,{type:"primary",onClick:N},{default:t(()=>e[6]||(e[6]=[v("确认")])),_:1})])]),default:t(()=>[l(M,{model:a.value,"label-width":"80px"},{default:t(()=>[l(c,{label:"异常说明"},{default:t(()=>[l(p,{modelValue:a.value.condition,"onUpdate:modelValue":e[0]||(e[0]=i=>a.value.condition=i),type:"textarea",rows:3,placeholder:"请输入异常说明"},null,8,["modelValue"])]),_:1}),l(c,{label:"异常类型"},{default:t(()=>[l(U,{modelValue:a.value.damage_type,"onUpdate:modelValue":e[1]||(e[1]=i=>a.value.damage_type=i),placeholder:"请选择异常类型"},{default:t(()=>[l(f,{label:"严重损坏",value:0}),l(f,{label:"中度损坏",value:1}),l(f,{label:"轻度损坏",value:2})]),_:1},8,["modelValue"])]),_:1}),l(c,{label:"照片"},{default:t(()=>[l(J,{class:"upload-demo",action:P.value,headers:{Authorization:"JWT "+A(j).get("token")},"on-success":w,"on-error":B,"before-upload":k,"file-list":g.value,"list-type":"picture",multiple:"","on-remove":G},{tip:t(()=>e[4]||(e[4]=[V("div",{class:"el-upload__tip"}," 只能上传jpg/png文件，且不超过5MB ",-1)])),default:t(()=>[l(_,{type:"primary"},{default:t(()=>e[3]||(e[3]=[v("选择图片")])),_:1})]),_:1},8,["action","headers","file-list"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),W=I(T,[["__scopeId","data-v-5c7de92a"]]);export{W as default};
