|
@ -17,6 +17,7 @@ |
|
|
:loading="table.loading" |
|
|
:loading="table.loading" |
|
|
:class="tableClassComputed" |
|
|
:class="tableClassComputed" |
|
|
:table-style="tableHeightComputed" |
|
|
:table-style="tableHeightComputed" |
|
|
|
|
|
:row-key="rowKey_" |
|
|
@request="onRequest" |
|
|
@request="onRequest" |
|
|
@fullscreen="tableFullscreenFun" |
|
|
@fullscreen="tableFullscreenFun" |
|
|
> |
|
|
> |
|
@ -80,7 +81,7 @@ |
|
|
> |
|
|
> |
|
|
<q-checkbox v-model="scope.selected" flat |
|
|
<q-checkbox v-model="scope.selected" flat |
|
|
/></q-th> |
|
|
/></q-th> |
|
|
<q-th v-else-if="props.checkboxSelection"></q-th> |
|
|
<q-th v-else-if="props.checkboxSelection || props.tree"></q-th> |
|
|
<q-th v-for="col in scope.cols" :key="col.name" :props="scope" :style="col.style" :class="col.classes"> |
|
|
<q-th v-for="col in scope.cols" :key="col.name" :props="scope" :style="col.style" :class="col.classes"> |
|
|
{{ col.label }} |
|
|
{{ col.label }} |
|
|
</q-th> |
|
|
</q-th> |
|
@ -199,7 +200,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, reactive, computed, onMounted, nextTick, toRaw, useAttrs, getCurrentInstance, provide } from 'vue'; |
|
|
import { ref, reactive, computed, onMounted, nextTick, toRaw, useAttrs, getCurrentInstance, provide, watchEffect } from 'vue'; |
|
|
import { axios, Environment, NotifyManager, TreeBuilder, VueTools, Tools } from '@/platform'; |
|
|
import { axios, Environment, NotifyManager, TreeBuilder, VueTools, Tools } from '@/platform'; |
|
|
import { useQuasar, getCssVar, exportFile } from 'quasar'; |
|
|
import { useQuasar, getCssVar, exportFile } from 'quasar'; |
|
|
import { IconEnum } from '@/platform/enums'; |
|
|
import { IconEnum } from '@/platform/enums'; |
|
@ -1008,7 +1009,7 @@ const requestHandler = async (ops) => { |
|
|
reqParams.page = ops.pagination.page; |
|
|
reqParams.page = ops.pagination.page; |
|
|
reqParams.size = ops.pagination.rowsPerPage; |
|
|
reqParams.size = ops.pagination.rowsPerPage; |
|
|
} |
|
|
} |
|
|
reqParams.pageable = props.pageable; |
|
|
reqParams.pageable = props.tree ? false : props.pageable; |
|
|
if (ops.pagination.sortBy && ops.pagination.sortBy !== '') { |
|
|
if (ops.pagination.sortBy && ops.pagination.sortBy !== '') { |
|
|
if (ops.pagination.descending) { |
|
|
if (ops.pagination.descending) { |
|
|
reqParams.sortBy = '-' + ops.pagination.sortBy; |
|
|
reqParams.sortBy = '-' + ops.pagination.sortBy; |
|
@ -1039,7 +1040,7 @@ const onRequest = async (ops: any) => { |
|
|
if (Array.isArray(responseData)) { |
|
|
if (Array.isArray(responseData)) { |
|
|
table.rows = responseData; |
|
|
table.rows = responseData; |
|
|
table.pagination.rowsNumber = responseData.length; |
|
|
table.pagination.rowsNumber = responseData.length; |
|
|
} else if (typeof responseData === 'object') { |
|
|
} else if (typeof responseData === 'object' && responseData.content) { |
|
|
if (props.pageable) { |
|
|
if (props.pageable) { |
|
|
table.pagination.page = table.pagination.reqPageStart === 0 ? responseData.number + 1 : responseData.number; |
|
|
table.pagination.page = table.pagination.reqPageStart === 0 ? responseData.number + 1 : responseData.number; |
|
|
table.pagination.rowsPerPage = responseData.size || table.pagination.rowsPerPage; |
|
|
table.pagination.rowsPerPage = responseData.size || table.pagination.rowsPerPage; |
|
@ -1050,10 +1051,26 @@ const onRequest = async (ops: any) => { |
|
|
table.rows = responseData.content; |
|
|
table.rows = responseData.content; |
|
|
} |
|
|
} |
|
|
} else if (resp && resp.data && props.tree) { |
|
|
} else if (resp && resp.data && props.tree) { |
|
|
const treeRows = TreeBuilder.build(resp.data); |
|
|
const responseData = resp.data; |
|
|
table.pagination.rowsNumber = resp.data.length; |
|
|
if (Array.isArray(responseData)) { |
|
|
table.pagination.rowsPerPage = 0; |
|
|
table.pagination.rowsNumber = responseData.length; |
|
|
table.rows = treeRows; |
|
|
table.pagination.rowsPerPage = 0; |
|
|
|
|
|
if (props.treeRelationship === 'parent') { |
|
|
|
|
|
const treeRows = TreeBuilder.build(responseData, props.treeRelationshipField, props.treePrimaryField); |
|
|
|
|
|
table.rows = treeRows; |
|
|
|
|
|
} else { |
|
|
|
|
|
table.rows = responseData; |
|
|
|
|
|
} |
|
|
|
|
|
} else if (typeof responseData === 'object' && responseData.content) { |
|
|
|
|
|
table.pagination.rowsNumber = responseData.content.length; |
|
|
|
|
|
table.pagination.rowsPerPage = 0; |
|
|
|
|
|
if (props.treeRelationship === 'parent') { |
|
|
|
|
|
const treeRows = TreeBuilder.build(responseData.content, props.treeRelationshipField, props.treePrimaryField); |
|
|
|
|
|
table.rows = treeRows; |
|
|
|
|
|
} else { |
|
|
|
|
|
table.rows = responseData.content; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
addRowKey(table.rows); |
|
|
addRowKey(table.rows); |
|
|
stickyHeaderColumn(); |
|
|
stickyHeaderColumn(); |
|
@ -1231,9 +1248,19 @@ const getRows = () => { |
|
|
return toRaw(table.rows); |
|
|
return toRaw(table.rows); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
watchEffect(() => { |
|
|
|
|
|
url.dataUrl = props.dataUrl; |
|
|
|
|
|
url.fetchDataUrl = props.fetchDataUrl; |
|
|
|
|
|
url.addDataUrl = props.addDataUrl; |
|
|
|
|
|
url.editDataUrl = props.editDataUrl; |
|
|
|
|
|
url.removeDataUrl = props.removeDataUrl; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
const refresh = () => { |
|
|
const refresh = () => { |
|
|
onRequest({ |
|
|
nextTick(() => { |
|
|
pagination: table.pagination, |
|
|
onRequest({ |
|
|
|
|
|
pagination: table.pagination, |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -1785,13 +1812,24 @@ VueTools.expose2Instance(instance); |
|
|
:deep(.q-table__top) { |
|
|
:deep(.q-table__top) { |
|
|
padding: 8px 8px; |
|
|
padding: 8px 8px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
:deep(.q-table th:first-child) { |
|
|
|
|
|
border-left: 1px solid var(--tableBorderColor); |
|
|
|
|
|
} |
|
|
|
|
|
:deep(.q-table tr td:first-child) { |
|
|
|
|
|
border-left: 1px solid var(--tableBorderColor); |
|
|
|
|
|
} |
|
|
:deep(.q-table th) { |
|
|
:deep(.q-table th) { |
|
|
|
|
|
padding: 7px 8px; |
|
|
|
|
|
background-color: inherit; |
|
|
border-left-width: 0px; |
|
|
border-left-width: 0px; |
|
|
border-right-width: 1px; |
|
|
border-right-width: 1px; |
|
|
border-top-width: 0px; |
|
|
border-top-width: 0px; |
|
|
border-bottom-width: 1px; |
|
|
border-bottom-width: 1px; |
|
|
} |
|
|
} |
|
|
:deep(.q-table td) { |
|
|
:deep(.q-table td) { |
|
|
|
|
|
padding: 7px 8px; |
|
|
|
|
|
background-color: inherit; |
|
|
border-left-width: 0px; |
|
|
border-left-width: 0px; |
|
|
border-right-width: 1px; |
|
|
border-right-width: 1px; |
|
|
border-top-width: 0px; |
|
|
border-top-width: 0px; |
|
|