Commit c3337f21cebf86eae18b1ad9186e3d03b98840c4

Authored by puhui999
1 parent c4ff0a10

fix:主子表 props

yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/components/list_sub_erp.vue.vm
@@ -94,7 +94,7 @@ const { t } = useI18n() // 国际化 @@ -94,7 +94,7 @@ const { t } = useI18n() // 国际化
94 const message = useMessage() // 消息弹窗 94 const message = useMessage() // 消息弹窗
95 95
96 const props = defineProps<{ 96 const props = defineProps<{
97 - ${subJoinColumn.javaField}: undefined // ${subJoinColumn.columnComment}(主表的关联字段) 97 + ${subJoinColumn.javaField}?: number // ${subJoinColumn.columnComment}(主表的关联字段)
98 }>() 98 }>()
99 const loading = ref(false) // 列表的加载中 99 const loading = ref(false) // 列表的加载中
100 const list = ref([]) // 列表的数据 100 const list = ref([]) // 列表的数据
@@ -103,17 +103,20 @@ const total = ref(0) // 列表的总页数 @@ -103,17 +103,20 @@ const total = ref(0) // 列表的总页数
103 const queryParams = reactive({ 103 const queryParams = reactive({
104 pageNo: 1, 104 pageNo: 1,
105 pageSize: 10, 105 pageSize: 10,
106 - ${subJoinColumn.javaField}: undefined 106 + ${subJoinColumn.javaField}: undefined as unknown
107 }) 107 })
108 108
109 /** 监听主表的关联字段的变化,加载对应的子表数据 */ 109 /** 监听主表的关联字段的变化,加载对应的子表数据 */
110 watch( 110 watch(
111 () => props.${subJoinColumn.javaField}, 111 () => props.${subJoinColumn.javaField},
112 - (val) => { 112 + (val: number) => {
  113 + if (!val) {
  114 + return
  115 + }
113 queryParams.${subJoinColumn.javaField} = val 116 queryParams.${subJoinColumn.javaField} = val
114 handleQuery() 117 handleQuery()
115 }, 118 },
116 - { immediate: false } 119 + { immediate: true, deep: true }
117 ) 120 )
118 #end 121 #end
119 122