53 lines
1.4 KiB
Vue
53 lines
1.4 KiB
Vue
<script setup lang="ts">
|
|||
|
|
import { computed } from 'vue';
|
||
|
|
import { Table as ATable } from 'ant-design-vue';
|
||
|
|
import type { TreasuryPartyBalanceDto } from '@mento/shared';
|
||
|
|
import { toman } from '@/views/treasury/treasury-format';
|
||
|
|
|
||
|
|
const props = defineProps<{
|
||
|
|
rows: TreasuryPartyBalanceDto[];
|
||
|
|
settledLabel: string;
|
||
|
|
}>();
|
||
|
|
|
||
|
|
const kindLabel: Record<string, string> = {
|
||
|
|
person: 'مشتری',
|
||
|
|
company: 'شرکت',
|
||
|
|
user: 'کاربر',
|
||
|
|
};
|
||
|
|
|
||
|
|
const columns = computed(() => [
|
||
|
|
{ title: 'طرف حساب', dataIndex: 'partyName', key: 'partyName' },
|
||
|
|
{
|
||
|
|
title: 'نوع',
|
||
|
|
key: 'partyKind',
|
||
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) =>
|
||
|
|
(record.partyKind && kindLabel[record.partyKind]) || 'ثبت قبلی',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'مبلغ کل',
|
||
|
|
key: 'amount',
|
||
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) => toman(record.amount),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: props.settledLabel,
|
||
|
|
key: 'settledAmount',
|
||
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) => toman(record.settledAmount),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: 'مانده',
|
||
|
|
key: 'remaining',
|
||
|
|
customRender: ({ record }: { record: TreasuryPartyBalanceDto }) => toman(record.remaining),
|
||
|
|
},
|
||
|
|
]);
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<template>
|
||
|
|
<a-table
|
||
|
|
:columns="columns"
|
||
|
|
:data-source="rows"
|
||
|
|
:pagination="false"
|
||
|
|
row-key="key"
|
||
|
|
:locale="{ emptyText: 'ماندهای نیست.' }"
|
||
|
|
/>
|
||
|
|
</template>
|