|
@@ -19,6 +19,14 @@ function findNotJoinLeafXmj(x, type = '') {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function getMpSpreadByMBData(id) {
|
|
|
+ const info = materialBillsData.find(function (item) {
|
|
|
+ return item.id === parseInt(id);
|
|
|
+ });
|
|
|
+ console.log(info);
|
|
|
+ return info.m_spread;
|
|
|
+}
|
|
|
+
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
// 清单table
|
|
@@ -52,13 +60,8 @@ $(document).ready(() => {
|
|
|
if (gcl) {
|
|
|
SpreadJsObj.loadSheetData(leafXmjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gcl.leafXmjs);
|
|
|
// 对清单调差工料table的单位数量进行改变
|
|
|
- // console.log(materialSpreadSetting.cols[materialSpreadSetting.cols.length - 1]);
|
|
|
- // materialSpreadSetting.cols[materialSpreadSetting.cols.length - 1].title = '|' + gcl.unit + '数量<a href="" data-toggle="tooltip" data-placement="bottom" title="单位数量:每一单位清单下所需工料消耗量。"><i class="fa fa-question-circle-o"></i></a>';
|
|
|
materialSpreadSetting.cols[materialSpreadSetting.cols.length - 1].title = '|' + gcl.unit + '数量';
|
|
|
- // const sheet = materialSpread.getActiveSheet();
|
|
|
- // sheet.setCellType(2,3, '1', spreadNS.SheetArea.colHeader);
|
|
|
SpreadJsObj.initSheet(materialSpread.getActiveSheet(), materialSpreadSetting);
|
|
|
- // materialSpread.resumePaint();
|
|
|
} else {
|
|
|
SpreadJsObj.loadSheetData(leafXmjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, []);
|
|
|
}
|
|
@@ -79,7 +82,7 @@ $(document).ready(() => {
|
|
|
{title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
{title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 80, type: 'Number'},
|
|
|
{title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
|
|
|
- {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'jijia', hAlign: 2, width: 80, type: 'Number'},
|
|
|
+ {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'jiacha', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.jiacha'},
|
|
|
],
|
|
|
emptyRows: 0,
|
|
|
headRows: 2,
|
|
@@ -89,6 +92,23 @@ $(document).ready(() => {
|
|
|
readOnly: true,
|
|
|
font: '10pt 微软雅黑',
|
|
|
};
|
|
|
+ const leafXmjCol = {
|
|
|
+ getValue: {
|
|
|
+ jiacha: function (data) {
|
|
|
+ let sum = 0;
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const notx = findNotJoinLeafXmj(select);
|
|
|
+ if (notx === undefined) {
|
|
|
+ for(const ml of materialList) {
|
|
|
+ sum = ZhCalc.add(sum, ZhCalc.mul(ZhCalc.mul(data.gather_qty, ml.quantity), getMpSpreadByMBData(ml.mb_id)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(leafXmjSpreadSetting, leafXmjCol);
|
|
|
SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
|
|
|
// 加载清单数据
|
|
|
SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
|
|
@@ -100,7 +120,7 @@ $(document).ready(() => {
|
|
|
{title: '清单调差工料|编号', colSpan: '4|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
|
|
|
{title: '|名称', colSpan: '|1', rowSpan: '|1', field: 'name', hAlign: 0, width: 100, formatter: '@', readOnly: true},
|
|
|
{title: '|单位', colSpan: '|1', rowSpan: '|1', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true},
|
|
|
- {title: '|数量', colSpan: '1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: true},
|
|
|
+ {title: '|数量', colSpan: '1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
],
|
|
|
emptyRows: 0,
|
|
|
headRows: 2,
|
|
@@ -110,6 +130,25 @@ $(document).ready(() => {
|
|
|
font: '10pt 微软雅黑',
|
|
|
};
|
|
|
|
|
|
+ const materialBase = {
|
|
|
+ isEdit: function (data) {
|
|
|
+ // 是否本期添加的工料
|
|
|
+ return data.mid === materialID;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const materialCol = {
|
|
|
+ readOnly: {
|
|
|
+ isEdit: function (data) {
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const notx = findNotJoinLeafXmj(select);
|
|
|
+ return !(!readOnly && notx === undefined && materialBase.isEdit(data));
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ SpreadJsObj.initSpreadSettingEvents(materialSpreadSetting, materialCol);
|
|
|
+
|
|
|
// 获取项目节数据
|
|
|
let materialList = [];
|
|
|
function loadMaterialData(iGclRow, iLXmjRow) {
|
|
@@ -122,14 +161,11 @@ $(document).ready(() => {
|
|
|
materialList.push(m);
|
|
|
}
|
|
|
}
|
|
|
- // console.log(materialList);
|
|
|
- const notx = findNotJoinLeafXmj(xmj);
|
|
|
- materialSpreadSetting.cols[materialSpreadSetting.cols.length - 1].readOnly = !(readOnly || notx === undefined);
|
|
|
- SpreadJsObj.initSheet(materialSpread.getActiveSheet(), materialSpreadSetting);
|
|
|
SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialList);
|
|
|
} else {
|
|
|
SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, []);
|
|
|
}
|
|
|
+ SpreadJsObj.reLoadSheetData(leafXmjSpread.getActiveSheet());
|
|
|
}
|
|
|
|
|
|
loadLeafXmjData(0);
|
|
@@ -280,18 +316,11 @@ $(document).ready(() => {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- const materialBase = {
|
|
|
- isEdit: function (data) {
|
|
|
- // 是否本期添加的工料
|
|
|
- return data.mid === materialID;
|
|
|
- }
|
|
|
- };
|
|
|
// material-spread右键功能
|
|
|
const materialSpreadObj = {
|
|
|
del: function () {
|
|
|
const sheet = materialSpread.getActiveSheet();
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- console.log(select);
|
|
|
postData(window.location.pathname + '/save', {type: 'del', id: select.id}, function (result) {
|
|
|
const index = materialList.indexOf(select);
|
|
|
materialList.splice(index, 1);
|
|
@@ -322,6 +351,8 @@ $(document).ready(() => {
|
|
|
materialListData.splice(materialListIndex, 1, select);
|
|
|
materialList.indexOf(index, 1, select);
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, iRow);
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
});
|