【关联选项】关联选项时需要关联随机结果
This commit is contained in:
@@ -234,7 +234,7 @@ export default defineComponent({
|
||||
() => props.answer,
|
||||
() => {
|
||||
context.emit("changeAnswer", {
|
||||
options: options.value,
|
||||
options: optionGroups.value.flatMap(group => group.options || []),
|
||||
value: value.value,
|
||||
});
|
||||
// 质量控制
|
||||
|
||||
@@ -412,7 +412,20 @@ export default defineComponent({
|
||||
watch(
|
||||
() => props.answer,
|
||||
() => {
|
||||
context.emit("changeAnswer", { list: props.list });
|
||||
const list = JSON.parse(JSON.stringify(props.list || []))
|
||||
const rowItems = rowGroups.value.flatMap(group => group.options || [])
|
||||
const colItems = colGroups.value.flatMap(group => group.options || [])
|
||||
list.forEach(li => {
|
||||
const options = (li.options || []).map(i => i.option_key)
|
||||
|
||||
if(li.type === 1) {
|
||||
li.options = JSON.parse(JSON.stringify(rowItems.filter(i => options.includes(i.option_key))))
|
||||
} else if(li.type === 2) {
|
||||
li.options = JSON.parse(JSON.stringify(colItems.filter(i => options.includes(i.option_key))))
|
||||
}
|
||||
})
|
||||
|
||||
context.emit("changeAnswer", { list });
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
|
||||
@@ -410,7 +410,20 @@ export default defineComponent({
|
||||
watch(
|
||||
() => props.answer,
|
||||
() => {
|
||||
context.emit("changeAnswer", { list: props.list });
|
||||
const list = JSON.parse(JSON.stringify(props.list || []))
|
||||
const rowItems = rowGroups.value.flatMap(group => group.options || [])
|
||||
const colItems = colGroups.value.flatMap(group => group.options || [])
|
||||
list.forEach(li => {
|
||||
const options = (li.options || []).map(i => i.option_key)
|
||||
|
||||
if(li.type === 1) {
|
||||
li.options = JSON.parse(JSON.stringify(rowItems.filter(i => options.includes(i.option_key))))
|
||||
} else if(li.type === 2) {
|
||||
li.options = JSON.parse(JSON.stringify(colItems.filter(i => options.includes(i.option_key))))
|
||||
}
|
||||
})
|
||||
|
||||
context.emit("changeAnswer", { list });
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
|
||||
@@ -222,7 +222,20 @@ export default defineComponent({
|
||||
watch(
|
||||
() => props.answer,
|
||||
() => {
|
||||
context.emit("changeAnswer", { list: props.list });
|
||||
const list = JSON.parse(JSON.stringify(props.list || []))
|
||||
const rowItems = rowGroups.value.flatMap(group => group.options || [])
|
||||
const colItems = colGroups.value.flatMap(group => group.options || [])
|
||||
list.forEach(li => {
|
||||
const options = (li.options || []).map(i => i.option_key)
|
||||
|
||||
if(li.type === 1) {
|
||||
li.options = JSON.parse(JSON.stringify(rowItems.filter(i => options.includes(i.option_key))))
|
||||
} else if(li.type === 2) {
|
||||
li.options = JSON.parse(JSON.stringify(colItems.filter(i => options.includes(i.option_key))))
|
||||
}
|
||||
})
|
||||
|
||||
context.emit("changeAnswer", { list });
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
|
||||
@@ -201,7 +201,7 @@ export default defineComponent({
|
||||
() => props.answer,
|
||||
() => {
|
||||
context.emit("changeAnswer", {
|
||||
options: options.value,
|
||||
options: optionGroups.value.flatMap(group => group.options || []),
|
||||
value: value.value,
|
||||
});
|
||||
// 质量控制
|
||||
|
||||
Reference in New Issue
Block a user