修复已知问题

This commit is contained in:
2024-09-27 14:17:12 +08:00
parent c0328fa23e
commit 5e56c31300
299 changed files with 17512 additions and 987 deletions
@@ -21,7 +21,7 @@
>
<a-tabs type="card" v-model:active-key="active" @change="onChange">
<a-tab-pane tab="基本信息" key="base">
<a-form-item label="选择栏目" name="categoryId">
<a-form-item label="所属栏目" name="categoryId">
<a-tree-select
allow-clear
:tree-data="navigationList"
@@ -33,6 +33,17 @@
@update:value="(value?: number) => (form.categoryId = value)"
@change="onCategoryId"
/>
<!-- <a-tree-select-->
<!-- allow-clear-->
<!-- :tree-data="categoryList"-->
<!-- tree-default-expand-all-->
<!-- style="width: 558px"-->
<!-- placeholder="请选择栏目"-->
<!-- :value="form.categoryId || undefined"-->
<!-- :dropdown-style="{ maxHeight: '360px', overflow: 'auto' }"-->
<!-- @update:value="(value?: number) => (form.categoryId = value)"-->
<!-- @change="onCategoryId"-->
<!-- />-->
</a-form-item>
<a-form-item label="文章标题" name="title">
<a-input
@@ -155,6 +166,8 @@
categoryId?: number;
// 栏目数据
navigationList?: Navigation[];
// 栏目数据
categoryList?: CmsArticleCategory[];
}>();
const emit = defineEmits<{
@@ -253,20 +266,20 @@
// }
// }
// ],
categoryId: [
{
required: true,
type: 'number',
message: '请选择栏目',
trigger: 'blur',
validator: async (_rule: RuleObject, value: string) => {
if (!form.categoryId) {
return Promise.reject('请选择栏目');
}
return Promise.resolve();
}
}
],
// categoryId: [
// {
// required: true,
// type: 'number',
// message: '请选择栏目',
// trigger: 'blur',
// validator: async (_rule: RuleObject, value: string) => {
// if (!form.categoryId) {
// return Promise.reject('请选择栏目');
// }
// return Promise.resolve();
// }
// }
// ],
content: [
{
required: true,
@@ -294,6 +307,7 @@
// 选择栏目
const onCategoryId = (id: number) => {
console.log(id);
form.categoryId = id;
};
@@ -52,17 +52,17 @@
<script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import { ref, watch } from 'vue';
import { getCount } from '@/api/cms/article';
import { getCount } from '@/api/cms/cmsArticle';
import type { ArticleCount, ArticleParam } from '@/api/cms/article/model';
import useSearch from '@/utils/use-search';
import { Navigation } from '@/api/cms/navigation/model';
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
merchantId?: number;
navigationList?: Navigation[];
navigationList?: CmsNavigation[];
categoryId?: number;
model?: string;
}>(),
@@ -113,7 +113,6 @@
};
const reload = () => {
console.log(where);
getCount(where).then((data: any) => {
articleCount.value = data;
});
@@ -121,7 +120,7 @@
};
// 按模型查找
const chooseModel = (item: Navigation) => {
const chooseModel = (item: CmsNavigation) => {
where.model = `${item.value}`;
where.modelName = `${item.label}`;
emit('search', where);
@@ -136,7 +135,7 @@
/* 重置 */
const reset = () => {
resetFields();
type.value = '';
type.value = undefined;
reload();
};
+29 -20
View File
@@ -8,6 +8,7 @@
:columns="columns"
:datasource="datasource"
:customRow="customRow"
v-model:selection="selection"
:scroll="{ x: 1200 }"
tool-class="ele-toolbar-form"
class="sys-org-table"
@@ -29,26 +30,14 @@
<template v-if="column.key === 'title'">
<span
class="cursor-pointer"
@click="
openSpmUrl(
`/article/detail/${record.articleId}.html`,
record,
record.articleId
)
"
@click="openSpmUrl(`/detail`, record, record.articleId)"
>{{ record.title }}</span
>
</template>
<template v-if="column.key === 'categoryName'">
<span
class="cursor-pointer"
@click="
openSpmUrl(
`/article/${record.categoryId}`,
record,
record.categoryId
)
"
@click="openSpmUrl(`/category`, record, record.articleId)"
>{{ record.categoryName }}</span
>
</template>
@@ -95,6 +84,7 @@
<ArticleEdit
v-model:visible="showEdit"
:navigationList="navigationList"
:categoryList="categoryList"
:categoryId="categoryId"
:data="current"
@done="reload"
@@ -126,6 +116,8 @@
import { isImage, openSpmUrl } from '@/utils/common';
import { listCmsNavigation } from '@/api/cms/cmsNavigation';
import { CmsNavigation } from '@/api/cms/cmsNavigation/model';
import { CmsArticleCategory } from '@/api/cms/cmsArticleCategory/model';
import { listCmsArticleCategory } from '@/api/cms/cmsArticleCategory';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -146,6 +138,8 @@
const model = ref<number>();
// 栏目数据
const navigationList = ref<CmsNavigation[]>();
// 文章分类
const categoryList = ref<CmsArticleCategory[]>();
// 表格数据源
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
@@ -254,9 +248,9 @@
/* 搜索 */
const reload = (where?: CmsArticleParam) => {
if (where?.categoryId) {
categoryId.value = where.categoryId;
}
// if (where?.categoryId) {
// categoryId.value = where.categoryId;
// }
selection.value = [];
tableRef?.value?.reload({ where: where });
};
@@ -343,9 +337,9 @@
data: res?.map((d) => {
d.value = d.navigationId;
d.label = d.title;
if (d.model != 'article') {
d.disabled = true;
}
// if (d.model != 'article') {
// d.disabled = true;
// }
return d;
}),
idField: 'navigationId',
@@ -354,6 +348,21 @@
});
}
// 加载文章分类
if (!categoryList.value) {
listCmsArticleCategory({}).then((res) => {
categoryList.value = toTreeData({
data: res?.map((d) => {
d.value = d.categoryId;
d.label = d.title;
return d;
}),
idField: 'categoryId',
parentIdField: 'parentId'
});
});
}
watch(
() => router.currentRoute.value.query,
(query) => {