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

修改数据库重新选择

parent 7551b1b5
...@@ -300,20 +300,44 @@ export default { ...@@ -300,20 +300,44 @@ export default {
}, },
// 保存方法 // 保存方法
saveTestDescription() { saveTestDescription() {
// 将数组对象转化为Json字符串 // 判断是否选择了重复分支
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify( for (var a = 0; a < this.serviceAndBranchList.length; a++) {
this.serviceAndBranchList for (var b = a + 1; b < this.serviceAndBranchList.length; b++) {
) if (
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList) this.serviceAndBranchList[a].serviceName ===
this.addTestDescriptionForm.database = JSON.stringify(this.databaseList) this.serviceAndBranchList[b].serviceName
// console.log('参数信息', this.addTestDescriptionForm) ) {
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) => { this.$refs.addTestDescriptionRef.validate((valid) => {
if (!valid) { if (!valid) {
return false return false
} else { } 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) => { editTestDescription(this.addTestDescriptionForm).then((resp) => {
if (resp.data.businessCode === '0000') { if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg) this.$message.success('编辑成功!')
this.isShowDetail = true this.isShowDetail = true
// 返回列表页 // 返回列表页
this.$router.push({ path: `/qa/testDescription` }) this.$router.push({ path: `/qa/testDescription` })
......
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
<el-input v-model="addTestDescriptionForm.api"></el-input> <el-input v-model="addTestDescriptionForm.api"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="备注:" class="input-style"> <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-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -380,37 +380,51 @@ export default { ...@@ -380,37 +380,51 @@ export default {
this.addTestDescriptionForm.scope = '' this.addTestDescriptionForm.scope = ''
this.addTestDescriptionForm.updateTime = '' this.addTestDescriptionForm.updateTime = ''
this.serviceAndBranchList = [] this.serviceAndBranchList = []
// this.serviceAndBranchList.push({
// serviceName: '',
// branch: '',
// developer: this.getUserName
// })
this.apolloList = [] this.apolloList = []
this.databaseList = [] this.databaseList = []
}, },
// 保存数据按钮 // 保存数据按钮
addTestDescriptionFrom() { addTestDescriptionFrom() {
// 判断添加的数据是否有重复 // 判断是否选择了重复分支
// console.log('888', this.databaseList) for (var a = 0; a < this.serviceAndBranchList.length; a++) {
// var newDatabaseList = [] for (var b = a + 1; b < this.serviceAndBranchList.length; b++) {
// this.database.forEach((element) => { if (
// if() this.serviceAndBranchList[a].serviceName ===
// }) this.serviceAndBranchList[b].serviceName
// 将数组对象转化为Json字符串 ) {
this.addTestDescriptionForm.serviceAndBranch = JSON.stringify( return this.$message.error(
this.serviceAndBranchList '已经选择了已有的分支,请重新选择新分支!'
) )
this.addTestDescriptionForm.apollo = JSON.stringify(this.apolloList) }
this.addTestDescriptionForm.database = JSON.stringify(this.databaseList) }
}
// 判断添加的数据库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) => { this.$refs.addTestDescriptionRef.validate((valid) => {
if (!valid) { if (!valid) {
return false return false
} else { } 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) { if (this.addTestDescriptionForm.id) {
editTestDescription(this.addTestDescriptionForm).then((resp) => { editTestDescription(this.addTestDescriptionForm).then((resp) => {
if (resp.data.businessCode === '0000') { if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg) this.$message.success('修改成功!')
this.DialogAddVisible = false this.DialogAddVisible = false
this.getTestDescriptionList() this.getTestDescriptionList()
} else { } else {
...@@ -421,7 +435,7 @@ export default { ...@@ -421,7 +435,7 @@ export default {
// 添加测试文档 // 添加测试文档
addTestDescription(this.addTestDescriptionForm).then((resp) => { addTestDescription(this.addTestDescriptionForm).then((resp) => {
if (resp.data.businessCode === '0000') { if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg) this.$message.success('添加成功!')
this.DialogAddVisible = false this.DialogAddVisible = false
this.getTestDescriptionList() this.getTestDescriptionList()
} else { } 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