feat(pwl): 新增材料库资料库管理功能- 添加材料库资料库表的增删改查接口
- 实现材料库资料库表的分页查询和列表查询功能 - 新增材料库资料库表的添加、修改、删除和批量删除接口 - 创建材料库资料库管理页面,包含表格展示和操作功能- 添加材料库资料库编辑弹窗,支持新增和修改操作- 实现材料库资料库的类型、状态、推荐等字段的展示和编辑 - 集成文件选择组件,支持资料库图标和关联文件的选择 - 添加搜索组件,支持材料库资料库的搜索功能 - 更新开发环境API地址配置 -修复SelectDocsBook组件相关类型引用问题 - 优化AI审计方案生成器界面样式和交互
This commit is contained in:
@@ -5,5 +5,5 @@ VITE_API_URL=https://cms-api.websoft.top/api
|
|||||||
|
|
||||||
#VITE_SOCKET_URL=ws://127.0.0.1:9191
|
#VITE_SOCKET_URL=ws://127.0.0.1:9191
|
||||||
#VITE_SERVER_URL=http://127.0.0.1:8000/api
|
#VITE_SERVER_URL=http://127.0.0.1:8000/api
|
||||||
#VITE_API_URL=http://127.0.0.1:9000/api
|
VITE_API_URL=http://127.0.0.1:9200/api
|
||||||
#/booking/bookingItem
|
#/booking/bookingItem
|
||||||
|
|||||||
106
src/api/pwl/pwlProjectLibrary/index.ts
Normal file
106
src/api/pwl/pwlProjectLibrary/index.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
import type { ApiResult, PageResult } from '@/api';
|
||||||
|
import type { PwlProjectLibrary, PwlProjectLibraryParam } from './model';
|
||||||
|
import { MODULES_API_URL } from '@/config/setting';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询材料库资料库表
|
||||||
|
*/
|
||||||
|
export async function pagePwlProjectLibrary(params: PwlProjectLibraryParam) {
|
||||||
|
const res = await request.get<ApiResult<PageResult<PwlProjectLibrary>>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library/page',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询材料库资料库表列表
|
||||||
|
*/
|
||||||
|
export async function listPwlProjectLibrary(params?: PwlProjectLibraryParam) {
|
||||||
|
const res = await request.get<ApiResult<PwlProjectLibrary[]>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library',
|
||||||
|
{
|
||||||
|
params
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加材料库资料库表
|
||||||
|
*/
|
||||||
|
export async function addPwlProjectLibrary(data: PwlProjectLibrary) {
|
||||||
|
const res = await request.post<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改材料库资料库表
|
||||||
|
*/
|
||||||
|
export async function updatePwlProjectLibrary(data: PwlProjectLibrary) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library',
|
||||||
|
data
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除材料库资料库表
|
||||||
|
*/
|
||||||
|
export async function removePwlProjectLibrary(id?: number) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除材料库资料库表
|
||||||
|
*/
|
||||||
|
export async function removeBatchPwlProjectLibrary(data: (number | undefined)[]) {
|
||||||
|
const res = await request.delete<ApiResult<unknown>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library/batch',
|
||||||
|
{
|
||||||
|
data
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询材料库资料库表
|
||||||
|
*/
|
||||||
|
export async function getPwlProjectLibrary(id: number) {
|
||||||
|
const res = await request.get<ApiResult<PwlProjectLibrary>>(
|
||||||
|
MODULES_API_URL + '/pwl/pwl-project-library/' + id
|
||||||
|
);
|
||||||
|
if (res.data.code === 0 && res.data.data) {
|
||||||
|
return res.data.data;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
47
src/api/pwl/pwlProjectLibrary/model/index.ts
Normal file
47
src/api/pwl/pwlProjectLibrary/model/index.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import type { PageParam } from '@/api';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料库资料库表
|
||||||
|
*/
|
||||||
|
export interface PwlProjectLibrary {
|
||||||
|
// ID
|
||||||
|
id?: number;
|
||||||
|
// 资料库名称
|
||||||
|
name?: string;
|
||||||
|
// 资料库类型: biz-项目案例库, pub-公共知识库
|
||||||
|
type?: string;
|
||||||
|
// 关联知识库ID
|
||||||
|
kbId?: string;
|
||||||
|
// 排序(数字越小越靠前)
|
||||||
|
sort?: number;
|
||||||
|
// 资料库图标
|
||||||
|
image?: string;
|
||||||
|
// 资料库描述
|
||||||
|
content?: string;
|
||||||
|
// 关联文件
|
||||||
|
files?: string;
|
||||||
|
// 备注
|
||||||
|
comments?: string;
|
||||||
|
// 是否推荐
|
||||||
|
recommend?: number;
|
||||||
|
// 状态, 0正常, 1冻结
|
||||||
|
status?: number;
|
||||||
|
// 是否删除, 0否, 1是
|
||||||
|
deleted?: number;
|
||||||
|
// 创建用户ID
|
||||||
|
userId?: number;
|
||||||
|
// 租户id
|
||||||
|
tenantId?: number;
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string;
|
||||||
|
// 修改时间
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材料库资料库表搜索条件
|
||||||
|
*/
|
||||||
|
export interface PwlProjectLibraryParam extends PageParam {
|
||||||
|
id?: number;
|
||||||
|
keywords?: string;
|
||||||
|
}
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
v-model:value="searchText"
|
v-model:value="searchText"
|
||||||
placeholder="请输入搜索关键词"
|
placeholder="请输入搜索关键词"
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
@search="reload"
|
@search="() => reload()"
|
||||||
@pressEnter="reload"
|
@pressEnter="() => reload()"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
@@ -52,9 +52,9 @@
|
|||||||
ColumnItem,
|
ColumnItem,
|
||||||
DatasourceFunction
|
DatasourceFunction
|
||||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
import { pageDocsBook } from '@/api/cms/docs-book';
|
import { pageCmsDocsBook } from '@/api/cms/cmsDocsBook';
|
||||||
import { EleProTable } from 'ele-admin-pro';
|
import { EleProTable } from 'ele-admin-pro';
|
||||||
import { DocsBook, DocsBookParam } from '@/api/cms/docs-book/model';
|
import { CmsDocsBook, CmsDocsBookParam } from '@/api/cms/cmsDocsBook/model';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
// 弹窗是否打开
|
// 弹窗是否打开
|
||||||
@@ -62,11 +62,11 @@
|
|||||||
// 标题
|
// 标题
|
||||||
title?: string;
|
title?: string;
|
||||||
// 修改回显的数据
|
// 修改回显的数据
|
||||||
data?: DocsBook | null;
|
data?: CmsDocsBook | null;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'done', data: DocsBook): void;
|
(e: 'done', data: CmsDocsBook): void;
|
||||||
(e: 'update:visible', visible: boolean): void;
|
(e: 'update:visible', visible: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 搜索内容
|
// 搜索内容
|
||||||
const searchText = ref(null);
|
const searchText = ref<string>('');
|
||||||
const pageId = ref<number>(0);
|
const pageId = ref<number>(0);
|
||||||
const checked = ref<boolean>(true);
|
const checked = ref<boolean>(true);
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
if (searchText.value) {
|
if (searchText.value) {
|
||||||
where.name = searchText.value;
|
where.name = searchText.value;
|
||||||
}
|
}
|
||||||
return pageDocsBook({
|
return pageCmsDocsBook({
|
||||||
...where,
|
...where,
|
||||||
...orders,
|
...orders,
|
||||||
page,
|
page,
|
||||||
@@ -123,18 +123,18 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* 搜索 */
|
/* 搜索 */
|
||||||
const reload = (where?: DocsBookParam) => {
|
const reload = (where?: CmsDocsBookParam) => {
|
||||||
tableRef?.value?.reload({ page: 1, where });
|
tableRef?.value?.reload({ page: 1, where });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onRadio = (record: DocsBook) => {
|
const onRadio = (record: CmsDocsBook) => {
|
||||||
pageId.value = Number(record.bookId);
|
pageId.value = Number(record.bookId);
|
||||||
updateVisible(false);
|
updateVisible(false);
|
||||||
emit('done', record);
|
emit('done', record);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 自定义行属性 */
|
/* 自定义行属性 */
|
||||||
const customRow = (record: DocsBook) => {
|
const customRow = (record: CmsDocsBook) => {
|
||||||
return {
|
return {
|
||||||
// 行点击事件
|
// 行点击事件
|
||||||
// onClick: () => {
|
// onClick: () => {
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
<a-input
|
<a-input
|
||||||
disabled
|
disabled
|
||||||
style="width: calc(100% - 32px)"
|
style="width: calc(100% - 32px)"
|
||||||
v-model:value="value"
|
:value="displayValue"
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
/>
|
/>
|
||||||
<a-button @click="openEdit">
|
<a-button @click="() => openEdit()">
|
||||||
<template #icon><BulbOutlined class="ele-text-warning" /></template>
|
<template #icon><BulbOutlined class="ele-text-warning" /></template>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
import { BulbOutlined } from '@ant-design/icons-vue';
|
import { BulbOutlined } from '@ant-design/icons-vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import SelectData from './components/select-data.vue';
|
import SelectData from './components/select-data.vue';
|
||||||
import { DocsBook } from '@/api/cms/docs-book/model';
|
import { CmsDocsBook } from '@/api/cms/cmsDocsBook/model';
|
||||||
|
|
||||||
withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
value?: any;
|
value?: any;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
@@ -38,22 +38,27 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'done', DocsBook): void;
|
(e: 'done', data: CmsDocsBook): void;
|
||||||
(e: 'clear'): void;
|
(e: 'clear'): void;
|
||||||
|
(e: 'update:value', value: any): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// 是否显示编辑弹窗
|
// 是否显示编辑弹窗
|
||||||
const showEdit = ref(false);
|
const showEdit = ref(false);
|
||||||
// 当前编辑数据
|
// 当前编辑数据
|
||||||
const current = ref<DocsBook | null>(null);
|
const current = ref<CmsDocsBook | null>(null);
|
||||||
|
// 显示值
|
||||||
|
const displayValue = ref(props.value || '');
|
||||||
|
|
||||||
/* 打开编辑弹窗 */
|
/* 打开编辑弹窗 */
|
||||||
const openEdit = (row?: DocsBook) => {
|
const openEdit = (row?: CmsDocsBook) => {
|
||||||
current.value = row ?? null;
|
current.value = row ?? null;
|
||||||
showEdit.value = true;
|
showEdit.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (row) => {
|
const onChange = (row) => {
|
||||||
|
displayValue.value = row.name;
|
||||||
|
emit('update:value', row.name);
|
||||||
emit('done', row);
|
emit('done', row);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
<!-- 用户编辑弹窗 -->
|
<!-- 用户编辑弹窗 -->
|
||||||
<template>
|
<template>
|
||||||
<a-drawer
|
<a-drawer
|
||||||
:width="`80%`"
|
:width="`70%`"
|
||||||
:visible="visible"
|
:visible="visible"
|
||||||
:confirm-loading="loading"
|
:confirm-loading="loading"
|
||||||
:maxable="maxAble"
|
:maxable="maxAble"
|
||||||
title="AI审计方案生成器"
|
title="AI审计方案生成器"
|
||||||
:body-style="{ paddingBottom: '8px', background: '#f3f3f3' }"
|
:body-style="{ paddingBottom: '8px', background: '#f3f3f3' }"
|
||||||
@update:visible="updateVisible"
|
@update:visible="updateVisible"
|
||||||
:maskClosable="false"
|
:maskClosable="false"
|
||||||
:footer="null"
|
:footer="null"
|
||||||
@ok="save"
|
@ok="save"
|
||||||
>
|
>
|
||||||
<a-card title="基本信息" style="margin-bottom: 20px" :bordered="false">
|
<a-card title="基本信息" style="margin-bottom: 20px" :bordered="false">
|
||||||
<a-descriptions>
|
<a-descriptions>
|
||||||
<a-descriptions-item
|
<a-descriptions-item
|
||||||
label="公司名称"
|
label="公司名称"
|
||||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||||
>
|
>
|
||||||
<span @click="copyText(form.name)">{{ form.name }}</span>
|
<span @click="copyText(form.name)">{{ form.name }}</span>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item
|
<a-descriptions-item
|
||||||
label="被审计人"
|
label="被审计人"
|
||||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||||
>
|
>
|
||||||
<span>{{ form.nickname || '暂无' }}</span>
|
<span>{{ form.nickname || '暂无' }}</span>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
<a-descriptions-item
|
<a-descriptions-item
|
||||||
label="审计时间"
|
label="审计时间"
|
||||||
:labelStyle="{ width: '90px', color: '#808080' }"
|
:labelStyle="{ width: '90px', color: '#808080' }"
|
||||||
>
|
>
|
||||||
<span>{{ form.expirationTime }}</span>
|
<span>{{ form.expirationTime }}</span>
|
||||||
</a-descriptions-item>
|
</a-descriptions-item>
|
||||||
@@ -78,13 +78,13 @@
|
|||||||
<div class="navigation-container">
|
<div class="navigation-container">
|
||||||
<div class="nav-grid">
|
<div class="nav-grid">
|
||||||
<a-button
|
<a-button
|
||||||
v-for="(item, index) in navigationItems"
|
v-for="(item, index) in navigationItems"
|
||||||
:key="index"
|
:key="index"
|
||||||
:type="currentSection === index ? 'primary' : 'default'"
|
:type="currentSection === index ? 'primary' : 'default'"
|
||||||
size="small"
|
size="small"
|
||||||
@click="scrollToSection(index)"
|
@click="scrollToSection(index)"
|
||||||
class="nav-button"
|
class="nav-button"
|
||||||
:class="{ 'active': currentSection === index }"
|
:class="{ 'active': currentSection === index }"
|
||||||
>
|
>
|
||||||
<span class="nav-number">{{ item.number }}</span>
|
<span class="nav-number">{{ item.number }}</span>
|
||||||
<span class="nav-text">{{ item.name }}</span>
|
<span class="nav-text">{{ item.name }}</span>
|
||||||
@@ -95,8 +95,8 @@
|
|||||||
<div class="progress-container">
|
<div class="progress-container">
|
||||||
<div class="progress-bar">
|
<div class="progress-bar">
|
||||||
<div
|
<div
|
||||||
class="progress-fill"
|
class="progress-fill"
|
||||||
:style="{ width: `${((currentSection + 1) / navigationItems.length) * 100}%` }"
|
:style="{ width: `${((currentSection + 1) / navigationItems.length) * 100}%` }"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress-text">
|
<div class="progress-text">
|
||||||
@@ -109,22 +109,22 @@
|
|||||||
<!-- 审计方案内容 -->
|
<!-- 审计方案内容 -->
|
||||||
<div class="audit-content">
|
<div class="audit-content">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in navigationItems"
|
v-for="(item, index) in navigationItems"
|
||||||
:key="index"
|
:key="index"
|
||||||
:id="`section-${index}`"
|
:id="`section-${index}`"
|
||||||
class="audit-section"
|
class="audit-section"
|
||||||
>
|
>
|
||||||
<a-card
|
<a-card
|
||||||
:title="`${item.number}、${item.name}`"
|
:title="`${item.number}、${item.name}`"
|
||||||
style="margin-bottom: 20px"
|
style="margin-bottom: 20px"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-button
|
<a-button
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
@click="generateContent(index)"
|
@click="generateContent(index)"
|
||||||
:loading="item.generating"
|
:loading="item.generating"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<RobotOutlined/>
|
<RobotOutlined/>
|
||||||
@@ -140,21 +140,36 @@
|
|||||||
<!-- 单内容部分 -->
|
<!-- 单内容部分 -->
|
||||||
<template v-if="!item.children">
|
<template v-if="!item.children">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
v-model:value="item.content"
|
v-model:value="item.content"
|
||||||
:rows="item.rows || 8"
|
:rows="item.rows || 8"
|
||||||
:placeholder="item.placeholder"
|
:placeholder="item.placeholder"
|
||||||
class="content-textarea"
|
class="content-textarea"
|
||||||
style="margin-top: 16px"
|
style="margin-top: 16px; background-color: #f0fdf4"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div style="margin-top: 12px">
|
<div style="margin-top: 12px">
|
||||||
<div class="question-prompt">点此开始提问</div>
|
<div class="question-prompt">AI小助手</div>
|
||||||
<a-textarea
|
<div class="flex flex-col gap-2 justify-center items-start">
|
||||||
|
<a-textarea
|
||||||
v-model:value="item.suggestion"
|
v-model:value="item.suggestion"
|
||||||
:rows="3"
|
:rows="3"
|
||||||
placeholder="请在此输入您的优化建议或疑问..."
|
placeholder="请在此输入您的优化建议或疑问..."
|
||||||
class="suggestion-textarea"
|
class="suggestion-textarea"
|
||||||
/>
|
style="flex: 1;"
|
||||||
|
@pressEnter="generateContent(index)"
|
||||||
|
/>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
@click="generateContent(index)"
|
||||||
|
:loading="item.generating"
|
||||||
|
style="align-self: flex-end; margin-bottom: 4px;"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<RobotOutlined/>
|
||||||
|
</template>
|
||||||
|
发送
|
||||||
|
</a-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -164,11 +179,11 @@
|
|||||||
<div class="child-title">
|
<div class="child-title">
|
||||||
{{ child.name }}
|
{{ child.name }}
|
||||||
<a-button
|
<a-button
|
||||||
type="text"
|
type="text"
|
||||||
size="small"
|
size="small"
|
||||||
@click.stop="generateContent(index, childIndex)"
|
@click.stop="generateContent(index, childIndex)"
|
||||||
:loading="child.generating"
|
:loading="child.generating"
|
||||||
style="margin-left: 12px"
|
style="margin-left: 12px"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<RobotOutlined/>
|
<RobotOutlined/>
|
||||||
@@ -177,11 +192,11 @@
|
|||||||
</a-button>
|
</a-button>
|
||||||
</div>
|
</div>
|
||||||
<a-textarea
|
<a-textarea
|
||||||
v-model:value="child.content"
|
v-model:value="child.content"
|
||||||
:rows="child.rows || 6"
|
:rows="child.rows || 6"
|
||||||
:placeholder="child.placeholder"
|
:placeholder="child.placeholder"
|
||||||
class="content-textarea"
|
class="content-textarea"
|
||||||
style="margin-top: 12px"
|
style="margin-top: 12px; background-color: #f0fdf4"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -733,7 +748,7 @@ const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
|||||||
section.generating = true;
|
section.generating = true;
|
||||||
try {
|
try {
|
||||||
await Promise.all(section.children.map((_, i) =>
|
await Promise.all(section.children.map((_, i) =>
|
||||||
generateContent(sectionIndex, i)
|
generateContent(sectionIndex, i)
|
||||||
));
|
));
|
||||||
} finally {
|
} finally {
|
||||||
section.generating = false;
|
section.generating = false;
|
||||||
@@ -776,7 +791,7 @@ const generateContent = async (sectionIndex: number, childIndex?: number) => {
|
|||||||
/* 监听滚动位置更新当前章节 */
|
/* 监听滚动位置更新当前章节 */
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
const sections = navigationItems.value.map((_, index) =>
|
const sections = navigationItems.value.map((_, index) =>
|
||||||
document.getElementById(`section-${index}`)
|
document.getElementById(`section-${index}`)
|
||||||
);
|
);
|
||||||
|
|
||||||
const scrollContainer = getScrollContainer();
|
const scrollContainer = getScrollContainer();
|
||||||
@@ -845,19 +860,19 @@ onUnmounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.visible,
|
() => props.visible,
|
||||||
(visible) => {
|
(visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (props.data) {
|
if (props.data) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
assignObject(form, props.data);
|
assignObject(form, props.data);
|
||||||
// 重置到第一个章节
|
// 重置到第一个章节
|
||||||
currentSection.value = 0;
|
currentSection.value = 0;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
resetFields();
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
resetFields();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -908,7 +923,6 @@ export default {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #0958d9;
|
color: #0958d9;
|
||||||
text-decoration: underline;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,305 @@
|
|||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<template>
|
||||||
|
<ele-modal
|
||||||
|
:width="800"
|
||||||
|
:visible="visible"
|
||||||
|
:maskClosable="false"
|
||||||
|
:maxable="maxable"
|
||||||
|
:title="isUpdate ? '编辑资料库' : '添加资料库'"
|
||||||
|
:body-style="{ paddingBottom: '28px' }"
|
||||||
|
@update:visible="updateVisible"
|
||||||
|
@ok="save"
|
||||||
|
>
|
||||||
|
<a-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="form"
|
||||||
|
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||||
|
:wrapper-col="
|
||||||
|
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<a-form-item label="资料库名称" name="name">
|
||||||
|
<a-input
|
||||||
|
allow-clear
|
||||||
|
placeholder="请输入资料库名称"
|
||||||
|
v-model:value="form.name"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="类型" name="type">
|
||||||
|
<a-select
|
||||||
|
v-model:value="form.type"
|
||||||
|
placeholder="请选择资料库类型"
|
||||||
|
:options="typeOptions"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<!-- <a-form-item label="关联知识库" name="kbId">-->
|
||||||
|
<!-- <SelectDocsBook-->
|
||||||
|
<!-- v-model:value="kbDisplayName"-->
|
||||||
|
<!-- placeholder="请选择关联知识库"-->
|
||||||
|
<!-- @done="onSelectKnowledgeBase"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
|
||||||
|
<a-form-item
|
||||||
|
label="资料库图标"
|
||||||
|
name="image">
|
||||||
|
<SelectFile
|
||||||
|
:placeholder="`请选择图片`"
|
||||||
|
:limit="1"
|
||||||
|
:data="images"
|
||||||
|
@done="chooseImage"
|
||||||
|
@del="onDeleteImage"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="资料库描述" name="content">
|
||||||
|
<a-textarea
|
||||||
|
:rows="3"
|
||||||
|
:maxlength="500"
|
||||||
|
placeholder="请输入资料库描述"
|
||||||
|
v-model:value="form.content"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="关联文件" name="files">
|
||||||
|
<SelectFile
|
||||||
|
:placeholder="'请选择关联文件'"
|
||||||
|
:limit="10"
|
||||||
|
:data="fileList"
|
||||||
|
@done="onSelectFile"
|
||||||
|
@del="onDeleteFile"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="备注" name="comments">
|
||||||
|
<a-textarea
|
||||||
|
:rows="4"
|
||||||
|
:maxlength="200"
|
||||||
|
placeholder="请输入备注信息"
|
||||||
|
v-model:value="form.comments"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="是否推荐" name="recommend">
|
||||||
|
<a-radio-group v-model:value="form.recommend">
|
||||||
|
<a-radio :value="1">推荐</a-radio>
|
||||||
|
<a-radio :value="0">不推荐</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="排序" name="sort">
|
||||||
|
<a-input-number
|
||||||
|
v-model:value="form.sort"
|
||||||
|
:min="0"
|
||||||
|
:max="9999"
|
||||||
|
placeholder="数字越小越靠前"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="状态" name="status">
|
||||||
|
<a-radio-group v-model:value="form.status">
|
||||||
|
<a-radio :value="0">显示</a-radio>
|
||||||
|
<a-radio :value="1">隐藏</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</ele-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, watch } from 'vue';
|
||||||
|
import { Form, message } from 'ant-design-vue';
|
||||||
|
import { assignObject, uuid } from 'ele-admin-pro';
|
||||||
|
import { addPwlProjectLibrary, updatePwlProjectLibrary } from '@/api/pwl/pwlProjectLibrary';
|
||||||
|
import { PwlProjectLibrary } from '@/api/pwl/pwlProjectLibrary/model';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||||
|
import { FormInstance } from 'ant-design-vue/es/form';
|
||||||
|
import { FileRecord } from '@/api/system/file/model';
|
||||||
|
import SelectDocsBook from '@/components/SelectDocsBook/index.vue';
|
||||||
|
import SelectFile from '@/components/SelectFile/index.vue';
|
||||||
|
|
||||||
|
// 是否是修改
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
// 是否开启响应式布局
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { styleResponsive } = storeToRefs(themeStore);
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
// 弹窗是否打开
|
||||||
|
visible: boolean;
|
||||||
|
// 修改回显的数据
|
||||||
|
data?: PwlProjectLibrary | null;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'done'): void;
|
||||||
|
(e: 'update:visible', visible: boolean): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 提交状态
|
||||||
|
const loading = ref(false);
|
||||||
|
// 是否显示最大化切换按钮
|
||||||
|
const maxable = ref(true);
|
||||||
|
// 表格选中数据
|
||||||
|
const formRef = ref<FormInstance | null>(null);
|
||||||
|
const images = ref<ItemType[]>([]);
|
||||||
|
const fileList = ref<ItemType[]>([]);
|
||||||
|
const kbDisplayName = ref<string>('');
|
||||||
|
|
||||||
|
// 类型选项
|
||||||
|
const typeOptions = [
|
||||||
|
{ label: '项目案例库', value: 'biz' },
|
||||||
|
{ label: '公共知识库', value: 'pub' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const form = reactive<PwlProjectLibrary>({
|
||||||
|
id: undefined,
|
||||||
|
name: undefined,
|
||||||
|
type: undefined,
|
||||||
|
kbId: undefined,
|
||||||
|
sort: 0,
|
||||||
|
image: undefined,
|
||||||
|
content: undefined,
|
||||||
|
files: undefined,
|
||||||
|
recommend: 0,
|
||||||
|
deleted: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
tenantId: undefined,
|
||||||
|
createTime: undefined,
|
||||||
|
updateTime: undefined,
|
||||||
|
status: 0,
|
||||||
|
comments: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
/* 更新visible */
|
||||||
|
const updateVisible = (value: boolean) => {
|
||||||
|
emit('update:visible', value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择图片
|
||||||
|
const chooseImage = (data: FileRecord) => {
|
||||||
|
images.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
form.image = data.path;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除图片
|
||||||
|
const onDeleteImage = (index: number) => {
|
||||||
|
images.value.splice(index, 1);
|
||||||
|
form.image = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择文件
|
||||||
|
const onSelectFile = (data: FileRecord) => {
|
||||||
|
fileList.value.push({
|
||||||
|
uid: data.id,
|
||||||
|
url: data.path,
|
||||||
|
status: 'done'
|
||||||
|
});
|
||||||
|
// 更新 form.files 字段
|
||||||
|
form.files = fileList.value.map(file => file.url).join(',');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除文件
|
||||||
|
const onDeleteFile = (index: number) => {
|
||||||
|
fileList.value.splice(index, 1);
|
||||||
|
// 更新 form.files 字段
|
||||||
|
form.files = fileList.value.map(file => file.url).join(',');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 选择知识库
|
||||||
|
const onSelectKnowledgeBase = (data: any) => {
|
||||||
|
form.kbId = data.id;
|
||||||
|
kbDisplayName.value = data.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 保存编辑 */
|
||||||
|
const save = () => {
|
||||||
|
if (!formRef.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
formRef.value
|
||||||
|
.validate()
|
||||||
|
.then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
const formData = {
|
||||||
|
...form
|
||||||
|
};
|
||||||
|
const saveOrUpdate = isUpdate.value ? updatePwlProjectLibrary : addPwlProjectLibrary;
|
||||||
|
saveOrUpdate(formData)
|
||||||
|
.then((msg) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.success(msg);
|
||||||
|
updateVisible(false);
|
||||||
|
emit('done');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
loading.value = false;
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(visible) => {
|
||||||
|
if (visible) {
|
||||||
|
images.value = [];
|
||||||
|
fileList.value = [];
|
||||||
|
kbDisplayName.value = '';
|
||||||
|
|
||||||
|
if (props.data) {
|
||||||
|
assignObject(form, props.data);
|
||||||
|
|
||||||
|
// 回显图片
|
||||||
|
if(props.data.image){
|
||||||
|
images.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: props.data.image,
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 回显文件
|
||||||
|
if(props.data.files){
|
||||||
|
const files = props.data.files.split(',');
|
||||||
|
files.forEach((file) => {
|
||||||
|
if(file.trim()) {
|
||||||
|
fileList.value.push({
|
||||||
|
uid: uuid(),
|
||||||
|
url: file.trim(),
|
||||||
|
status: 'done'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 回显知识库名称 - 这里可以根据实际需求通过API获取知识库名称
|
||||||
|
if(props.data.kbId) {
|
||||||
|
kbDisplayName.value = props.data.kbId;
|
||||||
|
}
|
||||||
|
|
||||||
|
isUpdate.value = true;
|
||||||
|
} else {
|
||||||
|
// 重置表单默认值
|
||||||
|
form.sort = 0;
|
||||||
|
form.recommend = 0;
|
||||||
|
form.status = 0;
|
||||||
|
isUpdate.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
42
src/views/pwl/pwlProjectLibrary/components/search.vue
Normal file
42
src/views/pwl/pwlProjectLibrary/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<!-- 搜索表单 -->
|
||||||
|
<template>
|
||||||
|
<a-space :size="10" style="flex-wrap: wrap">
|
||||||
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||||
|
<template #icon>
|
||||||
|
<PlusOutlined />
|
||||||
|
</template>
|
||||||
|
<span>添加</span>
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { GradeParam } from '@/api/user/grade/model';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
// 选中的角色
|
||||||
|
selection?: [];
|
||||||
|
}>(),
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'search', where?: GradeParam): void;
|
||||||
|
(e: 'add'): void;
|
||||||
|
(e: 'remove'): void;
|
||||||
|
(e: 'batchMove'): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
const add = () => {
|
||||||
|
emit('add');
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.selection,
|
||||||
|
() => {}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
258
src/views/pwl/pwlProjectLibrary/index.vue
Normal file
258
src/views/pwl/pwlProjectLibrary/index.vue
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page">
|
||||||
|
<div class="ele-body">
|
||||||
|
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||||
|
<ele-pro-table
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="pwlProjectLibraryId"
|
||||||
|
:columns="columns"
|
||||||
|
:datasource="datasource"
|
||||||
|
:customRow="customRow"
|
||||||
|
tool-class="ele-toolbar-form"
|
||||||
|
class="sys-org-table"
|
||||||
|
>
|
||||||
|
<template #toolbar>
|
||||||
|
<search
|
||||||
|
@search="reload"
|
||||||
|
:selection="selection"
|
||||||
|
@add="openEdit"
|
||||||
|
@remove="removeBatch"
|
||||||
|
@batchMove="openMove"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="column.key === 'type'">
|
||||||
|
<a-tag v-if="record.type === 'biz'" color="blue">项目案例库</a-tag>
|
||||||
|
<a-tag v-if="record.type === 'pub'" color="green">公共知识库</a-tag>
|
||||||
|
<span v-if="!record.type || (record.type !== 'biz' && record.type !== 'pub')">未设置</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'image'">
|
||||||
|
<a-image :src="record.image" :width="50" />
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'status'">
|
||||||
|
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||||
|
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.key === 'action'">
|
||||||
|
<a-space>
|
||||||
|
<a @click="openEdit(record)">修改</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="确定要删除此记录吗?"
|
||||||
|
@confirm="remove(record)"
|
||||||
|
>
|
||||||
|
<a class="ele-text-danger">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
</a-space>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</ele-pro-table>
|
||||||
|
</a-card>
|
||||||
|
|
||||||
|
<!-- 编辑弹窗 -->
|
||||||
|
<PwlProjectLibraryEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { createVNode, ref } from 'vue';
|
||||||
|
import { message, Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import type { EleProTable } from 'ele-admin-pro';
|
||||||
|
import type {
|
||||||
|
DatasourceFunction,
|
||||||
|
ColumnItem
|
||||||
|
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||||
|
import Search from './components/search.vue';
|
||||||
|
import PwlProjectLibraryEdit from './components/pwlProjectLibraryEdit.vue';
|
||||||
|
import { pagePwlProjectLibrary, removePwlProjectLibrary, removeBatchPwlProjectLibrary } from '@/api/pwl/pwlProjectLibrary';
|
||||||
|
import type { PwlProjectLibrary, PwlProjectLibraryParam } from '@/api/pwl/pwlProjectLibrary/model';
|
||||||
|
|
||||||
|
// 表格实例
|
||||||
|
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||||
|
|
||||||
|
// 表格选中数据
|
||||||
|
const selection = ref<PwlProjectLibrary[]>([]);
|
||||||
|
// 当前编辑数据
|
||||||
|
const current = ref<PwlProjectLibrary | null>(null);
|
||||||
|
// 是否显示编辑弹窗
|
||||||
|
const showEdit = ref(false);
|
||||||
|
// 是否显示批量移动弹窗
|
||||||
|
const showMove = ref(false);
|
||||||
|
// 加载状态
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
|
// 表格数据源
|
||||||
|
const datasource: DatasourceFunction = ({
|
||||||
|
page,
|
||||||
|
limit,
|
||||||
|
where,
|
||||||
|
orders,
|
||||||
|
filters
|
||||||
|
}) => {
|
||||||
|
if (filters) {
|
||||||
|
where.status = filters.status;
|
||||||
|
}
|
||||||
|
return pagePwlProjectLibrary({
|
||||||
|
...where,
|
||||||
|
...orders,
|
||||||
|
page,
|
||||||
|
limit
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 表格列配置
|
||||||
|
const columns = ref<ColumnItem[]>([
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'id',
|
||||||
|
key: 'id',
|
||||||
|
align: 'center',
|
||||||
|
width: 90,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '资料库',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '类型',
|
||||||
|
dataIndex: 'type',
|
||||||
|
key: 'type',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// title: '关联知识库ID',
|
||||||
|
// dataIndex: 'kbId',
|
||||||
|
// key: 'kbId',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '资料库图标',
|
||||||
|
// dataIndex: 'image',
|
||||||
|
// key: 'image',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '是否推荐',
|
||||||
|
// dataIndex: 'recommend',
|
||||||
|
// key: 'recommend',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '状态',
|
||||||
|
// dataIndex: 'status',
|
||||||
|
// key: 'status',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// title: '备注',
|
||||||
|
// dataIndex: 'comments',
|
||||||
|
// key: 'comments',
|
||||||
|
// align: 'center',
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: '排序',
|
||||||
|
dataIndex: 'sort',
|
||||||
|
key: 'sort',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 180,
|
||||||
|
fixed: 'right',
|
||||||
|
align: 'center',
|
||||||
|
hideInSetting: true
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
const reload = (where?: PwlProjectLibraryParam) => {
|
||||||
|
selection.value = [];
|
||||||
|
tableRef?.value?.reload({ where: where });
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开编辑弹窗 */
|
||||||
|
const openEdit = (row?: PwlProjectLibrary) => {
|
||||||
|
current.value = row ?? null;
|
||||||
|
showEdit.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 打开批量移动弹窗 */
|
||||||
|
const openMove = () => {
|
||||||
|
showMove.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 删除单个 */
|
||||||
|
const remove = (row: PwlProjectLibrary) => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removePwlProjectLibrary(row.id)
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 批量删除 */
|
||||||
|
const removeBatch = () => {
|
||||||
|
if (!selection.value.length) {
|
||||||
|
message.error('请至少选择一条数据');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除选中的记录吗?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
maskClosable: true,
|
||||||
|
onOk: () => {
|
||||||
|
const hide = message.loading('请求中..', 0);
|
||||||
|
removeBatchPwlProjectLibrary(selection.value.map((d) => d.id))
|
||||||
|
.then((msg) => {
|
||||||
|
hide();
|
||||||
|
message.success(msg);
|
||||||
|
reload();
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
hide();
|
||||||
|
message.error(e.message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 查询 */
|
||||||
|
const query = () => {
|
||||||
|
loading.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 自定义行属性 */
|
||||||
|
const customRow = (record: PwlProjectLibrary) => {
|
||||||
|
return {
|
||||||
|
// 行点击事件
|
||||||
|
onClick: () => {
|
||||||
|
// console.log(record);
|
||||||
|
},
|
||||||
|
// 行双击事件
|
||||||
|
onDblclick: () => {
|
||||||
|
openEdit(record);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
query();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'PwlProjectLibrary'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
Reference in New Issue
Block a user