|
@@ -108,11 +108,12 @@ const columns: EpTableColumn<ExtractArrayValue<ExtractApiResponse<'getStatistics
|
|
|
})
|
|
|
|
|
|
const data = computed(() => {
|
|
|
- const arr = props.data?.map((v) => ({ ...v })) || []
|
|
|
- const totalIndex = arr.findIndex((v) => !v.markingGroupNumber)
|
|
|
+ const arr = JSON.parse(JSON.stringify(props.data || []))?.map((v: any) => ({ ...v })) || []
|
|
|
+ const totalIndex = arr.findIndex((v: any) => !v.markingGroupNumber)
|
|
|
if (totalIndex >= 0) {
|
|
|
const [total] = arr.splice(totalIndex, 1)
|
|
|
- total && arr.push(total)
|
|
|
+ // total && arr.push(total)
|
|
|
+ total && arr.unshift(total)
|
|
|
}
|
|
|
return arr
|
|
|
})
|
|
@@ -120,21 +121,26 @@ const data = computed(() => {
|
|
|
const { tableRef, tableData, current, onCurrentChange, elTableRef } = useTableCheck(data, false)
|
|
|
const sortTableData = ref<any[]>([])
|
|
|
const originalTableData = ref<any[]>([])
|
|
|
+function initSortTableData() {
|
|
|
+ if (tableData.value) {
|
|
|
+ sortTableData.value = JSON.parse(JSON.stringify(tableData.value))
|
|
|
+ originalTableData.value = JSON.parse(JSON.stringify(tableData.value))
|
|
|
+ }
|
|
|
+}
|
|
|
+initSortTableData()
|
|
|
watch(tableData, () => {
|
|
|
if (tableData.value) {
|
|
|
- let data: any[] = tableData.value || []
|
|
|
- if (data.length && data[data.length - 1].markingGroupNumber === 0) {
|
|
|
- let last = data.splice(data.length - 1, 1)[0]
|
|
|
- data.unshift(last)
|
|
|
- }
|
|
|
- sortTableData.value = JSON.parse(JSON.stringify(data))
|
|
|
- originalTableData.value = JSON.parse(JSON.stringify(data))
|
|
|
+ // let data: any[] = JSON.parse(JSON.stringify(tableData.value)) || []
|
|
|
+ // if (data.length && data[data.length - 1].markingGroupNumber === 0) {
|
|
|
+ // let last = data.splice(data.length - 1, 1)[0]
|
|
|
+ // data.unshift(last)
|
|
|
+ // }
|
|
|
+ sortTableData.value = JSON.parse(JSON.stringify(tableData.value))
|
|
|
+ originalTableData.value = JSON.parse(JSON.stringify(tableData.value))
|
|
|
}
|
|
|
})
|
|
|
const sortChange = (params: any) => {
|
|
|
const { column, prop, order } = params
|
|
|
- console.log('order:', order)
|
|
|
- console.log('prop:', prop)
|
|
|
if (order === 'ascending') {
|
|
|
sortTableData.value.sort((a: any, b: any) => {
|
|
|
if (a.markingGroupNumber == 0) {
|