zhangxiaoxu123456
2022-04-29 7e694768f428b83ed462eb384c43b2ebff61f75c
1
2
webpackJsonp([2],{QPlm:function(t,a){},UhcM:function(t,a,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n=e("woOf"),o=e.n(n),i=e("Gu7T"),l=e.n(i),s=e("Dd8w"),c=e.n(s),d=[{title:"ID",dataIndex:"id",width:60},{title:"label_name",dataIndex:"label_name",width:150,scopedSlots:{customRender:"label_name"}},{title:"color",dataIndex:"color",width:200,scopedSlots:{customRender:"color"}},{title:"状态",dataIndex:"statusText",width:150},{title:"创建时间",dataIndex:"create_time",width:160},{title:"操作",dataIndex:"operation",scopedSlots:{customRender:"operation"}}],r={inject:["reload"],data:function(){return{data:[],columns:d,cacheData:[],visible:!1,loading:!1,label:{color:"#000000"}}},created:function(){var t=this;this.$http({method:"Get",url:this.HOST+"/admin/tags/index",dataType:"json"}).then(function(a){t.data=a.data,t.data.filter(function(t){t.statusText=0==t.status?"开启":"禁用"}),t.cacheData=t.data.map(function(t){return c()({},t)})}).catch(function(t){console.log(t)})},methods:{handleChange:function(t,a,e){var n=[].concat(l()(this.data)),o=n.filter(function(t){return a===t.id})[0];o&&(o[e]=t,this.data=n)},edit:function(t){var a=[].concat(l()(this.data)),e=a.filter(function(a){return t===a.id})[0];e&&(e.editable=!0,this.data=a)},save:function(t){var a=this,e=[].concat(l()(this.data)),n=e.filter(function(a){return t===a.id})[0],o={label_name:n.label_name,color:n.color};n&&this.$http({method:"Post",url:this.HOST+"/admin/tags/edit?id="+t,dataType:"json",data:o}).then(function(t){t.data.code>0?a.$message.error(t.data.msg):(delete n.editable,a.data=e,a.cacheData=e.map(function(t){return c()({},t)}),a.$message.success(t.data.msg))}).catch(function(t){console.log(t)})},cancel:function(t){var a=[].concat(l()(this.data)),e=a.filter(function(a){return t===a.id})[0];e&&(o()(e,this.cacheData.filter(function(a){return t===a.id})[0]),delete e.editable,this.data=a)},status:function(t,a){var e=this;this.$http({method:"Post",url:this.HOST+"/admin/tags/setStatus",dataType:"json",data:{id:t,status:0==a?1:0}}).then(function(t){t.data.code>0?e.$message.error(t.data.msg):(e.$message.success(t.data.msg),e.reload())}).catch(function(t){console.log(t)})},showAdd:function(){this.visible=!0},labelAdd:function(){var t=this;this.loading=!0,this.$http({method:"Post",url:this.HOST+"/admin/tags/add",dataType:"json",data:this.label}).then(function(a){t.loading=!1,t.visible=!1,a.data.code>0?t.$message.error(a.data.msg):(t.$message.success(a.data.msg),t.reload())}).catch(function(a){t.loading=!1,console.log(a)})}}},u={render:function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",[e("a-button",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"primary"},on:{click:t.showAdd}},[t._v("添加标签")]),t._v(" "),e("a-table",{attrs:{columns:t.columns,dataSource:t.data,bordered:""},scopedSlots:t._u([t._l(["label_name","color"],function(a){return{key:a,fn:function(n,o,i){return[e("div",{key:a},[o.editable?e("a-input",{staticStyle:{margin:"-5px 0"},attrs:{value:n},on:{change:function(e){return t.handleChange(e.target.value,o.id,a)}}}):[t._v(t._s(n))]],2)]}}}),{key:"operation",fn:function(a,n,o){return[e("div",{staticClass:"editable-row-operations"},[n.editable?e("span",[e("a-button",{attrs:{type:"primary"},on:{click:function(){return t.save(n.id)}}},[t._v("保存")]),t._v(" "),e("a-popconfirm",{attrs:{title:"你确定?",okText:"确定",cancelText:"取消"},on:{confirm:function(){return t.cancel(n.id)}}},[e("a-button",[t._v("取消")])],1)],1):e("span",[e("a-button",{attrs:{type:"primary"},on:{click:function(){return t.edit(n.id)}}},[t._v("编辑")]),t._v(" "),1==n.status?e("a-button",{on:{click:function(){return t.status(n.id,n.status)}}},[t._v("开启")]):t._e(),t._v(" "),0==n.status?e("a-button",{attrs:{type:"danger"},on:{click:function(){return t.status(n.id,n.status)}}},[t._v("禁用")]):t._e()],1)])]}}],!0)}),t._v(" "),e("a-modal",{attrs:{title:"添加标签",onOk:"labelAdd"},model:{value:t.visible,callback:function(a){t.visible=a},expression:"visible"}},[e("template",{slot:"footer"},[e("a-button",{key:"submit",attrs:{type:"primary",loading:t.loading},on:{click:t.labelAdd}},[t._v("保存")])],1),t._v(" "),e("a-input",{staticStyle:{"margin-top":"10px"},attrs:{addonBefore:"标签名称",placeholder:"请填写标签名称"},model:{value:t.label.label_name,callback:function(a){t.$set(t.label,"label_name",a)},expression:"label.label_name"}}),t._v(" "),e("a-input",{staticStyle:{"margin-top":"10px"},attrs:{addonBefore:"标签颜色"},model:{value:t.label.color,callback:function(a){t.$set(t.label,"color",a)},expression:"label.color"}},[e("colorPicker",{attrs:{slot:"addonAfter"},slot:"addonAfter",model:{value:t.label.color,callback:function(a){t.$set(t.label,"color",a)},expression:"label.color"}})],1)],2)],1)},staticRenderFns:[]};var f=e("VU/8")(r,u,!1,function(t){e("QPlm")},"data-v-fc2a1b56",null);a.default=f.exports}});
//# sourceMappingURL=2.82faddb425f1da85c811.js.map