diff --git a/src/views/content/article/columns.ts b/src/views/content/article/columns.ts index 688b118..e2ba350 100644 --- a/src/views/content/article/columns.ts +++ b/src/views/content/article/columns.ts @@ -16,7 +16,7 @@ export const columns = [ { title: '文章标题', key: 'title', - width: 200, + width: 250, render(record) { return h( 'a', diff --git a/src/views/content/article/edit.vue b/src/views/content/article/edit.vue index 1fcd3e2..9c05e30 100644 --- a/src/views/content/article/edit.vue +++ b/src/views/content/article/edit.vue @@ -121,6 +121,9 @@ import Editor from '@/components/Editor/tinymce.vue'; import { buildTree } from '@/utils/auth'; + /** + * 定义常量 + */ const emit = defineEmits(['success', 'update:visible']); const formRef = ref(); const editorRef = ref(); @@ -133,17 +136,18 @@ const message = useMessage(); const formData = reactive({ id: '', - categoryId: undefined, + categoryId: '', title: '', author: '', cover: '', + images: '', intro: '', content: '', status: 0, click: '', sort: 0, - images: '', imagesList: [], + fileList: [], }); /** @@ -161,6 +165,10 @@ default: 0, }, }); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.articleId ? '编辑文章' : '添加文章', subBtuText: '确定', @@ -182,6 +190,7 @@ ); return; }; + /** * 执行提交 */ @@ -251,7 +260,10 @@ setFormData(); } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/content/article/index.vue b/src/views/content/article/index.vue index 8bb0483..dc28cc3 100644 --- a/src/views/content/article/index.vue +++ b/src/views/content/article/index.vue @@ -27,7 +27,6 @@ 新建 - { rowKeys.value = []; const result = await getArticleList({ ...formParams, ...res }); return result; }; + /** + * 数据行选中事件 + * @param keys 参数 + */ function onCheckedRow(keys) { rowKeys.value = keys; } + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -141,6 +158,9 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -151,6 +171,9 @@ reloadTable(); } + /** + * 执行注册 + */ const [register, {}] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, labelWidth: 80, @@ -166,6 +189,7 @@ await nextTick(); createModalRef.value.openModal(); }; + /** * 执行编辑 */ @@ -175,6 +199,7 @@ await nextTick(); createModalRef.value.openModal(); } + /** * 执行删除 * @param id 参数 diff --git a/src/views/content/category/edit.vue b/src/views/content/category/edit.vue index e345316..7fe3ed2 100644 --- a/src/views/content/category/edit.vue +++ b/src/views/content/category/edit.vue @@ -103,13 +103,19 @@ name: '', //排序 sort: 0, + // 备注 note: '', }); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.categoryId ? '编辑分类' : '添加分类', subBtuText: '确定', width: 600, }); + /** * 关闭窗体 */ @@ -122,7 +128,7 @@ /** * 获取分类数据 */ - const getcategory = async () => { + const getCategory = async () => { const data: any = await getCategoryList(); data.map((item) => { expandedKeys.value.push(item.id); @@ -171,14 +177,17 @@ * 钩子函数 */ onMounted(() => { - getcategory(); + getCategory(); if (props.categoryId) { getDetail(); } else { formData.parentId = props.pid; } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/content/category/index.vue b/src/views/content/category/index.vue index 3d8e980..6b77014 100644 --- a/src/views/content/category/index.vue +++ b/src/views/content/category/index.vue @@ -64,8 +64,11 @@ const categoryId = ref(0); const pid = ref(0); + /** + * 定义操作栏 + */ const actionColumn = reactive({ - width: 220, + width: 250, title: '操作', align: 'center', key: 'action', @@ -101,7 +104,7 @@ }); /** - * 获取部门列表 + * 获取分类列表 */ const loadDataTable = async (res) => { const data = await getCategoryList(); diff --git a/src/views/content/tag/edit.vue b/src/views/content/tag/edit.vue index 17ee0bf..f8988b5 100644 --- a/src/views/content/tag/edit.vue +++ b/src/views/content/tag/edit.vue @@ -66,11 +66,16 @@ default: 0, }, }); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.tagId ? '编辑标签' : '添加标签', subBtuText: '确定', width: 600, }); + /** * 执行提交 */ @@ -117,7 +122,10 @@ setFormData(); } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/content/tag/index.vue b/src/views/content/tag/index.vue index 43ae627..1f933a1 100644 --- a/src/views/content/tag/index.vue +++ b/src/views/content/tag/index.vue @@ -27,7 +27,6 @@ 新建 - { rowKeys.value = []; const result = await getTagList({ ...formParams, ...res }); return result; }; + /** + * 数据行选中事件 + * @param keys 参数 + */ function onCheckedRow(keys) { rowKeys.value = keys; } + /** + * 刷新数据列表 + * @param noRefresh 参数 + */ function reloadTable(noRefresh = '') { basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); } + /** + * 执行提交表单 + * @param values 参数 + */ function handleSubmit(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -140,6 +157,10 @@ reloadTable(); } + /** + * 执行重置 + * @param values 参数 + */ function handleReset(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -150,6 +171,9 @@ reloadTable(); } + /** + * 执行注册 + */ const [register, {}] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, labelWidth: 80, @@ -165,6 +189,7 @@ await nextTick(); createModalRef.value.openModal(); }; + /** * 执行编辑 */ @@ -174,6 +199,7 @@ await nextTick(); createModalRef.value.openModal(); } + /** * 执行删除 * @param id 参数