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