fix bug
This commit is contained in:
@@ -66,6 +66,18 @@
|
||||
</a-row>
|
||||
</template>
|
||||
|
||||
<SupportMessengerSettings
|
||||
v-if="supportMessengerBundle"
|
||||
:messenger-row="supportMessengerBundle.messenger"
|
||||
:id-row="supportMessengerBundle.id"
|
||||
:text-row="supportMessengerBundle.text"
|
||||
:draft-value="draftValue"
|
||||
:is-saving="isSaving"
|
||||
:is-saved-flash="isSavedFlash"
|
||||
@update:value="onValueChange"
|
||||
@update:is-active="onActiveChange"
|
||||
/>
|
||||
|
||||
<template v-if="otherRows.length">
|
||||
<div class="settings-section-title settings-section-title--spaced">سایر تنظیمات</div>
|
||||
<a-row :gutter="[16, 16]" class="settings-grid">
|
||||
@@ -90,7 +102,7 @@
|
||||
</template>
|
||||
|
||||
<a-empty
|
||||
v-if="!loading && !switchRows.length && !otherRows.length"
|
||||
v-if="!loading && !switchRows.length && !supportMessengerBundle && !otherRows.length"
|
||||
description="تنظیمی یافت نشد"
|
||||
class="mt-8"
|
||||
/>
|
||||
@@ -171,13 +183,17 @@ import { loading } from '@/utils'
|
||||
import { getConfiguration, setConfiguration } from '@/api/configuration'
|
||||
import SettingValueField from './SettingValueField.vue'
|
||||
import SettingCard from './SettingCard.vue'
|
||||
import SupportMessengerSettings from './SupportMessengerSettings.vue'
|
||||
import {
|
||||
SETTING_TYPE_OPTIONS,
|
||||
formatValueForSave,
|
||||
helpText,
|
||||
resolveSettingFieldType
|
||||
resolveSettingFieldType,
|
||||
SUPPORT_MESSENGER_KEYS
|
||||
} from './settingTypes'
|
||||
|
||||
const supportMessengerKeySet = new Set<string>(SUPPORT_MESSENGER_KEYS)
|
||||
|
||||
const settingTypeOptions = SETTING_TYPE_OPTIONS
|
||||
|
||||
const statusFilterOptions = [
|
||||
@@ -270,9 +286,24 @@ const switchRows = computed(() =>
|
||||
)
|
||||
|
||||
const otherRows = computed(() =>
|
||||
filteredRows.value.filter((row) => resolveSettingFieldType(row) !== 'switch')
|
||||
filteredRows.value.filter(
|
||||
(row) =>
|
||||
resolveSettingFieldType(row) !== 'switch' &&
|
||||
!supportMessengerKeySet.has(row.key ?? '')
|
||||
)
|
||||
)
|
||||
|
||||
const supportMessengerBundle = computed(() => {
|
||||
const rows = filteredRows.value.filter((row) => supportMessengerKeySet.has(row.key ?? ''))
|
||||
if (!rows.length) return null
|
||||
const byKey = Object.fromEntries(rows.map((row) => [row.key, row]))
|
||||
return {
|
||||
messenger: byKey.support_messenger as Const | undefined,
|
||||
id: byKey.support_messenger_id as Const | undefined,
|
||||
text: byKey.support_messenger_text as Const | undefined
|
||||
}
|
||||
})
|
||||
|
||||
function rowColSpan(row: Const): number {
|
||||
return resolveSettingFieldType(row) === 'longtext' ? 24 : 8
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user