5f42ed87 by lxs

分类分级任务-tree滚动

1 parent da366cd6
......@@ -45,10 +45,6 @@ const resetForm = (formEl: FormInstance | undefined) => {
})
}
defineExpose({
formInline,
formRef,
})
const setFormFields = (list: any) => {
let obj = {}
list.map((item: any) => {
......@@ -99,6 +95,12 @@ const inputChange = (val) => {
onSubmit()
}
const formCascaderRef = ref()
defineExpose({
formInline,
formRef,
getCascaderCheckedData
})
onMounted(() => {
props.init && onSubmit()
})
......
......@@ -57,14 +57,8 @@ const cascaderChange = (val, item) => {
emits("cascaderChange", val, item);
}
const getCascaderCheckedData = () => {
const toolSearchForm = toolSearch.value.formRef[0] || toolSearch.value.formRef;
return toolSearchForm.getCascaderCheckedData();
}
defineExpose({
toolSearch,
getCascaderCheckedData
toolSearch
})
</script>
......
......@@ -39,11 +39,12 @@ const gradeList = ref([]);
const treeData = ref([
{
classifyName: "全部",
classifyDetailGuid: "all",
classifyDetailGuid: "",
guid: 'all',
children: [],
},
]);
const currTreeNode = ref({ classifyName: "全部", classifyDetailGuid: "all" })
const treeInfoRef = ref();
const treeInfo: any = ref({
id: "data-pickup-tree",
......@@ -53,7 +54,7 @@ const treeInfo: any = ref({
props: {
label: "classifyName",
},
nodeKey: 'classifyDetailGuid',
nodeKey: 'guid',
expandedKey: [],
expandOnNodeClick: false,
data: [],
......@@ -513,22 +514,21 @@ const tabChange = (val) => {
}
const nodeClick = (data, node) => {
currTreeNode.value = data;
if (data.classifyDetailGuid == 'all') {
fieldItemList.value[4].default = '';
fieldItemList.value[5].default = [];
promiseList(
getFieldTableData()
)
} else {
const parentGuids = data.parentGuids || [];
parentGuids.push(data.classifyDetailGuid)
const nodeData = JSON.parse(JSON.stringify(data));
let parentGuids = nodeData.parentGuids || [];
parentGuids.push(nodeData.guid)
fieldItemList.value[4].default = 'Y';
fieldItemList.value[5].default = parentGuids;
}
nextTick(() => {
promiseList(
getFieldTableData()
)
}
})
}
// 获取库表数据
......@@ -565,10 +565,8 @@ const getFieldTableData = () => {
isMergeClassify: checked1.value ? 'Y' : 'N'
}
const cascaderData = fieldSearchRef.value.toolSearch.getCascaderCheckedData();
debugger
const classifyName = params.classifyName?.at(-1) || undefined;
if (classifyName && classifyName != 'unclassified') {
params.classifyDetail = classifyName;
if (cascaderData.length) {
params.classifyDetail = cascaderData[0].data.classifyDetailGuid;
}
delete params.classifyName
return execTaskFieldList(params).then((res: any) => {
......@@ -617,6 +615,11 @@ const tableBtnClick = (scope, btn) => {
treeInfo.value.expandedKey = ['all'];
treeInfoRef.value.setCurrentKey('all');
getSheetFieldList({ type: 2, dbGuid: row.databaseGuid }, row.tableGuid);
nextTick(() => {
const treeRef = treeInfoRef.value.treeRef;
const container = treeRef.$el;
container.scrollTo({ top: 0, behavior: 'smooth' });
})
} else if (type == "edit") {
row.STATE = 'Running';
} else if (type == 'save') {
......@@ -795,6 +798,11 @@ const searchField = (val: any, clear: boolean = false) => {
fieldItemList.value.map(item => item.default = '')
treeInfo.value.expandedKey = ['all'];
treeInfoRef.value.setCurrentKey('all');
nextTick(() => {
const treeRef = treeInfoRef.value.treeRef;
const container = treeRef.$el;
container.scrollTo({ top: 0, behavior: 'smooth' });
})
}
fieldParams.value = Object.assign({}, { ...fieldParams.value }, { ...val });
promiseList(
......@@ -814,9 +822,16 @@ const cascaderChange = (val, info) => {
} else {
treeInfoRef.value.expandedKey = val || ['all'];
treeInfoRef.value.setCurrentKey(val?.at(-1) || 'all');
val && (fieldItemList.value[4].default = 'Y');
promiseList(
getFieldTableData()
)
setTimeout(() => {
const treeRef = treeInfoRef.value.treeRef;
const container = treeRef.$el;
const currentNode = container.querySelector('.el-tree-node.is-current');
currentNode && container.scrollTo({ top: currentNode.offsetTop, behavior: 'smooth' });
}, 300)
}
}
};
......@@ -894,9 +909,15 @@ const selectChange = (val, item, scope = null) => {
treeInfo.value.expandedKey = ['all'];
treeInfoRef.value.setCurrentKey('all');
fieldItemList.value[4].default = val || '';
nextTick(() => {
promiseList(
getFieldTableData()
)
const treeRef = treeInfoRef.value.treeRef;
const container = treeRef.$el;
container.scrollTo({ top: 0, behavior: 'smooth' });
})
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!