|
@@ -40,6 +40,9 @@ $(document).ready(() => {
|
|
|
},
|
|
|
isSf: function(data) {
|
|
|
return data.pay_type === 'bqsf';
|
|
|
+ },
|
|
|
+ isGatherValid: function(data) {
|
|
|
+ return !data.pay_type && (!data.children || data.children.length === 0);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -385,7 +388,7 @@ $(document).ready(() => {
|
|
|
{title: '截止本期金额', colSpan: '1', rowSpan: '1', field: 'end_tp', hAlign: 2, width: 100, readOnly: true, type: 'Number'},
|
|
|
{title: '起扣金额', colSpan: '1', rowSpan: '1', field: 'start_tp', hAlign: 2, width: 100, type: 'Number'},
|
|
|
{title: '付(扣)款限额', colSpan: '1', rowSpan: '1', field: 'range_tp', hAlign: 2, width: 100, cellType: 'tip', type: 'Number', getTip: payUtils.tips.range_tp},
|
|
|
- {title: '汇总', colSpan: '1', rowSpan: '1', field: 'is_yf', hAlign: 2, width: 60, readOnly: true, type: 'checkbox'},
|
|
|
+ {title: '汇总', colSpan: '1', rowSpan: '1', field: 'is_gather', hAlign: 1, width: 60, cellType: 'signalCheckbox', show: payUtils.check.isGatherValid},
|
|
|
{title: '附件', colSpan: '1', rowSpan: '1', field: 'attachment', hAlign: 0, width: 60, readOnly: true, cellType: 'imageBtn', normalImg: '#rela-file-icon', hoverImg: '#rela-file-hover', getValue: 'getValue.attachment'},
|
|
|
{title: '本期批注', colSpan: '1', rowSpan: '1', field: 'postil', hAlign: 0, width: 120, formatter: '@', cellType: 'autoTip'},
|
|
|
],
|
|
@@ -507,6 +510,9 @@ $(document).ready(() => {
|
|
|
case 'range_tp':
|
|
|
info.cancel = (select.children && select.children.length > 0) || payUtils.check.isYf(select);
|
|
|
break;
|
|
|
+ case 'is_gather':
|
|
|
+ info.cancel = true;
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
if (col.field === 'tp') {
|
|
@@ -602,6 +608,72 @@ $(document).ready(() => {
|
|
|
}
|
|
|
payEvent.loadExprToInput();
|
|
|
},
|
|
|
+ buttonClicked: function (e, info) {
|
|
|
+ if (!info.sheet.zh_setting) return;
|
|
|
+
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field !== 'is_gather') return;
|
|
|
+ if (!payUtils.check.isGatherValid(select)) return;
|
|
|
+ if (info.sheet.isEditing()) info.sheet.endEdit(true);
|
|
|
+
|
|
|
+ const data = {
|
|
|
+ postType: 'update',
|
|
|
+ postData: { id: select.id },
|
|
|
+ };
|
|
|
+ data.postData[col.field] = info.sheet.getValue(info.row, info.col) || 0;
|
|
|
+ // 更新至服务器
|
|
|
+ postData('update', data, function (result) {
|
|
|
+ if (result.reload) payEvent.reloadPays(result.reload);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deletePress: function (sheet) {
|
|
|
+ if (!sheet.zh_setting) return;
|
|
|
+
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!sel) return;
|
|
|
+ const col = sheet.zh_setting.cols[sel.col];
|
|
|
+ if (col.readOnly === true) return;
|
|
|
+ if (sel.colCount > 1) toastr.warning('请勿同时删除多列数据');
|
|
|
+
|
|
|
+ const data = { postType: 'update', postData: [] };
|
|
|
+ for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow ++) {
|
|
|
+ const node = sheet.zh_tree.nodes[iRow];
|
|
|
+ if (node && (!node.pay_type || col.field === 'postil')) {
|
|
|
+ const updateData = { id: node.id };
|
|
|
+ switch(col.field) {
|
|
|
+ case 'tp':
|
|
|
+ updateData.tp = 0;
|
|
|
+ updateData.expr = '';
|
|
|
+ break;
|
|
|
+ case 'start_tp':
|
|
|
+ updateData.start_tp = 0;
|
|
|
+ updateData.start_expr = '';
|
|
|
+ break;
|
|
|
+ case 'range_tp':
|
|
|
+ updateData.range_tp = 0;
|
|
|
+ updateData.range_expr = '';
|
|
|
+ break;
|
|
|
+ case 'is_gather':
|
|
|
+ updateData.is_gather = 0;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ updateData[col.field] = col.type === 'Number' ? 0 : '';
|
|
|
+ }
|
|
|
+ data.postData.push(updateData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ postData('update', data, function (result) {
|
|
|
+ if (result.reload) {
|
|
|
+ payEvent.reloadPays(result.reload);
|
|
|
+ } else {
|
|
|
+ const refreshData = payTree.loadPostData(result);
|
|
|
+ payEvent.refreshTree(refreshData);
|
|
|
+ }
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, sel.row, sel.rowCount);
|
|
|
+ });
|
|
|
+ },
|
|
|
baseOpr: function(type) {
|
|
|
const self = this;
|
|
|
const node = SpreadJsObj.getSelectObject(sheet);
|
|
@@ -638,6 +710,8 @@ $(document).ready(() => {
|
|
|
if (!readOnly) {
|
|
|
spread.bind(spreadNS.Events.EditStarting, payEvent.editStarting);
|
|
|
spread.bind(spreadNS.Events.EditEnded, payEvent.editEnded);
|
|
|
+ spread.bind(spreadNS.Events.ButtonClicked, payEvent.buttonClicked);
|
|
|
+ SpreadJsObj.addDeleteBind(spread, payEvent.deletePress);
|
|
|
$('a[name="base-opr"]').click(function () {
|
|
|
payEvent.baseOpr(this.getAttribute('type'));
|
|
|
});
|