Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
e33e92c6
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e33e92c6
编写于
10月 26, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(消息通知): 拆分组件
上级
acdca004
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
955 addition
and
589 deletion
+955
-589
frontend/src/business/components/settings/organization/TaskNotification.vue
...ess/components/settings/organization/TaskNotification.vue
+24
-589
frontend/src/business/components/settings/organization/components/DefectTaskNotification.vue
...ttings/organization/components/DefectTaskNotification.vue
+220
-0
frontend/src/business/components/settings/organization/components/JenkinsNotification.vue
.../settings/organization/components/JenkinsNotification.vue
+221
-0
frontend/src/business/components/settings/organization/components/TestPlanTaskNotification.vue
...ings/organization/components/TestPlanTaskNotification.vue
+242
-0
frontend/src/business/components/settings/organization/components/TestReviewNotification.vue
...ttings/organization/components/TestReviewNotification.vue
+248
-0
未找到文件。
frontend/src/business/components/settings/organization/TaskNotification.vue
浏览文件 @
e33e92c6
此差异已折叠。
点击以展开。
frontend/src/business/components/settings/organization/components/DefectTaskNotification.vue
0 → 100644
浏览文件 @
e33e92c6
<
template
>
<div>
<el-row>
<el-col
:span=
"10"
>
<h3>
{{
$t
(
'
organization.message.defect_task_notification
'
)
}}
</h3>
<el-button
icon=
"el-icon-circle-plus-outline"
plain
size=
"mini"
@
click=
"handleAddTaskModel('defectTask')"
>
{{
$t
(
'
organization.message.create_new_notification
'
)
}}
</el-button>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"24"
>
<el-table
:data=
"form.defectTask"
class=
"tb-edit"
border
size=
"mini"
:cell-style=
"rowClass"
:header-cell-style=
"headClass"
>
<el-table-column
:label=
"$t('schedule.event')"
min-width=
"20%"
prop=
"events"
>
<template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.event"
:placeholder=
"$t('organization.message.select_events')"
prop=
"event"
:disabled=
"!scope.row.isSet"
>
<el-option
v-for=
"item in defectEventOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiver')"
prop=
"receiver"
min-width=
"20%"
>
<
template
v-slot:default=
"{row}"
>
<el-select
v-model=
"row.userIds"
filterable
multiple
:placeholder=
"$t('commons.please_select')"
style=
"width: 100%;"
:disabled=
"!row.isSet"
>
<el-option
v-for=
"item in defectReceiverOptions"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiving_mode')"
min-width=
"20%"
prop=
"type"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.type"
:placeholder=
"$t('organization.message.select_receiving_method')"
:disabled=
"!scope.row.isSet"
@
change=
"handleEdit(scope.$index, scope.row)"
>
<el-option
v-for=
"item in receiveTypeOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"webhook"
min-width=
"20%"
prop=
"webhook"
>
<
template
v-slot:default=
"scope"
>
<el-input
v-model=
"scope.row.webhook"
placeholder=
"webhook地址"
:disabled=
"!scope.row.isSet||!scope.row.isReadOnly"
></el-input>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('commons.operating')"
min-width=
"20%"
prop=
"result"
>
<
template
v-slot:default=
"scope"
>
<el-button
type=
"primary"
size=
"mini"
v-show=
"scope.row.isSet"
@
click=
"handleAddTask(scope.$index,scope.row)"
>
{{
$t
(
'
commons.add
'
)
}}
</el-button>
<el-button
size=
"mini"
v-show=
"scope.row.isSet"
@
click.native.prevent=
"removeRowTask(scope.$index,form.defectTask)"
>
{{
$t
(
'
commons.cancel
'
)
}}
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
v-show=
"!scope.row.isSet"
@
click=
"deleteRowTask(scope.$index,scope.row)"
></el-button>
</
template
>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</template>
<
script
>
export
default
{
name
:
"
DefectTaskNotification
"
,
props
:
{
defectReceiverOptions
:
{
type
:
Array
}
},
data
()
{
return
{
form
:
{
defectTask
:
[{
taskType
:
"
defectTask
"
,
event
:
""
,
userIds
:
[],
type
:
[],
webhook
:
""
,
isSet
:
true
,
identification
:
""
,
isReadOnly
:
false
,
}],
},
defectEventOptions
:
[
{
value
:
'
CREATE
'
,
label
:
this
.
$t
(
'
commons.create
'
)},
],
receiveTypeOptions
:
[
{
value
:
'
EMAIL
'
,
label
:
this
.
$t
(
'
organization.message.mail
'
)},
{
value
:
'
NAIL_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.nail_robot
'
)},
{
value
:
'
WECHAT_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.enterprise_wechat_robot
'
)}
],
};
},
activated
()
{
this
.
initForm
()
},
methods
:
{
initForm
()
{
this
.
result
=
this
.
$get
(
'
/notice/search/message
'
,
response
=>
{
this
.
form
.
defectTask
=
response
.
data
.
defectTask
;
})
},
handleEdit
(
index
,
data
)
{
data
.
isReadOnly
=
true
;
if
(
data
.
type
===
'
EMAIL
'
)
{
data
.
isReadOnly
=
!
data
.
isReadOnly
}
},
handleAddTaskModel
(
type
)
{
let
Task
=
{};
Task
.
event
=
[];
Task
.
userIds
=
[];
Task
.
type
=
""
;
Task
.
webhook
=
""
;
Task
.
isSet
=
true
;
Task
.
identification
=
""
;
if
(
type
===
'
jenkinsTask
'
)
{
Task
.
taskType
=
'
JENKINS_TASK
'
this
.
form
.
jenkinsTask
.
push
(
Task
)
}
if
(
type
===
'
testPlanTask
'
)
{
Task
.
taskType
=
'
TEST_PLAN_TASK
'
this
.
form
.
testCasePlanTask
.
push
(
Task
)
}
if
(
type
===
'
reviewTask
'
)
{
Task
.
taskType
=
'
REVIEW_TASK
'
this
.
form
.
reviewTask
.
push
(
Task
)
}
if
(
type
===
'
defectTask
'
)
{
Task
.
taskType
=
'
DEFECT_TASK
'
this
.
form
.
defectTask
.
push
(
Task
)
}
},
handleAddTask
(
index
,
data
)
{
if
(
data
.
event
&&
data
.
userIds
.
length
>
0
&&
data
.
type
)
{
console
.
log
(
data
.
type
)
if
(
data
.
type
===
'
NAIL_ROBOT
'
||
data
.
type
===
'
WECHAT_ROBOT
'
)
{
if
(
!
data
.
webhook
)
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message_webhook
'
));
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message
'
));
}
},
addTask
(
data
)
{
let
list
=
[]
data
.
isSet
=
false
list
.
push
(
data
)
let
param
=
{};
param
.
messageDetail
=
list
this
.
result
=
this
.
$post
(
"
/notice/save/message/task
"
,
param
,
()
=>
{
this
.
initForm
()
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
})
},
removeRowTask
(
index
,
data
)
{
//移除
data
.
splice
(
index
,
1
)
},
deleteRowTask
(
index
,
data
)
{
//删除
this
.
result
=
this
.
$get
(
"
/notice/delete/message/
"
+
data
.
identification
,
response
=>
{
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
initForm
()
})
},
rowClass
()
{
return
"
text-align:center
"
},
headClass
()
{
return
"
text-align:center;background:'#ededed'
"
}
}
}
</
script
>
<
style
scoped
>
.el-row
{
margin-bottom
:
10px
;
}
</
style
>
frontend/src/business/components/settings/organization/components/JenkinsNotification.vue
0 → 100644
浏览文件 @
e33e92c6
<
template
>
<div>
<el-row>
<el-col
:span=
"10"
>
<h3>
{{
$t
(
'
organization.message.jenkins_task_notification
'
)
}}
</h3>
<el-button
icon=
"el-icon-circle-plus-outline"
plain
size=
"mini"
@
click=
"handleAddTaskModel('jenkinsTask')"
>
{{
$t
(
'
organization.message.create_new_notification
'
)
}}
</el-button>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"24"
>
<el-table
:data=
"form.jenkinsTask"
class=
"tb-edit"
border
size=
"mini"
:cell-style=
"rowClass"
:header-cell-style=
"headClass"
>
<el-table-column
:label=
"$t('schedule.event')"
min-width=
"20%"
prop=
"events"
>
<template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.event"
:placeholder=
"$t('organization.message.select_events')"
prop=
"events"
:disabled=
"!scope.row.isSet"
>
<el-option
v-for=
"item in jenkinsEventOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiver')"
prop=
"userIds"
min-width=
"20%"
>
<
template
v-slot:default=
"{row}"
>
<el-select
v-model=
"row.userIds"
filterable
multiple
:placeholder=
"$t('commons.please_select')"
style=
"width: 100%;"
:disabled=
"!row.isSet"
>
<el-option
v-for=
"item in jenkinsReceiverOptions"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiving_mode')"
min-width=
"20%"
prop=
"type"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.type"
:placeholder=
"$t('organization.message.select_receiving_method')"
:disabled=
"!scope.row.isSet"
@
change=
"handleEdit(scope.$index, scope.row)"
>
<el-option
v-for=
"item in receiveTypeOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"webhook"
min-width=
"20%"
prop=
"webhook"
>
<
template
v-slot:default=
"scope"
>
<el-input
v-model=
"scope.row.webhook"
placeholder=
"webhook地址"
:disabled=
"!scope.row.isSet||!scope.row.isReadOnly"
></el-input>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('commons.operating')"
min-width=
"20%"
prop=
"result"
>
<
template
v-slot:default=
"scope"
>
<el-button
type=
"primary"
size=
"mini"
v-show=
"scope.row.isSet"
@
click=
"handleAddTask(scope.$index,scope.row)"
>
{{
$t
(
'
commons.add
'
)
}}
</el-button>
<el-button
size=
"mini"
v-show=
"scope.row.isSet"
@
click.native.prevent=
"removeRowTask(scope.$index,form.jenkinsTask)"
>
{{
$t
(
'
commons.cancel
'
)
}}
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
v-show=
"!scope.row.isSet"
@
click.native.prevent=
"deleteRowTask(scope.$index,scope.row)"
></el-button>
</
template
>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</template>
<
script
>
export
default
{
name
:
"
JenkinsNotification
"
,
props
:
{
jenkinsReceiverOptions
:
{
type
:
Array
}
},
data
()
{
return
{
form
:
{
jenkinsTask
:
[{
taskType
:
"
jenkinsTask
"
,
event
:
""
,
userIds
:
[],
type
:
[],
webhook
:
""
,
isSet
:
true
,
identification
:
""
,
isReadOnly
:
false
,
}],
},
jenkinsEventOptions
:
[
{
value
:
'
EXECUTE_SUCCESSFUL
'
,
label
:
this
.
$t
(
'
schedule.event_success
'
)},
{
value
:
'
EXECUTE_FAILED
'
,
label
:
this
.
$t
(
'
schedule.event_failed
'
)}
],
receiveTypeOptions
:
[
{
value
:
'
EMAIL
'
,
label
:
this
.
$t
(
'
organization.message.mail
'
)},
{
value
:
'
NAIL_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.nail_robot
'
)},
{
value
:
'
WECHAT_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.enterprise_wechat_robot
'
)}
],
}
},
activated
()
{
this
.
initForm
();
},
methods
:
{
initForm
()
{
this
.
result
=
this
.
$get
(
'
/notice/search/message
'
,
response
=>
{
this
.
form
.
jenkinsTask
=
response
.
data
.
jenkinsTask
;
})
},
handleEdit
(
index
,
data
)
{
data
.
isReadOnly
=
true
;
if
(
data
.
type
===
'
EMAIL
'
)
{
data
.
isReadOnly
=
!
data
.
isReadOnly
}
},
handleAddTaskModel
(
type
)
{
let
Task
=
{};
Task
.
event
=
[];
Task
.
userIds
=
[];
Task
.
type
=
""
;
Task
.
webhook
=
""
;
Task
.
isSet
=
true
;
Task
.
identification
=
""
;
if
(
type
===
'
jenkinsTask
'
)
{
Task
.
taskType
=
'
JENKINS_TASK
'
this
.
form
.
jenkinsTask
.
push
(
Task
)
}
if
(
type
===
'
testPlanTask
'
)
{
Task
.
taskType
=
'
TEST_PLAN_TASK
'
this
.
form
.
testCasePlanTask
.
push
(
Task
)
}
if
(
type
===
'
reviewTask
'
)
{
Task
.
taskType
=
'
REVIEW_TASK
'
this
.
form
.
reviewTask
.
push
(
Task
)
}
if
(
type
===
'
defectTask
'
)
{
Task
.
taskType
=
'
DEFECT_TASK
'
this
.
form
.
defectTask
.
push
(
Task
)
}
},
handleAddTask
(
index
,
data
)
{
if
(
data
.
event
&&
data
.
userIds
.
length
>
0
&&
data
.
type
)
{
console
.
log
(
data
.
type
)
if
(
data
.
type
===
'
NAIL_ROBOT
'
||
data
.
type
===
'
WECHAT_ROBOT
'
)
{
if
(
!
data
.
webhook
)
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message_webhook
'
));
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message
'
));
}
},
addTask
(
data
)
{
let
list
=
[]
data
.
isSet
=
false
list
.
push
(
data
)
let
param
=
{};
param
.
messageDetail
=
list
this
.
result
=
this
.
$post
(
"
/notice/save/message/task
"
,
param
,
()
=>
{
this
.
initForm
()
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
})
},
removeRowTask
(
index
,
data
)
{
//移除
data
.
splice
(
index
,
1
)
},
deleteRowTask
(
index
,
data
)
{
//删除
this
.
result
=
this
.
$get
(
"
/notice/delete/message/
"
+
data
.
identification
,
response
=>
{
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
initForm
()
})
},
rowClass
()
{
return
"
text-align:center
"
},
headClass
()
{
return
"
text-align:center;background:'#ededed'
"
},
}
}
</
script
>
<
style
scoped
>
.el-row
{
margin-bottom
:
10px
;
}
</
style
>
frontend/src/business/components/settings/organization/components/TestPlanTaskNotification.vue
0 → 100644
浏览文件 @
e33e92c6
<
template
>
<div>
<el-row>
<el-col
:span=
"10"
>
<h3>
{{
$t
(
'
organization.message.test_plan_task_notification
'
)
}}
</h3>
<el-button
icon=
"el-icon-circle-plus-outline"
plain
size=
"mini"
@
click=
"handleAddTaskModel('testPlanTask')"
>
{{
$t
(
'
organization.message.create_new_notification
'
)
}}
</el-button>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"24"
>
<el-table
:data=
"form.testCasePlanTask"
class=
"tb-edit"
border
size=
"mini"
:cell-style=
"rowClass"
:header-cell-style=
"headClass"
>
<el-table-column
:label=
"$t('schedule.event')"
min-width=
"20%"
prop=
"events"
>
<template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.event"
:placeholder=
"$t('organization.message.select_events')"
@
change=
"handleTestPlanReceivers(scope.row)"
prop=
"events"
:disabled=
"!scope.row.isSet"
>
<el-option
v-for=
"item in otherEventOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiver')"
prop=
"userIds"
min-width=
"20%"
>
<
template
v-slot:default=
"{row}"
>
<el-select
v-model=
"row.userIds"
filterable
multiple
:placeholder=
"$t('commons.please_select')"
style=
"width: 100%;"
:disabled=
"!row.isSet"
>
<el-option
v-for=
"item in row.testPlanReceiverOptions"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiving_mode')"
min-width=
"20%"
prop=
"type"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.type"
:placeholder=
"$t('organization.message.select_receiving_method')"
:disabled=
"!scope.row.isSet"
@
change=
"handleEdit(scope.$index, scope.row)"
>
<el-option
v-for=
"item in receiveTypeOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"webhook"
min-width=
"20%"
prop=
"webhook"
>
<
template
v-slot:default=
"scope"
>
<el-input
v-model=
"scope.row.webhook"
placeholder=
"webhook地址"
:disabled=
"!scope.row.isSet||!scope.row.isReadOnly"
></el-input>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('commons.operating')"
min-width=
"20%"
prop=
"result"
>
<
template
v-slot:default=
"scope"
>
<el-button
type=
"primary"
size=
"mini"
v-show=
"scope.row.isSet"
@
click=
"handleAddTask(scope.$index,scope.row)"
>
{{
$t
(
'
commons.add
'
)
}}
</el-button>
<el-button
size=
"mini"
v-show=
"scope.row.isSet"
@
click.native.prevent=
"removeRowTask(scope.$index,form.testCasePlanTask)"
>
{{
$t
(
'
commons.cancel
'
)
}}
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
v-show=
"!scope.row.isSet"
@
click.native.prevent=
"deleteRowTask(scope.$index,scope.row)"
></el-button>
</
template
>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</template>
<
script
>
export
default
{
name
:
"
TestPlanTaskNotification
"
,
props
:
{
testPlanReceiverOptions
:
{
type
:
Array
}
},
data
()
{
return
{
form
:
{
testCasePlanTask
:
[{
taskType
:
"
testPlanTask
"
,
event
:
""
,
userIds
:
[],
type
:
[],
webhook
:
""
,
isSet
:
true
,
identification
:
""
,
isReadOnly
:
false
,
}],
},
otherEventOptions
:
[
{
value
:
'
CREATE
'
,
label
:
this
.
$t
(
'
commons.create
'
)},
{
value
:
'
UPDATE
'
,
label
:
this
.
$t
(
'
commons.update
'
)},
{
value
:
'
DELETE
'
,
label
:
this
.
$t
(
'
commons.delete
'
)}
],
receiveTypeOptions
:
[
{
value
:
'
EMAIL
'
,
label
:
this
.
$t
(
'
organization.message.mail
'
)},
{
value
:
'
NAIL_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.nail_robot
'
)},
{
value
:
'
WECHAT_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.enterprise_wechat_robot
'
)}
],
};
},
activated
()
{
this
.
initForm
()
},
methods
:
{
initForm
()
{
this
.
result
=
this
.
$get
(
'
/notice/search/message
'
,
response
=>
{
this
.
form
.
testCasePlanTask
=
response
.
data
.
testCasePlanTask
;
this
.
form
.
testCasePlanTask
.
forEach
(
planTask
=>
{
this
.
handleTestPlanReceivers
(
planTask
);
});
})
},
handleEdit
(
index
,
data
)
{
data
.
isReadOnly
=
true
;
if
(
data
.
type
===
'
EMAIL
'
)
{
data
.
isReadOnly
=
!
data
.
isReadOnly
}
},
handleAddTaskModel
(
type
)
{
let
Task
=
{};
Task
.
event
=
[];
Task
.
userIds
=
[];
Task
.
type
=
""
;
Task
.
webhook
=
""
;
Task
.
isSet
=
true
;
Task
.
identification
=
""
;
if
(
type
===
'
jenkinsTask
'
)
{
Task
.
taskType
=
'
JENKINS_TASK
'
this
.
form
.
jenkinsTask
.
push
(
Task
)
}
if
(
type
===
'
testPlanTask
'
)
{
Task
.
taskType
=
'
TEST_PLAN_TASK
'
this
.
form
.
testCasePlanTask
.
push
(
Task
)
}
if
(
type
===
'
reviewTask
'
)
{
Task
.
taskType
=
'
REVIEW_TASK
'
this
.
form
.
reviewTask
.
push
(
Task
)
}
if
(
type
===
'
defectTask
'
)
{
Task
.
taskType
=
'
DEFECT_TASK
'
this
.
form
.
defectTask
.
push
(
Task
)
}
},
handleAddTask
(
index
,
data
)
{
if
(
data
.
event
&&
data
.
userIds
.
length
>
0
&&
data
.
type
)
{
console
.
log
(
data
.
type
)
if
(
data
.
type
===
'
NAIL_ROBOT
'
||
data
.
type
===
'
WECHAT_ROBOT
'
)
{
if
(
!
data
.
webhook
)
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message_webhook
'
));
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message
'
));
}
},
addTask
(
data
)
{
let
list
=
[]
data
.
isSet
=
false
list
.
push
(
data
)
let
param
=
{};
param
.
messageDetail
=
list
this
.
result
=
this
.
$post
(
"
/notice/save/message/task
"
,
param
,
()
=>
{
this
.
initForm
()
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
})
},
removeRowTask
(
index
,
data
)
{
//移除
data
.
splice
(
index
,
1
)
},
deleteRowTask
(
index
,
data
)
{
//删除
this
.
result
=
this
.
$get
(
"
/notice/delete/message/
"
+
data
.
identification
,
response
=>
{
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
initForm
()
})
},
rowClass
()
{
return
"
text-align:center
"
},
headClass
()
{
return
"
text-align:center;background:'#ededed'
"
},
handleTestPlanReceivers
(
row
)
{
let
testPlanReceivers
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
testPlanReceiverOptions
));
switch
(
row
.
event
)
{
case
"
CREATE
"
:
testPlanReceivers
.
unshift
({
id
:
'
EXECUTOR
'
,
name
:
this
.
$t
(
'
test_track.plan_view.executor
'
)})
break
;
case
"
UPDATE
"
:
case
"
DELETE
"
:
case
"
COMMENT
"
:
testPlanReceivers
.
unshift
({
id
:
'
FOUNDER
'
,
name
:
this
.
$t
(
'
api_test.creator
'
)});
break
;
default
:
break
;
}
row
.
testPlanReceiverOptions
=
testPlanReceivers
;
},
}
}
</
script
>
<
style
scoped
>
.el-row
{
margin-bottom
:
10px
;
}
</
style
>
frontend/src/business/components/settings/organization/components/TestReviewNotification.vue
0 → 100644
浏览文件 @
e33e92c6
<
template
>
<div>
<el-row>
<el-col
:span=
"10"
>
<h3>
{{
$t
(
'
organization.message.test_review_task_notice
'
)
}}
</h3>
<el-button
icon=
"el-icon-circle-plus-outline"
plain
size=
"mini"
@
click=
"handleAddTaskModel('reviewTask')"
>
{{
$t
(
'
organization.message.create_new_notification
'
)
}}
</el-button>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"24"
>
<el-table
:data=
"form.reviewTask"
class=
"tb-edit"
border
size=
"mini"
:cell-style=
"rowClass"
:header-cell-style=
"headClass"
>
<el-table-column
:label=
"$t('schedule.event')"
min-width=
"20%"
prop=
"events"
>
<template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.event"
:placeholder=
"$t('organization.message.select_events')"
@
change=
"handleReviewReceivers(scope.row)"
prop=
"event"
:disabled=
"!scope.row.isSet"
>
<el-option
v-for=
"item in reviewTaskEventOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiver')"
prop=
"receiver"
min-width=
"20%"
>
<
template
v-slot:default=
"{row}"
>
<el-select
v-model=
"row.userIds"
filterable
multiple
:placeholder=
"$t('commons.please_select')"
style=
"width: 100%;"
:disabled=
"!row.isSet"
>
<el-option
v-for=
"item in row.reviewReceiverOptions"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('schedule.receiving_mode')"
min-width=
"20%"
prop=
"type"
>
<
template
slot-scope=
"scope"
>
<el-select
v-model=
"scope.row.type"
:placeholder=
"$t('organization.message.select_receiving_method')"
:disabled=
"!scope.row.isSet"
@
change=
"handleEdit(scope.$index, scope.row)"
>
<el-option
v-for=
"item in receiveTypeOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
</
template
>
</el-table-column>
<el-table-column
label=
"webhook"
min-width=
"20%"
prop=
"webhook"
>
<
template
v-slot:default=
"scope"
>
<el-input
v-model=
"scope.row.webhook"
placeholder=
"webhook地址"
:disabled=
"!scope.row.isSet||!scope.row.isReadOnly"
></el-input>
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('commons.operating')"
min-width=
"20%"
prop=
"result"
>
<
template
v-slot:default=
"scope"
>
<el-button
type=
"primary"
size=
"mini"
v-show=
"scope.row.isSet"
@
click=
"handleAddTask(scope.$index,scope.row)"
>
{{
$t
(
'
commons.add
'
)
}}
</el-button>
<el-button
size=
"mini"
v-show=
"scope.row.isSet"
@
click.native.prevent=
"removeRowTask(scope.$index,form.reviewTask)"
>
{{
$t
(
'
commons.cancel
'
)
}}
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
v-show=
"!scope.row.isSet"
@
click.native.prevent=
"deleteRowTask(scope.$index,scope.row)"
></el-button>
</
template
>
</el-table-column>
</el-table>
</el-col>
</el-row>
</div>
</template>
<
script
>
export
default
{
name
:
"
TestReviewNotification
"
,
props
:
{
reviewReceiverOptions
:
{
type
:
Array
}
},
data
()
{
return
{
form
:
{
reviewTask
:
[{
taskType
:
"
reviewTask
"
,
event
:
""
,
userIds
:
[],
type
:
[],
webhook
:
""
,
isSet
:
true
,
identification
:
""
,
isReadOnly
:
false
,
}],
},
reviewTaskEventOptions
:
[
{
value
:
'
CREATE
'
,
label
:
this
.
$t
(
'
commons.create
'
)},
{
value
:
'
UPDATE
'
,
label
:
this
.
$t
(
'
commons.update
'
)},
{
value
:
'
DELETE
'
,
label
:
this
.
$t
(
'
commons.delete
'
)},
{
value
:
'
COMMENT
'
,
label
:
this
.
$t
(
'
commons.comment
'
)}
],
receiveTypeOptions
:
[
{
value
:
'
EMAIL
'
,
label
:
this
.
$t
(
'
organization.message.mail
'
)},
{
value
:
'
NAIL_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.nail_robot
'
)},
{
value
:
'
WECHAT_ROBOT
'
,
label
:
this
.
$t
(
'
organization.message.enterprise_wechat_robot
'
)}
],
};
},
activated
()
{
this
.
initForm
()
},
methods
:
{
initForm
()
{
this
.
result
=
this
.
$get
(
'
/notice/search/message
'
,
response
=>
{
this
.
form
.
reviewTask
=
response
.
data
.
reviewTask
;
this
.
form
.
reviewTask
.
forEach
(
planTask
=>
{
this
.
handleReviewReceivers
(
planTask
);
});
})
},
handleEdit
(
index
,
data
)
{
data
.
isReadOnly
=
true
;
if
(
data
.
type
===
'
EMAIL
'
)
{
data
.
isReadOnly
=
!
data
.
isReadOnly
}
},
handleAddTaskModel
(
type
)
{
let
Task
=
{};
Task
.
event
=
[];
Task
.
userIds
=
[];
Task
.
type
=
""
;
Task
.
webhook
=
""
;
Task
.
isSet
=
true
;
Task
.
identification
=
""
;
if
(
type
===
'
jenkinsTask
'
)
{
Task
.
taskType
=
'
JENKINS_TASK
'
this
.
form
.
jenkinsTask
.
push
(
Task
)
}
if
(
type
===
'
testPlanTask
'
)
{
Task
.
taskType
=
'
TEST_PLAN_TASK
'
this
.
form
.
testCasePlanTask
.
push
(
Task
)
}
if
(
type
===
'
reviewTask
'
)
{
Task
.
taskType
=
'
REVIEW_TASK
'
this
.
form
.
reviewTask
.
push
(
Task
)
}
if
(
type
===
'
defectTask
'
)
{
Task
.
taskType
=
'
DEFECT_TASK
'
this
.
form
.
defectTask
.
push
(
Task
)
}
},
handleAddTask
(
index
,
data
)
{
if
(
data
.
event
&&
data
.
userIds
.
length
>
0
&&
data
.
type
)
{
console
.
log
(
data
.
type
)
if
(
data
.
type
===
'
NAIL_ROBOT
'
||
data
.
type
===
'
WECHAT_ROBOT
'
)
{
if
(
!
data
.
webhook
)
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message_webhook
'
));
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
addTask
(
data
)
}
}
else
{
this
.
$warning
(
this
.
$t
(
'
organization.message.message
'
));
}
},
addTask
(
data
)
{
let
list
=
[]
data
.
isSet
=
false
list
.
push
(
data
)
let
param
=
{};
param
.
messageDetail
=
list
this
.
result
=
this
.
$post
(
"
/notice/save/message/task
"
,
param
,
()
=>
{
this
.
initForm
()
this
.
$success
(
this
.
$t
(
'
commons.save_success
'
));
})
},
removeRowTask
(
index
,
data
)
{
//移除
data
.
splice
(
index
,
1
)
},
deleteRowTask
(
index
,
data
)
{
//删除
this
.
result
=
this
.
$get
(
"
/notice/delete/message/
"
+
data
.
identification
,
response
=>
{
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
initForm
()
})
},
rowClass
()
{
return
"
text-align:center
"
},
headClass
()
{
return
"
text-align:center;background:'#ededed'
"
},
handleReviewReceivers
(
row
)
{
let
reviewReceiverOptions
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
reviewReceiverOptions
));
switch
(
row
.
event
)
{
case
"
CREATE
"
:
reviewReceiverOptions
.
unshift
({
id
:
'
EXECUTOR
'
,
name
:
this
.
$t
(
'
test_track.review.reviewer
'
)})
break
;
case
"
UPDATE
"
:
reviewReceiverOptions
.
unshift
({
id
:
'
FOUNDER
'
,
name
:
this
.
$t
(
'
test_track.review.review_creator
'
)})
break
;
case
"
DELETE
"
:
reviewReceiverOptions
.
unshift
({
id
:
'
FOUNDER
'
,
name
:
this
.
$t
(
'
test_track.review.review_creator
'
)})
break
;
case
"
COMMENT
"
:
reviewReceiverOptions
.
unshift
({
id
:
'
MAINTAINER
'
,
name
:
this
.
$t
(
'
test_track.case.maintainer
'
)})
break
;
default
:
break
;
}
row
.
reviewReceiverOptions
=
reviewReceiverOptions
;
}
}
}
</
script
>
<
style
scoped
>
.el-row
{
margin-bottom
:
10px
;
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录