change configuration & add talabBedehi

This commit is contained in:
2026-05-25 10:49:08 +03:30
parent 5f5d9aef6a
commit 06568c5858
9 changed files with 255 additions and 107 deletions
+10 -8
View File
@@ -99,6 +99,7 @@ const form = ref<Const>({
description: '',
is_active: true
})
const formRef = ref<FormInstance>()
const typeItems = [
@@ -116,9 +117,6 @@ const typeItems = [
}
]
onMounted(() => {
initConfig()
})
const settingsConfig = {
// اطلاعات پایه
'name_fa': {
@@ -261,18 +259,18 @@ async function initConfig() {
loading.value = true
baseData.value = await getConfiguration()
items.value = baseData.value?.map((x: Const) => {
const title = x?.title_fa ?? (settingsConfig[x.key]?.title ?? x?.key)
const title_fa = x?.title_fa || settingsConfig[x.key]?.title || x?.key
return {
id: x.id,
name: `${title}`,
name: title_fa,
title_fa,
value: x.value,
key: x.key,
type: x.type || 'text',
description: x.description,
is_active: x.is_active,
list: settingsConfig[x.key]?.list ?? []
}
})
} catch (e) {
@@ -288,7 +286,7 @@ const groupedItems = computed(() => {
const type = item.type && result[item.type] ? item.type : 'text'
result[type].push(item)
})
console.log(result)
// console.log(result)
return result
})
@@ -318,7 +316,6 @@ async function ok() {
formRef.value?.validateFields().then(async () => {
try {
loading.value = true
console.log(form.value)
await setConfiguration(form.value)
await resetData()
@@ -331,6 +328,11 @@ async function ok() {
}
})
}
onMounted(() => {
initConfig()
})
</script>
<style lang="less"></style>