chunk-5eb186e8.f627cdb9.js 8.6 KB

12
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5eb186e8"],{"0091":function(t,e,r){},"0cd2":function(t,e,r){},"6cbc":function(t,e,r){"use strict";var n=r("0cd2"),i=r.n(n);i.a},"8a92":function(t,e,r){"use strict";var n=r("0091"),i=r.n(n);i.a},"8cdd":function(t,e,r){"use strict";r.d(e,"b",function(){return i}),r.d(e,"c",function(){return o}),r.d(e,"d",function(){return a}),r.d(e,"a",function(){return s});var n=r("bf9a");function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n["b"].get("admin-permissions",{params:t})}function o(t){return n["b"].post("admin-permissions",t)}function a(t,e){return n["b"].put("admin-permissions/".concat(t),e)}function s(t){return n["b"].get("admin-permissions/".concat(t,"/edit"))}},abe7: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,form:t.form,errors:t.errors,"edit-mode":t.editMode},on:{"update:form":function(e){t.form=e},"update:errors":function(e){t.errors=e}}},[r("el-form-item",{attrs:{label:"标识",required:"",prop:"slug"}},[r("el-input",{model:{value:t.form.slug,callback:function(e){t.$set(t.form,"slug",e)},expression:"form.slug"}})],1),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:"方法",prop:"http_method"}},[r("el-select",{attrs:{clearable:"",multiple:"",placeholder:"选择请求方法"},model:{value:t.form.http_method,callback:function(e){t.$set(t.form,"http_method",e)},expression:"form.http_method"}},t._l(t.methods,function(t){return r("el-option",{key:t,attrs:{label:t,value:t}})}),1)],1),r("el-form-item",{attrs:{label:"路径",prop:"http_path"}},[r("el-input",{attrs:{autosize:{minRows:6},type:"textarea"},model:{value:t.form.http_path,callback:function(e){t.$set(t.form,"http_path",e)},expression:"form.http_path"}})],1)],1)],1)],1)},i=[],o=(r("96cf"),r("3b8d")),a=r("8cdd"),s=r("ada3"),c=r("fe06"),u={name:"Form",components:{LzForm:s["a"]},mixins:[c["a"]],data:function(){return{form:{slug:"",name:"",http_method:"",http_path:""},errors:{},methods:["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"]}},methods:{getData:function(){var t=Object(o["a"])(regeneratorRuntime.mark(function t(){var e,r;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(!this.editMode){t.next=7;break}return t.next=3,Object(a["a"])(this.resourceId);case 3:e=t.sent,r=e.data,r.http_path=r.http_path.join("\n"),this.fillForm(r);case 7:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}(),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(a["d"])(this.resourceId,this.form);case 3:t.next=7;break;case 5:return t.next=7,Object(a["c"])(this.form);case 7:case"end":return t.stop()}},t,this)}));function e(){return t.apply(this,arguments)}return e}()}},l=u,f=r("2877"),p=Object(f["a"])(l,n,i,!1,null,null,null);e["default"]=p.exports},ada3:function(t,e,r){"use strict";r("8e6e"),r("456d");var n=r("bd86"),i=r("75fc"),o=(r("a481"),r("96cf"),r("3b8d")),a=(r("ac6a"),r("28a5"),r("9948")),s=r.n(a),c=r("9b02"),u=r.n(c),l=r("1a38"),f=r("873a"),p=r("a22f");function d(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 h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(r,!0).forEach(function(e){Object(n["a"])(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var m,b,g={name:"LzForm",components:{FlexSpacer:p["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(o["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(o["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,o=n.propsData,a=o.helper,s=o.label;if(a){a=a.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:a}}),t("i",{class:"ml-1 el-icon-question helper"})])]);return t("el-form-item",{props:n.propsData},[c].concat(Object(i["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:h({model:this.form,errors:this.errors,labelPosition:this.realLabelPosition},this.$attrs),on:h({},this.$listeners),class:{"in-dialog":this.inDialog},style:{width:this.inDialog?"auto":"800px"},directives:[{name:"loading",value:this.loading}],ref:"form"},[r,n])}},v=g,y=(r("6cbc"),r("8a92"),r("2877")),O=Object(y["a"])(v,m,b,!1,null,"3084f0c4",null);e["a"]=O.exports},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-5eb186e8.f627cdb9.js.map