|
|
@@ -6,9 +6,10 @@
|
|
|
<span class="title-color">产品分类</span>
|
|
|
<a-button type="link" size="small" @click="openSetClass()">新建大类</a-button>
|
|
|
</div>
|
|
|
- <a-tree :tree-data="classList" :field-names="treeFieldNames" :selected-keys="selectedClassKeys"
|
|
|
- :expanded-keys="expandedKeys" :expand-action="false" :autoExpandParent="true" @select="onClassSelect"
|
|
|
- @expand="onTreeExpand" class="custom-tree" draggable @dragenter="onDragEnter" @drop="onDrop">
|
|
|
+ <div class="tree-scroll-wrapper">
|
|
|
+ <a-tree :tree-data="classList" :field-names="treeFieldNames" :selected-keys="selectedClassKeys"
|
|
|
+ :expanded-keys="expandedKeys" :expand-action="false" :autoExpandParent="true" @select="onClassSelect"
|
|
|
+ @expand="onTreeExpand" class="custom-tree" draggable @dragenter="onDragEnter" @drop="onDrop">
|
|
|
<template #title="node">
|
|
|
<div class="tree-node-content" :style="{ width: 240 - node.level * 21 + 'px' }">
|
|
|
<!-- 每少一级别,宽度减少21px -->
|
|
|
@@ -49,12 +50,14 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</a-tree>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 右侧内容 -->
|
|
|
<div class="list-content">
|
|
|
<listTemp ref="list" @handleData="handleData" keyRouteName="name" :param="param" tableName="productListTable"
|
|
|
- :searchType="searchType" :detailPage="{ name: 'productDetail', idname: 'sa_fadid' }">
|
|
|
+ :searchType="searchType" :detailPage="{ name: 'productDetail', idname: 'sa_fadid' }"
|
|
|
+ :scrollY="tableScrollY">
|
|
|
<template #operation>
|
|
|
<Add ref="addRef" :selectedClass="selectedClassNode" @back="delRow" v-if="utils.hasPermission('insert')">
|
|
|
</Add>
|
|
|
@@ -95,7 +98,7 @@
|
|
|
<script setup>
|
|
|
import listTemp from '@/components/listTemplate/index.vue';
|
|
|
import setClass from './modules/setClass/index.vue'
|
|
|
-import { ref, onMounted, nextTick, provide, reactive } from 'vue'
|
|
|
+import { ref, onMounted, onBeforeUnmount, nextTick, provide, reactive } from 'vue'
|
|
|
import { useRouter } from "vue-router";
|
|
|
import Api from '@/api/api'
|
|
|
import utils from '@/utils/utils'
|
|
|
@@ -112,6 +115,13 @@ const addClassRef = ref()
|
|
|
const editClassRef = ref()
|
|
|
const addRef = ref(null) // Add组件引用
|
|
|
|
|
|
+// 表格滚动高度
|
|
|
+const tableScrollY = ref(0)
|
|
|
+const calcTableScrollY = () => {
|
|
|
+ tableScrollY.value = window.innerHeight - 366
|
|
|
+}
|
|
|
+const onResize = () => calcTableScrollY()
|
|
|
+
|
|
|
// 操作函数
|
|
|
const handleCreate = (node, e) => {
|
|
|
// 防止事件冒泡,避免触发Tree的select事件
|
|
|
@@ -464,8 +474,6 @@ const getClassList = async () => {
|
|
|
return keys
|
|
|
}
|
|
|
expandedKeys.value = getAllKeys(res.data)
|
|
|
-
|
|
|
- searchType.value[2].dataSource = classList.value
|
|
|
console.log(classList.value, '分类');
|
|
|
}
|
|
|
|
|
|
@@ -816,6 +824,12 @@ const saveClassStructure = async (data, affectedParentIds) => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
getClassList()
|
|
|
+ calcTableScrollY()
|
|
|
+ window.addEventListener('resize', onResize)
|
|
|
+})
|
|
|
+
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ window.removeEventListener('resize', onResize)
|
|
|
})
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
@@ -823,7 +837,7 @@ onMounted(() => {
|
|
|
.product-manage-container {
|
|
|
display: flex;
|
|
|
gap: 10px;
|
|
|
- min-height: calc(100vh - 146px);
|
|
|
+ height: calc(100vh - 100px);
|
|
|
}
|
|
|
|
|
|
.class-sidebar {
|
|
|
@@ -832,6 +846,9 @@ onMounted(() => {
|
|
|
border-radius: 4px;
|
|
|
flex-shrink: 0;
|
|
|
box-sizing: border-box;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
.sidebar-header {
|
|
|
@@ -841,6 +858,7 @@ onMounted(() => {
|
|
|
margin-bottom: 10px;
|
|
|
padding-bottom: 10px;
|
|
|
border-bottom: 1px solid #f0f0f0;
|
|
|
+ flex-shrink: 0;
|
|
|
}
|
|
|
|
|
|
.sidebar-header span {
|
|
|
@@ -852,6 +870,19 @@ onMounted(() => {
|
|
|
color: #1890ff;
|
|
|
}
|
|
|
|
|
|
+.list-content {
|
|
|
+ flex: 1;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+
|
|
|
+.tree-scroll-wrapper {
|
|
|
+ flex: 1;
|
|
|
+ min-height: 0;
|
|
|
+ overflow: hidden auto;
|
|
|
+}
|
|
|
+
|
|
|
/* 树形组件选中样式 */
|
|
|
.custom-tree :deep(.ant-tree-node-selected) {
|
|
|
background-color: #e6f7ff !important;
|