|
|
@@ -1,43 +1,44 @@
|
|
|
<template>
|
|
|
- <!-- 申请单 -->
|
|
|
- <section>
|
|
|
- <a-table :columns="columns" class="srcollYTable expandLeftTable" :scroll="{ x: '100%', y: '190px' }" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :expandIcon="expandIcon" :expandIconAsCell="false" rowKey="financeapplyid" :data-source="tableList">
|
|
|
- <!-- 额外的展开行 -->
|
|
|
- <template v-if="btnList.length" #expandedRowRender="{ record }">
|
|
|
- <BtnList :btnList="handleBtnList(btnList, record)" :record="record" class="btn-list-sticky" @click="openComponent" />
|
|
|
- </template>
|
|
|
- <!-- 类型 -->
|
|
|
- <template #financetype="{ record }">
|
|
|
- <a>{{ getFinanceTypeName(record.financetype) }}</a>
|
|
|
- </template>
|
|
|
-
|
|
|
- <!-- 状态 -->
|
|
|
- <template #applystatus="{ text }">
|
|
|
- <a>{{ getApplyStatusFinanceName(text) }}</a>
|
|
|
- </template>
|
|
|
- <template #createtime="{ record }">
|
|
|
- <a>{{ formatTime(record.createtime) }}</a>
|
|
|
- </template>
|
|
|
-
|
|
|
- <!-- 结算方式 1:按日结息 3:按月结息-->
|
|
|
- <template #interestsettlemode="{ text }">
|
|
|
- <a>{{ getInterestSettleModeName(text) }}</a>
|
|
|
- </template>
|
|
|
- <!-- 费用 -->
|
|
|
- <template #interestsettlevalue="{ record }">
|
|
|
- <a>{{ getInterestrateModeName(record.interestratemode, record.interestrate, record.enumdicname) }}</a>
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
+ <!-- 融资管理-申请单 -->
|
|
|
+ <mtp-table-scroll>
|
|
|
+ <template #default="{ scroll }">
|
|
|
+ <a-table :columns="columns" class="srcollYTable" :scroll="scroll" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :expandIcon="expandIcon" :expandIconAsCell="false" :rowKey="(record, index) => index" :data-source="tableList">
|
|
|
+ <!-- 额外的展开行 -->
|
|
|
+ <template v-if="buttons.length" #expandedRowRender="{ record }">
|
|
|
+ <BtnList :btnList="handleBtnList(buttons, record)" :record="record" class="btn-list-sticky" @click="openComponent" />
|
|
|
+ </template>
|
|
|
+ <!-- 类型 -->
|
|
|
+ <template #financetype="{ record }">
|
|
|
+ <a>{{ getFinanceTypeName(record.financetype) }}</a>
|
|
|
+ </template>
|
|
|
+ <!-- 状态 -->
|
|
|
+ <template #applystatus="{ text }">
|
|
|
+ <a>{{ getApplyStatusFinanceName(text) }}</a>
|
|
|
+ </template>
|
|
|
+ <template #createtime="{ record }">
|
|
|
+ <a>{{ formatTime(record.createtime) }}</a>
|
|
|
+ </template>
|
|
|
+ <!-- 结算方式 1:按日结息 3:按月结息-->
|
|
|
+ <template #interestsettlemode="{ text }">
|
|
|
+ <a>{{ getInterestSettleModeName(text) }}</a>
|
|
|
+ </template>
|
|
|
+ <!-- 费用 -->
|
|
|
+ <template #interestsettlevalue="{ record }">
|
|
|
+ <a>{{ getInterestrateModeName(record.interestratemode, record.interestrate, record.enumdicname) }}</a>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ </template>
|
|
|
+ </mtp-table-scroll>
|
|
|
<component :is="componentId" v-if="componentId" :selectedRow="selectedRow" @cancel="closeComponent"></component>
|
|
|
- </section>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { enumOrderComponents } from '@/common/constants/enumOrderComponents';
|
|
|
+import { PropType } from 'vue';
|
|
|
+import { DynamicComponent } from '@/@next/hooks/common/interface';
|
|
|
+import MtpTableScroll from '@/common/components/tableScroll/index.vue';
|
|
|
import { queryTableList, BtnList, defineAsyncComponent, defineComponent, ModalEnum } from '@/common/export/commonTable';
|
|
|
import { queryWrFinanceBuyApply } from '@/services/go/wrtrade';
|
|
|
import { WrFinanceBuyApply } from '@/services/go/wrtrade/interface';
|
|
|
-import { getRecordItemTab } from '@/common/setup/order/orderData';
|
|
|
import { handleComposeOrderTable } from '@/common/setup/table/compose';
|
|
|
import { ComposeOrderTableParam } from '@/common/setup/table/interface';
|
|
|
import { formatTime } from '@/common/methods';
|
|
|
@@ -47,66 +48,79 @@ import { getApplyStatusFinanceName, getFinanceTypeName, getInterestrateModeName,
|
|
|
import { BtnListType } from '@/common/components/btnList/interface';
|
|
|
|
|
|
export default defineComponent({
|
|
|
- name: enumOrderComponents.financing_manager_apply_order,
|
|
|
- components: {
|
|
|
- BtnList,
|
|
|
- [ModalEnum.financing_manager_apply_cancel]: defineAsyncComponent(() => import('./components/cancel/index.vue')),
|
|
|
- },
|
|
|
- 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).then((res) => {
|
|
|
- const arr = res.map((e) => {
|
|
|
- return { ...e, key: e.financeapplyid };
|
|
|
+ props: {
|
|
|
+ parentComponent: {
|
|
|
+ type: Object as PropType<DynamicComponent>,
|
|
|
+ required: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ MtpTableScroll,
|
|
|
+ BtnList,
|
|
|
+ cancel: defineAsyncComponent(() => import('./components/cancel/index.vue')), // 撤销
|
|
|
+ },
|
|
|
+ setup(props) {
|
|
|
+ const { buttons } = props.parentComponent;
|
|
|
+ // 表格列表数据
|
|
|
+ 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).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 = {
|
|
|
+ queryFn: queryTableAction,
|
|
|
+ tableName: 'table_pcweb_financing_manage_bottom_apply_order',
|
|
|
+ };
|
|
|
+
|
|
|
+ // 融资摘牌成功,重新加载数据
|
|
|
+ Bus.$on('financing_manager', () => {
|
|
|
+ queryTableAction();
|
|
|
});
|
|
|
- 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 = {
|
|
|
- queryFn: queryTableAction,
|
|
|
- tableName: 'table_pcweb_financing_manage_bottom_apply_order',
|
|
|
- recordList: getRecordItemTab(),
|
|
|
- };
|
|
|
- // 融资摘牌成功,重新加载数据
|
|
|
- Bus.$on('financing_manager', () => {
|
|
|
- queryTableAction();
|
|
|
- });
|
|
|
- function handleBtnList(btnList: BtnListType[], item: WrFinanceBuyApply) {
|
|
|
- const { applystatus } = item;
|
|
|
- if (applystatus === 1) {
|
|
|
- return btnList.filter((e) => e.code === ModalEnum.financing_manager_apply_cancel);
|
|
|
- } else {
|
|
|
- return [];
|
|
|
- }
|
|
|
- }
|
|
|
- return {
|
|
|
- ...handleComposeOrderTable<WrFinanceBuyApply>(param),
|
|
|
- loading,
|
|
|
- tableList,
|
|
|
- formatTime,
|
|
|
- expandIcon,
|
|
|
- getFinanceTypeName,
|
|
|
- getApplyStatusFinanceName,
|
|
|
- handleBtnList,
|
|
|
- getInterestrateModeName,
|
|
|
- getInterestSettleModeName,
|
|
|
- };
|
|
|
- },
|
|
|
+
|
|
|
+ function handleBtnList(btnList: BtnListType[], item: WrFinanceBuyApply) {
|
|
|
+ const { applystatus } = item;
|
|
|
+ if (applystatus === 1) {
|
|
|
+ return btnList.filter((e) => e.code === ModalEnum.financing_manager_apply_cancel);
|
|
|
+ } else {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...handleComposeOrderTable<WrFinanceBuyApply>(param),
|
|
|
+ loading,
|
|
|
+ tableList,
|
|
|
+ buttons,
|
|
|
+ formatTime,
|
|
|
+ expandIcon,
|
|
|
+ getFinanceTypeName,
|
|
|
+ getApplyStatusFinanceName,
|
|
|
+ handleBtnList,
|
|
|
+ getInterestrateModeName,
|
|
|
+ getInterestSettleModeName,
|
|
|
+ };
|
|
|
+ },
|
|
|
});
|
|
|
</script>
|