82a6de26 by xukangle

fix : 修复标签管理递归函数

1 parent cf478289
......@@ -116,7 +116,7 @@ const tableInfo = ref({
btns: [
{
label: "编辑", value: "edit", click: (scope) => {
// console.log(drawerRef.value.drawerFormRef[0].ruleFormRef);
console.log(scope.row);
currentEditingGuid.value = scope.row.guid;
selectParentEdit(scope.row.guid);
currTableInfo.value = scope.row;
......@@ -387,7 +387,7 @@ const findStandardName = (guid: string) => {
const item: any = classifyGradListData.value.find((item: any) => item.guid == guid);
return item ? item.name : '';
}
const tableRef = ref(null); // 表格的 ref
// 获取分类树形列表
const treeListParams = ref({
pageIndex: 1,
......@@ -404,6 +404,7 @@ const getTreeListData = async () => {
classEditFormItems.value[2].options = treeListData.value;
shapeTreeListData.value = treeListData.value;
tableInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -816,6 +817,11 @@ onMounted(() => {
})
const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true');
const isExpand1 = ref<boolean>(true);
const expand = (item) => {
console.log(item);
isExpand1.value = item
}
</script>
......@@ -827,13 +833,13 @@ const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true'
<Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
</ContentWrap>
<ContentWrap id="id-classStandard" class="detail-content" title="分类规则" description=""
style="margin-top:16px; height: calc(100% - 161px)">
style="margin-top:16px; height: calc(100% - 161px)" :expandSwicth="true" :isExpand="isExpand1" @expand="expand">
<div class="tools_btns">
<el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加规则</el-button>
<!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> -->
<el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button>
</div>
<Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" />
<Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" :ref="tableRef" />
<div ref="shapeMain" class="shape-main" v-show="dataShowMethod != 'table'"></div>
<div v-if="showNodeDetails" class="node-details-popup"
:style="{ top: popupPosition.top + 'px', left: popupPosition.left + 'px' }">
......
......@@ -140,7 +140,7 @@ const tableInfo = ref({
console.log(scope);
filterDataGradeEdit(scope.row.dataGrade);
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeStandardDialogInfo.value.title = '编辑标准';
newCreateGradeStandardDialogInfo.value.title = '编辑规则';
newCreateGradeFormItems.value.forEach(item => {
item.default = scope.row[item.field];
})
......@@ -268,7 +268,7 @@ const newCreateGradeFormRules = ref({
const newCreateGradeStandardDialogInfo = ref({
visible: false,
size: 860,
title: "新增标准",
title: "新增规则",
type: "",
formInfo: {
id: "grade-form",
......@@ -282,7 +282,7 @@ const newCreateGradeStandardDialogInfo = ref({
},
submit: async (btn, info) => {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = true;
if (newCreateGradeStandardDialogInfo.value.title === '编辑标准') {
if (newCreateGradeStandardDialogInfo.value.title === '编辑规则') {
const params = {
...info,
guid: editClassifyGradeGuid.value,
......@@ -293,7 +293,7 @@ const newCreateGradeStandardDialogInfo = ref({
if (res.code == proxy.$passCode) {
proxy.$ElMessage({
type: 'success',
message: '编辑标准成功'
message: '编辑规则成功'
})
getGradeListData();
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
......@@ -311,7 +311,7 @@ const newCreateGradeStandardDialogInfo = ref({
if (res.code == proxy.$passCode) {
proxy.$ElMessage({
type: 'success',
message: '新增标准成功'
message: '新增规则成功'
})
getGradeListData();
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
......@@ -326,7 +326,7 @@ const newCreateGradeStandardDialogInfo = ref({
const newStandard = () => {
filterDataGrade();
newCreateGradeStandardDialogInfo.value.title = '新增标准';
newCreateGradeStandardDialogInfo.value.title = '新增规则';
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeFormItems.value.forEach(item => item.default = '');
}
......@@ -396,7 +396,7 @@ const cancel = () => {
<ContentWrap id="id-grade-info" title="分级规则" class="detail-content" description="" style="margin-top: 8px;">
<div class="content" v-loading="fullscreenLoading">
<div class="table-top-btns">
<el-button type="primary" @click="newStandard">新增标准</el-button>
<el-button type="primary" @click="newStandard">新增规则</el-button>
<el-button @click="batchRemobe">批量删除</el-button>
</div>
<Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" />
......
......@@ -148,32 +148,33 @@ const findTopParentNode = (node: any) => {
if (!node) return;
// 判断是否为最后一层
if (node.childNodes.length === 0) {
isLastLayer.value = true;
isLastLayer.value = node.childNodes.length === 0;
if (isLastLayer.value) {
atGradeinfo.value = node.data;
} else {
isLastLayer.value = false;
}
// 如果当前节点的父节点符合条件
if (node.parent && node.parent.data.type === 'C') {
findNodeDetails.value = node.parent.data;
return; // 停止递归
}
// 递归向上查找符合条件的祖先节点
const findCParent = (currentNode: any): any => {
if (!currentNode?.parent) return null; // 没有父节点,停止递归
if (currentNode.parent.data?.type === 'C') {
return currentNode.parent; // 找到符合条件的节点
}
return findCParent(currentNode.parent); // 继续向上查找
};
// 如果当前节点的祖父节点符合条件
if (node.parent?.parent && node.parent.parent.data.type === 'C') {
findNodeDetails.value = node.parent.parent.data;
return; // 停止递归
}
// 查找最接近的符合条件的祖先节点
const topParent = findCParent(node);
// 如果未找到,继续递归向上查找
if (node.parent) {
findTopParentNode(node.parent);
// 更新结果
if (topParent) {
findNodeDetails.value = topParent.data;
}
};
const nodeClick = (data, node) => {
findTopParentNode(node);
newCreateGradeFormItems.value[1].options = transformDataForTree([findNodeDetails.value])
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!