from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr class QuestionContent(SpecObject): """问题内容""" label = ValidateAttr(field="label", type=str) type = ValidateAttr(field="type", in_list=['单选题', '多选题', '填空题']) option = ValidateAttr(field="option", instance_list="OptionContent") unit = ValidateAttr(field="unit", type=str) class QuestionnaireContent(SpecObject): """问卷内容""" label = ValidateAttr(field="label", type=str) children = ValidateAttr(field="children", instance_list="QuestionContent") class Questionnaire(SpecObject): """问卷类""" industry = ValidateAttr(field="industry", type=str) id = ValidateAttr(field='id', type=str, length=8) content = ValidateAttr(field="content", instance_list="QuestionnaireContent") fields_map = { "industry": "行业", "id": "问卷ID", "content": "问卷内容" }