This commit is contained in:
fit2-zhao 2021-03-24 18:58:05 +08:00
commit c3937b1c44
6 changed files with 143 additions and 86 deletions

View File

@ -9,9 +9,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
@ -22,6 +22,7 @@
width="400"
trigger="click"
:content="robotTitle">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
@ -132,6 +133,7 @@
<script>
import {hasLicense} from "@/common/js/utils";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
const TASK_TYPE = 'DEFECT_TASK';
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
@ -140,6 +142,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "DefectTaskNotification",
components: {
MsCodeEdit,
"NoticeTemplate": noticeTemplate.default
},
props: {
@ -149,6 +152,7 @@ export default {
},
data() {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
@ -274,6 +278,7 @@ export default {
.el-row {
margin-bottom: 10px;
}
.el-button {
margin-left: 10px;
}

View File

@ -9,9 +9,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
@ -19,9 +19,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
@ -136,6 +136,7 @@
<script>
import {hasLicense} from "@/common/js/utils";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
const TASK_TYPE = 'JENKINS_TASK';
@ -145,6 +146,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "JenkinsNotification",
components: {
MsCodeEdit,
"NoticeTemplate": noticeTemplate.default
},
props: {
@ -154,6 +156,7 @@ export default {
},
data() {
return {
modes: ['text', 'html'],
title: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +

View File

@ -9,9 +9,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
@ -19,9 +19,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
width="200"
trigger="click" >
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
@ -136,6 +136,7 @@
<script>
import {hasLicense} from "@/common/js/utils";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./notice/NoticeTemplate.vue") : {};
@ -143,6 +144,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "ScheduleTaskNotification",
components: {
MsCodeEdit,
"NoticeTemplate": noticeTemplate.default
},
props: {
@ -155,6 +157,7 @@ export default {
},
data() {
return {
modes: ['text', 'html'],
title: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +

View File

@ -9,9 +9,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
@ -19,9 +19,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
@ -133,6 +133,7 @@
<script>
import {hasLicense} from "@/common/js/utils";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
const TASK_TYPE = 'TEST_PLAN_TASK';
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
@ -141,6 +142,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "TestPlanTaskNotification",
components: {
MsCodeEdit,
"NoticeTemplate": noticeTemplate.default
},
props: {
@ -150,6 +152,7 @@ export default {
},
data() {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
@ -308,6 +311,7 @@ export default {
.el-row {
margin-bottom: 10px;
}
.el-button {
margin-left: 10px;
}

View File

@ -9,9 +9,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="title">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="400px" :data.sync="title" :modes="modes" :mode="'html'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.mail_template_example') }}
</el-button>
@ -19,9 +19,9 @@
<el-popover
placement="right-end"
title="示例"
width="400"
trigger="click"
:content="robotTitle">
width="600"
trigger="click">
<ms-code-edit :read-only="true" height="200px" :data.sync="robotTitle" :modes="modes" :mode="'text'"/>
<el-button icon="el-icon-warning" plain size="mini" slot="reference">
{{ $t('organization.message.robot_template') }}
</el-button>
@ -133,6 +133,7 @@
<script>
import {hasLicense} from "@/common/js/utils";
import MsCodeEdit from "@/business/components/common/components/MsCodeEdit";
const TASK_TYPE = 'REVIEW_TASK';
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
@ -141,6 +142,7 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
export default {
name: "TestReviewNotification",
components: {
MsCodeEdit,
"NoticeTemplate": noticeTemplate.default
},
props: {
@ -150,6 +152,7 @@ export default {
},
data() {
return {
modes: ['text', 'html'],
title: "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
@ -313,6 +316,7 @@ export default {
.el-row {
margin-bottom: 10px;
}
.el-button {
margin-left: 10px;
}

View File

@ -103,8 +103,9 @@
</el-col>
<el-col :span="14">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth">
<el-cascader filterable placeholder="请选择要关联的测试" show-all-levels v-model="form.selected" :props="props"
class="ms-case"></el-cascader>
<el-cascader :options="sysList" filterable placeholder="请选择要关联的测试" show-all-levels
v-model="form.selected" :props="props"
class="ms-case" @change="clearInput" ref="cascade"></el-cascader>
</el-form-item>
</el-col>
</el-row>
@ -315,43 +316,10 @@ export default {
return {
props: {
multiple: true,
lazy: true,
lazyLoad: ((node, resolve) => {
const {level} = node;
if (node.level == 0) {
const nodes = TEST
.map(item => ({
value: item.id,
label: item.name,
leaf: level >= 1
}));
resolve(nodes)
}
if (node.level == 1) {
this.testOptions = [];
let url = '';
this.form.type = node.data.value
if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId
}
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
this.$get(url, response => {
const nodes = response.data
.map(item => ({
value: item.id,
label: item.name,
leaf: level >= 1
}));
resolve(nodes)
});
}
}
}),
//lazy: true,
//lazyLoad:this.lazyLoad
},
sysList: [],//
options: REVIEW_STATUS,
statuOptions: API_STATUS,
comments: [],
@ -462,8 +430,87 @@ export default {
this.$emit('setModuleOptions', this.moduleOptions);
}
},
created() {
this.loadOptions()
},
methods: {
clearInput() {
//this.$refs['cascade'].panel.clearCheckedNodes()
},
async loadOptions(sysLib) {
sysLib = TEST
.map(item => ({
value: item.id,
label: item.name,
}));
let array = [];
for (let i = 0; i < sysLib.length; i++) {
if (sysLib.length > 0) {
let res = await this.getTestOptions(sysLib[i].value);
sysLib[i].children = res;
}
array.push(sysLib[i]);
}
this.sysList = array;
},
getTestOptions(val) {
this.form.type = val
this.projectId = this.projectId
this.testOptions = [];
let url = '';
if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId
}
return new Promise((resolve, reject) => {
this.$get(url).then(res => {
console.log(res.data.data)
const data = res.data.data.map(item => ({
value: item.id,
label: item.name,
leaf: true
}))
resolve(data)
}).catch((err) => {
reject(err)
})
})
},
/* lazyLoad(node, resolve){
const { level } = node;
if(node.level==0){
const nodes = TEST
.map(item => ({
value: item.id,
label: item.name,
leaf: level >= 1
}));
resolve(nodes)
}
if(node.level==1){
this.projectId = getCurrentProjectID()
this.testOptions = [];
let url = '';
this.form.type=node.data.value
if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId
}
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
this.$get(url, response => {
const nodes = response.data
.map(item => ({
value: item.id,
label: item.name,
leaf: level >= 1
}));
resolve(nodes)
});
}
}
},*/
handleCommand(e) {
if (e === "ADD_AND_CREATE") {
this.$refs['caseFrom'].validate((valid) => {
@ -506,6 +553,10 @@ export default {
this.$nextTick(() => (this.isStepTableAlive = true));
},
open(testCase) {
/*
this.form.selected=[["automation", "3edaaf31-3fa4-4a53-9654-320205c2953a"],["automation", "3aa58bd1-c986-448c-8060-d32713dbd4eb"]]
*/
this.projectId = this.projectId;
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close);
@ -577,7 +628,7 @@ export default {
})
})
},
setFormData(testCase) {
async setFormData(testCase) {
testCase.tags = JSON.parse(testCase.tags);
testCase.selected = JSON.parse(testCase.testId);
let tmp = {};
@ -587,11 +638,12 @@ export default {
tmp.steps = []
}
Object.assign(this.form, tmp);
console.log(this.form.selected)
this.form.module = testCase.nodeId;
/*
this.form.testId=testCase.selected
*/
this.getFileMetaData(testCase);
/* testCase.selected = JSON.parse(testCase.testId);
this.form.selected= testCase.selected*/
await this.loadOptions(this.sysList)
},
setTestCaseExtInfo(testCase) {
this.testCase = {};
@ -710,7 +762,7 @@ export default {
if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags);
}
param.testId = JSON.stringify(this.form.selected)
param.testId=JSON.stringify(this.form.selected)
param.tags = this.form.tags;
param.type = 'functional'
return param;
@ -782,21 +834,7 @@ export default {
this.maintainerOptions = response.data;
});
},
getTestOptions(val) {
this.testOptions = [];
let url = '';
if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId
}
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
this.result = this.$get(url, response => {
this.testOptions = response.data;
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
});
}
},
visibleChange(flag) {
if (flag) {
this.getDemandOptions();