|
|
@@ -264,11 +264,58 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
+ '</div>'
|
|
|
);
|
|
|
}
|
|
|
+ /** 确认/审批页:默认选中服务端计算的有数据月份,避免沿用错误月份导致空表 */
|
|
|
+ function procuremenApplyActiveYm(ym) {
|
|
|
+ if (!/^\d{4}-\d{2}$/.test(ym)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Controller.currYm = ym;
|
|
|
+ var y = ym.substring(0, 4);
|
|
|
+ var mo = parseInt(ym.substring(5, 7), 10) || 1;
|
|
|
+ var $item = $('.procuremen-ym-item[data-ym="' + ym + '"]');
|
|
|
+ if (!$item.length) {
|
|
|
+ var $block = $('.procuremen-sidebar .procuremen-year-block').filter(function () {
|
|
|
+ return $(this).find('.year-title').text() === y + '年';
|
|
|
+ }).first();
|
|
|
+ if (!$block.length) {
|
|
|
+ $block = $('<div class="procuremen-year-block"><div class="year-title">' + y + '年</div></div>');
|
|
|
+ $('.procuremen-sidebar').prepend($block);
|
|
|
+ }
|
|
|
+ $item = $('<a href="javascript:;" class="procuremen-ym-item" data-ym="' + ym + '">' + mo + '月</a>');
|
|
|
+ $block.append($item);
|
|
|
+ $item.on('click', function () {
|
|
|
+ var clickYm = $(this).data('ym');
|
|
|
+ if (!clickYm || clickYm === Controller.currYm) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Controller.currYm = clickYm;
|
|
|
+ $('.procuremen-ym-item').removeClass('active');
|
|
|
+ $(this).addClass('active');
|
|
|
+ table.bootstrapTable('refresh');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ $('.procuremen-ym-item').removeClass('active');
|
|
|
+ $item.addClass('active');
|
|
|
+ }
|
|
|
+ function procuremenSyncCurrYmFromSidebar() {
|
|
|
+ var defYm = ($layout.data('defaultYm') || '').toString();
|
|
|
+ if (/^\d{4}-\d{2}$/.test(defYm)) {
|
|
|
+ procuremenApplyActiveYm(defYm);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var $first = $('.procuremen-sidebar .procuremen-ym-item').first();
|
|
|
+ if ($first.length) {
|
|
|
+ procuremenApplyActiveYm(($first.data('ym') || '').toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
procuremenEnsureSidebarMonths();
|
|
|
+ if (Controller.wffTab === 'audit' || Controller.wffTab === 'confirm') {
|
|
|
+ procuremenSyncCurrYmFromSidebar();
|
|
|
+ }
|
|
|
|
|
|
Table.api.init({
|
|
|
extend: {
|
|
|
- index_url: 'procuremen/' + listAction + location.search,
|
|
|
+ index_url: 'procuremen/' + listAction,
|
|
|
multi_url: 'procuremen/multi',
|
|
|
import_url: 'procuremen/import',
|
|
|
table: 'scydgy',
|
|
|
@@ -394,7 +441,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
var indexInitWffTab = Controller.wffTab;
|
|
|
var indexShowall = indexInitWffTab === 'pick' || indexInitWffTab === 'audit';
|
|
|
var indexShowIssued = indexInitWffTab === 'audit' || indexInitWffTab === 'confirm';
|
|
|
- var indexShowPendingOnly = indexInitWffTab === 'confirm';
|
|
|
+ var indexShowPendingOnly = indexInitWffTab === 'confirm' || indexInitWffTab === 'audit';
|
|
|
var indexShowPickedOnly = indexInitWffTab === 'confirm';
|
|
|
var indexShowAuditSuppliers = indexInitWffTab === 'audit';
|
|
|
function procuremenEscAttr(s) {
|
|
|
@@ -424,6 +471,69 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}
|
|
|
return "<div class='autocontent-item' style='white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:" + width + ";'>" + procuremenEscHtml(text) + '</div>';
|
|
|
}
|
|
|
+ /** 报价供应商:收起单行省略,展开后每家公司一行 */
|
|
|
+ function procuremenParseSupplierLines(value) {
|
|
|
+ if (value == null || value === '') {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ var raw = String(value).replace(/\r\n/g, '\n').trim();
|
|
|
+ var lines = raw.split('\n').map(function (s) {
|
|
|
+ return s.trim();
|
|
|
+ }).filter(Boolean);
|
|
|
+ if (lines.length === 1 && /[、;]/.test(lines[0])) {
|
|
|
+ lines = lines[0].split(/[、;]+/).map(function (s) {
|
|
|
+ return s.trim();
|
|
|
+ }).filter(Boolean);
|
|
|
+ }
|
|
|
+ return lines;
|
|
|
+ }
|
|
|
+ function procuremenSupplierLinesCell(value, colWidth) {
|
|
|
+ var lines = procuremenParseSupplierLines(value);
|
|
|
+ if (lines.length === 0) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ var preview = lines.join(';');
|
|
|
+ var width = colWidth != null && colWidth !== '' ? String(colWidth) : '260';
|
|
|
+ if (/^\d+$/.test(width)) {
|
|
|
+ width = width + 'px';
|
|
|
+ }
|
|
|
+ return "<div class='procuremen-supplier-lines' data-supplier-full='" + procuremenEscAttr(JSON.stringify(lines)) + "' style='white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:" + width + ";'>"
|
|
|
+ + "<span class='procuremen-supplier-preview'>" + procuremenEscHtml(preview) + '</span>'
|
|
|
+ + '</div>';
|
|
|
+ }
|
|
|
+ function procuremenReadSupplierLinesFromCell($item) {
|
|
|
+ if (!$item || !$item.length) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ var raw = $item.attr('data-supplier-full');
|
|
|
+ if (raw) {
|
|
|
+ try {
|
|
|
+ var parsed = JSON.parse(raw);
|
|
|
+ if ($.isArray(parsed)) {
|
|
|
+ return parsed.map(function (s) {
|
|
|
+ return String(s == null ? '' : s).trim();
|
|
|
+ }).filter(Boolean);
|
|
|
+ }
|
|
|
+ } catch (ignore) {
|
|
|
+ }
|
|
|
+ return procuremenParseSupplierLines(raw);
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ function procuremenSupplierLinesPopupHtml(lines) {
|
|
|
+ return '<div class="procuremen-supplier-popup" style="padding:10px 12px;line-height:1.8;word-break:break-all;">'
|
|
|
+ + lines.map(function (line) {
|
|
|
+ return '<div>' + procuremenEscHtml(line) + '</div>';
|
|
|
+ }).join('')
|
|
|
+ + '</div>';
|
|
|
+ }
|
|
|
+ function procuremenSupplierCntText(v) {
|
|
|
+ var n = parseInt(v, 10);
|
|
|
+ if (isNaN(n) || n < 0) {
|
|
|
+ n = 0;
|
|
|
+ }
|
|
|
+ return n + '家';
|
|
|
+ }
|
|
|
var indexTableColumns = [
|
|
|
{checkbox: true, field: 'state', visible: indexShowall, align: 'center', width: 42, class: 'procuremen-col-checkbox'},
|
|
|
// {field: 'ID', title: __('ID'), operate: 'LIKE', table: 'a', width: 100, align: 'center',
|
|
|
@@ -438,7 +548,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
// return v != null && v !== '' && String(v) !== '0' ? String(v) : '';
|
|
|
// }
|
|
|
// },
|
|
|
- {field: 'CCYDH', title: __('订单号'), operate: 'LIKE', table: 'b', width: 100, align: 'center', sortable: true},
|
|
|
+ {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',
|
|
|
@@ -496,44 +606,44 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return (v == null || v === '') ? '' : String(v);
|
|
|
}
|
|
|
},
|
|
|
- {field: 'notify_supplier_text', title: '供应商', operate: false, table: 'a', width: 240, align: 'left',
|
|
|
+ {field: 'notify_supplier_text', title: '报价供应商', operate: false, table: 'a', width: 260, align: 'left',
|
|
|
visible: indexShowAuditSuppliers,
|
|
|
- class: 'autocontent',
|
|
|
+ class: 'procuremen-supplier-lines-cell',
|
|
|
formatter: function (v) {
|
|
|
- return procuremenAutocontentCell(v, this.width || 240);
|
|
|
+ return procuremenSupplierLinesCell(v, this.width || 260);
|
|
|
}
|
|
|
},
|
|
|
- {field: 'po_detail_count',title: '已下发数量',operate: false,table: 'a',width: 96,align: 'center',
|
|
|
- visible: indexShowPendingOnly,
|
|
|
+ {field: 'picked_supplier_name', title: '报价供应商', operate: 'LIKE', table: 'a', width: 260, align: 'left',
|
|
|
+ visible: indexShowPickedOnly,
|
|
|
+ class: 'procuremen-supplier-lines-cell',
|
|
|
formatter: function (v) {
|
|
|
- return v != null && v !== '' ? String(v) : '0';
|
|
|
+ return procuremenSupplierLinesCell(v, this.width || 260);
|
|
|
}
|
|
|
},
|
|
|
- {field: 'po_amount_fill_cnt',title: '已上报金额',operate: false,table: 'a',width: 96,align: 'center',
|
|
|
+ {field: 'po_detail_count', title: '已下发供应商', operate: false, table: 'a', width: 108, align: 'center',
|
|
|
visible: indexShowPendingOnly,
|
|
|
formatter: function (v) {
|
|
|
- return v != null && v !== '' ? String(v) : '0';
|
|
|
+ return procuremenSupplierCntText(v);
|
|
|
}
|
|
|
},
|
|
|
- {field: 'po_delivery_fill_cnt',title: '已上报货期',operate: false,table: 'a',width: 96,align: 'center',
|
|
|
+ {field: 'po_amount_fill_cnt', title: '已填写单价', operate: false, table: 'a', width: 100, align: 'center',
|
|
|
visible: indexShowPendingOnly,
|
|
|
formatter: function (v) {
|
|
|
- return v != null && v !== '' ? String(v) : '0';
|
|
|
+ return procuremenSupplierCntText(v);
|
|
|
}
|
|
|
},
|
|
|
- {field: 'picked_supplier_name', title: '报价供应商', operate: 'LIKE', table: 'a', width: 260, align: 'left',
|
|
|
- visible: indexShowPickedOnly,
|
|
|
- class: 'autocontent',
|
|
|
+ {field: 'po_delivery_fill_cnt', title: '已填写货期', operate: false, table: 'a', width: 100, align: 'center',
|
|
|
+ visible: indexShowPendingOnly,
|
|
|
formatter: function (v) {
|
|
|
- return procuremenAutocontentCell(v, this.width || 260);
|
|
|
+ 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: 'cywyxm', title: __('业务员'), operate: 'LIKE', table: 'b', width: 80, align: 'center'},
|
|
|
- {field: 'dStamp', title: __('操作日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'a', width: 165, align: 'center'},
|
|
|
- {field: 'dputrecord', title: __('提交日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'b', width: 170, align: 'center'},
|
|
|
+ {field: 'dStamp', title: __('操作日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'a', width: 158, align: 'center', sortable: true, class: 'procuremen-th-sort-tight'},
|
|
|
+ {field: 'dputrecord', title: __('提交日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'b', width: 158, align: 'center', sortable: true, class: 'procuremen-th-sort-tight'},
|
|
|
{field: 'operate',title: '操作',width: 220,align: 'center',fixed: 'right', operate: false,
|
|
|
visible: indexInitWffTab !== 'pick',
|
|
|
table: table,
|
|
|
@@ -564,7 +674,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
parts.push('<a class="btn btn-xs btn-info procuremen-op-open procuremen-btn-details"' + areaDetails + ' href="procuremen/details" data-row-index="' + index + '" title="详情"><i class="fa fa-file-text-o"></i> 详情</a>');
|
|
|
}
|
|
|
}
|
|
|
- return '<div class="btn-group">' + parts.join(' ') + '</div>';
|
|
|
+ return '<span class="procuremen-op-btns">' + parts.join('') + '</span>';
|
|
|
},
|
|
|
events: {}
|
|
|
}
|
|
|
@@ -621,6 +731,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
showExport: false,
|
|
|
smartDisplay: false,
|
|
|
responseHandler: function (res) {
|
|
|
+ if (res && res.activeYm && (Controller.wffTab === 'audit' || Controller.wffTab === 'confirm')) {
|
|
|
+ procuremenApplyActiveYm(res.activeYm);
|
|
|
+ }
|
|
|
if (res && typeof res === 'object' && res.msg && (res.total === 0 || !res.rows || !res.rows.length)) {
|
|
|
delete res.msg;
|
|
|
}
|
|
|
@@ -637,6 +750,57 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
|
|
|
Table.api.bindevent(table);
|
|
|
|
|
|
+ table.off('mouseenter.procuremenSupplierLines mouseleave.procuremenSupplierLines', '.procuremen-supplier-lines-cell')
|
|
|
+ .on('mouseenter.procuremenSupplierLines', '.procuremen-supplier-lines-cell', function () {
|
|
|
+ var $item = $(this).find('.procuremen-supplier-lines').first();
|
|
|
+ if (!$item.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var lines = procuremenReadSupplierLinesFromCell($item);
|
|
|
+ var target = $item.find('.procuremen-supplier-preview').get(0);
|
|
|
+ if (lines.length > 1 || (target && target.scrollWidth > target.offsetWidth)) {
|
|
|
+ if (!$(this).find('> .procuremen-supplier-caret').length) {
|
|
|
+ $(this).append("<div class='procuremen-supplier-caret'><i class='fa fa-chevron-down'></i></div>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .on('mouseleave.procuremenSupplierLines', '.procuremen-supplier-lines-cell', function () {
|
|
|
+ $(this).find('> .procuremen-supplier-caret').remove();
|
|
|
+ });
|
|
|
+ table.off('click.procuremenSupplierLines', '.procuremen-supplier-lines-cell > .procuremen-supplier-caret')
|
|
|
+ .on('click.procuremenSupplierLines', '.procuremen-supplier-lines-cell > .procuremen-supplier-caret', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+ e.stopImmediatePropagation();
|
|
|
+ var $td = $(this).closest('.procuremen-supplier-lines-cell');
|
|
|
+ var $item = $td.find('.procuremen-supplier-lines').first();
|
|
|
+ var lines = procuremenReadSupplierLinesFromCell($item);
|
|
|
+ if (!lines.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var tdrect = $td.get(0).getBoundingClientRect();
|
|
|
+ var layerIndex = Layer.open({
|
|
|
+ id: 'procuremen-supplier-lines',
|
|
|
+ skin: 'layui-layer-fast layui-layer-autocontent',
|
|
|
+ title: false,
|
|
|
+ content: procuremenSupplierLinesPopupHtml(lines),
|
|
|
+ btn: false,
|
|
|
+ anim: false,
|
|
|
+ shade: 0,
|
|
|
+ isOutAnim: false,
|
|
|
+ area: 'auto',
|
|
|
+ maxWidth: 450,
|
|
|
+ maxHeight: 350,
|
|
|
+ offset: [tdrect.y, tdrect.x]
|
|
|
+ });
|
|
|
+ var mousedown = function (ev) {
|
|
|
+ if ($(ev.target).closest('.layui-layer').length === 0) {
|
|
|
+ Layer.close(layerIndex);
|
|
|
+ $(document).off('mousedown', mousedown);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $(document).off('mousedown', mousedown).on('mousedown', mousedown);
|
|
|
+ });
|
|
|
+
|
|
|
// 刷新/切换月份时旧请求被中断会误触 load-error;列表已有数据时不打扰用户
|
|
|
table.off('load-error.bs.table').on('load-error.bs.table', function (status, res, jqXHR) {
|
|
|
var xhr = jqXHR || res;
|
|
|
@@ -1827,7 +1991,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return;
|
|
|
}
|
|
|
Lr.confirm(
|
|
|
- '驳回后本单将退回「协助审批下发」。是否确认驳回?',
|
|
|
+ '是否确认驳回?',
|
|
|
{
|
|
|
icon: 0,
|
|
|
title: '采购终审 — 审批驳回',
|