Commit aa983a6fa978fe12efa8bb02156362c09c5a881c

Authored by xingyu
1 parent ff938a9e

fix: 代码生成器

yudao-ui-admin-vue3/src/components/ContextMenu/src/ContextMenu.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus' 2 import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus'
3 -import { PropType, ref } from 'vue' 3 +import { PropType, ref, defineEmits } from 'vue'
4 import { useI18n } from '@/hooks/web/useI18n' 4 import { useI18n } from '@/hooks/web/useI18n'
5 import { useDesign } from '@/hooks/web/useDesign' 5 import { useDesign } from '@/hooks/web/useDesign'
6 import type { RouteLocationNormalizedLoaded } from 'vue-router' 6 import type { RouteLocationNormalizedLoaded } from 'vue-router'
yudao-ui-admin-vue3/src/components/CountTo/src/CountTo.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 -import { reactive, computed, watch, onMounted, unref, toRef, PropType } from 'vue' 2 +import { reactive, computed, watch, onMounted, unref, toRef, PropType, defineEmits } from 'vue'
3 import { isNumber } from '@/utils/is' 3 import { isNumber } from '@/utils/is'
4 import { propTypes } from '@/utils/propTypes' 4 import { propTypes } from '@/utils/propTypes'
5 import { useDesign } from '@/hooks/web/useDesign' 5 import { useDesign } from '@/hooks/web/useDesign'
yudao-ui-admin-vue3/src/components/Crontab/src/Crontab.vue
@@ -24,7 +24,7 @@ import { @@ -24,7 +24,7 @@ import {
24 ElRadioButton, 24 ElRadioButton,
25 ElMessage 25 ElMessage
26 } from 'element-plus' 26 } from 'element-plus'
27 -import { ref, computed, onMounted, reactive, watch, PropType } from 'vue' 27 +import { ref, computed, onMounted, reactive, watch, PropType, defineEmits } from 'vue'
28 interface shortcutsType { 28 interface shortcutsType {
29 text: string 29 text: string
30 value: string 30 value: string
yudao-ui-admin-vue3/src/components/Error/src/Error.vue
@@ -4,6 +4,7 @@ import networkError from &#39;@/assets/svgs/500.svg&#39; @@ -4,6 +4,7 @@ import networkError from &#39;@/assets/svgs/500.svg&#39;
4 import noPermission from '@/assets/svgs/403.svg' 4 import noPermission from '@/assets/svgs/403.svg'
5 import { propTypes } from '@/utils/propTypes' 5 import { propTypes } from '@/utils/propTypes'
6 import { useI18n } from '@/hooks/web/useI18n' 6 import { useI18n } from '@/hooks/web/useI18n'
  7 +import { defineEmits } from 'vue'
7 8
8 interface ErrorMap { 9 interface ErrorMap {
9 url: string 10 url: string
yudao-ui-admin-vue3/src/components/Icon/src/IconSelect.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { cloneDeep } from 'lodash-es' 2 import { cloneDeep } from 'lodash-es'
3 -import { ref, computed, CSSProperties, toRef, watch } from 'vue' 3 +import { ref, computed, CSSProperties, toRef, watch, defineEmits } from 'vue'
4 import { 4 import {
5 ElInput, 5 ElInput,
6 ElPopover, 6 ElPopover,
yudao-ui-admin-vue3/src/components/Infotip/src/Infotip.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 -import { PropType } from 'vue' 2 +import { PropType, defineEmits } from 'vue'
3 import { Highlight } from '@/components/Highlight' 3 import { Highlight } from '@/components/Highlight'
4 import { useDesign } from '@/hooks/web/useDesign' 4 import { useDesign } from '@/hooks/web/useDesign'
5 import { propTypes } from '@/utils/propTypes' 5 import { propTypes } from '@/utils/propTypes'
yudao-ui-admin-vue3/src/components/InputPassword/src/InputPassword.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 -import { ref, unref, computed, watch } from 'vue' 2 +import { ref, unref, computed, watch, defineEmits } from 'vue'
3 import { ElInput } from 'element-plus' 3 import { ElInput } from 'element-plus'
4 import { propTypes } from '@/utils/propTypes' 4 import { propTypes } from '@/utils/propTypes'
5 import { useConfigGlobal } from '@/hooks/web/useConfigGlobal' 5 import { useConfigGlobal } from '@/hooks/web/useConfigGlobal'
yudao-ui-admin-vue3/src/components/Qrcode/src/Qrcode.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 -import { PropType, nextTick, ref, watch, computed, unref } from 'vue' 2 +import { PropType, nextTick, ref, watch, computed, unref, defineEmits } from 'vue'
3 import QRCode from 'qrcode' 3 import QRCode from 'qrcode'
4 import { QRCodeRenderersOptions } from 'qrcode' 4 import { QRCodeRenderersOptions } from 'qrcode'
5 import { cloneDeep } from 'lodash-es' 5 import { cloneDeep } from 'lodash-es'
yudao-ui-admin-vue3/src/components/Search/src/Search.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import { Form } from '@/components/Form' 2 import { Form } from '@/components/Form'
3 -import { PropType, computed, unref, ref } from 'vue' 3 +import { PropType, computed, unref, ref, defineEmits } from 'vue'
4 import { propTypes } from '@/utils/propTypes' 4 import { propTypes } from '@/utils/propTypes'
5 import { ElButton } from 'element-plus' 5 import { ElButton } from 'element-plus'
6 import { useI18n } from '@/hooks/web/useI18n' 6 import { useI18n } from '@/hooks/web/useI18n'
yudao-ui-admin-vue3/src/components/Setting/src/components/ColorRadioPicker.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 -import { PropType, watch, unref, ref } from 'vue' 2 +import { PropType, watch, unref, ref, defineEmits } from 'vue'
3 import { propTypes } from '@/utils/propTypes' 3 import { propTypes } from '@/utils/propTypes'
4 import { useDesign } from '@/hooks/web/useDesign' 4 import { useDesign } from '@/hooks/web/useDesign'
5 5
yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue
@@ -26,6 +26,10 @@ const activeName = ref(&#39;cloum&#39;) @@ -26,6 +26,10 @@ const activeName = ref(&#39;cloum&#39;)
26 const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>() 26 const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>()
27 const genInfoRef = ref<ComponentRef<typeof GenInfoForm>>() 27 const genInfoRef = ref<ComponentRef<typeof GenInfoForm>>()
28 const cloumInfoRef = ref(null) 28 const cloumInfoRef = ref(null)
  29 +const parentMenuId = ref<number>()
  30 +const menu = (id: number) => {
  31 + parentMenuId.value = id
  32 +}
29 const submitForm = async () => { 33 const submitForm = async () => {
30 const basicInfo = unref(basicInfoRef) 34 const basicInfo = unref(basicInfoRef)
31 const genInfo = unref(genInfoRef) 35 const genInfo = unref(genInfoRef)
@@ -38,6 +42,11 @@ const submitForm = async () =&gt; { @@ -38,6 +42,11 @@ const submitForm = async () =&gt; {
38 table: Object.assign({}, basicInfoData, genInfoData), 42 table: Object.assign({}, basicInfoData, genInfoData),
39 columns: cloumCurrentRow.value 43 columns: cloumCurrentRow.value
40 } 44 }
  45 + if (parentMenuId.value) {
  46 + genInfoData.parentMenuId = parentMenuId.value
  47 + } else {
  48 + genInfoData.parentMenuId = 0
  49 + }
41 await updateCodegenTableApi(genTable) 50 await updateCodegenTableApi(genTable)
42 ElMessage.success(t('common.updateSuccess')) 51 ElMessage.success(t('common.updateSuccess'))
43 push('/infra/codegen') 52 push('/infra/codegen')
@@ -57,7 +66,7 @@ onMounted(() =&gt; { @@ -57,7 +66,7 @@ onMounted(() =&gt; {
57 <CloumInfoForm ref="cloumInfoRef" :info="cloumCurrentRow" /> 66 <CloumInfoForm ref="cloumInfoRef" :info="cloumCurrentRow" />
58 </el-tab-pane> 67 </el-tab-pane>
59 <el-tab-pane label="生成信息" name="genInfo"> 68 <el-tab-pane label="生成信息" name="genInfo">
60 - <GenInfoForm ref="genInfoRef" :genInfo="tableCurrentRow" /> 69 + <GenInfoForm ref="genInfoRef" :genInfo="tableCurrentRow" @menu="menu" />
61 </el-tab-pane> 70 </el-tab-pane>
62 </el-tabs> 71 </el-tabs>
63 <template #right> 72 <template #right>
yudao-ui-admin-vue3/src/views/infra/codegen/components/GenInfoForm.vue
@@ -15,7 +15,8 @@ const props = defineProps({ @@ -15,7 +15,8 @@ const props = defineProps({
15 default: () => null 15 default: () => null
16 } 16 }
17 }) 17 })
18 -const defaultProps = { 18 +const menuProps = {
  19 + checkStrictly: true,
19 children: 'children', 20 children: 'children',
20 label: 'name', 21 label: 'name',
21 value: 'id' 22 value: 'id'
@@ -31,7 +32,6 @@ const rules = reactive({ @@ -31,7 +32,6 @@ const rules = reactive({
31 }) 32 })
32 const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE) 33 const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
33 const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE) 34 const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
34 -const parentMenuId = ref()  
35 const treeRef = ref<InstanceType<typeof ElTreeSelect>>() 35 const treeRef = ref<InstanceType<typeof ElTreeSelect>>()
36 const menuOptions = ref<any>([]) // 树形结构 36 const menuOptions = ref<any>([]) // 树形结构
37 const getTree = async () => { 37 const getTree = async () => {
@@ -112,9 +112,13 @@ const schema = reactive&lt;FormSchema[]&gt;([ @@ -112,9 +112,13 @@ const schema = reactive&lt;FormSchema[]&gt;([
112 const { register, methods, elFormRef } = useForm({ 112 const { register, methods, elFormRef } = useForm({
113 schema 113 schema
114 }) 114 })
  115 +const parentMenuId = ref<number>()
  116 +//子组件像父组件传值
  117 +const emit = defineEmits(['menu'])
115 const handleNodeClick = () => { 118 const handleNodeClick = () => {
116 - console.log(parentMenuId.value) 119 + emit('menu', parentMenuId.value)
117 } 120 }
  121 +
118 // ========== 初始化 ========== 122 // ========== 初始化 ==========
119 onMounted(async () => { 123 onMounted(async () => {
120 await getTree() 124 await getTree()
@@ -143,10 +147,9 @@ defineExpose({ @@ -143,10 +147,9 @@ defineExpose({
143 v-model="parentMenuId" 147 v-model="parentMenuId"
144 ref="treeRef" 148 ref="treeRef"
145 node-key="id" 149 node-key="id"
146 - check-on-click-node  
147 - expand-on-click-node="false"  
148 - :props="defaultProps" 150 + :props="menuProps"
149 :data="menuOptions" 151 :data="menuOptions"
  152 + check-strictly
150 @node-click="handleNodeClick" 153 @node-click="handleNodeClick"
151 /> 154 />
152 </template> 155 </template>
yudao-ui-admin-vue3/src/views/infra/codegen/components/ImportTable.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 -import { reactive, ref } from 'vue' 2 +import { reactive, ref, defineEmits } from 'vue'
3 import { getSchemaTableListApi, createCodegenListApi } from '@/api/infra/codegen' 3 import { getSchemaTableListApi, createCodegenListApi } from '@/api/infra/codegen'
4 import { 4 import {
5 ElMessage, 5 ElMessage,
yudao-ui-admin-vue3/src/views/system/tenant/index.vue
@@ -150,7 +150,6 @@ onMounted(async () =&gt; { @@ -150,7 +150,6 @@ onMounted(async () =&gt; {
150 <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" /> 150 <DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
151 </template> 151 </template>
152 <template #packageId="{ row }"> 152 <template #packageId="{ row }">
153 - <!-- <DictTag :type="DICT_TYPE.SYSTEM_TENANT_PACKAGE_ID" :value="row.packageId" />-->  
154 <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag> 153 <el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag>
155 <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag> 154 <el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag>
156 </template> 155 </template>
@@ -161,7 +160,6 @@ onMounted(async () =&gt; { @@ -161,7 +160,6 @@ onMounted(async () =&gt; {
161 <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span> 160 <span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
162 </template> 161 </template>
163 <template #action="{ row }"> 162 <template #action="{ row }">
164 - <!-- <el-button type="text" v-hasPermi="['system:tenant:update']" @click="handleUpdate(row)">-->  
165 <el-button 163 <el-button
166 link 164 link
167 type="primary" 165 type="primary"