import{_ as f,L as k,i as I,f as m,k as u,d as l,e as r,g as e,l as i,t as o,j as _,F as h,h as w,n as T,m as U,p as y,q as p}from"./app-ad835f92.js";import{a as g}from"./swal-23a4a8dd.js";const C={components:{LoadingOverlay:k},data(){return{baseUrl:"/sets/sm",hotbeeUrl:"/sets/sm/efw",polibeeUrl:"/sets/sm/si",chembeeUrl:"/sets/sm/csm",id:this.$store.state.auth.user.id,subSystemId:this.$route.params.subSystemId??null,subSystem:["","安全智慧巡檢功能","電氣火災預警功能","化學品智慧安全管理功能"],isAdmin:I(),users:[],dataTable:null,loading:!1,systemToken:[]}},mounted(){const t=this;t.fetchData(),$("input[type='search']").on("keyup input",function(){t.dataTable.search(this.value).draw()})},methods:{fetchData:async function(){const t=this;t.loading=!0,await m.get(`/api/getUserSubHasSystemRole/${t.subSystemId}/p/${t.id}`).then(s=>{t.users=s.data.data}).catch(g),t.dataTable=$("#table").DataTable(),t.loading=!1},gotoSubSystem:async function(t){const s=this;await m.get(`/api/getJwtTokenByUserId/${t}`).then(d=>{s.systemToken=d.data.data}).catch(g),window.location.href=s.subSystemId==2?`${s.hotbeeUrl}/thermal-web/login/${s.systemToken[s.subSystemId]}`:s.subSystemId==1?`${s.polibeeUrl}/login/${s.systemToken[s.subSystemId]}`:`${s.chembeeUrl}/login/${s.systemToken[s.subSystemId]}`}}},x={class:"main-view px-4 pt-2"},B={class:"d-flex align-items-center mb-3"},L={style:{"--bs-breadcrumb-divider":"'>'"},"aria-label":"breadcrumb"},A={class:"breadcrumb m-0"},D={class:"breadcrumb-item"},N={href:"#"},V={class:"breadcrumb-item active","aria-current":"page"},F={class:"mb-5"},O={key:0,class:"text-end"},j={class:"table table-hover",id:"table"},q={class:"text-center"},z={class:"text-center"},E={class:"text-center"},H={class:"text-center"},J={class:"col-1 text-center"},R={class:"col-2"},G={class:"col-3"},K={class:"col-2 text-center"},M={class:"col-2 text-center"},P={class:"col-2 text-center"},Q=["onClick"];function W(t,s,d,X,n,c){const b=u("router-link"),S=u("LoadingOverlay");return l(),r(h,null,[e("div",x,[e("div",B,[e("button",{class:"btn-goback me-2",onClick:s[0]||(s[0]=a=>t.$router.back())},[s[2]||(s[2]=e("i",{class:"bi bi-chevron-left me-1"},null,-1)),i(o(t.$t("global.go_back")),1)]),e("nav",L,[e("ol",A,[e("li",D,[e("a",N,o(t.$t("global.homepage")),1)]),e("li",V,"【"+o(n.subSystem[n.subSystemId])+"】"+o(t.$t("backend.userSubSystem.parent_company_list")),1)])])]),e("h1",F,"【"+o(n.subSystem[n.subSystemId])+"】"+o(t.$t("backend.userSubSystem.parent_company_list")),1),n.subSystemId==3?(l(),r("div",O,[e("button",{class:"btn btn-primary mb-2",onClick:s[1]||(s[1]=a=>c.gotoSubSystem(n.id))},o(t.$t("global.navigate_to")),1)])):_("",!0)]),e("div",{class:T(["p-4",{"admin-bg-color":n.isAdmin,"user-bg-color":!n.isAdmin}])},[s[3]||(s[3]=e("div",{class:"input-group w-50 mb-3"},[e("input",{type:"search",class:"form-control border border-2 border-end-0 inside-border-color",placeholder:"Search..."}),e("button",{class:"btn btn-light border border-2 border-start-0 inside-border-color",type:"button"},[e("i",{class:"bi bi-search"})])],-1)),e("table",j,[e("thead",null,[e("tr",null,[e("th",q,o(t.$t("global.serial_number")),1),e("th",null,o(t.$t("global.name")),1),e("th",null,o(t.$t("global.email")),1),e("th",z,o(t.$t("global.sub_user")),1),e("th",E,o(t.$t("global.sub_company")),1),e("th",H,o(t.$t("global.operation")),1)])]),e("tbody",null,[(l(!0),r(h,null,w(n.users,(a,v)=>(l(),r("tr",{key:a.id},[e("td",J,o(v+1),1),e("td",R,o(a.name),1),e("td",G,o(a.email),1),e("td",K,[y(b,{to:`/userSubSystem/subUserSubSystemIndex/${n.subSystemId}/${a.id}`,class:"btn btn-secondary"},{default:p(()=>[i(o(t.$t("global.inspect")),1)]),_:2},1032,["to"])]),e("td",M,[y(b,{to:`/userSubSystem/subSubSystemIndex/${n.subSystemId}/${a.id}`,class:"btn btn-secondary"},{default:p(()=>[i(o(t.$t("global.inspect")),1)]),_:2},1032,["to"])]),e("td",P,[e("button",{class:"btn btn-success mx-1",onClick:Y=>c.gotoSubSystem(a.id)},o(t.$t("global.navigate_to")),9,Q)])]))),128))])])],2),n.loading?(l(),U(S,{key:0})):_("",!0)],64)}const te=f(C,[["render",W],["__scopeId","data-v-63e419f4"]]);export{te as default};
