import{u as A,r as b,d as k,o as B,f as r,G as E,a as w,c as h,h as $,g as o,w as a,H as F,F as S,i,t as d,l as T}from"./index-ad591d72.js";import{g as j,c as z,f as G,r as H}from"./index-dc51eeee.js";import{_ as J}from"./_plugin-vue_export-helper-c27b6911.js";import"./axios-4a70c6fc.js";const K={class:"top"},L={class:"card shadow","element-loading-background":"rgba(255, 255, 255, 1)"},O={class:"dialog-footer"},Q={__name:"user",setup(W){A();const c=b(!1),v=b([]),D=b(null),n=k({page:1,total:0,perPage:10}),p=()=>{c.value=!0,setTimeout(()=>{j(n.page).then(e=>{n.total=e.total,n.perPage=e.perPage,v.value=e.users.filter(t=>!t.is_admin),c.value=!1})},500)},l=k({visible:!1,form:{Username:"",Password:"",Message:""}}),x=e=>e+1+(n.page-1)*n.perPage;B(()=>{p()});const y=()=>{l.form={Username:"",Password:"",Message:""},l.visible=!0},C=e=>{l.form=e,l.visible=!0},U=e=>{z(e.ID).then(t=>{n.page=1,p()})},V=()=>{(l.form.ID?G(l.form.ID,l.form):H(l.form)).then(t=>{l.visible=!1,n.page=1,p()})},P=e=>{n.page=e,p()};return(e,t)=>{const m=r("el-button"),u=r("el-table-column"),M=r("el-table"),I=r("el-pagination"),f=r("el-input"),g=r("el-form-item"),q=r("el-form"),N=r("el-dialog"),R=E("loading");return w(),h(S,null,[$("div",K,[o(m,{onClick:y},{default:a(()=>[i(d(e.$t("clock.userDialog.add")),1)]),_:1})]),F((w(),h("div",L,[o(M,{data:v.value,height:"calc(100vh - 54px - 34px - 20px - 44px - 74px)","header-cell-style":{textAlign:"center"},"empty-text":e.$t("equipmentManagement.nodata"),"cell-style":{textAlign:"center"}},{default:a(()=>[o(u,{type:"index",index:x,label:e.$t("equipmentManagement.index"),width:"60"},null,8,["label"]),o(u,{prop:"Username",label:e.$t("clock.userDialog.username"),width:"120px"},null,8,["label"]),o(u,{prop:"Message",label:e.$t("clock.desc")},null,8,["label"]),o(u,{label:e.$t("clock.list"),width:"200px","show-overflow-tooltip":""},{default:a(({row:s})=>[i(d(s.Clocks.map(_=>_.Code).join(", ")),1)]),_:1},8,["label"]),o(u,{label:e.$t("chipCheck.Actions"),width:"160px",fixed:"right"},{default:a(({row:s})=>[o(m,{onClick:_=>C(s)},{default:a(()=>[i(d(e.$t("clock.edit")),1)]),_:2},1032,["onClick"]),o(m,{onClick:_=>U(s)},{default:a(()=>[i(d(e.$t("clock.del")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"]),o(I,{onCurrentChange:P,style:{"margin-top":"10px",float:"right"},background:"",layout:"prev, pager, next",total:n.total},null,8,["total"]),o(N,{"destroy-on-close":"",modelValue:l.visible,"onUpdate:modelValue":t[5]||(t[5]=s=>l.visible=s),title:l.form.ID?e.$t("clock.userDialog.edit"):e.$t("clock.userDialog.add"),width:"400px"},{footer:a(()=>[$("span",O,[o(m,{type:"info",text:"",onClick:t[4]||(t[4]=s=>l.visible=!1)},{default:a(()=>[i(d(e.$t("popup.cancel")),1)]),_:1}),o(m,{onClick:V,color:"#17609a",disabled:!l.form.Username||!l.form.Password},{default:a(()=>[i(d(e.$t("popup.confirm")),1)]),_:1},8,["disabled"])])]),default:a(()=>[o(q,{ref_key:"formRef",ref:D,model:l.form,"label-width":"80px",rules:{Username:[{required:!0,message:"",trigger:"blur"}],Password:[{required:!0,message:"",trigger:"blur"},{len:{min:6,max:32},message:"",trigger:"blur"}]},onSubmit:t[3]||(t[3]=T(()=>{},["prevent"]))},{default:a(()=>[o(g,{label:e.$t("clock.userDialog.username"),prop:"Username"},{default:a(()=>[o(f,{modelValue:l.form.Username,"onUpdate:modelValue":t[0]||(t[0]=s=>l.form.Username=s),placeholder:"",autocomplete:"off"},null,8,["modelValue"])]),_:1},8,["label"]),o(g,{label:e.$t("clock.userDialog.password"),prop:"Password"},{default:a(()=>[o(f,{type:"password",modelValue:l.form.Password,"onUpdate:modelValue":t[1]||(t[1]=s=>l.form.Password=s),"show-password":"",placeholder:"",autocomplete:"off"},null,8,["modelValue"])]),_:1},8,["label"]),o(g,{label:e.$t("clock.desc")},{default:a(()=>[o(f,{type:"textarea",autosize:{minRows:4,maxRows:4},modelValue:l.form.Message,"onUpdate:modelValue":t[2]||(t[2]=s=>l.form.Message=s)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["modelValue","title"])])),[[R,c.value]])],64)}}},le=J(Q,[["__scopeId","data-v-82cd3909"]]);export{le as default};
