"use strict";(self["webpackChunkvoghion_vue_admin"]=self["webpackChunkvoghion_vue_admin"]||[]).push([[92066],{92066:function(t,e,a){a.r(e),a.d(e,{default:function(){return d}});var i=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){return t.showEditModal()}}},[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.labelname,callback:function(e){t.$set(t.form,"labelname",e)},expression:"form.labelname"}})],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}},[e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"id",label:"id"}}),e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"labelname",label:"标签名称"}}),e("el-table-column",{attrs:{"header-align":"center",align:"center",prop:"actions",label:"操作"},scopedSlots:t._u([{key:"default",fn:function({row:a}){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.showEditModal(a)}}},[t._v("编辑")]),e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.deleteHandle(a)}}},[t._v("删除")])]}}])})],1),e("div",{staticClass:"g-pagination-container"},[e("el-pagination",{attrs:{"current-page":t.dataSource.pageNow,"page-sizes":[20,50,100],"page-size":t.dataSource.pageSize,layout:"sizes, prev, pager, next, jumper",background:"",total:t.dataSource.rowCount},on:{"size-change":function(e){return t.fetchDataSource(null,e)},"current-change":function(e){return t.fetchDataSource(e)}}})],1),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},nativeOn:{submit:function(t){t.preventDefault()}}},[e("el-form-item",{attrs:{label:"标签名称"}},[e("el-input",{staticStyle:{width:"256px"},attrs:{clearable:""},model:{value:t.dialogForm.labelname,callback:function(e){t.$set(t.dialogForm,"labelname",e)},expression:"dialogForm.labelname"}})],1)],1)],1)],1)},o=[],l={data(){return{form:{},dataSource:{records:[],pageNow:1,pageSize:20},loading:!1,dialogVisible:!1,dialogRecord:void 0,dialogForm:{}}},mounted(){this.fetchDataSource()},methods:{async fetchDataSource(t,e){this.loading=!0;const a={pageNow:t||this.dataSource.pageNow,pageSize:e||this.dataSource.pageSize,...this.form},i=await this.$store.dispatch({type:"product/goodsLabelList",payload:a});i&&(this.dataSource=i),this.loading=!1},async addHandle(){const t=await this.$store.dispatch({type:"product/addGoodsLabel",payload:{...this.dialogForm}});t&&(this.fetchDataSource(),this.closeEditModal())},showEditModal(t){this.dialogVisible=!0,this.dialogRecord=t,this.dialogForm=t||{}},closeEditModal(){this.dialogVisible=!1,this.dialogRecord=void 0,this.dialogForm={}},isAdd(){return!this.dialogRecord},dialogTitle(){return this.isAdd()?"新增标签":"编辑标签"},async editHandle(){const t=await this.$store.dispatch({type:"product/editGoodsLabel",payload:{id:this.dialogRecord.id,...this.dialogForm}});t&&(this.fetchDataSource(),this.closeEditModal())},async deleteHandle(t){this.$confirm("确定删除？").then((async()=>{const e=await this.$store.dispatch({type:"product/deleteGoodsLabel",payload:{id:t.id}});e&&(this.fetchDataSource(),this.closeEditModal())}))},handleClose(){this.dialogVisible=!1}}},n=l,r=a(81656),s=(0,r.A)(n,i,o,!1,null,null,null),d=s.exports}}]);