1 line
4.1 KiB
JavaScript
1 line
4.1 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d207706"],{a111:function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"divBox"},[a("el-card",[a("el-button",{staticClass:"mb20",attrs:{size:"small",type:"primary"},on:{click:t.onAdd}},[t._v("添加数据")]),t._v(" "),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{data:t.tableData.data,size:"small"}},[t._l(t.columns,(function(e,i){return a("el-table-column",{key:i,attrs:{prop:e.key,label:e.title,"min-width":e.minWidth},scopedSlots:t._u([{key:"default",fn:function(i){return[["img","image","pic"].indexOf(e.key)>-1||e.key.indexOf("pic")>-1||e.key.indexOf("img")>-1||e.key.indexOf("image")>-1||e.key.indexOf("banner")>-1?a("div",{staticClass:"demo-image__preview"},[Array.isArray(i.row[e.key])?a("div",t._l(i.row[e.key],(function(t,e){return a("span",{key:e},[a("el-image",{staticStyle:{width:"36px",height:"36px","margin-right":"5px"},attrs:{src:t}})],1)})),0):a("div",[a("el-image",{staticStyle:{width:"36px",height:"36px"},attrs:{src:i.row[e.key]}})],1)]):a("span",[t._v(t._s(i.row[e.key]))])]}}],null,!0)})})),t._v(" "),a("el-table-column",{attrs:{prop:"status",label:"是否显示","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-switch",{attrs:{"active-value":1,"inactive-value":0,width:55,"active-text":"显示","inactive-text":"隐藏"},on:{change:function(a){return t.onchangeIsShow(e.row)}},model:{value:e.row.status,callback:function(a){t.$set(e.row,"status",a)},expression:"scope.row.status"}})]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"100",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.onEdit(e.row.group_data_id)}}},[t._v("编辑")]),t._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return t.handleDelete(e.row.group_data_id,e.$index)}}},[t._v("删除")])]}}])})],2),t._v(" "),a("div",{staticClass:"block"},[a("el-pagination",{attrs:{background:"","page-size":t.tableData.limit,"current-page":t.tableData.page,layout:"total, prev, pager, next, jumper",total:t.tableData.total},on:{"size-change":t.handleSizeChange,"current-change":t.pageChange}})],1)],1)],1)},n=[],o=(a("7f7f"),a("ac6a"),a("8593")),s={name:"Data",data:function(){return{tableData:{page:1,limit:20,data:[],total:0},loading:!1,groupId:null,groupDetail:null}},computed:{columns:function(){if(!this.groupDetail)return[];var t=[{title:"ID",key:"group_data_id",minWidth:60}];return this.groupDetail.fields.forEach((function(e){t.push({title:e.name,key:e.field,minWidth:80})})),t.push({title:"添加时间",key:"create_time",minWidth:200}),t}},watch:{"$route.params.id":function(t){this.groupId=t},groupId:function(t){this.getGroupDetail(t)}},mounted:function(){this.groupId=this.$route.params.id},methods:{getGroupDetail:function(t){var e=this;Object(o["u"])(t).then((function(t){e.groupDetail=t.data,e.tableData.page=1,e.getList()}))},getList:function(){var t=this;this.loading=!0,Object(o["t"])(this.$route.params.id,this.tableData.page,this.tableData.limit).then((function(e){t.tableData.data=e.data.list,t.tableData.total=e.data.count,t.loading=!1})).catch((function(e){t.loading=!1,t.$message.error(e.message)}))},pageChange:function(t){this.tableData.page=t,this.getList()},handleSizeChange:function(t){this.tableData.limit=t,this.getList()},onAdd:function(){var t=this;this.$modalForm(Object(o["m"])(this.$route.params.id)).then((function(){return t.getList()}))},onEdit:function(t){var e=this;this.$modalForm(Object(o["O"])(this.$route.params.id,t)).then((function(){return e.getList()}))},onchangeIsShow:function(t){},handleDelete:function(t,e){var a=this;this.$modalSure("删除该数据").then((function(){Object(o["o"])(t).then((function(t){var i=t.message;a.$message.success(i),a.tableData.data.splice(e,1)})).catch((function(t){var e=t.message;a.$message.error(e)}))}))}}},l=s,r=a("2877"),u=Object(r["a"])(l,i,n,!1,null,"592a6f3c",null);e["default"]=u.exports}}]); |