|
@@ -65,8 +65,17 @@ $(document).ready(() => {
|
|
|
return a.order - b.order;
|
|
|
});
|
|
|
}
|
|
|
+ calculateAll() {
|
|
|
+ for (const d of this.data) {
|
|
|
+ d.end_arrive_qty = ZhCalc.add(d.pre_arrive_qty, d.arrive_qty);
|
|
|
+ d.end_arrive_tp = ZhCalc.add(d.pre_arrive_tp, d.arrive_tp);
|
|
|
+ d.end_deduct_qty = ZhCalc.add(d.pre_deduct_qty, d.deduct_qty);
|
|
|
+ d.end_deduct_tp = ZhCalc.add(d.pre_deduct_tp, d.deduct_tp);
|
|
|
+ }
|
|
|
+ }
|
|
|
loadDatas(datas) {
|
|
|
this.data = datas;
|
|
|
+ this.calculateAll();
|
|
|
this.resortData();
|
|
|
}
|
|
|
loadUpdateData(updateData) {
|
|
@@ -92,6 +101,7 @@ $(document).ready(() => {
|
|
|
return updateData.del.indexOf(d.id) >= 0;
|
|
|
});
|
|
|
}
|
|
|
+ this.calculateAll();
|
|
|
this.resortData();
|
|
|
}
|
|
|
}
|
|
@@ -156,13 +166,13 @@ $(document).ready(() => {
|
|
|
const sels = sheet.getSelections();
|
|
|
if (!sels || !sels[0]) return;
|
|
|
const hint = {
|
|
|
- isOld: {type: 'warning', msg: '该甲供材料为往期数据,不可删除'},
|
|
|
+ isOld: {type: 'warning', msg: '该甲供材料已计量,不可删除'},
|
|
|
invalidDel: {type: 'warning', msg: '该甲供材料不是您新增的,只有原报和新增人可删除'},
|
|
|
};
|
|
|
|
|
|
for (let iRow = sels[0].row, iLen = sels[0].row + sels[0].rowCount; iRow < iLen; iRow++) {
|
|
|
const node = sortData[iRow];
|
|
|
- if (node.add_sid === stageId) {
|
|
|
+ if (node.pre_used) {
|
|
|
toastMessageUniq(hint.isOld);
|
|
|
continue;
|
|
|
} else {
|
|
@@ -174,7 +184,7 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
if (datas.length > 0) {
|
|
|
- postData(window.location.pathname + '/update', {updateType: 'del', updateData: datas}, function (result) {
|
|
|
+ postData(window.location.pathname + '/update', {del: datas}, function (result) {
|
|
|
jgclObj.loadUpdateData(result);
|
|
|
SpreadJsObj.reLoadSheetData(jgclSheet);
|
|
|
}, function () {
|
|
@@ -213,7 +223,6 @@ $(document).ready(() => {
|
|
|
|
|
|
postData(window.location.pathname + '/update', data, function (result) {
|
|
|
jgclObj.loadUpdateData(result);
|
|
|
- //SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
SpreadJsObj.reLoadSheetData(info.sheet);
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
@@ -233,7 +242,7 @@ $(document).ready(() => {
|
|
|
case 'name':
|
|
|
case 'unit':
|
|
|
case 'unit_price':
|
|
|
- info.cancel = readOnly && node.add_sid !== stageId;
|
|
|
+ info.cancel = readOnly || node.pre_used;
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
@@ -266,7 +275,7 @@ $(document).ready(() => {
|
|
|
const colSetting = setting.cols[curCol];
|
|
|
const value = trimInvalidChar(pasteData[iRow][iCol]);
|
|
|
|
|
|
- if (col.field === 'name' && (!value || value === '')) {
|
|
|
+ if (colSetting.field === 'name' && (!value || value === '')) {
|
|
|
toastMessageUniq(hint.name);
|
|
|
break;
|
|
|
}
|
|
@@ -286,6 +295,7 @@ $(document).ready(() => {
|
|
|
data.id = node.id;
|
|
|
uDatas.push(data);
|
|
|
} else {
|
|
|
+ data.order = curRow + 1;
|
|
|
iDatas.push(data);
|
|
|
}
|
|
|
}
|
|
@@ -303,10 +313,32 @@ $(document).ready(() => {
|
|
|
}
|
|
|
},
|
|
|
upMove: function () {
|
|
|
-
|
|
|
+ const sels = jgclSheet.getSelections(), sortData = jgclSheet.zh_data;
|
|
|
+ const node = sortData[sels[0].row];
|
|
|
+ const preNode = sortData[sels[0].row - 1];
|
|
|
+ const data = [
|
|
|
+ {id: node.id, order: preNode.order},
|
|
|
+ {id: preNode.id, order: node.order}
|
|
|
+ ];
|
|
|
+ postData(window.location.pathname + '/update', {update: data}, function (result) {
|
|
|
+ jgclObj.loadUpdateData(result);
|
|
|
+ SpreadJsObj.reLoadRowsData(jgclSheet, [sels[0].row, sels[0].row - 1]);
|
|
|
+ jgclSheet.setSelection(sels[0].row - 1, sels[0].col, sels[0].rowCount, sels[0].colCount);
|
|
|
+ });
|
|
|
},
|
|
|
downMove: function () {
|
|
|
-
|
|
|
+ const sels = jgclSheet.getSelections(), sortData = jgclSheet.zh_data;
|
|
|
+ const node = sortData[sels[0].row];
|
|
|
+ const nextNode = sortData[sels[0].row + 1];
|
|
|
+ const data = [
|
|
|
+ {id: node.id, order: nextNode.order},
|
|
|
+ {id: nextNode.id, order: node.order}
|
|
|
+ ];
|
|
|
+ postData(window.location.pathname + '/update', {update: data}, function (result) {
|
|
|
+ jgclObj.loadUpdateData(result);
|
|
|
+ SpreadJsObj.reLoadRowsData(jgclSheet, [sels[0].row, sels[0].row + 1]);
|
|
|
+ jgclSheet.setSelection(sels[0].row + 1, sels[0].col, sels[0].rowCount, sels[0].colCount);
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
jgclSheet.bind(spreadNS.Events.EditEnded, jgclOprObj.editEnded);
|
|
@@ -338,9 +370,10 @@ $(document).ready(() => {
|
|
|
return !readOnly;
|
|
|
}
|
|
|
},
|
|
|
+ sprDel: '------------',
|
|
|
upMove: {
|
|
|
name: '上移',
|
|
|
- icon: 'fa-remove',
|
|
|
+ icon: 'fa-arrow-up',
|
|
|
callback: function (key, opt) {
|
|
|
jgclOprObj.upMove();
|
|
|
},
|
|
@@ -358,7 +391,7 @@ $(document).ready(() => {
|
|
|
},
|
|
|
downMove: {
|
|
|
name: '下移',
|
|
|
- icon: 'fa-remove',
|
|
|
+ icon: 'fa-arrow-down',
|
|
|
callback: function (key, opt) {
|
|
|
jgclOprObj.downMove();
|
|
|
},
|