From b06f6a316b6a8293bb8aba6bfff33336b66c032a Mon Sep 17 00:00:00 2001 From: ahaos <8406649+lhailgl@user.noreply.gitee.com> Date: 星期三, 13 十二月 2023 09:01:52 +0800 Subject: [PATCH] !64 版本升级 * Merge branch 'dev' of gitee.com:JavaLionLi/plus-ui into ts * 升级依赖 * !61 fix: 删除重复环境变量ElUploadInstance * fix: 删除重复环境变量ElUploadInstance --- src/views/tool/gen/genInfoForm.vue | 163 ++++++++++++++++++++++++++++-------------------------- 1 files changed, 84 insertions(+), 79 deletions(-) diff --git a/src/views/tool/gen/genInfoForm.vue b/src/views/tool/gen/genInfoForm.vue index 70fb36f..84e1d90 100644 --- a/src/views/tool/gen/genInfoForm.vue +++ b/src/views/tool/gen/genInfoForm.vue @@ -1,76 +1,3 @@ -<script setup lang="ts"> -import { listMenu } from '@/api/system/menu'; -import { ComponentInternalInstance, PropType } from 'vue'; - -interface MenuOptionsType { - menuId: number; - menuName: string; - children: MenuOptionsType[] | undefined; -} - -const subColumns = ref<any>([]); -const menuOptions = ref<Array<MenuOptionsType>>([]); -const { proxy } = getCurrentInstance() as ComponentInternalInstance; - -const props = defineProps({ - info: { - type: Object as PropType<any>, - default: null - }, - tables: { - type: Array as PropType<any[]>, - default: null - } -}); - -const infoForm = computed(() => props.info); - -const table = computed(() => props.tables); - -// 琛ㄥ崟鏍¢獙 -const rules = ref({ - tplCategory: [{ required: true, message: "璇烽�夋嫨鐢熸垚妯℃澘", trigger: "blur" }], - packageName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愬寘璺緞", trigger: "blur" }], - moduleName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愭ā鍧楀悕", trigger: "blur" }], - businessName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愪笟鍔″悕", trigger: "blur" }], - functionName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愬姛鑳藉悕", trigger: "blur" }] -}); -const subSelectChange = () => { - infoForm.value.subTableFkName = ""; -} -const tplSelectChange = (value: string) => { - if (value !== "sub") { - infoForm.value.subTableName = ""; - infoForm.value.subTableFkName = ""; - } -} -const setSubTableColumns = (value: string) => { - table.value.forEach(item => { - const name = item.tableName; - if (value === name) { - subColumns.value = item.columns; - return; - } - }) -} -/** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ -const getMenuTreeselect = async () => { - const res = await listMenu(); - const data = proxy?.handleTree<MenuOptionsType>(res.data, "menuId"); - if (data) { - menuOptions.value = data - } -} - -watch(() => props.info.subTableName, val => { - setSubTableColumns(val); -}); - -onMounted(() => { - getMenuTreeselect(); -}) -</script> - <template> <el-form ref="genInfoForm" :model="infoForm" :rules="rules" label-width="150px"> <el-row> @@ -140,11 +67,17 @@ <el-icon><question-filled /></el-icon> </el-tooltip> </template> - <tree-select - v-model:value="infoForm.parentMenuId" - :options="menuOptions" - :objMap="{ value: 'menuId', label: 'menuName', children: 'children' }" - placeholder="璇烽�夋嫨绯荤粺鑿滃崟" + <el-tree-select + v-model="infoForm.parentMenuId" + :data="menuOptions" + :props="{ value: 'menuId', label: 'menuName', children: 'children' }" + value-key="menuId" + node-key="menuId" + placeholder="閫夋嫨涓婄骇鑿滃崟" + check-strictly + filterable + clearable + highlight-current /> </el-form-item> </el-col> @@ -162,7 +95,7 @@ </el-form-item> </el-col> - <el-col :span="24" v-if="infoForm.genType == '1'"> + <el-col v-if="infoForm.genType == '1'" :span="24"> <el-form-item prop="genPath"> <template #label> 鑷畾涔夎矾寰� @@ -287,3 +220,75 @@ </template> </el-form> </template> + +<script setup lang="ts"> +import { listMenu } from '@/api/system/menu'; +import { propTypes } from '@/utils/propTypes'; + +interface MenuOptionsType { + menuId: number | string; + menuName: string; + children: MenuOptionsType[] | undefined; +} + +const subColumns = ref<any>([]); +const menuOptions = ref<Array<MenuOptionsType>>([]); +const { proxy } = getCurrentInstance() as ComponentInternalInstance; + +const props = defineProps({ + info: propTypes.any.def(null), + tables: propTypes.any.def(null) +}); + +const infoForm = computed(() => props.info); + +const table = computed(() => props.tables); + +// 琛ㄥ崟鏍¢獙 +const rules = ref({ + tplCategory: [{ required: true, message: '璇烽�夋嫨鐢熸垚妯℃澘', trigger: 'blur' }], + packageName: [{ required: true, message: '璇疯緭鍏ョ敓鎴愬寘璺緞', trigger: 'blur' }], + moduleName: [{ required: true, message: '璇疯緭鍏ョ敓鎴愭ā鍧楀悕', trigger: 'blur' }], + businessName: [{ required: true, message: '璇疯緭鍏ョ敓鎴愪笟鍔″悕', trigger: 'blur' }], + functionName: [{ required: true, message: '璇疯緭鍏ョ敓鎴愬姛鑳藉悕', trigger: 'blur' }] +}); +const subSelectChange = () => { + infoForm.value.subTableFkName = ''; +}; +const tplSelectChange = (value: string) => { + if (value !== 'sub') { + infoForm.value.subTableName = ''; + infoForm.value.subTableFkName = ''; + } +}; +const setSubTableColumns = (value: string) => { + table.value.forEach((item: any) => { + const name = item.tableName; + if (value === name) { + subColumns.value = item.columns; + return; + } + }); +}; + +/** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ +const getMenuTreeselect = async () => { + const res = await listMenu(); + res.data.forEach((m) => (m.menuId = m.menuId.toString())); + const data = proxy?.handleTree<MenuOptionsType>(res.data, 'menuId'); + if (data) { + menuOptions.value = data; + } +}; + +watch( + () => props.info.subTableName, + (val) => { + setSubTableColumns(val); + } +); + +onMounted(() => { + getMenuTreeselect(); +}); +</script> -- Gitblit v1.9.3