diff --git a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiPaperServiceImpl.java b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiPaperServiceImpl.java index e210441..051cce6 100644 --- a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiPaperServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/applet/service/impl/AppletApiPaperServiceImpl.java @@ -308,6 +308,12 @@ public class AppletApiPaperServiceImpl implements AppletApiPaperService { if (option.getScore() != null) { totalScore += option.getScore(); } + + try{ + processBlankAnswer(option, option.getContent(), report); + }catch (Exception e){ + log.error(e.getMessage()); + } } } } @@ -335,13 +341,13 @@ public class AppletApiPaperServiceImpl implements AppletApiPaperService { } } } - appletPaperReportService.updateById(report); }catch (JacksonException e){ log.error(e.getMessage()); throw new JeecgBootException("格式有误!"); } } + appletPaperReportService.updateById(report); if (existingItem != null) { // 更新现有记录 @@ -685,6 +691,10 @@ public class AppletApiPaperServiceImpl implements AppletApiPaperService { } catch (NumberFormatException e) { throw new JeecgBootException("身高格式不正确,请输入有效的数字"); } + } else if (optionText.contains("sex")){ + report.setSex(userInput); + } else if (optionText.contains("age")){ + report.setAge(userInput); } } diff --git a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestions.java b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestions.java index 2d123df..def2b6e 100644 --- a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestions.java +++ b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestions.java @@ -77,8 +77,6 @@ public class AppletQuestions implements Serializable { @Schema(description = "排序") private java.lang.Double sort; /**关联标签*/ -// @Excel(name = "关联标签", width = 15, dicCode = "topic_associate_tag") -// @Dict(dicCode = "topic_associate_tag") @Schema(description = "关联标签") private java.lang.String needTag; /**触发器*/ diff --git a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestionsOptions.java b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestionsOptions.java index 07d3ab9..7bd0ac3 100644 --- a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestionsOptions.java +++ b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/entity/AppletQuestionsOptions.java @@ -85,8 +85,7 @@ public class AppletQuestionsOptions implements Serializable { @Schema(description = "产品") private java.lang.String productId; /**设置关联*/ - @Excel(name = "设置关联", width = 15, dicCode = "topic_associate_tag") - @Dict(dicCode = "topic_associate_tag") + @Excel(name = "设置关联", width = 15, dictTable = "applet_questions_tag", dicText = "title", dicCode = "id") @Schema(description = "设置关联") private java.lang.String settingTag; /**输入框类型*/ diff --git a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vo/AppletQuestionsPage.java b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vo/AppletQuestionsPage.java index 70ecc71..effd721 100644 --- a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vo/AppletQuestionsPage.java +++ b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vo/AppletQuestionsPage.java @@ -74,10 +74,16 @@ public class AppletQuestionsPage { @Schema(description = "排序") private java.lang.Integer sort; /**关联标签*/ - @Excel(name = "关联标签", width = 15, dicCode = "topic_associate_tag") - @Dict(dicCode = "topic_associate_tag") @Schema(description = "关联标签") private java.lang.String needTag; + /**多选*/ + @Excel(name = "多选", width = 15) + @Schema(description = "多选") + private java.lang.String multiple; + /**触发器*/ + @Excel(name = "触发器", width = 15, dictTable = "applet_question_trigger", dicText = "title", dicCode = "id") + @Schema(description = "触发器") + private java.lang.String triggerId; @ExcelCollection(name="题目选项") @Schema(description = "题目选项") diff --git a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vue3/AppletQuestions.data.ts b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vue3/AppletQuestions.data.ts index 2546232..83e13f3 100644 --- a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vue3/AppletQuestions.data.ts +++ b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaper/vue3/AppletQuestions.data.ts @@ -100,7 +100,9 @@ export const formSchema: FormSchema[] = [ field: 'needTag', component: 'JSelectMultiple', componentProps:{ - dictCode:"topic_associate_tag" + dictTable: "applet_questions_tag", + dictCode: "id", + dictText: "title" }, }, // TODO 主键隐藏字段,目前写死为ID @@ -221,15 +223,15 @@ export const appletQuestionsOptionsJVxeColumns: JVxeColumn[] = [ defaultValue:'', }, { - title: '设置关联', - key: 'settingTag', - type: JVxeTypes.selectMultiple, - options:[], - dictCode:"topic_associate_tag", - width:"250px", - placeholder: '请输入${title}', - defaultValue:'', - }, + title: '设置关联', + key: 'settingTag', + type: JVxeTypes.selectMultiple, + options:[], + dictCode:"applet_questions_tag,title,id", + width:"250px", + placeholder: '请输入${title}', + defaultValue:'', + }, ] // 高级查询数据 @@ -240,7 +242,7 @@ export const superQuerySchema = { required: {title: '必填',order: 3,view: 'switch', type: 'string',}, remark: {title: '备注',order: 4,view: 'text', type: 'string',}, sort: {title: '排序',order: 5,view: 'number', type: 'number',}, - needTag: {title: '关联标签',order: 6,view: 'list_multi', type: 'string',dictCode: 'topic_associate_tag',}, + needTag: {title: '关联标签',order: 6,view: 'list_multi', type: 'string',dictTable: 'applet_questions_tag', dictCode: 'id', dictText: 'title',}, //子表高级查询 appletQuestionsOptions: { title: '题目选项', @@ -253,7 +255,7 @@ export const superQuerySchema = { imageAfter: {title: '选中后图片',order: 4,view: 'text', type: 'string',}, schemeId: {title: '方案',order: 5,view: 'list_multi', type: 'string',dictTable: "applet_scheme", dictCode: 'id', dictText: 'title',}, productId: {title: '产品',order: 6,view: 'list_multi', type: 'string',dictTable: "applet_product", dictCode: 'id', dictText: 'name',}, - settingTag: {title: '设置关联',order: 7,view: 'list_multi', type: 'string',dictCode: 'topic_associate_tag',}, + settingTag: {title: '设置关联',order: 7,view: 'list_multi', type: 'string',dictTable: 'applet_questions_tag', dictCode: 'id', dictText: 'title',}, } }, }; diff --git a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaperReport/entity/AppletPaperReportItem.java b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaperReport/entity/AppletPaperReportItem.java index 6a8855e..6203b92 100644 --- a/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaperReport/entity/AppletPaperReportItem.java +++ b/jeecg-boot/jeecg-boot-module/jeecgboot-boot-applet/src/main/java/org/jeecg/modules/demo/appletPaperReport/entity/AppletPaperReportItem.java @@ -84,8 +84,7 @@ public class AppletPaperReportItem implements Serializable { @Schema(description = "触发器") private java.lang.String triggerId; /**设置关联*/ - @Excel(name = "设置标签", width = 15, dicCode = "topic_associate_tag") - @Dict(dicCode = "topic_associate_tag") + @Excel(name = "设置标签", width = 15, dictTable = "applet_questions_tag", dicText = "title", dicCode = "id") @Schema(description = "设置标签") private java.lang.String settingTag; /**得分*/ diff --git a/jeecgboot-vue3/src/views/applet/questions/AppletQuestions.data.ts b/jeecgboot-vue3/src/views/applet/questions/AppletQuestions.data.ts index ddf4aaf..6dfb64f 100644 --- a/jeecgboot-vue3/src/views/applet/questions/AppletQuestions.data.ts +++ b/jeecgboot-vue3/src/views/applet/questions/AppletQuestions.data.ts @@ -149,7 +149,7 @@ export const formSchema: FormSchema[] = [ field: 'needTag', component: 'CustomTagSelector', componentProps:{ - dictCode:"topic_associate_tag" + dictCode:"applet_questions_tags,title,id" }, }, // TODO 主键隐藏字段,目前写死为ID @@ -210,7 +210,7 @@ export const appletQuestionsOptionsColumns: BasicColumn[] = [ dataIndex: 'inputType_dictText' }, { - title: '输入框内容类型', + title: '内容关联', align:"center", dataIndex: 'inputContentType_dictText' }, @@ -284,7 +284,7 @@ export const appletQuestionsOptionsJVxeColumns: JVxeColumn[] = [ key: 'settingTag', type: JVxeTypes.selectMultiple, options:[], - dictCode:"topic_associate_tag", + dictCode:"applet_questions_tags,title,id", width:"250px", placeholder: '请输入${title}', defaultValue:'', @@ -329,7 +329,7 @@ export const superQuerySchema = { remark: {title: '备注',order: 5,view: 'text', type: 'string',}, sort: {title: '排序',order: 6,view: 'number', type: 'string',}, triggerId: {title: '触发器',order: 7,view: 'list_multi', type: 'string',dictCode: 'applet_question_trigger',}, - needTag: {title: '关联标签',order: 8,view: 'list_multi', type: 'string',dictCode: 'topic_associate_tag',}, + needTag: {title: '关联标签',order: 8,view: 'list_multi', type: 'string',dictTable: 'applet_questions_tags', dictCode: 'id', dictText: 'title',}, //子表高级查询 appletQuestionsOptions: { title: '题目选项', @@ -342,7 +342,7 @@ export const superQuerySchema = { imageAfter: {title: '选中后图片',order: 4,view: 'text', type: 'string',}, schemeId: {title: '方案',order: 5,view: 'list_multi', type: 'string',dictTable: "applet_scheme", dictCode: 'id', dictText: 'title',}, productId: {title: '产品',order: 6,view: 'list_multi', type: 'string',dictTable: "applet_product", dictCode: 'id', dictText: 'name',}, - settingTag: {title: '设置关联',order: 7,view: 'list_multi', type: 'string',dictCode: 'topic_associate_tag',}, + settingTag: {title: '设置关联',order: 7,view: 'list_multi', type: 'string',dictTable: 'applet_questions_tags', dictCode: 'id', dictText: 'title',}, inputType: {title: '输入框类型',order: 8,view: 'list', type: 'string',dictCode: 'applet_question_input_type',}, inputContentType: {title: '输入框内容类型',order: 9,view: 'list', type: 'string',dictCode: 'applet_question_input_content_type',}, } diff --git a/jeecgboot-vue3/src/views/applet/questions/components/CustomTagSelector.vue b/jeecgboot-vue3/src/views/applet/questions/components/CustomTagSelector.vue index e5e110b..3e64861 100644 --- a/jeecgboot-vue3/src/views/applet/questions/components/CustomTagSelector.vue +++ b/jeecgboot-vue3/src/views/applet/questions/components/CustomTagSelector.vue @@ -90,7 +90,7 @@ import { ref, watch, defineProps, defineEmits } from 'vue'; import { useRuleFormItem } from '/@/hooks/component/useFormItem'; import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue'; import { PlusOutlined, DeleteOutlined } from '@ant-design/icons-vue'; -import { filterDictTextByCache } from '/@/utils/dict/JDictSelectUtil'; +import { initDictOptions, filterDictText } from '/@/utils/dict/JDictSelectUtil'; interface TagItem { value: string; @@ -108,8 +108,8 @@ const props = defineProps({ }, dictCode: { type: String, - default: 'topic_associate_tag' - } + default: 'applet_questions_tag,title,id' + }, }); const emit = defineEmits(['update:value', 'change']); @@ -117,10 +117,22 @@ const props = defineProps({ const columns = ref([{ tags: [] }]); const emitData = ref([]); const availableTags = ref([]); + const dictOptions = ref([]); // 使用表单项规则 const [state] = useRuleFormItem(props, 'value', 'change', emitData); +// 初始化字典数据 +const initDictData = async () => { + try { + const options = await initDictOptions(props.dictCode); + dictOptions.value = options || []; + } catch (error) { + console.error('初始化字典数据失败:', error); + dictOptions.value = []; + } +}; + // 初始化数据 const initData = () => { console.log('CustomTagSelector initData - props.value:', props.value); @@ -162,6 +174,11 @@ watch(() => props.value, (newValue, oldValue) => { } }, { immediate: true }); +// 监听dictCode变化,重新加载字典数据 +watch(() => props.dictCode, () => { + initDictData(); +}, { immediate: true }); + // 添加列 const addColumn = () => { columns.value.push({ tags: [] }); @@ -214,7 +231,7 @@ const getTagValues = (columnTags: TagItem[]) => { // 获取字典文本显示 const getDictText = (value: string) => { - const dictText = filterDictTextByCache(props.dictCode, value); + const dictText = filterDictText(dictOptions.value, value); return dictText || value; };