|
@@ -233,6 +233,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ commitStateFlag: false,
|
|
|
tabledataloading: true,
|
|
|
// 表格默认数据
|
|
|
tableData: [],
|
|
@@ -467,53 +468,10 @@ export default {
|
|
|
// 输入框失焦
|
|
|
inputBlur(inputBlurData, index, isPro) {
|
|
|
// console.log(`如果input失焦,则提交本行数据到后端`)
|
|
|
- // console.log('inputBlur inputBlurData=', inputBlurData)
|
|
|
- // console.log('inputBlur inputScope=', index)
|
|
|
- // console.log('tableData', this.tableData)
|
|
|
if (isPro) {
|
|
|
// 根据当前 exampleTestRulesValue 获取相应规则中的 params
|
|
|
this.tableData[index].exampleSetting = getParams(inputBlurData.exampleTestRulesValue, this.exampleTestRulesOptions)
|
|
|
}
|
|
|
-
|
|
|
- // 原: 如果 stepsId > 0 才执行提交
|
|
|
- // 新: 后端 不支持批量提交数据 改为单条提交
|
|
|
- // 如果 stepsId > 0 才执行提交
|
|
|
- // {
|
|
|
- // "id": "32",
|
|
|
- // "name": "值为123",
|
|
|
- // "suiteId": "999",
|
|
|
- // "planId": "999",
|
|
|
- // "ruleId": 10,
|
|
|
- // "ruleName": "采样数据是否等于某个值",
|
|
|
- // "not": false,
|
|
|
- // "value": 123,
|
|
|
- // "error": 0,
|
|
|
- // "params": {
|
|
|
- // "RANGE": "3",
|
|
|
- // "OFFSET": "0",
|
|
|
- // "VALUE": "123"
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // 不再使用失焦保存
|
|
|
- // const paramsJson = array2Json(inputBlurData.exampleSetting)
|
|
|
-
|
|
|
- // const editPath = `/test/unit`
|
|
|
- // const editData = {
|
|
|
- // id: inputBlurData.exampleId,
|
|
|
- // name: inputBlurData.exampleName,
|
|
|
- // suiteId: this.currentPlanData.id,
|
|
|
- // planId: null,
|
|
|
- // ruleId: inputBlurData.exampleTestRulesValue,
|
|
|
- // not: inputBlurData.exampleNegate,
|
|
|
- // value: inputBlurData.exampleExpectValue,
|
|
|
- // error: inputBlurData.exampleExpectValue,
|
|
|
- // params: paramsJson
|
|
|
- // }
|
|
|
- //
|
|
|
- // editRow(editPath, editData).then(editRes => {
|
|
|
- // this.tableData[index].exampleId = editRes.id
|
|
|
- // })
|
|
|
},
|
|
|
// 保存
|
|
|
saveClick(row, index) {
|
|
@@ -539,6 +497,15 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ if (this.commitStateFlag) {
|
|
|
+ this.$message({
|
|
|
+ message: '数据正在提交中',
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.commitStateFlag = true
|
|
|
this.tableData[index].jsonInputs = false
|
|
|
const paramsJson = formatParams(row.exampleSetting)
|
|
|
// console.log('savaRow = ', row.exampleSetting)
|
|
@@ -556,6 +523,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
editRow(editPath, editData).then(editRes => {
|
|
|
+ this.commitStateFlag = false
|
|
|
this.tableData[index].exampleId = editRes.id
|
|
|
this.$message({
|
|
|
message: `${editRes.name} 保存成功.`,
|
|
@@ -639,29 +607,17 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ if (this.commitStateFlag) {
|
|
|
+ this.$message({
|
|
|
+ message: '数据正在提交中',
|
|
|
+ type: 'error',
|
|
|
+ offset: window.screen.height / 3
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.commitStateFlag = true
|
|
|
this.tableData.forEach(async(tmpRowData, index) => {
|
|
|
const tableRowData = this.getSubmitTableRowData(tmpRowData)
|
|
|
- // let isNotPassMesage = ''
|
|
|
- // // console.log(tableRowData)
|
|
|
- // let v = tableRowData.name.toString() || ''
|
|
|
- // v = v.toString().replace(/ /gi, '')
|
|
|
- // // console.log('name=', v)
|
|
|
- // if (v === '') {
|
|
|
- // isNotPassMesage = '必填项(用例名称)不能为空'
|
|
|
- // }
|
|
|
- // v = tableRowData.ruleId.toString() || ''
|
|
|
- // v = v.toString().replace(/ /gi, '')
|
|
|
- // if (v === '') {
|
|
|
- // isNotPassMesage = '必填项(测试规则)不能为空'
|
|
|
- // }
|
|
|
- // if (isNotPassMesage !== '') {
|
|
|
- // this.$message({
|
|
|
- // type: 'error',
|
|
|
- // message: isNotPassMesage,
|
|
|
- // offset: window.screen.height / 3
|
|
|
- // })
|
|
|
- // return
|
|
|
- // }
|
|
|
await editRow(editPath, tableRowData).then(editRes => {
|
|
|
tableRowData.exampleId = editRes.id
|
|
|
if (index === this.tableData.length - 1) {
|
|
@@ -683,6 +639,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
+ this.commitStateFlag = false
|
|
|
},
|
|
|
|
|
|
// pop弹出框保存par
|