|
@@ -254,6 +254,16 @@ $(document).ready(() => {
|
|
|
};
|
|
|
const stagePos = new StagePosData(stagePosSetting);
|
|
|
|
|
|
+ const reloadCooperationHtml = function () {
|
|
|
+ const html = [];
|
|
|
+ for (const p of stageTree.pwd) {
|
|
|
+ html.push('<tr>', `<td>${p.node.code}</td>`, `<td>${p.node.name}</td>`);
|
|
|
+ html.push('<td>', p.check ? `已解锁:${p.pwd}` : `<a name="ledger-unlock" lid="${p.ledger_id}" href="javascript: void(0);">解锁</a>`, '</td>');
|
|
|
+ html.push('</tr>');
|
|
|
+ }
|
|
|
+ $('#cooperationList').html(html.join(''));
|
|
|
+ };
|
|
|
+
|
|
|
class Changes {
|
|
|
constructor(obj) {
|
|
|
const self = this;
|
|
@@ -546,7 +556,7 @@ $(document).ready(() => {
|
|
|
const ratioCol = ledgerSpreadSetting.cols.find(x => {return x.field === 'end_gather_percent' || x.field === 'end_correct_percent'});
|
|
|
ratioCol.field = tenderInfo.display.stage.correct ? 'end_correct_percent' : 'end_gather_percent';
|
|
|
ledgerSpreadSetting.imageClick = function (data) {
|
|
|
- if (data.children && data.children.length > 0) return;
|
|
|
+ if (data.children && data.children.length > 0 || data.lock) return;
|
|
|
|
|
|
const nodePos = stagePos.getLedgerPos(data.id);
|
|
|
if (nodePos && nodePos.length > 0) return;
|
|
@@ -621,6 +631,10 @@ $(document).ready(() => {
|
|
|
},
|
|
|
},
|
|
|
];
|
|
|
+ ledgerSpreadSetting.readOnly = function (data) {
|
|
|
+ if (!data) return false;
|
|
|
+ return data.lock || false;
|
|
|
+ };
|
|
|
SpreadJsObj.initSheet(slSpread.getActiveSheet(), ledgerSpreadSetting);
|
|
|
slSpread.getActiveSheet().frozenColumnCount(5);
|
|
|
slSpread.getActiveSheet().options.frozenlineColor = '#93b5e4';
|
|
@@ -1411,7 +1425,9 @@ $(document).ready(() => {
|
|
|
* 加载计量单元 根据当前台账选择节点
|
|
|
*/
|
|
|
loadCurPosData: function () {
|
|
|
- const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ const sheet = slSpread.getActiveSheet();
|
|
|
+ const node = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ if (node.lock) spSpread.getActiveSheet().zh_setting.readOnly = node.lock;
|
|
|
if (node) {
|
|
|
const posData = stagePos.ledgerPos[itemsPre + node.id] || [];
|
|
|
SpreadJsObj.loadSheetData(spSpread.getActiveSheet(), 'data', posData);
|
|
@@ -1683,6 +1699,8 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
deletePress: function (sheet) {
|
|
|
+ if (sheet.zh_setting.readOnly) return;
|
|
|
+
|
|
|
if (sheet.zh_setting && sheet.zh_data) {
|
|
|
const sortData = sheet.zh_data;
|
|
|
if (!sortData || sortData.length === 0) { return; }
|
|
@@ -1797,12 +1815,18 @@ $(document).ready(() => {
|
|
|
});
|
|
|
|
|
|
// 加载计量单元数据 - 暂时统一加载,如有需要,切换成动态加载并缓存
|
|
|
- postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;tag' }, function (result) {
|
|
|
+ postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;tag;cooperation' }, function (result) {
|
|
|
// 加载树结构
|
|
|
stageTree.loadDatas(result.ledgerData);
|
|
|
// stageTree.loadCurStageData(curStageData);
|
|
|
// stageTree.loadPreStageData(preStageData);
|
|
|
treeCalc.calculateAll(stageTree);
|
|
|
+ // 加载解锁相关
|
|
|
+ if (result.cooperation) {
|
|
|
+ stageTree.loadPwd(result.cooperation, 'bills-p-' + userID + '-' + window.location.pathname.split('/')[2]);
|
|
|
+ $('#cooperationCount').html(stageTree.pwd.length || '');
|
|
|
+ reloadCooperationHtml();
|
|
|
+ }
|
|
|
// 加载部位明细
|
|
|
stagePos.loadDatas(result.posData);
|
|
|
stagePos.calculateAll();
|
|
@@ -1889,6 +1913,9 @@ $(document).ready(() => {
|
|
|
return !checkTzMeasureType();
|
|
|
},
|
|
|
disabled: function (key, opt) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ if (!node || node.lock) return true;
|
|
|
+
|
|
|
const sheet = spSpread.getActiveSheet();
|
|
|
if (sheet.zh_data && !readOnly) {
|
|
|
const selection = sheet.getSelections();
|
|
@@ -1925,7 +1952,7 @@ $(document).ready(() => {
|
|
|
},
|
|
|
disabled: function (key, opt) {
|
|
|
const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
- return _.isNil(node) || _.isNil(node.b_code) || node.b_code === '';
|
|
|
+ return _.isNil(node) || _.isNil(node.b_code) || node.b_code === '' || node.lock;
|
|
|
},
|
|
|
callback: function (key, opt) {
|
|
|
mergePeg.show();
|
|
@@ -1937,6 +1964,10 @@ $(document).ready(() => {
|
|
|
const data = spSpread.getActiveSheet().zh_data;
|
|
|
return data && data.length > 0;
|
|
|
},
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const node = SpreadJsObj.getSelectObject(slSpread.getActiveSheet());
|
|
|
+ return node.lock;
|
|
|
+ },
|
|
|
callback: function (key, opt) {
|
|
|
$('#cbr-ratio').val('');
|
|
|
$('#apply2sibling')[0].checked = false;
|
|
@@ -3910,4 +3941,38 @@ $(document).ready(() => {
|
|
|
}
|
|
|
stageTreeSpreadObj.measureByBatch(posName, ratio, apply2sibling);
|
|
|
});
|
|
|
+
|
|
|
+ $('body').on('click', '[name=ledger-unlock]', function() {
|
|
|
+ $('#cooperation').modal('hide');
|
|
|
+ const lid = this.getAttribute('lid');
|
|
|
+ if (!lid) return;
|
|
|
+
|
|
|
+ const p = stageTree.pwd.find(x => {return x.ledger_id == lid});
|
|
|
+ if (!p) return;
|
|
|
+
|
|
|
+ $('#unlock-info').html(`${p.node.code} ${p.node.name} 解锁密码<b class="text-danger">*</b>`);
|
|
|
+ $('#unlock-pwd').val('').removeClass('is-invalid');
|
|
|
+ $('.invalid-feedback', '#unlock').hide();
|
|
|
+ $('.alert-warning', '#unlock').hide();
|
|
|
+ $('#unlock-ok').attr('lid', lid);
|
|
|
+ $('#unlock').modal('show');
|
|
|
+ });
|
|
|
+ $('#unlock-ok').click(function () {
|
|
|
+ const lid = this.getAttribute('lid');
|
|
|
+ if (!lid) return;
|
|
|
+
|
|
|
+ const p = stageTree.pwd.find(x => {return x.ledger_id == lid});
|
|
|
+ if (!p) return;
|
|
|
+
|
|
|
+ if (p.pwd === $('#unlock-pwd').val()) {
|
|
|
+ const refresh = stageTree.lockNode(p, false);
|
|
|
+ SpreadJsObj.reloadRowsReadonly(slSpread.getActiveSheet(), refresh);
|
|
|
+ $('#unlock').modal('hide');
|
|
|
+ reloadCooperationHtml();
|
|
|
+ } else {
|
|
|
+ $('#unlock-pwd').addClass('is-invalid');
|
|
|
+ $('.invalid-feedback', '#unlock').show();
|
|
|
+ $('.alert-warning', '#unlock').show();
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|