ui测试前后端问题修复
This commit is contained in:
@@ -171,7 +171,7 @@
|
||||
</div>
|
||||
<!-- -->
|
||||
<div v-else class="operateObject-wrap" style="padding: 10px;">
|
||||
<el-select v-model="row.operateObject" class="select">
|
||||
<el-select v-model="row.operateObject" class="select" @change="() => handleOperateObjectChange(row)">
|
||||
<el-option key="1" label="元素对象" value="1"></el-option>
|
||||
<el-option key="2" label="元素定位" value="2"></el-option>
|
||||
</el-select>
|
||||
@@ -326,7 +326,7 @@
|
||||
</div>
|
||||
<!-- -->
|
||||
<div v-else class="operateObject-wrap" style="padding: 10px;">
|
||||
<el-select v-model="row.operateObject" class="select">
|
||||
<el-select v-model="row.operateObject" class="select" @change="() => handleOperateObjectChange(row)">
|
||||
<el-option key="1" label="元素对象" value="1"></el-option>
|
||||
<el-option key="2" label="元素定位" value="2"></el-option>
|
||||
</el-select>
|
||||
@@ -413,7 +413,7 @@
|
||||
<div v-for="(content, index2) in item.assertionQOList.elementAssertions" class="time">
|
||||
<div class="time-left">
|
||||
<div class="operateObject-wrap">
|
||||
<el-select v-model="content.operateObject" class="select">
|
||||
<el-select v-model="content.operateObject" class="select" @change="() => handleOperateObjectChange(content)">
|
||||
<el-option key="1" label="元素对象" value="1"></el-option>
|
||||
<el-option key="2" label="元素定位" value="2"></el-option>
|
||||
</el-select>
|
||||
@@ -473,7 +473,7 @@
|
||||
<div v-for="(content, index2) in item.assertionQOList.dropdownBoxes" class="time">
|
||||
<div class="time-left">
|
||||
<div class="operateObject-wrap">
|
||||
<el-select v-model="content.operateObject" class="select">
|
||||
<el-select v-model="content.operateObject" class="select" @change="() => handleOperateObjectChange(content)">
|
||||
<el-option key="1" label="元素对象" value="1"></el-option>
|
||||
<el-option key="2" label="元素定位" value="2"></el-option>
|
||||
</el-select>
|
||||
@@ -593,7 +593,7 @@ export default {
|
||||
saveForm: {
|
||||
errorHandling: '1', // 错误处理
|
||||
waitElementTime: 15000, // 等待元素超时时间
|
||||
screenshotConfiguration: 1, // 截图配置
|
||||
screenshotConfiguration: 2, // 截图配置 - 修改默认值为2(出现异常截图)
|
||||
beforeList: [], // 前置数组
|
||||
afterList: [], // 后置数组
|
||||
before: '1',
|
||||
@@ -904,8 +904,24 @@ export default {
|
||||
break
|
||||
}
|
||||
},
|
||||
// 处理操作对象类型切换
|
||||
handleOperateObjectChange(row) {
|
||||
if (row.operateObject === '2') {
|
||||
// 切换到元素定位时,清空元素对象相关的值
|
||||
row.operateGroupId = null;
|
||||
row.operateElementId = null;
|
||||
this.elementList = [];
|
||||
} else if (row.operateObject === '1') {
|
||||
// 切换到元素对象时,如果之前有选择过分组,则重新获取元素列表
|
||||
if (row.operateGroupId) {
|
||||
this.getElementListData(row.operateGroupId, row);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获取元素列表
|
||||
getElementListData(groupId, target) {
|
||||
if (!groupId) return;
|
||||
|
||||
getElementList({ groupId: groupId }).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.elementList = res.rows;
|
||||
@@ -967,7 +983,7 @@ export default {
|
||||
this.saveForm = {
|
||||
errorHandling: '1', // 错误处理
|
||||
waitElementTime: 15000, // 等待元素超时时间
|
||||
screenshotConfiguration: 1, // 截图配置
|
||||
screenshotConfiguration: 2, // 截图配置 - 修改默认值为2(出现异常截图)
|
||||
beforeList: [], // 前置数组
|
||||
afterList: [], // 后置数组
|
||||
before: '1',
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="saveForm.stepType === '1'">
|
||||
<el-checkbox v-model="appendPageValue">追加页面</el-checkbox>
|
||||
<el-checkbox
|
||||
v-model="isAppendPageModel"
|
||||
>追加页面</el-checkbox>
|
||||
<el-tooltip class="item" effect="dark" content="追加页面,在新的页面打开url,不勾选覆盖当前url" placement="right">
|
||||
<i class="el-icon-info"></i>
|
||||
</el-tooltip>
|
||||
@@ -86,7 +88,7 @@
|
||||
<!-- 根据定位方式切换 frame -->
|
||||
<el-form-item prop="operateObject" label="操作对象" v-show="saveForm.operate === 3">
|
||||
<div class="operateObject-wrap">
|
||||
<el-select v-model="saveForm.operateObject" class="select">
|
||||
<el-select v-model="saveForm.operateObject" class="select" @change="handleOperateObjectChange">
|
||||
<el-option key="1" label="元素对象" value="1"></el-option>
|
||||
<el-option key="2" label="元素定位" value="2"></el-option>
|
||||
</el-select>
|
||||
@@ -362,6 +364,7 @@ export default {
|
||||
height: 0,
|
||||
width: 0,
|
||||
},
|
||||
isAppendPageModel: false, // 追加页面的临时模型
|
||||
saveForm: {
|
||||
automationId: null, // 场景id
|
||||
name: null, // 名称
|
||||
@@ -421,9 +424,25 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 确保在组件挂载时saveForm中有正确的初始值
|
||||
if (!this.detail || Object.keys(this.detail).length === 0) {
|
||||
this.$set(this.saveForm, 'isAppendPage', 0);
|
||||
}
|
||||
this.initData()
|
||||
this.getListGroupData()
|
||||
},
|
||||
methods: {
|
||||
// 初始化数据
|
||||
initData() {
|
||||
// 如果是编辑模式,会通过watch detail来设置saveForm
|
||||
if (!this.detail || Object.keys(this.detail).length === 0) {
|
||||
// 创建模式下,确保有初始值
|
||||
this.saveForm = {
|
||||
...this.saveForm,
|
||||
isAppendPage: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
// 步骤类型变换
|
||||
selectStepType() {
|
||||
// 置空操作
|
||||
@@ -441,8 +460,24 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
// 处理操作对象类型切换
|
||||
handleOperateObjectChange() {
|
||||
if (this.saveForm.operateObject === '2') {
|
||||
// 切换到元素定位时,清空元素对象相关的值
|
||||
this.saveForm.operateGroupId = null;
|
||||
this.saveForm.operateElementId = null;
|
||||
this.elementList = [];
|
||||
} else if (this.saveForm.operateObject === '1') {
|
||||
// 切换到元素对象时,如果之前有选择过分组,则重新获取元素列表
|
||||
if (this.saveForm.operateGroupId) {
|
||||
this.getElementListData(this.saveForm.operateGroupId);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获取元素列表
|
||||
getElementListData(groupId) {
|
||||
if (!groupId) return;
|
||||
|
||||
getElementList({ groupId: groupId }).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.elementList = res.rows;
|
||||
@@ -469,6 +504,31 @@ export default {
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 监听操作对象类型的变化
|
||||
'saveForm.operateObject': {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal === '1' && this.saveForm.operateGroupId) {
|
||||
// 当切换到元素对象且已有分组ID时,重新获取元素列表
|
||||
this.getElementListData(this.saveForm.operateGroupId);
|
||||
}
|
||||
}
|
||||
},
|
||||
// 监听复选框模型的变化
|
||||
isAppendPageModel: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
this.saveForm.isAppendPage = val ? 1 : 0;
|
||||
console.log('isAppendPageModel changed:', val, this.saveForm.isAppendPage);
|
||||
}
|
||||
},
|
||||
// 监听saveForm中isAppendPage的变化来更新复选框状态
|
||||
'saveForm.isAppendPage': {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
this.isAppendPageModel = val === 1;
|
||||
console.log('isAppendPage changed:', val, this.isAppendPageModel);
|
||||
}
|
||||
},
|
||||
detail(newVal, oldVal) {
|
||||
this.saveForm = newVal
|
||||
// 如果是元素对象且有元素组ID,获取元素列表
|
||||
@@ -602,12 +662,14 @@ export default {
|
||||
computed: {
|
||||
appendPageValue: {
|
||||
get() {
|
||||
// 将数字转换为布尔值用于显示
|
||||
return this.saveForm.isAppendPage === 1;
|
||||
return this.saveForm && typeof this.saveForm.isAppendPage !== 'undefined' ? this.saveForm.isAppendPage === 1 : false;
|
||||
},
|
||||
set(value) {
|
||||
// 将布尔值转换为数字存储
|
||||
if (!this.saveForm) {
|
||||
this.saveForm = {};
|
||||
}
|
||||
this.saveForm.isAppendPage = value ? 1 : 0;
|
||||
console.log('appendPageValue changed:', value, this.saveForm.isAppendPage);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user