feat: 工况库
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
>
|
||||
<template #leftOptions v-if="!readonly">
|
||||
<div>
|
||||
<el-button :icon="Plus" @click="addRowFun(NODE_TYPE.CATEGORY)" :disabled="canAddChildFun(NODE_TYPE.CATEGORY)" >{{ $t('工况库.分类') }}</el-button>
|
||||
<el-button :icon="Plus" @click="addRowFun(NODE_TYPE.TASK)" :disabled="canAddChildFun(NODE_TYPE.TASK)">{{ $t('工况库.工况') }}</el-button>
|
||||
<el-button :icon="Plus" @click="addRowFun(NODE_TYPE.PERFORMANCE)" :disabled="canAddChildFun(NODE_TYPE.PERFORMANCE)" >{{ $t('工况库.指标') }}</el-button>
|
||||
<el-button :icon="Plus" @click="addRowFun(NODE_TYPE.CATEGORY)" :disabled="addNodeDisabled[NODE_TYPE.CATEGORY]" >{{ $t('工况库.分类') }}</el-button>
|
||||
<el-button :icon="Plus" @click="addRowFun(NODE_TYPE.TASK)" :disabled="addNodeDisabled[NODE_TYPE.TASK]">{{ $t('工况库.工况') }}</el-button>
|
||||
<el-button :icon="Plus" @click="addRowFun(NODE_TYPE.PERFORMANCE)" :disabled="addNodeDisabled[NODE_TYPE.PERFORMANCE]" >{{ $t('工况库.指标') }}</el-button>
|
||||
</div>
|
||||
<slot name="otherLeftOptions"></slot>
|
||||
</template>
|
||||
@@ -535,42 +535,24 @@ const editTableRowFun = (row: any) => {
|
||||
displayModalFun(row.nodeType, 'edit', row);
|
||||
};
|
||||
const checkboxChangeFun = () => {
|
||||
// const checkRowData = loadcaseTableRef.value?.getCheckboxRecordsFun(true) || [];
|
||||
// canAddChildFun(checkRowData, NODE_TYPE.CATEGORY);
|
||||
// canAddChildFun(checkRowData, NODE_TYPE.TASK);
|
||||
// canAddChildFun(checkRowData, NODE_TYPE.PERFORMANCE);
|
||||
const checkRowData = loadcaseTableRef.value?.getCheckboxRecordsFun(true) || [];
|
||||
canAddChildFun(checkRowData, NODE_TYPE.CATEGORY);
|
||||
canAddChildFun(checkRowData, NODE_TYPE.TASK);
|
||||
canAddChildFun(checkRowData, NODE_TYPE.PERFORMANCE);
|
||||
};
|
||||
// const canAddChildFun = (checkRowData: any, nodeType: string) => {
|
||||
// if (!nodeType) {
|
||||
// return true;
|
||||
// }
|
||||
// let canAdd = true;
|
||||
// if (checkRowData.length === 0) {
|
||||
// canAdd = canAddChild({ nodeType: NODE_TYPE.ROOT }, nodeType);
|
||||
// } else if (checkRowData.length === 1) {
|
||||
// canAdd = canAddChild(checkRowData[0], nodeType);
|
||||
// } else {
|
||||
// canAdd = false;
|
||||
// }
|
||||
// addNodeDisabled.value[nodeType] = !canAdd;
|
||||
// };
|
||||
const canAddChildFun = (nodeType?: string) => {
|
||||
// return false;
|
||||
const canAddChildFun = (checkRowData: any, nodeType: string) => {
|
||||
if (!nodeType) {
|
||||
return true;
|
||||
}
|
||||
// const canAdd = true;
|
||||
// const checkRowData = getVxeRef()?.getCheckboxRecords(true);
|
||||
// const checkRowData = getVxeRef()?.getCheckboxRecords(true) || [];
|
||||
// if (checkRowData.length === 0) {
|
||||
// canAdd = canAddChild({ nodeType: NODE_TYPE.ROOT }, nodeType);
|
||||
// } else if (checkRowData.length === 1) {
|
||||
// canAdd = canAddChild(checkRowData[0], nodeType);
|
||||
// } else {
|
||||
// canAdd = false;
|
||||
// }
|
||||
// return !canAdd;
|
||||
|
||||
let canAdd = true;
|
||||
if (checkRowData.length === 0) {
|
||||
canAdd = canAddChild({ nodeType: NODE_TYPE.ROOT }, nodeType);
|
||||
} else if (checkRowData.length === 1) {
|
||||
canAdd = canAddChild(checkRowData[0], nodeType);
|
||||
} else {
|
||||
canAdd = false;
|
||||
}
|
||||
addNodeDisabled.value[nodeType] = !canAdd;
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
|
||||
Reference in New Issue
Block a user