chunk-3ee5920a.efb34322.js 11 KB

12
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3ee5920a"],{1030: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("3835")),o=(r("96cf"),r("1da1")),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},3835:function(t,e,r){"use strict";function n(t){if(Array.isArray(t))return t}function a(t,e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,a=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0)if(r.push(o.value),e&&r.length===e)break}catch(c){a=!0,i=c}finally{try{n||null==s["return"]||s["return"]()}finally{if(a)throw i}}return r}}r.d(e,"a",(function(){return s}));var i=r("06c5");function o(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){return n(t)||a(t,e)||Object(i["a"])(t,e)||o()}},"6cbc":function(t,e,r){"use strict";var n=r("7cf6"),a=r.n(n);a.a},"7cf6":function(t,e,r){},"8a92":function(t,e,r){"use strict";var n=r("1030"),a=r.n(n);a.a},ada3:function(t,e,r){"use strict";r("8e6e"),r("456d");var n=r("ade3"),a=r("2909"),i=(r("a481"),r("96cf"),r("1da1")),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(Object(r),!0).forEach((function(e){Object(n["a"])(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(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)}}}}}]);
  2. //# sourceMappingURL=chunk-3ee5920a.efb34322.js.map