diff --git a/test-ui/src/views/test/uiTest/advancedSetting.vue b/test-ui/src/views/test/uiTest/advancedSetting.vue index 1d12569..b9faf26 100644 --- a/test-ui/src/views/test/uiTest/advancedSetting.vue +++ b/test-ui/src/views/test/uiTest/advancedSetting.vue @@ -171,7 +171,7 @@
- + @@ -326,7 +326,7 @@
- + @@ -413,7 +413,7 @@
- + @@ -473,7 +473,7 @@
- + @@ -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', diff --git a/test-ui/src/views/test/uiTest/sceneStep.vue b/test-ui/src/views/test/uiTest/sceneStep.vue index 35ae735..a491f65 100644 --- a/test-ui/src/views/test/uiTest/sceneStep.vue +++ b/test-ui/src/views/test/uiTest/sceneStep.vue @@ -22,7 +22,9 @@ - 追加页面 + 追加页面 @@ -86,7 +88,7 @@
- + @@ -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,获取元素列表 @@ -577,7 +637,7 @@ export default { const beforeList = this.saveForm.beforeList || []; const afterList = this.saveForm.afterList || []; var newList = [...beforeList, ...afterList]; - + // 错误处理 var param3 = { settingType: '3', @@ -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); } } },