"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[17587],{17587:function(t,e,i){i.r(e),i.d(e,{default:function(){return m}});var a,l,o=function(){var t=this,e=t._self._c;return e("div",{staticStyle:{background:"white"}},[e("div",{staticClass:"g-pa-md"},[e("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!0}}},[t._v("新增")])],1),e("el-form",{ref:"form",staticClass:"g-mt-md",attrs:{inline:!0,model:t.form,"label-width":"80px"},nativeOn:{submit:function(t){t.preventDefault()}}},[e("el-form-item",{attrs:{label:"标签名称"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{clearable:""},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.fetchDataSource()}}},[t._v("搜索")])],1)],1),e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.dataSource.records}},[t._l(t.columns,(function(i){return[i.render?e("el-table-column",{key:i.key,attrs:{"header-align":"center",align:"center",prop:i.key,label:i.title},scopedSlots:t._u([{key:"default",fn:function(t){return[e("CustomColumn",{attrs:{render:i.render,params:t}})]}}],null,!0)}):e("el-table-column",{key:i.key,attrs:{"header-align":"center",align:"center",prop:i.key,label:i.title}})]})),e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"actions",label:"操作"},scopedSlots:t._u([{key:"default",fn:function({row:i}){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.showEditModal(i)}}},[t._v("编辑")]),e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.deleteHandle(i)}}},[t._v("删除")])]}}])})],2),e("el-dialog",{attrs:{visible:t.dialogVisible,title:t.dialogTitle(),width:"30%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}},scopedSlots:t._u([{key:"footer",fn:function(){return[e("span",{staticClass:"dialog-footer"},[e("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取 消")]),t.isAdd()?e("el-button",{attrs:{type:"primary"},on:{click:t.addHandle}},[t._v("确 定")]):e("el-button",{attrs:{type:"primary"},on:{click:t.editHandle}},[t._v("确 定")])],1)]},proxy:!0}])},[e("el-form",{staticClass:"g-mt-md",attrs:{inline:!0}},[e("el-form-item",{attrs:{label:"标签名称"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{clearable:""},model:{value:t.dialogInput,callback:function(e){t.dialogInput=e},expression:"dialogInput"}})],1)],1)],1)],1)},s=[],n={props:{params:{type:Object},render:{type:Function}},render(t){return this.render(t,this.params)}},r=n,d=i(81656),c=(0,d.A)(r,a,l,!1,null,null,null),u=c.exports,p={components:{CustomColumn:u},data(){return{form:{},dataSource:{records:[],pageNow:1,pageSize:20},loading:!1,columns:[{title:"id",key:"id"},{title:"标签名称",key:"name"},{title:"当前商品数量",key:"goodsNumber"}],dialogVisible:!1,dialogRecord:void 0,dialogInput:""}},mounted(){this.fetchDataSource()},methods:{async fetchDataSource(t,e){this.loading=!0;const i={pageNow:t||this.dataSource.pageNow,pageSize:e||this.dataSource.pageSize,...this.form},a=await this.$store.dispatch({type:"logisticsLabel/getLogisticsLabelList",payload:i});a&&(this.dataSource=a),this.loading=!1},async addHandle(){const t=await this.$store.dispatch({type:"logisticsLabel/addLogisticsLabel",payload:{name:this.dialogInput}});t&&(this.fetchDataSource(),this.closeEditModal())},showEditModal(t){this.dialogVisible=!0,this.dialogRecord=t,this.dialogInput=t.name},closeEditModal(){this.dialogVisible=!1,this.dialogRecord=void 0,this.dialogInput=void 0},isAdd(){return!this.dialogRecord},dialogTitle(){return this.isAdd()?"新增标签":"编辑标签"},async editHandle(){const t=await this.$store.dispatch({type:"logisticsLabel/editLogisticsLabel",payload:{id:this.dialogRecord.id,name:this.dialogInput}});t&&(this.fetchDataSource(),this.closeEditModal())},async deleteHandle(t){this.$confirm("确定删除？").then((async()=>{const e=await this.$store.dispatch({type:"logisticsLabel/deleteLogisticsLabel",payload:[t.id]});e&&(this.fetchDataSource(),this.closeEditModal())}))},handleClose(){this.dialogVisible=!1}}},h=p,g=(0,d.A)(h,o,s,!1,null,null,null),m=g.exports}}]);