Commit 06c7b874 authored by 王晓铜's avatar 王晓铜

更新合并代码问题

parents ef947120 9daff845
......@@ -138,7 +138,7 @@
<el-table :data="databaseList" border class="table-style" style="width:95%">
<el-table-column label="数据库名称" width="210">
<template slot-scope="scope">
<el-select v-model="scope.row.db" placeholder="请选择" filterable clearable>
<el-select v-model="scope.row.db" placeholder="请选择" filterable clearable allow-create>
<el-option v-for="item in queryDataBaseList" :key="item" :label="item" :value="item">
</el-option>
</el-select>
......@@ -166,7 +166,7 @@
<el-input v-model="addTestDescriptionForm.api"></el-input>
</el-form-item>
<el-form-item label="备注:" class="input-style" style="width:95%">
<el-input v-model="addTestDescriptionForm.scope" type="textarea" autosize=""></el-input>
<el-input v-model="addTestDescriptionForm.scope" type="textarea" autosize></el-input>
</el-form-item>
<el-form-item>
<div style="margin-left:1000px">
......@@ -277,6 +277,7 @@ export default {
this.database = JSON.parse(data.database)
this.id = data.id
this.jiraProjectKey = data.jiraProjectKey
this.updateTime = data.updateTime
})
},
methods: {
......@@ -294,23 +295,48 @@ export default {
this.serviceAndBranchList = this.serviceAndBranch
this.apolloList = this.apollo
this.databaseList = this.database
this.addTestDescriptionForm.updateTime = this.updateTime
},
// 保存方法
saveTestDescription() {
// 将数组对象转化为Json字符串
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify(
this.serviceAndBranchList
)
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList)
this.addTestDescriptionForm.database = JSON.stringify(this.databaseList)
// console.log('参数信息', this.addTestDescriptionForm)
// 判断是否选择了重复分支
for (var a = 0; a < this.serviceAndBranchList.length; a++) {
for (var b = a + 1; b < this.serviceAndBranchList.length; b++) {
if (
this.serviceAndBranchList[a].serviceName ===
this.serviceAndBranchList[b].serviceName
) {
return this.$message.error(
'已经选择了已有的分支,请重新选择新分支!'
)
}
}
}
// 判断添加的数据库key值是否有重复
for (var i = 0; i < this.databaseList.length; i++) {
for (var j = i + 1; j < this.databaseList.length; j++) {
if (this.databaseList[i].db === this.databaseList[j].db) {
return this.$message.error(
'已经选择了已有的数据库,请重新选择数据库!'
)
}
}
}
this.$refs.addTestDescriptionRef.validate((valid) => {
if (!valid) {
return false
} else {
// 将数组对象转化为Json字符串
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify(
this.serviceAndBranchList
)
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList)
this.addTestDescriptionForm.database = JSON.stringify(
this.databaseList
)
editTestDescription(this.addTestDescriptionForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg)
this.$message.success('编辑成功!')
this.isShowDetail = true
// 返回列表页
this.$router.push({ path: `/qa/testDescription` })
......
......@@ -158,7 +158,7 @@
<el-table :data="databaseList" border class="table-style">
<el-table-column label="数据库名称" width="210">
<template slot-scope="scope">
<el-select v-model="scope.row.db" placeholder="请选择" filterable clearable>
<el-select v-model="scope.row.db" placeholder="请选择" filterable clearable allow-create>
<el-option v-for="item in queryDataBaseList" :key="item" :label="item" :value="item">
</el-option>
</el-select>
......@@ -240,7 +240,8 @@ export default {
database: '',
requirement: '',
api: '',
scope: ''
scope: '',
updateTime: ''
},
rules: {
jiraProjectKey: [
......@@ -377,34 +378,53 @@ export default {
this.addTestDescriptionForm.requirement = ''
this.addTestDescriptionForm.api = ''
this.addTestDescriptionForm.scope = ''
this.addTestDescriptionForm.updateTime = ''
this.serviceAndBranchList = []
// this.serviceAndBranchList.push({
// serviceName: '',
// branch: '',
// developer: this.getUserName
// })
this.apolloList = []
this.databaseList = []
},
// 保存数据按钮
addTestDescriptionFrom() {
// 将数组对象转化为Json字符串
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify(
this.serviceAndBranchList
)
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList)
this.addTestDescriptionForm.database = JSON.stringify(this.databaseList)
// console.log('88888', this.addTestDescriptionForm)
// 判断是否选择了重复分支
for (var a = 0; a < this.serviceAndBranchList.length; a++) {
for (var b = a + 1; b < this.serviceAndBranchList.length; b++) {
if (
this.serviceAndBranchList[a].serviceName ===
this.serviceAndBranchList[b].serviceName
) {
return this.$message.error(
'已经选择了已有的分支,请重新选择新分支!'
)
}
}
}
// 判断添加的数据库key值是否有重复
for (var i = 0; i < this.databaseList.length; i++) {
for (var j = i + 1; j < this.databaseList.length; j++) {
if (this.databaseList[i].db === this.databaseList[j].db) {
return this.$message.error(
'已经选择了已有的数据库,请重新选择数据库!'
)
}
}
}
this.$refs.addTestDescriptionRef.validate((valid) => {
if (!valid) {
return false
} else {
// 将数组对象转化为Json字符串
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify(
this.serviceAndBranchList
)
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList)
this.addTestDescriptionForm.database = JSON.stringify(
this.databaseList
)
// 编辑测试文档
if (this.addTestDescriptionForm.id) {
editTestDescription(this.addTestDescriptionForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg)
this.$message.success('修改成功!')
this.DialogAddVisible = false
this.getTestDescriptionList()
} else {
......@@ -415,7 +435,7 @@ export default {
// 添加测试文档
addTestDescription(this.addTestDescriptionForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg)
this.$message.success('添加成功!')
this.DialogAddVisible = false
this.getTestDescriptionList()
} else {
......@@ -436,6 +456,7 @@ export default {
this.addTestDescriptionForm.requirement = row.requirement
this.addTestDescriptionForm.api = row.api
this.addTestDescriptionForm.scope = row.scope
this.addTestDescriptionForm.updateTime = row.updateTime
this.serviceAndBranchList = JSON.parse(row.serviceAndBranch)
this.apolloList = JSON.parse(row.apollo)
this.databaseList = JSON.parse(row.database)
......@@ -472,11 +493,6 @@ export default {
},
// 详情按钮
openPreviewDialog(row) {
// this.$router.push('/qa/detailTestDescription?')
// this.$nextTick(function () {
// // DOM 现在更新了
// bus.$emit('msg', row)
// })
this.$router.push({
path: `/qa/detailTestDescription`,
query: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment