94.bc6c560cdae156e09ea1.js 3.3 KB

1
  1. webpackJsonp([94],{"7raj":function(e,t){},dFm7:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a("mvHQ"),n=a.n(i),r=a("vLgD"),d=a("//BC"),l=a("rZyd"),s={name:"rule_category_edit",components:{CategorySelectorCell:d.a,DeptSelectorCell:l.a},data:function(){return{data:{rule_id:0,name:"",pid:0,dep_ids:[]},rule_cate:[],depts:[]}},watch:{rule_cate:function(e){e.length>0?this.data.pid=e[0].id:this.data.pid=0},depts:function(e){e.length>0&&(this.data.dep_ids=e.map(function(e){return e.dept_id}))}},methods:{del:function(){var e=this;this.$dialog.confirm({title:"删除分类吗",message:"确定要删除当前分类吗?"}).then(function(){e.$toast.loading({mask:!0,message:"处理中..."}),Object(r.a)("delete","/api/integral/rule",{rule_id:e.data.rule_id}).then(function(t){e.$toast.clear(),1==t.data.code?(e.$toast.success("删除成功"),e.$keep_alive_update("delete_cate_info",e.data),setTimeout(function(){e.$route_back()},300)):e.$toast(t.data.msg)})}).catch(function(){})},data_verify:function(){var e=this;e.$validator.validateAll().then(function(t){t?e.send():e.$notify({type:"danger",message:e.$validator.errors.items[0].msg})})},send:function(){var e=this;e.send_loading=!0,e.$toast.loading({message:"正在处理"}),this.data.dep_ids=n()(this.data.dep_ids),Object(r.a)("put","/api/integral/rule",e.data).then(function(t){e.send_loading=!1,e.$toast.clear(),1==t.data.code?(e.$toast("修改成功"),setTimeout(function(){e.$keep_alive_update("update_rule_cate",e.data),e.$route_back()},500)):e.$toast(t.data.msg)}).catch(function(t){e.send_loading=!1,e.$toast.clear()})}},created:function(){var e=this;if(this.$route.query.rule_id){this.data.rule_id=this.$route.query.rule_id,this.data.pid=this.$route.query.pid,this.data.name=this.$route.query.rule_name;var t=JSON.parse(this.$route.query.departments);t.length>0&&(this.depts=t.map(function(e){return{dept_name:e.name,dept_id:e.id}})),this.$nextTick(function(){e.rule_cate=[{id:1*e.$route.query.pid,name:e.$route.query.pname}]})}}},o={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("van-nav-bar",{attrs:{title:"修改积分分类","left-text":"返回","left-arrow":"","right-text":"保存"},on:{"click-left":e.$route_back,"click-right":e.data_verify}}),e._v(" "),a("div",{staticClass:"body_com has_header"},[a("scroller",[a("van-cell-group",[a("van-field",{directives:[{name:"validate",rawName:"v-validate",value:"required|max:10",expression:"'required|max:10'"}],attrs:{label:"分类名称",name:"名称",placeholder:"请输入名称",required:"",maxlength:"10","show-word-limit":""},model:{value:e.data.name,callback:function(t){e.$set(e.data,"name",t)},expression:"data.name"}})],1),e._v(" "),a("van-cell-group",[a("CategorySelectorCell",{attrs:{title:"选择父级分类",max:2,multi:!1},model:{value:e.rule_cate,callback:function(t){e.rule_cate=t},expression:"rule_cate"}})],1),e._v(" "),a("van-cell-group",[a("DeptSelectorCell",{attrs:{title:"可见范围",multi:!1},model:{value:e.depts,callback:function(t){e.depts=t},expression:"depts"}})],1),e._v(" "),a("div",{staticStyle:{padding:"0.32rem"}},[a("van-button",{attrs:{size:"large",type:"danger"},on:{click:e.del}},[e._v("删除")])],1)],1)],1)],1)},staticRenderFns:[]};var u=a("VU/8")(s,o,!1,function(e){a("7raj")},"data-v-79df6e10",null);t.default=u.exports}});