canyin-project/ybcy/views/channel/index/static/js/chunk-644911e0.cad6e50e.js
2024-11-01 16:07:54 +08:00

1 line
6.8 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-644911e0"],{"0aa7":function(e,t,a){"use strict";a.r(t);var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"outmain ba_f"},[e._m(0),a("div",[a("el-button",{attrs:{type:"primary",size:"medium"},on:{click:e.handleEdit}},[e._v("新增规格")]),a("el-button",{attrs:{size:"medium"},on:{click:e.handleDelete}},[e._v("批量删除")])],1),a("div",{staticClass:"tabledata mar_t20"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:e.list,"element-loading-text":e.elementLoadingText,stripe:"","row-key":"id"},on:{"selection-change":e.setSelectRows}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{prop:"sort",label:"排序"}}),a("el-table-column",{attrs:{prop:"id",label:"ID"}}),a("el-table-column",{attrs:{prop:"name",label:"规格名称"}}),a("el-table-column",{attrs:{label:"状态"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{attrs:{"active-value":"1","inactive-value":"2"},on:{change:function(a){return e.changeSwitch(t.row)}},model:{value:t.row.display,callback:function(a){e.$set(t.row,"display",a)},expression:"scope.row.display"}})]}}])}),a("el-table-column",{attrs:{label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("div",{staticClass:"flex"},[a("el-button",{attrs:{type:"text"},on:{click:function(a){return e.handleEdit(t.row)}}},[e._v("编辑")]),a("el-button",{attrs:{type:"text"},on:{click:function(a){return e.handleDelete(t.row)}}},[e._v("删除")])],1)]}}])})],1),a("el-pagination",{attrs:{background:"",layout:"prev, pager, next",total:e.page.total,"page-size":e.page.pagesize,"current-page":e.page.currentPage},on:{"update:currentPage":function(t){return e.$set(e.page,"currentPage",t)},"update:current-page":function(t){return e.$set(e.page,"currentPage",t)},"current-change":e.handleCurrentChange}}),a("edit",{ref:"edit",on:{fetchData:e.fetchData}})],1)])},r=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"shuju_title mar_b20"},[a("div",{staticClass:"shuju_title_text"},[a("span",[e._v("商品规格")])])])}],s=(a("d81d"),a("a434"),a("96cf"),a("1da1")),i=a("98d5"),o=a("aa47"),c=a("5a4a"),l={components:{Edit:i["a"]},created:function(){this.fetchData()},data:function(){return{list:[],listLoading:!0,selectRows:"",elementLoadingText:"正在加载...",page:{total:0,size:10,currentPage:1}}},methods:{fetchData:function(){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function t(){var a,n,r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(c["w"])({page:e.page.currentPage});case 2:a=t.sent,n=a.data,r=a.count,e.list=n,e.page.total=r,e.listLoading=!1;case 8:case"end":return t.stop()}}),t)})))()},setSelectRows:function(e){this.selectRows=e},handleEdit:function(e){e.id?this.$refs["edit"].showEdit(e):this.$refs["edit"].showEdit()},handleDelete:function(e){var t=this;if(e.id)this.$baseConfirm("你确定要删除当前项吗",null,Object(s["a"])(regeneratorRuntime.mark((function a(){var n,r;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,Object(c["Z"])({id:e.id});case 2:n=a.sent,r=n.msg,t.$baseMessage(r,"success"),t.fetchData();case 6:case"end":return a.stop()}}),a)}))));else{if(!(this.selectRows.length>0))return this.$baseMessage("未选中任何行","error"),!1;var a=this.selectRows.map((function(e){return e.id}));this.$baseConfirm("你确定要删除选中项吗",null,Object(s["a"])(regeneratorRuntime.mark((function e(){var n,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(c["Z"])({id:a});case 2:n=e.sent,r=n.msg,t.$baseMessage(r,"success"),t.fetchData();case 6:case"end":return e.stop()}}),e)}))))}},changeSwitch:function(e){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function a(){var n,r;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,Object(c["o"])({id:e.id,display:e.display});case 2:n=a.sent,r=n.msg,t.$baseMessage(r,"success"),t.fetchData();case 6:case"end":return a.stop()}}),a)})))()},handleCurrentChange:function(e){this.page.currentPage=e,this.fetchData()},rowDrop:function(){var e=document.querySelector(".el-table__body-wrapper tbody"),t=this;o["a"].create(e,{onEnd:function(e){var a=e.newIndex,n=e.oldIndex,r=t.fetchData.splice(n,1)[0];t.fetchData.splice(a,0,r),this.fetchData=t.fetchData}})}}},u=l,d=a("2877"),f=Object(d["a"])(u,n,r,!1,null,null,null);t["default"]=f.exports},"98d5":function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{},[a("el-dialog",{attrs:{title:e.title,visible:e.dialogFormVisible,width:"600px","close-on-click-modal":!1},on:{"update:visible":function(t){e.dialogFormVisible=t},close:e.close}},[a("el-form",{ref:"form",attrs:{model:e.form,"label-width":"120px"}},[a("el-form-item",{attrs:{label:"排序",prop:"sort"}},[a("el-input",{attrs:{autocomplete:"off",placeholder:"请输入排序"},model:{value:e.form.sort,callback:function(t){e.$set(e.form,"sort","string"===typeof t?t.trim():t)},expression:"form.sort"}})],1),a("el-form-item",{attrs:{label:"规格名称",prop:"name",required:!0}},[a("el-input",{attrs:{autocomplete:"off",placeholder:"请输入规格名称"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name","string"===typeof t?t.trim():t)},expression:"form.name"}})],1)],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"medium"},on:{click:e.close}},[e._v("取 消")]),a("el-button",{attrs:{size:"medium",type:"primary"},on:{click:e.save}},[e._v("确 定")])],1)],1)],1)},r=[],s=(a("96cf"),a("1da1")),i=a("5a4a"),o={name:"goodlistedit",created:function(){},data:function(){return{form:{id:"",sort:"1",name:""},title:"",dialogFormVisible:!1}},components:{},methods:{showEdit:function(e){e?(this.title="编辑",this.form=Object.assign({},e)):this.title="添加",this.dialogFormVisible=!0},close:function(){this.$refs["form"].resetFields(),this.form=this.$options.data().form,this.dialogFormVisible=!1},setStoreId:function(e){this.form.storeId=e},save:function(){var e=this;this.$refs["form"].validate(function(){var t=Object(s["a"])(regeneratorRuntime.mark((function t(a){var n,r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!a){t.next=10;break}return t.next=3,Object(i["ab"])(e.form);case 3:n=t.sent,r=n.msg,e.$baseMessage(r,"success"),e.$emit("fetchData"),e.close(),t.next=11;break;case 10:return t.abrupt("return",!1);case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}},c=o,l=a("2877"),u=Object(l["a"])(c,n,r,!1,null,null,null);t["a"]=u.exports}}]);