1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-c3477bb8"],{"6b87":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e._self._c;return t("a-table",e._g(e._b({attrs:{rowKey:e.rowKey,columns:e.columns,dataSource:e.dataSource,expandedRowKeys:e.expandedRowKeys},on:{expand:e.handleExpand,expandedRowsChange:function(t){e.expandedRowKeys=t}},scopedSlots:e._u([e._l(e.slots,(function(t){return{key:t,fn:function(n,r,a){return[e._t(t,null,null,{text:n,record:r,index:a})]}}}))],null,!0)},"a-table",e.tableAttrs,!1),e.$listeners))},a=[],o=n("0fea");function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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 o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function u(e,t){if(e){if("string"===typeof e)return s(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)?s(e,t):void 0}}function s(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 c={name:"JTreeTable",props:{rowKey:{type:String,default:"id"},queryKey:{type:String,default:"parentId"},queryParams:{type:Object,default:function(){return{}}},topValue:{type:String,default:null},columns:{type:Array,required:!0},url:{type:String,required:!0},childrenUrl:{type:String,default:null},tableProps:{type:Object,default:function(){return{}}},immediateRequest:{type:Boolean,default:!0},condition:{type:String,default:"",required:!1}},data:function(){return{dataSource:[],expandedRowKeys:[]}},computed:{getChildrenUrl:function(){return this.childrenUrl?this.childrenUrl:this.url},slots:function(){var e,t=[],n=l(this.columns);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.scopedSlots&&r.scopedSlots.customRender&&t.push(r.scopedSlots.customRender)}}catch(a){n.e(a)}finally{n.f()}return t},tableAttrs:function(){return Object.assign(this.$attrs,this.tableProps)}},watch:{queryParams:{deep:!0,handler:function(){this.loadData()}}},created:function(){this.immediateRequest&&this.loadData()},methods:{loadData:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.topValue,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.url;this.$emit("requestBefore",{first:n}),n&&(this.expandedRowKeys=[]);var a=Object.assign({},this.queryParams||{});return a[this.queryKey]=t,this.condition&&this.condition.length>0&&(a["condition"]=this.condition),Object(o["c"])(r,a).then((function(t){var r=[];if(t.result instanceof Array)r=t.result;else{if(!(t.result.records instanceof Array))throw"返回数据类型不识别";r=t.result.records}var a=r.map((function(t){if(!0===t.hasChildren){var n,r,a,o=l(e.columns);try{for(o.s();!(a=o.n()).done;){var u=a.value;if(r=u.dataIndex,r)break}}catch(c){o.e(c)}finally{o.f()}var s=(n={id:"".concat(t.id,"_loadChild")},i(n,r,"loading..."),i(n,"isLoading",!0),n);t.children=[s]}return t}));return n&&(e.dataSource=a),e.$emit("requestSuccess",{first:n,dataSource:a,res:t}),Promise.resolve(a)})).finally((function(){return e.$emit("requestFinally",{first:n})}))},handleExpand:function(e,t){e&&!0===t.children[0].isLoading&&this.loadData(t.id,!1,this.getChildrenUrl).then((function(e){0===e.length?t.children=null:t.children=e}))}}},d=c,f=n("2877"),h=Object(f["a"])(d,r,a,!1,null,"ba3bd2be",null);t["default"]=h.exports},da9b: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("j-tree-table",{attrs:{url:e.url,topValue:"0",queryKey:"id",columns:e.columns,tableProps:e.tableProps},scopedSlots:e._u([{key:"action",fn:function(n){return[t("a",{on:{click:function(){return e.handleEdit(n.record)}}},[e._v("编辑")])]}}])})],1)},a=[],o=n("6b87"),i={name:"JeecgTreeTable",components:{JTreeTable:o["default"]},data:function(){return{url:"/api/asynTreeList",columns:[{title:"菜单名称",dataIndex:"name"},{title:"组件",dataIndex:"component"},{title:"排序",dataIndex:"orderNum"},{title:"操作",dataIndex:"action",scopedSlots:{customRender:"action"}}],selectedRowKeys:[]}},computed:{tableProps:function(){var e=this;return{rowSelection:{selectedRowKeys:e.selectedRowKeys,onChange:function(t){return e.selectedRowKeys=t}}}}},methods:{handleEdit:function(e){this.$info({width:600,title:"编辑",content:"编辑ID:"+e.id+";名称:"+e.name,okText:"确定",maskClosable:!0})}}},l=i,u=n("2877"),s=Object(u["a"])(l,r,a,!1,null,"2090c591",null);t["default"]=s.exports}}]);
|