提交
This commit is contained in:
parent
4a372c2440
commit
051a1bec6a
@ -66,7 +66,10 @@
|
|||||||
@update:checked-row-keys="handleCheck"
|
@update:checked-row-keys="handleCheck"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
-->
|
-->
|
||||||
|
<!--flex-height-->
|
||||||
<n-data-table
|
<n-data-table
|
||||||
|
ref="tableRef"
|
||||||
|
id="my-table"
|
||||||
size="small"
|
size="small"
|
||||||
remote
|
remote
|
||||||
striped
|
striped
|
||||||
@ -75,6 +78,10 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
virtual-scroll
|
||||||
|
:virtual-scroll-x="true"
|
||||||
|
:scroll-x="scrollX"
|
||||||
|
:max-height="580"
|
||||||
/>
|
/>
|
||||||
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
<n-pagination
|
<n-pagination
|
||||||
@ -134,7 +141,6 @@
|
|||||||
clearable
|
clearable
|
||||||
remote
|
remote
|
||||||
:clear-filter-after-select="false"
|
:clear-filter-after-select="false"
|
||||||
|
|
||||||
@update:value="xmselupdate"
|
@update:value="xmselupdate"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
@ -487,13 +493,16 @@ const columns = [
|
|||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
align:'center',
|
align:'center',
|
||||||
minWidth: 150,
|
minWidth: 260,
|
||||||
title: '产品名称',
|
title: '产品名称',
|
||||||
key: 'projectName'
|
key: 'projectName',
|
||||||
|
ellipsis: {
|
||||||
|
tooltip: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:'center',
|
align:'center',
|
||||||
minWidth: 150,
|
minWidth: 200,
|
||||||
title: '物料名称',
|
title: '物料名称',
|
||||||
key: 'name'
|
key: 'name'
|
||||||
},
|
},
|
||||||
@ -583,9 +592,9 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:'center',
|
align:'center',
|
||||||
minWidth: 150,
|
|
||||||
title: '备注',
|
title: '备注',
|
||||||
key: 'remark'
|
key: 'remark',
|
||||||
|
minWidth:200
|
||||||
},
|
},
|
||||||
// { title: '创建时间', key: 'createTime', width: 100 },
|
// { title: '创建时间', key: 'createTime', width: 100 },
|
||||||
// { title: '创建人', key: 'createBy' },
|
// { title: '创建人', key: 'createBy' },
|
||||||
@ -634,6 +643,19 @@ const columns = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
//根据内容设置表格滚动条
|
||||||
|
let scrollX = ref(0)
|
||||||
|
|
||||||
|
function updateScrollX() {
|
||||||
|
const tableElement = document.querySelector('#my-table .n-data-table-table')
|
||||||
|
if (tableElement) {
|
||||||
|
// 使用 scrollWidth 可以获取表格内容的总宽度,确保滚动条出现
|
||||||
|
scrollX.value = tableElement.scrollWidth
|
||||||
|
} else {
|
||||||
|
scrollX.value = 2000;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -1058,7 +1080,11 @@ async function loadDictOptions() {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadData()
|
loadData()
|
||||||
loadDictOptions()
|
loadDictOptions()
|
||||||
|
|
||||||
|
updateScrollX()
|
||||||
|
window.addEventListener('resize', updateScrollX)
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user