2026-04-29 11:20:59 +03:30
|
|
|
<template>
|
|
|
|
|
<div class="flex-wrap mb-2 flex justify-between items-center border-1 border-gray-300 border-solid rounded-lg p-3">
|
|
|
|
|
<div class="flex flex-col justify-between ">
|
|
|
|
|
<div class=" font-bold">{{ item.name }}</div>
|
|
|
|
|
<div class=" text-xs ">کلید: {{ item.key }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="flex">
|
|
|
|
|
<a-switch
|
2026-04-29 16:24:50 +03:30
|
|
|
checked-children="فعال"
|
|
|
|
|
un-checked-children="غیرفعال"
|
|
|
|
|
v-model:checked="value"
|
|
|
|
|
@change="ok"
|
2026-04-29 11:20:59 +03:30
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-04-29 16:24:50 +03:30
|
|
|
import {loading} from '@/utils'
|
|
|
|
|
import {setConfiguration} from '@/api/configuration'
|
|
|
|
|
import {message} from 'ant-design-vue'
|
|
|
|
|
import {onMounted} from 'vue'
|
|
|
|
|
import type {TagItem} from "@/components/BasicTags/model";
|
2026-04-29 11:20:59 +03:30
|
|
|
|
|
|
|
|
interface Prop {
|
2026-04-29 16:24:50 +03:30
|
|
|
item: TagItem
|
2026-04-29 11:20:59 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const props = defineProps<Prop>()
|
|
|
|
|
const value = ref<string>('false')
|
|
|
|
|
|
|
|
|
|
async function ok() {
|
|
|
|
|
let obj = {
|
|
|
|
|
id: props.item.id,
|
|
|
|
|
key: props.item.key,
|
2026-04-29 16:24:50 +03:30
|
|
|
value: `${value.value}`,
|
|
|
|
|
type:props.item.type,
|
|
|
|
|
title_fa:props.item.name,
|
|
|
|
|
description: props.item.description,
|
|
|
|
|
is_active: props.item.is_active,
|
2026-04-29 11:20:59 +03:30
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
loading.value = true
|
|
|
|
|
await setConfiguration(obj)
|
|
|
|
|
message.success('تغییر با موفقیت انجام شد')
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e)
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-29 16:24:50 +03:30
|
|
|
onMounted(() => {
|
|
|
|
|
value.value = props.item.value === 'true'
|
|
|
|
|
})
|
2026-04-29 11:20:59 +03:30
|
|
|
</script>
|