|
|
@@ -439,10 +439,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
table.bootstrapTable((stagePick || stageAudit) ? 'showColumn' : 'hideColumn', 'state');
|
|
|
} catch (ignore) {
|
|
|
}
|
|
|
- $('#btn-procuremen-pick-review').toggle(stagePick && procuremenCanDispatch());
|
|
|
- $('#btn-procuremen-pick-delete').toggle(stagePick && procuremenCanPickDelete());
|
|
|
- $('#btn-procuremen-batch-finish').toggle(stagePick && procuremenCanComplete());
|
|
|
- $('#btn-procuremen-audit-abandon').toggle(stageAudit && procuremenCanAuditAbandon());
|
|
|
+ // 用 class 显隐,避免被工具栏 CSS 的 display:!important 盖掉
|
|
|
+ function procuremenToggleStageBtn(sel, show) {
|
|
|
+ var $btn = $(sel);
|
|
|
+ if (!$btn.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $btn.toggleClass('procuremen-stage-hide', !show);
|
|
|
+ $btn.toggleClass('hide', !show);
|
|
|
+ if (show) {
|
|
|
+ $btn.css('display', '');
|
|
|
+ } else {
|
|
|
+ $btn.css('display', 'none');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function procuremenApplyStageButtons() {
|
|
|
+ var pick = Controller.wffTab === 'pick';
|
|
|
+ var audit = Controller.wffTab === 'audit';
|
|
|
+ procuremenToggleStageBtn('#btn-procuremen-pick-review', pick && procuremenCanDispatch());
|
|
|
+ procuremenToggleStageBtn('#btn-procuremen-pick-delete', pick && procuremenCanPickDelete());
|
|
|
+ procuremenToggleStageBtn('#btn-procuremen-batch-finish', pick && procuremenCanComplete());
|
|
|
+ procuremenToggleStageBtn('#btn-procuremen-audit-abandon', audit && procuremenCanAuditAbandon());
|
|
|
+ }
|
|
|
+ procuremenApplyStageButtons();
|
|
|
+ Controller._procuremenApplyStageButtons = procuremenApplyStageButtons;
|
|
|
|
|
|
$(document).off('click.procuremenYm', '.procuremen-ym-item').on('click.procuremenYm', '.procuremen-ym-item', function () {
|
|
|
var ym = $(this).data('ym');
|
|
|
@@ -466,46 +486,105 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
if (!$host.length || !$bt.length) {
|
|
|
return;
|
|
|
}
|
|
|
- var $ft = $bt.children('.fixed-table-toolbar').first();
|
|
|
- if (!$ft.length) {
|
|
|
- $ft = $host.find('.fixed-table-toolbar').first();
|
|
|
- }
|
|
|
- if (!$ft.length) {
|
|
|
+ $host.show().css({
|
|
|
+ display: 'block',
|
|
|
+ height: '',
|
|
|
+ minHeight: '',
|
|
|
+ padding: '',
|
|
|
+ border: '',
|
|
|
+ overflow: 'visible'
|
|
|
+ });
|
|
|
+
|
|
|
+ var $hostFt = $host.children('.fixed-table-toolbar').first();
|
|
|
+ var $btFt = $bt.children('.fixed-table-toolbar').first();
|
|
|
+
|
|
|
+ // 宿主已有完整工具栏:保留,隐藏表格内重复生成的空壳
|
|
|
+ var hostOk = $hostFt.length && $hostFt.find('.btn-refresh, .toolbar .btn, .bs-bars .btn').length > 0;
|
|
|
+ if (hostOk) {
|
|
|
+ if ($btFt.length) {
|
|
|
+ $btFt.hide().attr('data-procuremen-toolbar-dup', '1');
|
|
|
+ }
|
|
|
+ // 每次都校正右侧顺序,保证贴右且图标顺序与图二一致
|
|
|
+ procuremenNormalizeToolbarRight($hostFt);
|
|
|
+ procuremenBindToolbarDropdownFix();
|
|
|
+ if (typeof Controller._procuremenApplyStageButtons === 'function') {
|
|
|
+ Controller._procuremenApplyStageButtons();
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
- if ($ft.parent()[0] === $host[0] && $ft.find('.procuremen-toolbar-search-wrap').length) {
|
|
|
+
|
|
|
+ // 把表格内工具栏挪到宿主(脱离 overflow:hidden,避免上半截被裁切)
|
|
|
+ var $ft = $btFt.length ? $btFt : $hostFt;
|
|
|
+ if (!$ft.length) {
|
|
|
return;
|
|
|
}
|
|
|
if ($ft.parent()[0] !== $host[0]) {
|
|
|
- $host.children('.fixed-table-toolbar').remove();
|
|
|
- $host.append($ft);
|
|
|
+ $host.children('.fixed-table-toolbar').each(function () {
|
|
|
+ var $old = $(this);
|
|
|
+ if (!$old.find('.btn-refresh, .toolbar .btn, .search').length) {
|
|
|
+ $old.remove();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $host.append($ft.show().removeAttr('data-procuremen-toolbar-dup'));
|
|
|
var $src = $bt.closest('.procuremen-table-area').find('#toolbar').first();
|
|
|
if ($src.length && !$src.children().length) {
|
|
|
$src.addClass('procuremen-toolbar-empty');
|
|
|
}
|
|
|
}
|
|
|
- $ft.find('.procuremen-toolbar-search-wrap').removeClass('procuremen-toolbar-search-wrap');
|
|
|
+ procuremenNormalizeToolbarRight($ft);
|
|
|
+ procuremenBindToolbarDropdownFix();
|
|
|
+ if (typeof Controller._procuremenApplyStageButtons === 'function') {
|
|
|
+ Controller._procuremenApplyStageButtons();
|
|
|
+ }
|
|
|
+ // 工具栏移出后重算表高,避免占位错乱
|
|
|
+ setTimeout(function () {
|
|
|
+ procuremenTableHeightCached = 0;
|
|
|
+ procuremenSyncTableHeight();
|
|
|
+ if (typeof Controller._procuremenApplyStageButtons === 'function') {
|
|
|
+ Controller._procuremenApplyStageButtons();
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ function procuremenNormalizeToolbarRight($ft) {
|
|
|
+ if (!$ft || !$ft.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
var $search = $ft.find('.search').first();
|
|
|
if (!$search.length) {
|
|
|
return;
|
|
|
}
|
|
|
- var $right = $search.closest('.columns, .pull-right').first();
|
|
|
- if (!$right.length || ($ft[0] && !$.contains($ft[0], $right[0]))) {
|
|
|
- return;
|
|
|
+ // 专用右侧容器:不能把 .search 自身当 wrap(.search 的 display 会盖掉 flex,导致搜索与图标折成两行)
|
|
|
+ var $right = $ft.children('.procuremen-toolbar-search-wrap').first();
|
|
|
+ if (!$right.length) {
|
|
|
+ $right = $('<div class="columns columns-right pull-right procuremen-toolbar-search-wrap"></div>');
|
|
|
+ $ft.append($right);
|
|
|
+ } else {
|
|
|
+ $right.addClass('columns columns-right pull-right procuremen-toolbar-search-wrap');
|
|
|
}
|
|
|
+ // 若历史上把图标塞进了 .search 里,先拆出来
|
|
|
+ if ($search.hasClass('procuremen-toolbar-search-wrap')) {
|
|
|
+ $search.removeClass('procuremen-toolbar-search-wrap columns columns-right');
|
|
|
+ }
|
|
|
+ $search.children().not('input, .form-control').appendTo($right);
|
|
|
+ $search.appendTo($right);
|
|
|
+
|
|
|
$ft.children().each(function () {
|
|
|
var $c = $(this);
|
|
|
- if ($c.is('.bars, .bs-bars') || $c[0] === $right[0]) {
|
|
|
+ if ($c.is('.bars, .bs-bars') || $c[0] === $right[0] || $c.hasClass('search')) {
|
|
|
return;
|
|
|
}
|
|
|
var mergeToolbarExtras = $c.hasClass('columns')
|
|
|
|| $c.hasClass('pull-right')
|
|
|
- || ($c.hasClass('btn-group') && $c.find('.search').length === 0);
|
|
|
- if (!mergeToolbarExtras || $c.find('.search').length) {
|
|
|
+ || ($c.hasClass('btn-group') && $c.find('.search').length === 0)
|
|
|
+ || $c.is('button[name="commonSearch"], button[name="toggle"]');
|
|
|
+ if (!mergeToolbarExtras) {
|
|
|
return;
|
|
|
}
|
|
|
if ($c.hasClass('btn-group') && !$c.hasClass('columns')) {
|
|
|
$c.appendTo($right);
|
|
|
+ } else if ($c.is('button')) {
|
|
|
+ $c.appendTo($right);
|
|
|
} else {
|
|
|
$c.children().appendTo($right);
|
|
|
if (!$c.children().length) {
|
|
|
@@ -513,12 +592,83 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- $ft.find('.search').first().prependTo($right);
|
|
|
+ // 顺序:搜索框 → 切换 → 列显隐 → 导出 → 通用搜索(放大镜)
|
|
|
$right.addClass('procuremen-toolbar-search-wrap');
|
|
|
+ var $toggle = $right.find('button[name="toggle"]').first();
|
|
|
+ var $columns = $right.find('.keep-open').first();
|
|
|
+ var $export = $right.find('.export').first();
|
|
|
+ var $common = $right.find('button[name="commonSearch"]').first();
|
|
|
+ $search = $right.find('.search').first();
|
|
|
+ if ($search.length) {
|
|
|
+ $search.prependTo($right);
|
|
|
+ }
|
|
|
+ if ($toggle.length) {
|
|
|
+ $toggle.insertAfter($search);
|
|
|
+ }
|
|
|
+ if ($columns.length) {
|
|
|
+ $columns.insertAfter($toggle.length ? $toggle : $search);
|
|
|
+ }
|
|
|
+ if ($export.length) {
|
|
|
+ var $afterCols = $columns.length ? $columns : ($toggle.length ? $toggle : $search);
|
|
|
+ $export.insertAfter($afterCols);
|
|
|
+ }
|
|
|
+ if ($common.length) {
|
|
|
+ $common.appendTo($right);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 列显隐下拉用 fixed,避免被表格区域 overflow 裁切 */
|
|
|
+ function procuremenBindToolbarDropdownFix() {
|
|
|
+ var $host = $('#procuremen-toolbar-host');
|
|
|
+ if (!$host.length || $host.data('dropdownFixBound')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $host.data('dropdownFixBound', 1);
|
|
|
+ $host.on('show.bs.dropdown shown.bs.dropdown', '.btn-group', function () {
|
|
|
+ var $btnGroup = $(this);
|
|
|
+ var $menu = $btnGroup.children('.dropdown-menu').first();
|
|
|
+ if (!$menu.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var place = function () {
|
|
|
+ var btnTop = $btnGroup.offset().top;
|
|
|
+ var btnHeight = $btnGroup.outerHeight();
|
|
|
+ var scrollTop = $(window).scrollTop();
|
|
|
+ var winH = $(window).height();
|
|
|
+ var menuH = $menu.outerHeight() || 280;
|
|
|
+ var maxH = Math.max(220, Math.min(520, winH - 24));
|
|
|
+ var top = btnTop - scrollTop + btnHeight;
|
|
|
+ if (top + Math.min(menuH, maxH) > winH - 8) {
|
|
|
+ var up = btnTop - scrollTop - Math.min(menuH, maxH) - 4;
|
|
|
+ if (up >= 8) {
|
|
|
+ top = up;
|
|
|
+ maxH = Math.min(maxH, Math.max(180, btnTop - scrollTop - 12));
|
|
|
+ } else {
|
|
|
+ maxH = Math.max(180, winH - top - 12);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var left = $btnGroup.offset().left + $btnGroup.outerWidth() - ($menu.outerWidth() || 180);
|
|
|
+ left = Math.max(8, Math.min(left, $(window).width() - ($menu.outerWidth() || 180) - 8));
|
|
|
+ $menu.css({
|
|
|
+ position: 'fixed',
|
|
|
+ top: top,
|
|
|
+ left: left,
|
|
|
+ right: 'auto',
|
|
|
+ bottom: 'auto',
|
|
|
+ maxHeight: maxH + 'px',
|
|
|
+ overflowY: 'auto',
|
|
|
+ overflowX: 'hidden',
|
|
|
+ zIndex: 2000
|
|
|
+ });
|
|
|
+ };
|
|
|
+ place();
|
|
|
+ setTimeout(place, 0);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
table.on('post-header.bs.table', function () {
|
|
|
procuremenPlaceToolbar();
|
|
|
+ procuremenScheduleAlign();
|
|
|
});
|
|
|
|
|
|
var indexInitWffTab = Controller.wffTab;
|
|
|
@@ -632,15 +782,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
// }
|
|
|
// },
|
|
|
{field: 'CCYDH', title: __('订单号'), operate: 'LIKE', table: 'b', width: 108, align: 'center', sortable: true, class: 'procuremen-th-sort-tight'},
|
|
|
- {field: 'CYJMC', title: __('印件名称'), operate: 'LIKE', table: 'b', width: 270, align: 'left'},
|
|
|
- {field: 'CCLBMMC', title: '承揽部门', operate: 'LIKE', table: 'b', width: 100, align: 'center'},
|
|
|
- {field: 'CGYMC', title: __('工序名称'), operate: 'LIKE', table: 'a', width: 140, align: 'left',
|
|
|
+ {field: 'CYJMC', title: __('印件名称'), operate: 'LIKE', table: 'b', width: 270, align: 'left', class: 'procuremen-cell-wrap',
|
|
|
+ formatter: function (v) {
|
|
|
+ if (v == null || v === '') {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ return '<span title="' + procuremenEscAttr(v) + '">' + procuremenEscHtml(v) + '</span>';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {field: 'CCLBMMC', title: '承揽部门', operate: 'LIKE', table: 'b', width: 140, align: 'center', class: 'procuremen-cell-wrap'},
|
|
|
+ {field: 'CGYMC', title: __('工序名称'), operate: 'LIKE', table: 'a', width: 140, align: 'left', class: 'procuremen-cell-wrap',
|
|
|
formatter: function (v) {
|
|
|
return v != null && v !== '' ? String(v) : '';
|
|
|
}
|
|
|
},
|
|
|
- {field: 'CDW', title: __('单位'), operate: 'LIKE', table: 'a', width: 50, align: 'center'},
|
|
|
- {field: 'NGZL', title: __('工作量'), operate: 'LIKE', table: 'a', width: 80, align: 'center',
|
|
|
+ {field: 'CDW', title: __('单位'), operate: 'LIKE', table: 'a', width: 88, align: 'center'},
|
|
|
+ {field: 'NGZL', title: __('工作量'), operate: 'LIKE', table: 'a', width: 88, align: 'center',
|
|
|
formatter: function (v) {
|
|
|
if (v == null || v === '') {
|
|
|
return '';
|
|
|
@@ -721,13 +878,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return procuremenSupplierCntText(v);
|
|
|
}
|
|
|
},
|
|
|
- {field: 'CDF', title: __('订法'), operate: 'LIKE', table: 'a', width: 100, align: 'center'},
|
|
|
- {field: 'cGzzxMc', title: __('外厂单位'), operate: 'LIKE', table: 'a', width: 220, align: 'center'},
|
|
|
- {field: 'MBZ', title: __('备注'), operate: 'LIKE', table: 'a', width: 150, align: 'center'},
|
|
|
+ {field: 'CDF', title: __('订法'), operate: 'LIKE', table: 'a', width: 100, align: 'center', class: 'procuremen-cell-wrap'},
|
|
|
+ {field: 'cGzzxMc', title: __('外厂单位'), operate: 'LIKE', table: 'a', width: 220, align: 'center', class: 'procuremen-cell-wrap'},
|
|
|
+ {field: 'MBZ', title: __('备注'), operate: 'LIKE', table: 'a', width: 150, align: 'center', class: 'procuremen-cell-wrap'},
|
|
|
{field: 'cywyxm', title: __('业务员'), operate: 'LIKE', table: 'b', width: 80, align: 'center'},
|
|
|
{field: 'dStamp', title: __('操作日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'a', width: 176, align: 'center', sortable: true, class: 'procuremen-th-sort-tight'},
|
|
|
{field: 'dputrecord', title: __('提交日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'b', width: 176, align: 'center', sortable: true, class: 'procuremen-th-sort-tight'},
|
|
|
- {field: 'operate',title: '操作',width: 220,align: 'center',fixed: 'right', operate: false,
|
|
|
+ {field: 'operate',title: '操作',width: 240,align: 'center',fixed: 'right', operate: false,
|
|
|
visible: indexInitWffTab !== 'pick',
|
|
|
table: table,
|
|
|
formatter: function (value, row, index) {
|
|
|
@@ -785,16 +942,200 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
procuremenHeightSyncTimer = null;
|
|
|
var h = procuremenCalcTableHeight();
|
|
|
if (procuremenTableHeightCached > 0 && Math.abs(procuremenTableHeightCached - h) <= 3) {
|
|
|
+ procuremenScheduleAlign();
|
|
|
return;
|
|
|
}
|
|
|
procuremenTableHeightCached = h;
|
|
|
try {
|
|
|
table.bootstrapTable('resetView', {height: h});
|
|
|
+ procuremenScheduleAlign();
|
|
|
} catch (ignore) {
|
|
|
}
|
|
|
}, 100);
|
|
|
}
|
|
|
|
|
|
+ /** 按列配置生成统一宽度,表头/表体共用,杜绝内容撑开导致竖线错位 */
|
|
|
+ function procuremenGetVisibleColWidths() {
|
|
|
+ var widths = [];
|
|
|
+ try {
|
|
|
+ var opts = table.bootstrapTable('getOptions') || {};
|
|
|
+ var cols = (opts.columns && opts.columns[0]) ? opts.columns[0] : indexTableColumns;
|
|
|
+ $.each(cols, function (_, col) {
|
|
|
+ if (!col || col.visible === false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var w = parseInt(col.width, 10);
|
|
|
+ if (!w || isNaN(w)) {
|
|
|
+ w = col.checkbox ? 42 : 120;
|
|
|
+ }
|
|
|
+ widths.push(w);
|
|
|
+ });
|
|
|
+ } catch (ignore) {
|
|
|
+ }
|
|
|
+ return widths;
|
|
|
+ }
|
|
|
+
|
|
|
+ function procuremenApplyColgroup($tbl, widths) {
|
|
|
+ if (!$tbl || !$tbl.length || !widths.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var total = 0;
|
|
|
+ var i;
|
|
|
+ for (i = 0; i < widths.length; i++) {
|
|
|
+ total += widths[i];
|
|
|
+ }
|
|
|
+ $tbl.css({
|
|
|
+ tableLayout: 'fixed',
|
|
|
+ width: total + 'px',
|
|
|
+ minWidth: total + 'px'
|
|
|
+ });
|
|
|
+ var $cg = $tbl.children('colgroup');
|
|
|
+ if (!$cg.length) {
|
|
|
+ $cg = $('<colgroup/>').prependTo($tbl);
|
|
|
+ }
|
|
|
+ $cg.empty();
|
|
|
+ for (i = 0; i < widths.length; i++) {
|
|
|
+ $cg.append($('<col/>').attr('style', 'width:' + widths[i] + 'px;min-width:' + widths[i] + 'px;'));
|
|
|
+ }
|
|
|
+ $tbl.find('thead tr:first > th').each(function (idx) {
|
|
|
+ if (idx >= widths.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var w = widths[idx];
|
|
|
+ var $th = $(this);
|
|
|
+ $th.css({width: w + 'px', minWidth: w + 'px', maxWidth: w + 'px'});
|
|
|
+ $th.find('.fht-cell').css({width: w + 'px', minWidth: w + 'px', maxWidth: w + 'px'});
|
|
|
+ });
|
|
|
+ // 只锁首行即可带动 fixed 布局;避免给每一行都写 style 太重
|
|
|
+ $tbl.find('tbody tr:first-child:not(.no-records-found) > *').each(function (idx) {
|
|
|
+ if (idx >= widths.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var w = widths[idx];
|
|
|
+ $(this).css({width: w + 'px', minWidth: w + 'px', maxWidth: w + 'px'});
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 表头/表体列线对齐:统一 colgroup 宽度,不再用内容实测宽(内容会把表体撑偏) */
|
|
|
+ function procuremenSyncHeaderBodyAlign() {
|
|
|
+ if ($('body').hasClass('fa-sidebar-resizing')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var $bt = table.closest('.bootstrap-table');
|
|
|
+ if (!$bt.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var $headerWrap = $bt.find('> .fixed-table-container > .fixed-table-header').first();
|
|
|
+ if (!$headerWrap.length) {
|
|
|
+ $headerWrap = $bt.find('.fixed-table-header').not('.fixed-columns-right .fixed-table-header').first();
|
|
|
+ }
|
|
|
+ var $bodyWrap = $bt.find('> .fixed-table-container > .fixed-table-body').first();
|
|
|
+ if (!$bodyWrap.length) {
|
|
|
+ $bodyWrap = $bt.find('.fixed-table-body').not('.fixed-columns-right .fixed-table-body, .fixed-columns .fixed-table-body').first();
|
|
|
+ }
|
|
|
+ if (!$headerWrap.length || !$bodyWrap.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var $headerTable = $headerWrap.children('table').first();
|
|
|
+ var $bodyTable = $bodyWrap.children('table').first();
|
|
|
+ if (!$headerTable.length || !$bodyTable.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var widths = procuremenGetVisibleColWidths();
|
|
|
+ if (!widths.length) {
|
|
|
+ // 兜底:按当前表头列数均分不可靠,改为按现有 th 数量取配置默认
|
|
|
+ var n = $headerTable.find('thead tr:first > th').length;
|
|
|
+ for (var k = 0; k < n; k++) {
|
|
|
+ widths.push(120);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 列数不一致时以较少者为准,避免错位
|
|
|
+ var headCount = $headerTable.find('thead tr:first > th').length;
|
|
|
+ var bodyCount = $bodyTable.find('tbody tr:first-child:not(.no-records-found) > *').length;
|
|
|
+ if (!bodyCount) {
|
|
|
+ bodyCount = $bodyTable.find('thead tr:first > th').length;
|
|
|
+ }
|
|
|
+ var colCount = Math.min(widths.length, headCount || widths.length, bodyCount || widths.length);
|
|
|
+ if (colCount > 0 && colCount < widths.length) {
|
|
|
+ widths = widths.slice(0, colCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ $headerWrap.css('padding-right', '');
|
|
|
+ var bodyEl = $bodyWrap[0];
|
|
|
+ var sb = Math.max(0, bodyEl.offsetWidth - bodyEl.clientWidth);
|
|
|
+ $headerWrap.css('margin-right', sb > 0 ? sb + 'px' : '');
|
|
|
+
|
|
|
+ procuremenApplyColgroup($headerTable, widths);
|
|
|
+ procuremenApplyColgroup($bodyTable, widths);
|
|
|
+
|
|
|
+ // 主表横向滚动与表头同步;避免异常 scrollLeft 把左侧复选框/订单号滚出可视区
|
|
|
+ var sl = $bodyWrap.scrollLeft() || 0;
|
|
|
+ if (sl < 0) {
|
|
|
+ sl = 0;
|
|
|
+ $bodyWrap.scrollLeft(0);
|
|
|
+ }
|
|
|
+ $headerWrap.scrollLeft(sl);
|
|
|
+
|
|
|
+ // 右侧固定操作列:插件克隆整表再 scrollLeft 到最右;切勿 scrollLeft(0) 或把 table 压成 240px
|
|
|
+ var $fixedRight = $bt.find('.fixed-columns-right');
|
|
|
+ if ($fixedRight.length) {
|
|
|
+ var $fh = $fixedRight.find('.fixed-table-header').first();
|
|
|
+ var $fb = $fixedRight.find('.fixed-table-body').first();
|
|
|
+ var $fTable = $fh.find('table').first();
|
|
|
+ if (!$fTable.length) {
|
|
|
+ $fTable = $fb.find('table').first();
|
|
|
+ }
|
|
|
+ // 清掉历史错误内联样式,恢复整表宽度
|
|
|
+ $fixedRight.find('table').each(function () {
|
|
|
+ $(this).css({width: '', minWidth: '', maxWidth: '', tableLayout: ''});
|
|
|
+ });
|
|
|
+ $fixedRight.find('thead th, tbody td').css({
|
|
|
+ width: '',
|
|
|
+ minWidth: '',
|
|
|
+ maxWidth: '',
|
|
|
+ overflow: '',
|
|
|
+ whiteSpace: ''
|
|
|
+ });
|
|
|
+ $fixedRight.find('colgroup').remove();
|
|
|
+
|
|
|
+ var opW = 240;
|
|
|
+ var $opCell = $bt.find('.fixed-table-body table thead th[data-field="operate"]').first();
|
|
|
+ if (!$opCell.length) {
|
|
|
+ $opCell = $headerTable.find('th[data-field="operate"]').first();
|
|
|
+ }
|
|
|
+ if ($opCell.length) {
|
|
|
+ var measured = $opCell.outerWidth();
|
|
|
+ if (measured > 0) {
|
|
|
+ opW = Math.max(measured, 240);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $fixedRight.css({
|
|
|
+ width: opW + 'px',
|
|
|
+ minWidth: opW + 'px',
|
|
|
+ maxWidth: opW + 'px',
|
|
|
+ display: 'block',
|
|
|
+ visibility: 'visible',
|
|
|
+ overflow: 'hidden'
|
|
|
+ });
|
|
|
+
|
|
|
+ var fullW = $fTable.outerWidth() || $fTable.width() || 0;
|
|
|
+ if (fullW > 0) {
|
|
|
+ $fh.scrollLeft(fullW);
|
|
|
+ $fb.scrollLeft(fullW);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function procuremenScheduleAlign() {
|
|
|
+ if ($('body').hasClass('fa-sidebar-resizing')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ setTimeout(procuremenSyncHeaderBodyAlign, 0);
|
|
|
+ setTimeout(procuremenSyncHeaderBodyAlign, 80);
|
|
|
+ }
|
|
|
+
|
|
|
var procuremenInitTableHeight = procuremenCalcTableHeight();
|
|
|
|
|
|
table.bootstrapTable({
|
|
|
@@ -809,9 +1150,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
clickToSelect: false,
|
|
|
dblClickToEdit: false,
|
|
|
dragCheckboxMultiselect: false,
|
|
|
+ maintainSelected: false,
|
|
|
commonSearch: true,
|
|
|
- showToggle: false,
|
|
|
- showExport: false,
|
|
|
+ showToggle: true,
|
|
|
+ showColumns: true,
|
|
|
+ showExport: true,
|
|
|
+ search: true,
|
|
|
smartDisplay: false,
|
|
|
responseHandler: function (res) {
|
|
|
if (res && res.activeYm && (Controller.wffTab === 'audit' || Controller.wffTab === 'confirm')) {
|
|
|
@@ -832,6 +1176,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
});
|
|
|
|
|
|
Table.api.bindevent(table);
|
|
|
+ // 本页不需要「跨页选择模式」提示
|
|
|
+ table.closest('.bootstrap-table').find('.btn-selected-tips').remove();
|
|
|
+ $('#procuremen-toolbar-host .btn-selected-tips, #toolbar .btn-selected-tips').remove();
|
|
|
+ table.on('post-body.bs.table post-header.bs.table', function () {
|
|
|
+ $('#procuremen-toolbar-host .btn-selected-tips, .bootstrap-table .btn-selected-tips, #toolbar .btn-selected-tips').remove();
|
|
|
+ });
|
|
|
|
|
|
table.off('mouseenter.procuremenSupplierLines mouseleave.procuremenSupplierLines', '.procuremen-supplier-lines-cell')
|
|
|
.on('mouseenter.procuremenSupplierLines', '.procuremen-supplier-lines-cell', function () {
|
|
|
@@ -906,9 +1256,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
setTimeout(procuremenSyncTableHeight, 150);
|
|
|
});
|
|
|
$(window).off('resize.procuremenIndex').on('resize.procuremenIndex', function () {
|
|
|
+ if ($('body').hasClass('fa-sidebar-resizing')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
procuremenTableHeightCached = 0;
|
|
|
procuremenSyncTableHeight();
|
|
|
});
|
|
|
+ $(document).off('fa.sidebar.resized.procuremenIndex fa.table.relayout.procuremenIndex')
|
|
|
+ .on('fa.sidebar.resized.procuremenIndex fa.table.relayout.procuremenIndex', function () {
|
|
|
+ if ($('body').hasClass('fa-sidebar-resizing')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ procuremenTableHeightCached = 0;
|
|
|
+ var $bt = table.closest('.bootstrap-table');
|
|
|
+ $bt.find('.fixed-table-header').css({paddingRight: '', marginRight: ''});
|
|
|
+ $bt.find('.fixed-table-header thead th').css({width: '', minWidth: '', maxWidth: ''});
|
|
|
+ try {
|
|
|
+ table.bootstrapTable('resetView', {height: procuremenCalcTableHeight()});
|
|
|
+ } catch (ignore) {
|
|
|
+ }
|
|
|
+ procuremenScheduleAlign();
|
|
|
+ });
|
|
|
|
|
|
function procuremenEscHtml(s) {
|
|
|
return String(s == null ? '' : s)
|
|
|
@@ -1232,9 +1600,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
if (!v) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (v.q === '' && v.p === '') {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ // 允许清空:只要与库中原值不同即视为已修改(两个都删空也能保存)
|
|
|
return v.q !== v.origQ || v.p !== v.origP;
|
|
|
}
|
|
|
function procuremenEnsurePoPopover() {
|
|
|
@@ -1308,6 +1674,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
if (isNaN(rowIdx)) {
|
|
|
return;
|
|
|
}
|
|
|
+ // 切到另一行时,上一行有未保存修改则先自动保存
|
|
|
+ if (procuremenPoActiveRow !== null && procuremenPoActiveRow !== rowIdx
|
|
|
+ && procuremenPoRowDirty(procuremenPoActiveRow)) {
|
|
|
+ procuremenSavePoRow(procuremenPoActiveRow);
|
|
|
+ }
|
|
|
var v = procuremenPoRowValues(rowIdx);
|
|
|
if (!v) {
|
|
|
return;
|
|
|
@@ -1326,7 +1697,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return;
|
|
|
}
|
|
|
if (!procuremenPoRowDirty(rowIdx)) {
|
|
|
- Toastr.info('请先填写并修改本次数量或最高限价');
|
|
|
+ Toastr.info('没有需要保存的修改');
|
|
|
return;
|
|
|
}
|
|
|
var row = $.extend({}, v.baseRow);
|
|
|
@@ -1396,6 +1767,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
if ($t.closest('.procuremen-po-field, .procuremen-po-popover').length) {
|
|
|
return;
|
|
|
}
|
|
|
+ // 点到别处时:有未保存修改则自动保存(避免删空后忘点保存)
|
|
|
+ var rowIdx = procuremenPoActiveRow;
|
|
|
+ if (rowIdx !== null && procuremenPoRowDirty(rowIdx)) {
|
|
|
+ procuremenSavePoRow(rowIdx);
|
|
|
+ return;
|
|
|
+ }
|
|
|
procuremenPoPopoverHide();
|
|
|
});
|
|
|
table.on('refresh.bs.table load-success.bs.table', function () {
|
|
|
@@ -1538,9 +1915,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
tableRoot.addEventListener('click', Controller._procuremenOpTableClick, true);
|
|
|
}
|
|
|
|
|
|
- $layout.find('.procuremen-main').off('click.procuremenTbRefresh').on('click.procuremenTbRefresh', '#procuremen-toolbar-host .btn-refresh, .procuremen-table-area #toolbar .btn-refresh', function (e) {
|
|
|
+ $layout.find('.procuremen-main').off('click.procuremenTbRefresh').on('click.procuremenTbRefresh', '.bootstrap-table > .fixed-table-toolbar .btn-refresh, #procuremen-toolbar-host .btn-refresh, .procuremen-table-area #toolbar .btn-refresh', function (e) {
|
|
|
e.preventDefault();
|
|
|
- var $spinFa = $('#procuremen-toolbar-host .btn-refresh .fa, .procuremen-table-area #toolbar .btn-refresh .fa');
|
|
|
+ var $spinFa = $('.bootstrap-table > .fixed-table-toolbar .btn-refresh .fa, #procuremen-toolbar-host .btn-refresh .fa, .procuremen-table-area #toolbar .btn-refresh .fa');
|
|
|
$spinFa.addClass('fa-spin');
|
|
|
var apiBase = ($layout.attr('data-procuremen-redis-api') || '').toString().trim();
|
|
|
if (apiBase) {
|
|
|
@@ -1570,7 +1947,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}, 0);
|
|
|
});
|
|
|
table.on('post-body.bs.table', function () {
|
|
|
- $('#procuremen-toolbar-host .btn-refresh .fa').removeClass('fa-spin');
|
|
|
+ $('#procuremen-toolbar-host .btn-refresh .fa, .bootstrap-table > .fixed-table-toolbar .btn-refresh .fa').removeClass('fa-spin');
|
|
|
+ procuremenScheduleAlign();
|
|
|
if (Controller.wffTab !== 'pick' && Controller.wffTab !== 'audit') {
|
|
|
return;
|
|
|
}
|
|
|
@@ -1587,6 +1965,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ table.on('column-switch.bs.table reset-view.bs.table', function () {
|
|
|
+ procuremenScheduleAlign();
|
|
|
+ });
|
|
|
if ($bt.length) {
|
|
|
$bt.off('click.procuremenCbTd', 'tbody td.bs-checkbox').on('click.procuremenCbTd', 'tbody td.bs-checkbox', function (e) {
|
|
|
if ((Controller.wffTab !== 'pick' && Controller.wffTab !== 'audit') || $(e.target).is('input[type="checkbox"]')) {
|
|
|
@@ -1643,6 +2024,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
rfqHeightTimer = null;
|
|
|
var h = rfqCalcTableHeight();
|
|
|
if (rfqHeightCached > 0 && Math.abs(rfqHeightCached - h) <= 3) {
|
|
|
+ rfqFitEmptyState();
|
|
|
return;
|
|
|
}
|
|
|
rfqHeightCached = h;
|
|
|
@@ -1650,9 +2032,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
table.bootstrapTable('resetView', {height: h});
|
|
|
} catch (ignore) {
|
|
|
}
|
|
|
+ rfqFitEmptyState();
|
|
|
}, 100);
|
|
|
}
|
|
|
|
|
|
+ /** 无数据时占满表体高度,文案垂直居中到底部区域 */
|
|
|
+ function rfqFitEmptyState() {
|
|
|
+ var $bt = table.closest('.bootstrap-table');
|
|
|
+ var $body = $bt.find('.fixed-table-body').first();
|
|
|
+ var $tr = $body.find('tr.no-records-found');
|
|
|
+ if (!$tr.length || !$body.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var h = Math.max(160, Math.floor($body.innerHeight() || 0) - 4);
|
|
|
+ $tr.find('> td').css({
|
|
|
+ height: h + 'px',
|
|
|
+ verticalAlign: 'middle',
|
|
|
+ textAlign: 'center',
|
|
|
+ color: '#8c8c8c',
|
|
|
+ fontSize: '14px',
|
|
|
+ border: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
var columns = [
|
|
|
{field: 'CCYDH', title: '订单号', operate: 'LIKE', width: 120},
|
|
|
{field: 'CYJMC', title: '印件名称', operate: 'LIKE', class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
@@ -1736,20 +2138,38 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
pageSize: Config.pagesize || localStorage.getItem('pagesize') || 20,
|
|
|
pageList: [10, 15, 20, 25, 50],
|
|
|
showJumpto: true,
|
|
|
+ formatNoMatches: function () {
|
|
|
+ return '暂无数据';
|
|
|
+ },
|
|
|
columns: [columns]
|
|
|
});
|
|
|
|
|
|
Table.api.bindevent(table);
|
|
|
|
|
|
- table.on('load-success.bs.table', function () {
|
|
|
+ table.on('post-body.bs.table load-success.bs.table', function () {
|
|
|
rfqSyncTableHeight();
|
|
|
+ setTimeout(rfqFitEmptyState, 0);
|
|
|
});
|
|
|
$(window).off('resize.procuremenRfqlist').on('resize.procuremenRfqlist', function () {
|
|
|
+ if ($('body').hasClass('fa-sidebar-resizing')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
rfqHeightCached = 0;
|
|
|
rfqSyncTableHeight();
|
|
|
});
|
|
|
+ $(document).off('fa.sidebar.resized.procuremenRfq fa.table.relayout.procuremenRfq')
|
|
|
+ .on('fa.sidebar.resized.procuremenRfq fa.table.relayout.procuremenRfq', function () {
|
|
|
+ if ($('body').hasClass('fa-sidebar-resizing')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ rfqHeightCached = 0;
|
|
|
+ rfqSyncTableHeight();
|
|
|
+ });
|
|
|
$(document).off('click.procuremenRfqCommonSearch', 'button[name="commonSearch"]').on('click.procuremenRfqCommonSearch', 'button[name="commonSearch"]', function () {
|
|
|
- setTimeout(rfqSyncTableHeight, 150);
|
|
|
+ setTimeout(function () {
|
|
|
+ rfqSyncTableHeight();
|
|
|
+ rfqFitEmptyState();
|
|
|
+ }, 150);
|
|
|
});
|
|
|
|
|
|
$(document).off('click.procuremenRfqDetails', '.btn-rfq-details').on('click.procuremenRfqDetails', '.btn-rfq-details', function (e) {
|
|
|
@@ -3432,7 +3852,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
[
|
|
|
$.extend({field: 'id', title: __('Id'), width: 60, operate: false}, colCenter),
|
|
|
$.extend({field: 'ccydh', title: '订单号', operate: 'LIKE'}, colCenter),
|
|
|
- $.extend({field: 'send_time', title: '发送时间', operate: 'RANGE', addclass: 'datetimerange', sortable: true}, colCenter),
|
|
|
$.extend({field: 'from_email', title: '发件邮箱', operate: 'LIKE', formatter: function (v, row) {
|
|
|
return row.from_email_masked || v || '';
|
|
|
}}, colCenter),
|
|
|
@@ -3451,6 +3870,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
: '<span class="text-danger">' + t + '</span>';
|
|
|
}}, colCenter),
|
|
|
$.extend({field: 'admin_name', title: '操作人', operate: 'LIKE'}, colCenter),
|
|
|
+ $.extend({field: 'send_time', title: '操作时间', operate: 'RANGE', addclass: 'datetimerange', sortable: true}, colCenter),
|
|
|
$.extend({field: 'fail_reason', title: '失败原因', operate: false, class: 'autocontent', formatter: Table.api.formatter.content}, colCenter)
|
|
|
]
|
|
|
]
|