1. 统一化代码

2. 增加 DocAlert 关联文档
This commit is contained in:
YunaiV
2023-04-05 20:13:35 +08:00
parent bb88e3d77c
commit 4404554cfc
111 changed files with 640 additions and 567 deletions

View File

@@ -16,7 +16,7 @@
<el-form-item label="公告类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择公告类型" clearable>
<el-option
v-for="dict in getDictOptions(DICT_TYPE.SYSTEM_NOTICE_TYPE)"
v-for="dict in getIntDictOptions(DICT_TYPE.SYSTEM_NOTICE_TYPE)"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
@@ -26,7 +26,7 @@
<el-form-item label="状态" prop="status">
<el-select v-model="formData.status" placeholder="请选择状态" clearable>
<el-option
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key="parseInt(dict.value)"
:label="dict.label"
:value="parseInt(dict.value)"
@@ -44,7 +44,8 @@
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { CommonStatusEnum } from '@/utils/constants'
import * as NoticeApi from '@/api/system/notice'
const { t } = useI18n() //
const message = useMessage() //
@@ -58,7 +59,7 @@ const formData = ref({
title: '',
type: undefined,
content: '',
status: undefined,
status: CommonStatusEnum.ENABLE,
remark: ''
})
const formRules = reactive({
@@ -70,7 +71,7 @@ const formRules = reactive({
const formRef = ref() // Ref
/** 打开弹窗 */
const openModal = async (type: string, id?: number) => {
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@@ -85,7 +86,7 @@ const openModal = async (type: string, id?: number) => {
}
}
}
defineExpose({ openModal }) // openModal
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
@@ -120,7 +121,7 @@ const resetForm = () => {
title: '',
type: undefined,
content: '',
status: undefined,
status: CommonStatusEnum.ENABLE,
remark: ''
}
formRef.value?.resetFields()

View File

@@ -1,5 +1,5 @@
<template>
<content-wrap>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
@@ -25,10 +25,10 @@
class="!w-240px"
>
<el-option
v-for="dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
:key="parseInt(dict.value)"
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key="dict.value"
:label="dict.label"
:value="parseInt(dict.value)"
:value="dict.value"
/>
</el-select>
</el-form-item>
@@ -38,17 +38,17 @@
<el-button
type="primary"
plain
@click="openModal('create')"
@click="openForm('create')"
v-hasPermi="['system:notice:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
</el-form-item>
</el-form>
</content-wrap>
</ContentWrap>
<!-- 列表 -->
<content-wrap>
<ContentWrap>
<el-table v-loading="loading" :data="list">
<el-table-column label="公告编号" align="center" prop="id" />
<el-table-column label="公告标题" align="center" prop="title" />
@@ -74,7 +74,7 @@
<el-button
link
type="primary"
@click="openModal('update', scope.row.id)"
@click="openForm('update', scope.row.id)"
v-hasPermi="['system:notice:update']"
>
编辑
@@ -97,17 +97,16 @@
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</content-wrap>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<notice-form ref="modalRef" @success="getList" />
<NoticeForm ref="formRef" @success="getList" />
</template>
<script setup lang="tsx">
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import * as NoticeApi from '@/api/system/notice'
import { DictTag } from '@/components/DictTag'
import NoticeForm from './form.vue'
import NoticeForm from './NoticeForm.vue'
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
@@ -148,9 +147,9 @@ const resetQuery = () => {
}
/** 添加/修改操作 */
const modalRef = ref()
const openModal = (type: string, id?: number) => {
modalRef.value.openModal(type, id)
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */