Browse Source

feat: 0520 需求开发

master
AaronWu 3 weeks ago
parent
commit
07276ffe90
  1. 4
      .env.development
  2. 2
      src/views/client/entrance/index.vue
  3. 73
      src/views/client/knowledgeBase/index.vue
  4. 40
      src/views/question/issue/columns.tsx
  5. 2
      src/views/question/issue/formSchemas.tsx
  6. 4
      src/views/question/issue/index.vue

4
.env.development

@ -9,8 +9,8 @@
# 只在开发模式中被载入 # 只在开发模式中被载入
# 网站前缀 # 网站前缀
VITE_BASE_API_URL = http://192.168.2.3:8089/server/
# VITE_BASE_API_URL = http://43.137.2.78:8085/server/
# VITE_BASE_API_URL = http://192.168.2.3:8089/server/
VITE_BASE_API_URL = http://43.137.2.78:8085/server/
# base api # base api
VITE_BASE_API = '/server/' VITE_BASE_API = '/server/'

2
src/views/client/entrance/index.vue

@ -129,7 +129,7 @@
<!-- 搜索框 --> <!-- 搜索框 -->
<div class="search-section"> <div class="search-section">
<h1>👋 有什么可以帮?</h1>
<h1>👋 有什么可以帮?</h1>
<div class="search-wrapper"> <div class="search-wrapper">
<div class="search-container"> <div class="search-container">
<a-input-search <a-input-search

73
src/views/client/knowledgeBase/index.vue

@ -9,7 +9,7 @@
</div> </div>
<a-row :gutter="16"> <a-row :gutter="16">
<!-- 左侧目录树 --> <!-- 左侧目录树 -->
<a-col :span="4">
<a-col :span="5">
<a-card class="tree-card"> <a-card class="tree-card">
<template #title> <template #title>
<span class="card-title"> <span class="card-title">
@ -17,12 +17,27 @@
<span class="title-text">知识库目录</span> <span class="title-text">知识库目录</span>
</span> </span>
</template> </template>
<a-tree v-model:selectedKeys="selectedKeys" :tree-data="treeData" @select="onSelect" />
<div class="h-full w-full overflow-auto">
<a-tree
v-model:selectedKeys="selectedKeys"
:tree-data="treeData"
show-icon
@select="onSelect"
>
<template #title="{ title, key, isLeafCustom }">
<span v-if="!isLeafCustom">{{ title }}</span>
<div v-else class="w-[100%] flex items-center">
<FileOutlined class="mr-2" v-if="isLeafCustom" />
<span class="truncate">{{ title }}</span>
</div>
</template>
</a-tree>
</div>
</a-card> </a-card>
</a-col> </a-col>
<!-- 右侧内容区 --> <!-- 右侧内容区 -->
<a-col :span="20">
<a-col :span="19">
<a-card class="content-card"> <a-card class="content-card">
<template #title> <template #title>
<span class="card-title"> <span class="card-title">
@ -108,11 +123,15 @@
ExportOutlined, ExportOutlined,
LeftOutlined, LeftOutlined,
PaperClipOutlined, PaperClipOutlined,
CarryOutOutlined,
FileOutlined, FileOutlined,
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
import { fetchKnowledgeBaseList, findOneById, addReadCount } from '@/api/knowledgeBase'; import { fetchKnowledgeBaseList, findOneById, addReadCount } from '@/api/knowledgeBase';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { getDictionaryByTypeName } from '@/utils/dict';
import { DictEnum } from '@/enums/dictEnum';
// //
const handleDownload = (file) => { const handleDownload = (file) => {
window.open(file.url, '_blank'); window.open(file.url, '_blank');
@ -157,12 +176,23 @@
}; };
watch(selectedKeys, async (newVal) => { watch(selectedKeys, async (newVal) => {
console.log('newVal: ', newVal);
if (!newVal.length) return; if (!newVal.length) return;
});
//
const onSelect = async (selectedKeys: string[], info: any) => {
console.log('selected', selectedKeys, info);
if (!selectedKeys.length || !info?.node?.dataRef?.isLeafCustom) {
curRowDetail.value = {};
return;
}
loading.value = true; loading.value = true;
try { try {
const res = await findOneById({ id: newVal[0] });
const res = await findOneById({ id: selectedKeys[0] });
curRowDetail.value = res; curRowDetail.value = res;
const count = await addReadCount({ id: newVal[0] });
const count = await addReadCount({ id: selectedKeys[0] });
console.log('count: ', count); console.log('count: ', count);
if (count) { if (count) {
curRowDetail.value.readCount = count; curRowDetail.value.readCount = count;
@ -172,21 +202,36 @@
} finally { } finally {
loading.value = false; loading.value = false;
} }
});
//
const onSelect = (selectedKeys: string[], info: any) => {
console.log('selected', selectedKeys, info);
}; };
const initTreeData = async () => { const initTreeData = async () => {
const list = await fetchKnowledgeBaseList();
treeData.value = list.map((e) => {
let tree: any = [];
//
const tagList = await getDictionaryByTypeName(DictEnum.TAG_TYPE);
console.log('tagList: ', tagList);
const list = await fetchKnowledgeBaseList({});
tree = tagList?.map((e) => {
let tagName = e.label;
return { return {
title: e.title,
key: e.id,
title: e.label,
key: e.value,
isLeafCustom: false,
selectable: false,
children: list
.filter((e) => e.tags?.includes(tagName))
.map((item) => {
return {
title: item.title,
key: item.id,
isLeafCustom: true,
};
}),
}; };
}); });
treeData.value = tree;
console.log('route: ', route); console.log('route: ', route);
if (route.query.id) { if (route.query.id) {
selectedKeys.value = [route.query.id as string]; selectedKeys.value = [route.query.id as string];

40
src/views/question/issue/columns.tsx

@ -18,6 +18,7 @@ export const baseColumns: TableColumnItem[] = [
dataIndex: 'title', dataIndex: 'title',
// sorter: true, // sorter: true,
width: 150, width: 150,
ellipsis: true,
resizable: true, resizable: true,
formItemProps: { formItemProps: {
defaultValue: '', defaultValue: '',
@ -72,6 +73,7 @@ export const baseColumns: TableColumnItem[] = [
title: '问题号', title: '问题号',
align: 'center', align: 'center',
dataIndex: 'billcode', dataIndex: 'billcode',
ellipsis: true,
width: 200, width: 200,
formItemProps: { formItemProps: {
defaultValue: '', defaultValue: '',
@ -81,10 +83,33 @@ export const baseColumns: TableColumnItem[] = [
}, },
}, },
}, },
// zentaoNos
{
title: '禅道号',
align: 'center',
dataIndex: 'zentaoNos',
width: 150,
hideInSearch: true,
customRender: ({ record }) => {
const { zentaoNos } = record;
// 自定义渲染成a标签,点击跳转到指定链接
return (
zentaoNos && // 如果zentaoNos存在才渲染
<a
href={`http://43.137.2.78:8084/zentao/bug-view-${zentaoNos}.html`}
target="_blank"
rel="noopener noreferrer"
>
{zentaoNos}
</a>
);
},
},
{ {
title: '客户', title: '客户',
align: 'center', align: 'center',
dataIndex: 'customer', dataIndex: 'customer',
ellipsis: true,
width: 150, width: 150,
formItemProps: { formItemProps: {
defaultValue: '', defaultValue: '',
@ -99,6 +124,7 @@ export const baseColumns: TableColumnItem[] = [
align: 'center', align: 'center',
dataIndex: 'product', dataIndex: 'product',
width: 150, width: 150,
ellipsis: true,
hideInSearch: true, hideInSearch: true,
formItemProps: { formItemProps: {
defaultValue: '', defaultValue: '',
@ -110,6 +136,7 @@ export const baseColumns: TableColumnItem[] = [
align: 'center', align: 'center',
dataIndex: 'version', dataIndex: 'version',
width: 150, width: 150,
ellipsis: true,
hideInSearch: true, hideInSearch: true,
formItemProps: { formItemProps: {
defaultValue: '', defaultValue: '',
@ -120,6 +147,7 @@ export const baseColumns: TableColumnItem[] = [
title: '代理商', title: '代理商',
align: 'center', align: 'center',
dataIndex: 'agent', dataIndex: 'agent',
ellipsis: true,
width: 150, width: 150,
formItemProps: { formItemProps: {
defaultValue: '', defaultValue: '',
@ -140,14 +168,7 @@ export const baseColumns: TableColumnItem[] = [
required: false, required: false,
}, },
}, },
// zentaoNos
{
title: '禅道号',
align: 'center',
dataIndex: 'zentaoNos',
width: 150,
hideInSearch: true,
},
{ {
title: '创建时间', title: '创建时间',
align: 'center', align: 'center',
@ -193,6 +214,9 @@ export const baseColumns: TableColumnItem[] = [
component: 'Select', component: 'Select',
componentProps: { componentProps: {
options: stateTypeList.filter((e) => e.value !== 1), options: stateTypeList.filter((e) => e.value !== 1),
mode: 'multiple',
allowClear: true,
placeholder: '请选择问题状态',
}, },
colProps: { colProps: {
span: 6, span: 6,

2
src/views/question/issue/formSchemas.tsx

@ -324,7 +324,7 @@ export const getFlowFormSchema: (row?: Partial<TableListItem>) => FormSchema[] =
span: 24, span: 24,
}, },
vIf: () => record.state === 0, vIf: () => record.state === 0,
rules: [{ required: true, type: 'string' }],
// rules: [{ required: true, type: 'string' }],
}, },
{ {
field: 'remark', field: 'remark',

4
src/views/question/issue/index.vue

@ -10,7 +10,7 @@
--> -->
<template> <template>
<div class="h-[100%]"> <div class="h-[100%]">
<div class="issue-container h-[55%] overflow-auto" ref="issueContainerRef">
<div class="issue-container h-[58%] overflow-auto" ref="issueContainerRef">
<DynamicTable <DynamicTable
size="small" size="small"
showIndex showIndex
@ -23,7 +23,7 @@
:row-class-name="getRowClassName" :row-class-name="getRowClassName"
:customRow="customRow" :customRow="customRow"
:row-selection="rowSelection" :row-selection="rowSelection"
:scroll="{ x: '100vw' }"
:scroll="{ x: '100vw', y: '180px' }"
> >
<template v-if="isCheckRows" #title> <template v-if="isCheckRows" #title>
<Alert class="w-full" type="info" show-icon> <Alert class="w-full" type="info" show-icon>

Loading…
Cancel
Save