diff --git a/src/main/webapp/assets/css/view-page.css b/src/main/webapp/assets/css/view-page.css index ed8e674af..8d7643e97 100644 --- a/src/main/webapp/assets/css/view-page.css +++ b/src/main/webapp/assets/css/view-page.css @@ -125,4 +125,10 @@ html, body { } .view-action.empty { margin-top: 4px; +} +.btn.load-mores { + display: inline-block; + min-width: 200px; + line-height: 2.8rem; + border-radius: 99px; } \ No newline at end of file diff --git a/src/main/webapp/assets/js/rb-view.jsx b/src/main/webapp/assets/js/rb-view.jsx index 77a17b4c9..d64e7752a 100644 --- a/src/main/webapp/assets/js/rb-view.jsx +++ b/src/main/webapp/assets/js/rb-view.jsx @@ -143,15 +143,24 @@ const RbViewPage = { }, initVTabs(config) { + let that = this let rs = [] $(config).each(function(){ - $('').appendTo('.nav-tabs') - $('
').appendTo('.tab-content') + let entity = this[0] + $('').appendTo('.nav-tabs') + let rl = $('
').appendTo('.tab-content') rs.push(this[0]) + + let mores = $('
').appendTo(rl) + rl = rl.find('.related-list') + mores.find('.btn').on('click', function(){ + let pno = ~~($(this).attr('data-pno') || 1) + 1 + $(this).attr('data-pno', pno) + that.renderRelatedGrid(rl, entity, pno) + }) }) this.__vtab_es = rs - let that = this $('.nav-tabs li>a').on('click', function(e) { e.preventDefault() let _this = $(this) @@ -193,12 +202,18 @@ const RbViewPage = { renderRelatedGrid(el, related, page) { page = page || 1 - $.get(rb.baseUrl + '/app/entity/related-list?masterId=' + this.__id + '&related=' + related + '&pageNo=' + page, function(res){ + let psize = 20 + $.get(rb.baseUrl + '/app/entity/related-list?masterId=' + this.__id + '&related=' + related + '&pageNo=' + page + '&pageSize=' + psize, function(res){ el.removeClass('rb-loading-active') - $(res.data.data).each(function(){ + let _data = res.data.data + $(_data).each(function(){ let h = '#!/View/' + related + '/' + this[0] $('
' + this[1] + '
' + this[2] + '
').appendTo(el) }) + + let mores = $(el).next('.J_mores') + if (_data.length >= psize) mores.removeClass('hide') + else mores.find('.btn').attr({ disabled: true }).text('已加载全部') }) }, diff --git a/src/main/webapp/general-entity/record-view.jsp b/src/main/webapp/general-entity/record-view.jsp index 8d6d3ed52..8a5208654 100644 --- a/src/main/webapp/general-entity/record-view.jsp +++ b/src/main/webapp/general-entity/record-view.jsp @@ -24,7 +24,7 @@