chunk-b064dbca.b3abdce1.js 10 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-b064dbca"],{1332:function(e,t,r){"use strict";r("ff28")},b830:function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"m-container"},[r("h2",[r("el-page-header",{attrs:{content:("create"==e.pageType?"添加":"修改")+"阶梯奖励"},on:{back:e.onCancel}})],1),e._v(" "),r("div",{staticClass:"m-core"},[r("el-form",{ref:"form",attrs:{model:e.result,rules:e.rules,"label-width":"120px"}},[r("el-form-item",{staticStyle:{width:"500px"},attrs:{label:"活动名称",prop:"name"}},[r("el-input",{model:{value:e.result.name,callback:function(t){e.$set(e.result,"name","string"===typeof t?t.trim():t)},expression:"result.name"}})],1),e._v(" "),r("el-form-item",{staticStyle:{width:"500px"},attrs:{prop:"rewardMode",label:"活动类型"}},[r("el-radio-group",{model:{value:e.result.rewardMode,callback:function(t){e.$set(e.result,"rewardMode","string"===typeof t?t.trim():t)},expression:"result.rewardMode"}},[r("el-radio",{attrs:{label:"STAIR"}},[e._v("阶梯奖励")]),e._v(" "),r("el-radio",{attrs:{label:"PER"}},[e._v("累计奖励")])],1)],1),e._v(" "),r("el-form-item",{staticClass:"moreRule",staticStyle:{"margin-bottom":"0"}},[r("span",{staticClass:"min"},[e._v("最小值")]),e._v(" "),r("span",{staticClass:"min"},[e._v("最大值")]),e._v(" "),r("span",{staticClass:"max"},[e._v("奖励金额")])]),e._v(" "),r("div",{staticClass:"moreRule"},[e._l(e.result.domains,(function(t,a){return r("div",{key:t.key,staticClass:"moreRuleIn"},[r("el-form-item",{attrs:{label:"梯度"+(a+1)}},[r("el-input",{directives:[{name:"number",rawName:"v-number"}],attrs:{type:"number",disabled:t.disabled},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:t.min,callback:function(r){e.$set(t,"min","string"===typeof r?r.trim():r)},expression:"domain.min"}})],1),e._v(" "),r("el-form-item",[r("el-input",{directives:[{name:"number",rawName:"v-number"}],attrs:{type:"number",disabled:t.disabled},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:t.max,callback:function(r){e.$set(t,"max","string"===typeof r?r.trim():r)},expression:"domain.max"}})],1),e._v(" "),r("el-form-item",[r("el-input",{staticStyle:{width:"auto"},attrs:{type:"number",disabled:t.disabled},nativeOn:{mousewheel:function(e){e.preventDefault()}},model:{value:t.money,callback:function(r){e.$set(t,"money","string"===typeof r?r.trim():r)},expression:"domain.money"}}),e._v(" "),0==a||t.disabled?e._e():r("el-button",{on:{click:function(r){return r.preventDefault(),e.removeDomain(e.result,t)}}},[e._v("删除")])],1)],1)})),e._v(" "),e.result.errorText?r("div",{staticClass:"el-form-item__error"},[e._v("\n "+e._s(e.result.errorText)+"\n ")]):e._e()],2),e._v(" "),r("el-form-item",{staticClass:"add"},[r("el-button",{attrs:{icon:"el-icon-plus"},on:{click:function(t){return e.addDomain(e.result)}}},[e._v("新增梯度")])],1),e._v(" "),r("el-form-item",{staticStyle:{width:"500px"},attrs:{prop:"vipGroupCategoryIdList",label:"课程类型"}},[r("select-all",{staticStyle:{width:"100% !important"},attrs:{filterable:"",clearable:"",multiple:"",placeholder:"请选择"},model:{value:e.result.vipGroupCategoryIdList,callback:function(t){e.$set(e.result,"vipGroupCategoryIdList","string"===typeof t?t.trim():t)},expression:"result.vipGroupCategoryIdList"}},e._l(e.selects.vipGroupCategory,(function(e){return r("el-option",{key:e.id,attrs:{label:e.name,value:e.id.toString()}})})),1)],1),e._v(" "),r("el-form-item",{staticStyle:{width:"500px"},attrs:{prop:"organId",label:"所属分部"}},[r("el-select",{staticStyle:{width:"100% !important"},attrs:{filterable:"",clearable:"",placeholder:"请选择"},on:{change:function(t){return e.onSubjectChange("search")}},model:{value:e.result.organId,callback:function(t){e.$set(e.result,"organId","string"===typeof t?t.trim():t)},expression:"result.organId"}},e._l(e.selects.branchs,(function(e){return r("el-option",{key:e.id,attrs:{label:e.name,value:e.id.toString()}})})),1)],1),e._v(" "),r("el-form-item",{staticStyle:{width:"500px"},attrs:{prop:"subjectIds",label:"所属声部"}},[r("select-all",{staticStyle:{width:"100% !important"},attrs:{filterable:"",clearable:"",multiple:"",placeholder:"请选择"},on:{change:function(t){return e.onSubjectChange("search")}},model:{value:e.result.subjectIds,callback:function(t){e.$set(e.result,"subjectIds","string"===typeof t?t.trim():t)},expression:"result.subjectIds"}},e._l(e.selects.subjects,(function(e,t){return r("el-option",{key:t,attrs:{label:e.name,value:e.id.toString()}})})),1)],1),e._v(" "),r("el-form-item",{staticStyle:{width:"500px"},attrs:{prop:"teacherId",label:"老师"}},[r("select-all",{staticStyle:{width:"100% !important"},attrs:{filterable:"",clearable:"",multiple:"",placeholder:"请选择"},model:{value:e.result.teacherId,callback:function(t){e.$set(e.result,"teacherId","string"===typeof t?t.trim():t)},expression:"result.teacherId"}},e._l(e.teacherList,(function(e,t){return r("el-option",{key:t,attrs:{label:e.label,value:e.value.toString()}})})),1)],1),e._v(" "),r("el-form-item",[r("el-button",{on:{click:e.resetForm}},[e._v("重置")]),e._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit("form")}}},[e._v("立即"+e._s("create"==e.pageType?"创建":"修改"))])],1)],1)],1)])},s=[],n=(r("6b54"),r("ac6a"),r("c7eb")),i=(r("7f7f"),r("28a5"),r("96cf"),r("1da1")),l=(r("1cc7"),r("99b4")),o=(r("7e78"),{name:"branchActiveOperation",data:function(){return{organId:null,pageType:this.$route.query.type,id:this.$route.query.id,teacherList:[],result:{name:null,rewardMode:null,vipGroupCategoryIdList:null,organId:null,teacherId:null,subjectIds:null,courseScheduleType:"VIP",domains:[{min:null,max:null,money:null,disabled:!1,key:Date.now()}],errorText:null},rules:{name:[{required:!0,message:"请输入活动名称",trigger:"blur"}],rewardMode:[{required:!0,message:"请选择活动类型",trigger:"change"}],vipGroupCategoryIdList:[{type:"array",required:!0,message:"请选择课程类型",trigger:"change"}],organId:[{required:!0,message:"请选择所属分部",trigger:"change"}],subjectIds:[{type:"array",required:!0,message:"请选择所属声部",trigger:"change"}],teacherId:[{type:"array",required:!0,message:"请选择老师",trigger:"change"}]}}},mounted:function(){this.__init()},methods:{__init:function(){var e=Object(i["a"])(Object(n["a"])().mark((function e(){var t,r,a=this;return Object(n["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(this.$refs.form.resetFields(),this.$store.dispatch("setVipGroupCategory"),this.$store.dispatch("setBranchs"),this.$store.dispatch("setSubjects"),"update"!=this.pageType){e.next=11;break}return e.next=7,Object(l["h"])({id:this.id});case 7:t=e.sent,200==t.code&&(r=t.data,this.$nextTick((function(){a.result.organId=r.organId,a.result.subjectIds=r.subjectIds?r.subjectIds.split(","):r.subjectIds,a.onSubjectChange("update"),a.result={id:r.id,name:r.name,rewardMode:r.rewardMode,organId:r.organId,subjectIds:r.subjectIds?r.subjectIds.split(","):r.subjectIds,vipGroupCategoryIdList:r.vipGroupCategoryIdList?r.vipGroupCategoryIdList.split(","):r.vipGroupCategoryIdList,teacherId:r.teacherId?r.teacherId.split(","):r.teacherId,courseScheduleType:r.courseScheduleType,domains:r.rewardsRulesJson?JSON.parse(r.rewardsRulesJson):[{min:null,max:null,money:null,disabled:!1,key:Date.now()}],errorText:null}}))),e.next=12;break;case 11:this.resetForm();case 12:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),onSubjectChange:function(){var e=Object(i["a"])(Object(n["a"])().mark((function e(t){var r,a,s,i=this;return Object(n["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r=this.result.organId,a=this.result.subjectIds,!(a.length<=0)&&r&&""!=r){e.next=6;break}return this.teacherList=[],this.result.teacherId=[],e.abrupt("return");case 6:return s=Object.assign([],a).join(","),e.next=9,Object(l["m"])({organId:r,subjectIds:s,jobNature:"FULL_TIME"}).then((function(e){200==e.code&&("update"!=t&&(i.teacherList=[],i.result.teacherId=[]),e.data.forEach((function(e){i.teacherList.push({label:e.realName,value:e.id})})))}));case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),onCheckAll:function(){var e=this;this.teacherList.length<=0||(this.result.teacherId=[],this.teacherList.forEach((function(t){e.result.teacherId.push(t.value.toString())})))},onSubmit:function(e){var t=this;this.$refs[e].validate((function(e){var r=JSON.parse(JSON.stringify(t.result));if(t.addDomain(r,!0),!e||r.errorText)return!1;r.domains.forEach((function(e){e.money||(e.money=0)}));var a={organId:r.organId,vipGroupCategoryIdList:r.vipGroupCategoryIdList.join(","),teacherId:r.teacherId.join(","),courseScheduleType:r.courseScheduleType,rewardMode:r.rewardMode,subjectIds:r.subjectIds.join(","),rewardsRulesJson:JSON.stringify(r.domains),name:r.name};"update"==t.pageType?(a.id=r.id,Object(l["i"])(a).then((function(e){t.messageTips("修改",e)}))):"create"==t.pageType&&Object(l["g"])(a).then((function(e){t.messageTips("添加",e)}))}))},messageTips:function(e,t){200==t.code?(this.$message.success("修改成功"),this.$store.dispatch("delVisitedViews",this.$route),this.$router.push({path:"/operateManager/branchActiveManager/branchActive",query:{rules:this.pageInfo,searchForm:this.searchForm}})):this.$message.error(t.msg)},onCancel:function(){this.$store.dispatch("delVisitedViews",this.$route),this.$router.push({path:"/operateManager/branchActiveManager/branchActive",query:{rules:this.pageInfo,searchForm:this.searchForm}})},resetForm:function(){this.teacherList=[],this.result={name:null,rewardMode:null,organId:null,subjectIds:[],teacherId:[],courseScheduleType:"VIP",domains:[{min:null,max:null,money:null,disabled:!1,key:Date.now()}],errorText:null},this.$refs.form.resetFields()},removeDomain:function(e,t){var r=e.domains.indexOf(t);-1!==r&&(e.domains.splice(r,1),e.domains[e.domains.length-1].disabled=!1,e.errorText=null)},addDomain:function(e,t){var r=e.domains,a=r.length,s=r[a-1];s.min?a<=1&&parseInt(s.min)<=0?e.errorText="最小值不能小于0":a>1&&parseInt(s.min)<=parseInt(r[a-2].max)?e.errorText="最小值不能小于或等于上一个梯度的最大值":parseInt(s.max)?parseInt(s.max)<=parseInt(s.min)?e.errorText="最大值应大于该梯度的最小值":(e.errorText=null,t||(s.disabled=!0,r.push({min:null,max:null,disabled:!1,key:Date.now()}))):e.errorText="最大值不能为空":e.errorText="最小值不能为空"}}}),u=o,c=(r("1332"),r("2877")),d=Object(c["a"])(u,a,s,!1,null,"1f60de32",null);t["default"]=d.exports},ff28:function(e,t,r){}}]);