UNPKG

tree-grid-component

Version:
2 lines 16.9 kB
webpackJsonp([1],{"1yV6":function(e,t,n){var a=n("FHqv"),o=n("hgbu")("iterator"),l=n("yYxz");e.exports=n("iANj").getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||l[a(e)]}},"2NXm":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n("BO1k"),o=n.n(a),l=n("WBDt"),i=n.n(l),r={data:function(){return{treeDataSource:i.a,treeColumns:[{key:1,name:"组织名称",fieldName:"org_name",minWidth:380,maxWidth:500,mainAccountSlotName:"mainAccount"},{key:2,name:"子账号数量(个)",fieldName:"sub_account_total",minWidth:130,expandFunc:!0},{key:3,name:"操作",fieldName:"operate",minWidth:290,slotName:"treeOperate"}],tableColumns:[{key:1,name:"子账号名称",fieldName:"sub_account_user_name",minWidth:200,showTooltip:!0},{key:2,name:"显示名",fieldName:"sub_account_display_name",minWidth:200,showTooltip:!0},{key:3,name:"关联状态",fieldName:"sub_account_relation_status",minWidth:90,showTooltip:!1},{key:4,name:"关联时间",fieldName:"sub_account_relation_time",minWidth:140,showTooltip:!1},{key:5,name:"操作",fieldName:"operate",minWidth:160,showTooltip:!1,slotName:"tableOperate"}],childrenAlias:"sub_account_list"}},components:{treeGrid:n("Sz5k").a},methods:{deepTraversal:function(e){if(e.isExpand=!1,e.children&&e.children.length>0){var t=e.children,n=!0,a=!1,l=void 0;try{for(var i,r=o()(t);!(n=(i=r.next()).done);n=!0){var s=i.value;this.deepTraversal(s)}}catch(e){a=!0,l=e}finally{try{!n&&r.return&&r.return()}finally{if(a)throw l}}}},handlerFold:function(e){console.log("展开/折叠"),e.isFold=!e.isFold,e.isFold||this.deepTraversal(e)},handlerExpand:function(e){console.log("扩展/收起"),e.isExpand=!e.isExpand},handlerData:function(e){var t=[],n=5;return function a(o,l){if(o<=0)return!1;var i=Math.min(o,n);window.requestAnimationFrame(function(){for(var n=0;n<i;n++)t.push(e[l+n]);a(o-i,l+i)})}(e.length,0),t}}},s={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"common-css contains"},[n("tree-grid",{ref:"recTree",attrs:{list:e.treeDataSource,treeColumnList:e.treeColumns,columnList:e.tableColumns,tableListName:e.childrenAlias},on:{"update:list":function(t){e.treeDataSource=t},handlerFold:e.handlerFold,handlerExpand:e.handlerExpand},scopedSlots:e._u([{key:"mainAccount",fn:function(){return[n("i",{staticClass:"tree-account"},[e._v("\n 【主账号: SPgmdd】\n ")])]},proxy:!0},{key:"treeOperate",fn:function(){return[n("el-button",{attrs:{type:"text"}},[e._v("添加子账号")]),e._v(" "),n("el-button",{attrs:{type:"text"}},[e._v("修改")]),e._v(" "),n("el-button",{attrs:{type:"text"}},[e._v("删除组织")])]},proxy:!0},{key:"extendTable",fn:function(t){return[n("el-table",{staticClass:"show-border",staticStyle:{width:"90%"},style:t.data.children&&t.data.children.length>0?"margin-left: 13px":"",attrs:{data:e.handlerData(t.data.sub_account_list),border:"",lazy:"","max-height":470}},e._l(e.tableColumns,function(t){return n("el-table-column",{key:t.key,attrs:{prop:t.fieldName,label:t.name,"min-width":t.minWidth,"show-overflow-tooltip":t.showTooltip},scopedSlots:e._u([{key:"default",fn:function(a){return[t.slotName?e._e():n("span",[e._v("\n "+e._s(a.row[t.fieldName])+"\n ")]),e._v(" "),t.slotName?e._t(t.slotName,function(){return[n("el-button",{attrs:{type:"text"}},[e._v("解除关联")]),e._v(" "),n("el-button",{attrs:{type:"text"}},[e._v("变更组织")])]},{data:a.row}):e._e()]}}],null,!0)})}),1)]}}])})],1)},staticRenderFns:[]};var d=n("VU/8")(r,s,!1,function(e){n("8j4V")},"data-v-4ce13df0",null);t.default=d.exports},"8j4V":function(e,t){},BO1k:function(e,t,n){e.exports={default:n("oY0/"),__esModule:!0}},FHqv:function(e,t,n){var a=n("NZra"),o=n("hgbu")("toStringTag"),l="Arguments"==a(function(){return arguments}());e.exports=function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:l?a(t):"Object"==(i=a(t))&&"function"==typeof t.callee?"Arguments":i}},QF4L:function(e,t){},RLCm:function(e,t){},St71:function(e,t,n){var a=n("FKWp"),o=n("1yV6");e.exports=n("iANj").getIterator=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return a(t.call(e))}},Sz5k:function(e,t,n){"use strict";var a=n("mvHQ"),o=n.n(a),l={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:e.tdClass},[0!==e.root&&1!==e.nodes?n("span",{staticClass:"before-line",style:{left:e.model.bLeft+"px"}}):e._e(),e._v(" "),n("table",[n("tr",[n("td",{attrs:{colspan:e.colSpan}},[n("table",[n("tr",{staticClass:"level",class:e.levelClass},[n("td",{staticClass:"td1"},[n("div",{staticClass:"td-title"},[n("div",[e.model.children&&e.model.children.length>0?n("i",{class:"zk-table--tree-icon zk-icon "+(e.model.isFold?"zk-icon-minus-square-o zk-shield":"zk-icon-plus-square-o"),on:{click:function(t){return e.handlerFold(e.model)}}}):e._e(),e._v(" "),n("div",{staticClass:"tree-row"},e._l(e.treeColumnList,function(t){return n("div",{key:t.key,staticClass:"tree-column",style:e.treeColumnRender(t,e.model)},[[t.slotName?e._e():n("span",{staticClass:"node-title",style:{width:t.expandFunc?"40px":"auto"}},[e._v("\n "+e._s(e.model[t.fieldName])),t.mainAccountSlotName&&1===e.model.level?e._t(t.mainAccountSlotName,null,{data:e.model}):e._e()],2),e._v(" "),t.expandFunc&&e.model[e.tableListName]&&e.model[e.tableListName].length>0?n("div",{staticClass:"zk-table__cell-inner zk-table--expand-inner",class:{"zk-table--expanded-inner":e.model.isExpand},on:{click:function(t){return e.handlerExpand(e.model)}}},[n("i",{staticClass:"zk-icon zk-icon-angle-right"})]):e._e(),e._v(" "),t.slotName?e._t(t.slotName,null,{data:e.model}):e._e()]],2)}),0),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.model.isExpand&&e.model[e.tableListName].length>0,expression:"model.isExpand && model[tableListName].length > 0"}],staticClass:"extend-table",style:e.tableRowRender},[n("span",{directives:[{name:"show",rawName:"v-show",value:e.model.isFold&&e.model.isExpand&&e.model.children.length>0,expression:"\n model.isFold &&\n model.isExpand &&\n model.children.length > 0\n "}],staticClass:"level-line"}),e._v(" "),e._t("extendTable",null,{data:e.model})],2)])])])])])])])]),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.model.isFold,expression:"model.isFold"}],staticClass:"other-node",class:e.otherNodeClass},e._l(e.model.children,function(t,a){return n("tree-unit",{key:String("child_node"+a),attrs:{num:a,root:1,nodes:e.model[e.tableListName].length,trees:e.trees,model:t,treeColumnList:e.treeColumnList,columnList:e.columnList,tableListName:e.tableListName},on:{handlerFold:e.handlerFold,handlerExpand:e.handlerExpand,"update:nodes":function(t){return e.$set(e.model[e.tableListName],"length",t)},"update:trees":function(t){e.trees=t}},scopedSlots:e._u([{key:"extendTable",fn:function(t){return[e._t("extendTable",null,{data:t.data})]}},e._l(e.treeColumnList,function(t){return{key:t.slotName,fn:function(n){return[e._t(t.slotName,null,{data:n.data})]}}}),e._l(e.treeColumnList,function(t){return{key:t.mainAccountSlotName,fn:function(n){return[e._t(t.mainAccountSlotName,null,{data:n.data})]}}})],null,!0)})}),1)])},staticRenderFns:[]};var i={name:"treeGrid",props:["list","treeColumnList","columnList","tableListName"],data:function(){return{treeDataSource:[]}},watch:{list:{handler:function(){this.initTreeData()},deep:!0}},computed:{},methods:{treeHeaderRender:function(e,t,n){return t!==n.length-1?{"flex-basis":e.minWidth+"px"||"100px","min-width":e.minWidth+"px"||"100px","max-width":e.maxWidth+"px"||"500px"}:{"flex-basis":e.minWidth+"px"||"100px","min-width":e.minWidth+"px"||"100px","max-width":e.maxWidth+"px"||"500px","padding-left":"80px"}},initTreeData:function(){console.log("处理前的:",JSON.parse(o()(this.list)));var e=JSON.parse(o()(this.list));!function e(t,n){t.map(function(t,a){t.isFold=!0,t.isExpand=!0,t.children=t.children||[],t.level=n,t.bLeft=1===n?65:14*(n-2)+65,t.children.length>0&&e(t.children,n+1)})}(e,1),console.log("处理后的:",e),this.treeDataSource=e},getMore:function(){alert("滚动到底部加载更多"),$("#scrollWrap").mCustomScrollbar("scrollTo","top",{scrollInertia:0})},handlerFold:function(e){this.$emit("handlerFold",e)},handlerExpand:function(e){this.$emit("handlerExpand",e)}},components:{"tree-unit":n("VU/8")({name:"treeUnit",props:["model","num","nodes","root","trees","treeColumnList","columnList","tableListName"],data:function(){return{parentNodeModel:null}},computed:{colSpan:function(){return 0===this.root?"":6},tdClass:function(){return 0===this.root?"td-border":"not-border"},levelClass:function(){return this.model?"level-"+this.model.level:""},childNodeClass:function(){return 0===this.root?"":"child-node"},otherNodeClass:function(){return this.model?"other-node-"+this.model.level:""},tableRowRender:function(){return{"padding-top":"20px","padding-bottom":"20px","margin-left":-15*(this.model.level-1)-54+"px","padding-left":65+15*(this.model.level-1)+"px","background-color":"#f4f6fa"}}},watch:{},methods:{columnRender:function(e,t){return 1===e.key?t.children&&t.children.length>0?"26px":"12px":"0px"},treeColumnRender:function(e,t){return{"flex-basis":2!==e.key?e.minWidth-14*(t.level-1)+"px":e.minWidth+13*(t.level-1)+"px","min-width":2!==e.key?e.minWidth-14*(t.level-1)+"px":e.minWidth+13*(t.level-1)+"px",display:e.expandFunc?"flex":"inline-block","padding-left":this.columnRender(e,t),"padding-right":3===e.key?"30px":"0","text-align":3===e.key?"right":"left","text-overflow":"ellipsis"}},getParentNode:function(e){var t=this;!function n(a,o){a.forEach(function(a){a.id===e.id&&(t.parentNodeModel=o),a.children&&n(a.children,a)})}(this.trees,this.trees)},handlerFold:function(e){this.$emit("handlerFold",e)},handlerExpand:function(e){this.$emit("handlerExpand",e)}},filters:{formatDate:function(e){return e}}},l,!1,function(e){n("RLCm")},null,null).exports},mounted:function(){var e=this;e.$nextTick(function(){e.initTreeData()})}},r={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"tree-grid"},[n("div",{staticClass:"tree-head"},[n("table",[n("tr",e._l(e.treeColumnList,function(t,a){return n("th",{key:t.key,class:"th"+(a+1),style:e.treeHeaderRender(t,a,e.treeColumnList)},[e._v("\n "+e._s(t.name)+"\n ")])}),0)])]),e._v(" "),n("div",{staticClass:"tree-wrap",attrs:{id:"scrollWrap"}},[n("div",{staticClass:"tree-body"},[e.treeDataSource.length>0?n("table",[n("tbody",[n("tr",[n("td",e._l(e.treeDataSource,function(t,a){return n("tree-unit",{key:"root_node_"+a,attrs:{root:0,num:a,nodes:e.treeDataSource.length,trees:e.treeDataSource,model:t,treeColumnList:e.treeColumnList,columnList:e.columnList,tableListName:e.tableListName},on:{handlerFold:e.handlerFold,handlerExpand:e.handlerExpand,"update:trees":function(t){e.treeDataSource=t}},scopedSlots:e._u([e._l(e.treeColumnList,function(t){return{key:t.slotName,fn:function(n){return[e._t(t.slotName,null,{data:n.data})]}}}),e._l(e.treeColumnList,function(t){return{key:t.mainAccountSlotName,fn:function(n){return[e._t(t.mainAccountSlotName,null,{data:n.data})]}}}),{key:"extendTable",fn:function(t){return[e._t("extendTable",null,{data:t.data})]}}],null,!0)})}),1)])])]):e._e()])])])},staticRenderFns:[]};var s=n("VU/8")(i,r,!1,function(e){n("QF4L")},null,null);t.a=s.exports},WBDt:function(e,t){e.exports=[{org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",sub_account_total:8,sub_account_list:[{sub_account_user_id:"0b7823a4-7856-4269-9760-ff5c1edac668",sub_account_user_name:"linshaoqiang66",sub_account_display_name:"linshaoqiang66",sub_account_relation_status:1,sub_account_relation_time:1664440928e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"7a43fd3d-9897-461e-b493-a63d861857e0",sub_account_user_name:"r12640",sub_account_display_name:"12640",sub_account_relation_status:1,sub_account_relation_time:1666078277e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"f39ca23b-133a-48aa-9d7e-c8db4d922168",sub_account_user_name:"testlyy11111111111111111111111",sub_account_display_name:"r123123",sub_account_relation_status:1,sub_account_relation_time:1658301905e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"1995a3ee-654f-4775-a63d-24eedfab7cc9",sub_account_user_name:"xioahahha",sub_account_display_name:"xioahahha",sub_account_relation_status:1,sub_account_relation_time:1656296289e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"86a28127-f9b4-4721-be65-c5b1350bc99a",sub_account_user_name:"zx3344",sub_account_display_name:"zx3344",sub_account_relation_status:1,sub_account_relation_time:165707294e4,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"230c2ac3-607e-4cef-9a73-9df1a1acda1c",sub_account_user_name:"zx9988",sub_account_display_name:"zx9988",sub_account_relation_status:1,sub_account_relation_time:1657073076e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"8cb442c8-9627-4fd3-97e3-07a97c50eedc",sub_account_user_name:"zxtest331",sub_account_display_name:"zxtest331",sub_account_relation_status:1,sub_account_relation_time:1653879501e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"},{sub_account_user_id:"5c36172d-3991-40db-be2a-83924e83ccb0",sub_account_user_name:"zxtest332",sub_account_display_name:"ssssssssssssssssssss",sub_account_relation_status:1,sub_account_relation_time:1665560605e3,org_id:"d9cbe04a-6973-4acd-bd3a-e938d5b091dd",org_name:"黑白公司",role:"sub"}],children:[{org_id:"6ca0799b-9b73-4b8f-9f0e-fbf6038880ec",org_name:"1的的顶顶顶顶顶顶顶顶顶顶的顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶dddd2",sub_account_total:0,sub_account_list:[],children:[]},{org_id:"191f638f-0f92-47f1-8a72-9f1163130c09",org_name:"ddd",sub_account_total:0,sub_account_list:[],children:[]},{org_id:"d1e26ad2-d110-4b6a-a418-3cba8dfb2f56",org_name:"方法反反复复付付付付oooooo付付付付付付付8付付付付付付付付付孤寡孤寡孤寡过过过过过过过过过过",sub_account_total:0,sub_account_list:[],children:[]},{org_id:"c1ab7200-6a8e-4931-84b6-fb6fcc39f68a",org_name:"卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔",sub_account_total:2,sub_account_list:[{sub_account_user_id:"f6f4e768-606a-46b1-9594-e9c934b1b55d",sub_account_user_name:"34fertrtr",sub_account_display_name:"ddd语言呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀呀晕晕晕晕晕晕晕晕晕晕晕晕晕晕晕",sub_account_relation_status:1,sub_account_relation_time:1656296772e3,org_id:"c1ab7200-6a8e-4931-84b6-fb6fcc39f68a",org_name:"卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔",role:"sub"},{sub_account_user_id:"94c53c14-6e29-4ef8-8354-570717ecbb16",sub_account_user_name:"zx0099",sub_account_display_name:"zx0099",sub_account_relation_status:1,sub_account_relation_time:1657073763e3,org_id:"c1ab7200-6a8e-4931-84b6-fb6fcc39f68a",org_name:"卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔尔卡塔",role:"sub"}],children:[{org_id:"85664c65-40de-4adb-aa09-fa13437c4aba",org_name:"立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛立陶宛",sub_account_total:0,sub_account_list:[],children:[{org_id:"ef97b52e-14ec-491a-9ca5-146bde073ffe",org_name:"阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷阿根廷",sub_account_total:0,sub_account_list:[],children:[{org_id:"f967f6cc-ba2d-4d3e-9284-a6581b906649",org_name:"葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄牙葡萄",sub_account_total:0,sub_account_list:[],children:[]}]}]}]}]}]},Zbun:function(e,t,n){var a=n("iANj"),o=a.JSON||(a.JSON={stringify:JSON.stringify});e.exports=function(e){return o.stringify.apply(o,arguments)}},mvHQ:function(e,t,n){e.exports={default:n("Zbun"),__esModule:!0}},"oY0/":function(e,t,n){n("+3lO"),n("tz60"),e.exports=n("St71")}}); //# sourceMappingURL=1.3936cb0f8ab80d1d4873.js.map