(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-02f9c298"],{"13b3":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"config-list-container",staticStyle:{padding:"10px"}},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.tableData,border:"",height:"100%"}},[n("el-table-column",{attrs:{prop:"name",label:"名称",align:"center","min-width":"120"}}),n("el-table-column",{attrs:{prop:"game",label:"游戏标识",align:"center","min-width":"120"}}),n("el-table-column",{attrs:{label:"状态",align:"center","min-width":"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(n){return e.handleSwitchChange(t.row)}},model:{value:t.row.status,callback:function(n){e.$set(t.row,"status",n)},expression:"scope.row.status"}})]}}])}),n("el-table-column",{attrs:{label:"是否热门",align:"center","min-width":"100"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(n){return e.handleSwitchChange(t.row)}},model:{value:t.row.is_rec,callback:function(n){e.$set(t.row,"is_rec",n)},expression:"scope.row.is_rec"}})]}}])}),n("el-table-column",{attrs:{label:"排序",align:"center","min-width":"150"},scopedSlots:e._u([{key:"default",fn:function(t){return[t.row.isEdit?n("el-input-number",{staticStyle:{width:"120px"},attrs:{step:1,size:"small"},model:{value:t.row.sort,callback:function(n){e.$set(t.row,"sort",n)},expression:"scope.row.sort"}}):n("span",[e._v(e._s(t.row.sort))])]}}])}),n("el-table-column",{attrs:{label:"操作",align:"center",width:"180",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){return[t.row.isEdit?[n("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(n){return e.handleSave(t.row)}}},[e._v("保存")]),n("el-button",{attrs:{type:"info",size:"mini"},on:{click:function(n){return e.handleCancel(t.row)}}},[e._v("取消")])]:[n("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(n){return e.handleEdit(t.row)}}},[e._v("编辑")])]]}}])})],1)],1)},r=[];n("a4d3");function i(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==t.indexOf(a))continue;n[a]=e[a]}return n}function c(e,t){if(null==e)return{};var n,a,r=i(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)n=c[a],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=n("c14f"),s=n("5530"),o=n("1da1"),u=(n("d81d"),n("e9f5"),n("ab43"),n("1236"),n("e9c4"),n("b64b"),n("d3b7"),n("7e1e")),d=["isEdit","_original"],f=["isEdit","_original"],b={name:"ConfigList",data:function(){return{tableData:[],loading:!1}},created:function(){this.getListData()},methods:{getListData:function(){var e=this;return Object(o["a"])(Object(l["a"])().m((function t(){var n,a;return Object(l["a"])().w((function(t){while(1)switch(t.p=t.n){case 0:return e.loading=!0,t.p=1,t.n=2,Object(u["h"])();case 2:n=t.v,n&&0===n.code&&(e.tableData=n.data.map((function(e){return Object(s["a"])(Object(s["a"])({},e),{},{isEdit:!1,_original:null})}))),t.n=4;break;case 3:t.p=3,a=t.v,console.error("获取列表失败:",a);case 4:return t.p=4,e.loading=!1,t.f(4);case 5:return t.a(2)}}),t,null,[[1,3,4,5]])})))()},handleEdit:function(e){e._original=JSON.parse(JSON.stringify(e)),e.isEdit=!0},handleCancel:function(e){Object.assign(e,e._original),e.isEdit=!1},handleSwitchChange:function(e){var t=this;return Object(o["a"])(Object(l["a"])().m((function e(){var n,a,r;return Object(l["a"])().w((function(e){while(1)switch(e.p=e.n){case 0:return n=t.tableData.map((function(e){e.isEdit,e._original;var t=c(e,d);return t})),e.p=1,e.n=2,Object(u["ib"])({field:"game_list",val:n});case 2:a=e.v,a&&0===a.code?t.$message.success("保存成功"):(t.$message.error(a.msg||"保存失败"),t.getListData()),e.n=4;break;case 3:e.p=3,r=e.v,console.error("保存接口异常:",r),t.$message.error("接口异常，保存失败"),t.getListData();case 4:return e.a(2)}}),e,null,[[1,3]])})))()},handleSave:function(e){var t=this;return Object(o["a"])(Object(l["a"])().m((function n(){var a,r,i;return Object(l["a"])().w((function(n){while(1)switch(n.p=n.n){case 0:return e.isEdit=!1,a=t.tableData.map((function(e){e.isEdit,e._original;var t=c(e,f);return t})),n.p=1,n.n=2,Object(u["ib"])({field:"game_list",val:a});case 2:r=n.v,r&&0===r.code?(t.$message.success("保存成功"),t.getListData()):(t.$message.error(r.msg||"保存失败"),t.handleCancel(e)),n.n=4;break;case 3:n.p=3,i=n.v,console.error("保存接口异常:",i),t.$message.error("接口异常，保存失败"),t.handleCancel(e);case 4:return n.a(2)}}),n,null,[[1,3]])})))()}}},g=b,p=(n("6a8a"),n("2877")),h=Object(p["a"])(g,a,r,!1,null,"0c1244ce",null);t["default"]=h.exports},"1cdd":function(e,t,n){},"6a8a":function(e,t,n){"use strict";n("1cdd")}}]);