|
@@ -141,23 +141,34 @@ $(document).ready(() => {
|
|
|
// 初始化 清单编号窗口 参数
|
|
|
this.spreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '已用', field: '', width: 45, formatter: '@', cellType: 'image', readOnly: true, hAlign: 1, indent: 14},
|
|
|
+ {title: '已用', field: '', width: 45, formatter: '@', cellType: 'image', readOnly: true, hAlign: 1, indent: 14, img: function (data) {
|
|
|
+ if (data.uamount && !checkZero(data.uamount)) {
|
|
|
+ return $('#icon-ok')[0];
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }},
|
|
|
{title: '变更令号', field: 'code', width: 100, formatter: '@', readOnly: true, hAlign: 0, },
|
|
|
{title: '名称', field: 'name', width: 120, formatter: '@', readOnly: true, hAlign: 0,},
|
|
|
{title: '总数量', field: 'b_amount', width: 60, formatter: '@', readOnly: true, hAlign: 2, },
|
|
|
{title: '可变更数量', field: 'vamount', width: 60, readOnly: true, hAlign: 2, },
|
|
|
- {title: '本期计量', field: 'uamount', width: 60, formatter: '@', hAlign: 2, },
|
|
|
+ {title: '本期计量', field: 'uamount', width: 60, formatter: '@', hAlign: 2, type: 'Number', },
|
|
|
],
|
|
|
emptyRows: 0,
|
|
|
headRows: 1,
|
|
|
headRowHeight: [40],
|
|
|
- };
|
|
|
- this.spreadSetting.cols[0].img = function (data) {
|
|
|
- //return $('#icon-ok')[0];
|
|
|
- if (data.uamount && !checkZero(data.uamount)) {
|
|
|
- return $('#icon-ok')[0];
|
|
|
- } else {
|
|
|
- return null;
|
|
|
+ getColor: function (data, col, defaultColor) {
|
|
|
+ if (col.field === 'uamount') {
|
|
|
+ if (!data.vamount) {
|
|
|
+ return data.uamount ? '#ff6f5c' : defaultColor;
|
|
|
+ } else if (data.uamount) {
|
|
|
+ return data.uamount > data.vamount ? '#ff6f5c' : defaultColor;
|
|
|
+ } else {
|
|
|
+ return defaultColor;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return defaultColor;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
this.curChangeId = '';
|
|
@@ -183,8 +194,8 @@ $(document).ready(() => {
|
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
|
const node = sortData[info.row];
|
|
|
node[col.field] = col.type === 'Number' ? parseFloat(info.editingText) : info.editingText;
|
|
|
- // 刷新已用提示
|
|
|
- info.sheet.repaint(info.sheet.getCellRect(info.row, 0));
|
|
|
+ // 刷新界面
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
|
|
|
}
|
|
|
});
|
|
|
this.spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
|
|
@@ -218,6 +229,7 @@ $(document).ready(() => {
|
|
|
$('#customCheckDisabled').click(function () {
|
|
|
self._filterEmptyChange(!this.checked);
|
|
|
});
|
|
|
+ // 展开收起 变更令详细信息
|
|
|
$('#show-bgl-detail').bind('click', function () {
|
|
|
const detail = $('#bgl-detail'), bgl=$('#bgl'), obj=$(this);
|
|
|
if (detail.hasClass('col-4')) {
|
|
@@ -234,6 +246,39 @@ $(document).ready(() => {
|
|
|
self.spread.refresh();
|
|
|
}
|
|
|
});
|
|
|
+ // 添加调用变更令
|
|
|
+ $('#usg-bg-ok').click(function () {
|
|
|
+ const data = { target: self.callData, change: [] };
|
|
|
+ for (const c of self.changes) {
|
|
|
+ if (c.uamount) {
|
|
|
+ if (!c.vamount || checkZero(c.vamount)) {
|
|
|
+ toast('变更令:' + c.code + ' 当前不可使用', 'error');
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if (c.uamount > c.vamount) {
|
|
|
+ toast('变更令:' + c.code + ' 超计,请修改本期计量后,再提交', 'error');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.obj.modal('hide');
|
|
|
+ // 提交数据到后端
|
|
|
+ // postData(window.location.pathname + 'use-change', data, function(result) {
|
|
|
+ // if (result.pos) {
|
|
|
+ // stagePos.loadCurStageData(result.pos.curStageData);
|
|
|
+ // }
|
|
|
+ // const nodes = stageTree.loadPostStageData(result.ledger.curStageData);
|
|
|
+ // stageTreeSpreadObj.refreshTreeNodes(slSpread.getActiveSheet(), nodes);
|
|
|
+ // stagePosSpreadObj.loadCurPosData();
|
|
|
+ // self.obj.modal('hide');
|
|
|
+ // });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _calculateValidAmount() {
|
|
|
+ for (const c of this.changes) {
|
|
|
+ c.vamount = c.b_amount;
|
|
|
+ }
|
|
|
}
|
|
|
_loadChangeDetail(change) {
|
|
|
if (change) {
|
|
@@ -310,6 +355,7 @@ $(document).ready(() => {
|
|
|
$('#b-code-hint').text('当前变更清单:' + code);
|
|
|
postData(window.location.pathname + '/valid-change', data, function (result) {
|
|
|
self.changes = result;
|
|
|
+ self._calculateValidAmount();
|
|
|
self._viewChanges();
|
|
|
self.obj.modal('show');
|
|
|
});
|