"use strict";(self["webpackChunkmi_wifi_agent"]=self["webpackChunkmi_wifi_agent"]||[]).push([[7523],{2400:function(e,l,a){a.r(l),a.d(l,{default:function(){return u}});var t=a(641);const i={class:"left-panel"},s={class:"right-panel"},n={class:"right-panel-search"};function o(e,l,a,o,r,d){const c=(0,t.g2)("el-button"),h=(0,t.g2)("el-input"),u=(0,t.g2)("el-header"),p=(0,t.g2)("el-table-column"),b=(0,t.g2)("el-tag"),g=(0,t.g2)("el-popconfirm"),f=(0,t.g2)("el-button-group"),k=(0,t.g2)("scTable"),m=(0,t.g2)("el-main"),y=(0,t.g2)("el-container"),v=(0,t.g2)("save-dialog");return(0,t.uX)(),(0,t.CE)(t.FK,null,[(0,t.bF)(y,null,{default:(0,t.k6)((()=>[(0,t.bF)(u,null,{default:(0,t.k6)((()=>[(0,t.Lk)("div",i,[(0,t.bF)(c,{type:"primary",icon:"el-icon-plus",onClick:d.add},null,8,["onClick"]),(0,t.bF)(c,{type:"danger",plain:"",icon:"el-icon-delete",disabled:0==r.selection.length,onClick:d.batch_del},null,8,["disabled","onClick"])]),(0,t.Lk)("div",s,[(0,t.Lk)("div",n,[(0,t.bF)(h,{modelValue:r.search.keyword,"onUpdate:modelValue":l[0]||(l[0]=e=>r.search.keyword=e),placeholder:"部门名称",clearable:""},null,8,["modelValue"]),(0,t.bF)(c,{type:"primary",icon:"el-icon-search",onClick:d.upsearch},null,8,["onClick"])])])])),_:1}),(0,t.bF)(m,{class:"nopadding"},{default:(0,t.k6)((()=>[(0,t.bF)(k,{ref:"table",apiObj:r.apiObj,"row-key":"id",onSelectionChange:d.selectionChange,hidePagination:""},{default:(0,t.k6)((()=>[(0,t.bF)(p,{type:"selection",width:"50"}),(0,t.bF)(p,{label:"部门名称",prop:"label",width:"250"}),(0,t.bF)(p,{label:"排序",prop:"sort",width:"150"}),(0,t.bF)(p,{label:"状态",prop:"status",width:"150"},{default:(0,t.k6)((e=>[1==e.row.status?((0,t.uX)(),(0,t.Wv)(b,{key:0,type:"success"},{default:(0,t.k6)((()=>[(0,t.eW)("启用")])),_:1})):(0,t.Q3)("",!0),0==e.row.status?((0,t.uX)(),(0,t.Wv)(b,{key:1,type:"danger"},{default:(0,t.k6)((()=>[(0,t.eW)("停用")])),_:1})):(0,t.Q3)("",!0)])),_:1}),(0,t.bF)(p,{label:"创建时间",prop:"date",width:"180"}),(0,t.bF)(p,{label:"备注",prop:"remark","min-width":"300"}),(0,t.bF)(p,{label:"操作",fixed:"right",align:"right",width:"170"},{default:(0,t.k6)((e=>[(0,t.bF)(f,null,{default:(0,t.k6)((()=>[(0,t.bF)(c,{text:"",type:"primary",size:"small",onClick:l=>d.table_show(e.row,e.$index)},{default:(0,t.k6)((()=>[(0,t.eW)("查看")])),_:2},1032,["onClick"]),(0,t.bF)(c,{text:"",type:"primary",size:"small",onClick:l=>d.table_edit(e.row,e.$index)},{default:(0,t.k6)((()=>[(0,t.eW)("编辑")])),_:2},1032,["onClick"]),(0,t.bF)(g,{title:"确定删除吗？",onConfirm:l=>d.table_del(e.row,e.$index)},{reference:(0,t.k6)((()=>[(0,t.bF)(c,{text:"",type:"primary",size:"small"},{default:(0,t.k6)((()=>[(0,t.eW)("删除")])),_:1})])),_:2},1032,["onConfirm"])])),_:2},1024)])),_:1})])),_:1},8,["apiObj","onSelectionChange"])])),_:1})])),_:1}),r.dialog.save?((0,t.uX)(),(0,t.Wv)(v,{key:0,ref:"saveDialog",onSuccess:d.handleSaveSuccess,onClosed:l[1]||(l[1]=e=>r.dialog.save=!1)},null,8,["onSuccess"])):(0,t.Q3)("",!0)],64)}var r=a(8214),d={name:"dept",components:{saveDialog:r["default"]},data(){return{dialog:{save:!1},apiObj:this.$API.system.dept.list,selection:[],search:{keyword:null}}},methods:{add(){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open()}))},table_edit(e){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open("edit").setData(e)}))},table_show(e){this.dialog.save=!0,this.$nextTick((()=>{this.$refs.saveDialog.open("show").setData(e)}))},async table_del(e){var l={id:e.id},a=await this.$API.demo.post.post(l);200==a.code?(this.$refs.table.refresh(),this.$message.success("删除成功")):this.$alert(a.message,"提示",{type:"error"})},async batch_del(){this.$confirm(`确定删除选中的 ${this.selection.length} 项吗？如果删除项中含有子集将会被一并删除`,"提示",{type:"warning"}).then((()=>{const e=this.$loading();this.$refs.table.refresh(),e.close(),this.$message.success("操作成功")})).catch((()=>{}))},selectionChange(e){this.selection=e},upsearch(){},filterTree(e){var l=null;function a(t){t.forEach((t=>{t.id==e&&(l=t),t.children&&a(t.children)}))}return a(this.$refs.table.tableData),l},handleSaveSuccess(e,l){("add"==l||"edit"==l)&&this.$refs.table.refresh()}}},c=a(6262);const h=(0,c.A)(d,[["render",o]]);var u=h}}]);