优化文章、分类、标签
This commit is contained in:
parent
bed4eb179d
commit
a905f4fab5
@ -16,7 +16,7 @@ export const columns = [
|
|||||||
{
|
{
|
||||||
title: '文章标题',
|
title: '文章标题',
|
||||||
key: 'title',
|
key: 'title',
|
||||||
width: 200,
|
width: 250,
|
||||||
render(record) {
|
render(record) {
|
||||||
return h(
|
return h(
|
||||||
'a',
|
'a',
|
||||||
|
@ -121,6 +121,9 @@
|
|||||||
import Editor from '@/components/Editor/tinymce.vue';
|
import Editor from '@/components/Editor/tinymce.vue';
|
||||||
import { buildTree } from '@/utils/auth';
|
import { buildTree } from '@/utils/auth';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义常量
|
||||||
|
*/
|
||||||
const emit = defineEmits(['success', 'update:visible']);
|
const emit = defineEmits(['success', 'update:visible']);
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const editorRef = ref();
|
const editorRef = ref();
|
||||||
@ -133,17 +136,18 @@
|
|||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
id: '',
|
id: '',
|
||||||
categoryId: undefined,
|
categoryId: '',
|
||||||
title: '',
|
title: '',
|
||||||
author: '',
|
author: '',
|
||||||
cover: '',
|
cover: '',
|
||||||
|
images: '',
|
||||||
intro: '',
|
intro: '',
|
||||||
content: '',
|
content: '',
|
||||||
status: 0,
|
status: 0,
|
||||||
click: '',
|
click: '',
|
||||||
sort: 0,
|
sort: 0,
|
||||||
images: '',
|
|
||||||
imagesList: [],
|
imagesList: [],
|
||||||
|
fileList: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,6 +165,10 @@
|
|||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: props.articleId ? '编辑文章' : '添加文章',
|
title: props.articleId ? '编辑文章' : '添加文章',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
@ -182,6 +190,7 @@
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行提交
|
* 执行提交
|
||||||
*/
|
*/
|
||||||
@ -251,7 +260,10 @@
|
|||||||
setFormData();
|
setFormData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//导出方法
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
</template>
|
</template>
|
||||||
新建
|
新建
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|
||||||
<n-button
|
<n-button
|
||||||
type="error"
|
type="error"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
@ -63,12 +62,13 @@
|
|||||||
import { getArticleList, articleDelete, articleBatchDelete } from '@/api/content/article';
|
import { getArticleList, articleDelete, articleBatchDelete } from '@/api/content/article';
|
||||||
import { columns } from './columns';
|
import { columns } from './columns';
|
||||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||||
import CreateModal from './CreateModal.vue';
|
|
||||||
import editDialog from './edit.vue';
|
import editDialog from './edit.vue';
|
||||||
import { basicModal, useModal } from '@/components/Modal';
|
|
||||||
import { schemas } from './querySchemas';
|
import { schemas } from './querySchemas';
|
||||||
import { renderIcon } from '@/utils';
|
import { renderIcon } from '@/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义常量
|
||||||
|
*/
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
const basicTableRef = ref();
|
const basicTableRef = ref();
|
||||||
@ -76,14 +76,19 @@
|
|||||||
const editVisible = ref(false);
|
const editVisible = ref(false);
|
||||||
const articleId = ref(0);
|
const articleId = ref(0);
|
||||||
const rowKeys = ref([]);
|
const rowKeys = ref([]);
|
||||||
const exportLoading = ref(false);
|
|
||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义查询参数
|
||||||
|
*/
|
||||||
const formParams = reactive({
|
const formParams = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
status: '',
|
status: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 200,
|
width: 200,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@ -113,24 +118,36 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addTable() {
|
/**
|
||||||
showModal.value = true;
|
* 加载数据列表
|
||||||
}
|
* @param res 参数
|
||||||
|
*/
|
||||||
const loadDataTable = async (res) => {
|
const loadDataTable = async (res) => {
|
||||||
rowKeys.value = [];
|
rowKeys.value = [];
|
||||||
const result = await getArticleList({ ...formParams, ...res });
|
const result = await getArticleList({ ...formParams, ...res });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据行选中事件
|
||||||
|
* @param keys 参数
|
||||||
|
*/
|
||||||
function onCheckedRow(keys) {
|
function onCheckedRow(keys) {
|
||||||
rowKeys.value = keys;
|
rowKeys.value = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新数据列表
|
||||||
|
* @param noRefresh 参数
|
||||||
|
*/
|
||||||
function reloadTable(noRefresh = '') {
|
function reloadTable(noRefresh = '') {
|
||||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行提交表单
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleSubmit(values: Recordable) {
|
function handleSubmit(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -141,6 +158,9 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行重置
|
||||||
|
*/
|
||||||
function handleReset(values: Recordable) {
|
function handleReset(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -151,6 +171,9 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行注册
|
||||||
|
*/
|
||||||
const [register, {}] = useForm({
|
const [register, {}] = useForm({
|
||||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
@ -166,6 +189,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行编辑
|
* 执行编辑
|
||||||
*/
|
*/
|
||||||
@ -175,6 +199,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行删除
|
* 执行删除
|
||||||
* @param id 参数
|
* @param id 参数
|
||||||
|
@ -103,13 +103,19 @@
|
|||||||
name: '',
|
name: '',
|
||||||
//排序
|
//排序
|
||||||
sort: 0,
|
sort: 0,
|
||||||
|
// 备注
|
||||||
note: '',
|
note: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: props.categoryId ? '编辑分类' : '添加分类',
|
title: props.categoryId ? '编辑分类' : '添加分类',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
width: 600,
|
width: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭窗体
|
* 关闭窗体
|
||||||
*/
|
*/
|
||||||
@ -122,7 +128,7 @@
|
|||||||
/**
|
/**
|
||||||
* 获取分类数据
|
* 获取分类数据
|
||||||
*/
|
*/
|
||||||
const getcategory = async () => {
|
const getCategory = async () => {
|
||||||
const data: any = await getCategoryList();
|
const data: any = await getCategoryList();
|
||||||
data.map((item) => {
|
data.map((item) => {
|
||||||
expandedKeys.value.push(item.id);
|
expandedKeys.value.push(item.id);
|
||||||
@ -171,14 +177,17 @@
|
|||||||
* 钩子函数
|
* 钩子函数
|
||||||
*/
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getcategory();
|
getCategory();
|
||||||
if (props.categoryId) {
|
if (props.categoryId) {
|
||||||
getDetail();
|
getDetail();
|
||||||
} else {
|
} else {
|
||||||
formData.parentId = props.pid;
|
formData.parentId = props.pid;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//导出方法
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -64,8 +64,11 @@
|
|||||||
const categoryId = ref(0);
|
const categoryId = ref(0);
|
||||||
const pid = ref(0);
|
const pid = ref(0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 220,
|
width: 250,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
key: 'action',
|
key: 'action',
|
||||||
@ -101,7 +104,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门列表
|
* 获取分类列表
|
||||||
*/
|
*/
|
||||||
const loadDataTable = async (res) => {
|
const loadDataTable = async (res) => {
|
||||||
const data = await getCategoryList();
|
const data = await getCategoryList();
|
||||||
|
@ -66,11 +66,16 @@
|
|||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义模态
|
||||||
|
*/
|
||||||
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
const [modalRegister, { openModal, setSubLoading }] = useModal({
|
||||||
title: props.tagId ? '编辑标签' : '添加标签',
|
title: props.tagId ? '编辑标签' : '添加标签',
|
||||||
subBtuText: '确定',
|
subBtuText: '确定',
|
||||||
width: 600,
|
width: 600,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行提交
|
* 执行提交
|
||||||
*/
|
*/
|
||||||
@ -117,7 +122,10 @@
|
|||||||
setFormData();
|
setFormData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//导出方法
|
|
||||||
|
/**
|
||||||
|
* 定义函数
|
||||||
|
*/
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
</template>
|
</template>
|
||||||
新建
|
新建
|
||||||
</n-button>
|
</n-button>
|
||||||
|
|
||||||
<n-button
|
<n-button
|
||||||
type="error"
|
type="error"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
@ -63,12 +62,13 @@
|
|||||||
import { getTagList, tagDelete, tagBatchDelete } from '@/api/content/tag';
|
import { getTagList, tagDelete, tagBatchDelete } from '@/api/content/tag';
|
||||||
import { columns } from './columns';
|
import { columns } from './columns';
|
||||||
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
import { PlusOutlined, DeleteOutlined, FormOutlined } from '@vicons/antd';
|
||||||
import CreateModal from './CreateModal.vue';
|
|
||||||
import editDialog from './edit.vue';
|
import editDialog from './edit.vue';
|
||||||
import { basicModal, useModal } from '@/components/Modal';
|
|
||||||
import { schemas } from './querySchemas';
|
import { schemas } from './querySchemas';
|
||||||
import { renderIcon } from '@/utils';
|
import { renderIcon } from '@/utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义常量
|
||||||
|
*/
|
||||||
const message = useMessage();
|
const message = useMessage();
|
||||||
const dialog = useDialog();
|
const dialog = useDialog();
|
||||||
const basicTableRef = ref();
|
const basicTableRef = ref();
|
||||||
@ -76,13 +76,18 @@
|
|||||||
const editVisible = ref(false);
|
const editVisible = ref(false);
|
||||||
const tagId = ref(0);
|
const tagId = ref(0);
|
||||||
const rowKeys = ref([]);
|
const rowKeys = ref([]);
|
||||||
const exportLoading = ref(false);
|
|
||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义查询参数
|
||||||
|
*/
|
||||||
const formParams = reactive({
|
const formParams = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义操作栏
|
||||||
|
*/
|
||||||
const actionColumn = reactive({
|
const actionColumn = reactive({
|
||||||
width: 200,
|
width: 200,
|
||||||
title: '操作',
|
title: '操作',
|
||||||
@ -112,24 +117,36 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addTable() {
|
/**
|
||||||
showModal.value = true;
|
* 加载数据列表
|
||||||
}
|
* @param res 参数
|
||||||
|
*/
|
||||||
const loadDataTable = async (res) => {
|
const loadDataTable = async (res) => {
|
||||||
rowKeys.value = [];
|
rowKeys.value = [];
|
||||||
const result = await getTagList({ ...formParams, ...res });
|
const result = await getTagList({ ...formParams, ...res });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据行选中事件
|
||||||
|
* @param keys 参数
|
||||||
|
*/
|
||||||
function onCheckedRow(keys) {
|
function onCheckedRow(keys) {
|
||||||
rowKeys.value = keys;
|
rowKeys.value = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新数据列表
|
||||||
|
* @param noRefresh 参数
|
||||||
|
*/
|
||||||
function reloadTable(noRefresh = '') {
|
function reloadTable(noRefresh = '') {
|
||||||
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
basicTableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行提交表单
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleSubmit(values: Recordable) {
|
function handleSubmit(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -140,6 +157,10 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行重置
|
||||||
|
* @param values 参数
|
||||||
|
*/
|
||||||
function handleReset(values: Recordable) {
|
function handleReset(values: Recordable) {
|
||||||
for (const key in formParams) {
|
for (const key in formParams) {
|
||||||
formParams[key] = '';
|
formParams[key] = '';
|
||||||
@ -150,6 +171,9 @@
|
|||||||
reloadTable();
|
reloadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行注册
|
||||||
|
*/
|
||||||
const [register, {}] = useForm({
|
const [register, {}] = useForm({
|
||||||
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
gridProps: { cols: '1 s:1 m:2 l:3 xl:4 2xl:4' },
|
||||||
labelWidth: 80,
|
labelWidth: 80,
|
||||||
@ -165,6 +189,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行编辑
|
* 执行编辑
|
||||||
*/
|
*/
|
||||||
@ -174,6 +199,7 @@
|
|||||||
await nextTick();
|
await nextTick();
|
||||||
createModalRef.value.openModal();
|
createModalRef.value.openModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行删除
|
* 执行删除
|
||||||
* @param id 参数
|
* @param id 参数
|
||||||
|
Loading…
Reference in New Issue
Block a user