"use strict";(self["webpackChunkscui"]=self["webpackChunkscui"]||[]).push([[5275],{57283:function(e,a,t){t.r(a),t.d(a,{default:function(){return m}});var s=t(66252);const i={class:"left-panel"},l={class:"right-panel"},n={class:"right-panel-search"},o=(0,s.Uk)("修改"),c=(0,s.Uk)("删除");function d(e,a,t,d,r,u){const h=(0,s.up)("el-button"),p=(0,s.up)("el-input"),m=(0,s.up)("el-header"),w=(0,s.up)("el-table-column"),g=(0,s.up)("el-switch"),v=(0,s.up)("scTable"),f=(0,s.up)("el-main"),b=(0,s.up)("el-container"),_=(0,s.up)("save-dialog");return(0,s.wg)(),(0,s.iD)(s.HY,null,[(0,s.Wm)(b,{class:"mainBox"},{default:(0,s.w5)((()=>[(0,s.Wm)(m,null,{default:(0,s.w5)((()=>[(0,s._)("div",i,[(0,s.Wm)(h,{size:r.size,type:"primary",icon:"el-icon-plus",onClick:u.add},null,8,["size","onClick"])]),(0,s._)("div",l,[(0,s._)("div",n,[(0,s.Wm)(p,{size:r.size,modelValue:r.params.keyword,"onUpdate:modelValue":a[0]||(a[0]=e=>r.params.keyword=e),placeholder:"部门名称",clearable:""},null,8,["size","modelValue"]),(0,s.Wm)(h,{size:r.size,type:"primary",icon:"el-icon-search",onClick:u.upsearch},null,8,["size","onClick"])])])])),_:1}),(0,s.Wm)(f,{class:"nopadding"},{default:(0,s.w5)((()=>[(0,s.Wm)(v,{ref:"table",tableName:"listCustomColumn",apiObj:r.list.apiObj,column:r.list.column,"row-key":"id",stripe:"",showPagination:r.showPagination,params:r.params},{active_status:(0,s.w5)((e=>[(0,s.Wm)(g,{modelValue:e.row.active_status,"onUpdate:modelValue":a=>e.row.active_status=a,"active-value":!0,"inactive-value":!1,loading:e.row.$switch_yx,onChange:a=>u.changeSwitch(a,e.row),size:r.size},null,8,["modelValue","onUpdate:modelValue","loading","onChange","size"])])),default:(0,s.w5)((()=>[(0,s.Wm)(w,{type:"selection",align:"center",width:"50"}),(0,s.Wm)(w,{label:"序号",align:"center",type:"index",width:"50"}),(0,s.Wm)(w,{label:"操作",fixed:"right",align:"center",width:"160"},{default:(0,s.w5)((e=>[(0,s.Wm)(h,{class:"table_btn_text",text:"",icon:"sc-icon-Edit",type:"primary",size:r.size,onClick:a=>u.handlerCommand(e.row,"edit")},{default:(0,s.w5)((()=>[o])),_:2},1032,["size","onClick"]),(0,s.Wm)(h,{class:"table_btn_text",text:"",icon:"sc-icon-Delete",type:"danger",size:r.size,onClick:a=>u.handlerCommand(e.row,"delete")},{default:(0,s.w5)((()=>[c])),_:2},1032,["size","onClick"])])),_:1})])),_:1},8,["apiObj","column","showPagination","params"])])),_:1})])),_:1}),r.dialog.save?((0,s.wg)(),(0,s.j4)(_,{key:0,ref:"saveDialog",onSuccess:u.handleSaveSuccess,onClosed:a[1]||(a[1]=e=>r.dialog.save=!1)},null,8,["onSuccess"])):(0,s.kq)("",!0)],64)}var r=t(3327),u={name:"dept",components:{saveDialog:r["default"]},data(){return{size:"small",showPagination:!1,dialog:{save:!1},list:{apiObj:this.$API.system.dept.list,column:[]},selection:[],params:{keyword:"",url:"dept.list"}}},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){const a={id:e.id},t=await this.$API.system.dept.del.post(a);200===t.code&&(this.$refs.table.refresh(),this.$message.success("删除成功"))},changeSwitch(e,a){a.$switch_yx=!0,setTimeout((async()=>{let e={id:a.id,status:a.active_status};const t=await this.$API.system.dept.status.post(e);200==t.code||(a.active_status=!a.active_status),delete a.$switch_yx}),500)},handlerCommand(e,a){"edit"==a?this.table_edit(e):"delete"==a&&this.table_del(e)},selectionChange(e){this.selection=e},upsearch(){this.$refs.table.upData(this.params)},filterTree(e){var a=null;function t(s){s.forEach((s=>{s.id===e&&(a=s),s.children&&t(s.children)}))}return t(this.$refs.table.tableData),a},handleSaveSuccess(e,a){("add"===a||"edit"===a)&&this.$refs.table.refresh()},sizeChange(e){this.size=e}}},h=t(83744);const p=(0,h.Z)(u,[["render",d]]);var m=p}}]);