|
@@ -55,12 +55,18 @@ const customIndicatorDialogRef = ref<CustomIndicatorDialog>()
|
|
|
// 表格上方查询表单
|
|
|
const tableQueryFormRef = ref<TableQueryForm>()
|
|
|
|
|
|
+// 当前滚动条是否固定状态,这个主要用于在给sizeOb使用
|
|
|
+// 如果是固定状态,那么在表格大小改变的时候,left需要重置到表格的最左侧的left位置
|
|
|
+// 如果不是,那么设为0即可
|
|
|
+const isFixed = ref<boolean>(true)
|
|
|
+
|
|
|
const emits = defineEmits([
|
|
|
'updateCustomIndicator',
|
|
|
'pageSizeChange',
|
|
|
'curPageChange',
|
|
|
'saveToTemplate',
|
|
|
'changeScheme',
|
|
|
+ 'queryTable',
|
|
|
])
|
|
|
|
|
|
const {
|
|
@@ -76,6 +82,7 @@ const { initScroll, setScrollAndHeader, obScroll } = useTableScroll(
|
|
|
tableContent,
|
|
|
tableContainer,
|
|
|
tableHeaderRef,
|
|
|
+ isFixed,
|
|
|
)
|
|
|
|
|
|
const rowHeight = 56 // 表格行高
|
|
@@ -109,9 +116,14 @@ const tableSizeOb = new ResizeObserver((entries: ResizeObserverEntry[]) => {
|
|
|
// 找到表格容器
|
|
|
let container = entries.find(item => item.target === tableContainer.value)
|
|
|
if (!container) return
|
|
|
- // console.log(container)
|
|
|
- let left = container.target.getBoundingClientRect().left
|
|
|
- elScrollBarH.value.style.left = left + 'px'
|
|
|
+
|
|
|
+ // 看当前的固定状态,分别去调整滚动条的位置
|
|
|
+ if (isFixed.value) {
|
|
|
+ let left = container.target.getBoundingClientRect().left
|
|
|
+ elScrollBarH.value.style.left = left + 'px'
|
|
|
+ } else {
|
|
|
+ elScrollBarH.value.style.left = 0 + 'px'
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
// 表格加载状态
|
|
@@ -193,11 +205,9 @@ const paginationTableData = computed<Array<TableData>>(() => {
|
|
|
* @return {*}
|
|
|
*/
|
|
|
const queryTable = (queryParams: any) => {
|
|
|
- console.log(queryParams)
|
|
|
+ emits('queryTable', queryParams)
|
|
|
}
|
|
|
|
|
|
-const resetTable = () => {}
|
|
|
-
|
|
|
/**
|
|
|
* @description: 初始化分页配置项
|
|
|
* @return {*}
|
|
@@ -298,6 +308,29 @@ const changeTableLoading = (state: boolean) => {
|
|
|
tableLoading.value = state
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @description: 获取当前的查询参数
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+const getTableReqParams = () => {
|
|
|
+ if (tableQueryFormRef.value) {
|
|
|
+ return tableQueryFormRef.value.getParams()
|
|
|
+ } else {
|
|
|
+ return {}
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 初始化查询框
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+const initQueryForm = () => {
|
|
|
+ if (tableQueryFormRef.value) {
|
|
|
+ tableQueryFormRef.value.initFilterForm()
|
|
|
+ tableQueryFormRef.value.initFilterFields()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
watch(
|
|
|
() => props.tableData,
|
|
|
newData => {
|
|
@@ -309,9 +342,6 @@ watch(
|
|
|
cacheTableData,
|
|
|
newData,
|
|
|
)
|
|
|
-
|
|
|
- tableQueryFormRef.value?.initFilterForm()
|
|
|
- tableQueryFormRef.value?.initFilterFields()
|
|
|
updateIndicatorScheme() // 更新指标方案
|
|
|
schemeActive.value = '默认'
|
|
|
},
|
|
@@ -319,10 +349,22 @@ watch(
|
|
|
deep: true,
|
|
|
},
|
|
|
)
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => props.activeMenu,
|
|
|
+ () => {
|
|
|
+ nextTick(() => {
|
|
|
+ initQueryForm()
|
|
|
+ let queryParams = tableQueryFormRef.value?.getParams()
|
|
|
+ emits('queryTable', queryParams)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ { deep: true },
|
|
|
+)
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
initScroll()
|
|
|
- tableQueryFormRef.value?.initFilterForm()
|
|
|
- tableQueryFormRef.value?.initFilterFields()
|
|
|
+
|
|
|
tableVisOb.observe(tableContent.value as HTMLElement)
|
|
|
tableSizeOb.observe(tableContainer.value as HTMLElement)
|
|
|
})
|
|
@@ -330,6 +372,7 @@ onMounted(() => {
|
|
|
defineExpose({
|
|
|
updateIndicatorScheme,
|
|
|
changeTableLoading,
|
|
|
+ getTableReqParams,
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -340,7 +383,6 @@ defineExpose({
|
|
|
ref="tableQueryFormRef"
|
|
|
:filters-info="props.filtersInfo"
|
|
|
@query-table="queryTable"
|
|
|
- @reset-table="resetTable"
|
|
|
></TableQueryForm>
|
|
|
<div class="operationContainer">
|
|
|
<div class="tableOperationLeft">
|
|
@@ -354,6 +396,7 @@ defineExpose({
|
|
|
class="batchOper w120"
|
|
|
v-model="batchOper"
|
|
|
placeholder="批量操作"
|
|
|
+ :disabled="tableLoading"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in batchOperList"
|
|
@@ -370,6 +413,7 @@ defineExpose({
|
|
|
class="exportData w120 ml16"
|
|
|
plain
|
|
|
@click="exportDialogVisble = true"
|
|
|
+ :disabled="tableLoading"
|
|
|
>导出数据</el-button
|
|
|
>
|
|
|
</slot>
|
|
@@ -378,7 +422,8 @@ defineExpose({
|
|
|
placement="bottom"
|
|
|
trigger="hover"
|
|
|
popper-style="padding:0 0px; background-color: #fff;
|
|
|
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);"
|
|
|
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);"
|
|
|
+ :disabled="tableLoading"
|
|
|
>
|
|
|
<div class="popoverContainer">
|
|
|
<div
|
|
@@ -392,6 +437,7 @@ defineExpose({
|
|
|
</div>
|
|
|
<template #reference>
|
|
|
<el-button
|
|
|
+ :disabled="tableLoading"
|
|
|
@click="showCustomIndicator"
|
|
|
class="customIndicator w120 ml16"
|
|
|
plain
|