chunk-620151b2.b4ee1b81.js 8.1 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-620151b2"],{"0747":function(module,__webpack_exports__,__webpack_require__){"use strict";var _api_setting__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("90e7");function _typeof(t){return _typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}__webpack_exports__["a"]={mounted:function(){this.getNewFormBuildRule()},methods:{getNewFormBuildRule:function getNewFormBuildRule(){var _this=this;Object(_api_setting__WEBPACK_IMPORTED_MODULE_0__["f"])(this.type?this.type:this.typeMole).then((function(res){_this.rules=res.data.rules,_this.url=res.data.url;var validate=res.data.validate;Object.keys(validate).map((function(key){"object"===_typeof(validate[key])&&validate[key].map((function(item){void 0!==item.pattern&&(item.pattern=eval(item.pattern))}))})),_this.ruleValidate=validate}))},setRulesValue:function(t,e){var n=this;return t.map((function(t){void 0!==t.field&&(t.value=e[t.field]||""),"object"===_typeof(t.options)&&t.options.map((function(t){void 0!==t.componentsModel&&(t.componentsModel=n.setRulesValue(t.componentsModel,e))})),"object"===_typeof(t.control)&&t.control.map((function(t){void 0!==t.componentsModel&&(t.componentsModel=n.setRulesValue(t.componentsModel,e))})),"object"===_typeof(t.componentsModel)&&(t.componentsModel=n.setRulesValue(t.componentsModel,e))})),t}}}},"2aebd":function(t,e,n){},"3ca7":function(t,e,n){"use strict";var o=n("2aebd"),r=n.n(o);r.a},4523:function(t,e,n){},"8ecf":function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("from-submit",{attrs:{validate:t.ruleValidate,url:t.url,title:t.title,rules:t.rules}})},r=[],u=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"form-submit"},[n("Form",{ref:"formSubmit"+t.field,attrs:{model:t.submitValue,"label-width":124}},[n("use-component",{attrs:{errorsValidate:t.errorsValidate,validate:t.validate,rules:t.rules},on:{changeValue:t.changeValue}}),t._t("content"),n("div",{staticStyle:{height:"2px"}}),t.buttonHide?n("Card",{staticClass:"fixed-card",style:{left:"200rpx"},attrs:{bordered:!1,"dis-hover":""}},[n("FormItem",[n("Button",{staticClass:"btn-add",attrs:{type:"primary",disabled:t.disabled,loading:t.loading},on:{click:t.submit}},[t._v(t._s(t.butName))])],1)],1):t._e(),t._t("button")],2)],1)},i=[],a=n("2a95"),l=n("e069"),s=n("b6bd"),c=n("2f62");function d(t){return d="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function p(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(n,!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var b={name:"fromSubmit",components:{useComponent:function(){return n.e("chunk-1acf8a58").then(n.bind(null,"05f7"))}},provide:function(){return{}},props:{rules:{type:Array,default:function(){return[]}},validate:{type:Object,default:function(){return{}}},butName:{type:String,default:"提交"},field:{type:String,default:function(){return""+Math.random()}},url:{type:String,default:""},method:{type:String,default:"POST"},buttonHide:{type:Boolean,default:!0},on:{type:Object,default:function(){return{}}}},data:function(){return{submitValue:{},disabled:!1,loading:!1,errorsValidate:[]}},computed:{},watch:{rules:{handler:function(){this.submitValue=this.getRuleValue(this.rules)},deep:!0}},mounted:function(){this.submitValue=this.getRuleValue(this.rules),this.setCopyrightShow({value:!1})},destroyed:function(){this.setCopyrightShow({value:!0})},methods:p({},Object(c["d"])("admin/layout",["setCopyrightShow","isMobile","menuCollapse"]),{changeValue:function(t){this.submitValue[t.field]=t.value,this.rules=this.setRuleValue(this.rules,t.field,t.value)},setRuleValue:function(t,e,n){var o=this;return t.map((function(t){void 0!==t.field&&t.field===e&&(t.value=n),"object"===d(t.options)&&t.options.map((function(t){void 0!==t.componentsModel&&(t.componentsModel=o.setRuleValue(t.componentsModel,e,n))})),"object"===d(t.control)&&t.control.map((function(t){void 0!==t.componentsModel&&(t.componentsModel=o.setRuleValue(t.componentsModel,e,n))})),"object"===d(t.componentsModel)&&(t.componentsModel=o.setRuleValue(t.componentsModel,e,n))})),t},getRuleValue:function(t){var e=this,n={};return t.map((function(t){if(void 0!==t.field&&(n[t.field]=t.value),"object"===d(t.options)&&t.options.map((function(t){if(void 0!==t.componentsModel){var o=e.getRuleValue(t.componentsModel);Object.assign(n,o)}})),"object"===d(t.control)&&t.control.map((function(t){if(void 0!==t.componentsModel){var o=e.getRuleValue(t.componentsModel);Object.assign(n,o)}})),"object"===d(t.componentsModel)){var o=e.getRuleValue(t.componentsModel);Object.assign(n,o)}})),n},submit:function(){var t=this,e=new a["a"](this.validate);e.validate(this.submitValue,(function(e){if(void 0===e||null===e)if(t.errorsValidate=[],t.disabled=!0,t.loading=!0,t.on["save"])try{t.on["save"](t.submitValue,(function(){return t.disabled=!1}),(function(){return t.loading=!1}))}catch(n){l["Message"].error(err||"提交失败")}else s["a"][t.method.toLowerCase()](t.url,t.submitValue).then((function(e){l["Message"].success(e.msg||"提交成功"),t.on["submit"]&&t.on["submit"](e)})).catch((function(t){l["Message"].error(t.msg||"提交失败")})).finally((function(){t.disabled=!1,t.loading=!1}));else t.errorsValidate=e,l["Message"].error(e[0].message)}))}})},h=b,y=(n("e172"),n("2877")),g=Object(y["a"])(h,u,i,!1,null,"334393ed",null),_=g.exports,v=n("0747"),j={name:"commonForm",components:{fromSubmit:_},mixins:[v["a"]],data:function(){return{ruleValidate:{},rules:[],url:"",title:"",type:""}},props:{typeMole:{type:String,default:""}},watch:{typeMole:function(){this.rules=[],this.getNewFormBuildRule()}}},O=j,M=(n("3ca7"),Object(y["a"])(O,o,r,!1,null,"1cba9fdc",null));e["default"]=M.exports},"90e7":function(t,e,n){"use strict";n.d(e,"j",(function(){return r})),n.d(e,"g",(function(){return u})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return a})),n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return s})),n.d(e,"h",(function(){return c})),n.d(e,"l",(function(){return d})),n.d(e,"m",(function(){return f})),n.d(e,"i",(function(){return p})),n.d(e,"e",(function(){return m})),n.d(e,"k",(function(){return b})),n.d(e,"f",(function(){return h}));var o=n("b6bd");function r(){return Object(o["a"])({url:"/supplier",method:"get"})}function u(t){return Object(o["a"])({url:"/supplier",method:"put",data:t})}function i(t){return Object(o["a"])({url:"city",method:"get",params:t})}function a(t){return Object(o["a"])({url:"admin",method:"get",params:t})}function l(){return Object(o["a"])({url:"admin/create",method:"get"})}function s(t){return Object(o["a"])({url:"admin/".concat(t,"/edit"),method:"get"})}function c(t){return Object(o["a"])({url:"admin/set_status/".concat(t.id,"/").concat(t.status),method:"put"})}function d(t){return Object(o["a"])({url:"setting/shipping_templates/list",method:"get",params:t})}function f(t,e){return Object(o["a"])({url:"setting/shipping_templates/save/".concat(t),method:"post",data:e})}function p(t){return Object(o["a"])({url:"setting/shipping_templates/".concat(t,"/edit"),method:"get"})}function m(t){return Object(o["a"])({url:"city",method:"get",params:t})}function b(t,e){return Object(o["a"])({url:"/system/form/info/".concat(t),method:"get",params:e})}function h(t){return Object(o["a"])({url:"system/config/edit_new_build/"+t,method:"get"})}},e172:function(t,e,n){"use strict";var o=n("4523"),r=n.n(o);r.a}}]);