import{d as C,n as E,w as h,r,o as _,A as v,y as l,e as D,h as u,d6 as x,i,H as q,cd as w,_ as R,Q as b,a as A,dK as N}from"./index.js";import{R as P}from"./global.9ad647c8.js";const S={status:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u5BA1\u6838\u72B6\u6001"}],remark:[{required:!0,trigger:"change",message:"\u8BF7\u8F93\u5165\u5907\u6CE8"}]},T={flex:"","flex-col":"",style:{width:"50%"}},U={class:"w-full flex justify-end"},I=C({__name:"default",props:{approveValue:{type:String,required:!0},rejectValue:{type:String,required:!0}},emits:["approval"],setup(B,{emit:y}){const F=y,s=B,a=E(null),o=E({status:"",remark:""}),d=E({...S});async function V(){var n;try{await((n=a.value)==null?void 0:n.validate()),F("approval",i(o))}catch{}}return h(()=>o.value,({status:n})=>{d.value.remark[0].required=n===s.rejectValue},{deep:!0}),(n,e)=>{const t=r("ElOption"),g=r("ElSelect"),f=r("ElFormItem"),p=r("ElInput"),k=r("ElButton");return _(),v(i(w),{ref_key:"formRef",ref:a,model:o.value,rules:d.value,"label-width":"100px"},{default:l(()=>[D("div",T,[u(f,{label:"\u5BA1\u6838\u72B6\u6001",prop:"status"},{default:l(()=>[u(g,{placeholder:"\u8BF7\u9009\u62E9\u5BA1\u6838\u72B6\u6001",modelValue:o.value.status,"onUpdate:modelValue":e[0]||(e[0]=c=>o.value.status=c)},{default:l(()=>[u(t,{value:n.approveValue,label:"\u901A\u8FC7"},null,8,["value"]),u(t,{value:n.rejectValue,label:"\u9A73\u56DE"},null,8,["value"])]),_:1},8,["modelValue"])]),_:1}),u(f,{label:"\u5907\u6CE8",prop:"remark"},{default:l(()=>[u(p,x({rows:5,type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8",modelValue:o.value.remark,"onUpdate:modelValue":e[1]||(e[1]=c=>o.value.remark=c)},i(P)),null,16,["modelValue"])]),_:1})]),u(f,null,{default:l(()=>[D("div",U,[u(k,{type:"primary",onClick:V},{default:l(()=>e[2]||(e[2]=[q(" \u63D0\u4EA4\u5BA1\u6838\u7ED3\u679C ")])),_:1})])]),_:1})]),_:1},8,["model","rules"])}}});var O=R(I,[["__file","D:/work/jiesuan/settle-vue3/src/components/ApprovalNode/src/default.vue"]]);const H={class:"w-full flex justify-end"},M=C({__name:"receipt",props:{approveValue:{type:String,required:!0},rejectValue:{type:String,required:!1},imgProp:{type:String,required:!1,default:"return_image"},noTime:{type:Boolean,required:!1,default:!1},hasRemark:{type:Boolean,required:!1,default:!1}},emits:["approval"],setup(B,{emit:y}){const F=y,s=B,a=b({[s.imgProp]:"",return_time:"",status:s.approveValue}),o=b({status:[{required:!0,trigger:"change",message:"\u8BF7\u9009\u62E9\u5BA1\u6838\u72B6\u6001"}],remark:[{required:s.hasRemark,trigger:"change",message:"\u8BF7\u9009\u62E9\u5BA1\u6838\u72B6\u6001"}],return_time:[{required:!s.noTime,trigger:"change",message:"\u8BF7\u9009\u62E9\u4E0A\u4F20\u56DE\u6267\u65F6\u95F4"}],[s.imgProp]:[{required:!s.noTime,trigger:"change",message:"\u8BF7\u9009\u62E9\u4E0A\u4F20\u56DE\u6267\u56FE\u7247"}]}),d=E(null),V=()=>{d.value.validate(e=>e&&F("approval",i(a)))},n=e=>e.getTime()>Date.now();return h(()=>a.status,e=>{const t=e===s.approveValue;o.remark[0].required=!t},{immediate:!0}),(e,t)=>{const g=r("el-option"),f=r("el-select"),p=r("el-form-item"),k=r("el-input"),c=r("el-date-picker"),j=r("el-button");return _(),v(i(w),{ref_key:"formRef",ref:d,model:a,rules:o,"label-width":"80px"},{default:l(()=>[e.rejectValue?(_(),v(p,{key:0,label:"\u5BA1\u6838\u72B6\u6001",prop:"status",style:{"margin-bottom":"10px"}},{default:l(()=>[u(f,{placeholder:"\u5BA1\u6838\u72B6\u6001",modelValue:a.status,"onUpdate:modelValue":t[0]||(t[0]=m=>a.status=m),style:{width:"300px"}},{default:l(()=>[u(g,{label:"\u901A\u8FC7",value:e.approveValue},null,8,["value"]),u(g,{label:"\u4E0D\u901A\u8FC7",value:e.rejectValue},null,8,["value"])]),_:1},8,["modelValue"])]),_:1})):A("v-if",!0),e.hasRemark?(_(),v(p,{key:1,label:"\u5907\u6CE8",prop:"remark"},{default:l(()=>[u(k,{style:{width:"300px"},type:"textarea",modelValue:a.remark,"onUpdate:modelValue":t[1]||(t[1]=m=>a.remark=m),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1})):A("v-if",!0),u(p,{label:"\u56DE\u6267\u56FE\u7247",prop:e.imgProp},{default:l(()=>[u(i(N),{multiple:"",onChange:t[2]||(t[2]=m=>a[e.imgProp]=m)})]),_:1},8,["prop"]),e.noTime?A("v-if",!0):(_(),v(p,{key:2,label:"\u56DE\u6267\u65F6\u95F4",prop:"return_time"},{default:l(()=>[u(c,{type:"datetime","disabled-date":n,"value-format":"YYYY-MM-DD HH:mm:ss",modelValue:a.return_time,"onUpdate:modelValue":t[3]||(t[3]=m=>a.return_time=m),placeholder:"\u8BF7\u8F93\u5165\u56DE\u6267\u65F6\u95F4"},null,8,["modelValue"])]),_:1})),u(p,null,{default:l(()=>[D("div",H,[u(j,{type:"primary",onClick:V},{default:l(()=>t[4]||(t[4]=[q("\u4FDD\u5B58")])),_:1})])]),_:1})]),_:1},8,["model","rules"])}}});var $=R(M,[["__file","D:/work/jiesuan/settle-vue3/src/components/ApprovalNode/src/receipt.vue"]]);export{O as D,$ as R};
