fix error in update me

This commit is contained in:
2026-07-16 11:36:16 +03:30
parent 14d0285847
commit 62414cac88
4 changed files with 129 additions and 108 deletions
@@ -9,6 +9,8 @@ import DatePicker from './datePick'
import locale from 'ant-design-vue/es/date-picker/locale/fa_IR'
import dayjs, { Dayjs } from 'dayjs'
import { omit } from 'lodash'
import { computed, useAttrs } from 'vue'
import { persianToEnglishDigits } from '@/utils/persianDigits'
interface Props {
value?: string | Dayjs
@@ -26,7 +28,7 @@ const _attrs = computed(() => {
const props = withDefaults(defineProps<Props>(), {
value: '',
format: 'YYYY/MM/DD',
format: 'YYYY-MM-DD',
inputReadOnly:true
})
@@ -39,7 +41,7 @@ const _date = computed({
set: (val) => {
let temp: string | null = null
if (val) {
temp = val.calendar('gregory').locale('en').format(props.format)
temp = persianToEnglishDigits(val.calendar('gregory').locale('en').format(props.format))
}
emit('update:value', temp)
emit('onchange', temp)
@@ -97,7 +97,7 @@ export function buildCustomerColumns(metals: CustomerMetalColumn[] = []): BaseTa
return [
...baseColumns,
...metalColumns,
{
/* {
title: 'اخرین بازدید',
dataIndex: 'last_seen_at',
key: 'last_seen_at',
@@ -105,7 +105,7 @@ export function buildCustomerColumns(metals: CustomerMetalColumn[] = []): BaseTa
customRender(data) {
return toJalali(data.record.last_seen_at)
}
},
},*/
{
title: 'وضعیت کاربر',
dataIndex: 'active',
@@ -25,6 +25,12 @@ export function getProductColumns(): BaseTableColumn[] {
sortable: false,
customRender: (record: any) => record.index + 1
},
{
title: 'کد محصول',
dataIndex: 'id',
key: 'id',
type: 'Number'
},
{
title: 'نام',
dataIndex: 'title',
@@ -63,9 +69,7 @@ export function getProductColumns(): BaseTableColumn[] {
type: 'Number',
customRender: (record) => (
<div class="flex justify-center">
{record?.record.reading_method
? `${record?.record.price_offset_percent ?? 0}`
: '—'}
{record?.record.reading_method ? `${record?.record.price_offset_percent ?? 0}` : '—'}
</div>
)
},
@@ -87,14 +91,16 @@ export function getProductColumns(): BaseTableColumn[] {
dataIndex: 'cash_fee_buy',
key: 'cash_fee_buy',
type: 'Number',
customRender: ({ record }) => formatAdminCashFeeLabel(record.cash_fee_buy, record.cash_fee_buy_is_percent)
customRender: ({ record }) =>
formatAdminCashFeeLabel(record.cash_fee_buy, record.cash_fee_buy_is_percent)
},
{
title: 'هزینه فروش',
dataIndex: 'cash_fee_sell',
key: 'cash_fee_sell',
type: 'Number',
customRender: ({ record }) => formatAdminCashFeeLabel(record.cash_fee_sell, record.cash_fee_sell_is_percent)
customRender: ({ record }) =>
formatAdminCashFeeLabel(record.cash_fee_sell, record.cash_fee_sell_is_percent)
},
...(isStoreApp() ? [inventoryColumn] : []),
{
+13
View File
@@ -0,0 +1,13 @@
const PERSIAN_DIGITS = '۰۱۲۳۴۵۶۷۸۹'
const ARABIC_DIGITS = '٠١٢٣٤٥٦٧٨٩'
export function persianToEnglishDigits(value: string | number | null | undefined): string {
if (value == null) {
return ''
}
return String(value)
.replace(/[۰-۹]/g, (d) => String(PERSIAN_DIGITS.indexOf(d)))
.replace(/[٠-٩]/g, (d) => String(ARABIC_DIGITS.indexOf(d)))
.replace(/٫/g, '.')
}