"use strict";(self["webpackChunkh5_u2"]=self["webpackChunkh5_u2"]||[]).push([[780],{8859:function(e,a,l){var t=l(4311),i=l(5975);const n={baseURL:location.origin,timeout:5e3},s=t.Z.create(n);s.interceptors.request.use((function(e){return"get"===e.method&&"/api/login"!==e.url&&(localStorage.getItem("os-token")?(e.params||(e.params={}),Object.assign(e.params,{token:localStorage.getItem("os-token")})):((0,i.z8)({message:"请先登录",type:"warning"}),localStorage.clear())),e}),(function(e){return Promise.reject(e)})),s.interceptors.response.use((function(e){return 1===e.data.ret&&(0,i.z8)({message:"请先登录",type:"warning"}),e.data}),(function(e){return Promise.reject(e)})),a["Z"]=s},279:function(e,a,l){l.r(a),l.d(a,{default:function(){return A}});l(7658);var t=l(3396),i=l(4870),n=l(7139),s=l(5102),d=l(5975),u=l(7096),o=l(5743),m=l.n(o),r=l(8859);const p=e=>((0,t.dD)("data-v-b3c4a346"),e=e(),(0,t.Cn)(),e),c={class:"addRealm"},g={key:0,style:{height:"40px",display:"flex","align-items":"center"}},v={class:"text",style:{"font-size":"15px","margin-right":"10px"}},w={class:"text",style:{"font-size":"15px","margin-right":"10px"}},y={class:"text",style:{"font-size":"15px","margin-right":"10px"}},h=p((()=>(0,t._)("br",null,null,-1))),k={key:1,style:{height:"40px",display:"flex","align-items":"center"}},f={class:"text",style:{"font-size":"15px","margin-right":"10px"}},b={class:"text",style:{"font-size":"15px","margin-right":"10px"}},x={class:"text",style:{"font-size":"15px","margin-right":"10px"}},_=p((()=>(0,t._)("br",null,null,-1))),T={key:2,style:{width:"340px",height:"40px",display:"flex","align-items":"flex-start","justify-content":"flex-start"}},I={class:"text",style:{"font-size":"15px","margin-right":"10px"}},z={class:"card-header",style:{display:"flex","justify-content":"space-between"}},D=p((()=>(0,t._)("span",{style:{"font-size":"20px","vertical-align":"middle"}}," 最近开服 ",-1))),U={key:0},q={key:1},R={style:{display:"inline-block",position:"absolute",top:"10px",right:"46px"}},W={key:0,class:"color-span add"},S={key:1,class:"color-span del"},j={key:2,class:"color-span edit"},H={key:0,class:"text"},N={key:0},V={key:0};var Y={__name:"addRealm",setup(e){const a=(0,i.iH)("add"),l=(0,i.iH)([]),o=async e=>{if("edit"===e&&(Y.list[0]={areaName:Y.list[0].areaName,bigRealmId:Z.value[A.value].bigRealmId.toString(),openTime:m().unix(Z.value[A.value].openTime).toDate(),visibleTime:m().unix(Z.value[A.value].visibleTime).toDate(),realmId:Z.value[A.value].realmId},E.value=[...Z.value.filter((e=>e.bigRealmId==Z.value[A.value].bigRealmId)).map((e=>e.name)),Z.value[Z.value.length-1].name.replace(/([0-9]+)/g,(function(e){return Number(e)+1}))]),"add"===e&&(Y.list[0]={areaName:"",bigRealmId:"",openTime:m()().set("hour",5).set("minute",0).set("second",0).toDate(),visibleTime:"",realmId:""},Z.value=[],E.value=[]),"select"===e){const{data:e}=await r.Z.get("/api/select_recentOperationRealm");l.value=e,e.some((e=>"del"===e.operation))&&(Z.value.push(...e.filter((e=>"del"===e.operation))),A.value=Z.value.length-1)}a.value=e},p=(0,t.Fl)((()=>l?.value?.find((e=>e.realmId===Z.value[A.value].realmId))||{})),Y=(0,i.qj)({list:[{areaName:"",bigRealmId:"",openTime:m()().set("hour",5).set("minute",0).set("second",0).toDate(),visibleTime:"",realmId:""}]}),C=(0,i.iH)([]),Z=(0,i.iH)([]),A=(0,i.iH)(0),M=e=>{A.value+=e};let B=0;const $=async e=>{const{data:a}=await r.Z.get("/api/select_recentRealm",{params:{areaName:e}});Z.value=a,A.value=a.length-1,B=a[a.length-1].bigRealmId,C.value[0]=[];for(let l=0;l<2;l++)C.value[0][l]=(B+l).toString();Y.list[0].bigRealmId&&!C.value[0].includes(Y.list[0].bigRealmId)&&(Y.list[0].bigRealmId="",E.value=[])},E=(0,i.iH)([]),K=e=>{E.value=[...Z.value.filter((a=>a.bigRealmId==e)).map((e=>e.name)),Z.value[Z.value.length-1].name.replace(/([0-9]+)/g,(function(e){return Number(e)+1}))]},O=((0,i.iH)(""),(0,i.iH)(""),e=>e.getTime()Date.now()+1728e5),F=(0,t.Fl)((()=>Y.list.map((e=>!!e.openTime)))),P=(e,a)=>!F.value[a]||e.getTime()<=Y.list[a].openTime.getTime()-864e5,L=e=>Y.list.some((a=>a.bigRealmId==e)),X=((0,i.iH)(null),async(e,a="add")=>{const l=ee(e,"edit"===a||"del"===a)[0],t=G(l);t||(("add"===a||"edit"===a)&&l.openTime&&l.visibleTime&&l.openTime>l.visibleTime?d.z8.warning("服务器对外时间需大于开服时间!"):u.T.confirm("确认要操作服务器吗?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((async()=>{const e=await r.Z.post(`/api/add_realmInfo?account=${localStorage.getItem("account")}&token=${localStorage.getItem("os-token")}`,{simpleRealm:l,type:a,token:localStorage.getItem("os-token")});0===e.ret?(d.z8.success(e.msg),setTimeout((()=>{location.reload()}),1e3)):1===e.ret?d.z8.warning("操作失败!"):d.z8.warning(e.msg)})).catch((()=>{})))}),G=e=>Object.entries(e).some((([e,a])=>Q(e,a))),J={areaName:"服务器大区",bigRealmId:"bigRealmId",openTime:"开服时间",visibleTime:"对外时间",realmId:"realmId"},Q=(e,a)=>{if(0!==a&&"realmId"!==e&&!a)return d.z8.warning(`${J[e]}不能为空`),!0},ee=(e,a)=>{const l=e.map((e=>(e.openTimeTmp=ae(e.openTime,!0),e.visibleTimeTmp=ae(e.visibleTime,!1),e)));return l.map((e=>({areaName:e.areaName,bigRealmId:parseInt(e.bigRealmId),openTime:e.openTimeTmp,visibleTime:e.visibleTimeTmp,realmId:a?e.realmId:void 0})))},ae=(e,a)=>a?m()(e).set("hour",5).set("minute",0).set("second",0).unix():m()(e).unix(),le=async()=>{u.T.confirm("确认要提交吗?","提示",{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}).then((async()=>{const e=await r.Z.get(`/api/commit_realmInfo?account=${localStorage.getItem("account")}`);0===e.code?d.z8.success("提交成功"):d.z8.warning(e.msg)})).catch((()=>{}))};return(e,l)=>{const d=(0,t.up)("el-option"),u=(0,t.up)("el-select"),r=(0,t.up)("el-form-item"),B=(0,t.up)("el-col"),F=(0,t.up)("el-button"),G=(0,t.up)("el-card"),J=(0,t.up)("el-date-picker"),Q=(0,t.up)("el-space"),ee=(0,t.up)("el-form"),ae=(0,t.up)("el-row");return(0,t.wg)(),(0,t.iD)("div",c,[(0,t.Wm)(ae,{gutter:10},{default:(0,t.w5)((()=>[((0,t.wg)(!0),(0,t.iD)(t.HY,null,(0,t.Ko)(Y.list,((e,c)=>((0,t.wg)(),(0,t.iD)("div",{key:c},[(0,t.Wm)(ee,{model:e,"label-width":"100px"},{default:(0,t.w5)((()=>[(0,t.Wm)(Q,{direction:(0,i.SU)(s.X)?"vertical":"horizontal"},{default:(0,t.w5)((()=>[(0,t.Wm)(B,{span:8,xs:24,style:{width:"369px"}},{default:(0,t.w5)((()=>[(0,t.Wm)(r,{label:"服务器大区",required:""},{default:(0,t.w5)((()=>[(0,t.Wm)(u,{modelValue:e.areaName,"onUpdate:modelValue":a=>e.areaName=a,style:{width:"275px"},placeholder:"选择服务器大区",onChange:$},{default:(0,t.w5)((()=>[(0,t.Wm)(d,{value:"NA",label:"NA"},{default:(0,t.w5)((()=>[(0,t.Uk)("NA")])),_:1}),(0,t.Wm)(d,{value:"EU",label:"EU"},{default:(0,t.w5)((()=>[(0,t.Uk)("EU")])),_:1}),(0,t.Wm)(d,{value:"Asia",label:"Asia"},{default:(0,t.w5)((()=>[(0,t.Uk)("Asia")])),_:1})])),_:2},1032,["modelValue","onUpdate:modelValue"])])),_:2},1024)])),_:2},1024),Z.value.length>0&&"add"===a.value?((0,t.wg)(),(0,t.iD)("div",g,[(0,t._)("span",v,"realmId: "+(0,n.zw)(Z.value[Z.value.length-1].realmId+1),1),(0,t._)("span",w,"区服名称: "+(0,n.zw)(Z.value[Z.value.length-1].name.replace(/([0-9]+)/g,(function(e){return Number(e)+1}))),1),(0,t._)("span",y,"showSeq: "+(0,n.zw)(Z.value[Z.value.length-1].showSeq+1),1),h])):(0,t.kq)("",!0),Z.value.length>0&&"edit"===a.value?((0,t.wg)(),(0,t.iD)("div",k,[(0,t._)("span",f,"realmId: "+(0,n.zw)(Z.value[A.value].realmId),1),(0,t._)("span",b,"区服名称: "+(0,n.zw)(Z.value[A.value].name),1),(0,t._)("span",x,"showSeq: "+(0,n.zw)(Z.value[A.value].showSeq),1),_])):(0,t.kq)("",!0),Z.value.length>0&&("add"===a.value||"edit"===a.value)?((0,t.wg)(),(0,t.iD)("div",T,[(0,t._)("span",I,"logicWorldId: "+(0,n.zw)(Z.value[Z.value.length-1].logicWorldId),1)])):(0,t.kq)("",!0),Z.value.length>0&&"select"===a.value?((0,t.wg)(),(0,t.j4)(G,{key:3,class:"box-card"},{header:(0,t.w5)((()=>[(0,t._)("div",z,[(0,t.Wm)(F,{type:"primary",link:"",onClick:l[0]||(l[0]=e=>M(-1)),disabled:0===A.value},{default:(0,t.w5)((()=>[(0,t.Uk)("上一个")])),_:1},8,["disabled"]),D,(0,t.Wm)(F,{type:"primary",link:"",onClick:l[1]||(l[1]=e=>M(1)),disabled:A.value===Z.value.length-1},{default:(0,t.w5)((()=>[(0,t.Uk)("下一个")])),_:1},8,["disabled"])])])),default:(0,t.w5)((()=>[((0,t.wg)(!0),(0,t.iD)(t.HY,null,(0,t.Ko)(Z.value[A.value],((e,a)=>((0,t.wg)(),(0,t.iD)("div",{key:a,class:"text"},["openTime"==a||"visibleTime"==a?((0,t.wg)(),(0,t.iD)("div",U,[(0,t._)("span",null,(0,n.zw)(a+": "),1),(0,t._)("span",null,(0,n.zw)((0,i.SU)(m()).unix(e).format("YYYY-MM-DD HH:mm:ss")),1)])):((0,t.wg)(),(0,t.iD)("div",q,[(0,t._)("span",null,(0,n.zw)(a+": "),1),(0,t._)("span",null,(0,n.zw)(e),1)]))])))),128)),Z.value[A.value].visibleTime>(new Date).getTime()/1e3&&!Z.value[A.value].operation?((0,t.wg)(),(0,t.j4)(F,{key:0,type:"primary",link:"",onClick:l[2]||(l[2]=e=>o("edit"))},{default:(0,t.w5)((()=>[(0,t.Uk)("编辑")])),_:1})):(0,t.kq)("",!0),(0,t._)("div",R,["add"===(0,i.SU)(p).operation?((0,t.wg)(),(0,t.iD)("span",W,"增加")):(0,t.kq)("",!0),"del"===(0,i.SU)(p).operation?((0,t.wg)(),(0,t.iD)("span",S,"删除")):(0,t.kq)("",!0),"edit"===(0,i.SU)(p).operation?((0,t.wg)(),(0,t.iD)("span",j,"修改")):(0,t.kq)("",!0)])])),_:2},1024)):(0,t.kq)("",!0),"edit"===a.value||"add"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:4,span:8,xs:24,class:"tags",style:{width:"369px"}},{default:(0,t.w5)((()=>[(0,t.Wm)(r,{label:"bigRealmId",required:""},{default:(0,t.w5)((()=>[(0,t.Wm)(u,{modelValue:e.bigRealmId,"onUpdate:modelValue":a=>e.bigRealmId=a,style:{width:"259px"},onChange:K,placeholder:"选择bigRealmId"},{default:(0,t.w5)((()=>[((0,t.wg)(!0),(0,t.iD)(t.HY,null,(0,t.Ko)(C.value[c],(e=>((0,t.wg)(),(0,t.j4)(d,{key:e,value:e,label:e,disabled:L(e)},null,8,["value","label","disabled"])))),128))])),_:2},1032,["modelValue","onUpdate:modelValue"]),E.value.length>0&&("add"===a.value||"edit"===a.value)?((0,t.wg)(),(0,t.iD)("div",H,"相同bigRealmId:"+(0,n.zw)(E.value.join(",")),1)):(0,t.kq)("",!0)])),_:2},1024)])),_:2},1024)):(0,t.kq)("",!0),"edit"===a.value||"add"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:5,span:8,xs:24,style:{width:"369px"}},{default:(0,t.w5)((()=>[(0,t.Wm)(r,{label:"开服时间",required:""},{default:(0,t.w5)((()=>[(0,t.Wm)(J,{style:{width:"275px"},modelValue:e.openTime,"onUpdate:modelValue":a=>e.openTime=a,type:"date","disabled-date":O,placeholder:"请选择开服时间"},null,8,["modelValue","onUpdate:modelValue"]),Z.value.length>0?((0,t.wg)(),(0,t.iD)("div",N," 北京开服时间:"+(0,n.zw)((0,i.SU)(m())(e.openTime).set("hour",5).set("minute",0).set("second",0).add(8-Z.value[Z.value.length-1].timeZone,"hour").format("YYYY-MM-DD HH:mm:ss")),1)):(0,t.kq)("",!0)])),_:2},1024)])),_:2},1024)):(0,t.kq)("",!0),"edit"===a.value||"add"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:6,span:8,xs:24,style:{width:"369px"}},{default:(0,t.w5)((()=>[(0,t.Wm)(r,{label:"对外时间",required:""},{default:(0,t.w5)((()=>[(0,t.Wm)(J,{style:{width:"275px"},modelValue:e.visibleTime,"onUpdate:modelValue":a=>e.visibleTime=a,type:"datetime","disabled-date":e=>P(e,c),placeholder:"请选择对外时间"},null,8,["modelValue","onUpdate:modelValue","disabled-date"]),Z.value.length>0&&e.visibleTime?((0,t.wg)(),(0,t.iD)("div",V," 北京对外时间:"+(0,n.zw)((0,i.SU)(m())(e.visibleTime).add(8-Z.value[Z.value.length-1].timeZone,"hour").format("YYYY-MM-DD HH:mm:ss")),1)):(0,t.kq)("",!0)])),_:2},1024)])),_:2},1024)):(0,t.kq)("",!0)])),_:2},1032,["direction"])])),_:2},1032,["model"])])))),128)),"add"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:0,span:8,xs:24},{default:(0,t.w5)((()=>[(0,t.Wm)(F,{style:{width:"350px"},type:"success",onClick:l[3]||(l[3]=e=>o("select"))},{default:(0,t.w5)((()=>[(0,t.Uk)("查看修改列表")])),_:1})])),_:1})):(0,t.kq)("",!0),"add"!==a.value?((0,t.wg)(),(0,t.j4)(B,{key:1,span:8,xs:24},{default:(0,t.w5)((()=>[(0,t.Wm)(F,{style:{width:"350px"},type:"warning",onClick:l[4]||(l[4]=e=>o("add"))},{default:(0,t.w5)((()=>[(0,t.Uk)("返回新增")])),_:1})])),_:1})):(0,t.kq)("",!0),"edit"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:2,span:8,xs:24},{default:(0,t.w5)((()=>[(0,t.Wm)(F,{style:{width:"350px"},type:"danger",onClick:l[5]||(l[5]=e=>X(Y.list,"del")),plain:""},{default:(0,t.w5)((()=>[(0,t.Uk)("删除服务器")])),_:1})])),_:1})):(0,t.kq)("",!0),"add"===a.value||"edit"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:3,span:8,xs:24},{default:(0,t.w5)((()=>[(0,t.Wm)(F,{style:{width:"350px"},type:"primary",onClick:l[6]||(l[6]=e=>X(Y.list,"add"===a.value?"add":"edit")),plain:""},{default:(0,t.w5)((()=>[(0,t.Uk)((0,n.zw)("add"===a.value?"添加服务器":"修改服务器"),1)])),_:1})])),_:1})):(0,t.kq)("",!0),"select"===a.value?((0,t.wg)(),(0,t.j4)(B,{key:4,span:8,xs:24},{default:(0,t.w5)((()=>[(0,t.Wm)(F,{style:{width:"350px"},type:"primary",onClick:le},{default:(0,t.w5)((()=>[(0,t.Uk)("提交")])),_:1})])),_:1})):(0,t.kq)("",!0)])),_:1})])}}},C=l(89);const Z=(0,C.Z)(Y,[["__scopeId","data-v-b3c4a346"]]);var A=Z}}]); //# sourceMappingURL=addRealm.4dc256fb.js.map