From bf4a8543ca9f4e9ef6d13f78385f5c0f30255dc0 Mon Sep 17 00:00:00 2001 From: LiuHao <liuhaoai545@gmail.com> Date: 星期六, 06 五月 2023 09:25:05 +0800 Subject: [PATCH] Merge branch 'ts' into dev --- src/components/ImageUpload/index.vue | 2 src/views/system/role/index.vue | 2 src/assets/styles/sidebar.scss | 2 src/types/router.d.ts | 1 src/components/DictTag/index.vue | 90 +++++++++--- src/plugins/download.ts | 2 src/views/system/dept/index.vue | 2 src/layout/index.vue | 42 ++--- src/layout/components/TagsView/index.vue | 3 src/components/Editor/index.vue | 2 src/api/system/ossConfig/index.ts | 12 src/components/IconSelect/index.vue | 45 +++--- src/views/system/user/index.vue | 2 src/views/tool/gen/genInfoForm.vue | 69 +++++---- src/views/system/role/authUser.vue | 2 src/layout/components/TagsView/ScrollPane.vue | 2 package.json | 2 src/views/tool/gen/editTable.vue | 79 +++++----- src/components/TopNav/index.vue | 10 + src/layout/components/AppMain.vue | 22 +++ src/api/system/oss/index.ts | 6 src/router/index.ts | 2 src/components/FileUpload/index.vue | 2 23 files changed, 239 insertions(+), 164 deletions(-) diff --git a/package.json b/package.json index 3879a32..b629327 100644 --- a/package.json +++ b/package.json @@ -70,11 +70,11 @@ "unplugin-auto-import": "0.13.0", "unplugin-icons": "0.15.1", "unplugin-vue-components": "0.23.0", - "vite": "4.3.1", "vite-plugin-compression": "0.5.1", "vite-plugin-svg-icons": "2.0.1", "vite-plugin-vue-setup-extend": "^0.4.0", "vitest": "^0.29.7", + "vite": "4.3.1", "vue-eslint-parser": "9.1.0", "vue-tsc": "0.35.0" } diff --git a/src/api/system/oss/index.ts b/src/api/system/oss/index.ts index 6821d4e..4472112 100644 --- a/src/api/system/oss/index.ts +++ b/src/api/system/oss/index.ts @@ -5,7 +5,7 @@ // 鏌ヨOSS瀵硅薄瀛樺偍鍒楄〃 export function listOss(query: OssQuery): AxiosPromise<OssVO[]> { return request({ - url: '/system/oss/list', + url: '/resource/oss/list', method: 'get', params: query }); @@ -14,7 +14,7 @@ // 鏌ヨOSS瀵硅薄鍩轰簬id涓� export function listByIds(ossId: string | number): AxiosPromise<OssVO[]> { return request({ - url: '/system/oss/listByIds/' + ossId, + url: '/resource/oss/listByIds/' + ossId, method: 'get' }); } @@ -22,7 +22,7 @@ // 鍒犻櫎OSS瀵硅薄瀛樺偍 export function delOss(ossId: string | number | Array<string | number>) { return request({ - url: '/system/oss/' + ossId, + url: '/resource/oss/' + ossId, method: 'delete' }); } diff --git a/src/api/system/ossConfig/index.ts b/src/api/system/ossConfig/index.ts index b9ff537..d0faefe 100644 --- a/src/api/system/ossConfig/index.ts +++ b/src/api/system/ossConfig/index.ts @@ -5,7 +5,7 @@ // 鏌ヨ瀵硅薄瀛樺偍閰嶇疆鍒楄〃 export function listOssConfig(query: OssConfigQuery): AxiosPromise<OssConfigVO[]> { return request({ - url: '/system/oss/config/list', + url: '/resource/oss/config/list', method: 'get', params: query }); @@ -14,7 +14,7 @@ // 鏌ヨ瀵硅薄瀛樺偍閰嶇疆璇︾粏 export function getOssConfig(ossConfigId: string | number): AxiosPromise<OssConfigVO> { return request({ - url: '/system/oss/config/' + ossConfigId, + url: '/resource/oss/config/' + ossConfigId, method: 'get' }); } @@ -22,7 +22,7 @@ // 鏂板瀵硅薄瀛樺偍閰嶇疆 export function addOssConfig(data: OssConfigForm) { return request({ - url: '/system/oss/config', + url: '/resource/oss/config', method: 'post', data: data }); @@ -31,7 +31,7 @@ // 淇敼瀵硅薄瀛樺偍閰嶇疆 export function updateOssConfig(data: OssConfigForm) { return request({ - url: '/system/oss/config', + url: '/resource/oss/config', method: 'put', data: data }); @@ -40,7 +40,7 @@ // 鍒犻櫎瀵硅薄瀛樺偍閰嶇疆 export function delOssConfig(ossConfigId: string | number | Array<string | number>) { return request({ - url: '/system/oss/config/' + ossConfigId, + url: '/resource/oss/config/' + ossConfigId, method: 'delete' }); } @@ -53,7 +53,7 @@ configKey }; return request({ - url: '/system/oss/config/changeStatus', + url: '/resource/oss/config/changeStatus', method: 'put', data: data }); diff --git a/src/assets/styles/sidebar.scss b/src/assets/styles/sidebar.scss index 2d11eaf..06bf057 100644 --- a/src/assets/styles/sidebar.scss +++ b/src/assets/styles/sidebar.scss @@ -1,6 +1,6 @@ #app { .main-container { - min-height: 100%; + height: 100%; transition: margin-left 0.28s; margin-left: $base-sidebar-width; position: relative; diff --git a/src/components/DictTag/index.vue b/src/components/DictTag/index.vue index 827a7af..f27b16a 100644 --- a/src/components/DictTag/index.vue +++ b/src/components/DictTag/index.vue @@ -2,13 +2,9 @@ <div> <template v-for="(item, index) in options"> <template v-if="values.includes(item.value)"> - <span - v-if="item.elTagType == 'default' || item.elTagType == ''" - :key="item.value" - :index="index" - :class="item.elTagClass" - >{{ item.label }}</span - > + <span v-if="item.elTagType == 'default' || item.elTagType == ''" :key="item.value" :index="index" :class="item.elTagClass"> + {{ item.label + " " }} + </span> <el-tag v-else :disable-transitions="true" @@ -16,9 +12,13 @@ :index="index" :type="item.elTagType === 'primary' ? '' : item.elTagType" :class="item.elTagClass" - >{{ item.label }}</el-tag > + {{ item.label + " " }} + </el-tag> </template> + </template> + <template v-if="unmatch && showValue"> + {{ unmatchArray }} </template> </div> </template> @@ -26,23 +26,71 @@ <script setup lang="ts"> import { PropType } from 'vue'; + const props = defineProps({ - // 鏁版嵁 - options: { - type: Array as PropType<DictDataOption[]>, - default: null, - }, - // 褰撳墠鐨勫�� - value: [Number, String, Array], -}) + // 鏁版嵁 + options: { + type: Array as PropType<DictDataOption[]>, + default: null, + }, + // 褰撳墠鐨勫�� + value: [Number, String, Array] as PropType<number | string | Array<number | string>>, + // 褰撴湭鎵惧埌鍖归厤鐨勬暟鎹椂锛屾樉绀簐alue + showValue: { + type: Boolean as PropType<boolean>, + default: true, + }, +}); const values = computed(() => { - if (props.value !== null && typeof props.value !== 'undefined') { - return Array.isArray(props.value) ? props.value : [String(props.value)]; - } else { - return []; + if (props.value !== null && typeof props.value !== "undefined") { + return Array.isArray(props.value) ? props.value : [String(props.value)]; + } else { + return []; + } +}); + +const unmatch = computed(() => { + if (props.value !== null && typeof props.value !== "undefined") { + // 浼犲叆鍊间负闈炴暟缁� + if (!Array.isArray(props.value)) { + if (props.options.some((v) => v.value == props.value)) { + return false; + } + return true; } -}) + return true; + } + // 娌℃湁value涓嶆樉绀� + return false; +}); + +const unmatchArray = computed(() => { +// 璁板綍鏈尮閰嶇殑椤� + const itemUnmatchArray: Array<string | number> = []; + if (props.value !== null && typeof props.value !== "undefined") { + // 浼犲叆鍊间负闈炴暟缁� + if (!Array.isArray(props.value)) { + itemUnmatchArray.push(props.value); + } else { + // 浼犲叆鍊间负Array + props.value.forEach((item) => { + if (!props.options.some((v) => v.value == item)) { + itemUnmatchArray.push(item); + } + }); + } + } + // 娌℃湁value涓嶆樉绀� + return handleArray(itemUnmatchArray); +}); + +const handleArray = (array: Array<string | number>) => { + if (array.length === 0) return ""; + return array.reduce((pre, cur) => { + return pre + " " + cur; + }); +} </script> <style scoped> diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index e250050..a0728eb 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -68,7 +68,7 @@ const upload = reactive<UploadOption>({ headers: { Authorization: "Bearer " + getToken() }, - url: import.meta.env.VITE_APP_BASE_API + '/system/oss/upload' + url: import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload' }) const myQuillEditor = ref(); diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 9d8f742..a46d5ee 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -78,7 +78,7 @@ const uploadList = ref<any[]>([]); const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadFileUrl = ref(baseUrl + "/system/oss/upload"); // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧� +const uploadFileUrl = ref(baseUrl + "/resource/oss/upload"); // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧� const headers = ref({ Authorization: "Bearer " + getToken() }); const fileList = ref<any[]>([]); diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 330c44f..22b9484 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -2,7 +2,7 @@ <div class="relative" :style="{ width: width }"> <el-input v-model="modelValue" readonly @click="visible = !visible" placeholder="鐐瑰嚮閫夋嫨鍥炬爣"> <template #prepend> - <svg-icon :icon-class="modelValue as string"></svg-icon> + <svg-icon :icon-class="modelValue as string" /> </template> </el-input> @@ -19,7 +19,7 @@ <el-scrollbar height="w-[200px]"> <ul class="icon-list"> <el-tooltip v-for="(iconName, index) in iconNames" :key="index" :content="iconName" placement="bottom" effect="light"> - <li class="icon-item" @click="selectedIcon(iconName)"> + <li :class="['icon-item', {active: modelValue == iconName}]" @click="selectedIcon(iconName)"> <svg-icon color="var(--el-text-color-regular)" :icon-class="iconName" /> </li> </el-tooltip> @@ -33,15 +33,15 @@ import icons from '@/components/IconSelect/requireIcons'; const props = defineProps({ - modelValue: { - type: String, - require: true - }, - width: { - type: String, - require: false, - default: '400px' - } + modelValue: { + type: String, + require: true + }, + width: { + type: String, + require: false, + default: '400px' + } }); const emit = defineEmits(['update:modelValue']); @@ -55,22 +55,21 @@ * 绛涢�夊浘鏍� */ const filterIcons = () => { - if (filterValue.value) { - iconNames.value = icons.filter(iconName => - iconName.includes(filterValue.value) - ); - } else { - iconNames.value = icons; - } + if (filterValue.value) { + iconNames.value = icons.filter(iconName => + iconName.includes(filterValue.value) + ); + } else { + iconNames.value = icons; + } } - /** * 閫夋嫨鍥炬爣 * @param iconName 閫夋嫨鐨勫浘鏍囧悕绉� */ const selectedIcon = (iconName: string) => { - emit('update:modelValue', iconName); - visible.value = false; + emit('update:modelValue', iconName); + visible.value = false; } </script> @@ -101,5 +100,9 @@ transform: scaleX(1.1); } } + .active { + border-color: var(--el-color-primary); + color: var(--el-color-primary); + } } </style> diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 57697fa..0791f3e 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -76,7 +76,7 @@ const dialogVisible = ref(false); const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadImgUrl = ref(baseUrl + "/system/oss/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 +const uploadImgUrl = ref(baseUrl + "/resource/oss/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 const headers = ref({ Authorization: "Bearer " + getToken() }); const fileList = ref<any[]>([]); diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index 79b7786..2092415 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -104,7 +104,7 @@ visibleNumber.value = parseInt(String(width / 85)); } -const handleSelect = (key: string, keyPath: string[]) => { +const handleSelect = (key: string) => { currentIndex.value = key; const route = routers.value.find(item => item.path === key); if (isHttp(key)) { @@ -112,7 +112,13 @@ window.open(key, "_blank"); } else if (!route || !route.children) { // 娌℃湁瀛愯矾鐢辫矾寰勫唴閮ㄦ墦寮� - router.push({ path: key, fullPath: '' }); + const routeMenu = childrenMenus.value.find(item => item.path === key); + if (routeMenu && routeMenu.query) { + let query = JSON.parse(routeMenu.query); + router.push({ path: key, query: query }); + } else { + router.push({ path: key }); + } appStore.toggleSideBarHide(true); } else { // 鏄剧ず宸︿晶鑱斿姩鑿滃崟 diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index 463224d..8a73232 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -56,3 +56,25 @@ } } </style> +<style lang="scss"> +// fix css style bug in open el-dialog +.el-popup-parent--hidden { + .fixed-header { + padding-right: 6px; + } +} + +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +::-webkit-scrollbar-track { + background-color: #f1f1f1; +} + +::-webkit-scrollbar-thumb { + background-color: #c0c0c0; + border-radius: 3px; +} +</style> diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue index e4624dc..64d9fdb 100644 --- a/src/layout/components/TagsView/ScrollPane.vue +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -96,7 +96,7 @@ bottom: 0px; } :deep(.el-scrollbar__wrap) { - height: 49px; + height: 39px; } } </style> diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index d82ddf9..467081e 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -246,9 +246,10 @@ position: relative; cursor: pointer; height: 26px; - line-height: 26px; + line-height: 23px; background-color: var(--el-bg-color); border: 1px solid var(--el-border-color-light); + color: #495060; padding: 0 8px; font-size: 12px; margin-left: 5px; diff --git a/src/layout/index.vue b/src/layout/index.vue index 4c6ab94..5c01f90 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,17 +1,23 @@ <template> <div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }"> - <el-scrollbar> - <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside"/> - <side-bar v-if="!sidebar.hide" class="sidebar-container" /> - <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container"> + <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> + <side-bar v-if="!sidebar.hide" class="sidebar-container" /> + <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container"> + <!-- <el-scrollbar> <div :class="{ 'fixed-header': fixedHeader }"> - <navbar ref="navbarRef" @setLayout="setLayout" /> - <tags-view v-if="needTagsView" /> + <navbar ref="navbarRef" @setLayout="setLayout" /> + <tags-view v-if="needTagsView" /> </div> <app-main /> <settings ref="settingRef" /> + </el-scrollbar> --> + <div :class="{ 'fixed-header': fixedHeader }"> + <navbar ref="navbarRef" @setLayout="setLayout" /> + <tags-view v-if="needTagsView" /> </div> - </el-scrollbar> + <app-main /> + <settings ref="settingRef" /> + </div> </div> </template> @@ -54,17 +60,17 @@ const settingRef = ref(Settings); onMounted(() => { - nextTick(() => { - navbarRef.value.initTenantList(); - }) + nextTick(() => { + navbarRef.value.initTenantList(); + }) }) const handleClickOutside = () => { - useAppStore().closeSideBar({ withoutAnimation: false }) + useAppStore().closeSideBar({ withoutAnimation: false }) } const setLayout = () => { - settingRef.value.openSetting(); + settingRef.value.openSetting(); } </script> @@ -77,18 +83,6 @@ position: relative; height: 100%; width: 100%; - - .el-scrollbar { - height: 100%; - } - - :deep(.el-scrollbar__bar).is-vertical { - z-index: 10; - } - - :deep(.el-scrollbar__wrap) { - overflow-x: hidden; - } &.mobile.openSidebar { position: fixed; diff --git a/src/plugins/download.ts b/src/plugins/download.ts index 2640763..e1c4414 100644 --- a/src/plugins/download.ts +++ b/src/plugins/download.ts @@ -9,7 +9,7 @@ let downloadLoadingInstance: LoadingInstance; export default { async oss(ossId: string | number) { - const url = baseURL + '/system/oss/download/' + ossId; + const url = baseURL + '/resource/oss/download/' + ossId; downloadLoadingInstance = ElLoading.service({ text: '姝e湪涓嬭浇鏁版嵁锛岃绋嶅��', background: 'rgba(0, 0, 0, 0.7)' }); try { const res = await axios({ diff --git a/src/router/index.ts b/src/router/index.ts index bbfc448..9540ab2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -134,7 +134,7 @@ path: '/system/oss-config', component: Layout, hidden: true, - permissions: ['monitor:job:list'], + permissions: ['system:oss:list'], children: [ { path: 'index', diff --git a/src/types/router.d.ts b/src/types/router.d.ts index 0f2b026..b60b831 100644 --- a/src/types/router.d.ts +++ b/src/types/router.d.ts @@ -13,6 +13,7 @@ title: string; icon: string; }; + query?: string; } & RouteRecordRaw; interface _RouteLocationBase { diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 22b254d..4e7750d 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -232,7 +232,7 @@ nextTick(() => { reset(); if (row && row.deptId) { - form.value.parentId = row?.parentId; + form.value.parentId = row?.deptId; } }) } diff --git a/src/views/system/role/authUser.vue b/src/views/system/role/authUser.vue index 4b2bec8..ae4f73f 100644 --- a/src/views/system/role/authUser.vue +++ b/src/views/system/role/authUser.vue @@ -63,7 +63,7 @@ :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" - @pagination="handleQuery" + @pagination="getList" /> <select-user ref="selectRef" :roleId="queryParams.roleId" @ok="handleQuery" /> </el-card> diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 237f173..1cd0506 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -95,7 +95,7 @@ v-model:total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" - @pagination="handleQuery" + @pagination="getList" /> </el-card> diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 13e6659..f7b3a35 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -146,7 +146,7 @@ :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" - @pagination="handleQuery" + @pagination="getList" /> </el-card> </el-col> diff --git a/src/views/tool/gen/editTable.vue b/src/views/tool/gen/editTable.vue index eb11b88..15e6edd 100644 --- a/src/views/tool/gen/editTable.vue +++ b/src/views/tool/gen/editTable.vue @@ -136,54 +136,53 @@ /** 鎻愪氦鎸夐挳 */ const submitForm = () => { - const basicForm = basicInfo.value.$refs.basicInfoForm; - const genForm = genInfo.value.$refs.genInfoForm; + const basicForm = basicInfo.value.$refs.basicInfoForm; + const genForm = genInfo.value.$refs.genInfoForm; - Promise.all([basicForm, genForm].map(getFormPromise)).then(async res => { - const validateResult = res.every(item => !!item); - if (validateResult) { - const genTable: any = Object.assign({}, info.value); - genTable.columns = columns.value; - genTable.params = { - treeCode: info.value?.treeCode, - treeName: info.value.treeName, - treeParentCode: info.value.treeParentCode, - parentMenuId: info.value.parentMenuId - }; - const response = await updateGenTable(genTable); - proxy?.$modal.msgSuccess(response.msg); - if (response.code === 200) { - close(); - } - } else { - proxy?.$modal.msgError("琛ㄥ崟鏍¢獙鏈�氳繃锛岃閲嶆柊妫�鏌ユ彁浜ゅ唴瀹�"); - } - }); + Promise.all([basicForm, genForm].map(getFormPromise)).then(async res => { + const validateResult = res.every(item => !!item); + if (validateResult) { + const genTable: any = Object.assign({}, info.value); + genTable.columns = columns.value; + genTable.params = { + treeCode: info.value?.treeCode, + treeName: info.value.treeName, + treeParentCode: info.value.treeParentCode, + parentMenuId: info.value.parentMenuId + }; + const response = await updateGenTable(genTable); + proxy?.$modal.msgSuccess(response.msg); + if (response.code === 200) { + close(); + } + } else { + proxy?.$modal.msgError("琛ㄥ崟鏍¢獙鏈�氳繃锛岃閲嶆柊妫�鏌ユ彁浜ゅ唴瀹�"); + } + }); } const getFormPromise = (form: any) => { - return new Promise(resolve => { - form.validate((res: any) => { - resolve(res); - }); + return new Promise(resolve => { + form.validate((res: any) => { + resolve(res); }); + }); } const close = () => { - const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } }; - proxy?.$tab.closeOpenPage(obj); + const obj = {path: "/tool/gen", query: {t: Date.now(), pageNum: route.query.pageNum}}; + proxy?.$tab.closeOpenPage(obj); } (async () => { - const tableId = route.params && route.params.tableId as string; - if (tableId) { - // 鑾峰彇琛ㄨ缁嗕俊鎭� - const res = await getGenTable(tableId); - res.data.info.parentMenuId = Number(res.data.info.parentMenuId); - columns.value = res.data.rows; - info.value = res.data.info; - tables.value = res.data.tables; - /** 鏌ヨ瀛楀吀涓嬫媺鍒楄〃 */ - const response = await getDictOptionselect(); - dictOptions.value = response.data; - } + const tableId = route.params && route.params.tableId as string; + if (tableId) { + // 鑾峰彇琛ㄨ缁嗕俊鎭� + const res = await getGenTable(tableId); + columns.value = res.data.rows; + info.value = res.data.info; + tables.value = res.data.tables; + /** 鏌ヨ瀛楀吀涓嬫媺鍒楄〃 */ + const response = await getDictOptionselect(); + dictOptions.value = response.data; + } })(); </script> diff --git a/src/views/tool/gen/genInfoForm.vue b/src/views/tool/gen/genInfoForm.vue index 54a9a19..ab6e714 100644 --- a/src/views/tool/gen/genInfoForm.vue +++ b/src/views/tool/gen/genInfoForm.vue @@ -226,9 +226,9 @@ import { ComponentInternalInstance, PropType } from 'vue'; interface MenuOptionsType { - menuId: number; - menuName: string; - children: MenuOptionsType[] | undefined; + menuId: number | string; + menuName: string; + children: MenuOptionsType[] | undefined; } const subColumns = ref<any>([]); @@ -236,14 +236,14 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance; const props = defineProps({ - info: { - type: Object as PropType<any>, - default: null - }, - tables: { - type: Array as PropType<any[]>, - default: null - } + info: { + type: Object as PropType<any>, + default: null + }, + tables: { + type: Array as PropType<any[]>, + default: null + } }); const infoForm = computed(() => props.info); @@ -252,45 +252,46 @@ // 琛ㄥ崟鏍¢獙 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" }] + 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 = ""; + infoForm.value.subTableFkName = ""; } const tplSelectChange = (value: string) => { - if (value !== "sub") { - infoForm.value.subTableName = ""; - infoForm.value.subTableFkName = ""; - } + 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; - } - }) + 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"); + 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 - } + menuOptions.value = data + } } watch(() => props.info.subTableName, val => { - setSubTableColumns(val); + setSubTableColumns(val); }); onMounted(() => { - getMenuTreeselect(); + getMenuTreeselect(); }) </script> -- Gitblit v1.9.3