import{a2 as e,e as a,r as s,Q as t,x as n,f as r,g as c,o as i,h as l,w as o,a as u,i as d,j as m,t as p,N as f,a7 as g,y as h,z as x,a8 as y}from"./index-Cg3FU-dV.js";import{_ as k}from"./uni-datetime-picker.h8Ix41Za.js";import{b as _}from"./business.D15ulJLJ.js";const v={__name:"formBox",props:{type:{type:String,default:"center"},status:{type:Number,default:-2}},emits:["change"],setup(v,{emit:T}){const b=v,{type:j,status:I}=e(b),z=a({typeText:"所有状态",timeText:"所有日期",usersText:"所有类型",typeIndex:0,usersIndex:0,usersData:[]}),D=a({time:"",approveId:"",status:""}),C=s(null);let N=T;const w=a([{name:"所有状态",id:""},{name:"待审核",id:0},{name:"已通过",id:1},{name:"已拒绝",id:2},{name:"已撤销",id:-1}]);t((()=>{B(3)}));const B=e=>{_(e).then((e=>{const a=e.data?e.data:[];a.unshift({name:"所有类型",id:""}),z.usersData=a})).catch((e=>{n.error(e.message)}))},Q=e=>{const a=e.detail.value;z.typeText=w[a].name,D.status=w[a].id,N("change",D)},R=e=>{const a=e.detail.value;z.usersText=z.usersData[a].name,D.approveId=z.usersData[a].id,N("change",D)},S=()=>{C.value.clear()},q=e=>{if(e.length>0){const a=e[0].replace(/-/g,"/")+"-"+e[1].replace(/-/g,"/");z.timeText=e[0].substring(5).replace("-","/")+"-"+e[1].substring(5).replace("-","/"),D.time=a}else z.timeText="所有日期",D.time="";N("change",D)};return(e,a)=>{const s=h,t=x,n=y,_=r(c("uni-datetime-picker"),k);return i(),l(t,{class:"cr-search-content plr10"},{default:o((()=>[1!=u(I)?(i(),l(n,{key:0,class:"picker-selector",mode:"selector",onChange:Q,value:z.typeIndex,range:w,"range-key":"name"},{default:o((()=>[d(t,{class:"search-default-label"},{default:o((()=>[m(p(z.typeText)+" ",1),d(s,{class:"iconfont icon-zhankai1"})])),_:1})])),_:1},8,["value","range"])):f("",!0),d(n,{class:"picker-selector",mode:"selector",onChange:R,value:z.usersIndex,range:z.usersData,"range-key":"name"},{default:o((()=>[d(t,{class:"search-default-label"},{default:o((()=>[m(p(z.usersText)+" ",1),d(s,{class:"iconfont icon-zhankai1"})])),_:1})])),_:1},8,["value","range"]),d(_,{ref_key:"timeRef",ref:C,type:"daterange","clear-icon":!1,border:!1,onChange:q},{default:o((()=>[d(t,{class:"search-default-date"},{default:o((()=>[m(p(z.timeText)+" ",1),D.time?f("",!0):(i(),l(s,{key:0,class:"date-open-icon iconfont icon-zhankai1"}))])),_:1}),D.time?(i(),l(s,{key:0,class:"iconfont date-clear icon-shenpizhongxin-jujue",onClick:g(S,["stop"])})):f("",!0)])),_:1},512)])),_:1})}}};export{v as _};
