From 8630040b90870520dbb27f178e20f33ef3f522b8 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Thu, 30 Jul 2026 21:03:19 +0330 Subject: [PATCH] Fix SmsTenantPage TypeScript implicit any for production build. Co-authored-by: Cursor --- src/pages/SmsTenantPage.vue | 86 +++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 37 deletions(-) diff --git a/src/pages/SmsTenantPage.vue b/src/pages/SmsTenantPage.vue index 7d73758..37b4592 100644 --- a/src/pages/SmsTenantPage.vue +++ b/src/pages/SmsTenantPage.vue @@ -114,6 +114,14 @@ function fromGroupedInput(raw: string, allowNegative = false) { return neg ? -n : n } +function onGroupedMoneyInput( + apply: (n: number) => void, + value: string | number, + allowNegative = false, +) { + apply(fromGroupedInput(String(value ?? ''), allowNegative)) +} + function formatNumber(value: number | null | undefined) { if (value == null) return '—' return new Intl.NumberFormat('fa-IR').format(value) @@ -331,14 +339,14 @@ const logColumns: TableColumnsType = [ title: 'مبلغ', key: 'totalAmount', width: 120, - customRender: ({ record }) => formatMoney(record.totalAmount), + customRender: ({ record }: { record: any }) => formatMoney(record.totalAmount), }, { title: 'ارائه‌دهنده', dataIndex: 'provider', key: 'provider', width: 110 }, { title: 'زمان', key: 'createdAt', width: 150, - customRender: ({ record }) => formatIranDateTime(record.createdAt), + customRender: ({ record }: { record: any }) => formatIranDateTime(record.createdAt), }, ] @@ -348,20 +356,50 @@ const ledgerColumns: TableColumnsType = [ title: 'مبلغ', key: 'amount', width: 130, - customRender: ({ record }) => formatMoney(record.amount), + customRender: ({ record }: { record: any }) => formatMoney(record.amount), }, { title: 'مانده', key: 'balanceAfter', width: 130, - customRender: ({ record }) => formatMoney(record.balanceAfter), + customRender: ({ record }: { record: any }) => formatMoney(record.balanceAfter), }, { title: 'توضیح', dataIndex: 'note', key: 'note', ellipsis: true }, { title: 'زمان', key: 'createdAt', width: 150, - customRender: ({ record }) => formatIranDateTime(record.createdAt), + customRender: ({ record }: { record: any }) => formatIranDateTime(record.createdAt), + }, +] + +const providerReportColumns: TableColumnsType = [ + { title: 'ارائه‌دهنده', dataIndex: 'provider', key: 'provider' }, + { title: 'پیامک', dataIndex: 'messages', key: 'messages' }, + { title: 'پارت', dataIndex: 'parts', key: 'parts' }, + { + title: 'مبلغ', + key: 'amount', + customRender: ({ record }: { record: any }) => formatMoney(record.amount), + }, +] + +const chargeReportColumns: TableColumnsType = [ + { + title: 'مبلغ', + key: 'amount', + customRender: ({ record }: { record: any }) => formatMoney(record.amount), + }, + { + title: 'مانده', + key: 'balanceAfter', + customRender: ({ record }: { record: any }) => formatMoney(record.balanceAfter), + }, + { title: 'توضیح', dataIndex: 'note', key: 'note' }, + { + title: 'زمان', + key: 'createdAt', + customRender: ({ record }: { record: any }) => formatIranDateTime(record.createdAt), }, ] @@ -443,7 +481,7 @@ onMounted(async () => { dir="ltr" class="money-input" :value="toGroupedDisplay(form.pricePerPartRials)" - @update:value="(v) => (form.pricePerPartRials = fromGroupedInput(String(v)))" + @update:value="(v: string | number) => onGroupedMoneyInput((n) => (form.pricePerPartRials = n), v)" /> ذخیره قیمت @@ -458,7 +496,7 @@ onMounted(async () => { class="money-input" placeholder="مبلغ (ریال)" :value="toGroupedDisplay(chargeForm.amountRials)" - @update:value="(v) => (chargeForm.amountRials = fromGroupedInput(String(v), true))" + @update:value="(v: string | number) => onGroupedMoneyInput((n) => (chargeForm.amountRials = n), v, true)" /> @@ -507,7 +545,7 @@ onMounted(async () => { dir="ltr" class="money-input" :value="toGroupedDisplay(form.alertCriticalRials)" - @update:value="(v) => (form.alertCriticalRials = fromGroupedInput(String(v)))" + @update:value="(v: string | number) => onGroupedMoneyInput((n) => (form.alertCriticalRials = n), v)" /> ذخیره آستانه‌ها @@ -557,16 +595,7 @@ onMounted(async () => { size="small" :pagination="false" :data-source="periodReport.byProvider" - :columns="[ - { title: 'ارائه‌دهنده', dataIndex: 'provider', key: 'provider' }, - { title: 'پیامک', dataIndex: 'messages', key: 'messages' }, - { title: 'پارت', dataIndex: 'parts', key: 'parts' }, - { - title: 'مبلغ', - key: 'amount', - customRender: ({ record }) => formatMoney(record.amount), - }, - ]" + :columns="providerReportColumns" row-key="provider" /> @@ -595,24 +624,7 @@ onMounted(async () => { :loading="chargeReportLoading" :pagination="false" :data-source="chargeReport.items" - :columns="[ - { - title: 'مبلغ', - key: 'amount', - customRender: ({ record }) => formatMoney(record.amount), - }, - { - title: 'مانده', - key: 'balanceAfter', - customRender: ({ record }) => formatMoney(record.balanceAfter), - }, - { title: 'توضیح', dataIndex: 'note', key: 'note' }, - { - title: 'زمان', - key: 'createdAt', - customRender: ({ record }) => formatIranDateTime(record.createdAt), - }, - ]" + :columns="chargeReportColumns" row-key="id" />