|
@@ -56,6 +56,45 @@ $(document).ready(function() {
|
|
|
});
|
|
|
const posSpread = SpreadJsObj.createNewSpread($('#pos-spread')[0]);
|
|
|
|
|
|
+
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const errorList = $.cs_errorList({
|
|
|
+ tabSelector: '#error-list-tab',
|
|
|
+ selector: '#error-list',
|
|
|
+ relaSpread: ledgerSpread,
|
|
|
+ storeKey: 'ledger-error-' + getTenderId(),
|
|
|
+ afterLocated: function () {
|
|
|
+ posOperationObj.loadCurPosData();
|
|
|
+ },
|
|
|
+ afterShow: function () {
|
|
|
+ ledgerSpread.refresh();
|
|
|
+ if (posSpread) posSpread.refresh();
|
|
|
+ },
|
|
|
+ showSideTools: showSideTools,
|
|
|
+ });
|
|
|
+
|
|
|
$.subMenu({
|
|
|
menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
|
|
|
toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
|
|
@@ -86,6 +125,9 @@ $(document).ready(function() {
|
|
|
if (searchLedger) {
|
|
|
searchLedger.spread.refresh();
|
|
|
}
|
|
|
+ if (errorList) {
|
|
|
+ errorList.spread.refresh();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1882,29 +1924,6 @@ $(document).ready(function() {
|
|
|
$('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;
|
|
@@ -1948,7 +1967,7 @@ $(document).ready(function() {
|
|
|
dealBills.loadData();
|
|
|
}
|
|
|
dealBills.spread.refresh();
|
|
|
- } else if (tab.attr('content') === '#search' && !searchLedger) {
|
|
|
+ } else if (tab.attr('content') === '#search') {
|
|
|
if (!searchLedger) {
|
|
|
searchLedger = $.billsSearch({
|
|
|
selector: '#search',
|
|
@@ -1976,6 +1995,8 @@ $(document).ready(function() {
|
|
|
});
|
|
|
}
|
|
|
searchLedger.spread.refresh();
|
|
|
+ } else if (tab.attr('content') === '#error-list') {
|
|
|
+ errorList.spread.refresh();
|
|
|
}
|
|
|
} else { // 收起工具栏
|
|
|
tab.removeClass('active');
|
|
@@ -2581,6 +2602,60 @@ $(document).ready(function() {
|
|
|
|
|
|
SpreadExcelObj.exportSimpleXlsxSheet(setting, data, "台账分解.xlsx");
|
|
|
});
|
|
|
+
|
|
|
+ const dataChecker = DataChecker({
|
|
|
+ loadUrl: window.location.pathname + '/load',
|
|
|
+ loadData: {},
|
|
|
+ checkFun: function (data, progress) {
|
|
|
+ ledgerTree.loadDatas(data.bills);
|
|
|
+ treeCalc.calculateAll(ledgerTree);
|
|
|
+ SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
|
|
|
+
|
|
|
+ pos.loadDatas(data.pos);
|
|
|
+ posOperationObj.loadCurPosData();
|
|
|
+
|
|
|
+ const checkFields = ['sgfh_qty', 'qtcl_qty', 'sjcl_qty', 'quantity'], result = [];
|
|
|
+ const iLen = data.bills.length;
|
|
|
+ for (const [i, b] of data.bills.entries()) {
|
|
|
+ const pr = _.filter(data.pos, {lid: b.id});
|
|
|
+ if (pr && pr.length > 0) {
|
|
|
+ const checkData = {}, calcData = {};
|
|
|
+ for (const field of checkFields) {
|
|
|
+ checkData[field] = b[field] ? b[field] : 0;
|
|
|
+ }
|
|
|
+ for (p of pr) {
|
|
|
+ for (const field of checkFields) {
|
|
|
+ calcData[field] = ZhCalc.add(calcData[field], p[field]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (const field of checkFields) {
|
|
|
+ calcData[field] = calcData[field] ? calcData[field] : 0;
|
|
|
+ }
|
|
|
+ if (!_.isMatch(checkData, calcData)) {
|
|
|
+ result.push({
|
|
|
+ ledger_id: b.ledger_id,
|
|
|
+ b_code: b.b_code,
|
|
|
+ name: b.name,
|
|
|
+ serialNo: ledgerTree.getNodeIndex(ledgerTree.getItems(b.ledger_id)) + 1,
|
|
|
+ error: {checkData: checkData, calcData: calcData}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ progress(parseInt((i+1)/iLen*100));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ errorList: errorList,
|
|
|
+ });
|
|
|
+ $('[name=audit-start]').submit(function (e) {
|
|
|
+ if (checkAuditorFrom()) {
|
|
|
+ $(this).parent().parent().parent().modal('hide');
|
|
|
+ const formData = new FormData();
|
|
|
+ dataChecker.checkAndPost(this.action, formData);
|
|
|
+ $('#hide-all').hide();
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
// 检查上报情况
|
|
@@ -2588,7 +2663,9 @@ function checkAuditorFrom () {
|
|
|
if ($('#auditors li').length === 0) {
|
|
|
toastr.error('请先选择审批人,再上报数据');
|
|
|
return false;
|
|
|
+ } else {
|
|
|
+ $('#hide-all').show();
|
|
|
+ return true;
|
|
|
}
|
|
|
- $('#hide-all').show();
|
|
|
}
|
|
|
|