"use strict";(self["webpackChunkx_php_admin"]=self["webpackChunkx_php_admin"]||[]).push([[309],{9309:function(e,t,i){i.r(t),i.d(t,{default:function(){return L}});i(7658);var s=i(6252),l=i(3577);const a=e=>((0,s.dD)("data-v-a847c536"),e=e(),(0,s.Cn)(),e),o={class:"widgets-content"},n={class:"widgets-top-actions"},d={class:"widgets",ref:"widgets"},m={class:"widgets-wrapper"},c={key:0,class:"no-widgets"},u={class:"widgets-item"},r={key:0,class:"customize-overlay"},g=a((()=>(0,s._)("div",{class:"btm-view"},null,-1))),p={key:0,class:"widgets-aside"},h={class:"widgets-aside-title"},w={class:"widgets-list"},f={key:0,class:"widgets-list-nodata"},y={class:"item-logo"},k={class:"item-info"},v={class:"item-actions"};function _(e,t,i,a,_,C){const W=(0,s.up)("el-button"),z=(0,s.up)("el-empty"),$=(0,s.up)("el-icon"),b=(0,s.up)("el-input-number"),D=(0,s.up)("el-col"),L=(0,s.up)("draggable"),U=(0,s.up)("el-row"),V=(0,s.up)("el-icon-circle-plus-filled"),x=(0,s.up)("el-icon-close"),j=(0,s.up)("el-header"),G=(0,s.up)("el-main"),O=(0,s.up)("el-footer"),q=(0,s.up)("el-container");return(0,s.wg)(),(0,s.iD)("div",{class:(0,l.C_)(["widgets-home",_.customizing?"customizing":""]),ref:"main"},[(0,s._)("div",o,[(0,s._)("div",n,[_.customizing?((0,s.wg)(),(0,s.j4)(W,{key:0,type:"primary",icon:"el-icon-check",round:"",onClick:C.save},{default:(0,s.w5)((()=>[(0,s.Uk)("完成")])),_:1},8,["onClick"])):((0,s.wg)(),(0,s.j4)(W,{key:1,type:"primary",icon:"el-icon-edit",round:"",onClick:C.custom},{default:(0,s.w5)((()=>[(0,s.Uk)("自定义")])),_:1},8,["onClick"]))]),(0,s._)("div",d,[(0,s._)("div",m,[_.widgets.length<=0?((0,s.wg)(),(0,s.iD)("div",c,[(0,s.Wm)(z,{description:"没有部件啦","image-size":280})])):(0,s.kq)("",!0),(0,s.Wm)(U,{gutter:15},{default:(0,s.w5)((()=>[(0,s.Wm)(L,{modelValue:_.widgets,"onUpdate:modelValue":t[0]||(t[0]=e=>_.widgets=e),animation:"100",handle:".customize-overlay",group:"people","item-key":"com","force-fallback":"",fallbackOnBody:"",class:"draggable-box"},{item:(0,s.w5)((({element:e})=>[(0,s.Wm)(D,{md:parseInt(e.layout)||24,xs:24},{default:(0,s.w5)((()=>[(0,s._)("div",u,[((0,s.wg)(),(0,s.j4)((0,s.LL)(_.allComps[e.name]),{ref:`components${e.name}`},null,512)),_.customizing?((0,s.wg)(),(0,s.iD)("div",r,[(0,s.Wm)(W,{class:"close",type:"danger",plain:"",icon:"el-icon-close",size:"small",onClick:t=>C.remove(e.name)},null,8,["onClick"]),(0,s._)("label",null,[(0,s.Wm)($,null,{default:(0,s.w5)((()=>[((0,s.wg)(),(0,s.j4)((0,s.LL)(_.allComps[e.name].icon)))])),_:2},1024),(0,s.Uk)(" "+(0,l.zw)(_.allComps[e.name].title),1)]),(0,s.Wm)(b,{modelValue:e.layout,"onUpdate:modelValue":t=>e.layout=t,min:_.allComps[e.name].minWidth?_.allComps[e.name].minWidth:4,max:24,onChange:t=>C.sizeChange(e.name)},null,8,["modelValue","onUpdate:modelValue","min","onChange"])])):(0,s.kq)("",!0)])])),_:2},1032,["md"])])),_:1},8,["modelValue"])])),_:1}),g])],512)]),_.customizing?((0,s.wg)(),(0,s.iD)("div",p,[(0,s.Wm)(q,null,{default:(0,s.w5)((()=>[(0,s.Wm)(j,null,{default:(0,s.w5)((()=>[(0,s._)("div",h,[(0,s.Wm)($,null,{default:(0,s.w5)((()=>[(0,s.Wm)(V)])),_:1}),(0,s.Uk)("添加部件")]),(0,s._)("div",{class:"widgets-aside-close",onClick:t[1]||(t[1]=e=>C.close())},[(0,s.Wm)($,null,{default:(0,s.w5)((()=>[(0,s.Wm)(x)])),_:1})])])),_:1}),(0,s.Wm)(G,{class:"nopadding"},{default:(0,s.w5)((()=>[(0,s._)("div",w,[C.myCompsList.length<=0?((0,s.wg)(),(0,s.iD)("div",f,[(0,s.Wm)(z,{description:"没有部件啦","image-size":60})])):(0,s.kq)("",!0),((0,s.wg)(!0),(0,s.iD)(s.HY,null,(0,s.Ko)(C.myCompsList,(e=>((0,s.wg)(),(0,s.iD)("div",{key:e.title,class:"widgets-list-item"},[(0,s._)("div",y,[(0,s.Wm)($,null,{default:(0,s.w5)((()=>[((0,s.wg)(),(0,s.j4)((0,s.LL)(e.icon)))])),_:2},1024)]),(0,s._)("div",k,[(0,s._)("h2",null,(0,l.zw)(e.title),1),(0,s._)("p",null,(0,l.zw)(e.description),1)]),(0,s._)("div",v,[(0,s.Wm)(W,{type:"primary",icon:"el-icon-plus",size:"small",onClick:t=>C.push(e)},null,8,["onClick"])])])))),128))])])),_:1}),(0,s.Wm)(O,{style:{height:"51px"}},{default:(0,s.w5)((()=>[(0,s.Wm)(W,{size:"small",onClick:t[2]||(t[2]=e=>C.backDefaul())},{default:(0,s.w5)((()=>[(0,s.Uk)("恢复默认")])),_:1})])),_:1})])),_:1})])):(0,s.kq)("",!0)],2)}var C=i(9980),W=i.n(C),z=i(2856),$={components:{draggable:W()},data(){return{customizing:!1,allComps:z["default"],defaultGrid:[],widgets:[]}},created(){this.defaultGrid=this.$tool.data.get("defaultgrid")||this.$config.DEFAULT_GRID,this.widgets=this.$tool.data.get("widgets"),0==this.widgets.length&&(this.widgets=JSON.parse(JSON.stringify(this.defaultGrid)))},mounted(){this.$emit("on-mounted")},computed:{allCompsList(){var e=[];for(var t in this.allComps)e.push({key:t,title:z["default"][t].title,icon:z["default"][t].icon,description:z["default"][t].description,minWidth:z["default"][t].minWidth});var i=this.widgets;for(let s of e){const e=i.find((e=>e.name===s.key));e&&(s.disabled=!0)}return e},myCompsList(){var e=this.$tool.data.get("dashboardgrid");return e.length>0?this.allCompsList.filter((t=>!t.disabled&&e.includes(t.key))):this.allCompsList.filter((e=>!e.disabled))}},methods:{custom(){this.customizing=!0;const e=this.$refs.widgets.offsetWidth;this.$nextTick((()=>{const t=this.$refs.widgets.offsetWidth/e;this.$refs.widgets.style.setProperty("transform",`scale(${t})`),this.setDomWidth(this.widgets)}))},setDomWidth(e){e.map((e=>{this.sizeChange(e.name)}))},push(e){this.widgets.push({name:e.key,layout:e.layout||24})},remove(e){var t=this.widgets;t.splice(t.findIndex((t=>t.name===e)),1)},save(){this.customizing=!1,this.$refs.widgets.style.removeProperty("transform"),this.$tool.data.set("widgets",this.widgets),this.$http.post("widgets",{name:"widgets",event:"update",data:this.widgets}).then((e=>{200!=e.code&&this.$alert(e.message,"提示",{type:"error"})}))},backDefaul(){this.customizing=!1,this.$refs.widgets.style.removeProperty("transform"),this.widgets=JSON.parse(JSON.stringify(this.defaultGrid)),this.$tool.data.remove("widgets")},close(){this.customizing=!1,this.$refs.widgets.style.removeProperty("transform")},sizeChange(e){this.$refs[`components${e}`].refView&&this.$refs[`components${e}`].refView()}}},b=i(3744);const D=(0,b.Z)($,[["render",_],["__scopeId","data-v-a847c536"]]);var L=D}}]);