tableChild.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. /**
  2. *
  3. * @name: 子表格扩展
  4. * @author: yelog
  5. * @version: v1.4.4
  6. */
  7. layui.define(['table' ,'element', 'form', 'laytpl'], function (exports) {
  8. var $ = layui.jquery,
  9. table = layui.table,
  10. laytpl = layui.laytpl,
  11. tableChildren={},
  12. ELEM_HOVER='soul-table-hover';
  13. // 封装方法
  14. var mod = {
  15. /**
  16. * 渲染入口
  17. * @param myTable
  18. */
  19. render: function (myTable) {
  20. var _this = this,
  21. $table = $(myTable.elem),
  22. $tableBox = $table.next().children('.layui-table-box'),
  23. tableId = myTable.id,
  24. $tableHead = $tableBox.children('.layui-table-header').children('table'),
  25. $fixedBody = $tableBox.children('.layui-table-fixed').children('.layui-table-body').children('table'),
  26. $noFixedBody = $tableBox.children('.layui-table-body').children('table'),
  27. $tableBody = $.merge($tableBox.children('.layui-table-body').children('table'), $fixedBody),
  28. columns = _this.getCompleteCols(myTable.cols),
  29. childIndex = [],
  30. soulSort = typeof myTable.soulSort === 'undefined' || myTable.soulSort,
  31. i;
  32. // 修复hover样式
  33. _this.fixHoverStyle(myTable)
  34. // 获取子表配置信息
  35. for (i=0;i<columns.length;i++) {
  36. if (columns[i].children && columns[i].children.length>0) {
  37. childIndex.push(i);
  38. }
  39. }
  40. if (typeof $table.attr('lay-filter') === 'undefined') {
  41. $table.attr('lay-filter', tableId);
  42. }
  43. // 绑定一下主表事件
  44. if ($table.parents('.childTr').length === 0) {
  45. if (typeof myTable.rowEvent === 'function') {
  46. table.on('row('+$table.attr('lay-filter')+')', function (obj) {
  47. var index = $(this).data('index');
  48. obj.tr = $tableBody.children('tbody').children('tr[data-index="'+index+'"]');
  49. myTable.rowEvent(obj);
  50. })
  51. }
  52. if (typeof myTable.rowDoubleEvent === 'function') {
  53. table.on('rowDouble('+$table.attr('lay-filter')+')', function (obj) {
  54. var index = $(this).data('index');
  55. obj.tr = $tableBody.children('tbody').children('tr[data-index="'+index+'"]');
  56. myTable.rowDoubleEvent(obj);
  57. })
  58. }
  59. }
  60. if (childIndex.length>0) {
  61. for ( i = 0; i < childIndex.length; i++) {
  62. (function f() {
  63. var child = columns[childIndex[i]]
  64. ,curIndex = childIndex[i]
  65. ,icon = child.icon || ['layui-icon layui-icon-right', 'layui-icon layui-icon-down'];
  66. if (soulSort && !(myTable.url && myTable.page)) {
  67. // 前台排序
  68. table.on('sort(' + $table.attr('lay-filter') + ')', function () {
  69. _this.render(myTable)
  70. });
  71. }
  72. if (child.isChild && typeof child.isChild === 'function') {
  73. $tableBody.find('tr').find('td[data-key$="'+child.key+'"]>div').each(function (index) {
  74. if (child.isChild(layui.table.cache[tableId][index])) {
  75. if (child.field) {
  76. $(this).prepend('<i style="cursor: pointer" class="childTable '+icon[0]+'"></i>');
  77. } else {
  78. $(this).html('<i style="cursor: pointer" class="childTable '+icon[0]+'"></i>');
  79. }
  80. }
  81. })
  82. } else {
  83. if (child.field) {
  84. $tableBody.find('tr').find('td[data-key$="'+child.key+'"]>div').prepend('<i style="cursor: pointer" class="childTable '+icon[0]+'"></i>');
  85. } else {
  86. $tableBody.find('tr').find('td[data-key$="'+child.key+'"]>div').html('<i style="cursor: pointer" class="childTable '+icon[0]+'"></i>');
  87. }
  88. }
  89. $tableBody.children('tbody').children('tr').each(function () {
  90. $(this).children('td:eq('+curIndex+')').find('.childTable').on('click', function (e) {
  91. layui.stope(e)
  92. var rowIndex = $(this).parents('tr:eq(0)').data('index'),
  93. key = $(this).parents('td:eq(0)').data('key'),
  94. $this = $noFixedBody.children('tbody').children('tr[data-index=' + rowIndex + ']').children('td[data-key="'+key+'"]').find('.childTable:eq(0)'),
  95. $fixedThis = $fixedBody.find('tr[data-index=' + rowIndex + ']').children('td[data-key="'+key+'"]').find('.childTable:eq(0)'),
  96. data = table.cache[myTable.id][rowIndex],
  97. children = child.children;
  98. if (typeof child.children === 'function') {
  99. children = child.children(data)
  100. }
  101. if (child.show === 2) { // 弹窗模式
  102. layer.open($.extend({type: 1, title: '子表', maxmin: true ,content: _this.getTables(this, data, child, myTable, children), area: '1000px', offset: '100px'}, child.layerOption || {}));
  103. _this.renderTable(this, data, child, myTable, children, icon);
  104. } else { // 展开模式
  105. // 开启手风琴模式
  106. if (!$this.hasClass(icon[1]) && child.collapse) {
  107. $tableBody.children('tbody').children('tr').children('td').find('.childTable').each(function () {
  108. if ($(this).hasClass(icon[1])) {
  109. _this.destroyChildren($(this).parents('tr:eq(0)').data('index'), myTable, icon)
  110. }
  111. })
  112. }
  113. // 多个入口时,关闭其他入口
  114. if (!$this.hasClass(icon[1])) {
  115. $this.parents('tr:eq(0)').children('td').find('.childTable').each(function () {
  116. if ($(this).hasClass(icon[1])) {
  117. $(this).removeClass(icon[1]).addClass(icon[0])
  118. _this.destroyChildren($(this).parents('tr:eq(0)').data('index'), myTable, icon)
  119. }
  120. })
  121. }
  122. if ($this.hasClass(icon[1])) {
  123. $this.removeClass(icon[1]).addClass(icon[0])
  124. $fixedThis.removeClass(icon[1]).addClass(icon[0])
  125. } else {
  126. $this.removeClass(icon[0]).addClass(icon[1])
  127. $fixedThis.removeClass(icon[0]).addClass(icon[1])
  128. }
  129. var rowspanIndex=$this.parents('td:eq(0)').attr("rowspan");
  130. if ($this.hasClass(icon[1])) {
  131. var newTr = [];
  132. newTr.push('<tr class="noHover childTr"><td colspan="'+$tableHead.find('th:visible').length+'" style="cursor: inherit; padding: 0; width: '+$this.parents('tr:eq(0)').width()+'px">');
  133. newTr.push(_this.getTables(this, data, child, myTable, children));
  134. newTr.push('</td></tr>');
  135. if(rowspanIndex){
  136. var index=parseInt($this.parents('tr:eq(0)').data("index"))+parseInt(rowspanIndex)-1;
  137. $this.parents('table:eq(0)').children().children("[data-index='"+index+"']").after(newTr.join(''));
  138. }else{
  139. $this.parents('tr:eq(0)').after(newTr.join(''));
  140. }
  141. _this.renderTable(this, data, child, myTable, children, icon);
  142. if ($fixedBody.length>0) {
  143. var $tr = $this.parents('tr:eq(0)').next(),
  144. height = $tr.children('td').height(),
  145. $patchDiv = '<div class="soul-table-child-patch" style="height: '+height+'px"></div>';
  146. $tr.children('td').children('.layui-tab-card').css({
  147. position: 'absolute',
  148. top: 0,
  149. width: '100%',
  150. background: 'white',
  151. 'z-index': 200
  152. })
  153. $tr.children('td').append($patchDiv);
  154. $fixedBody.find('tr[data-index="'+rowIndex+'"]').each(function () {
  155. $(this).after('<tr><td style="padding: 0;" colspan="'+$(this).children('[data-key]').length+'">'+$patchDiv+'</td></tr>')
  156. })
  157. table.resize(tableId)
  158. }
  159. if (child.show === 3) {
  160. $this.parents('tr:eq(0)').next().find('.layui-table-view').css({margin:0, 'border-width':0});
  161. $this.parents('tr:eq(0)').next().find('.layui-table-header').css('display', 'none');
  162. }
  163. // 阻止事件冒泡
  164. $this.parents('tr:eq(0)').next().children('td').children('.layui-tab').children('.layui-tab-content').on('click', function (e) {
  165. e.stopPropagation()
  166. }).off('dblclick').on('dblclick', function (e) {
  167. e.stopPropagation()
  168. }).on('mouseenter', 'td', function (e) {
  169. e.stopPropagation()
  170. })
  171. } else {
  172. _this.destroyChildren(rowIndex, myTable, icon);
  173. table.resize(tableId)
  174. }
  175. }
  176. })
  177. })
  178. if (child.spread && child.show !== 2) {
  179. $tableBody.children('tbody').children('tr').children('td').find('.childTable').trigger('click');
  180. }
  181. })()
  182. }
  183. }
  184. },
  185. /**
  186. * 生成子表内容
  187. * @param _this
  188. * @param data
  189. * @param child
  190. * @param myTable
  191. * @param children 子表配置
  192. * @returns {string}
  193. */
  194. getTables: function (_this, data, child, myTable, children) {
  195. var tables = [],
  196. $table = $(myTable.elem),
  197. tableId = myTable.id,
  198. rowTableId = tableId + $(_this).parents('tr:eq(0)').data('index'),
  199. $tableMain = $table.next().children('.layui-table-box').children('.layui-table-body'),
  200. $tableBody = $tableMain.children('table'),
  201. scrollWidth = 0,
  202. i;
  203. tables.push('<div class="layui-tab layui-tab-card" lay-filter="table-child-'+rowTableId+'" style="margin: 0;border: 0;box-shadow: none;');
  204. if (child.show === 2) {
  205. tables.push('max-width: '+ ($tableBody.width()-2) +'px">')
  206. } else if (child.show === 3) {
  207. //不限制宽度
  208. tables.push('">')
  209. } else {
  210. if (child.childWidth === 'full') {
  211. //不限制宽度
  212. tables.push('">')
  213. } else {
  214. if ($tableMain.prop('scrollHeight') + (children.length>0?children[0].height:0) > $tableMain.height()) {
  215. scrollWidth = this.getScrollWidth();
  216. }
  217. tables.push('max-width: '+ ($tableMain.width() - 1 - scrollWidth) +'px">')
  218. }
  219. }
  220. if (child.show !== 3 && (typeof child.childTitle === 'undefined' || child.childTitle)) {
  221. tables.push('<ul class="layui-tab-title">')
  222. for (i=0;i<children.length;i++) {
  223. tables.push('<li class="'+(i===0?'layui-this':'')+'">'+(typeof children[i].title === 'function' ? children[i].title(data) :children[i].title)+'</li>');
  224. }
  225. tables.push('</ul>')
  226. }
  227. if (child.show === 3) {
  228. tables.push('<div class="layui-tab-content" style="padding: 0">');
  229. } else {
  230. tables.push('<div class="layui-tab-content" style="padding: 0 10px">');
  231. }
  232. for (i=0;i<children.length;i++) {
  233. var childTableId = rowTableId + i;
  234. tables.push('<div class="layui-tab-item layui-show"><form action="" class="layui-form" ><table id="'+childTableId+'" lay-filter="'+childTableId+'"></table></form></div>');
  235. }
  236. tables.push('</div></div>');
  237. return tables.join('')
  238. },
  239. /**
  240. * 渲染子表
  241. * @param _this
  242. * @param data 父表当前行数据
  243. * @param child 子表列
  244. * @param myTable 父表配置
  245. * @param children 子表配置
  246. */
  247. renderTable: function (_this, data, child, myTable, children, icon) {
  248. var tables = []
  249. ,_that = this
  250. ,tableId = myTable.id
  251. ,rowTableId = tableId + $(_this).parents('tr:eq(0)').data('index');
  252. if (child.lazy) {
  253. tables.push(renderChildTable(_that, _this, data, child, myTable, 0, children, icon));
  254. } else {
  255. for (var i=0; i<children.length; i++) {
  256. tables.push(renderChildTable(_that, _this, data, child, myTable, i, children, icon));
  257. }
  258. }
  259. tableChildren[rowTableId]=tables;
  260. layui.element.on('tab(table-child-'+rowTableId+')', function(tabData){
  261. if (child.lazy) {
  262. var isRender = false; // 是否已经渲染
  263. for(i=0; i<tableChildren[rowTableId].length; i++) {
  264. if (tableChildren[rowTableId][i].config.id === (rowTableId + tabData.index)) {
  265. isRender = true;
  266. break;
  267. }
  268. }
  269. if (!isRender) {
  270. tableChildren[rowTableId].push(renderChildTable(_that, _this, data, child, myTable, tabData.index, children))
  271. }
  272. }
  273. var rowIndex = $(_this).parents('tr:eq(0)').data('index'),
  274. height = $(tabData.elem).height();
  275. $(_this).parents('.layui-table-box:eq(0)').children('.layui-table-body').children('table').children('tbody').children('tr[data-index=' + rowIndex + ']').next().children().children('.soul-table-child-patch').css('height', height)
  276. $(_this).parents('.layui-table-box:eq(0)').children('.layui-table-fixed').children('.layui-table-body').children('table').children('tbody').children('tr[data-index=' + rowIndex + ']').next().children().children('.soul-table-child-patch').css('height', height)
  277. table.resize(tableId)
  278. });
  279. function renderChildTable(_that, _this, data, child, myTable, i, children, icon) {
  280. var param = _that.deepClone(children[i]), thisTableChild,
  281. tableId = myTable.id,
  282. rowIndex = $(_this).parents('tr:eq(0)').data('index'),
  283. childTableId = tableId + rowIndex + i,
  284. $table = $(myTable.elem),
  285. $tableBox = $table.next().children('.layui-table-box'),
  286. $tableBody = $.merge($tableBox.children('.layui-table-body').children('table'), $tableBox.children('.layui-table-fixed').children('.layui-table-body').children('table')),
  287. tr = $tableBody.children('tbody').children('tr[data-index="'+rowIndex+'"]'),
  288. row = table.cache[tableId][rowIndex],
  289. // 父表当前行对象
  290. pobj = {
  291. data: row,
  292. tr: tr,
  293. del: function() {
  294. table.cache[tableId][rowIndex] = [];
  295. _that.destroyChildren(rowIndex, myTable, icon)
  296. tr.remove();
  297. table.resize(tableId);
  298. },
  299. update: function(fields) {
  300. fields = fields || {};
  301. layui.each(fields, function(key, value){
  302. if(key in row){
  303. var templet, td = tr.children('td[data-field="'+ key +'"]');
  304. row[key] = value;
  305. table.eachCols(tableId, function(i, item2){
  306. if(item2.field == key && item2.templet){
  307. templet = item2.templet;
  308. }
  309. });
  310. td.children('.layui-table-cell').html(function(){
  311. return templet ? function(){
  312. return typeof templet === 'function'
  313. ? templet(row)
  314. : laytpl($(templet).html() || value).render(row)
  315. }() : value;
  316. }());
  317. td.data('content', value);
  318. }
  319. });
  320. },
  321. close: function () {
  322. _that.destroyChildren(rowIndex, myTable, icon)
  323. table.resize(tableId);
  324. }
  325. };
  326. param.id = childTableId;
  327. param.elem = '#'+childTableId;
  328. typeof param.where === 'function' && (param.where = param.where(data));
  329. typeof param.data === 'function' && (param.data = param.data(data));
  330. typeof param.url === 'function' && (param.url = param.url(data));
  331. thisTableChild = table.render(param);
  332. if (!child.lazy && i!==0) {
  333. $('#'+childTableId).parents('.layui-tab-item:eq(0)').removeClass('layui-show'); //解决隐藏时计算表格高度有问题
  334. }
  335. // 绑定 checkbox 事件
  336. if (typeof param.checkboxEvent === 'function') {
  337. table.on('checkbox('+childTableId+')', function (obj) {
  338. param.checkboxEvent(obj, pobj)
  339. })
  340. }
  341. // 绑定 edit 事件
  342. if (typeof param.editEvent === 'function') {
  343. table.on('edit('+childTableId+')', function (obj) {
  344. obj.oldValue = $(this).prev().text();
  345. param.editEvent(obj, pobj)
  346. })
  347. }
  348. // 绑定 tool 事件
  349. if (typeof param.toolEvent === 'function') {
  350. table.on('tool('+childTableId+')', function (obj) {
  351. param.toolEvent(obj, pobj)
  352. })
  353. }
  354. // 绑定 toolbar 事件
  355. if (typeof param.toolbarEvent === 'function') {
  356. table.on('toolbar('+childTableId+')', function (obj) {
  357. param.toolbarEvent(obj, pobj)
  358. })
  359. }
  360. // 绑定单击行事件
  361. if (typeof param.rowEvent === 'function') {
  362. table.on('row('+childTableId+')', function (obj) {
  363. param.rowEvent(obj, pobj)
  364. })
  365. }
  366. // 绑定双击行事件
  367. if (typeof param.rowDoubleEvent === 'function') {
  368. table.on('rowDouble('+childTableId+')', function (obj) {
  369. param.rowDoubleEvent(obj, pobj)
  370. })
  371. }
  372. return thisTableChild;
  373. }
  374. },
  375. destroyChildren: function (rowIndex, myTable, icon) {
  376. var tableId = myTable.id,
  377. $table = $(myTable.elem),
  378. $tableBox = $table.next().children('.layui-table-box'),
  379. $fixedBody = $tableBox.children('.layui-table-fixed').children('.layui-table-body').children('table'),
  380. $tableBody = $.merge($tableBox.children('.layui-table-body').children('table'), $fixedBody),
  381. $tr = $tableBody.children('tbody').children('tr[data-index="'+rowIndex+'"]');
  382. $tr.find('.childTable').removeClass(icon[1]).addClass(icon[0]);
  383. // 暂时不处理 rowspan 情况
  384. // var rowspanIndex = $this.parents('td:eq(0)').attr("rowspan");
  385. // if(rowspanIndex){
  386. // var index=$this.parents('tr:eq(0)').index()+parseInt(rowspanIndex);
  387. // $this.parents('table:eq(0)').children().children('tr:eq('+index+')').remove()
  388. // }else{
  389. // $this.parents('tr:eq(0)').next().remove();
  390. // }
  391. $tr.next().remove()
  392. var tables = tableChildren[tableId + rowIndex];
  393. if (layui.tableFilter) { //如果使用了筛选功能,怎同时清理筛选渲染的数据
  394. layui.tableFilter.destroy(tables);
  395. }
  396. delete tableChildren[tableId + rowIndex]
  397. },
  398. cloneJSON: function (obj) {
  399. var JSON_SERIALIZE_FIX = {
  400. PREFIX : "[[JSON_FUN_PREFIX_",
  401. SUFFIX : "_JSON_FUN_SUFFIX]]"
  402. };
  403. var sobj = JSON.stringify(obj,function(key, value){
  404. if(typeof value === 'function'){
  405. return JSON_SERIALIZE_FIX.PREFIX+value.toString()+JSON_SERIALIZE_FIX.SUFFIX;
  406. }
  407. return value;
  408. });
  409. return JSON.parse(sobj,function(key, value){
  410. if(typeof value === 'string' &&
  411. value.indexOf(JSON_SERIALIZE_FIX.SUFFIX)>0 && value.indexOf(JSON_SERIALIZE_FIX.PREFIX)===0){
  412. return eval("("+value.replace(JSON_SERIALIZE_FIX.PREFIX,"").replace(JSON_SERIALIZE_FIX.SUFFIX,"")+")");
  413. }
  414. return value;
  415. })||{};
  416. },
  417. fixHoverStyle: function(myTable) {
  418. var $table = $(myTable.elem)
  419. ,$tableBody = $table.next().children('.layui-table-box').children('.layui-table-body').children('table')
  420. ,$tableFixed = $table.next().children('.layui-table-box').children('.layui-table-fixed').children('.layui-table-body').children('table')
  421. ,style = $table.next().find('style')[0],
  422. sheet = style.sheet || style.styleSheet || {};
  423. // 屏蔽掉layui原生 hover 样式
  424. this.addCSSRule(sheet, '.layui-table-hover', 'background-color: inherit');
  425. this.addCSSRule(sheet, '.layui-table-hover.soul-table-hover', 'background-color: #F2F2F2');
  426. $.merge($tableFixed.children('tbody').children('tr'), $tableBody.children('tbody').children('tr'))
  427. .on('mouseenter', function () {
  428. var othis = $(this)
  429. ,index = $(this).data('index');
  430. if(othis.data('off')) return;
  431. $tableFixed.children('tbody').children('tr[data-index='+index+']').addClass(ELEM_HOVER);
  432. $tableBody.children('tbody').children('tr[data-index='+index+']').addClass(ELEM_HOVER);
  433. }).on('mouseleave', function () {
  434. var othis = $(this)
  435. ,index = $(this).data('index');
  436. if(othis.data('off')) return;
  437. $tableFixed.children('tbody').children('tr[data-index='+index+']').removeClass(ELEM_HOVER);
  438. $tableBody.children('tbody').children('tr[data-index='+index+']').removeClass(ELEM_HOVER);
  439. })
  440. },
  441. addCSSRule: function(sheet, selector, rules, index) {
  442. if ('insertRule' in sheet) {
  443. sheet.insertRule(selector + '{' + rules + '}', index)
  444. } else if ('addRule' in sheet) {
  445. sheet.addRule(selector, rules, index)
  446. }
  447. },
  448. // 深度克隆-不丢失方法
  449. deepClone: function (obj) {
  450. var newObj = Array.isArray(obj) ? [] : {}
  451. if (obj && typeof obj === "object") {
  452. for (var key in obj) {
  453. if (obj.hasOwnProperty(key)) {
  454. newObj[key] = (obj && typeof obj[key] === 'object') ? this.deepClone(obj[key]) : obj[key];
  455. }
  456. }
  457. }
  458. return newObj
  459. },
  460. getCompleteCols: function (origin) {
  461. var cols = this.deepClone(origin);
  462. var i,j,k, cloneCol;
  463. for (i = 0; i < cols.length; i++) {
  464. for (j = 0; j < cols[i].length; j++) {
  465. if (!cols[i][j].exportHandled) {
  466. if (cols[i][j].rowspan > 1) {
  467. cloneCol = this.deepClone(cols[i][j])
  468. cloneCol.exportHandled = true;
  469. k = i+1;
  470. while (k < cols.length) {
  471. cols[k].splice(j, 0, cloneCol)
  472. k++
  473. }
  474. }
  475. if (cols[i][j].colspan > 1) {
  476. cloneCol = this.deepClone(cols[i][j])
  477. cloneCol.exportHandled = true;
  478. for (k = 1; k < cols[i][j].colspan; k++) {
  479. cols[i].splice(j, 0, cloneCol)
  480. }
  481. j = j + cols[i][j].colspan - 1
  482. }
  483. }
  484. }
  485. }
  486. return cols[cols.length-1];
  487. },
  488. getScrollWidth: function (elem) {
  489. var width = 0;
  490. if(elem){
  491. width = elem.offsetWidth - elem.clientWidth;
  492. } else {
  493. elem = document.createElement('div');
  494. elem.style.width = '100px';
  495. elem.style.height = '100px';
  496. elem.style.overflowY = 'scroll';
  497. document.body.appendChild(elem);
  498. width = elem.offsetWidth - elem.clientWidth;
  499. document.body.removeChild(elem);
  500. }
  501. return width;
  502. }
  503. };
  504. // 输出
  505. exports('tableChild', mod);
  506. });