|
|
@@ -5,10 +5,9 @@ import type { KnowledgeType } from './config-data';
|
|
5
|
5
|
|
|
6
|
6
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
7
|
7
|
|
|
8
|
|
-import { ref } from 'vue';
|
|
9
|
8
|
import { useRouter } from 'vue-router';
|
|
10
|
9
|
|
|
11
|
|
-import { Page } from '@vben/common-ui';
|
|
|
10
|
+import { Page, useVbenDrawer } from '@vben/common-ui';
|
|
12
|
11
|
|
|
13
|
12
|
import { ElImage, ElMessageBox } from 'element-plus';
|
|
14
|
13
|
|
|
|
@@ -74,6 +73,11 @@ const getKnowledgeTypeList = async (params: any) => {
|
|
74
|
73
|
return mockData;
|
|
75
|
74
|
};
|
|
76
|
75
|
|
|
|
76
|
+// 定义侧拉
|
|
|
77
|
+const [TypeDrawerCom, typeDrawerApi] = useVbenDrawer({
|
|
|
78
|
+ connectedComponent: TypeDrawer,
|
|
|
79
|
+});
|
|
|
80
|
+
|
|
77
|
81
|
const deleteKnowledgeType = async (ids: string[]) => {
|
|
78
|
82
|
// 模拟删除操作
|
|
79
|
83
|
// console.log('删除知识库类别', ids);
|
|
|
@@ -134,25 +138,16 @@ const [BasicTable, BasicTableApi] = useVbenVxeGrid({
|
|
134
|
138
|
gridOptions,
|
|
135
|
139
|
});
|
|
136
|
140
|
|
|
137
|
|
-// 抽屉组件引用
|
|
138
|
|
-const typeDrawerRef = ref();
|
|
139
|
|
-
|
|
140
|
141
|
// 新增知识库类别
|
|
141
|
142
|
const handleAdd = () => {
|
|
142
|
143
|
// 调用抽屉组件的open方法
|
|
143
|
|
- const drawerApi = typeDrawerRef.value?.getDrawerApi?.();
|
|
144
|
|
- if (drawerApi) {
|
|
145
|
|
- drawerApi.setData({ isUpdate: false }).open();
|
|
146
|
|
- }
|
|
|
144
|
+ typeDrawerApi.setData({ isUpdate: false }).open();
|
|
147
|
145
|
};
|
|
148
|
146
|
|
|
149
|
147
|
// 编辑知识库类别
|
|
150
|
148
|
const handleEdit = (row: KnowledgeType) => {
|
|
151
|
149
|
// 调用抽屉组件的open方法
|
|
152
|
|
- const drawerApi = typeDrawerRef.value?.getDrawerApi?.();
|
|
153
|
|
- if (drawerApi) {
|
|
154
|
|
- drawerApi.setData({ id: row.id, isUpdate: true }).open();
|
|
155
|
|
- }
|
|
|
150
|
+ typeDrawerApi.setData({ id: row.id, isUpdate: true }).open();
|
|
156
|
151
|
};
|
|
157
|
152
|
|
|
158
|
153
|
// 查看知识库类别详情
|
|
|
@@ -203,6 +198,6 @@ const handleDelete = async (row: KnowledgeType) => {
|
|
203
|
198
|
</BasicTable>
|
|
204
|
199
|
|
|
205
|
200
|
<!-- 抽屉组件 -->
|
|
206
|
|
- <TypeDrawer @reload="BasicTableApi.reload()" />
|
|
|
201
|
+ <TypeDrawerCom />
|
|
207
|
202
|
</Page>
|
|
208
|
203
|
</template>
|