|
@@ -22,22 +22,21 @@ function loadUpdateMaterials(newMaterial, fields) {
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
|
|
|
- console.log(materialType);
|
|
|
const materialSpreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.t_type', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
- {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.code'},
|
|
|
- {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.name'},
|
|
|
- {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.unit'},
|
|
|
- {title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 230, formatter: '@', readOnly: 'readOnly.spec'},
|
|
|
- {title: '工料分类', colSpan: '1', rowSpan: '2', field: 'm_type', hAlign: 0, width: 60, readOnly: 'readOnly.m_type', cellType: 'customizeCombo', comboItems: materialType.m_type, cellTypeKey: 2},
|
|
|
- {title: '本期应耗数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.quantity'},
|
|
|
- {title: '基准价', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.basic_price'},
|
|
|
- {title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.basic_times'},
|
|
|
- {title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.msg_tp'},
|
|
|
- {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.msg_times'},
|
|
|
+ {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
+ {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 230, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '工料分类', colSpan: '1', rowSpan: '2', field: 'm_type', hAlign: 0, width: 60, readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.m_type, cellTypeKey: 2},
|
|
|
+ {title: '本期应耗数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '基准价', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '本期信息价|单价', colSpan: '3|1', rowSpan: '1|1', field: 'msg_tp', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
+ {title: '|时间', colSpan: '|1', rowSpan: '|1', field: 'msg_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '|价差', colSpan: '1', rowSpan: '1|1', field: 'msg_spread', hAlign: 2, width: 60, type: 'Number', readOnly: true},
|
|
|
- {title: '本期材料调差|风险幅度(%)', colSpan: '3|1', rowSpan: '1|1', field: 'm_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.m_risk'},
|
|
|
+ {title: '本期材料调差|风险幅度(%)', colSpan: '3|1', rowSpan: '1|1', field: 'm_risk', hAlign: 2, width: 100, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '|有效价差', colSpan: '|1', rowSpan: '|1', field: 'm_spread', hAlign: 2, width: 80, type: 'Number', readOnly: true},
|
|
|
{title: '|调整金额', colSpan: '|1', rowSpan: '1|1', field: 'm_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true},
|
|
|
{title: '截止上期调差金额', colSpan: '1', rowSpan: '2', field: 'pre_tp', hAlign: 2, width: 120, type: 'Number', readOnly: true},
|
|
@@ -52,46 +51,21 @@ $(document).ready(() => {
|
|
|
font: '10pt 微软雅黑',
|
|
|
};
|
|
|
|
|
|
+ const materialBase = {
|
|
|
+ isEdit: function (data) {
|
|
|
+ return materialListData.find(function (item) {
|
|
|
+ return item.mbid === data.id;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const materialCol = {
|
|
|
readOnly: {
|
|
|
- t_type: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- code: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- name: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- unit: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- spec: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- m_type: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- quantity: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- basic_price: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- basic_times: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- msg_tp: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- msg_times: function (data) {
|
|
|
- return false;
|
|
|
- },
|
|
|
- m_risk: function (data) {
|
|
|
- return false;
|
|
|
+ isEdit: function (data) {
|
|
|
+ return !(readOnly || materialBase.isEdit(data) === undefined);
|
|
|
},
|
|
|
- remark: function (data) {
|
|
|
- return false;
|
|
|
+ remark: function () {
|
|
|
+ return readOnly;
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -110,7 +84,8 @@ $(document).ready(() => {
|
|
|
};
|
|
|
const sheet = materialSpread.getActiveSheet();
|
|
|
const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- setObjEnable($('#del'), !readOnly && select);
|
|
|
+ // 还需判断是否已被调差清单调用
|
|
|
+ setObjEnable($('#del'), !readOnly && select && materialBase.isEdit(select) === undefined);
|
|
|
},
|
|
|
add: function () {
|
|
|
const sheet = materialSpread.getActiveSheet();
|
|
@@ -199,9 +174,10 @@ $(document).ready(() => {
|
|
|
},
|
|
|
disabled: function (key, opt) {
|
|
|
const sheet = materialSpread.getActiveSheet();
|
|
|
- if (sheet.zh_data.length > 0) {
|
|
|
- const selection = sheet.getSelections();
|
|
|
- return sheet.zh_data.length < selection[0].row + selection[0].rowCount;
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ materialSpreadObj.refreshActn();
|
|
|
+ if (!readOnly && select && materialBase.isEdit(select) === undefined) {
|
|
|
+ return false;
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|