|
@@ -94,6 +94,7 @@ let searchCodeList = [];
|
|
|
$(document).ready(() => {
|
|
|
const changeSpreadSetting = {
|
|
|
cols: [
|
|
|
+ {title: '计价', colSpan: '1', rowSpan: '2', field: 'is_valuation', hAlign: 1, width: 50, cellType: 'checkbox', readOnly: false},
|
|
|
{title: '清单编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
|
{title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit2'},
|
|
|
{title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit2', cellType: 'unit', comboItems: changeUnits, comboEdit: true},
|
|
@@ -182,6 +183,8 @@ $(document).ready(() => {
|
|
|
// 增加汇总行并设为锁定禁止编辑状态
|
|
|
changeSpreadSheet.addRows(changeSpreadSheet.getRowCount(), 1);
|
|
|
changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 0, '合计');
|
|
|
+ const cellType1 = new GC.Spread.Sheets.CellTypes.Text();
|
|
|
+ changeSpreadSheet.getCell(changeSpreadSheet.getRowCount() - 1, 0).cellType(cellType1);
|
|
|
changeSpreadSheet.setStyle(changeSpreadSheet.getRowCount() - 1, -1, style1);
|
|
|
changeSpreadObj.countSum();
|
|
|
},
|
|
@@ -191,13 +194,13 @@ $(document).ready(() => {
|
|
|
cSum = 0,
|
|
|
cdSum = 0;
|
|
|
for(var i = 0; i < rowCount - 1; i++){
|
|
|
- oSum = ZhCalc.add(oSum, changeSpreadSheet.getValue(i, 7));
|
|
|
- cSum = ZhCalc.add(cSum, changeSpreadSheet.getValue(i, 9));
|
|
|
- cdSum = ZhCalc.add(cdSum, changeSpreadSheet.getValue(i, 11));
|
|
|
+ oSum = ZhCalc.add(oSum, changeSpreadSheet.getValue(i, 8));
|
|
|
+ cSum = ZhCalc.add(cSum, changeSpreadSheet.getValue(i, 10));
|
|
|
+ cdSum = ZhCalc.add(cdSum, changeSpreadSheet.getValue(i, 12));
|
|
|
}
|
|
|
- changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 7, oSum !== 0 ? oSum : null);
|
|
|
- changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 9, cSum !== 0 ? cSum : null);
|
|
|
- changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 11, cdSum !== 0 ? cdSum : null);
|
|
|
+ changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 8, oSum !== 0 ? oSum : null);
|
|
|
+ changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 10, cSum !== 0 ? cSum : null);
|
|
|
+ changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 12, cdSum !== 0 ? cdSum : null);
|
|
|
},
|
|
|
add: function () {
|
|
|
let select = null;
|
|
@@ -236,6 +239,8 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/save', {type: 'batchadd', num, postData: select ? select.order : null}, function (result) {
|
|
|
if (result) {
|
|
|
changeList = result;
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(changeSpreadSetting, changeCol);
|
|
|
+ SpreadJsObj.initSheet(changeSpreadSheet, changeSpreadSetting);
|
|
|
SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
|
|
|
changeSpreadObj.makeSjsFooter();
|
|
|
changeSpreadObj.resetXmjSpread();
|
|
@@ -453,7 +458,7 @@ $(document).ready(() => {
|
|
|
if (info.sheet.zh_setting) {
|
|
|
const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
const col = info.sheet.zh_setting.cols[info.col];
|
|
|
- if (col.field === 'del_list') {
|
|
|
+ if (col.field === 'del_list' || col.field === 'is_valuation') {
|
|
|
return;
|
|
|
}
|
|
|
let validText = is_numeric(info.editingText) && _.indexOf(numField, col.field) !== -1 ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : '');
|
|
@@ -684,6 +689,27 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
});
|
|
|
},
|
|
|
+ buttonClicked: function (e, info) {
|
|
|
+ if (info.sheet.zh_setting) {
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field === 'is_valuation') {
|
|
|
+ if (info.sheet.isEditing()) {
|
|
|
+ info.sheet.endEdit(true);
|
|
|
+ }
|
|
|
+ select.is_valuation = info.sheet.getValue(info.row, info.col) ? 0 : 1;
|
|
|
+ delete select.waitingLoading;
|
|
|
+ // 更新至服务器
|
|
|
+ postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
|
|
|
+ changeList.splice(info.row, 1, select);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ }, function () {
|
|
|
+ select.is_valuation = info.sheet.getValue(info.row, info.col) ? 1 : 0;
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
valueChanged(e, info) {
|
|
|
// 防止ctrl+z撤销数据
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
@@ -934,8 +960,9 @@ $(document).ready(() => {
|
|
|
changeSpread.bind(spreadNS.Events.SelectionChanged, changeSpreadObj.selectionChanged);
|
|
|
changeSpread.bind(spreadNS.Events.ClipboardPasted, changeSpreadObj.clipboardPasted);
|
|
|
changeSpread.bind(spreadNS.Events.ValueChanged, changeSpreadObj.valueChanged);
|
|
|
+ changeSpread.bind(spreadNS.Events.ButtonClicked, changeSpreadObj.buttonClicked);
|
|
|
SpreadJsObj.addDeleteBind(changeSpread, changeSpreadObj.deletePress);
|
|
|
- changeSpreadSheet.getCell(-1, 12).foreColor('#dc3545');
|
|
|
+ changeSpreadSheet.getCell(-1, 13).foreColor('#dc3545');
|
|
|
const delCommand = {
|
|
|
canUndo: false,
|
|
|
execute: function (context, options, isUndo) {
|
|
@@ -1387,7 +1414,10 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/save', { type:'ledger_list', updateData: newLedgerList, postData: select ? select.order : null }, function (result) {
|
|
|
changeList = result.changeList;
|
|
|
changeUsedData = result.usedList;
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(changeSpreadSetting, changeCol);
|
|
|
+ SpreadJsObj.initSheet(changeSpreadSheet, changeSpreadSetting);
|
|
|
SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
|
|
|
+ // SpreadJsObj.reLoadSheetData(changeSpreadSheet);
|
|
|
changeSpreadObj.makeSjsFooter();
|
|
|
const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
|
|
|
changeSpreadObj.resetXmjSpread(select);
|
|
@@ -2198,6 +2228,7 @@ function remakeChangeSpread(cOrder = changeOrder) {
|
|
|
xmj_fxgc,
|
|
|
gcl_id,
|
|
|
mx_id,
|
|
|
+ is_valuation: 1,
|
|
|
};
|
|
|
const radionInfo = changeList.find(function (info) {
|
|
|
//return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id)) && parseInt(info.oamount) === parseInt(oamount);
|
|
@@ -2207,6 +2238,7 @@ function remakeChangeSpread(cOrder = changeOrder) {
|
|
|
trlist.camount = radionInfo.camount;
|
|
|
trlist.camount_expr = radionInfo.camount_expr;
|
|
|
trlist.detail = radionInfo.detail;
|
|
|
+ trlist.is_valuation = radionInfo.is_valuation;
|
|
|
}
|
|
|
newTableList.push(trlist);
|
|
|
}
|