|
|
|
|
@ -126,6 +126,8 @@
|
|
|
|
|
:data="list"
|
|
|
|
|
:stripe="true"
|
|
|
|
|
:show-overflow-tooltip="true"
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
:max-height="planTableMaxHeight"
|
|
|
|
|
row-key="id"
|
|
|
|
|
:default-expand-all="isExpandAll"
|
|
|
|
|
v-if="refreshTable"
|
|
|
|
|
@ -209,6 +211,19 @@ const { t } = useI18n() // 国际化
|
|
|
|
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const list = ref<OrganizationVO[]>([]) // 列表的数据
|
|
|
|
|
|
|
|
|
|
const tableRef = ref()
|
|
|
|
|
const planTableMaxHeight = ref(520)
|
|
|
|
|
const planPaginationRef = ref<HTMLElement>()
|
|
|
|
|
|
|
|
|
|
const updatePlanTableMaxHeight = async () => {
|
|
|
|
|
await nextTick()
|
|
|
|
|
const tableTop = tableRef.value?.$el?.getBoundingClientRect().top ?? 0
|
|
|
|
|
const paginationHeight = planPaginationRef.value?.getBoundingClientRect().height ?? 72
|
|
|
|
|
const pageBottomGap = 56
|
|
|
|
|
const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap
|
|
|
|
|
planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight)))
|
|
|
|
|
}
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
code: undefined,
|
|
|
|
|
name: undefined,
|
|
|
|
|
@ -232,6 +247,7 @@ const filterCount = 4 // 筛选框数量(code、parentId、name、orgClass)
|
|
|
|
|
/** 切换筛选框展开/折叠 */
|
|
|
|
|
const toggleFilters = () => {
|
|
|
|
|
showAllFilters.value = !showAllFilters.value
|
|
|
|
|
updatePlanTableMaxHeight()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
@ -242,6 +258,7 @@ const getList = async () => {
|
|
|
|
|
list.value = handleTree(data, 'id', 'parentId')
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
updatePlanTableMaxHeight()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -305,6 +322,8 @@ const organizationTree = ref() // 树形结构
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await getList()
|
|
|
|
|
updatePlanTableMaxHeight()
|
|
|
|
|
window.addEventListener('resize', updatePlanTableMaxHeight)
|
|
|
|
|
/** 获得产线工位树 */
|
|
|
|
|
organizationTree.value = []
|
|
|
|
|
const data = await OrganizationApi.getOrganizationList()
|
|
|
|
|
@ -312,6 +331,10 @@ onMounted(async () => {
|
|
|
|
|
root.children = handleTree(data, 'id', 'parentId')
|
|
|
|
|
organizationTree.value.push(root)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
|
window.removeEventListener('resize', updatePlanTableMaxHeight)
|
|
|
|
|
})
|
|
|
|
|
/** tab 切换 */
|
|
|
|
|
let activeName = ''
|
|
|
|
|
const handleTabClick = (tab: TabsPaneContext) => {
|
|
|
|
|
|