Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
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
中汽测评-信息安全测评系统
web
Commits
da89a871
Commit
da89a871
authored
Aug 30, 2024
by
zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: (任务处理/待办任务/开始任务) 新增上传文件
parent
0218fcc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
108 additions
and
33 deletions
+108
-33
dialog.vue
...views/processing/unprocessed-review/components/dialog.vue
+108
-33
No files found.
src/views/processing/unprocessed-review/components/dialog.vue
View file @
da89a871
<
template
>
<
template
>
<el-dialog
<el-dialog
:visible
.
sync=
"dialogManger.dialogVisible"
:visible
.
sync=
"dialogManger.dialogVisible"
title=
"选择测试场景"
title=
"开始车型校验子任务"
width=
"80%"
width=
"40%"
class=
"start_mession_dialog"
append-to-body
append-to-body
destroy-on-close
destroy-on-close
:close-on-click-modal=
"false"
:close-on-click-modal=
"false"
...
@@ -11,27 +12,29 @@
...
@@ -11,27 +12,29 @@
<el-form
v-loading=
"loading"
>
<el-form
v-loading=
"loading"
>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<el-form-item
label=
"请选择测试场景(可多选)"
prop=
"testScenarioList"
>
<el-form-item
prop=
"testScenarioList"
>
<footer-button
<span
v-show=
"uploadVisble"
style=
"font-size: 15px;"
><span
style=
"color: red;"
>
*
</span>
请上传检测方案
</span>
style=
"width: 80px; height: 25px"
<span
v-show=
"!uploadVisble"
>
已上传文件:
{{
fileName
}}
</span>
type=
"primary"
<br>
@
click=
"selectAll"
<el-button
v-show=
"!uploadVisble"
type=
"primary"
size=
"default"
@
click=
"removeAll"
>
撤销上传文件
</el-button>
>
<el-upload
全部选择
ref=
"upload"
</footer-button>
class=
"upload-demo"
<div
class=
"test-scenario-container"
>
:action=
"uploadUrl"
<div
:limit=
"1"
v-for=
"(item, index) in testScenarioList"
:on-exceed=
"handleExceed"
:key=
"index"
v-model:file-list=
"fileList"
:class=
"
{
:on-success=
"uploadSucess"
'test-scenario': item.check === false,
:on-change=
"uploadChange"
'check-test-scenario': item.check === true
:on-error=
"handleError"
}"
accept=
".xls, .xlsx"
@click="handleTestScenario(item)"
:headers=
"headers"
:show-file-list=
"false"
>
>
<div>
{{
item
.
label
}}
</div>
<el-button
v-show=
"uploadVisble"
size=
"medium "
type=
"default"
style=
"font-size: 15px;padding: 15px 30px;font-weight: bold;"
>
上传文件
</el-button>
</div>
<div
v-show=
"uploadVisble"
slot=
"tip"
class=
"el-upload__tip"
style=
"font-size: 15px"
>
支持格式: .xls .xlsx,单个文件不能超过20MB
</div>
</div>
</el-upload>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
</el-row>
...
@@ -49,6 +52,8 @@ import {
...
@@ -49,6 +52,8 @@ import {
createProject
,
createProject
,
getUseCaseListByScenario
getUseCaseListByScenario
}
from
'@/api/task/task'
}
from
'@/api/task/task'
import
{
getToken
}
from
'@/utils/auth'
export
default
{
export
default
{
props
:
{
props
:
{
dialogManger
:
{
dialogManger
:
{
...
@@ -63,13 +68,22 @@ export default {
...
@@ -63,13 +68,22 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
uploadUrl
:
process
.
env
.
VUE_APP_BASE_API
+
'/task/uploadExcel'
,
//上传文件接口
headers
:
{
// 头文件
Authorization
:
'Bearer '
+
getToken
()
},
fileName
:
''
,
// 已上传文件名字
model
:
{
model
:
{
searchFields
:
{
searchFields
:
{
scenario
:
[]
scenario
:
[]
}
}
},
},
loading
:
false
,
loading
:
false
,
testScenarioList
:
[]
testScenarioList
:
[],
fileList
:
[],
// 文件集合
testCaseObj
:
[],
// 用例编号数组
uploadVisble
:
true
}
}
},
},
watch
:
{
watch
:
{
...
@@ -82,27 +96,85 @@ export default {
...
@@ -82,27 +96,85 @@ export default {
}
}
}
}
}
}
},
'fileList'
(
newValue
){
if
(
newValue
.
length
<
1
){
this
.
uploadVisble
=
true
}
else
{
this
.
uploadVisble
=
false
}
}
}
},
},
created
()
{},
methods
:
{
methods
:
{
handleClose
()
{
handleClose
()
{
this
.
$emit
(
'close'
,
'123'
)
this
.
$emit
(
'close'
,
'123'
)
},
},
async
handleSubmit
()
{
uploadSucess
(
response
,
file
,
fileList
){
// 当表中没有用例编号一列时清除所有文件,提示错误
this
.
loading
=
true
if
(
response
.
code
===
200
){
const
params
=
{
this
.
testCaseObj
=
response
.
data
id
:
this
.
dialogManger
.
item
.
id
this
.
fileName
=
file
.
name
}
else
{
this
.
$message
({
message
:
response
.
msg
,
type
:
'warning'
});
this
.
fileList
=
[]
this
.
$refs
.
upload
.
clearFiles
();
}
}
const
res
=
await
getUseCaseListByScenario
(
this
.
model
)
if
(
res
.
code
===
200
)
{
},
const
resp
=
await
this
.
newFileTest
({
uploadChange
(
response
,
file
,
fileList
){
/**
* 文件大小限制
*/
console
.
log
(
file
)
let
imgSize
=
Number
(
file
.
size
/
1024
/
1024
);
if
(
imgSize
>
20
)
{
this
.
$message
({
title
:
""
,
message
:
"文件大小不能超过20MB,请重新上传。"
,
type
:
"warning"
,
});
return
;
}
this
.
fileList
=
this
.
$refs
.
upload
.
uploadFiles
},
removeAll
(){
this
.
fileList
=
[]
this
.
$refs
.
upload
.
clearFiles
();
},
handleExceed
(
files
,
fileList
)
{
this
.
$message
.
warning
(
`当前限制选择 1 个文件,本次选择了
${
files
.
length
}
个文件,共选择了
${
files
.
length
+
fileList
.
length
}
个文件`
);
},
handleError
(
response
,
file
,
fileList
){
this
.
$message
.
error
(
'文件大小不能超过20MB'
);
},
async
handleSubmit
()
{
if
(
this
.
fileList
.
length
<
1
){
this
.
$message
({
message
:
'请导入一个文件'
,
type
:
'warning'
});
}
else
{
this
.
loading
=
true
if
(
this
.
testCaseObj
&&
this
.
testCaseList
!=
''
){
console
.
log
(
this
.
testCaseObuseCaseListj
)
const
resp
=
await
this
.
newFileTest
({
name
:
this
.
dialogManger
.
item
.
taskName
,
name
:
this
.
dialogManger
.
item
.
taskName
,
caseIdList
:
res
.
data
caseIdList
:
this
.
testCaseObj
.
useCaseList
})
})
const
params
=
{
id
:
this
.
dialogManger
.
item
.
id
}
params
.
testSchemeId
=
resp
.
data
params
.
testSchemeId
=
resp
.
data
this
.
startTaskModel
(
params
)
this
.
startTaskModel
(
params
)
}
//const res = await getUseCaseListByScenario(this.model)
}
}
},
},
/**
/**
* 开始
* 开始
...
@@ -163,7 +235,10 @@ export default {
...
@@ -163,7 +235,10 @@ export default {
this
.
model
.
searchFields
.
scenario
=
this
.
testScenarioList
.
map
(
obj
=>
{
this
.
model
.
searchFields
.
scenario
=
this
.
testScenarioList
.
map
(
obj
=>
{
return
obj
.
label
return
obj
.
label
})
})
}
},
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
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