|
@@ -97,7 +97,7 @@ const is_numeric = (value) => {
|
|
if (typeof(value) === 'object') {
|
|
if (typeof(value) === 'object') {
|
|
return false;
|
|
return false;
|
|
} else {
|
|
} else {
|
|
- return !Number.isNaN(Number(value)) && value.trim() !== '';
|
|
|
|
|
|
+ return !Number.isNaN(Number(value)) && value.toString().trim() !== '';
|
|
}
|
|
}
|
|
};
|
|
};
|
|
$(document).ready(() => {
|
|
$(document).ready(() => {
|
|
@@ -105,8 +105,8 @@ $(document).ready(() => {
|
|
const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
|
|
const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
|
|
const materialSpreadSetting = {
|
|
const materialSpreadSetting = {
|
|
cols: [
|
|
cols: [
|
|
- {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 1, 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: 't_type', hAlign: 1, width: 80, formatter: '@', readOnly: 'readOnly.isUsed', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
|
+ {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isUsed'},
|
|
{title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, 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: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
{title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
@@ -161,16 +161,24 @@ $(document).ready(() => {
|
|
};
|
|
};
|
|
|
|
|
|
const materialBase = {
|
|
const materialBase = {
|
|
- isEdit: function (data) {
|
|
|
|
|
|
+ isUsed: function (data) {
|
|
if (data.t_type === 2) {
|
|
if (data.t_type === 2) {
|
|
return data.mid === materialID;
|
|
return data.mid === materialID;
|
|
} else {
|
|
} else {
|
|
- const mlInfo = materialListData.find(function (item) {
|
|
|
|
- return item.mb_id === data.id;
|
|
|
|
- });
|
|
|
|
|
|
+ const mlInfo = _.find(materialListData, { mb_id: data.id });
|
|
return data.mid === materialID && mlInfo === undefined;
|
|
return data.mid === materialID && mlInfo === undefined;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ isEdit: function (data) {
|
|
|
|
+ // if (data.t_type === 2) {
|
|
|
|
+ // return data.mid === materialID;
|
|
|
|
+ // } else {
|
|
|
|
+ // const mlInfo = _.find(materialListData, { mb_id: data.id });
|
|
|
|
+ // return data.mid === materialID && mlInfo === undefined;
|
|
|
|
+ // }
|
|
|
|
+ return data.mid === materialID;
|
|
|
|
+ },
|
|
|
|
+
|
|
// isStage: function (data) {
|
|
// isStage: function (data) {
|
|
// return data.mid === materialID;
|
|
// return data.mid === materialID;
|
|
// }
|
|
// }
|
|
@@ -194,6 +202,9 @@ $(document).ready(() => {
|
|
isEdit: function (data) {
|
|
isEdit: function (data) {
|
|
return !(!readOnly && materialBase.isEdit(data));
|
|
return !(!readOnly && materialBase.isEdit(data));
|
|
},
|
|
},
|
|
|
|
+ isUsed: function (data) {
|
|
|
|
+ return !(!readOnly && materialBase.isUsed(data));
|
|
|
|
+ },
|
|
remark: function () {
|
|
remark: function () {
|
|
return readOnly;
|
|
return readOnly;
|
|
},
|
|
},
|