Skip to content

Commit e84bf63

Browse files
xuegaiyingBidaya0
authored andcommitted
addtemp
1 parent 6423209 commit e84bf63

File tree

3 files changed

+47
-3
lines changed

3 files changed

+47
-3
lines changed

src/config/lang/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ export default {
927927
token: 'Access Token',
928928
department: 'Department',
929929
departmentPlaceholder: 'Please select a department',
930+
templatePlaceholder: 'Please select a template',
930931
tokenDesc:
931932
'Configure the access credentials of the current project for permission processing in the automatic scanning function',
932933
tokenPlaceholder: 'Place enter the access token',

src/config/lang/zh_cn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ export default {
928928
token: '访问凭证',
929929
department: '部门',
930930
departmentPlaceholder: '请选择部门',
931+
templatePlaceholder: '请选择项目配置',
931932
tokenDesc: '配置当前项目的访问凭证,用于自动扫描功能中的权限处理',
932933
tokenPlaceholder: '请输入访问凭证',
933934
appAddress: '项目地址',

src/views/project/ProjectEdit.vue

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@
6666
</el-select>
6767
</div>
6868
</el-form-item>
69+
<el-form-item
70+
:label="$t('views.deploy.projectTemplate')"
71+
prop="template_id"
72+
>
73+
<el-select
74+
v-model="submitForm.template_id"
75+
class="addUserInput"
76+
clearable
77+
style="width: 390px"
78+
>
79+
<el-option
80+
v-for="(item, index) in projectList"
81+
:key="index"
82+
:label="item.template_name"
83+
:value="item.id"
84+
></el-option>
85+
</el-select>
86+
</el-form-item>
6987
<template v-if="!advanced">
7088
<el-form-item>
7189
<span class="advancedSetting" @click="advanced = true">
@@ -242,6 +260,7 @@ import { Form } from 'element-ui'
242260
export default class ProjectEdit extends VueBase {
243261
private advanced = false
244262
private departmentList = []
263+
private projectList = []
245264
private submitForm: {
246265
name: string
247266
mode: string
@@ -253,7 +272,8 @@ export default class ProjectEdit extends VueBase {
253272
base_url: string
254273
test_req_header_key: string
255274
test_req_header_value: string
256-
department_id: any
275+
department_id: any,
276+
template_id: any
257277
} = {
258278
name: '',
259279
mode: this.$t('views.projectEdit.mode1') as string,
@@ -266,6 +286,7 @@ export default class ProjectEdit extends VueBase {
266286
test_req_header_key: '',
267287
test_req_header_value: '',
268288
department_id: '',
289+
template_id: ''
269290
}
270291
private engineList: Array<{
271292
id: number
@@ -309,6 +330,13 @@ export default class ProjectEdit extends VueBase {
309330
trigger: 'change',
310331
},
311332
],
333+
template_id: [
334+
{
335+
required: true,
336+
message: this.$t('views.projectEdit.templatePlaceholder'),
337+
trigger: 'change',
338+
},
339+
],
312340
}
313341
314342
private scanAddDialogOpen = false
@@ -331,9 +359,21 @@ export default class ProjectEdit extends VueBase {
331359
}
332360
this.$message.error(res.msg)
333361
}
362+
private async getListProjecttemplat() {
363+
const res = await this.services.setting.listProjecttemplat({
364+
page: 1,
365+
page_size: 100,
366+
})
367+
if (res.status === 201) {
368+
this.projectList = res.data
369+
return
370+
}
371+
this.$message.error(res.msg)
372+
}
334373
async created() {
335374
await this.getEngineList()
336375
await this.getListDepartment()
376+
await this.getListProjecttemplat()
337377
await this.strategyUserList()
338378
if (this.$route.params.pid) {
339379
await this.projectDetail()
@@ -381,7 +421,7 @@ export default class ProjectEdit extends VueBase {
381421
this.submitForm.test_req_header_key = data.test_req_header_key
382422
this.submitForm.test_req_header_value = data.test_req_header_value
383423
this.submitForm.department_id = data.department_id
384-
424+
this.submitForm.template_id = data.template_id
385425
this.agentChange()
386426
}
387427
@@ -574,7 +614,8 @@ export default class ProjectEdit extends VueBase {
574614
base_url: string
575615
test_req_header_key: string
576616
test_req_header_value: string
577-
department_id: any
617+
department_id: any,
618+
template_id: any
578619
} = {
579620
name: this.submitForm.name,
580621
mode: this.submitForm.mode,
@@ -591,6 +632,7 @@ export default class ProjectEdit extends VueBase {
591632
test_req_header_key: this.submitForm.test_req_header_key,
592633
test_req_header_value: this.submitForm.test_req_header_value,
593634
department_id: this.submitForm.department_id,
635+
template_id: this.submitForm.template_id,
594636
}
595637
if (this.$route.params.pid) {
596638
params.pid = this.$route.params.pid

0 commit comments

Comments
 (0)