12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-684aa2c0"],{"0091":function(t,e,r){},"0cd2":function(t,e,r){},"105e":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("el-card",{scopedSlots:t._u([{key:"header",fn:function(){return[r("content-header")]},proxy:!0}])},[r("el-row",{attrs:{type:"flex",justify:"center"}},[r("lz-form",{ref:"form",attrs:{"get-data":t.getData,submit:t.onSubmit,errors:t.errors,form:t.form,"edit-mode":t.editMode,rules:t.rules},on:{"update:errors":function(e){t.errors=e},"update:form":function(e){t.form=e}}},[r("el-form-item",{attrs:{label:"名称:",required:"",prop:"name"}},[r("el-input",{model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),r("el-form-item",{attrs:{label:"充值金额:",required:"",prop:"recharge_money"}},[r("el-input-number",{attrs:{precision:0,step:1,max:1e3},model:{value:t.form.recharge_money,callback:function(e){t.$set(t.form,"recharge_money",e)},expression:"form.recharge_money"}})],1),r("el-form-item",{attrs:{label:"赠送金额:",required:"",prop:"give_money"}},[r("el-input-number",{attrs:{precision:0,step:1,max:500},model:{value:t.form.give_money,callback:function(e){t.$set(t.form,"give_money",e)},expression:"form.give_money"}})],1),r("el-form-item",{attrs:{label:"区域",required:"",prop:"area_name"}},[r("el-select",{attrs:{filterable:"",clearable:"",placeholder:"请选择"},model:{value:t.form.area_id,callback:function(e){t.$set(t.form,"area_id",e)},expression:"form.area_id"}},t._l(t.areas,function(t){return r("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})}),1)],1),r("el-form-item",{attrs:{label:"是否启用:",required:"",prop:"status"}},[r("el-radio",{attrs:{label:t.status1,border:""},model:{value:t.form.status,callback:function(e){t.$set(t.form,"status",e)},expression:"form.status"}},[t._v("启用")]),r("el-radio",{attrs:{label:t.status0,border:""},model:{value:t.form.status,callback:function(e){t.$set(t.form,"status",e)},expression:"form.status"}},[t._v("停用")])],1),r("el-form-item",{attrs:{label:"开始时间",required:"",prop:"start_at"}},[r("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:t.form.start_at,callback:function(e){t.$set(t.form,"start_at",e)},expression:"form.start_at"}})],1),r("el-form-item",{attrs:{label:"结束时间",required:"",prop:"end_at"}},[r("el-date-picker",{attrs:{type:"datetime",placeholder:"选择日期时间"},model:{value:t.form.end_at,callback:function(e){t.$set(t.form,"end_at",e)},expression:"form.end_at"}})],1)],1)],1)],1)},a=[],i=(r("ac6a"),r("5df3"),r("768b")),o=(r("96cf"),r("3b8d")),s=r("ada3"),c=r("f00a"),u=r("b64d"),l=r("fe06"),f={name:"Form",components:{LzForm:s["a"]},mixins:[l["a"]],data:function(){return{form:{name:"",give_money:0,discount:1,recharge_money:0,status:0,area_id:"",start_at:"",end_at:""},rules:{},errors:{},areas:[],status1:1,status0:0}},methods:{onSubmit:function(){var t=Object(o["a"])(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(!this.editMode){t.next=5;break}return t.next=3,Object(c["d"])(this.resourceId,this.form);case 3:t.next=7;break;case 5:return t.next=7,Object(c["c"])(this.form);case 7:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}(),getData:function(){var t=Object(o["a"])(regeneratorRuntime.mark(function t(){var e,r,n,a,o;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Object(u["b"])({all:1})]);case 2:if(e=t.sent,r=Object(i["a"])(e,1),n=r[0].data,this.areas=n,!this.editMode){t.next=12;break}return t.next=9,Object(c["a"])(this.resourceId);case 9:a=t.sent,o=a.data,this.fillForm(o);case 12:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}()}},d=f,m=r("2877"),p=Object(m["a"])(d,n,a,!1,null,null,null);e["default"]=p.exports},"469f":function(t,e,r){r("6c1c"),r("1654"),t.exports=r("7d7b")},"5d73":function(t,e,r){t.exports=r("469f")},"6cbc":function(t,e,r){"use strict";var n=r("0cd2"),a=r.n(n);a.a},"768b":function(t,e,r){"use strict";var n=r("a745"),a=r.n(n);function i(t){if(a()(t))return t}var o=r("5d73"),s=r.n(o);function c(t,e){var r=[],n=!0,a=!1,i=void 0;try{for(var o,c=s()(t);!(n=(o=c.next()).done);n=!0)if(r.push(o.value),e&&r.length===e)break}catch(u){a=!0,i=u}finally{try{n||null==c["return"]||c["return"]()}finally{if(a)throw i}}return r}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function l(t,e){return i(t)||c(t,e)||u()}r.d(e,"a",function(){return l})},"7d7b":function(t,e,r){var n=r("e4ae"),a=r("7cd6");t.exports=r("584a").getIterator=function(t){var e=a(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return n(e.call(t))}},"8a92":function(t,e,r){"use strict";var n=r("0091"),a=r.n(n);a.a},ada3:function(t,e,r){"use strict";r("8e6e"),r("456d");var n=r("bd86"),a=r("75fc"),i=(r("a481"),r("96cf"),r("3b8d")),o=(r("ac6a"),r("28a5"),r("9948")),s=r.n(o),c=r("9b02"),u=r.n(c),l=r("1a38"),f=r("873a"),d=r("a22f");function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(r,!0).forEach(function(e){Object(n["a"])(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var h,b,v={name:"LzForm",components:{FlexSpacer:d["a"]},inject:{view:{from:"view",default:null}},data:function(){return{loading:!1,stay:!1}},props:{getData:Function,submit:Function,errors:Object,form:Object,submitText:{type:String,default:"保存"},labelPosition:String,inDialog:Boolean,createdRedirect:{type:[String,Function],default:function(){var t=this.$route.path.split("/");return"/"+(t[t.length-2]||"")}},updatedRedirect:{type:[String,Function],default:function(){return this.$router.back.bind(this.$router)}},disableRedirect:Boolean,disableStay:Boolean,editMode:Boolean},computed:{realLabelPosition:function(){return this.labelPosition||(this.$store.state.miniWidth?"top":"right")},miniWidth:function(){return this.$store.state.miniWidth}},created:function(){this.copyMethods()},methods:{copyMethods:function(){var t=this;[l["default"].extends.methods,l["default"].methods].forEach(function(e){s()(e,function(e,r){t[r]=function(){e.apply(this.$refs.form,arguments)}})})},_getData:function(){var t=Object(i["a"])(regeneratorRuntime.mark(function t(){var e=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(this.loading=!0,this.view&&this.$emit("update:form",this.view.formBak),t.prev=2,t.t0=this.getData,!t.t0){t.next=7;break}return t.next=7,this.getData();case 7:this.$nextTick(function(){e.setInitialValues()}),t.next=13;break;case 10:t.prev=10,t.t1=t["catch"](2),Promise.reject(t.t1);case 13:this.loading=!1;case 14:case"end":return t.stop()}},t,this,[[2,10]])}));function e(){return t.apply(this,arguments)}return e}(),onSubmit:function(){var t=Object(i["a"])(regeneratorRuntime.mark(function t(){var e;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(this.$emit("update:errors",{}),t.prev=1,t.t0=this.submit,!t.t0){t.next=6;break}return t.next=6,this.submit();case 6:if(this.$message.success(Object(f["h"])(this.editMode?"updated":"created")),!this.stay&&!this.disableRedirect){t.next=9;break}return t.abrupt("return");case 9:e=this.editMode?this.updatedRedirect:this.createdRedirect,"string"===typeof e?this.$router.push(e):"function"===typeof e&&e(),t.next=17;break;case 13:t.prev=13,t.t1=t["catch"](1),this.$emit("update:errors",Object(f["j"])(t.t1.response)),422!==u()(t.t1,"response.status")&&Promise.reject(t.t1);case 17:case"end":return t.stop()}},t,this,[[1,13]])}));function e(){return t.apply(this,arguments)}return e}(),onReset:function(){this.$refs.form.resetFields()}},watch:{$route:{handler:function(){this.$active&&this._getData()},immediate:!0}},render:function(t){var e=this,r=this.$slots.default;Array.isArray(r)&&(r=r.map(function(r){var n=r.componentOptions,i=n.propsData,o=i.helper,s=i.label;if(o){o=o.replace(/\n/g,"<br>");var c=t("template",{slot:"label"},[t("span",[s]),t("el-tooltip",{attrs:{effect:"dark",placement:"top-start","popper-class":"form-helper-popper ".concat(e.miniWidth?"mini-width":"")}},[t("div",{slot:"content",domProps:{innerHTML:o}}),t("i",{class:"ml-1 el-icon-question helper"})])]);return t("el-form-item",{props:n.propsData},[c].concat(Object(a["a"])(n.children)))}return r}));!this.disableStay&&t("el-checkbox",{attrs:{title:"表单提交后,留在此页"},model:{value:e.stay,callback:function(t){e.stay=t}}},["留在此页"]);var n=this.$slots.footer||t("el-form-item",{class:"footer"},[t("loading-action",{attrs:{type:"primary",action:this.onSubmit}},[this.submitText]),t("el-button",{on:{click:this.onReset}},["重置"]),this.$slots.footerAppend,t("flex-spacer")]);return t("el-form",{props:p({model:this.form,errors:this.errors,labelPosition:this.realLabelPosition},this.$attrs),on:p({},this.$listeners),class:{"in-dialog":this.inDialog},style:{width:this.inDialog?"auto":"800px"},directives:[{name:"loading",value:this.loading}],ref:"form"},[r,n])}},g=v,y=(r("6cbc"),r("8a92"),r("2877")),x=Object(y["a"])(g,h,b,!1,null,"3084f0c4",null);e["a"]=x.exports},b64d:function(t,e,r){"use strict";r.d(e,"b",function(){return a}),r.d(e,"c",function(){return i}),r.d(e,"d",function(){return o}),r.d(e,"e",function(){return s}),r.d(e,"a",function(){return c});var n=r("bf9a");function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n["b"].get("area",{params:t})}function i(t){return n["b"].get("area/".concat(t))}function o(t){return n["b"].post("area",t)}function s(t,e){return n["b"].put("area/".concat(t),e)}function c(t){return n["b"].get("area/".concat(t,"/edit"))}},f00a:function(t,e,r){"use strict";r.d(e,"b",function(){return a}),r.d(e,"c",function(){return i}),r.d(e,"d",function(){return o}),r.d(e,"a",function(){return s});var n=r("bf9a");function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n["b"].get("recharge_configuration",{params:t})}function i(t){return n["b"].post("recharge_configuration",t)}function o(t,e){return n["b"].put("recharge_configuration/".concat(t),e)}function s(t){return n["b"].get("recharge_configuration/".concat(t,"/edit"))}},fe06:function(t,e,r){"use strict";var n=r("873a");e["a"]={provide:function(){return{view:this}},data:function(){return{formField:"form",idField:"id"}},computed:{editMode:function(){return!!this.resourceId},resourceId:function(){return this.$route.params[this.idField]}},created:function(){this.backupForm()},methods:{getResourceId:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return this.$route.params[t]},backupForm:function(){this.formBak=JSON.parse(JSON.stringify(this.$data[this.formField]))},fillForm:function(t){this.$data[this.formField]=Object(n["b"])(this.$data[this.formField],t)}}}}}]);
- //# sourceMappingURL=chunk-684aa2c0.06c892be.js.map
|