diff --git a/src/views/content/layout/columns.ts b/src/views/content/layout/columns.ts index 279d618..dd726dd 100644 --- a/src/views/content/layout/columns.ts +++ b/src/views/content/layout/columns.ts @@ -13,16 +13,16 @@ export const columns = [ fixed: 'left', width: 50, }, - { - title: '位置编号', - key: 'location', - width: 100, - }, { title: '位置描述', key: 'description', width: 200, }, + { + title: '位置编号', + key: 'location', + width: 100, + }, { title: '排序', key: 'sort', diff --git a/src/views/content/layout/edit.vue b/src/views/content/layout/edit.vue index a39d5df..697379f 100644 --- a/src/views/content/layout/edit.vue +++ b/src/views/content/layout/edit.vue @@ -14,6 +14,9 @@ label-placement="left" label-width="85px" > + + + - - - @@ -66,11 +66,16 @@ default: 0, }, }); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: props.layoutId ? '编辑布局' : '添加布局', subBtuText: '确定', width: 600, }); + /** * 执行提交 */ @@ -118,7 +123,10 @@ setFormData(); } }); - //导出方法 + + /** + * 定义函数 + */ defineExpose({ openModal, }); diff --git a/src/views/content/layout/index.vue b/src/views/content/layout/index.vue index 9782658..ec27d75 100644 --- a/src/views/content/layout/index.vue +++ b/src/views/content/layout/index.vue @@ -27,7 +27,6 @@ 新建 - { rowKeys.value = []; const result = await getLayoutList({ ...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,9 @@ reloadTable(); } + /** + * 执行重置 + */ function handleReset(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -150,6 +170,9 @@ reloadTable(); } + /** + * 执行注册 + */ const [register, {}] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, labelWidth: 80, @@ -165,6 +188,7 @@ await nextTick(); createModalRef.value.openModal(); }; + /** * 执行编辑 */ @@ -174,6 +198,7 @@ await nextTick(); createModalRef.value.openModal(); } + /** * 执行删除 * @param id 参数 diff --git a/src/views/content/layoutItem/edit.vue b/src/views/content/layoutItem/edit.vue index 3a24487..5a36c35 100644 --- a/src/views/content/layoutItem/edit.vue +++ b/src/views/content/layoutItem/edit.vue @@ -94,20 +94,23 @@ import chooseArticle from './layout/index.vue'; import { useLockFn } from '@/utils/useLockFn'; + /** + * 定义常量 + */ const emit = defineEmits(['success', 'update:visible']); const formRef = ref(); const articleRef = ref(); + const message = useMessage(); + const chooseVisible = ref(false); + const layoutList = ref([]); /** * 定义表单参数 */ - const message = useMessage(); - const chooseVisible = ref(false); - const layoutList = ref([]); const formData = reactive({ id: '', - layoutId: undefined, - type: undefined, + layoutId: '', + type: '', typeText: '', typeId: '', image: '', @@ -130,6 +133,9 @@ }, }); + /** + * 定义数据 + */ const typeList = [ { label: 'CMS文章', value: 1 }, { label: '通知公告', value: 2 }, @@ -171,6 +177,7 @@ .catch((error) => {}); }; const { isLock: subLoading, lockFn: submit } = useLockFn(handleSubmit); + /** * 关闭窗体 */ @@ -190,6 +197,7 @@ } } }; + /** * 选择推荐内容成功回调事件 */ @@ -213,6 +221,7 @@ let list = await getLayoutAllList(); layoutList.value = list ? list : []; }; + /** * 钩子函数 */ diff --git a/src/views/content/layoutItem/index.vue b/src/views/content/layoutItem/index.vue index 4451412..8a5fb14 100644 --- a/src/views/content/layoutItem/index.vue +++ b/src/views/content/layoutItem/index.vue @@ -27,7 +27,6 @@ 新建 - { rowKeys.value = []; const result = await getLayoutList({ ...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,10 @@ reloadTable(); } + /** + * 执行重置 + * @param values 参数 + */ function handleReset(values: Recordable) { for (const key in formParams) { formParams[key] = ''; @@ -151,6 +172,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(); editVisible.value = true; }; + /** * 执行编辑 */ @@ -173,6 +198,7 @@ await nextTick(); editVisible.value = true; } + /** * 执行删除 * @param id 参数 diff --git a/src/views/content/layoutItem/layout/index.vue b/src/views/content/layoutItem/layout/index.vue index d7900b7..53ce37f 100644 --- a/src/views/content/layoutItem/layout/index.vue +++ b/src/views/content/layoutItem/layout/index.vue @@ -40,6 +40,7 @@ const emit = defineEmits(['success', 'update:visible', 'update:checked-row-keys']); const message = useMessage(); + /** * 定义接收的参数 */ @@ -58,10 +59,15 @@ const selectRow = ref({}); const tableRef = ref(); const checkedKeys = ref([]); + + /** + * 定义模态 + */ const [modalRegister, { openModal, setSubLoading }] = useModal({ title: '选择文章', width: 1000, }); + /** * 定义查询参数 */ @@ -127,7 +133,7 @@ } /** - * 注册 + * 执行注册 */ const [register, {}] = useForm({ gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' }, @@ -173,6 +179,12 @@ }, }; }; + + /** + * 行点击事件 + * @param record 数据记录 + * @param row 数据行 + */ const rowClick = (record, row) => { console.log(record); checkedKeys.value = record; @@ -184,7 +196,9 @@ */ onMounted(() => {}); - //导出方法 + /** + * 定义函数 + */ defineExpose({ openModal, });