|
|
@@ -10,7 +10,7 @@
|
|
|
:customRow="Rowclick"
|
|
|
:expandIcon="expandIcon"
|
|
|
:expandIconAsCell="false"
|
|
|
- rowKey="key"
|
|
|
+ rowKey="financeapplyid"
|
|
|
:data-source="tableList">
|
|
|
<!-- 额外的展开行 -->
|
|
|
<template v-if="btnList.length"
|
|
|
@@ -72,9 +72,27 @@ export default defineComponent({
|
|
|
setup() {
|
|
|
// 表格列表数据
|
|
|
const { loading, tableList, queryTable } = queryTableList<WrFinanceBuyApply>();
|
|
|
+ function sortTime<T extends object>(arr: T[], key: keyof T, isUp = true) {
|
|
|
+ const result = arr.sort((a, b) => {
|
|
|
+ const time1 = new Date((a[key] as unknown) as string).getTime();
|
|
|
+ const time2 = new Date((b[key] as unknown) as string).getTime();
|
|
|
+ return isUp ? time1 - time2 : time2 - time1;
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }
|
|
|
// 获取列表数据
|
|
|
const queryTableAction = () => {
|
|
|
- queryTable(queryWrFinanceBuyApply);
|
|
|
+ queryTable(queryWrFinanceBuyApply).then((res) => {
|
|
|
+ const arr = res.map((e) => {
|
|
|
+ return { ...e, key: e.financeapplyid };
|
|
|
+ });
|
|
|
+ const waiting = arr.filter((e) => e.applystatus === 1);
|
|
|
+ const other = arr.filter((e) => e.applystatus !== 1);
|
|
|
+ // 时间 倒序排序
|
|
|
+ const sortWaiting = sortTime<WrFinanceBuyApply>(waiting, 'applydate', false);
|
|
|
+ const sortOther = sortTime<WrFinanceBuyApply>(other, 'applydate', false);
|
|
|
+ tableList.value = [...sortWaiting, ...sortOther];
|
|
|
+ });
|
|
|
};
|
|
|
// 表格通用逻辑
|
|
|
const param: ComposeOrderTableParam = {
|