oct表单父项修改子项清空
parent
74547d7bff
commit
d05ea6c28d
|
|
@ -157,8 +157,8 @@
|
|||
<el-dialog v-if="addOrEdit.visible" :visible.sync="addOrEdit.visible" :close-on-click-modal="false"
|
||||
:title="addOrEdit.title" width="500px">
|
||||
<el-form ref="tableQsForm" v-loading="loading" :model="qsForm" size="small">
|
||||
<QuestionTableFormItem v-for="item in qsList" :key="item.Id" :question="item" :question-form="qsForm"
|
||||
:reading-task-state="readingTaskState" @setFormItemData="setFormItemData"
|
||||
<QuestionTableFormItem v-for="item in qsList" :key="item.Id" :question="item" :questions="qsList"
|
||||
:question-form="qsForm" :reading-task-state="readingTaskState" @setFormItemData="setFormItemData"
|
||||
@resetFormItemData="resetFormItemData" />
|
||||
<el-form-item style="text-align: right">
|
||||
<el-button size="small" @click="addOrEdit.visible = false">
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<QuestionTableFormItem v-for="item in question.Childrens" :key="item.Id" :question="item"
|
||||
<QuestionTableFormItem v-for="item in question.Childrens" :key="item.Id" :question="item" :questions="questions"
|
||||
:question-form="questionForm" :reading-task-state="readingTaskState" @setFormItemData="setFormItemData"
|
||||
@resetFormItemData="resetFormItemData" />
|
||||
</div>
|
||||
|
|
@ -129,6 +129,12 @@ export default {
|
|||
return []
|
||||
}
|
||||
},
|
||||
questions: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
}
|
||||
},
|
||||
readingTaskState: {
|
||||
type: Number,
|
||||
required: true
|
||||
|
|
@ -155,6 +161,7 @@ export default {
|
|||
}
|
||||
this.$emit('setFormItemData', { key: question.Id, val: v })
|
||||
}
|
||||
this.resetChildValue(question, this.questions)
|
||||
},
|
||||
resetChild(obj) {
|
||||
obj.forEach(i => {
|
||||
|
|
@ -164,6 +171,17 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
resetChildValue(obj, arr) {
|
||||
arr.some(item => {
|
||||
if (item.ParentId === obj.Id) {
|
||||
this.$emit('resetFormItemData', item.Id)
|
||||
}
|
||||
if (item.Childrens && item.Childrens.length > 0) {
|
||||
this.resetChildValue(obj, item.Childrens)
|
||||
}
|
||||
return item.ParentId === obj.Id
|
||||
})
|
||||
},
|
||||
limitBlur(valueType, value) {
|
||||
if (isNaN(parseInt(value))) {
|
||||
value = null
|
||||
|
|
|
|||
Loading…
Reference in New Issue