import{h as w,b as D}from"./index.a762c091.js";import{u as V}from"./use-response-handle.23bba72b.js";import{q as A,a4 as _,B as j,bl as q,b0 as R,r as o,o as m,K as U,H as u,t as a,p as f,n as c,v as S,bi as H,S as M,aF as g}from"./index.10c3f8e5.js";const N=["src"],I={key:1,class:"text"},P=f("span",{"text-sm":""},"\u5927\u5C0F:\u5C0F\u4E8E1M; \u5C3A\u5BF8:100*100; \u7C7B\u578B:jpg.png.bmp.jpeg",-1),z=M("\u4FDD\u5B58"),L=A({__name:"approval-pending",emits:["changeStatus"],setup(K,{emit:B}){const e=_({return_img:"",status:"",remark:""}),F=["image/png","image/jpg","image/bmp","image/jpeg"],i=_({return_img:[{required:!0,trigger:"change",message:"\u8BF7\u4E0A\u4F20\u9000\u6B3E\u56DE\u6267"}],status:[{required:!0,trigger:"change",message:"\u9009\u62E9\u5BA1\u6838\u72B6\u6001"}],remark:[{required:!0,trigger:"change",message:"\u8BF7\u8F93\u5165\u5907\u6CE8"}]}),d=j(null),E=V(),b=q(),h=({type:s,size:t})=>{if(!F.includes(s))return g.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(t/1024/1024>1)return g.error("\u56FE\u7247\u5927\u5C0F\u8D85\u8FC71M"),!1},k=async({file:s})=>{const t=new FormData;t.append("img",s),t.append("token",b.token);const{message:l,code:n,data:r}=await w(t);E({message:l,code:n,handler:()=>e.return_img=D+"/"+r[0].url})},v=()=>{d.value.validate(s=>s&&B("changeStatus",e))};return R(()=>{i.remark[0].required=e.status==="3"}),(s,t)=>{const l=o("el-option"),n=o("el-select"),r=o("el-form-item"),C=o("el-input"),x=o("el-upload"),y=o("el-button");return m(),U(S(H),{ref_key:"formRef",ref:d,"label-width":"100px",size:"small",model:e,rules:i},{default:u(()=>[a(r,{label:"\u5BA1\u6279\u72B6\u6001",prop:"status","w-400px":""},{default:u(()=>[a(n,{"w-400px":"",modelValue:e.status,"onUpdate:modelValue":t[0]||(t[0]=p=>e.status=p)},{default:u(()=>[a(l,{label:"\u901A\u8FC7",value:"2"}),a(l,{label:"\u4E0D\u901A\u8FC7",value:"3"})]),_:1},8,["modelValue"])]),_:1}),a(r,{label:"\u5907\u6CE8",prop:"remark","w-400px":""},{default:u(()=>[a(C,{type:"textarea",modelValue:e.remark,"onUpdate:modelValue":t[1]||(t[1]=p=>e.remark=p)},null,8,["modelValue"])]),_:1}),a(r,{label:"\u9000\u6B3E\u56DE\u6267",prop:"return_img"},{default:u(()=>[f("div",null,[a(x,{class:"upload","before-upload":h,"http-request":k,"show-file-list":!1},{default:u(()=>[e.return_img?(m(),c("img",{key:0,class:"avatar",src:e.return_img},null,8,N)):(m(),c("div",I,"\u70B9\u51FB\u4E0A\u4F20"))]),_:1}),P])]),_:1}),a(r,{"w-full":"",flex:"","justify-end":""},{default:u(()=>[a(y,{type:"primary",onClick:v},{default:u(()=>[z]),_:1})]),_:1})]),_:1},8,["model","rules"])}}});export{L as default};
