Commit 9017ae25 authored by 王晓铜's avatar 王晓铜

修改数据库重新选择

parent 7551b1b5
......@@ -300,20 +300,44 @@ export default {
},
// 保存方法
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` })
......
......@@ -186,7 +186,7 @@
<el-input v-model="addTestDescriptionForm.api"></el-input>
</el-form-item>
<el-form-item label="备注:" class="input-style">
<el-input v-model="addTestDescriptionForm.scope" type="textarea"></el-input>
<el-input v-model="addTestDescriptionForm.scope" type="textarea" autosize></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
......@@ -380,37 +380,51 @@ export default {
this.addTestDescriptionForm.scope = ''
this.addTestDescriptionForm.updateTime = ''
this.serviceAndBranchList = []
// this.serviceAndBranchList.push({
// serviceName: '',
// branch: '',
// developer: this.getUserName
// })
this.apolloList = []
this.databaseList = []
},
// 保存数据按钮
addTestDescriptionFrom() {
// 判断添加的数据是否有重复
// console.log('888', this.databaseList)
// var newDatabaseList = []
// this.database.forEach((element) => {
// if()
// })
// 将数组对象转化为Json字符串
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify(
this.serviceAndBranchList
)
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList)
this.addTestDescriptionForm.database = JSON.stringify(this.databaseList)
// 判断是否选择了重复分支
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 {
......@@ -421,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 {
......
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