import{_ as e,r as a,p as s,az as t,aJ as l,u,v as n,a as r,c as i,w as o,aK as d,aH as m,aI as c,z as f,i as p,d as v,at as g,e as _,b as h,aL as w,aM as y,s as V,N as R,aN as b,j as k}from"./index-BlslIQWi.js";const z=e({__name:"UserAgent",setup(e){const z=a({timeRange:[],effective:!1,user:[]}),q=a(!1),M=a();s({get:()=>z.value.user?[z.value.user]:[],set(e){z.value.user=e[0]}});const U={timeRange:{rules:[{errorMessage:"请选择代理时间段",required:!0}]},user:{rules:[{errorMessage:"请选择代理人",required:!0}]}};function j(){w({title:"提示",content:"您是否要取消该代理人设置",success:function(e){e.confirm&&y().then((e=>{V({icon:"none",title:"取消成功"}),R()}))}})}function x(){M.value.validate().then((e=>{b({timeRange:z.value.timeRange,user:z.value.user[0]}).then((e=>{V({icon:"none",title:"设置代理人成功"}),R()})).catch((e=>{V({icon:"none",title:"设置失败："+e.msg})}))})).catch((e=>{V({icon:"none",title:"请完成设置"})}))}return t((()=>{l().then((e=>{e.data&&(z.value={...e.data,user:e.data.user?[e.data.user]:[]},q.value=!0)}))})),(e,a)=>{const s=u(n("uni-datetime-picker"),d),t=u(n("uni-forms-item"),m),l=u(n("uni-forms"),c),w=u(n("uni-icons"),f),y=k,V=p;return r(),i(V,{class:"w-user-angent"},{default:o((()=>[v(l,{ref_key:"wflowForm",ref:M,rules:U,modelValue:z.value,"label-position":"top","label-width":"200"},{default:o((()=>[v(t,{name:"timeRange",required:!0,label:"代理时间段"},{default:o((()=>[v(s,{modelValue:z.value.timeRange,"onUpdate:modelValue":a[0]||(a[0]=e=>z.value.timeRange=e),type:"datetimerange",rangeSeparator:"至"},null,8,["modelValue"])])),_:1}),v(t,{name:"user",required:!0,label:"代理人"},{default:o((()=>[v(g,{class:"w-user",modelValue:z.value.user,"onUpdate:modelValue":a[1]||(a[1]=e=>z.value.user=e),formProps:{multiple:!1,placeholder:"请选择代理人"},position:"right"},null,8,["modelValue"])])),_:1})])),_:1},8,["modelValue"]),q.value?(r(),i(y,{key:0,type:"warn",plain:"",size:"mini",onClick:j},{default:o((()=>[v(w,{type:"refreshempty",color:"#E64340",size:"13"}),_(" 取消代理人 ")])),_:1})):h("",!0),v(y,{type:"primary",size:"mini",class:"w-button",onClick:x},{default:o((()=>[_("提交")])),_:1})])),_:1})}}},[["__scopeId","data-v-5fc00c84"]]);export{z as default};
