Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nse-ui
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Members
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
吴超
nse-ui
Commits
2f669943
Commit
2f669943
authored
Aug 24, 2025
by
wanglizhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
知识库导入
parent
755912ad
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
85 行增加
和
23 行删除
+85
-23
src/api/ruleConfig/dictionary.js
+30
-0
src/components/CustomUpload/index.vue
+0
-0
src/views/ruleConfig/Dictionary/index.vue
+24
-8
src/views/ruleConfig/Dictionary/modules/UploadModule.vue
+31
-15
没有找到文件。
src/api/ruleConfig/dictionary.js
View file @
2f669943
...
@@ -104,3 +104,32 @@ export function delValue(data) {
...
@@ -104,3 +104,32 @@ export function delValue(data) {
})
})
}
}
/**
* 知识库 - 导出excel
* @param {*} data
* @returns
*/
export
function
exportExcel
(
data
)
{
return
request
({
url
:
'/core/dictionaryexcel/export'
,
method
:
'post'
,
data
:
data
,
responseType
:
'blob'
})
}
/**
* 知识库 - 导入
* @param {*} data
* @returns
*/
export
function
importfile
(
data
)
{
return
request
({
url
:
'/core/dictionaryexcel/importfile'
,
method
:
'post'
,
data
:
data
,
headers
:
{
'Content-Type'
:
'multipart/form-data'
}
})
}
\ No newline at end of file
src/components/CustomUpload/index.vue
View file @
2f669943
差异被折叠。
点击展开。
src/views/ruleConfig/Dictionary/index.vue
View file @
2f669943
...
@@ -8,7 +8,7 @@ import AddClass from './modules/AddClass.vue' // 分类
...
@@ -8,7 +8,7 @@ import AddClass from './modules/AddClass.vue' // 分类
import
AddValue
from
'./modules/AddValue.vue'
// 值
import
AddValue
from
'./modules/AddValue.vue'
// 值
import
uploadModule
from
'./modules/uploadModule.vue'
// 上传模块
import
uploadModule
from
'./modules/uploadModule.vue'
// 上传模块
import
{
dictinaryTypes
,
query
,
delDictionaryType
,
delValue
}
from
'@/api/ruleConfig/dictionary'
import
{
dictinaryTypes
,
query
,
delDictionaryType
,
delValue
,
exportExcel
}
from
'@/api/ruleConfig/dictionary'
const
splitNum
=
ref
(
0.31
)
// 左右分割比例
const
splitNum
=
ref
(
0.31
)
// 左右分割比例
...
@@ -118,7 +118,7 @@ const modalConfirm = () => {
...
@@ -118,7 +118,7 @@ const modalConfirm = () => {
}
}
if
(
value
===
queryParams
.
value
.
typecode
)
{
if
(
value
===
queryParams
.
value
.
typecode
)
{
getData
()
getData
()
}
else
{
}
else
{
getData
(
'class'
)
getData
(
'class'
)
}
}
})
})
...
@@ -143,7 +143,7 @@ const modalConfirm = () => {
...
@@ -143,7 +143,7 @@ const modalConfirm = () => {
// 分类查看
// 分类查看
const
classView
=
(
item
)
=>
{
const
classView
=
(
item
)
=>
{
if
(
queryParams
.
value
.
typecode
===
item
.
value
)
return
if
(
queryParams
.
value
.
typecode
===
item
.
value
)
return
queryParams
.
value
.
typecode
=
item
.
value
queryParams
.
value
.
typecode
=
item
.
value
queryParams
.
value
.
typename
=
item
.
text
queryParams
.
value
.
typename
=
item
.
text
getTableData
()
getTableData
()
...
@@ -159,6 +159,7 @@ const AddDomainConfirm = (item) => {
...
@@ -159,6 +159,7 @@ const AddDomainConfirm = (item) => {
console
.
log
(
'导入'
,
item
)
console
.
log
(
'导入'
,
item
)
getTableData
()
getTableData
()
}
}
modalPopData
.
type
=
''
modalPopData
.
show
=
false
modalPopData
.
show
=
false
}
}
...
@@ -172,7 +173,7 @@ const importClick = () => {
...
@@ -172,7 +173,7 @@ const importClick = () => {
// 获取分类名称
// 获取分类名称
const
getClassName
=
(
value
)
=>
{
const
getClassName
=
(
value
)
=>
{
const
item
=
classList
.
value
.
find
(
item
=>
item
.
value
===
value
)
const
item
=
classList
.
value
.
find
(
item
=>
item
.
value
===
value
)
return
item
?
item
.
text
:
''
return
item
?
item
.
text
:
''
}
}
// 获取列表数据
// 获取列表数据
...
@@ -183,7 +184,7 @@ const getData = (type) => {
...
@@ -183,7 +184,7 @@ const getData = (type) => {
if
(
classList
.
value
.
length
<=
0
)
return
if
(
classList
.
value
.
length
<=
0
)
return
if
(
type
===
'class'
)
{
if
(
type
===
'class'
)
{
getTableData
()
getTableData
()
}
else
{
}
else
{
queryParams
.
value
.
typecode
=
classList
.
value
[
0
].
value
queryParams
.
value
.
typecode
=
classList
.
value
[
0
].
value
queryParams
.
value
.
typename
=
classList
.
value
[
0
].
text
queryParams
.
value
.
typename
=
classList
.
value
[
0
].
text
getTableData
()
getTableData
()
...
@@ -200,6 +201,21 @@ const getTableData = () => {
...
@@ -200,6 +201,21 @@ const getTableData = () => {
})
})
}
}
// 导出excel
const
exportExcelFunc
=
()
=>
{
exportExcel
({
typecode
:
queryParams
.
value
.
typecode
}).
then
(
response
=>
{
const
{
data
}
=
response
;
const
blob
=
new
Blob
([
response
],
{
type
:
'application/vnd.ms-excel,charset=utf-8'
});
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
URL
.
createObjectURL
(
blob
)
link
.
download
=
`
${
queryParams
.
value
.
typename
}
知识库.xlsx`
link
.
click
()
URL
.
revokeObjectURL
(
link
.
href
)
ElMessage
.
success
(
'导出成功'
)
})
}
onMounted
(()
=>
{
onMounted
(()
=>
{
getData
()
getData
()
})
})
...
@@ -249,7 +265,7 @@ onMounted(() => {
...
@@ -249,7 +265,7 @@ onMounted(() => {
</el-form-item>
</el-form-item>
<div
style=
"display: flex;"
>
<div
style=
"display: flex;"
>
<el-button
icon=
"Upload"
type=
"primary"
@
click=
"importClick"
>
导入
</el-button>
<el-button
icon=
"Upload"
type=
"primary"
@
click=
"importClick"
>
导入
</el-button>
<el-button
icon=
"Download"
type=
"success"
>
导出
</el-button>
<el-button
icon=
"Download"
type=
"success"
@
click=
"exportExcelFunc"
>
导出
</el-button>
<el-button
icon=
"Plus"
type=
"primary"
@
click=
"addValueClick('add')"
>
新增值
</el-button>
<el-button
icon=
"Plus"
type=
"primary"
@
click=
"addValueClick('add')"
>
新增值
</el-button>
</div>
</div>
</div>
</div>
...
@@ -287,8 +303,8 @@ onMounted(() => {
...
@@ -287,8 +303,8 @@ onMounted(() => {
<
template
#
content
>
<
template
#
content
>
<AddClass
:itemData=
"addClassForm"
:type=
"modalPopData.operation"
@
cancel=
"modalPopCancel"
<AddClass
:itemData=
"addClassForm"
:type=
"modalPopData.operation"
@
cancel=
"modalPopCancel"
@
confirm=
"AddDomainConfirm"
v-if=
"modalPopData.type === 'class'"
/>
@
confirm=
"AddDomainConfirm"
v-if=
"modalPopData.type === 'class'"
/>
<AddValue
:itemData=
"addValueForm"
:type=
"modalPopData.operation"
:classDict=
"classList"
@
cancel=
"modalPopCancel"
<AddValue
:itemData=
"addValueForm"
:type=
"modalPopData.operation"
:classDict=
"classList"
@
confirm=
"AddDomainConfirm"
v-if=
"modalPopData.type === 'value'"
/>
@
c
ancel=
"modalPopCancel"
@
c
onfirm=
"AddDomainConfirm"
v-if=
"modalPopData.type === 'value'"
/>
<uploadModule
@
cancel=
"modalPopCancel"
@
confirm=
"AddDomainConfirm"
v-if=
"modalPopData.type === 'upload'"
/>
<uploadModule
@
cancel=
"modalPopCancel"
@
confirm=
"AddDomainConfirm"
v-if=
"modalPopData.type === 'upload'"
/>
</
template
>
</
template
>
</ModalPop>
</ModalPop>
...
...
src/views/ruleConfig/Dictionary/modules/UploadModule.vue
View file @
2f669943
<
script
setup
lang=
"ts"
name=
"AddClass"
>
<
script
setup
lang=
"ts"
name=
"AddClass"
>
import
{
ref
}
from
"vue"
;
import
{
ref
,
reactive
}
from
"vue"
;
import
CustomUpload
from
"@/components/CustomUpload/index.vue"
import
{
ElMessage
}
from
"element-plus"
;
import
CustomUpload
from
"@/components/CustomUpload/index.vue"
;
import
{
importfile
}
from
"@/api/ruleConfig/dictionary"
;
const
emit
=
defineEmits
([
"
update:modelValue"
,
"
cancel"
,
"confirm"
]);
const
emit
=
defineEmits
([
"cancel"
,
"confirm"
]);
const
radioValue
=
ref
(
1
);
const
uploadLoading
=
ref
(
false
);
const
fileList
=
ref
<
File
[]
>
([]);
const
uploadFile
=
ref
({});
const
smart
=
ref
(
1
)
// 取消
// 取消
const
cancel
=
()
=>
{
const
cancel
=
()
=>
{
...
@@ -14,32 +17,45 @@ const cancel = () => {
...
@@ -14,32 +17,45 @@ const cancel = () => {
// 确认
// 确认
const
confirm
=
()
=>
{
const
confirm
=
()
=>
{
console
.
log
(
fileList
.
value
);
// emit("confirm");
// emit("confirm");
if
(
!
uploadFile
.
value
.
name
)
{
ElMessage
.
error
(
"请先选择文件"
);
return
;
}
uploadLoading
.
value
=
true
;
const
formData
=
new
FormData
();
formData
.
append
(
'fileUpload'
,
uploadFile
.
value
.
raw
);
formData
.
append
(
'smart'
,
smart
.
value
.
toString
());
importfile
(
formData
).
then
((
res
)
=>
{
const
{
flag
}
=
res
;
if
(
flag
)
{
uploadLoading
.
value
=
false
;
ElMessage
.
success
(
'导入成功'
);
emit
(
"confirm"
);
}
});
};
};
const
handleUpload
=
(
file
:
File
)
=>
{
const
handleFileChange
=
(
file
)
=>
{
console
.
log
(
file
);
uploadFile
.
value
=
file
;
// 上传文件
// 处理上传结果
// 更新modelValue
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div>
<div>
<div
class=
"mb20"
>
<div
class=
"mb20"
>
<CustomUpload
v-model:file-list=
"fileList"
:limit=
"1"
:needType=
"false"
:needSize=
"false"
:listShow=
"false"
prompt=
'点击或拖拽文件到此处上传'
/>
<CustomUpload
:prompt=
'uploadFile ? uploadFile.name : ""'
:loading=
"uploadLoading"
@
file-change=
"handleFileChange"
/>
</div>
</div>
<el-form-item
label=
"上传方式"
label-width=
"200px"
>
<el-form-item
label=
"上传方式"
label-width=
"200px"
>
<el-radio-group
v-model=
"
radioValue
"
>
<el-radio-group
v-model=
"
smart
"
>
<el-radio
:label=
"1"
>
覆盖原数据
</el-radio>
<el-radio
:label=
"1"
>
覆盖原数据
</el-radio>
<el-radio
:label=
"
2
"
>
追加数据
</el-radio>
<el-radio
:label=
"
0
"
>
追加数据
</el-radio>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<div
class=
"btn"
>
<div
class=
"btn"
>
<el-button
type=
"info"
style=
"width: 150px;"
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"info"
style=
"width: 150px;"
@
click=
"cancel"
>
取消
</el-button>
<el-button
type=
"primary"
style=
"width: 150px;"
@
click=
"confirm"
>
确认
</el-button>
<el-button
type=
"primary"
:loading=
"uploadLoading"
style=
"width: 150px;"
@
click=
"confirm"
>
确认
</el-button>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论