|
|
@@ -5166,6 +5166,7 @@ $(document).ready(() => {
|
|
|
opinion: $(`${'#sp-back'}`).find('[name=opinion]').val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '),
|
|
|
coop_checked: confirm && confirm.length > 0 ? confirm.map(x => { return x.id; }) : [],
|
|
|
checkType,
|
|
|
+ audit_locked_lid: $('[name=audit_locked_lid]').val(),
|
|
|
};
|
|
|
if ($('#warning-text').length) $('#warning-text').remove();
|
|
|
if (!checkType && !$('#warning-text').length) {
|
|
|
@@ -5473,6 +5474,118 @@ $(document).ready(() => {
|
|
|
stageAssistRela.refreshAssistTable();
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ // 审批退回锁定
|
|
|
+ const spBackLock = (function(){
|
|
|
+ let lockSpread, lockSheet, lockTree;
|
|
|
+ const getLockedLid = function() {
|
|
|
+ if (!lockTree) return '';
|
|
|
+ const lockedLid = lockTree.nodes.filter(x => { return x.locked; }).map(y => { return y.ledger_id; });
|
|
|
+ if (lockedLid.length > 200) throw '锁定的节点过多,请尽量在父项锁定数据';
|
|
|
+ return lockedLid.join(',');
|
|
|
+ };
|
|
|
+ const init = function(setting) {
|
|
|
+ if (lockSpread) return;
|
|
|
+ lockSpread = SpreadJsObj.createNewSpread($('#sp-lock-spread')[0]);
|
|
|
+ lockSheet = lockSpread.getActiveSheet();
|
|
|
+ const spreadSetting = {
|
|
|
+ cols: [
|
|
|
+ {title: '锁定', colSpan: '1', rowSpan: '1', field: 'locked', hAlign: 1, width: 60, cellType: 'checkbox'},
|
|
|
+ {title: '项目节编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 145, formatter: '@', cellType: 'tree'},
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '1', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 185, formatter: '@', },
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '1', field: 'unit_price', hAlign: 2, width: 60, type: 'Number',},
|
|
|
+ {title: '本期合同金额', colSpan: '1', rowSpan: '1', field: 'contract_tp', hAlign: 2, width: 100, type: 'Number'},
|
|
|
+ {title: '本期变更金额', colSpan: '1', rowSpan: '1', field: 'qc_tp', hAlign: 2, width: 100, type: 'Number'},
|
|
|
+ {title: '本期完成金额', colSpan: '1', rowSpan: '1', field: 'gather_tp', hAlign: 2, width: 100, type: 'Number'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ frozenLineColor: '#93b5e4',
|
|
|
+ readOnly: true,
|
|
|
+ };
|
|
|
+ sjsSettingObj.setFxTreeStyle(spreadSetting, sjsSettingObj.FxTreeStyle.jz);
|
|
|
+ SpreadJsObj.initSheet(lockSheet, spreadSetting);
|
|
|
+ lockTree = createNewPathTree('stage', {
|
|
|
+ id: 'ledger_id', pid: 'ledger_pid', order: 'order',
|
|
|
+ level: 'level', rootId: -1,
|
|
|
+ keys: ['id', 'tender_id', 'ledger_id'],
|
|
|
+ stageId: 'id',
|
|
|
+ calcFields: [],
|
|
|
+ });
|
|
|
+ const lockDatas = setting.tree.datas.map(y => {
|
|
|
+ return {
|
|
|
+ id: y.id, tender_id: y.tender_id,
|
|
|
+ ledger_id: y.ledger_id, ledger_pid: y.ledger_pid, order: y.order,
|
|
|
+ level: y.level, is_leaf: y.is_leaf, full_path: y.full_path,
|
|
|
+ code: y.code, b_code: y.b_code, name: y.name, unit: y.unit,
|
|
|
+ unit_price: y.unit_price, quantity: y.quantity, total_price: y.total_price,
|
|
|
+ contract_tp: y.contract_tp, qc_tp: y.qc_tp, gather_tp: y.gather_tp,
|
|
|
+ filter: y.filter, _fixed: y._fixed, locked: 0,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ lockTree.loadDatas(lockDatas);
|
|
|
+ lockTree.refreshNodeVisible();
|
|
|
+ SpreadJsObj.loadSheetData(lockSheet, SpreadJsObj.DataType.Tree, lockTree);
|
|
|
+
|
|
|
+ lockSpread.bind(spreadNS.Events.ButtonClicked, function(e, info) {
|
|
|
+ if (!info.sheet.zh_setting || !info.sheet.zh_tree) return;
|
|
|
+
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field !== 'locked') return;
|
|
|
+
|
|
|
+ const node = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ if (node._fixed) {
|
|
|
+ toastr.warning('无权锁定该节点,如需锁定,请在子项尝试');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!node.locked) {
|
|
|
+ const parents = info.sheet.zh_tree.getAllParents(node);
|
|
|
+ if (parents.find(x => { return x.locked; })) {
|
|
|
+ toastr.warning('父项已锁定,请勿在子项重复锁定');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ node.locked = !node.locked;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row, 1);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#sp-lock-ok').click(function() {
|
|
|
+ setting.callback(getLockedLid());
|
|
|
+ $('#sp-lock').modal('hide');
|
|
|
+ $('#sp-back').modal('show');
|
|
|
+ });
|
|
|
+ $('#sp-lock').on('shown.bs.modal', function() {
|
|
|
+ lockSpread.refresh();
|
|
|
+ });
|
|
|
+ };
|
|
|
+ const loadLockedLid = function(lid) {
|
|
|
+ if (!lid) return;
|
|
|
+ const lidList = lid.split(',');
|
|
|
+ lockTree.nodes.forEach(x => {
|
|
|
+ if (lidList.indexOf(x.ledger_id + '') >= 0) x.locked = 1;
|
|
|
+ })
|
|
|
+ };
|
|
|
+ const show = function(setting) {
|
|
|
+ init(setting);
|
|
|
+ loadLockedLid(setting.locked_lid);
|
|
|
+ $('#sp-back').modal('hide');
|
|
|
+ $('#sp-lock').modal('show');
|
|
|
+ };
|
|
|
+ return { show }
|
|
|
+ })();
|
|
|
+ $('#sp-back-lock').click(function(){
|
|
|
+ spBackLock.show({
|
|
|
+ tree: stageTree,
|
|
|
+ locked_lid: $('[name=audit_locked_lid]').val(),
|
|
|
+ callback: function(lid) { $('[name=audit_locked_lid]').val(lid) },
|
|
|
+ })
|
|
|
+ });
|
|
|
});
|
|
|
function makeOneShouFang(sf) {
|
|
|
const lData = _.find(ledgerData, { id: sf.lid });
|