|
|
@@ -99,7 +99,7 @@ $(document).ready(() => {
|
|
|
},
|
|
|
readOnly: {
|
|
|
isChangeAdd: function (data) {
|
|
|
- return !readOnly && !data.formc;
|
|
|
+ return ledgering || (!readOnly && !data.formc);
|
|
|
},
|
|
|
isChangeList: function (data) {
|
|
|
if (!data) return true;
|
|
|
@@ -146,7 +146,7 @@ $(document).ready(() => {
|
|
|
},
|
|
|
readOnly: {
|
|
|
isChangeAdd: function (data) {
|
|
|
- return !readOnly && !data.formc && (!data.settle_status || (data.settle_status && data.settle_status === settleStatus.finish));
|
|
|
+ return ledgering || (!readOnly && !data.formc && (!data.settle_status || (data.settle_status && data.settle_status === settleStatus.finish)));
|
|
|
},
|
|
|
isChangeList: function (data) {
|
|
|
if (!data) return true;
|
|
|
@@ -382,16 +382,16 @@ $(document).ready(() => {
|
|
|
}
|
|
|
|
|
|
if (col.field.indexOf('dgn') >= 0) {
|
|
|
- $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (_.isString(data.b_code) && data.b_code !== '') || !data.formc);
|
|
|
+ $('#bills-expr').attr('readOnly', ledgering || readOnly || cell.locked() || (_.isString(data.b_code) && data.b_code !== '') || !data.formc);
|
|
|
} else if (col.field === 'unit_price') {
|
|
|
- $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0) || (_.isBoolean(data.used) && data.used === true) || !data.formc);
|
|
|
+ $('#bills-expr').attr('readOnly', ledgering || readOnly || cell.locked() || (data.children && data.children.length > 0) || (_.isBoolean(data.used) && data.used === true) || !data.formc);
|
|
|
} else {
|
|
|
const nodePos = pos.getLedgerPos(data.id);
|
|
|
if (nodePos && nodePos.length > 0) {
|
|
|
$('#bills-expr').val('').attr('readOnly', true);
|
|
|
$('#bills-expr').removeAttr('data-row');
|
|
|
} else {
|
|
|
- $('#bills-expr').attr('readOnly', readOnly || cell.locked() || (data.children && data.children.length > 0) || !data.formc);
|
|
|
+ $('#bills-expr').attr('readOnly', ledgering || readOnly || cell.locked() || (data.children && data.children.length > 0) || !data.formc);
|
|
|
}
|
|
|
}
|
|
|
$('#bills-expr').attr('data-row', sel.row);
|
|
|
@@ -577,6 +577,7 @@ $(document).ready(() => {
|
|
|
* @param spread
|
|
|
*/
|
|
|
baseOpr: function (sheet, type, addCount = 1) {
|
|
|
+ if (ledgering) return;
|
|
|
const self = this;
|
|
|
const [tree, node, count] = this.getDefaultSelectInfo(sheet);
|
|
|
if (!tree || !node || !count) return;
|
|
|
@@ -870,6 +871,10 @@ $(document).ready(() => {
|
|
|
if (col.field === 'is_change' || col.field === 'is_valuation' || col.field === 'is_new_price') {
|
|
|
return;
|
|
|
}
|
|
|
+ if (ledgering && col.field !== 'camount') {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
const sortData = info.sheet.zh_dataType === 'tree' ? info.sheet.zh_tree.nodes : info.sheet.zh_data;
|
|
|
const node = sortData[info.row];
|
|
|
if (col.field === 'camount') {
|
|
|
@@ -1185,6 +1190,7 @@ $(document).ready(() => {
|
|
|
for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
const curCol = info.cellRange.col + iCol;
|
|
|
const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
+ if (ledgering && colSetting.field !== 'camount') continue;
|
|
|
const value = colSetting.wordWrap ? pasteData[iRow-filterRow][iCol] : trimInvalidChar(pasteData[iRow-filterRow][iCol]);
|
|
|
if (node.children && node.children.length > 0 && invalidFields.parent.indexOf(colSetting.field) >= 0) {
|
|
|
toastMessageUniq(hint.parent);
|
|
|
@@ -1561,6 +1567,7 @@ $(document).ready(() => {
|
|
|
const col = sheet.zh_setting.cols[iCol];
|
|
|
const style = sheet.getStyle(iRow, iCol);
|
|
|
if (style.locked || (['dgn_qty1', 'dgn_qty2'].indexOf(col.field) >= 0 && node.b_code)) continue;
|
|
|
+ if (ledgering && col.field !== 'camount') continue;
|
|
|
if (col.type === 'Number' && node.settle_status === settleStatus.finish) continue;
|
|
|
|
|
|
if (['dgn_qty1', 'dgn_qty2', 'camount'].indexOf(col.field) < 0 && sheet.zh_tree.checkNodeUsed(node, pos)) {
|
|
|
@@ -1637,6 +1644,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
pasteBlock: function (spread, copyInfo) {
|
|
|
+ if (ledgering) return;
|
|
|
const self = this;
|
|
|
const sheet = spread.getActiveSheet();
|
|
|
const [tree, node] = this.getDefaultSelectInfo(spread.getActiveSheet());
|
|
|
@@ -1779,6 +1787,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
sortCode: function (sheet) {
|
|
|
+ if (ledgering) return;
|
|
|
const tree = sheet.zh_tree;
|
|
|
if (!tree) return;
|
|
|
|
|
|
@@ -1963,15 +1972,17 @@ $(document).ready(() => {
|
|
|
billsSpread.bind(spreadNS.Events.topRowChanged, billsTreeSpreadObj.topRowChanged);
|
|
|
if (!readOnly) {
|
|
|
// 增删上下移升降级
|
|
|
- $('a[name="base-opr"]').click(function () {
|
|
|
- billsTreeSpreadObj.baseOpr(billsSheet, this.getAttribute('type'));
|
|
|
- });
|
|
|
- $('a[name=cpc]').click(function () {
|
|
|
- billsSpread.commandManager().execute({
|
|
|
- cmd: this.getAttribute('type'),
|
|
|
- sheetName: billsSheet.name()
|
|
|
+ if (!ledgering) {
|
|
|
+ $('a[name="base-opr"]').click(function () {
|
|
|
+ billsTreeSpreadObj.baseOpr(billsSheet, this.getAttribute('type'));
|
|
|
});
|
|
|
- });
|
|
|
+ $('a[name=cpc]').click(function () {
|
|
|
+ billsSpread.commandManager().execute({
|
|
|
+ cmd: this.getAttribute('type'),
|
|
|
+ sheetName: billsSheet.name()
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
$('#bills-expr').bind('change onblur', function () {
|
|
|
if (this.readOnly) return;
|
|
|
@@ -2143,7 +2154,7 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.Clipboard.setCopyData(copyText);
|
|
|
});
|
|
|
SpreadJsObj.addDeleteBind(billsSpread, billsTreeSpreadObj.deletePress);
|
|
|
- SpreadJsObj.addCutEvents(billsSpread, billsTreeSpreadObj.cut);
|
|
|
+ if (!ledgering) SpreadJsObj.addCutEvents(billsSpread, billsTreeSpreadObj.cut);
|
|
|
}
|
|
|
// 右键菜单
|
|
|
let batchInsertObj;
|
|
|
@@ -2181,7 +2192,7 @@ $(document).ready(() => {
|
|
|
},
|
|
|
items: {}
|
|
|
};
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly && !ledgering) {
|
|
|
billsContextMenuOptions.items.create = {
|
|
|
name: '新增',
|
|
|
icon: 'fa-sign-in',
|
|
|
@@ -2327,7 +2338,7 @@ $(document).ready(() => {
|
|
|
return select && select.level <= 1;
|
|
|
}
|
|
|
};
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly && !ledgering) {
|
|
|
billsContextMenuOptions.items.pasteBlock = {
|
|
|
name: '粘贴整块',
|
|
|
icon: 'fa-clipboard',
|
|
|
@@ -2351,7 +2362,7 @@ $(document).ready(() => {
|
|
|
};
|
|
|
billsContextMenuOptions.items.sprBlock = '----';
|
|
|
}
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly && !ledgering) {
|
|
|
billsContextMenuOptions.items.batchInsert = {
|
|
|
name: '批量插入',
|
|
|
type: 'batchInsert',
|
|
|
@@ -2498,7 +2509,7 @@ $(document).ready(() => {
|
|
|
? (data[exprInfo.expr] ? data[exprInfo.expr] : data[col.field])
|
|
|
: data[col.field];
|
|
|
$('#pos-expr').val(value).attr('field', col.field).attr('org', data[col.field])
|
|
|
- .attr('readOnly', readOnly || !data.formc || data.settle_status === settleStatus.finish).attr('data-row', sel.row);
|
|
|
+ .attr('readOnly', ledgering || readOnly || !data.formc || data.settle_status === settleStatus.finish).attr('data-row', sel.row);
|
|
|
} else {
|
|
|
$('#pos-expr').val('').attr('readOnly', true);
|
|
|
$('#pos-expr').removeAttr('data-row');
|
|
|
@@ -2529,7 +2540,7 @@ $(document).ready(() => {
|
|
|
posSheet.zh_setting.cols.forEach(function (col, i) {
|
|
|
for (let iRow = 0; iRow < posSheet.getRowCount(); iRow++) {
|
|
|
if (i !== 0 && col.field !== 'camount' && col.field !== 'is_valuation') {
|
|
|
- posSheet.getCell(iRow, i).locked((posSheet.zh_data[iRow] && !posSheet.zh_data[iRow].formc) || posSheet.zh_setting.readOnly || false);
|
|
|
+ posSheet.getCell(iRow, i).locked(ledgering || (posSheet.zh_data[iRow] && !posSheet.zh_data[iRow].formc) || posSheet.zh_setting.readOnly || false);
|
|
|
} else {
|
|
|
let lock = false;
|
|
|
if (!posSheet.zh_data[iRow]) {
|
|
|
@@ -2549,6 +2560,7 @@ $(document).ready(() => {
|
|
|
posSpreadObj.refreshOperationValid(posSheet);
|
|
|
},
|
|
|
baseOpr: function (sheet, type) {
|
|
|
+ if (ledgering) return;
|
|
|
const data = {
|
|
|
postType: 'pos',
|
|
|
posPostType: type === 'delete' ? type : 'update',
|
|
|
@@ -2800,6 +2812,10 @@ $(document).ready(() => {
|
|
|
if (col.field === 'is_change' || col.field === 'is_valuation') {
|
|
|
return;
|
|
|
}
|
|
|
+ if (ledgering && col.field !== 'camount') {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (col.field === 'camount') {
|
|
|
if (!node) {
|
|
|
toastr.error('数据错误,请选择台账节点后再试');
|
|
|
@@ -3107,6 +3123,7 @@ $(document).ready(() => {
|
|
|
const cData = {};
|
|
|
for (let iCol = sel.col; iCol < sel.col + sel.colCount; iCol++) {
|
|
|
const colSetting = sheet.zh_setting.cols[iCol];
|
|
|
+ if (ledgering && colSetting.field !== 'camount') continue;
|
|
|
if (colSetting.field === 'name') {
|
|
|
toastr.error('部位名称不能为空');
|
|
|
return;
|
|
|
@@ -3210,6 +3227,7 @@ $(document).ready(() => {
|
|
|
* @param sheet
|
|
|
*/
|
|
|
deletePos: function (sheet) {
|
|
|
+ if (ledgering) return;
|
|
|
const selection = sheet.getSelections();
|
|
|
const data = {
|
|
|
postType: 'pos',
|
|
|
@@ -3313,13 +3331,14 @@ $(document).ready(() => {
|
|
|
const lastOrder = sortData.length > 0 ? sortData[sortData.length - 1].porder + 1 : 1;
|
|
|
makeGclGatherData();
|
|
|
for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
|
|
|
- let bPaste = true;
|
|
|
+ let bPaste = !ledgering;
|
|
|
const curRow = info.cellRange.row + iRow;
|
|
|
const posData = curRow >= sortData.length ? {lid: node.id, porder: lastOrder + curRow - sortData.length} : {id: sortData[curRow].id, lid: node.id};
|
|
|
for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
|
|
|
const curCol = info.cellRange.col + iCol;
|
|
|
const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
if (!colSetting) continue;
|
|
|
+ if (ledgering && colSetting.field !== 'camount') continue;
|
|
|
|
|
|
posData[colSetting.field] = colSetting.wordWrap ? info.sheet.getText(curRow, curCol) : trimInvalidChar(info.sheet.getText(curRow, curCol));
|
|
|
if (posData.id && colSetting.type === 'Number' && sortData[curRow].settle_status === settleStatus.finish) {
|
|
|
@@ -3504,6 +3523,7 @@ $(document).ready(() => {
|
|
|
posSpreadObj.refreshOperationValid(posSheet);
|
|
|
},
|
|
|
addPegs: function (pegs) {
|
|
|
+ if (ledgering) return;
|
|
|
if (!pegs || pegs.length <= 0) return;
|
|
|
const node = SpreadJsObj.getSelectObject(billsSheet);
|
|
|
if (!node) return;
|
|
|
@@ -3524,9 +3544,11 @@ $(document).ready(() => {
|
|
|
};
|
|
|
posSpread.bind(spreadNS.Events.SelectionChanged, posSpreadObj.selectionChanged);
|
|
|
if (!readOnly) {
|
|
|
- $('a[name="pos-opr"]').click(function () {
|
|
|
- posSpreadObj.baseOpr(posSheet, this.getAttribute('type'));
|
|
|
- });
|
|
|
+ if (!ledgering) {
|
|
|
+ $('a[name="pos-opr"]').click(function () {
|
|
|
+ posSpreadObj.baseOpr(posSheet, this.getAttribute('type'));
|
|
|
+ });
|
|
|
+ }
|
|
|
$('#pos-expr').bind('change onblur', function () {
|
|
|
if (this.readOnly) return;
|
|
|
|
|
|
@@ -3688,39 +3710,41 @@ $(document).ready(() => {
|
|
|
posSpread.bind(spreadNS.Events.ClipboardPasted, posSpreadObj.clipboardPasted);
|
|
|
SpreadJsObj.addDeleteBind(posSpread, posSpreadObj.deletePress);
|
|
|
|
|
|
- $.contextMenu({
|
|
|
- selector: '#pos-spread',
|
|
|
- build: function ($trigger, e) {
|
|
|
- const target = SpreadJsObj.safeRightClickSelection($trigger, e, posSpread);
|
|
|
- return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
- },
|
|
|
- items: {
|
|
|
- 'delete': {
|
|
|
- name: '删除',
|
|
|
- icon: 'fa-remove',
|
|
|
- disabled: function (key, opt) {
|
|
|
- if (posSheet.zh_data) {
|
|
|
- const selection = posSheet.getSelections();
|
|
|
- const sel = selection ? selection[0] : sheet.getSelections()[0];
|
|
|
- const row = sel ? sel.row : -1;
|
|
|
- const rowCount = sel.rowCount;
|
|
|
- let settleFinish = false;
|
|
|
- for (let i = row; i < row + rowCount; i++) {
|
|
|
- if (!posSheet.zh_data[i]) continue;
|
|
|
- settleFinish = settleFinish || posSheet.zh_data[i].settle_status === settleStatus.finish;
|
|
|
+ if (!ledgering) {
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#pos-spread',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, posSpread);
|
|
|
+ return target.hitTestType === spreadNS.SheetArea.viewport || target.hitTestType === spreadNS.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ 'delete': {
|
|
|
+ name: '删除',
|
|
|
+ icon: 'fa-remove',
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ if (posSheet.zh_data) {
|
|
|
+ const selection = posSheet.getSelections();
|
|
|
+ const sel = selection ? selection[0] : sheet.getSelections()[0];
|
|
|
+ const row = sel ? sel.row : -1;
|
|
|
+ const rowCount = sel.rowCount;
|
|
|
+ let settleFinish = false;
|
|
|
+ for (let i = row; i < row + rowCount; i++) {
|
|
|
+ if (!posSheet.zh_data[i]) continue;
|
|
|
+ settleFinish = settleFinish || posSheet.zh_data[i].settle_status === settleStatus.finish;
|
|
|
+ }
|
|
|
+ return (posSheet.zh_data.length < selection[0].row + selection[0].rowCount) || (posSheet.zh_data[selection[0].row] && !posSheet.zh_data[selection[0].row].formc) || settleFinish;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
}
|
|
|
- return (posSheet.zh_data.length < selection[0].row + selection[0].rowCount) || (posSheet.zh_data[selection[0].row] && !posSheet.zh_data[selection[0].row].formc) || settleFinish;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
+ },
|
|
|
+ callback: function (key, opt) {
|
|
|
+ posSpreadObj.deletePos(posSheet);
|
|
|
}
|
|
|
},
|
|
|
- callback: function (key, opt) {
|
|
|
- posSpreadObj.deletePos(posSheet);
|
|
|
- }
|
|
|
- },
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 加载清单&计量单元数据
|
|
|
@@ -3805,7 +3829,7 @@ $(document).ready(() => {
|
|
|
this.spreadSetting = spreadSetting;
|
|
|
this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly && !ledgering) {
|
|
|
this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
const dealSheet = info.sheet;
|
|
|
const mainSheet = billsSheet;
|
|
|
@@ -4218,7 +4242,7 @@ $(document).ready(() => {
|
|
|
this.spread = SpreadJsObj.createNewSpread($(`#cb-${spreadSetting.stdType}-spread`)[0]);
|
|
|
const searchSheet = this.spread.getActiveSheet();
|
|
|
SpreadJsObj.initSheet(searchSheet, this.spreadSetting);
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly && !ledgering) {
|
|
|
this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
const dealSheet = info.sheet;
|
|
|
const mainSheet = billsSheet;
|
|
|
@@ -4443,7 +4467,7 @@ $(document).ready(() => {
|
|
|
}, 100);
|
|
|
});
|
|
|
})(`a[name=${relaSelect.showLevel}]`, searchSheet);
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly && !ledgering) {
|
|
|
this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
|
|
|
const dealSheet = info.sheet;
|
|
|
const mainSheet = billsSheet;
|
|
|
@@ -4781,6 +4805,7 @@ $(document).ready(() => {
|
|
|
if (posSpread) posSpread.refresh();
|
|
|
|
|
|
const stdLibCellDoubleClick = function (updateData, stdNode, stdTree) {
|
|
|
+ if (ledgering) return;
|
|
|
const mainSheet = billsSheet;
|
|
|
if (!stdTree || !mainSheet.zh_tree) { return; }
|
|
|
|