|
@@ -415,7 +415,7 @@
|
|
type="primary"
|
|
type="primary"
|
|
:icon="Box"
|
|
:icon="Box"
|
|
@click="handleSelectMaterial"
|
|
@click="handleSelectMaterial"
|
|
- :disabled="!currentBomItem"
|
|
|
|
|
|
+ :disabled="!currentBomItem || isButtonsDisabled"
|
|
>
|
|
>
|
|
{{ t('stock.selectMaterial') }}
|
|
{{ t('stock.selectMaterial') }}
|
|
</el-button>
|
|
</el-button>
|
|
@@ -432,7 +432,7 @@
|
|
type="primary"
|
|
type="primary"
|
|
:icon="Plus"
|
|
:icon="Plus"
|
|
@click="handleAddMaterial"
|
|
@click="handleAddMaterial"
|
|
- :disabled="!currentBomItem"
|
|
|
|
|
|
+ :disabled="!currentBomItem || isButtonsDisabled"
|
|
>
|
|
>
|
|
新增物料
|
|
新增物料
|
|
</el-button>
|
|
</el-button>
|
|
@@ -480,7 +480,7 @@
|
|
placeholder="请输入物料名称(必填)"
|
|
placeholder="请输入物料名称(必填)"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
:class="{ 'is-required-input': row.isNew && !row.materialName?.trim() }"
|
|
:class="{ 'is-required-input': row.isNew && !row.materialName?.trim() }"
|
|
- :disabled="isMaterialDisabled(row)"
|
|
|
|
|
|
+ :disabled="isMaterialDisabled(row)"
|
|
/>
|
|
/>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<!-- 非新增行:正常显示 -->
|
|
<!-- 非新增行:正常显示 -->
|
|
@@ -916,8 +916,13 @@ const displayedMaterialList = computed(() => {
|
|
const isMaterialDisabled = (material) => {
|
|
const isMaterialDisabled = (material) => {
|
|
// 根据物料的bomNodeId找到对应的保养项
|
|
// 根据物料的bomNodeId找到对应的保养项
|
|
const bomItem = list.value.find(item => item.bomNodeId === material.bomNodeId);
|
|
const bomItem = list.value.find(item => item.bomNodeId === material.bomNodeId);
|
|
- // 如果保养项存在且rule=1(不消耗物料),则禁用
|
|
|
|
- return bomItem && bomItem.rule === 1;
|
|
|
|
|
|
+ // 如果保养项不存在,默认不禁用
|
|
|
|
+ if (!bomItem) return false;
|
|
|
|
+ // 如果保养项状态为已完成(status=1),则禁用该物料
|
|
|
|
+ if (bomItem.status === 1) return true;
|
|
|
|
+ // 如果保养项rule=1(不消耗物料),则禁用
|
|
|
|
+ if (bomItem.rule === 1) return true;
|
|
|
|
+ return false;
|
|
};
|
|
};
|
|
|
|
|
|
// 物料表格行类名 - 用于设置灰色背景
|
|
// 物料表格行类名 - 用于设置灰色背景
|
|
@@ -931,6 +936,19 @@ const getMaterialRowClassName = ({ row }) => {
|
|
return '';
|
|
return '';
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+// 计算属性:判断按钮是否应该禁用
|
|
|
|
+const isButtonsDisabled = computed(() => {
|
|
|
|
+ if (!currentBomItem.value) return true;
|
|
|
|
+
|
|
|
|
+ // 条件1:保养状态为已完成(status=1)
|
|
|
|
+ if (currentBomItem.value.status === 1) return true;
|
|
|
|
+
|
|
|
|
+ // 条件2:消耗物料字段为不消耗物料(rule=1)
|
|
|
|
+ if (currentBomItem.value.rule === 1) return true;
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+});
|
|
|
|
+
|
|
// 切换显示所有物料/当前保养项物料
|
|
// 切换显示所有物料/当前保养项物料
|
|
const toggleShowAllMaterials = () => {
|
|
const toggleShowAllMaterials = () => {
|
|
showAllMaterials.value = !showAllMaterials.value;
|
|
showAllMaterials.value = !showAllMaterials.value;
|
|
@@ -2592,19 +2610,27 @@ const handleRowClick = (row) => {
|
|
:deep(.disabled-material-row) {
|
|
:deep(.disabled-material-row) {
|
|
background-color: #f5f7fa !important;
|
|
background-color: #f5f7fa !important;
|
|
color: #c0c4cc !important;
|
|
color: #c0c4cc !important;
|
|
|
|
+ cursor: not-allowed !important;
|
|
}
|
|
}
|
|
|
|
|
|
:deep(.disabled-material-row:hover>td) {
|
|
:deep(.disabled-material-row:hover>td) {
|
|
background-color: #f5f7fa !important;
|
|
background-color: #f5f7fa !important;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+:deep(.disabled-material-row .el-input.is-disabled .el-input__inner) {
|
|
|
|
+ background-color: #f5f7fa !important;
|
|
|
|
+ color: #c0c4cc !important;
|
|
|
|
+ cursor: not-allowed !important;
|
|
|
|
+}
|
|
|
|
+
|
|
:deep(.disabled-material-row .el-input-number.is-disabled) {
|
|
:deep(.disabled-material-row .el-input-number.is-disabled) {
|
|
opacity: 0.6;
|
|
opacity: 0.6;
|
|
|
|
+ cursor: not-allowed !important;
|
|
}
|
|
}
|
|
|
|
|
|
:deep(.disabled-material-row .el-button.is-disabled) {
|
|
:deep(.disabled-material-row .el-button.is-disabled) {
|
|
opacity: 0.6;
|
|
opacity: 0.6;
|
|
- cursor: not-allowed;
|
|
|
|
|
|
+ cursor: not-allowed !important;
|
|
}
|
|
}
|
|
|
|
|
|
/* 新增物料行的样式 */
|
|
/* 新增物料行的样式 */
|