1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
![]() |
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7f338bf7"],{"4e56":function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"outmain ba_f"},[t._m(0),n("div",[n("el-button",{attrs:{type:"primary",size:"medium"},on:{click:t.handleEdit}},[t._v("新增单位")]),n("el-button",{attrs:{size:"medium"},on:{click:t.handleDelete}},[t._v("批量删除")])],1),n("div",{staticClass:"tabledata mar_t20"},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:t.list,"element-loading-text":t.elementLoadingText,stripe:""},on:{"selection-change":t.setSelectRows}},[n("el-table-column",{attrs:{type:"selection",width:"55"}}),n("el-table-column",{attrs:{prop:"sort",label:"排序"}}),n("el-table-column",{attrs:{prop:"id",label:"ID"}}),n("el-table-column",{attrs:{prop:"name",label:"单位名称"}}),n("el-table-column",{attrs:{prop:"display",label:"状态"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-switch",{attrs:{"active-value":"1","inactive-value":"2"},on:{change:function(n){return t.changeSwitch(e.row)}},model:{value:e.row.display,callback:function(n){t.$set(e.row,"display",n)},expression:"scope.row.display"}})]}}])}),n("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("div",{staticClass:"flex"},[n("el-button",{attrs:{type:"text"},on:{click:function(n){return t.handleEdit(e.row)}}},[t._v("编辑")]),n("el-button",{attrs:{type:"text"},on:{click:function(n){return t.handleDelete(e.row)}}},[t._v("删除")])],1)]}}])})],1),n("el-pagination",{attrs:{background:"",layout:"prev, pager, next",total:t.page.total,"page-size":t.page.pagesize,"current-page":t.page.currentPage},on:{"update:currentPage":function(e){return t.$set(t.page,"currentPage",e)},"update:current-page":function(e){return t.$set(t.page,"currentPage",e)},"current-change":t.handleCurrentChange}}),n("edit",{ref:"edit",on:{fetchData:t.fetchData}})],1)])},a=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"shuju_title mar_b20"},[n("div",{staticClass:"shuju_title_text"},[n("span",[t._v("商品单位")])])])}],o=(n("d81d"),n("96cf"),n("1da1")),c=n("afb7"),u=n("5a4a"),i={components:{Edit:c["a"]},created:function(){this.fetchData()},data:function(){return{list:[],listLoading:!0,selectRows:"",elementLoadingText:"正在加载...",page:{total:0,size:10,currentPage:1}}},methods:{fetchData:function(){var t=this;return Object(o["a"])(regeneratorRuntime.mark((function e(){var n,r,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(u["x"])({page:t.page.currentPage});case 2:n=e.sent,r=n.data,a=n.count,t.list=r,t.page.total=a,t.listLoading=!1;case 8:case"end":return e.stop()}}),e)})))()},setSelectRows:function(t){this.selectRows=t},handleEdit:function(t){t.id?this.$refs["edit"].showEdit(t):this.$refs["edit"].showEdit()},handleDelete:function(t){var e=this;if(t.id)this.$baseConfirm("你确定要删除当前项吗",null,Object(o["a"])(regeneratorRuntime.mark((function n(){var r,a;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,Object(u["cb"])({id:t.id});case 2:r=n.sent,a=r.msg,e.$baseMessage(a,"success"),e.fetchData();case 6:case"end":return n.stop()}}),n)}))));else{if(!(this.selectRows.length>0))return this.$baseMessage("未选中任何行","error"),!1;var n=this.selectRows.map((function(t){return t.id}));this.$baseConfirm("你确定要删除选中项吗",null,Object(o["a"])(regeneratorRuntime.mark((function t(){var r,a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(u["cb"])({id:n});case 2:r=t.sent,a=r.msg,e.$baseMessage(a,"success"),e.fetchData();case 6:case"end":return t.stop()}}),t)}))))}},changeSwitch:function(t){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function n(){var r,a;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next
|