Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
intelligent_station_web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
intelligent_station_web
Commits
4f1d3e31
Commit
4f1d3e31
authored
Aug 02, 2024
by
Gede1416
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
0d94e9c9
9d5d7681
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
20 deletions
+212
-20
resLabelInfo.js
src/api/resLabelInfo.js
+38
-1
index.vue
src/views/resLabelInfo/index.vue
+174
-19
No files found.
src/api/resLabelInfo.js
View file @
4f1d3e31
...
@@ -8,7 +8,10 @@ import Qs from 'qs'
...
@@ -8,7 +8,10 @@ import Qs from 'qs'
* 4. 修改
* 4. 修改
* 5. 逻辑删除
* 5. 逻辑删除
* 6. 导出
* 6. 导出
*
* 7、导入标签信息
* 8.下载错误文件
* -------------------------
* 9.下载用户导入模板
*/
*/
// 1. 查询标签信息列表
// 1. 查询标签信息列表
...
@@ -74,3 +77,37 @@ export function exportResLabelInfo(query) {
...
@@ -74,3 +77,37 @@ export function exportResLabelInfo(query) {
responseType
:
'blob'
responseType
:
'blob'
})
})
}
}
// 7、导入标签信息
export
function
importExcel
(
data
)
{
return
request
({
url
:
'/reslabelinfo/importExcel'
,
method
:
'post'
,
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
transformRequest
:
[(
data
)
=>
{
return
data
}],
data
})
}
// 8.下载错误文件
export
function
uploadFalseFile
(
params
)
{
params
=
Qs
.
stringify
(
params
)
return
request
({
url
:
'/reslabelinfo/downFalseFile'
,
method
:
'post'
,
data
:
params
,
responseType
:
'blob'
})
}
// 9.下载用户导入模板
export
function
importTemplate
(
params
)
{
return
request
({
url
:
'/reslabelinfo/importTemplate'
,
method
:
'get'
,
responseType
:
'blob'
,
params
})
}
src/views/resLabelInfo/index.vue
View file @
4f1d3e31
...
@@ -58,6 +58,15 @@
...
@@ -58,6 +58,15 @@
:size=
"commonField.smallSize"
:size=
"commonField.smallSize"
@
click=
"handleAdd"
@
click=
"handleAdd"
>
新增
</el-button>
>
新增
</el-button>
<!-- //导入按钮-->
<el-button
v-hasPermi=
"hasImportPerm"
:class=
"commonField.importClass"
:type=
"commonField.typeWarning"
:icon=
"commonField.importIcon"
:size=
"commonField.smallSize"
@
click=
"handleImport"
>
{{
commonField
.
importName
}}
</el-button>
<el-button
<el-button
:class=
"commonField.exportClass"
:class=
"commonField.exportClass"
:type=
"commonField.typePrimary"
:type=
"commonField.typePrimary"
...
@@ -78,12 +87,12 @@
...
@@ -78,12 +87,12 @@
{{
scope
.
row
.
labelName
||
'-'
}}
{{
scope
.
row
.
labelName
||
'-'
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"标签分类"
prop=
"labelType"
:show-overflow-tooltip=
"true"
>
<el-table-column
width=
"120"
label=
"标签分类"
prop=
"labelType"
:show-overflow-tooltip=
"true"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
labelTypeName
||
'-'
}}
{{
scope
.
row
.
labelTypeName
||
'-'
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"权重"
prop=
"weight"
:show-overflow-tooltip=
"true"
>
<el-table-column
width=
"120"
label=
"权重"
prop=
"weight"
:show-overflow-tooltip=
"true"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
weight
||
'-'
}}
{{
scope
.
row
.
weight
||
'-'
}}
</
template
>
</
template
>
...
@@ -104,12 +113,12 @@
...
@@ -104,12 +113,12 @@
{{
scope
.
row
.
remarks
||
'-'
}}
{{
scope
.
row
.
remarks
||
'-'
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"创建时间"
prop=
"createDate"
:show-overflow-tooltip=
"true"
>
<el-table-column
label=
"创建时间"
width=
"160"
prop=
"createDate"
:show-overflow-tooltip=
"true"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
createDate
|
transformDateByFormat
(
'YYYY-MM-DD HH:mm'
)
}}
</span>
<span>
{{
scope
.
row
.
createDate
|
transformDateByFormat
(
'YYYY-MM-DD HH:mm'
)
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
class-name=
"small-padding fixed-width"
width=
"
20
0px"
>
<el-table-column
label=
"操作"
class-name=
"small-padding fixed-width"
width=
"
14
0px"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-button
<el-button
:class=
"commonField.updateClass"
:class=
"commonField.updateClass"
...
@@ -138,11 +147,11 @@
...
@@ -138,11 +147,11 @@
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"500px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
size=
"small"
label-width=
"90px"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
size=
"small"
label-width=
"90px"
>
<el-form-item
label=
"标签名称"
prop=
"labelName"
>
<el-form-item
label=
"标签名称"
prop=
"labelName"
>
<el-input
v-model
.
trim=
"form.labelName"
show-word-limit
:maxlength=
"
255
"
placeholder=
"请输入标签名称"
/>
<el-input
v-model
.
trim=
"form.labelName"
show-word-limit
:maxlength=
"
50
"
placeholder=
"请输入标签名称"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"标签分类"
>
<el-form-item
label=
"标签分类"
prop=
"labelType"
>
<el-radio-group
v-model=
"form.labelType"
>
<el-radio-group
v-model=
"form.labelType"
>
<el-radio
label=
"1"
>
模板
</el-radio>
<el-radio
label=
"1"
:checked=
"form.labelType === '1'"
>
模板
</el-radio>
<el-radio
label=
"2"
>
镜像
</el-radio>
<el-radio
label=
"2"
>
镜像
</el-radio>
<el-radio
label=
"3"
>
数据集
</el-radio>
<el-radio
label=
"3"
>
数据集
</el-radio>
</el-radio-group>
</el-radio-group>
...
@@ -165,6 +174,40 @@
...
@@ -165,6 +174,40 @@
<el-button
class=
"submitBtn"
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
class=
"submitBtn"
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
<!-- 标签导入对话框 -->
<el-dialog
:title=
"upload.title"
:visible
.
sync=
"upload.open"
width=
"400px"
append-to-body
>
<el-upload
accept=
".xlsx, .xls"
:headers=
"upload.headers"
:action=
"upload.url + '?updateSupport=' + upload.updateSupport"
:disabled=
"upload.isUploading"
:on-progress=
"handleFileUploadProgress"
:on-success=
"handleFileSuccess"
:auto-upload=
"false"
:on-change=
"employeeUpload"
:on-remove=
"handleRemove"
:before-remove=
"beforeRemove"
:on-preview=
"handlePreview"
:before-upload=
"beforeAvatarUpload"
:file-list=
"fileList"
drag
>
<i
class=
"el-icon-upload"
/>
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
<el-checkbox
v-model=
"upload.updateSupport"
/>
是否更新已经存在的标签数据
<el-link
type=
"info"
style=
"font-size:12px"
@
click=
"importTemplate"
>
下载模板
</el-link>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
style=
"color:red"
>
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
</el-upload>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
class=
"cancelBtn"
@
click=
"upload.open = false"
>
取 消
</el-button>
<el-button
class=
"submitBtn"
:loading=
"importLoading"
type=
"primary"
@
click=
"submitFileForm"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
</template>
...
@@ -175,15 +218,15 @@ import {
...
@@ -175,15 +218,15 @@ import {
delResLabelInfo
,
delResLabelInfo
,
addResLabelInfo
,
addResLabelInfo
,
updateResLabelInfo
,
updateResLabelInfo
,
exportResLabelInfo
}
from
'@/api/resLabelInfo'
exportResLabelInfo
,
import
{
importExcel
,
selectDictType
uploadFalseFile
,
}
from
'@/api/system/dict/type
'
importTemplate
}
from
'@/api/resLabelInfo
'
import
{
getDataCache
,
setDataCache
}
from
'@/assets/js/filterData'
import
{
getDataCache
,
setDataCache
}
from
'@/assets/js/filterData'
import
commonField
from
'@/utils/commonField'
import
commonField
from
'@/utils/commonField'
import
{
getToken
}
from
'@/utils/auth'
export
default
{
export
default
{
name
:
'ResLabelInfo'
,
name
:
'ResLabelInfo'
,
dicts
:
[
'res_label_type'
],
data
()
{
data
()
{
return
{
return
{
// 遮罩层
// 遮罩层
...
@@ -221,6 +264,21 @@ export default {
...
@@ -221,6 +264,21 @@ export default {
dictValue
:
'3'
dictValue
:
'3'
}
}
],
],
// 用户导入参数
upload
:
{
// 是否显示弹出层(用户导入)
open
:
false
,
// 弹出层标题(用户导入)
title
:
''
,
// 是否禁用上传
isUploading
:
false
,
// 是否更新已经存在的用户数据
updateSupport
:
0
,
// 设置上传的请求头部
headers
:
{
Authorization
:
'Bearer '
+
getToken
()
},
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
'/resLabeLInfo/importExcel'
},
// 查询参数
// 查询参数
queryParams
:
{
queryParams
:
{
page
:
1
,
page
:
1
,
...
@@ -232,7 +290,6 @@ export default {
...
@@ -232,7 +290,6 @@ export default {
},
},
// 表单参数
// 表单参数
form
:
{},
form
:
{},
dictList
:
[],
// 表单校验
// 表单校验
rules
:
{
rules
:
{
labelName
:
[
labelName
:
[
...
@@ -268,16 +325,13 @@ export default {
...
@@ -268,16 +325,13 @@ export default {
/** 查询标签信息列表 */
/** 查询标签信息列表 */
getList
()
{
getList
()
{
this
.
loading
=
true
this
.
loading
=
true
selectDictType
(
'res_label_type'
).
then
(
response
=>
{
this
.
dictList
=
response
.
data
})
listResLabelInfo
(
this
.
queryParams
).
then
(
listResLabelInfo
(
this
.
queryParams
).
then
(
response
=>
{
response
=>
{
this
.
resLabelInfoList
=
response
.
rows
this
.
resLabelInfoList
=
response
.
rows
this
.
total
=
response
.
total
this
.
total
=
response
.
total
this
.
loading
=
false
this
.
loading
=
false
this
.
resLabelInfoList
.
forEach
(
item
=>
{
this
.
resLabelInfoList
.
forEach
(
item
=>
{
item
.
labelTypeName
=
this
.
dictList
.
find
(
item1
=>
item1
.
dictValue
===
item
.
labelType
).
dictLabel
item
.
labelTypeName
=
this
.
sortOptions
.
find
(
item1
=>
item1
.
dictValue
===
item
.
labelType
).
dictLabel
})
})
}
}
)
)
...
@@ -293,7 +347,7 @@ export default {
...
@@ -293,7 +347,7 @@ export default {
businessId
:
undefined
,
businessId
:
undefined
,
remarks
:
undefined
,
remarks
:
undefined
,
labelName
:
undefined
,
labelName
:
undefined
,
labelType
:
undefined
,
labelType
:
'1'
,
weight
:
undefined
,
weight
:
undefined
,
flag
:
'1'
flag
:
'1'
}
}
...
@@ -401,13 +455,114 @@ export default {
...
@@ -401,13 +455,114 @@ export default {
const
downloadElement
=
document
.
createElement
(
'a'
)
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
href
=
href
downloadElement
.
download
=
'标签
信息
信息'
+
'.xls'
// 下载后文件名
downloadElement
.
download
=
'标签
管理
信息'
+
'.xls'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
})
})
})
})
},
/** 导入按钮操作 */
handleImport
()
{
this
.
upload
.
title
=
'标签导入'
this
.
upload
.
open
=
true
},
/** 下载模板操作 */
importTemplate
()
{
// eslint-disable-next-line no-undef
importTemplate
().
then
(
response
=>
{
const
blob
=
new
Blob
([
response
])
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
download
=
'标签导入模板'
+
'.xls'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
// this.download(response.msg);
})
},
// 文件上传中处理
handleFileUploadProgress
(
event
,
file
,
fileList
)
{
this
.
upload
.
isUploading
=
true
},
// 文件上传成功处理
handleFileSuccess
(
response
,
file
,
fileList
)
{
this
.
upload
.
open
=
false
this
.
upload
.
isUploading
=
false
this
.
$refs
.
upload
.
clearFiles
()
this
.
$alert
(
response
.
msg
,
'导入结果'
,
{
dangerouslyUseHTMLString
:
true
})
this
.
getList
()
},
// 提交上传文件
submitFileForm
()
{
// this.$refs.upload.submit()
this
.
importLoading
=
true
if
(
this
.
fileList
.
length
===
0
)
{
this
.
$message
.
warning
(
'请上传文件'
)
// 导入成功后关闭弹出框
this
.
importLoading
=
false
this
.
upload
.
open
=
true
}
else
{
// 根据后台需求数据格式
var
formData
=
new
FormData
()
// 当前为空
formData
.
append
(
'file'
,
this
.
fileList
)
importExcel
(
formData
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
if
(
res
.
data
.
filename
===
null
)
{
this
.
$message
.
success
(
'导入成功'
)
this
.
fileList
=
[]
// 导入成功后关闭弹出框
this
.
importLoading
=
false
this
.
upload
.
open
=
false
// 导入成功后刷新页面
this
.
getList
()
}
else
{
uploadFalseFile
({
fileName
:
res
.
data
.
filename
}).
then
(
res
=>
{
const
blob
=
new
Blob
([
res
])
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
download
=
'模板错误提示'
+
'.txt'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
this
.
importLoading
=
false
})
}
this
.
importLoading
=
false
}
else
if
(
res
.
code
===
41020
)
{
this
.
$message
.
info
(
'上传超时,请重新上传'
)
this
.
importLoading
=
false
}
else
{
this
.
$message
.
error
(
res
.
message
)
this
.
importLoading
=
false
}
}).
catch
(
err
=>
{
this
.
$message
.
success
(
err
.
message
)
this
.
importLoading
=
false
})
}
},
/** 导入change*/
employeeUpload
(
file
,
fileList
)
{
if
(
fileList
.
length
>
1
)
{
fileList
.
splice
(
0
,
1
)
}
this
.
fileList
=
fileList
[
0
].
raw
},
/** 导入remove操作*/
handleRemove
(
file
,
fileList
)
{
this
.
fileList
=
[]
},
/** 导入beforeRemove操作*/
beforeRemove
(
file
,
fileList
)
{
this
.
fileList
=
[]
},
/* 上传文件所需求 */
handlePreview
(
file
)
{
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment