chunk-19c7ca16.b20e9ff3.js 11 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-19c7ca16","chunk-2d0df437"],{"88bc":function(e,t,n){(function(t){var n=1/0,r=9007199254740991,i="[object Arguments]",a="[object Function]",o="[object GeneratorFunction]",l="[object Symbol]",s="object"==typeof t&&t&&t.Object===Object&&t,c="object"==typeof self&&self&&self.Object===Object&&self,u=s||c||Function("return this")();function d(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function f(e,t){var n=-1,r=e?e.length:0,i=Array(r);while(++n<r)i[n]=t(e[n],n,e);return i}function h(e,t){var n=-1,r=t.length,i=e.length;while(++n<r)e[i+n]=t[n];return e}var p=Object.prototype,y=p.hasOwnProperty,m=p.toString,v=u.Symbol,b=p.propertyIsEnumerable,g=v?v.isConcatSpreadable:void 0,w=Math.max;function C(e,t,n,r,i){var a=-1,o=e.length;n||(n=k),i||(i=[]);while(++a<o){var l=e[a];t>0&&n(l)?t>1?C(l,t-1,n,r,i):h(i,l):r||(i[i.length]=l)}return i}function S(e,t){return e=Object(e),j(e,t,(function(t,n){return n in e}))}function j(e,t,n){var r=-1,i=t.length,a={};while(++r<i){var o=t[r],l=e[o];n(l,o)&&(a[o]=l)}return a}function x(e,t){return t=w(void 0===t?e.length-1:t,0),function(){var n=arguments,r=-1,i=w(n.length-t,0),a=Array(i);while(++r<i)a[r]=n[t+r];r=-1;var o=Array(t+1);while(++r<t)o[r]=n[r];return o[t]=a,d(e,this,o)}}function k(e){return D(e)||O(e)||!!(g&&e&&e[g])}function F(e){if("string"==typeof e||V(e))return e;var t=e+"";return"0"==t&&1/e==-n?"-0":t}function O(e){return $(e)&&y.call(e,"callee")&&(!b.call(e,"callee")||m.call(e)==i)}var D=Array.isArray;function T(e){return null!=e&&I(e.length)&&!A(e)}function $(e){return R(e)&&T(e)}function A(e){var t=L(e)?m.call(e):"";return t==a||t==o}function I(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function L(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function R(e){return!!e&&"object"==typeof e}function V(e){return"symbol"==typeof e||R(e)&&m.call(e)==l}var K=x((function(e,t){return null==e?{}:S(e,f(C(t,1),F))}));e.exports=K}).call(this,n("c8ba"))},b098:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e._self._c;return t("a-tree-select",{staticStyle:{width:"100%"},attrs:{allowClear:"",labelInValue:"",getPopupContainer:function(e){return e.parentNode},disabled:e.disabled,dropdownStyle:{maxHeight:"400px",overflow:"auto"},placeholder:e.placeholder,loadData:e.asyncLoadTreeData,value:e.treeValue,treeData:e.treeData,multiple:e.multiple},on:{change:e.onChange,search:e.onSearch}})},i=[],a=n("0fea");function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function l(e){return u(e)||c(e)||f(e)||s()}function s(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function u(e){if(Array.isArray(e))return h(e)}function d(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){l=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(l)throw a}}}}function f(e,t){if(e){if("string"===typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p={name:"JTreeSelect",props:{value:{type:String,required:!1},placeholder:{type:String,default:"请选择",required:!1},dict:{type:String,default:"",required:!1},pidField:{type:String,default:"pid",required:!1},pidValue:{type:String,default:"",required:!1},disabled:{type:Boolean,default:!1,required:!1},hasChildField:{type:String,default:"",required:!1},condition:{type:String,default:"",required:!1},multiple:{type:Boolean,default:!1},loadTriggleChange:{type:Boolean,default:!1,required:!1}},data:function(){return{treeValue:null,treeData:[],url:"/sys/dict/loadTreeData",view:"/sys/dict/loadDictItem/",tableName:"",text:"",code:""}},watch:{value:function(){this.loadItemByCode()},dict:function(){this.initDictInfo(),this.loadRoot()}},created:function(){var e=this;this.validateProp().then((function(){e.initDictInfo(),e.loadRoot(),e.loadItemByCode()}))},methods:{loadItemByCode:function(){var e=this;this.value&&"0"!=this.value?Object(a["c"])("".concat(this.view).concat(this.dict),{key:this.value}).then((function(t){if(t.success){var n=e.value.split(",");e.treeValue=t.result.map((function(e,t){return{key:n[t],value:n[t],label:e}})),e.onLoadTriggleChange(t.result[0])}})):this.treeValue=null},onLoadTriggleChange:function(e){!this.multiple&&this.loadTriggleChange&&this.$emit("change",this.value,e)},initDictInfo:function(){var e=this.dict.split(",");this.tableName=e[0],this.text=e[1],this.code=e[2]},asyncLoadTreeData:function(e){var t=this;return new Promise((function(n){if(e.$vnode.children)n();else{var r=e.$vnode.key,i={pid:r,tableName:t.tableName,text:t.text,code:t.code,pidField:t.pidField,hasChildField:t.hasChildField,condition:t.condition};Object(a["c"])(t.url,i).then((function(e){if(e.success){var i,a=d(e.result);try{for(a.s();!(i=a.n()).done;){var o=i.value;o.value=o.key,0==o.leaf?o.isLeaf=!1:1==o.leaf&&(o.isLeaf=!0)}}catch(s){a.e(s)}finally{a.f()}t.addChildren(r,e.result,t.treeData),t.treeData=l(t.treeData)}n()}))}}))},addChildren:function(e,t,n){if(n&&n.length>0){var r,i=d(n);try{for(i.s();!(r=i.n()).done;){var a=r.value;if(a.key==e){t&&0!=t.length?a.children=t:a.isLeaf=!0;break}this.addChildren(e,t,a.children)}}catch(o){i.e(o)}finally{i.f()}}},loadRoot:function(){var e=this,t={pid:this.pidValue,tableName:this.tableName,text:this.text,code:this.code,pidField:this.pidField,hasChildField:this.hasChildField,condition:this.condition};Object(a["c"])(this.url,t).then((function(t){if(t.success&&t.result){var n,r=d(t.result);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.value=i.key,0==i.leaf?i.isLeaf=!1:1==i.leaf&&(i.isLeaf=!0)}}catch(a){r.e(a)}finally{r.f()}e.treeData=l(t.result)}}))},onChange:function(e){e?e instanceof Array?(this.$emit("change",e.map((function(e){return e.value})).join(",")),this.treeValue=e):(this.$emit("change",e.value,e.label),this.treeValue=e):(this.$emit("change",""),this.treeValue=null)},onSearch:function(e){},getCurrTreeData:function(){return this.treeData},validateProp:function(){var e=this,t=this.condition;return new Promise((function(n,r){if(t)try{var i=JSON.parse(t);"object"==o(i)&&i?n():(e.$message.error("组件JTreeSelect-condition传值有误,需要一个json字符串!"),r())}catch(a){e.$message.error("组件JTreeSelect-condition传值有误,需要一个json字符串!"),r()}else n()}))}},model:{prop:"value",event:"change"}},y=p,m=n("2877"),v=Object(m["a"])(y,r,i,!1,null,null,null);t["default"]=v.exports},f1cf:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e._self._c;return t("a-modal",{attrs:{title:e.title,width:e.width,visible:e.visible,confirmLoading:e.confirmLoading,destroyOnClose:!0,cancelText:"关闭"},on:{ok:e.handleOk,cancel:e.handleCancel}},[t("a-spin",{attrs:{spinning:e.confirmLoading}},[t("a-form",{attrs:{form:e.form}},[t("a-form-item",{attrs:{label:"父级节点",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("j-tree-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["pid",e.validatorRules.pid],expression:"['pid', validatorRules.pid]"}],ref:"treeSelect",attrs:{placeholder:"请选择父级节点",dict:"sys_category,name,id",pidField:"pid",pidValue:"0"}})],1),t("a-form-item",{attrs:{label:"分类名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["name",e.validatorRules.name],expression:"[ 'name', validatorRules.name]"}],attrs:{placeholder:"请输入分类名称"}})],1)],1)],1)],1)},i=[],a=n("0fea"),o=n("88bc"),l=n.n(o),s=n("b098"),c={name:"SysCategoryModal",components:{JTreeSelect:s["default"]},data:function(){return{form:this.$form.createForm(this),title:"操作",width:800,visible:!1,model:{},labelCol:{xs:{span:24},sm:{span:5}},wrapperCol:{xs:{span:24},sm:{span:16}},confirmLoading:!1,validatorRules:{code:{rules:[{required:!0,message:"请输入类型编码!"},{validator:this.validateMyCode}]},pid:{},name:{rules:[{required:!0,message:"请输入类型名称!"}]}},url:{add:"/sys/category/add",edit:"/sys/category/edit",checkCode:"/sys/category/checkCode"},expandedRowKeys:[],pidField:"pid",subExpandedKeys:[]}},created:function(){},methods:{add:function(){this.edit({})},edit:function(e){var t=this;this.form.resetFields(),this.model=Object.assign({},e),this.visible=!0,this.$nextTick((function(){t.form.setFieldsValue(l()(t.model,"pid","name","code"))}))},close:function(){this.$emit("close"),this.visible=!1},handleOk:function(){var e=this,t=this;this.form.validateFields((function(n,r){if(!n){t.confirmLoading=!0;var i="",o="";e.model.id?(i+=e.url.edit,o="put"):(i+=e.url.add,o="post");var l=Object.assign(e.model,r);Object(a["i"])(i,l,o).then((function(e){e.success?(t.$message.success(e.message),t.submitSuccess(l)):t.$message.warning(e.message)})).finally((function(){t.confirmLoading=!1,t.close()}))}}))},handleCancel:function(){this.close()},popupCallback:function(e){this.form.setFieldsValue(l()(e,"pid","name","code"))},submitSuccess:function(e){if(e.id)this.$emit("ok",e);else{var t=this.$refs.treeSelect.getCurrTreeData();this.expandedRowKeys=[],this.getExpandKeysByPid(e[this.pidField],t,t),e.pid&&0==this.expandedRowKeys.length&&(this.expandedRowKeys=this.subExpandedKeys),this.$emit("ok",e,this.expandedRowKeys.reverse())}},getExpandKeysByPid:function(e,t,n){if(e&&t&&t.length>0)for(var r=0;r<t.length;r++)t[r].key==e?(this.expandedRowKeys.push(t[r].key),this.getExpandKeysByPid(t[r]["parentId"],n,n)):this.getExpandKeysByPid(e,t[r].children,n)},validateMyCode:function(e,t,n){var r={pid:this.form.getFieldValue("pid"),code:t};Object(a["c"])(this.url.checkCode,r).then((function(e){e.success?n():n(e.message)}))}}},u=c,d=n("2877"),f=Object(d["a"])(u,r,i,!1,null,null,null);t["default"]=f.exports}}]);