|
|
@@ -642,7 +642,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
var allOnlyCols = ['ID'];
|
|
|
|
|
|
Controller.currYm = ($layout.data('defaultYm') || '').toString();
|
|
|
- Controller.wffTab = ($layout.data('procuremenStage') || 'pick').toString();
|
|
|
+ // 优先读属性,避免 jQuery .data() 缓存旧值导致 stage 错成 pick、操作列整列变空
|
|
|
+ Controller.wffTab = ($layout.attr('data-procuremen-stage') || $layout.data('procuremenStage') || 'pick').toString();
|
|
|
if (['pick', 'audit', 'confirm'].indexOf(Controller.wffTab) < 0) {
|
|
|
Controller.wffTab = 'pick';
|
|
|
}
|
|
|
@@ -1158,6 +1159,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
+ "<span class='procuremen-supplier-preview'>" + procuremenEscHtml(preview) + '</span>'
|
|
|
+ '</div>';
|
|
|
}
|
|
|
+ /** 多值直接换行展示(确认/审批订单号等) */
|
|
|
+ function procuremenMultiLinesWrapCell(value) {
|
|
|
+ var lines = procuremenParseSupplierLines(value);
|
|
|
+ if (lines.length === 0) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ if (lines.length === 1) {
|
|
|
+ return procuremenEscHtml(lines[0]);
|
|
|
+ }
|
|
|
+ return '<div class="procuremen-multi-lines-wrap" style="white-space:normal;line-height:1.55;text-align:center;">'
|
|
|
+ + lines.map(function (line) {
|
|
|
+ return '<div>' + procuremenEscHtml(line) + '</div>';
|
|
|
+ }).join('')
|
|
|
+ + '</div>';
|
|
|
+ }
|
|
|
function procuremenReadSupplierLinesFromCell($item) {
|
|
|
if (!$item || !$item.length) {
|
|
|
return [];
|
|
|
@@ -1511,6 +1527,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
{field: 'CCYDH', title: __('订单号'), operate: 'LIKE', table: 'b', width: 120, align: 'center', sortable: true,
|
|
|
class: 'procuremen-th-sort-tight procuremen-supplier-lines-cell',
|
|
|
formatter: function (v) {
|
|
|
+ var tab = Controller.wffTab || 'pick';
|
|
|
+ // 确认/审批:多订单号直接换行,避免省略看不清
|
|
|
+ if (tab === 'audit' || tab === 'confirm') {
|
|
|
+ return procuremenMultiLinesWrapCell(v);
|
|
|
+ }
|
|
|
return procuremenSupplierLinesCell(v, this.width || 120);
|
|
|
}
|
|
|
},
|
|
|
@@ -1569,6 +1590,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
},
|
|
|
{field: 'ceilingPrice', title: '最高限价', operate: 'LIKE', table: 'a', width: 90, align: 'center',
|
|
|
visible: true,
|
|
|
+ class: 'procuremen-supplier-lines-cell',
|
|
|
formatter: function (value, row, index) {
|
|
|
var tab = Controller.wffTab || 'pick';
|
|
|
var v = value;
|
|
|
@@ -1583,16 +1605,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
+ 'data-field="ceilingPrice" data-row-index="' + index + '" value="'
|
|
|
+ procuremenEscAttr(val) + '" placeholder="填写" autocomplete="off"/>';
|
|
|
}
|
|
|
- if (v == null || v === '') {
|
|
|
- return '';
|
|
|
- }
|
|
|
- var s = String(v).split(/[、,,]+/).map(function (x) {
|
|
|
- return $.trim(x);
|
|
|
- }).filter(Boolean).join('、');
|
|
|
- if (!s) {
|
|
|
- return '';
|
|
|
- }
|
|
|
- return '<span style="white-space:normal;line-height:1.5;">' + procuremenEscHtml(s) + '</span>';
|
|
|
+ return procuremenSupplierLinesCell(v, this.width || 90);
|
|
|
}
|
|
|
},
|
|
|
{field: 'order_status_text', title: '订单状态', operate: false, table: 'a', width: 100, align: 'center',
|
|
|
@@ -1672,7 +1685,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
{field: 'CDW', title: __('单位'), operate: 'LIKE', table: 'a', width: 88, align: 'center'},
|
|
|
{field: 'CDF', title: __('订法'), operate: 'LIKE', table: 'a', width: 90, align: 'center', class: 'procuremen-cell-wrap'},
|
|
|
{field: 'cGzzxMc', title: __('外厂单位'), operate: 'LIKE', table: 'a', width: 200, align: 'center', class: 'procuremen-cell-wrap'},
|
|
|
- {field: 'MBZ', title: '招标备注', operate: 'LIKE', table: 'a', width: 240, align: 'center', class: 'procuremen-cell-wrap',
|
|
|
+ {field: 'MBZ', title: '招标备注', operate: 'LIKE', table: 'a', width: 240, align: 'center',
|
|
|
+ class: indexInitWffTab === 'pick' ? 'procuremen-cell-wrap' : 'autocontent',
|
|
|
formatter: function (v, row, index) {
|
|
|
var tab = Controller.wffTab || 'pick';
|
|
|
if (tab === 'pick') {
|
|
|
@@ -1682,10 +1696,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
+ 'data-field="MBZ" data-row-index="' + index + '" value="'
|
|
|
+ procuremenEscAttr(val) + '" placeholder="填写" autocomplete="off"/>';
|
|
|
}
|
|
|
- if (v == null || v === '') {
|
|
|
- return '';
|
|
|
- }
|
|
|
- return '<span title="' + procuremenEscAttr(v) + '">' + procuremenEscHtml(String(v)) + '</span>';
|
|
|
+ // 确认/审批:过长单行省略,悬停出现下拉箭头展开全文
|
|
|
+ return procuremenAutocontentCell(v, this.width || 240);
|
|
|
}
|
|
|
},
|
|
|
{field: 'cywyxm', title: __('业务员'), operate: '=', searchList: procuremenSearchList('cywyxm'), table: 'b', width: 80, align: 'center'},
|
|
|
@@ -1726,46 +1738,61 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
{field: 'dputrecord', title: __('提交日期'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, table: 'b', width: 176, align: 'center', sortable: true, class: 'procuremen-th-sort-tight',
|
|
|
visible: indexInitWffTab === 'pick'
|
|
|
},
|
|
|
- {field: 'operate',title: '操作',width: indexInitWffTab === 'audit' ? 178 : 220,align: 'center',fixed: 'right', operate: false,
|
|
|
+ {field: 'operate', title: '操作', width: indexInitWffTab === 'audit' ? 178 : 220, align: 'center', operate: false,
|
|
|
visible: indexInitWffTab !== 'pick',
|
|
|
+ class: 'procuremen-operate-col',
|
|
|
table: table,
|
|
|
formatter: function (value, row, index) {
|
|
|
- var tab = Controller.wffTab || 'pick';
|
|
|
- var pk = row && (row.ID != null ? row.ID : row.id);
|
|
|
- if (!row || pk == null || pk === '' || String(pk) === '0') {
|
|
|
+ // 用初始化 stage,避免运行期 wffTab 被改写后操作列突然变空
|
|
|
+ var tab = indexInitWffTab || Controller.wffTab || 'pick';
|
|
|
+ if (tab === 'pick' || !row) {
|
|
|
return '';
|
|
|
}
|
|
|
+ // 合并行可能只有 scydgy_id / purchase_order_id,勿因缺 ID 整列变空
|
|
|
+ var pk = row.ID != null ? row.ID : row.id;
|
|
|
+ if (pk == null || pk === '' || String(pk) === '0') {
|
|
|
+ pk = row.scydgy_id != null ? row.scydgy_id : row.purchase_order_id;
|
|
|
+ }
|
|
|
+ if (pk == null || pk === '' || String(pk) === '0') {
|
|
|
+ pk = 'r' + index;
|
|
|
+ }
|
|
|
var areaDetails = ' data-area=\'["100%","100%"]\'';
|
|
|
var areaAudit = ' data-area=\'["98%","92%"]\'';
|
|
|
var areaConfirmOutward = ' data-area=\'["100%","100%"]\'';
|
|
|
var primary = '';
|
|
|
- var detail = '';
|
|
|
- if (tab === 'pick') {
|
|
|
- return '';
|
|
|
- } else if (tab === 'audit') {
|
|
|
- var stA = row && row.order_status_text != null ? String(row.order_status_text).trim() : '';
|
|
|
+ // 能进确认/审批列表即可看详情(接口仍会鉴权)
|
|
|
+ var detail = '<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>';
|
|
|
+ var canAuditIssue = procuremenCan('auditissue') || tab === 'audit';
|
|
|
+ var canOutward = procuremenCan('outward_detail') || tab === 'confirm';
|
|
|
+ if (tab === 'audit') {
|
|
|
+ var stA = row.order_status_text != null ? String(row.order_status_text).trim() : '';
|
|
|
if (stA === '待审批') {
|
|
|
stA = '待审核';
|
|
|
}
|
|
|
- if (stA === '待确认' && procuremenCan('auditissue')) {
|
|
|
+ if (stA === '待确认' && canAuditIssue) {
|
|
|
primary = '<a class="btn btn-xs btn-primary procuremen-op-open procuremen-btn-audit-issue"' + areaAudit + ' href="procuremen/auditissue" data-row-index="' + index + '" title=""><i class="fa fa-check"></i> 选择供应商</a>';
|
|
|
}
|
|
|
- if (procuremenCan('details')) {
|
|
|
- detail = '<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>';
|
|
|
- }
|
|
|
} else if (tab === 'confirm') {
|
|
|
- var stC = row && row.order_status_text != null ? String(row.order_status_text).trim() : '';
|
|
|
+ var stC = row.order_status_text != null ? String(row.order_status_text).trim() : '';
|
|
|
if (stC === '待审批') {
|
|
|
stC = '待审核';
|
|
|
}
|
|
|
- if (stC === '待审核' && procuremenCan('outward_detail')) {
|
|
|
- primary = '<a class="btn btn-xs btn-success procuremen-op-open procuremen-btn-outward"' + areaConfirmOutward + ' href="procuremen/outward_detail?wff_tab=confirm" data-row-index="' + index + '" title="审批"><i class="fa fa-gavel"></i> 审批</a>';
|
|
|
+ // 待开标:不可审批(须已开标或已指定供应商)
|
|
|
+ var bidText = row.bid_open_status_text != null ? String(row.bid_open_status_text).trim() : '';
|
|
|
+ if (!bidText) {
|
|
|
+ if (parseInt(row.bid_open_verified, 10) === 1) {
|
|
|
+ bidText = '已开标';
|
|
|
+ } else if (parseInt(row.manual_picked, 10) === 1) {
|
|
|
+ bidText = '已指定供应商';
|
|
|
+ } else {
|
|
|
+ bidText = '待开标';
|
|
|
+ }
|
|
|
}
|
|
|
- if (procuremenCan('details')) {
|
|
|
- detail = '<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>';
|
|
|
+ var bidReady = (bidText === '已开标' || bidText === '已指定供应商');
|
|
|
+ if (stC === '待审核' && bidReady && canOutward) {
|
|
|
+ primary = '<a class="btn btn-xs btn-success procuremen-op-open procuremen-btn-outward"' + areaConfirmOutward + ' href="procuremen/outward_detail?wff_tab=confirm" data-row-index="' + index + '" title="审批"><i class="fa fa-gavel"></i> 审批</a>';
|
|
|
}
|
|
|
- }
|
|
|
- if (!primary && !detail) {
|
|
|
+ } else {
|
|
|
return '';
|
|
|
}
|
|
|
// 双槽位:左侧主操作(无则占位),右侧详情固定竖线对齐;整体居中
|
|
|
@@ -1778,8 +1805,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}
|
|
|
];
|
|
|
|
|
|
- // audit / confirm 右侧固定操作列,避免横向滚动才能点按钮
|
|
|
- var useFixedColumns = indexInitWffTab === 'audit' || indexInitWffTab === 'confirm';
|
|
|
+ // 操作列改用 CSS sticky,禁用 fixed-columns 插件(克隆列宽错位会让操作按钮看起来“没了”)
|
|
|
+ var useFixedColumns = false;
|
|
|
var procuremenTableHeightCached = 0;
|
|
|
var procuremenHeightSyncTimer = null;
|
|
|
|
|
|
@@ -1936,55 +1963,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}
|
|
|
$headerWrap.scrollLeft(sl);
|
|
|
|
|
|
- // 右侧固定操作列:插件克隆整表再 scrollLeft 到最右;切勿 scrollLeft(0) 或把 table 压成单列宽
|
|
|
- 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 = 168;
|
|
|
- var opMin = Controller.wffTab === 'audit' ? 160 : 156;
|
|
|
- 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(Math.round(measured), opMin);
|
|
|
- }
|
|
|
- }
|
|
|
- $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);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 已改用 sticky 操作列:隐藏插件残留的右侧固定层,避免空白遮罩盖住按钮
|
|
|
+ $bt.find('.fixed-columns-right, .fixed-columns').hide();
|
|
|
}
|
|
|
|
|
|
function procuremenScheduleAlign() {
|
|
|
@@ -4709,9 +4689,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
FastRef.api.ajax({
|
|
|
url: FastRef.api.fixurl(isPickMode ? 'procuremen/picksubmit' : 'procuremen/review'),
|
|
|
type: 'POST',
|
|
|
- data: postData
|
|
|
+ data: postData,
|
|
|
+ timeout: isPickMode ? 180000 : 90000
|
|
|
}, function (data, ret) {
|
|
|
var msg = (ret && ret.msg) ? ret.msg : '操作成功';
|
|
|
+ var notifyFailed = data && (parseInt(data.notify_failed, 10) === 1);
|
|
|
try {
|
|
|
sessionStorage.removeItem('procuremen_merge_rows');
|
|
|
} catch (ignoreClr) {
|
|
|
@@ -4720,10 +4702,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
if (typeof parent !== 'undefined' && parent.Layer && index) {
|
|
|
parent.Layer.close(index);
|
|
|
}
|
|
|
- if (typeof parent !== 'undefined' && parent.Toastr) {
|
|
|
- parent.Toastr.success(msg);
|
|
|
- } else if (typeof Toastr !== 'undefined') {
|
|
|
- Toastr.success(msg);
|
|
|
+ // 下发已成功:通知未送达用 warning,避免被当成整单失败
|
|
|
+ var toast = (typeof parent !== 'undefined' && parent.Toastr) ? parent.Toastr
|
|
|
+ : (typeof Toastr !== 'undefined' ? Toastr : null);
|
|
|
+ if (toast) {
|
|
|
+ if (notifyFailed && toast.warning) {
|
|
|
+ toast.warning(msg);
|
|
|
+ } else {
|
|
|
+ toast.success(msg);
|
|
|
+ }
|
|
|
+ } else if (notifyFailed && typeof parent !== 'undefined' && parent.Layer) {
|
|
|
+ parent.Layer.msg(msg, {icon: 0, time: 5000});
|
|
|
}
|
|
|
if (parent && parent.$ && parent.$('#table').length) {
|
|
|
parent.$('#table').bootstrapTable('refresh', {silent: true});
|
|
|
@@ -4731,8 +4720,30 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
return false;
|
|
|
}, function (data, ret) {
|
|
|
$submitBtn.prop('disabled', false).html(submitBtnHtml);
|
|
|
- var errMsg = (ret && ret.msg) ? ret.msg : '提交失败,请重试';
|
|
|
- procuremenReviewWarn(errMsg);
|
|
|
+ var errMsg = (ret && ret.msg) ? String(ret.msg) : '';
|
|
|
+ var softFail = /timeout|timed out|网络|abort|gateway|504|502|503/i.test(errMsg)
|
|
|
+ || errMsg === ''
|
|
|
+ || (ret && (ret.code === -1 || typeof ret.code === 'undefined'));
|
|
|
+ if (isPickMode && softFail) {
|
|
|
+ try { sessionStorage.removeItem('procuremen_merge_rows'); } catch (e0) {}
|
|
|
+ var tip = '提交时间较长。请刷新列表:若已进入「待确认」,说明下发已成功;个别未收到通知时,请到「协助审批下发」重发。';
|
|
|
+ if (typeof parent !== 'undefined' && parent.Toastr && parent.Toastr.warning) {
|
|
|
+ parent.Toastr.warning(tip);
|
|
|
+ } else if (typeof Toastr !== 'undefined' && Toastr.warning) {
|
|
|
+ Toastr.warning(tip);
|
|
|
+ } else {
|
|
|
+ procuremenReviewWarn(tip);
|
|
|
+ }
|
|
|
+ if (parent && parent.$ && parent.$('#table').length) {
|
|
|
+ parent.$('#table').bootstrapTable('refresh', {silent: true});
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ var idxClose = parent.Layer.getFrameIndex(window.name);
|
|
|
+ if (idxClose) { parent.Layer.close(idxClose); }
|
|
|
+ } catch (e1) {}
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ procuremenReviewWarn(errMsg || '提交未完成,请刷新列表确认后重试');
|
|
|
return false;
|
|
|
});
|
|
|
}
|
|
|
@@ -5738,10 +5749,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
}
|
|
|
}, function (data, ret) {
|
|
|
var msg = (ret && ret.msg) ? ret.msg : '补加成功';
|
|
|
- if (typeof parent !== 'undefined' && parent.Toastr) {
|
|
|
- parent.Toastr.success(msg);
|
|
|
- } else {
|
|
|
- Toastr.success(msg);
|
|
|
+ var notifyFailed = data && (parseInt(data.notify_failed, 10) === 1);
|
|
|
+ var toast = (typeof parent !== 'undefined' && parent.Toastr) ? parent.Toastr
|
|
|
+ : (typeof Toastr !== 'undefined' ? Toastr : null);
|
|
|
+ if (toast) {
|
|
|
+ if (notifyFailed && toast.warning) {
|
|
|
+ toast.warning(msg);
|
|
|
+ } else {
|
|
|
+ toast.success(msg);
|
|
|
+ }
|
|
|
}
|
|
|
setTimeout(function () {
|
|
|
try {
|