refactor(测试跟踪): 自定义字段下拉框选项被删除则置空

--bug=1014996 --user=陈建星 修改了用例状态的选项,在用例模板已生效,但是创建用例的时候已经是旧的选项,正确的应该是草稿/非草稿 https://www.tapd.cn/55049933/s/1215779
This commit is contained in:
chenjianxing 2022-07-29 17:29:47 +08:00 committed by jianxing
parent 08e7ea6167
commit 784acdf419
1 changed files with 21 additions and 0 deletions

View File

@ -134,6 +134,27 @@ export default {
};
},
mounted() {
if (['select', 'multipleSelect', 'checkbox', 'radio'].indexOf(this.data.type) > -1 && this.data.options) {
let values = this.data[this.prop];
if (['multipleSelect', 'checkbox'].indexOf(this.data.type) > -1) {
if (values && values instanceof Array) {
for (let i = values.length - 1; i >= 0; i--) {
if (!this.data.options.find(item => item.value === values[i])) {
//
values.splice(i, 1);
}
}
} else {
//
this.data[this.prop] = [];
}
} else {
if (!this.data.options.find(item => item.value === values)) {
//
this.data[this.prop] = '';
}
}
}
getProjectMemberOption((data) => {
this.memberOptions = data;
if (this.data.name === '责任人' && this.data.system && this.isTemplateEdit) {