杂务:新增声明级注释覆盖率
This commit is contained in:
@@ -54,14 +54,42 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
/**
|
||||
* Purpose: LegalAgreementAdminVO supports LegalAgreementsView.vue by holding or executing the legal agreement admin vo page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
import { adminLegalAgreementApi, type LegalAgreementAdminVO } from '@/api/admin'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
/**
|
||||
* Purpose: loading supports LegalAgreementsView.vue by holding or executing the loading page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const loading = ref(false)
|
||||
/**
|
||||
* Purpose: saving supports LegalAgreementsView.vue by holding or executing the saving page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const saving = ref(false)
|
||||
/**
|
||||
* Purpose: modalOpen supports LegalAgreementsView.vue by holding or executing the modal open page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const modalOpen = ref(false)
|
||||
/**
|
||||
* Purpose: editingId supports LegalAgreementsView.vue by holding or executing the editing id page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const editingId = ref<IdType | null>(null)
|
||||
/**
|
||||
* Purpose: agreements supports LegalAgreementsView.vue by holding or executing the agreements page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const agreements = ref<LegalAgreementAdminVO[]>([])
|
||||
/**
|
||||
* Purpose: form supports LegalAgreementsView.vue by holding or executing the form page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const form = reactive({
|
||||
agreementType: 'USER_TERMS' as 'USER_TERMS' | 'PRIVACY_POLICY',
|
||||
title: '',
|
||||
@@ -69,6 +97,10 @@ const form = reactive({
|
||||
content: ''
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: columns supports LegalAgreementsView.vue by holding or executing the columns page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const columns = [
|
||||
{ title: '类型', dataIndex: 'agreementTypeName', key: 'agreementTypeName' },
|
||||
{ title: '标题', dataIndex: 'title', key: 'title' },
|
||||
@@ -78,6 +110,10 @@ const columns = [
|
||||
{ title: '操作', key: 'action', width: 220 }
|
||||
]
|
||||
|
||||
/**
|
||||
* Purpose: loadAgreements supports LegalAgreementsView.vue by holding or executing the load agreements page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const loadAgreements = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -87,6 +123,10 @@ const loadAgreements = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: resetForm supports LegalAgreementsView.vue by holding or executing the reset form page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const resetForm = () => {
|
||||
editingId.value = null
|
||||
form.agreementType = 'USER_TERMS'
|
||||
@@ -95,11 +135,19 @@ const resetForm = () => {
|
||||
form.content = ''
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: openCreate supports LegalAgreementsView.vue by holding or executing the open create page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const openCreate = () => {
|
||||
resetForm()
|
||||
modalOpen.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: openEdit supports LegalAgreementsView.vue by holding or executing the open edit page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const openEdit = (record: Record<string, any>) => {
|
||||
const agreement = record as LegalAgreementAdminVO
|
||||
editingId.value = agreement.id
|
||||
@@ -110,6 +158,10 @@ const openEdit = (record: Record<string, any>) => {
|
||||
modalOpen.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: saveAgreement supports LegalAgreementsView.vue by holding or executing the save agreement page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const saveAgreement = async () => {
|
||||
if (!form.title || !form.version || !form.content) {
|
||||
message.warning('请填写完整协议信息')
|
||||
@@ -130,12 +182,20 @@ const saveAgreement = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: publishAgreement supports LegalAgreementsView.vue by holding or executing the publish agreement page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const publishAgreement = async (id: IdType) => {
|
||||
await adminLegalAgreementApi.publish(id)
|
||||
message.success('发布成功')
|
||||
await loadAgreements()
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: disableAgreement supports LegalAgreementsView.vue by holding or executing the disable agreement page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const disableAgreement = async (id: IdType) => {
|
||||
await adminLegalAgreementApi.disable(id)
|
||||
message.success('已停用')
|
||||
|
||||
Reference in New Issue
Block a user