From bfa5e905e1306db09784b231e91737b35df1b64c Mon Sep 17 00:00:00 2001 From: zjl Date: Tue, 8 Oct 2024 13:25:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9D=97=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/content/ad/edit.vue | 33 +++- src/views/content/ad/index.vue | 43 ++++ src/views/content/adSort/edit.vue | 25 +++ src/views/content/adSort/index.vue | 46 ++++- src/views/content/adSort/querySchemas.ts | 2 +- src/views/content/article/edit.vue | 34 +++- src/views/content/article/index.vue | 45 +++++ src/views/content/category/edit.vue | 30 ++- src/views/content/category/index.vue | 32 ++- src/views/content/layout/edit.vue | 19 ++ src/views/content/layout/index.vue | 49 +++++ src/views/content/layoutItem/edit.vue | 46 ++++- src/views/content/layoutItem/index.vue | 45 +++++ src/views/content/layoutItem/layout/index.vue | 54 +++++- src/views/content/link/edit.vue | 19 ++ src/views/content/link/index.vue | 43 ++++ src/views/content/tag/edit.vue | 19 ++ src/views/content/tag/index.vue | 53 +++++ src/views/data/city/edit.vue | 32 +++ src/views/data/city/index.vue | 38 ++++ src/views/data/config/configItem.vue | 49 ++++- src/views/data/config/edit.vue | 19 ++ src/views/data/config/editItem.vue | 48 +++++ src/views/data/config/index.vue | 28 ++- src/views/data/dict/dictItem.vue | 47 ++++- src/views/data/dict/edit.vue | 19 ++ src/views/data/dict/editItem.vue | 19 ++ src/views/data/dict/index.vue | 52 ++++- src/views/data/message/edit.vue | 21 ++ src/views/data/message/index.vue | 44 ++++- src/views/data/notice/edit.vue | 20 ++ src/views/data/notice/index.vue | 39 ++++ src/views/data/param/edit.vue | 19 ++ src/views/data/param/index.vue | 51 +++++ src/views/file/emailTemplate/edit.vue | 27 ++- src/views/file/emailTemplate/index.vue | 56 +++++- src/views/file/fileTemplate/edit.vue | 30 ++- src/views/file/fileTemplate/index.vue | 55 ++++++ src/views/file/messageTemplate/edit.vue | 25 ++- src/views/file/messageTemplate/index.vue | 55 +++++- src/views/file/smsTemplate/edit.vue | 31 ++- src/views/file/smsTemplate/index.vue | 56 +++++- src/views/logger/emailLog/edit.vue | 21 ++ src/views/logger/emailLog/index.vue | 49 +++++ src/views/logger/fileLog/edit.vue | 12 ++ src/views/logger/fileLog/index.vue | 54 ++++++ src/views/logger/smsLog/edit.vue | 20 ++ src/views/logger/smsLog/index.vue | 48 +++++ src/views/monitor/cache/index.vue | 4 + src/views/monitor/caches/index.vue | 42 +++- src/views/monitor/dataSource/edit.vue | 19 ++ src/views/monitor/dataSource/index.vue | 52 +++++ src/views/monitor/job/edit.vue | 19 ++ src/views/monitor/job/index.vue | 67 +++++++ src/views/monitor/job/log/edit.vue | 12 ++ src/views/monitor/job/log/index.vue | 58 ++++++ src/views/monitor/online/index.vue | 30 +++ src/views/monitor/server/index.vue | 12 ++ src/views/setting/configWeb/BasicSetting.vue | 29 +++ src/views/setting/configWeb/EmailSetting.vue | 77 -------- src/views/setting/configWeb/RevealSetting.vue | 183 ------------------ src/views/setting/configWeb/index.vue | 11 ++ src/views/setting/profile/BasicSetting.vue | 18 +- src/views/tool/generator/edit.vue | 19 ++ src/views/tool/generator/index.vue | 39 ++++ 65 files changed, 2091 insertions(+), 321 deletions(-) delete mode 100644 src/views/setting/configWeb/EmailSetting.vue delete mode 100644 src/views/setting/configWeb/RevealSetting.vue diff --git a/src/views/content/ad/edit.vue b/src/views/content/ad/edit.vue index 2b9ad1f..15502cd 100644 --- a/src/views/content/ad/edit.vue +++ b/src/views/content/ad/edit.vue @@ -142,12 +142,17 @@ import { getAdSortAllList } from '@/api/content/adSort'; import { computed, onMounted, ref, shallowRef, reactive } from 'vue'; import { FormInstance } from 'element-plus'; - const formRef = shallowRef(); import UploadImg from '@/components/Upload/Image.vue'; import { useLockFn } from '@/utils/useLockFn'; import Editor from '@/components/Editor/tinymce.vue'; import { message } from '@/utils/auth'; + const formRef = shallowRef(); + const editorRef = ref(); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -168,12 +173,18 @@ const adTime = ref([]); const emit = defineEmits(['success', 'update:visible']); + /** + * 定义窗体标题 + */ const dialogTitle = computed(() => { return props.adId ? '编辑内容' : '新增内容'; }); const fwbHeight = document.body.clientHeight - 180; + /** + * 定义表单参数 + */ const formData = reactive({ id: '', title: '', @@ -193,10 +204,16 @@ sort: 0, }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getAdDetail(props.adId); for (const key in formData) { @@ -208,7 +225,9 @@ editorRef.value.myValue = formData.content; }; - const editorRef = ref(); + /** + * 执行提交表单 + */ const handleSubmit = async () => { formData.startTime = formData.adTime.length > 0 ? formData.adTime[0] : ''; formData.endTime = formData.adTime.length > 0 ? formData.adTime[1] : ''; @@ -216,7 +235,7 @@ let ruleForm = JSON.parse(JSON.stringify(formData)); ruleForm.content = editorRef.value.myValue; if (!ruleForm.content) { - message('请添加文章内容', 'error'); + message('请添加广告内容', 'error'); return; } props.adId ? await adUpdate(ruleForm) : await adAdd(ruleForm); @@ -226,10 +245,18 @@ }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + + /** + * 获取全部字典数据 + */ const getAllDict = async () => { let list = await getAdSortAllList(); adSortList.value = list ? list : []; }; + + /** + * 钩子函数 + */ onMounted(() => { getAllDict(); if (props.adId) { diff --git a/src/views/content/ad/index.vue b/src/views/content/ad/index.vue index 92db6fb..db7e75d 100644 --- a/src/views/content/ad/index.vue +++ b/src/views/content/ad/index.vue @@ -65,11 +65,19 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', status: '', adSortId: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -98,14 +106,24 @@ }, }); + /** + * 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getAdList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -113,6 +131,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -121,23 +144,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { adId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { adId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -148,6 +186,11 @@ message('删除成功'); reloadTable(); } + + /** + *选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/content/adSort/edit.vue b/src/views/content/adSort/edit.vue index e4c204b..41221bf 100644 --- a/src/views/content/adSort/edit.vue +++ b/src/views/content/adSort/edit.vue @@ -62,6 +62,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -71,6 +75,9 @@ sort: 0, }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -84,6 +91,10 @@ }, }); const locationList = ref([]); + + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.adSortId ? await adSortUpdate(formData) : await adSortAdd(formData); @@ -92,12 +103,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getAdSortDetail(props.adSortId); for (const key in formData) { @@ -107,10 +124,18 @@ } } }; + + /** + * 获取全部字典 + */ const getAllDict = async () => { let list = await getLayoutAllList(); locationList.value = list ? list : []; }; + + /** + * 钩子函数 + */ onMounted(() => { getAllDict(); if (props.adSortId) { diff --git a/src/views/content/adSort/index.vue b/src/views/content/adSort/index.vue index 84b9341..6dc869d 100644 --- a/src/views/content/adSort/index.vue +++ b/src/views/content/adSort/index.vue @@ -54,7 +54,6 @@ import { useForm } from '@/components/Form/index'; import { TableAction } from '@/components/Table'; import { getAdSortList, adSortDelete, adSortBatchDelete } from '@/api/content/adSort'; - import { getLayoutAllList } from '@/api/content/layout'; import { columns } from './columns'; import { PlusOutlined } from '@vicons/antd'; import { message, confirm } from '@/utils/auth'; @@ -63,10 +62,18 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ name: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -95,14 +102,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getAdSortList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -110,6 +129,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -118,23 +142,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { adSortId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { adSortId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -145,6 +184,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/content/adSort/querySchemas.ts b/src/views/content/adSort/querySchemas.ts index d9bb951..34e8e0c 100644 --- a/src/views/content/adSort/querySchemas.ts +++ b/src/views/content/adSort/querySchemas.ts @@ -3,7 +3,7 @@ export const schemas: FormSchema[] = [ { field: 'name', component: 'Input', - label: '名称', + label: '广告位名称', componentProps: { placeholder: '请输入广告位名称', }, diff --git a/src/views/content/article/edit.vue b/src/views/content/article/edit.vue index db285cb..f80bcb4 100644 --- a/src/views/content/article/edit.vue +++ b/src/views/content/article/edit.vue @@ -114,6 +114,9 @@ import Editor from '@/components/Editor/tinymce.vue'; import { message, buildTree } from '@/utils/auth'; + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -133,12 +136,18 @@ const categoryList = ref([]); const emit = defineEmits(['success', 'update:visible']); + /** + * 定义窗体标题 + */ const dialogTitle = computed(() => { - return props.articleId ? '编辑内容' : '新增内容'; + return props.articleId ? '编辑文章' : '新增文章'; }); const fwbHeight = document.body.clientHeight - 180; + /** + * 设置表单参数 + */ const formData = reactive({ id: '', categoryId: '', @@ -155,11 +164,17 @@ fileList: [], }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; - const setFormData = async (row: any) => { + /** + * 设置表单数据 + */ + const setFormData = async () => { const data = await getArticleDetail(props.articleId); for (const key in formData) { if (data[key] != null && data[key] != undefined) { @@ -179,11 +194,18 @@ const editorRef = ref(); + /** + * 上传文件 + * @param list 参数 + */ const fileUploads = (list: any) => { formData.fileList = list; formRef.value.validateField('fileList'); }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); // 文章图集处理,多个图片逗号分割 @@ -204,10 +226,18 @@ }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + + /** + * 获取全部字典 + */ const getAllDict = async () => { let list = await getCategoryList(); categoryList.value = list ? buildTree(list) : []; }; + + /** + * 钩子函数 + */ onMounted(() => { getAllDict(); if (props.articleId) { diff --git a/src/views/content/article/index.vue b/src/views/content/article/index.vue index ce15ff2..d6b0d2a 100644 --- a/src/views/content/article/index.vue +++ b/src/views/content/article/index.vue @@ -65,10 +65,18 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', status: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -98,14 +106,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getArticleList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -113,6 +133,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -121,23 +146,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { articleId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { articleId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -148,6 +188,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/content/category/edit.vue b/src/views/content/category/edit.vue index 64f773f..d567f5b 100644 --- a/src/views/content/category/edit.vue +++ b/src/views/content/category/edit.vue @@ -68,6 +68,10 @@ import { onMounted, reactive, ref, shallowRef } from 'vue'; import { message, buildTree } from '@/utils/auth'; import { useLockFn } from '@/utils/useLockFn'; + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -87,6 +91,9 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + /** + * 定义表单参数 + */ const formData = reactive({ id: '', //父级id @@ -104,7 +111,10 @@ const categoryOptions = ref([]); - const getMenu = async () => { + /** + * 获取分类数据 + */ + const getCategory = async () => { const data: any = await getCategoryList(); const menu: any = [{ id: 0, name: '顶级', children: [] }]; const lists = buildTree(data); @@ -112,6 +122,9 @@ categoryOptions.value = menu; }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.categoryId ? await categoryUpdate(formData) : await categoryAdd(formData); @@ -122,6 +135,9 @@ const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = (data: Record) => { for (const key in formData) { if (data[key] != null && data[key] != undefined) { @@ -130,17 +146,19 @@ } }; + /** + * 获取详情 + */ const getDetail = async () => { const data = await getCategoryDetail(props.categoryId); setFormData(data); }; - const handleClose = () => { - emit('close'); - }; - + /** + * 钩子函数 + */ onMounted(() => { - getMenu(); + getCategory(); if (props.categoryId) { getDetail(); } else { diff --git a/src/views/content/category/index.vue b/src/views/content/category/index.vue index fb46aea..88faad9 100644 --- a/src/views/content/category/index.vue +++ b/src/views/content/category/index.vue @@ -72,9 +72,11 @@ import { defineAsyncComponent, nextTick, onMounted, ref, shallowRef } from 'vue'; import { getCategoryList, categoryDelete } from '@/api/content/category'; import type { ElTable } from 'element-plus'; - const tableRef = shallowRef>(); import { confirm, message, buildTree } from '@/utils/auth'; + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); const isExpand = ref(false); @@ -83,7 +85,11 @@ const categoryId = ref(0); const pid = ref(0); const lists = ref([]); + const tableRef = shallowRef>(); + /** + * 获取全部分类 + */ const getLists = async () => { loading.value = true; try { @@ -95,6 +101,10 @@ } }; + /** + * 执行添加 + * @param parentId 上级ID + */ const handleAdd = async (parentId: any) => { categoryId.value = 0; pid.value = parentId ? parentId : 0; @@ -102,12 +112,20 @@ editVisible.value = true; }; + /** + * 执行编辑 + * @param data 参数 + */ const handleEdit = async (data: any) => { categoryId.value = data.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param categoryId 分类ID + */ const handleDelete = async (categoryId: number) => { await confirm('确定要删除?'); try { @@ -120,11 +138,17 @@ } }; + /** + * 执行扩展、收缩 + */ const handleExpand = () => { isExpand.value = !isExpand.value; toggleExpand(lists.value, isExpand.value); }; + /** + * 扩展、收缩实现 + */ const toggleExpand = (children: any[], unfold = true) => { for (const key in children) { tableRef.value?.toggleRowExpansion(children[key], unfold); @@ -134,10 +158,16 @@ } }; + /** + * 获取全部数据 + */ const getAll = () => { getLists(); }; + /** + * 钩子函数 + */ onMounted(() => { getAll(); }); diff --git a/src/views/content/layout/edit.vue b/src/views/content/layout/edit.vue index 7c0537c..5d18caf 100644 --- a/src/views/content/layout/edit.vue +++ b/src/views/content/layout/edit.vue @@ -48,6 +48,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', description: '', @@ -55,6 +59,9 @@ sort: 0, }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -68,6 +75,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.layoutId ? await layoutUpdate(formData) : await layoutAdd(formData); @@ -76,12 +86,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单 + */ const setFormData = async () => { const data = await getLayoutDetail(props.layoutId); for (const key in formData) { @@ -92,6 +108,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.layoutId) { setFormData(); diff --git a/src/views/content/layout/index.vue b/src/views/content/layout/index.vue index eadacb0..9b68a7b 100644 --- a/src/views/content/layout/index.vue +++ b/src/views/content/layout/index.vue @@ -57,14 +57,26 @@ import { columns } from './columns'; import { PlusOutlined } from '@vicons/antd'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); const layoutId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义表单参数 + */ const formParams = reactive({ description: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -93,14 +105,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getLayoutList({ ...formParams, ...res }); return result; }; + /** + *刷新数据表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -108,6 +132,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -116,23 +145,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { layoutId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { layoutId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -143,6 +187,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/content/layoutItem/edit.vue b/src/views/content/layoutItem/edit.vue index e65a6d2..047a442 100644 --- a/src/views/content/layoutItem/edit.vue +++ b/src/views/content/layoutItem/edit.vue @@ -68,7 +68,7 @@ v-if="chooseVisible" v-model:visible="chooseVisible" :type="formData.type" - @success="setArticle" + @success="selectedCallback" /> @@ -84,6 +84,12 @@ const emit = defineEmits(['success', 'update:visible']); const chooseArticle = defineAsyncComponent(() => import('./layout/index.vue')); const formRef = shallowRef(); + const chooseVisible = ref(false); + const layoutList = ref([]); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', layoutId: '', @@ -93,6 +99,10 @@ image: '', sort: 0, }); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -105,8 +115,10 @@ default: 0, }, }); - const chooseVisible = ref(false); - const layoutList = ref([]); + + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.layoutId ? await layoutUpdate(formData) : await layoutAdd(formData); @@ -115,12 +127,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 获取推荐内容 + */ const getLayoutItem = () => { if (!formData.type) { message('请选择页面类型', 'warning'); @@ -128,10 +146,18 @@ } chooseVisible.value = true; }; + + /** + * 执行设置类型 + */ const handleType = () => { formData.typeId = ''; formData.typeText = ''; }; + + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getLayoutDetail(props.layoutId); for (const key in formData) { @@ -141,15 +167,27 @@ } } }; - const setArticle = (row) => { + + /** + * 选择推荐内容成功回调 + */ + const selectedCallback = (row) => { formData.typeText = row.title; formData.typeId = row.id; formRef.value?.validateField('typeId'); }; + + /** + * 获取全部字典数据 + */ const getAllDict = async () => { let list = await getLayoutAllList(); layoutList.value = list ? list : []; }; + + /** + * 钩子函数 + */ onMounted(() => { getAllDict(); if (props.layoutId) { diff --git a/src/views/content/layoutItem/index.vue b/src/views/content/layoutItem/index.vue index 8f70497..d9a15ea 100644 --- a/src/views/content/layoutItem/index.vue +++ b/src/views/content/layoutItem/index.vue @@ -63,10 +63,18 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ layoutId: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -95,14 +103,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getLayoutList({ ...formParams, ...res }); return result; }; + /** + *刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -110,6 +130,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -118,23 +143,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { layoutId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { layoutId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -145,6 +185,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/content/layoutItem/layout/index.vue b/src/views/content/layoutItem/layout/index.vue index f00f31c..a4be212 100644 --- a/src/views/content/layoutItem/layout/index.vue +++ b/src/views/content/layoutItem/layout/index.vue @@ -39,7 +39,12 @@ import { schemas2 } from './notice/querySchemas'; const emit = defineEmits(['success', 'update:visible']); + const selectRow = ref({}); + const tableRef = ref(); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -52,19 +57,31 @@ default: 1, }, }); - const selectRow = ref({}); - const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', status: '', }); + + /** + * 定义列类型 + */ const columnsType = () => { if (props.type == 1) { + // 文章 return columns; } else if (props.type == 2) { + // 通知公告 return columns2; } }; + + /** + * 提交表单参数 + */ const handleSubmits = async () => { if (!selectRow.value.id) { return message('请选择推荐内容', 'error'); @@ -73,10 +90,17 @@ emit('success', selectRow.value); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { let result = []; if (props.type == 1) { @@ -87,9 +111,18 @@ return result; }; + + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -97,6 +130,11 @@ submitOnReset: true, schemas: props.type == 1 ? schemas : schemas2, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -105,13 +143,25 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 数据行点击事件 + * @param row 参数 + */ const rowClick = (row) => { selectRow.value = row; }; + + /** + * 钩子函数 + */ onMounted(() => {}); diff --git a/src/views/content/link/edit.vue b/src/views/content/link/edit.vue index 72b35a7..45f01e0 100644 --- a/src/views/content/link/edit.vue +++ b/src/views/content/link/edit.vue @@ -83,6 +83,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -94,6 +98,9 @@ sort: 0, }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -107,6 +114,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.linkId ? await linkUpdate(formData) : await linkAdd(formData); @@ -115,12 +125,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getLinkDetail(props.linkId); for (const key in formData) { @@ -131,6 +147,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.linkId) { setFormData(); diff --git a/src/views/content/link/index.vue b/src/views/content/link/index.vue index 2ac884d..2359eaa 100644 --- a/src/views/content/link/index.vue +++ b/src/views/content/link/index.vue @@ -62,9 +62,17 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ name: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -93,14 +101,25 @@ }, }); + /** + * 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getLinkList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -108,6 +127,10 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -116,23 +139,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { linkId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { linkId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -143,6 +181,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/content/tag/edit.vue b/src/views/content/tag/edit.vue index d18307d..882798b 100644 --- a/src/views/content/tag/edit.vue +++ b/src/views/content/tag/edit.vue @@ -38,6 +38,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -45,6 +49,9 @@ sort: 0, }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -58,6 +65,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.tagId ? await tagUpdate(formData) : await tagAdd(formData); @@ -66,12 +76,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getTagDetail(props.tagId); for (const key in formData) { @@ -82,6 +98,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.tagId) { setFormData(); diff --git a/src/views/content/tag/index.vue b/src/views/content/tag/index.vue index d550743..4557f99 100644 --- a/src/views/content/tag/index.vue +++ b/src/views/content/tag/index.vue @@ -57,14 +57,30 @@ import { columns } from './columns'; import { PlusOutlined } from '@vicons/antd'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const tagId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ name: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -93,14 +109,26 @@ }, }); + /** + * + * @param res 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getTagList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -108,6 +136,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -116,23 +149,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行重置 + */ const handleAdd = async () => { tagId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { tagId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -143,6 +191,11 @@ message('删除成功'); reloadTable(); } + + /** + *选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/data/city/edit.vue b/src/views/data/city/edit.vue index b79effb..1a3fce4 100644 --- a/src/views/data/city/edit.vue +++ b/src/views/data/city/edit.vue @@ -114,6 +114,10 @@ import { getCityByList } from '@/api/system/user'; import { message } from '@/utils/auth'; import { useLockFn } from '@/utils/useLockFn'; + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -130,6 +134,10 @@ default: () => {}, }, }); + + /** + * 定义选项数据 + */ const optionData = reactive({ cityTypeList: [ { @@ -148,11 +156,18 @@ id: 3, name: '街道', }, + { + id: 4, + name: '居委会', + }, ], }); const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + /** + * 定义表单参数 + */ const formData = reactive({ id: '', pid: '', @@ -167,6 +182,10 @@ lat: '', }); const caCheData = ref([]); + + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; @@ -195,6 +214,10 @@ const handleNodeClick = (data: Tree) => { formData.pid = data.id; }; + + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); if (formData.pid == 0) { @@ -208,6 +231,9 @@ const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = (data: Record) => { for (const key in formData) { if (data[key] != null && data[key] != undefined) { @@ -217,11 +243,17 @@ caCheData.value = [{ id: formData.pid, name: data.parentName }]; }; + /** + * 获取详情 + */ const getDetail = async () => { const data = await getCityDetail(props.cityId); setFormData(data); }; + /** + * 钩子函数 + */ onMounted(() => { if (props.cityId) { getDetail(); diff --git a/src/views/data/city/index.vue b/src/views/data/city/index.vue index 313f2bd..08b5e7c 100644 --- a/src/views/data/city/index.vue +++ b/src/views/data/city/index.vue @@ -87,8 +87,14 @@ const tableRef = ref(); import { confirm, message } from '@/utils/auth'; + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + /** + * 定义参数变量 + */ const loading = ref(false); const editVisible = ref(false); const cityId = ref(0); @@ -96,6 +102,11 @@ const lists = ref([]); const maps = ref(new Map()); + /** + * 获取城市列表 + * @param code 行政编码 + * @param resolve + */ const getDataList = async (code: any, resolve?: any) => { try { loading.value = true; @@ -124,6 +135,9 @@ } }; + /** + * 刷新城市列表 + */ const refreshDataList = (code) => { if (code == 0) { getDataList(0); @@ -134,10 +148,22 @@ } } }; + + /** + * 加载树结构 + * @param tree 数据 + * @param treeNode 树节点 + * @param resolve 解析 + */ const loadTree = (tree: any, treeNode: any, resolve: any) => { maps.value.set(tree.areaCode, { tree, treeNode, resolve }); getDataList(tree.areaCode, resolve); }; + + /** + * 执行添加 + * @param data 参数 + */ const handleAdd = async (data: any) => { cityId.value = 0; parentData.value = data; @@ -145,12 +171,20 @@ editVisible.value = true; }; + /** + * 执行编辑 + * @param data 参数 + */ const handleEdit = async (data: any) => { cityId.value = data.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param row 参数 + */ const handleDelete = async (row: any) => { await confirm('确定要删除?'); try { @@ -163,6 +197,10 @@ loading.value = false; } }; + + /** + * 钩子 + */ onMounted(() => { getDataList(0); }); diff --git a/src/views/data/config/configItem.vue b/src/views/data/config/configItem.vue index 319bb0a..0dc4c67 100644 --- a/src/views/data/config/configItem.vue +++ b/src/views/data/config/configItem.vue @@ -51,9 +51,17 @@ const editVisible = ref(false); const selectionData = ref([]); const configItemId = ref(0); + + /** + * 定义查询参数 + */ const params = ref({ name: '', }); + + /** + * 定义接收的参数 + */ const props = defineProps({ configId: { type: Number, @@ -61,6 +69,10 @@ default: 0, }, }); + + /** + * 定义侦听器 + */ watch( () => props.configId, async (value) => { @@ -70,10 +82,13 @@ } }, ); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, lable: '操作', - // title: '操作', prop: 'action', fixed: 'right', render(record) { @@ -97,28 +112,46 @@ }, }); - //刷新配置项值列表 + /** + * 刷新配置项值列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } - //加载配置项值列表 + + /** + * 加载配置项值列表 + * @param res 参数 + */ const loadDataTable = async (res) => { const result = await getConfigItemList({ ...params.value, configId: props.configId, ...res }); return result; }; - //新建配置 + + /** + * 执行添加 + */ const handleAdd = async () => { configItemId.value = 0; await nextTick(); editVisible.value = true; }; - //编辑配置 + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { configItemId.value = record.row.id; await nextTick(); editVisible.value = true; }; - //删除配置项 + + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -130,6 +163,10 @@ reloadTable(); } + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/data/config/edit.vue b/src/views/data/config/edit.vue index 0afc37e..1b11738 100644 --- a/src/views/data/config/edit.vue +++ b/src/views/data/config/edit.vue @@ -51,6 +51,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -59,6 +63,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -72,6 +79,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.configId ? await configUpdate(formData) : await configAdd(formData); @@ -80,12 +90,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getConfigDetail(props.configId); for (const key in formData) { @@ -96,6 +112,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.configId) { setFormData(); diff --git a/src/views/data/config/editItem.vue b/src/views/data/config/editItem.vue index 27f93e7..22bb52b 100644 --- a/src/views/data/config/editItem.vue +++ b/src/views/data/config/editItem.vue @@ -212,6 +212,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -230,6 +234,10 @@ }); const fwbHeight = document.body.clientHeight - 400; const optionsData = ref([]); + + /** + * 定义配置类型 + */ const typeList = ref([ { name: '隐藏', @@ -305,6 +313,9 @@ }, ]); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -322,6 +333,10 @@ default: 0, }, }); + + /** + * 配置类型选择发生变化事件 + */ const handleTypeChange = () => { formData.fileList = []; formData.fileName = ''; @@ -330,6 +345,9 @@ formData.value = ''; }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); formData.options = ''; @@ -371,12 +389,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getConfigItemDetail(props.configItemId); for (const key in formData) { @@ -430,19 +454,43 @@ }); } }; + + /** + * 添加选项行事件 + */ const addOptions = () => { optionsData.value.push({ name: '', value: '' }); }; + + /** + * 删除选项行事件 + * @param index 参数 + */ const delOptions = (index) => { optionsData.value.splice(index, 1); }; + + /** + * 文件上传 + * @param list 参数 + */ const fileUploads = (list: any) => { formData.fileList = list; }; + + /** + * 文件上传 + * @param filePath 文件路径 + * @param fileName 文件名称 + */ const fileUploadFile = async (filePath: any, fileName: any) => { formData.filePath = filePath; formData.fileName = fileName; }; + + /** + * 钩子函数 + */ onMounted(() => { if (props.configItemId) { setFormData(); diff --git a/src/views/data/config/index.vue b/src/views/data/config/index.vue index 5cb4516..4532225 100644 --- a/src/views/data/config/index.vue +++ b/src/views/data/config/index.vue @@ -28,7 +28,7 @@
- 新建 { + /** + * 执行添加 + */ + const handleAdd = async () => { configId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + */ const handleEdit = () => { editVisible.value = true; }; + /** + * 选中行事件 + * @param row 参数 + */ function onCheckedRow(row) { configId.value = row.id; } + /** + * 加载数据列表 + */ const loadDataTable = async () => { const result = await getConfigList({ ...params.value, @@ -128,6 +145,9 @@ pager.value.count = result.total; }; + /** + * 执行删除 + */ async function handleDelete() { await confirm('确定要删除?'); await configDelete(configId.value); @@ -135,6 +155,10 @@ pager.value.page = 1; loadDataTable(); } + + /** + * 钩子函数 + */ onMounted(() => { loadDataTable(); }); diff --git a/src/views/data/dict/dictItem.vue b/src/views/data/dict/dictItem.vue index e92057d..0f38e7a 100644 --- a/src/views/data/dict/dictItem.vue +++ b/src/views/data/dict/dictItem.vue @@ -51,9 +51,17 @@ const editVisible = ref(false); const selectionData = ref([]); const dictItemId = ref(0); + + /** + * 定义查询参数 + */ const params = ref({ name: '', }); + + /** + * 定义接收的参数 + */ const props = defineProps({ dictId: { type: Number, @@ -61,6 +69,10 @@ default: 0, }, }); + + /** + * 定义侦听器 + */ watch( () => props.dictId, async (value) => { @@ -70,10 +82,13 @@ } }, ); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, lable: '操作', - // title: '操作', prop: 'action', fixed: 'right', render(record) { @@ -97,29 +112,45 @@ }, }); - //刷新字典项值列表 + /** + * 刷新字典项值列表 + */ function reloadTable() { tableRef.value.reload({ pageNo: 1 }); } - //加载字典项值列表 + /** + * 加载字典项值列表 + * @param res 参数 + */ const loadDataTable = async (res) => { const result = await getDictItemList({ ...params.value, dictId: props.dictId, ...res }); return result; }; - //新建字典 + + /** + * 执行添加 + */ const handleAdd = async () => { dictItemId.value = 0; await nextTick(); editVisible.value = true; }; - //编辑字典 + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { dictItemId.value = record.row.id; await nextTick(); editVisible.value = true; }; - //删除字典项 + + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -131,6 +162,10 @@ reloadTable(); } + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/data/dict/edit.vue b/src/views/data/dict/edit.vue index a1ba1ed..4d881ef 100644 --- a/src/views/data/dict/edit.vue +++ b/src/views/data/dict/edit.vue @@ -51,6 +51,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -59,6 +63,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -72,6 +79,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.dictId ? await dictUpdate(formData) : await dictAdd(formData); @@ -80,12 +90,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getDictDetail(props.dictId); for (const key in formData) { @@ -96,6 +112,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.dictId) { setFormData(); diff --git a/src/views/data/dict/editItem.vue b/src/views/data/dict/editItem.vue index 2e67941..dd848c9 100644 --- a/src/views/data/dict/editItem.vue +++ b/src/views/data/dict/editItem.vue @@ -55,6 +55,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -63,6 +67,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -81,6 +88,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.dictItemId @@ -91,12 +101,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getDictItemDetail(props.dictItemId); for (const key in formData) { @@ -107,6 +123,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.dictItemId) { setFormData(); diff --git a/src/views/data/dict/index.vue b/src/views/data/dict/index.vue index 0cc1e81..e0e47fb 100644 --- a/src/views/data/dict/index.vue +++ b/src/views/data/dict/index.vue @@ -35,7 +35,7 @@
- 新建 import('./edit.vue')); + + /** + * 定义参数变量 + */ const dictId = ref(0); const dictItemShow = ref(false); const dictDataList = ref([]); const editVisible = ref(false); + + /** + * 定义查询参数 + */ const params = ref({ name: '', }); + + /** + *定义分页参数 + */ const pager = ref({ page: 1, size: 20, @@ -108,22 +124,33 @@ }); const fwbHeight = document.body.clientHeight - 395; - //新建字典 - const addDict = async () => { + /** + * 执行添加 + */ + const handleAdd = async () => { dictId.value = 0; await nextTick(); editVisible.value = true; }; - //编辑字典 + + /** + * 执行编辑 + */ const handleEdit = () => { editVisible.value = true; }; - //选择字典项 + + /** + * 字典数据选中事件 + * @param row 参数 + */ function onCheckedRow(row) { dictId.value = row.id; } - //加载字典项值列表; + /** + * 加载字典项值列表 + */ const loadDataTable = async () => { const result = await getDictList({ ...params.value, @@ -136,12 +163,17 @@ pager.value.count = result.total; }; - //刷新缓存 + /** + * 刷新缓存 + */ async function dictRefresh() { await refreshCache(); message('刷新成功'); } - //删除字典项 + + /** + * 删除字典项 + */ async function handleDelete() { await confirm('确定要删除?'); await dictDelete(dictId.value); @@ -149,6 +181,10 @@ pager.value.page = 1; loadDataTable(); } + + /** + * 钩子函数 + */ onMounted(() => { loadDataTable(); }); diff --git a/src/views/data/message/edit.vue b/src/views/data/message/edit.vue index d361a5d..c1db6df 100644 --- a/src/views/data/message/edit.vue +++ b/src/views/data/message/edit.vue @@ -35,6 +35,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', title: '', @@ -44,6 +48,9 @@ content: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -57,10 +64,16 @@ }, }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getMessageDetail(props.messageId); for (const key in formData) { @@ -87,6 +100,11 @@ } return typeText; }; + + /** + * 获取类型描述 + * @param type 类型 + */ const getTyepText = (type) => { let typeText = ''; switch (type) { @@ -105,6 +123,9 @@ return typeText; }; + /** + * 钩子函数 + */ onMounted(() => { if (props.messageId) { setFormData(); diff --git a/src/views/data/message/index.vue b/src/views/data/message/index.vue index bc7cd21..0e13d31 100644 --- a/src/views/data/message/index.vue +++ b/src/views/data/message/index.vue @@ -53,12 +53,20 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', bizType: '', type: '', status: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -72,7 +80,7 @@ label: '详情', icon: 'View', type: 'warning', - onClick: handleInfo.bind(null, record), + onClick: handleDetail.bind(null, record), auth: ['sys:message:detail'], }, { @@ -87,14 +95,25 @@ }, }); + /** + * 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getMessageList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -102,6 +121,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -110,18 +134,29 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } - const handleInfo = async (record: Recordable) => { + /** + * 执行查询详情 + * @param record 参数 + */ + const handleDetail = async (record: Recordable) => { messageId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -132,6 +167,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/data/notice/edit.vue b/src/views/data/notice/edit.vue index 9c81269..4fab2d2 100644 --- a/src/views/data/notice/edit.vue +++ b/src/views/data/notice/edit.vue @@ -74,6 +74,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); const editorRef = ref(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', title: '', @@ -83,6 +87,9 @@ content: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -96,6 +103,10 @@ }, }); const fwbHeight = document.body.clientHeight - 400; + + /** + * 执行提交表单 + */ const handleSubmit = async () => { formData.content = editorRef.value.myValue; await formRef.value?.validate(); @@ -107,12 +118,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getNoticeDetail(props.noticeId); for (const key in formData) { @@ -124,6 +141,9 @@ editorRef.value.myValue = formData.content; }; + /** + * 钩子函数 + */ onMounted(() => { if (props.noticeId) { setFormData(); diff --git a/src/views/data/notice/index.vue b/src/views/data/notice/index.vue index fbd26ea..ceb694a 100644 --- a/src/views/data/notice/index.vue +++ b/src/views/data/notice/index.vue @@ -64,11 +64,19 @@ const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', status: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -97,14 +105,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getNoticeList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -112,6 +132,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -120,23 +145,37 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { noticeId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + */ const handleEdit = async (record: Recordable) => { noticeId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { diff --git a/src/views/data/param/edit.vue b/src/views/data/param/edit.vue index 93c3a3d..de172b3 100644 --- a/src/views/data/param/edit.vue +++ b/src/views/data/param/edit.vue @@ -68,6 +68,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -79,6 +83,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -92,6 +99,9 @@ }, }); + /** + * 定义提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.paramId ? await paramUpdate(formData) : await paramAdd(formData); @@ -100,12 +110,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getParamDetail(props.paramId); for (const key in formData) { @@ -116,6 +132,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.paramId) { setFormData(); diff --git a/src/views/data/param/index.vue b/src/views/data/param/index.vue index 6610566..259e54e 100644 --- a/src/views/data/param/index.vue +++ b/src/views/data/param/index.vue @@ -57,16 +57,32 @@ import { columns } from './columns'; import { PlusOutlined } from '@vicons/antd'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const paramId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ name: '', status: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -95,14 +111,24 @@ }, }); + /** + * 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getParamList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -110,6 +136,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -118,23 +149,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { paramId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { paramId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -145,6 +191,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/file/emailTemplate/edit.vue b/src/views/file/emailTemplate/edit.vue index 03c16fb..d915a2d 100644 --- a/src/views/file/emailTemplate/edit.vue +++ b/src/views/file/emailTemplate/edit.vue @@ -80,10 +80,14 @@ import { computed, onMounted, shallowRef, reactive, ref, nextTick } from 'vue'; import { FormInstance } from 'element-plus'; import { message } from '@/utils/auth'; - const formRef = shallowRef(); import { useLockFn } from '@/utils/useLockFn'; import UploadFile from '@/components/Upload/file.vue'; + const formRef = shallowRef(); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -99,10 +103,16 @@ const emit = defineEmits(['success', 'update:visible']); + /** + * 关闭窗体 + */ const dialogTitle = computed(() => { return props.id ? '编辑模板文件' : '新增模板文件'; }); + /** + * 定义表单参数 + */ const formData = reactive({ id: '', title: '', @@ -113,6 +123,9 @@ fileName: '', }); + /** + * 文件上传 + */ const fileUpload = async (filePath: any, fileName: any) => { formData.filePath = filePath; formData.fileName = fileName; @@ -121,10 +134,16 @@ }); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async (id: any) => { const data = await getEmailTemplateDetail(id); for (const key in formData) { @@ -134,6 +153,9 @@ } }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.id ? await emailTemplateUpdate(formData) : await emailTemplateAdd(formData); @@ -144,6 +166,9 @@ const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 钩子函数 + */ onMounted(() => { if (props.id) { setFormData(props.id); diff --git a/src/views/file/emailTemplate/index.vue b/src/views/file/emailTemplate/index.vue index 53c2bf2..1f2b8e4 100644 --- a/src/views/file/emailTemplate/index.vue +++ b/src/views/file/emailTemplate/index.vue @@ -64,15 +64,31 @@ } from '@/api/file/emailTemplate'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const emailId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -101,14 +117,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getEmailTemplateList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -116,6 +144,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -124,22 +157,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } - const handleAdd = async (record: Recordable) => { + + /** + * 执行添加 + */ + const handleAdd = async () => { emailId.value = 0; await nextTick(); editVisible.value = true; }; + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { emailId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -150,6 +199,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/file/fileTemplate/edit.vue b/src/views/file/fileTemplate/edit.vue index 149b5e2..bd25b8d 100644 --- a/src/views/file/fileTemplate/edit.vue +++ b/src/views/file/fileTemplate/edit.vue @@ -66,10 +66,14 @@ import { computed, onMounted, shallowRef, reactive, ref, nextTick } from 'vue'; import { FormInstance } from 'element-plus'; import { message } from '@/utils/auth'; - const formRef = shallowRef(); import { useLockFn } from '@/utils/useLockFn'; import UploadFile from '@/components/Upload/file.vue'; + const formRef = shallowRef(); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -85,10 +89,16 @@ const emit = defineEmits(['success', 'update:visible']); + /** + * 关闭窗体 + */ const dialogTitle = computed(() => { return props.id ? '编辑模板文件' : '新增模板文件'; }); + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -97,6 +107,11 @@ fileName: '', }); + /** + * 文件上传 + * @param filePath 文件路径 + * @param fileName 文件名称 + */ const fileUpload = async (filePath: any, fileName: any) => { formData.filePath = filePath; formData.fileName = fileName; @@ -105,10 +120,17 @@ }); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + * @param id 参数 + */ const setFormData = async (id: any) => { const data = await getFileTemplateDetail(id); for (const key in formData) { @@ -118,6 +140,9 @@ } }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.id ? await fileTemplateUpdate(formData) : await fileTemplateAdd(formData); @@ -128,6 +153,9 @@ const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 钩子函数 + */ onMounted(() => { if (props.id) { setFormData(props.id); diff --git a/src/views/file/fileTemplate/index.vue b/src/views/file/fileTemplate/index.vue index 84602a9..bd1195d 100644 --- a/src/views/file/fileTemplate/index.vue +++ b/src/views/file/fileTemplate/index.vue @@ -64,14 +64,30 @@ } from '@/api/file/fileTemplate'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const fileId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ name: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -100,14 +116,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getFileTemplateList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -115,6 +143,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -123,22 +156,39 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + * @param record 参数 + */ const handleAdd = async (record: Recordable) => { fileId.value = 0; await nextTick(); editVisible.value = true; }; + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { fileId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -149,6 +199,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/file/messageTemplate/edit.vue b/src/views/file/messageTemplate/edit.vue index aa7bb7b..de1ebf6 100644 --- a/src/views/file/messageTemplate/edit.vue +++ b/src/views/file/messageTemplate/edit.vue @@ -87,9 +87,13 @@ import { computed, onMounted, shallowRef, reactive, ref } from 'vue'; import { FormInstance } from 'element-plus'; import { message } from '@/utils/auth'; - const formRef = shallowRef(); import { useLockFn } from '@/utils/useLockFn'; + const formRef = shallowRef(); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -105,10 +109,16 @@ const emit = defineEmits(['success', 'update:visible']); + /** + * 关闭窗体 + */ const dialogTitle = computed(() => { return props.id ? '编辑消息模板' : '新增消息模板'; }); + /** + * 定义表单参数 + */ const formData = reactive({ id: '', title: '', @@ -118,10 +128,17 @@ type: '', }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + * @param id 参数 + */ const setFormData = async (id: any) => { const data = await getMessageTemplateDetail(id); for (const key in formData) { @@ -131,6 +148,9 @@ } }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.id ? await messageTemplateUpdate(formData) : await messageTemplateAdd(formData); @@ -141,6 +161,9 @@ const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 钩子函数 + */ onMounted(() => { if (props.id) { setFormData(props.id); diff --git a/src/views/file/messageTemplate/index.vue b/src/views/file/messageTemplate/index.vue index 49bce34..331a5cb 100644 --- a/src/views/file/messageTemplate/index.vue +++ b/src/views/file/messageTemplate/index.vue @@ -64,15 +64,31 @@ } from '@/api/file/messageTemplate'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const messageId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -101,14 +117,25 @@ }, }); + /** + *加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getMessageTemplateList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -116,6 +143,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -124,22 +156,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } - const handleAdd = async (record: Recordable) => { + + /** + * 执行添加 + */ + const handleAdd = async () => { messageId.value = 0; await nextTick(); editVisible.value = true; }; + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { messageId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -150,6 +198,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/file/smsTemplate/edit.vue b/src/views/file/smsTemplate/edit.vue index 80d5bea..b5a96f5 100644 --- a/src/views/file/smsTemplate/edit.vue +++ b/src/views/file/smsTemplate/edit.vue @@ -20,14 +20,14 @@ /> @@ -83,9 +83,13 @@ import { computed, onMounted, shallowRef, reactive, ref } from 'vue'; import { FormInstance } from 'element-plus'; import { message } from '@/utils/auth'; - const formRef = shallowRef(); import { useLockFn } from '@/utils/useLockFn'; + const formRef = shallowRef(); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -101,10 +105,16 @@ const emit = defineEmits(['success', 'update:visible']); + /** + * 定义弹窗标题 + */ const dialogTitle = computed(() => { return props.id ? '编辑短信模板' : '新增短信模板'; }); + /** + * 定义表单参数 + */ const formData = reactive({ id: '', title: '', @@ -114,10 +124,17 @@ type: '', }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + * @param id 参数 + */ const setFormData = async (id: any) => { const data = await getSmsTemplateDetail(id); for (const key in formData) { @@ -127,6 +144,9 @@ } }; + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.id ? await smsTemplateUpdate(formData) : await smsTemplateAdd(formData); @@ -137,6 +157,9 @@ const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 钩子函数 + */ onMounted(() => { if (props.id) { setFormData(props.id); diff --git a/src/views/file/smsTemplate/index.vue b/src/views/file/smsTemplate/index.vue index 9e7a04d..53ef531 100644 --- a/src/views/file/smsTemplate/index.vue +++ b/src/views/file/smsTemplate/index.vue @@ -64,15 +64,31 @@ } from '@/api/file/smsTemplate'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const smsId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', type: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -101,14 +117,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getSmsTemplateList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -116,6 +144,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -124,22 +157,38 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } - const handleAdd = async (record: Recordable) => { + + /** + * 执行添加 + */ + const handleAdd = async () => { smsId.value = 0; await nextTick(); editVisible.value = true; }; + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { smsId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -150,6 +199,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/logger/emailLog/edit.vue b/src/views/logger/emailLog/edit.vue index cdc6f8b..954f1c1 100644 --- a/src/views/logger/emailLog/edit.vue +++ b/src/views/logger/emailLog/edit.vue @@ -64,6 +64,9 @@ const emit = defineEmits(['success', 'update:visible']); const formData = ref({}); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -77,14 +80,24 @@ }, }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getEmailLogDetail(props.emailId); formData.value = data; }; + + /** + * 获取接收人类型描述 + */ const getReviceType = (type) => { let typeText = ''; switch (type) { @@ -102,6 +115,11 @@ } return typeText; }; + + /** + * 获取日志类型描述 + * @param type 类型 + */ const getTyepText = (type) => { let typeText = ''; switch (type) { @@ -126,6 +144,9 @@ return typeText; }; + /** + * 钩子函数 + */ onMounted(() => { if (props.emailId) { setFormData(); diff --git a/src/views/logger/emailLog/index.vue b/src/views/logger/emailLog/index.vue index 5e99fd8..3b62ec1 100644 --- a/src/views/logger/emailLog/index.vue +++ b/src/views/logger/emailLog/index.vue @@ -52,17 +52,33 @@ import { getEmailLogList, emailLogDelete, emailLogBatchDelete } from '@/api/logger/emailLog'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const emailId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', receiveType: '', bizType: '', status: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 250, label: '操作', @@ -91,14 +107,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getEmailLogList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -106,6 +134,10 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -114,17 +146,29 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行查询详情 + * @param record 参数 + */ const handleDetail = async (record: Recordable) => { emailId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -135,6 +179,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/logger/fileLog/edit.vue b/src/views/logger/fileLog/edit.vue index 9ee2166..73583c5 100644 --- a/src/views/logger/fileLog/edit.vue +++ b/src/views/logger/fileLog/edit.vue @@ -61,6 +61,9 @@ const emit = defineEmits(['success', 'update:visible']); const formData = ref({}); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -74,15 +77,24 @@ }, }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getFileLogDetail(props.fileId); formData.value = data; }; + /** + * 钩子函数 + */ onMounted(() => { if (props.fileId) { setFormData(); diff --git a/src/views/logger/fileLog/index.vue b/src/views/logger/fileLog/index.vue index 48c8fa0..6b190cd 100644 --- a/src/views/logger/fileLog/index.vue +++ b/src/views/logger/fileLog/index.vue @@ -58,15 +58,31 @@ import UploadFile from '@/components/Upload/file.vue'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const fileId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ fileName: '', fileType: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -95,14 +111,25 @@ }, }); + /** + * 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getFileLogList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -110,6 +137,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -118,19 +150,36 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行查询详情 + * @param record 参数 + */ const handleDetail = async (record: Recordable) => { fileId.value = record.row.id; await nextTick(); editVisible.value = true; }; + + /** + * 上传文件 + */ const fileUploadFiles = () => { reloadTable(); }; + + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -141,6 +190,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/logger/smsLog/edit.vue b/src/views/logger/smsLog/edit.vue index fb6ccb7..930376d 100644 --- a/src/views/logger/smsLog/edit.vue +++ b/src/views/logger/smsLog/edit.vue @@ -71,6 +71,9 @@ const formRef = shallowRef(); const formData = ref({}); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -84,14 +87,24 @@ }, }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getSmsLogDetail(props.smsId); formData.value = data; }; + + /** + * 获取接收人类型描述 + */ const getReviceType = (type) => { let typeText = ''; switch (type) { @@ -109,6 +122,10 @@ } return typeText; }; + + /** + * 获取日志类型描述 + */ // 此处作为经典案例,禁止删除 const getTyepText = (type) => { let typeText = ''; @@ -134,6 +151,9 @@ return typeText; }; + /** + * 钩子函数 + */ onMounted(() => { if (props.smsId) { setFormData(); diff --git a/src/views/logger/smsLog/index.vue b/src/views/logger/smsLog/index.vue index 2872c1e..be39fbd 100644 --- a/src/views/logger/smsLog/index.vue +++ b/src/views/logger/smsLog/index.vue @@ -52,17 +52,33 @@ import { getSmsLogList, smsLogDelete, smsLogBatchDelete } from '@/api/logger/smsLog'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const smsId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ title: '', receiveType: '', bizType: '', status: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -91,14 +107,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getSmsLogList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -106,6 +134,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -114,17 +147,27 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行查询详情 + */ const handleDetail = async (record: Recordable) => { smsId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -135,6 +178,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/monitor/cache/index.vue b/src/views/monitor/cache/index.vue index 0ac9fa3..ba08ff2 100644 --- a/src/views/monitor/cache/index.vue +++ b/src/views/monitor/cache/index.vue @@ -84,6 +84,10 @@ const baseInfo = ref({}); const commandStats = ref([]); const gaugeValue = ref(''); + + /** + * 获取缓存信息 + */ const loadCacheInfo = async () => { const result = await getCacheInfo(); commandStats.value = result.commandStats; diff --git a/src/views/monitor/caches/index.vue b/src/views/monitor/caches/index.vue index 6bc486b..c72a478 100644 --- a/src/views/monitor/caches/index.vue +++ b/src/views/monitor/caches/index.vue @@ -114,6 +114,10 @@ const cacheKeyTable = ref(); const cacheNameData = ref([]); const cacheKeyData = ref([]); + + /** + * 定义表单参数 + */ const formData = reactive({ cacheKey: '', cacheName: '', @@ -124,18 +128,26 @@ const cacheKey = ref(''); const fwbHeight = document.body.clientHeight - 230; - //选择缓存名 + /** + * 选择缓存名 + * @param row 参数 + */ const onCheckedCacheName = (row) => { cacheName.value = row.cacheName; loadCachekeys(); }; - //选择缓存key + + /** + * 选择缓存key + */ const onCheckedCachKey = (row) => { cacheKey.value = row.cacheKey; loadCacheValue(); }; - //加载缓存名列表 + /** + * 加载缓存名列表 + */ const loadCacheNames = async () => { const result = await getCacheNames(); cacheNameData.value = result; @@ -147,7 +159,10 @@ loadCachekeys(); } }; - //加载缓存key列表 + + /** + * 加载缓存key列表 + */ const loadCachekeys = async () => { let datas = []; const result = await getCacheKeys(cacheName.value); @@ -166,7 +181,10 @@ loadCacheValue(); } }; - //加载缓存value列表 + + /** + * 加载缓存value列表 + */ const loadCacheValue = async () => { const data = await getCacheValue({ cacheName: cacheName.value, cacheKey: cacheKey.value }); for (const key in formData) { @@ -175,6 +193,12 @@ } } }; + + /** + * 执行删除 + * @param row 行数据 + * @param type 类型 + */ const handleDelete = async (row, type) => { await confirm('确定要删除?'); if (type == 'cacheName') { @@ -187,11 +211,19 @@ loadCachekeys(); } }; + + /** + * 清除全部缓存 + */ const clearAll = async () => { await confirm('确定要清理全部?'); await deleteCacheAll(); loadCacheNames(); }; + + /** + * 钩子函数 + */ onMounted(() => { loadCacheNames(); }); diff --git a/src/views/monitor/dataSource/edit.vue b/src/views/monitor/dataSource/edit.vue index d6a081c..698ebff 100644 --- a/src/views/monitor/dataSource/edit.vue +++ b/src/views/monitor/dataSource/edit.vue @@ -127,6 +127,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -140,6 +144,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -153,6 +160,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.dataSourceId ? await dataSourceUpdate(formData) : await dataSourceAdd(formData); @@ -161,12 +171,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getDataSourceDetail(props.dataSourceId); for (const key in formData) { @@ -177,6 +193,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.dataSourceId) { setFormData(); diff --git a/src/views/monitor/dataSource/index.vue b/src/views/monitor/dataSource/index.vue index 4533d58..513becd 100644 --- a/src/views/monitor/dataSource/index.vue +++ b/src/views/monitor/dataSource/index.vue @@ -61,15 +61,31 @@ import { columns } from './columns'; import { PlusOutlined } from '@vicons/antd'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const dataSourceId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ name: '', dbType: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -98,14 +114,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getDataSourceList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 100, layout: 'horizontal', @@ -113,6 +141,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -121,23 +154,37 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { dataSourceId.value = 0; await nextTick(); editVisible.value = true; }; + /** + * 执行编辑 + */ const handleEdit = async (record: Recordable) => { dataSourceId.value = record.row.id; await nextTick(); editVisible.value = true; }; + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -148,6 +195,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/monitor/job/edit.vue b/src/views/monitor/job/edit.vue index a2d20d8..f25281f 100644 --- a/src/views/monitor/job/edit.vue +++ b/src/views/monitor/job/edit.vue @@ -125,6 +125,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', jobName: '', @@ -139,6 +143,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -152,6 +159,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.jobId ? await jobUpdate(formData) : await jobAdd(formData); @@ -160,12 +170,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单参数 + */ const setFormData = async () => { const data = await getJobDetail(props.jobId); for (const key in formData) { @@ -176,6 +192,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.jobId) { setFormData(); diff --git a/src/views/monitor/job/index.vue b/src/views/monitor/job/index.vue index 3c23a0f..e3e603d 100644 --- a/src/views/monitor/job/index.vue +++ b/src/views/monitor/job/index.vue @@ -71,17 +71,33 @@ import { message, confirm } from '@/utils/auth'; import { useRouter } from 'vue-router'; const router = useRouter(); + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); const jobLog = defineAsyncComponent(() => import('./log/index.vue')); + + /** + * 定义参数变量 + */ const jobId = ref(0); const editVisible = ref(false); const editLogVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ jobName: '', status: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 350, label: '操作', @@ -152,6 +168,9 @@ }, }); + /** + * 加载数据列表 + */ const loadDataTable = async (res: any) => { const result = await getJobList({ ...formParams, ...res }); result.records.map((item) => { @@ -164,9 +183,16 @@ return result; }; + /** + * 刷新数据列表 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 100, layout: 'horizontal', @@ -174,6 +200,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -182,26 +213,48 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 执行添加 + */ const handleAdd = async () => { jobId.value = 0; await nextTick(); editVisible.value = true; }; + + /** + * 执行设置状态 + * @param row 参数 + */ const handelSetStatus = async (row) => { await setJobStatus({ id: row.id, status: row.realStatus ? 1 : 0 }); message('设置成功'); reloadTable('noRefresh'); }; + + /** + * 执行编辑 + * @param record 参数 + */ const handleEdit = async (record: Recordable) => { jobId.value = record.row.id; await nextTick(); editVisible.value = true; }; + + /** + * 执行变更状态 + * @param record 参数 + */ const handelChangeStatus = async (record) => { await confirm(`确定要${record.row.status == 1 ? '暂停' : '启动'}`); record.row.status == 1 ? await getJobPause(record.row.id) : await getJobResume(record.row.id); @@ -212,6 +265,11 @@ await getJobRunOnce(record.row.id); message('执行成功'); }; + + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -222,11 +280,20 @@ message('删除成功'); reloadTable(); } + + /** + * 执行查看日志 + * @param record 参数 + */ const handleJobLog = (record) => { // router.push({path:'/monitorJob/log'}) editLogVisible.value = true; jobId.value = record.row.id; }; + + /** + * 选项发生变化 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/monitor/job/log/edit.vue b/src/views/monitor/job/log/edit.vue index a03c764..5514fed 100644 --- a/src/views/monitor/job/log/edit.vue +++ b/src/views/monitor/job/log/edit.vue @@ -55,6 +55,9 @@ const emit = defineEmits(['success', 'update:visible']); const formData = ref({}); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -68,15 +71,24 @@ }, }); + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getJobLogDetail(props.logId); formData.value = data; }; + /** + * 钩子函数 + */ onMounted(() => { if (props.logId) { setFormData(); diff --git a/src/views/monitor/job/log/index.vue b/src/views/monitor/job/log/index.vue index e941f59..725b4fa 100644 --- a/src/views/monitor/job/log/index.vue +++ b/src/views/monitor/job/log/index.vue @@ -44,8 +44,16 @@ import { getJobLogList, jobLogDelete, jobLogBatchDelete } from '@/api/monitor/job'; import { columns } from './columns'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); const emit = defineEmits(['update:visible']); + + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -58,15 +66,27 @@ default: 0, }, }); + + /** + * 定义参数变量 + */ const editVisible = ref(false); const logId = ref(0); const size = document.body.clientWidth - 500; const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ jobName: '', status: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 200, label: '操作', @@ -103,14 +123,26 @@ }, }); + /** + *加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getJobLogList({ ...formParams, jobId: props.jobId, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 100, layout: 'horizontal', @@ -118,6 +150,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -126,19 +163,35 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; } } + + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; + + /** + * 执行查询详情 + */ const handleDetail = async (record: Recordable) => { logId.value = record.row.id; await nextTick(); editVisible.value = true; }; + + /** + * 执行删除 + * @param record 参数 + */ async function handleDelete(record: Recordable) { let ids = []; if (!record) { @@ -149,6 +202,11 @@ message('删除成功'); reloadTable(); } + + /** + * 选项发生变化 + * @param value 参数 + */ function onSelectionChange(value) { selectionData.value = value; } diff --git a/src/views/monitor/online/index.vue b/src/views/monitor/online/index.vue index 38ae7d2..436bc3f 100644 --- a/src/views/monitor/online/index.vue +++ b/src/views/monitor/online/index.vue @@ -56,20 +56,36 @@ import { getOnlineList, onlineOut } from '@/api/monitor/online'; import { message, confirm } from '@/utils/auth'; const onlineTableData = ref([]); + + /** + * 定义查询参数 + */ const formParams = reactive({ ipAddr: '', username: '', }); + + /** + * 定义分页参数 + */ const pager = ref({ page: 1, size: 10, count: onlineTableData.value.length, }); const fwbHeight = document.body.clientHeight - 370; + + /** + * 加载数据列表 + */ const loadTable = async () => { onlineTableData.value = await getOnlineList({ ...formParams }); pager.value.count = onlineTableData.value.length; }; + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 80, layout: 'horizontal', @@ -77,6 +93,10 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -85,6 +105,9 @@ loadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; @@ -92,12 +115,19 @@ pager.value.page = 1; } + /** + * 执行删除 + */ async function handleDelete(row) { await confirm('确定要强退?'); await onlineOut(row.tokenId); message('强退成功'); loadTable(); } + + /** + * 钩子函数 + */ onMounted(() => { loadTable(); }); diff --git a/src/views/monitor/server/index.vue b/src/views/monitor/server/index.vue index 62593da..009240d 100644 --- a/src/views/monitor/server/index.vue +++ b/src/views/monitor/server/index.vue @@ -84,6 +84,10 @@ import { getServerInfo } from '@/api/monitor/server'; const tabledata = ref([{}]); + + /** + * 定义表单参数 + */ const formData = reactive({ cpuInfo: [], memoryInfo: [], @@ -91,6 +95,10 @@ jvmInfo: {}, diskInfo: [], }); + + /** + * 获取服务信息 + */ const loadServerInfo = async () => { const result = await getServerInfo(); formData.cpuInfo.push( @@ -137,6 +145,10 @@ formData.jvmInfo = result.jvmInfo; formData.diskInfo = result.diskInfo; }; + + /** + * 钩子函数 + */ onMounted(() => { loadServerInfo(); }); diff --git a/src/views/setting/configWeb/BasicSetting.vue b/src/views/setting/configWeb/BasicSetting.vue index 2093d2a..f8fdd73 100644 --- a/src/views/setting/configWeb/BasicSetting.vue +++ b/src/views/setting/configWeb/BasicSetting.vue @@ -133,6 +133,10 @@ import UploadFile from '@/components/Upload/file.vue'; import IconPicker from '@/components/icon/picker.vue'; import { updateWeb } from '@/api/setting/web'; + + /** + * 定义接收的参数 + */ const props = defineProps({ dataList: { type: Array, @@ -154,6 +158,9 @@ const configItemList = ref([]); const emit = defineEmits(['success']); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); let ueditorIndex = 0; @@ -168,6 +175,12 @@ message('更新成功'); emit('success', props.activeName); }; + + /** + * 上传图片文件 + * @param list 列表 + * @param index 索引 + */ const fileUploadImgs = (list: any, index: any) => { const code = configItemList.value[index].code; formData[code] = []; @@ -177,12 +190,25 @@ configItemList.value[index].filePath.push({ filePath: item.filePath }); }); }; + + /** + *上传单个附件文件 + * @param filePath 文件路径 + * @param fileName 文件名称 + * @param index 索引 + */ const fileUploadFile = async (filePath: any, fileName: any, index: any) => { const code = configItemList.value[index].code; formData[code] = filePath ? `${fileName}|${filePath}` : ''; configItemList.value[index].filePath = filePath; configItemList.value[index].fileName = fileName; }; + + /** + * 上传单个附件文件 + * @param list 列表 + * @param index 索引 + */ const fileUploadFiles = (list: any, index: any) => { const code = configItemList.value[index].code; configItemList.value[index].filePath = []; @@ -193,6 +219,9 @@ }); }; + /** + * 钩子函数 + */ onMounted(() => { configItemList.value = JSON.parse(JSON.stringify(props.dataList)); nextTick(() => { diff --git a/src/views/setting/configWeb/EmailSetting.vue b/src/views/setting/configWeb/EmailSetting.vue deleted file mode 100644 index 86d2c79..0000000 --- a/src/views/setting/configWeb/EmailSetting.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - diff --git a/src/views/setting/configWeb/RevealSetting.vue b/src/views/setting/configWeb/RevealSetting.vue deleted file mode 100644 index 5095e16..0000000 --- a/src/views/setting/configWeb/RevealSetting.vue +++ /dev/null @@ -1,183 +0,0 @@ - - - diff --git a/src/views/setting/configWeb/index.vue b/src/views/setting/configWeb/index.vue index 1026a6d..1c19035 100644 --- a/src/views/setting/configWeb/index.vue +++ b/src/views/setting/configWeb/index.vue @@ -27,6 +27,9 @@ const activeName = ref(); const tabData = ref([]); + /** + * 获取TAB数据 + */ const getTabData = async (name) => { let res = await getWebInfo(); res.map((item) => { @@ -66,9 +69,17 @@ tabData.value = res; activeName.value = name ? name : tabData.value[0].configName; }; + + /** + * 刷新TAB数据 + */ const getReshTabData = (name) => { getTabData(name); }; + + /** + * 钩子函数 + */ onMounted(() => { getTabData(); }); diff --git a/src/views/setting/profile/BasicSetting.vue b/src/views/setting/profile/BasicSetting.vue index afa571b..dcfd40d 100644 --- a/src/views/setting/profile/BasicSetting.vue +++ b/src/views/setting/profile/BasicSetting.vue @@ -112,6 +112,9 @@ const formRef = ref(); + /** + * 定义表单参数 + */ const formData = reactive({ realname: '', gender: '', @@ -125,13 +128,20 @@ avatarName: '', }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); await updateProfile(formData); message('更新成功'); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); - const setUserInfo = async () => { + + /** + * 获取用户信息 + */ + const getUserInfo = async () => { const data = await getUserInfo(); for (const key in formData) { if (data[key] != null && data[key] != undefined) { @@ -152,7 +162,11 @@ } } }; + + /** + * 钩子函数 + */ onMounted(() => { - setUserInfo(); + getUserInfo(); }); diff --git a/src/views/tool/generator/edit.vue b/src/views/tool/generator/edit.vue index d6a081c..698ebff 100644 --- a/src/views/tool/generator/edit.vue +++ b/src/views/tool/generator/edit.vue @@ -127,6 +127,10 @@ const emit = defineEmits(['success', 'update:visible']); const formRef = shallowRef(); + + /** + * 定义表单参数 + */ const formData = reactive({ id: '', name: '', @@ -140,6 +144,9 @@ note: '', }); + /** + * 定义接收的参数 + */ const props = defineProps({ visible: { type: Boolean, @@ -153,6 +160,9 @@ }, }); + /** + * 执行提交表单 + */ const handleSubmit = async () => { await formRef.value?.validate(); props.dataSourceId ? await dataSourceUpdate(formData) : await dataSourceAdd(formData); @@ -161,12 +171,18 @@ emit('success'); }; + /** + * 关闭窗体 + */ const dialogClose = () => { emit('update:visible', false); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** + * 设置表单数据 + */ const setFormData = async () => { const data = await getDataSourceDetail(props.dataSourceId); for (const key in formData) { @@ -177,6 +193,9 @@ } }; + /** + * 钩子函数 + */ onMounted(() => { if (props.dataSourceId) { setFormData(); diff --git a/src/views/tool/generator/index.vue b/src/views/tool/generator/index.vue index 25aaccd..97d603b 100644 --- a/src/views/tool/generator/index.vue +++ b/src/views/tool/generator/index.vue @@ -48,15 +48,31 @@ import { columns } from './columns'; import { PlusOutlined } from '@vicons/antd'; import { message, confirm } from '@/utils/auth'; + + /** + * 导入组件 + */ const editDialog = defineAsyncComponent(() => import('./edit.vue')); + + /** + * 定义参数变量 + */ const dataSourceId = ref(0); const editVisible = ref(false); const selectionData = ref([]); const tableRef = ref(); + + /** + * 定义查询参数 + */ const formParams = reactive({ tableName: '', tableComment: '', }); + + /** + * 定义操作栏 + */ const actionColumn = reactive({ width: 150, label: '操作', @@ -78,14 +94,26 @@ }, }); + /** + * 加载数据列表 + * @param res 参数 + */ const loadDataTable = async (res: any) => { const result = await getTableList({ ...formParams, ...res }); return result; }; + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + + /** + * 注册 + */ const [register, {}] = useForm({ labelWidth: 100, layout: 'horizontal', @@ -93,6 +121,11 @@ submitOnReset: true, schemas, }); + + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { handleReset(); for (const key in values) { @@ -101,6 +134,9 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset() { for (const key in formParams) { formParams[key] = ''; @@ -133,6 +169,9 @@ message('一键生成成功'); }; + /** + * 选项发生变化 + */ function onSelectionChange(value) { selectionData.value = value; }