Commit aa983a6fa978fe12efa8bb02156362c09c5a881c

Authored by xingyu
1 parent ff938a9e

fix: 代码生成器

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