1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0015ba80","chunk-19c7ca16","chunk-2d0df437"],{3202:function(e,t,n){},"628b":function(e,t,n){"use strict";n("3202")},"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]",c="object"==typeof t&&t&&t.Object===Object&&t,s="object"==typeof self&&self&&self.Object===Object&&self,u=c||s||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,g=p.propertyIsEnumerable,b=v?v.isConcatSpreadable:void 0,w=Math.max;function x(e,t,n,r,i){var a=-1,o=e.length;n||(n=j),i||(i=[]);while(++a<o){var l=e[a];t>0&&n(l)?t>1?x(l,t-1,n,r,i):h(i,l):r||(i[i.length]=l)}return i}function S(e,t){return e=Object(e),C(e,t,(function(t,n){return n in e}))}function C(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 k(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 j(e){return O(e)||L(e)||!!(b&&e&&e[b])}function E(e){if("string"==typeof e||I(e))return e;var t=e+"";return"0"==t&&1/e==-n?"-0":t}function L(e){return K(e)&&y.call(e,"callee")&&(!g.call(e,"callee")||m.call(e)==i)}var O=Array.isArray;function F(e){return null!=e&&D(e.length)&&!_(e)}function K(e){return A(e)&&F(e)}function _(e){var t=R(e)?m.call(e):"";return t==a||t==o}function D(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function R(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function A(e){return!!e&&"object"==typeof e}function I(e){return"symbol"==typeof e||A(e)&&m.call(e)==l}var P=k((function(e,t){return null==e?{}:S(e,f(x(t,1),E))}));e.exports=P}).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)||s(e)||f(e)||c()}function c(){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 s(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(c){a.e(c)}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},ddf2:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("div",{staticClass:"table-operator"},[t("a-button",{attrs:{type:"primary",icon:"plus"},on:{click:e.handleAdd}},[e._v("新增")]),e.selectedRowKeys.length>0?t("a-dropdown",[t("a-menu",{attrs:{slot:"overlay"},slot:"overlay"},[t("a-menu-item",{key:"1",on:{click:e.batchDel}},[t("a-icon",{attrs:{type:"delete"}}),e._v("删除")],1)],1),t("a-button",{staticStyle:{"margin-left":"8px"}},[e._v(" 批量操作 "),t("a-icon",{attrs:{type:"down"}})],1)],1):e._e()],1),t("div",[t("div",{staticClass:"ant-alert ant-alert-info",staticStyle:{"margin-bottom":"16px"}},[t("i",{staticClass:"anticon anticon-info-circle ant-alert-icon"}),e._v(" 已选择 "),t("a",{staticStyle:{"font-weight":"600"}},[e._v(e._s(e.selectedRowKeys.length))]),e._v("项\n "),t("a",{staticStyle:{"margin-left":"24px"},on:{click:e.onClearSelected}},[e._v("清空")])]),t("a-table",e._b({ref:"table",attrs:{size:"middle",rowKey:"id",columns:e.columns,dataSource:e.dataSource,pagination:e.ipagination,loading:e.loading,expandedRowKeys:e.expandedRowKeys},on:{change:e.handleTableChange,expand:e.handleExpand},scopedSlots:e._u([{key:"action",fn:function(n,r){return t("span",{},[t("a",{on:{click:function(t){return e.handleEdit(r)}}},[e._v("编辑")]),t("a-divider",{attrs:{type:"vertical"}}),t("a-popconfirm",{attrs:{title:"确定删除吗?"},on:{confirm:function(){return e.handleDelete(r)}}},[t("a",[e._v("删除")])]),t("a-divider",{attrs:{type:"vertical"}}),t("a",{on:{click:function(t){return e.handleAddSub(r)}}},[e._v("添加下级")])],1)}}])},"a-table",e.tableProps,!1))],1),t("sysCategory-modal",{ref:"modalForm",on:{ok:e.modalFormOk}})],1)},i=[],a=n("0fea"),o=n("b65a"),l=n("f1cf");function c(e){return c="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},c(e)}function s(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */s=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(O){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),o=new j(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return L()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=S(o,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=d(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(O){return{type:"throw",arg:O}}}e.wrap=u;var f={};function h(){}function p(){}function y(){}var m={};l(m,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(E([])));g&&g!==t&&n.call(g,i)&&(m=g);var b=y.prototype=h.prototype=Object.create(m);function w(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(i,a,o,l){var s=d(e[i],e,a);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==c(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,o,l)}),(function(e){r("throw",e,o,l)})):t.resolve(f).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,l)}))}l(s.arg)}var i;this._invoke=function(e,n){function a(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(a,a):a()}}function S(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function E(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,l(b,"constructor",y),l(y,"constructor",p),p.displayName=l(y,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,o,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},w(x.prototype),l(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new x(u(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},w(b),l(b,o,"Generator"),l(b,i,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=E,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function u(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(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 d(e,t,n,r,i,a,o){try{var l=e[a](o),c=l.value}catch(s){return void n(s)}l.done?t(c):Promise.resolve(c).then(r,i)}function f(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){d(a,r,i,o,l,"next",e)}function l(e){d(a,r,i,o,l,"throw",e)}o(void 0)}))}}function h(e){return v(e)||m(e)||y(e)||p()}function p(){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 y(e,t){if(e){if("string"===typeof e)return g(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)?g(e,t):void 0}}function m(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function v(e){if(Array.isArray(e))return g(e)}function g(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 b={name:"SysCategoryList",mixins:[o["a"]],components:{SysCategoryModal:l["default"]},data:function(){return{description:"分类字典管理页面",columns:[{title:"分类名称",align:"left",dataIndex:"name"},{title:"分类编码",align:"left",dataIndex:"code"},{title:"操作",dataIndex:"action",align:"center",scopedSlots:{customRender:"action"}}],url:{list:"/sys/category/rootList",childList:"/sys/category/childList",delete:"/sys/category/delete",deleteBatch:"/sys/category/deleteBatch",exportXlsUrl:"/sys/category/exportXls",importExcelUrl:"sys/category/importExcel"},expandedRowKeys:[],hasChildrenField:"hasChild",pidField:"pid",dictOptions:{},subExpandedKeys:[]}},computed:{importExcelUrl:function(){return"".concat(window._CONFIG["domianURL"],"/").concat(this.url.importExcelUrl)},tableProps:function(){var e=this;return{rowSelection:{selectedRowKeys:e.selectedRowKeys,onChange:function(t){return e.selectedRowKeys=t}}}}},methods:{loadData:function(e){var t=this;1==e&&(this.ipagination.current=1),this.loading=!0,this.expandedRowKeys=[];var n=this.getQueryParams();return new Promise((function(e){Object(a["c"])(t.url.list,n).then((function(n){if(n.success){var r=n.result;Number(r.total)>0?(t.ipagination.total=Number(r.total),t.dataSource=t.getDataByResult(n.result.records),e()):(t.ipagination.total=0,t.dataSource=[])}else t.$message.warning(n.message);t.loading=!1}))}))},getDataByResult:function(e){var t=this;return e.map((function(e){if("1"==e[t.hasChildrenField]){var n={id:e.id+"_loadChild",name:"loading...",isLoading:!0};e.children=[n]}return e}))},handleExpand:function(e,t){var n=this;if(e){if(this.expandedRowKeys.push(t.id),t.children.length>0&&!0===t.children[0].isLoading){var r=this.getQueryParams();r[this.pidField]=t.id,Object(a["c"])(this.url.childList,r).then((function(e){e.success?e.result&&e.result.length>0?(t.children=n.getDataByResult(e.result),n.dataSource=h(n.dataSource)):(t.children="",t.hasChildrenField="0"):n.$message.warning(e.message)}))}}else{var i=this.expandedRowKeys.indexOf(t.id);i>=0&&this.expandedRowKeys.splice(i,1)}},initDictConfig:function(){},modalFormOk:function(e,t){e.id?(this.editOk(e,this.dataSource),this.dataSource=h(this.dataSource)):this.addOk(e,t)},editOk:function(e,t){if(t&&t.length>0)for(var n=0;n<t.length;n++){if(t[n].id==e.id){t[n]=e;break}this.editOk(e,t[n].children)}},addOk:function(){var e=f(s().mark((function e(t,n){var r,i,a;return s().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t[this.pidField]){e.next=4;break}this.loadData(),e.next=23;break;case 4:this.expandedRowKeys=[],r=u(n),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=15;break}return a=i.value,e.next=13,this.expandTreeNode(a);case 13:e.next=9;break;case 15:e.next=20;break;case 17:e.prev=17,e.t0=e["catch"](7),r.e(e.t0);case 20:return e.prev=20,r.f(),e.finish(20);case 23:case"end":return e.stop()}}),e,this,[[7,17,20,23]])})));function t(t,n){return e.apply(this,arguments)}return t}(),expandTreeNode:function(e){var t=this;return new Promise((function(n,r){t.getFormDataById(e,t.dataSource);var i=t.parentFormData;t.expandedRowKeys.push(e);var o=t.getQueryParams();o[t.pidField]=e,Object(a["c"])(t.url.childList,o).then((function(e){e.success?e.result&&e.result.length>0?(i.children=t.getDataByResult(e.result),t.dataSource=h(t.dataSource),n()):(i.children="",i.hasChildrenField="0",r()):r()}))}))},getFormDataById:function(e,t){if(t&&t.length>0)for(var n=0;n<t.length;n++)t[n].id==e?this.parentFormData=t[n]:this.getFormDataById(e,t[n].children)},handleAddSub:function(e){this.subExpandedKeys=[],this.getExpandKeysByPid(e.id,this.dataSource,this.dataSource),this.$refs.modalForm.subExpandedKeys=this.subExpandedKeys,this.$refs.modalForm.title="添加子分类",this.$refs.modalForm.edit({pid:e.id}),this.$refs.modalForm.disableSubmit=!1},handleDelete:function(e){var t=this,n=this;Object(a["a"])(n.url.delete,{id:e.id}).then((function(r){if(r.success)if(e.pid&&"0"!=e.pid){var i={pid:e.pid};n.$message.success(r.message),n.subExpandedKeys=[],n.getExpandKeysByPid(e.pid,t.dataSource,t.dataSource),n.addOk(i,t.subExpandedKeys.reverse())}else n.loadData();else n.$message.warning(r.message)}))},getExpandKeysByPid:function(e,t,n){if(e&&t&&t.length>0)for(var r=0;r<t.length;r++)t[r].id==e?(this.subExpandedKeys.push(t[r].id),this.getExpandKeysByPid(t[r]["pid"],n,n)):this.getExpandKeysByPid(e,t[r].children,n)}}},w=b,x=(n("628b"),n("2877")),S=Object(x["a"])(w,r,i,!1,null,"99324c1e",null);t["default"]=S.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),c=n("b098"),s={name:"SysCategoryModal",components:{JTreeSelect:c["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=s,d=n("2877"),f=Object(d["a"])(u,r,i,!1,null,null,null);t["default"]=f.exports}}]);
|