|
@@ -9,6 +9,7 @@
|
|
|
*/
|
|
|
|
|
|
$(document).ready(() => {
|
|
|
+ let xmjSearch;
|
|
|
autoFlashHeight();
|
|
|
const xmjSpread = SpreadJsObj.createNewSpread($('#xmj-spread')[0]);
|
|
|
const xmjSheet = xmjSpread.getActiveSheet();
|
|
@@ -82,6 +83,87 @@ $(document).ready(() => {
|
|
|
unitSpread.refresh();
|
|
|
}
|
|
|
});
|
|
|
+ $.divResizer({
|
|
|
+ select: '#right-spr',
|
|
|
+ callback: function () {
|
|
|
+ xmjSpread.refresh();
|
|
|
+ unitSpread.refresh();
|
|
|
+ if (xmjSearch) {
|
|
|
+ xmjSearch.spread.refresh();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $('a', '.side-menu').bind('click', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ const tab = $(this), tabPanel = $(tab.attr('content'));
|
|
|
+ const showSideTools = function (show) {
|
|
|
+ const left = $('#left-view'), right = $('#right-view'), parent = left.parent();
|
|
|
+ if (show) {
|
|
|
+ right.show();
|
|
|
+ autoFlashHeight();
|
|
|
+ /**
|
|
|
+ * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
|
|
|
+ * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
|
|
|
+ * 故需要通过最终的parent.width再计算一次left.width
|
|
|
+ *
|
|
|
+ * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
|
|
|
+ * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
|
|
|
+ *
|
|
|
+ */
|
|
|
+ //left.css('width', parent.width() - right.outerWidth());
|
|
|
+ //left.css('width', parent.width() - right.outerWidth());
|
|
|
+ const percent = 100 - right.outerWidth() /parent.width() * 100;
|
|
|
+ left.css('width', percent + '%');
|
|
|
+ } else {
|
|
|
+ left.width(parent.width());
|
|
|
+ right.hide();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ // 展开工具栏、切换标签
|
|
|
+ if (!tab.hasClass('active')) {
|
|
|
+ const close = $('.active', '#side-menu').length === 0;
|
|
|
+ $('a', '#side-menu').removeClass('active');
|
|
|
+ tab.addClass('active');
|
|
|
+ $('.tab-content .tab-pane').removeClass('active');
|
|
|
+ tabPanel.addClass('active');
|
|
|
+ showSideTools(tab.hasClass('active'));
|
|
|
+ if (tab.attr('content') === '#search' && !xmjSearch) {
|
|
|
+ if (!xmjSearch) {
|
|
|
+ xmjSearch = $.billsSearch({
|
|
|
+ selector: '#search',
|
|
|
+ searchSpread: xmjSpread,
|
|
|
+ searchRangeStr: '项目节编号/名称',
|
|
|
+ resultSpreadSetting: {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
|
|
|
+ {title: '名称', field: 'name', width: 150, hAlign: 0, formatter: '@', readOnly: true},
|
|
|
+ {title: '单位', field: 'unit', width: 50, hAlign: 1, formatter: '@', readOnly: true},
|
|
|
+ {title: '台账金额', field: 'total_price', hAlign: 2, width: 80, readOnly: true},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ selectedBackColor: '#fffacd',
|
|
|
+ },
|
|
|
+ afterLocated: function () {
|
|
|
+ unitTreeObj.loadCurUnitData();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ xmjSearch.spread.refresh();
|
|
|
+ }
|
|
|
+ } else { // 收起工具栏
|
|
|
+ tab.removeClass('active');
|
|
|
+ tabPanel.removeClass('active');
|
|
|
+ showSideTools(tab.hasClass('active'));
|
|
|
+ }
|
|
|
+ xmjSpread.refresh();
|
|
|
+ unitSpread.refresh();
|
|
|
+ });
|
|
|
|
|
|
// 显示层次
|
|
|
(function (select, sheet) {
|