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