diff --git a/.env b/.env index 5a7a24a..ca13819 100644 --- a/.env +++ b/.env @@ -2,7 +2,7 @@ VITE_APP_TITLE=芋道管理系统 # 项目本地运行端口号 -VITE_PORT=80 +VITE_PORT=8888 # open 运行 npm run dev 时自动打开浏览器 VITE_OPEN=true diff --git a/.eslintignore b/.eslintignore index 1e85c0f..64f94c6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,4 @@ /node_modules/* /dist* /src/main.ts +/src/components/Tinyflow/ui/** diff --git a/package.json b/package.json index 8ef3b4e..606c728 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "vue-i18n": "9.10.2", "vue-router": "4.4.5", "vue-types": "^5.1.1", + "vue3-country-region-select": "^1.0.0", "vue3-print-nb": "^0.1.4", "vue3-signature": "^0.2.4", "vuedraggable": "^4.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ac46ccb..902bb89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -161,6 +161,9 @@ importers: vue-types: specifier: ^5.1.1 version: 5.1.3(vue@3.5.12(typescript@5.3.3)) + vue3-country-region-select: + specifier: ^1.0.0 + version: 1.0.0(typescript@5.3.3) vue3-print-nb: specifier: ^0.1.4 version: 0.1.4(typescript@5.3.3) @@ -5034,6 +5037,9 @@ packages: vue: optional: true + vue3-country-region-select@1.0.0: + resolution: {integrity: sha512-4sHzVqd2AExz8Ijo2npiHCM6X50iD8AN2rtBZGeZc6y/LG4yNLzDFImZDT3UjBaAUFNUqQ1HR5akcQ1jrIuy5g==} + vue3-print-nb@0.1.4: resolution: {integrity: sha512-LExI7viEzplR6ZKQ2b+V4U0cwGYbVD4fut/XHvk3UPGlT5CcvIGs6VlwGp107aKgk6P8Pgx4rco3Rehv2lti3A==} @@ -10421,6 +10427,13 @@ snapshots: optionalDependencies: vue: 3.5.12(typescript@5.3.3) + vue3-country-region-select@1.0.0(typescript@5.3.3): + dependencies: + vue: 3.5.12(typescript@5.3.3) + vue-i18n: 9.10.2(vue@3.5.12(typescript@5.3.3)) + transitivePeerDependencies: + - typescript + vue3-print-nb@0.1.4(typescript@5.3.3): dependencies: vue: 3.5.12(typescript@5.3.3) diff --git a/src/api/cus/management/index.ts b/src/api/cus/management/index.ts new file mode 100644 index 0000000..98b584a --- /dev/null +++ b/src/api/cus/management/index.ts @@ -0,0 +1,81 @@ +import request from '@/config/axios' +import type { Dayjs } from 'dayjs'; + +/** 客户管理信息 */ +export interface Management { + id: number; // id + customerCode: string; // 客户编码 + customerName: string; // 客户名称 + status?: number; // 状态 + remark: string; // 备注 + afterSalesManager: string; // 售后负责人 + countryCode: string; // 国家编码 + countryName: string; // 国家名称 + provinceCode: string; // 省编码 + provinceName: string; // 省名称 + cityCode: string; // 城市编码 + cityName: string; // 城市名称 + address: string; // 详细地址 + longitude: number; // 经度 + latitude: number; // 纬度 + dbIp: string; // 数据库IP + dbPort: number; // 数据库端口 + dbUsername: string; // 数据库账号 + dbPassword: string; // 数据库密码 + } + +export interface ManagementDbConnectionTestReq { + id?: number + dbIp?: string + dbPort?: number + dbUsername?: string + dbPassword?: string +} + +// 客户管理 API +export const ManagementApi = { + // 查询客户管理分页 + getManagementPage: async (params: any) => { + return await request.get({ url: `/cus/management/page`, params }) + }, + + // 查询客户管理详情 + getManagement: async (id: number) => { + return await request.get({ url: `/cus/management/get?id=` + id }) + }, + + // 新增客户管理 + createManagement: async (data: Management) => { + return await request.post({ url: `/cus/management/create`, data }) + }, + + // 修改客户管理 + updateManagement: async (data: Management) => { + return await request.put({ url: `/cus/management/update`, data }) + }, + + // 删除客户管理 + deleteManagement: async (id: number) => { + return await request.delete({ url: `/cus/management/delete?id=` + id }) + }, + + /** 批量删除客户管理 */ + deleteManagementList: async (ids: number[]) => { + return await request.delete({ url: `/cus/management/delete-list?ids=${ids.join(',')}` }) + }, + + // 导出客户管理 Excel + exportManagement: async (params) => { + return await request.download({ url: `/cus/management/export-excel`, params }) + }, + + // 测试数据库连接 + testDbConnection: async (data: ManagementDbConnectionTestReq) => { + return await request.post({ url: `/cus/management/test-db-connection`, data }) + }, + + // 同步客户数据 + syncData: async (id: number) => { + return await request.post({ url: `/cus/management/sync-data?id=` + id }) + } +} diff --git a/src/api/system/area/index.ts b/src/api/system/area/index.ts index e91a499..41a09af 100644 --- a/src/api/system/area/index.ts +++ b/src/api/system/area/index.ts @@ -1,8 +1,11 @@ import request from '@/config/axios' // 获得地区树 -export const getAreaTree = async () => { - return await request.get({ url: '/system/area/tree' }) +export const getAreaTree = async (countryCode?: string) => { + return await request.get({ + url: '/system/area/tree', + params: countryCode ? { countryCode } : undefined + }) } // 获得 IP 对应的地区名 diff --git a/src/main.ts b/src/main.ts index fcfd780..993e859 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,6 +46,7 @@ import VueDOMPurifyHTML from 'vue-dompurify-html' // 解决v-html 的安全隐 import { setupWangEditorPlugin } from '@/views/bpm/model/form/PrintTemplate' import print from 'vue3-print-nb' // 打印插件 +import vueCountryRegionSelect from 'vue3-country-region-select' // 创建实例 const setupAll = async () => { @@ -77,6 +78,8 @@ const setupAll = async () => { // 打印 app.use(print) + app.use(vueCountryRegionSelect) + app.mount('#app') } diff --git a/src/utils/routerHelper.ts b/src/utils/routerHelper.ts index cf1b362..c9e8c90 100644 --- a/src/utils/routerHelper.ts +++ b/src/utils/routerHelper.ts @@ -87,9 +87,13 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord // 2. 生成 data(AppRouteRecordRaw) // 路由地址转首字母大写驼峰,作为路由名称,适配keepAlive + let path = + route.path.indexOf('?') > -1 && !isUrl(route.path) ? route.path.split('?')[0] : route.path // 注意,需要排除 http 这种 url,避免它带 ? 参数被截取掉 + if (route.parentId == 0 && path && !isUrl(path) && !path.startsWith('/')) { + path = `/${path}` + } let data: AppRouteRecordRaw = { - path: - route.path.indexOf('?') > -1 && !isUrl(route.path) ? route.path.split('?')[0] : route.path, // 注意,需要排除 http 这种 url,避免它带 ? 参数被截取掉 + path, name: route.componentName && route.componentName.length > 0 ? route.componentName @@ -124,7 +128,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord // 目录 if (route.children?.length) { data.component = Layout - data.redirect = getRedirect(route.path, route.children) + data.redirect = getRedirect(path, route.children) // 外链 } else if (isUrl(route.path)) { data = { diff --git a/src/views/Login/components/LoginForm.vue b/src/views/Login/components/LoginForm.vue index 1bb5173..6dad0f7 100644 --- a/src/views/Login/components/LoginForm.vue +++ b/src/views/Login/components/LoginForm.vue @@ -86,7 +86,7 @@ mode="pop" @success="handleLogin" /> - + diff --git a/src/views/cus/management/ManagementForm.vue b/src/views/cus/management/ManagementForm.vue new file mode 100644 index 0000000..d13bd9f --- /dev/null +++ b/src/views/cus/management/ManagementForm.vue @@ -0,0 +1,405 @@ + + + + diff --git a/src/views/cus/management/index.vue b/src/views/cus/management/index.vue new file mode 100644 index 0000000..eca0be3 --- /dev/null +++ b/src/views/cus/management/index.vue @@ -0,0 +1,389 @@ + + + diff --git a/vite.config.ts b/vite.config.ts index a10bcfb..d978b62 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -29,14 +29,14 @@ export default ({command, mode}: ConfigEnv): UserConfig => { host: "0.0.0.0", open: env.VITE_OPEN === 'true', // 本地跨域代理. 目前注释的原因:暂时没有用途,server 端已经支持跨域 - // proxy: { - // ['/admin-api']: { - // target: env.VITE_BASE_URL, - // ws: false, - // changeOrigin: true, - // rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''), - // }, - // }, + proxy: { + ['/admin-api']: { + target: env.VITE_BASE_URL, + ws: false, + changeOrigin: true, + rewrite: (path) => path.replace(new RegExp(`^/admin-api`), ''), + }, + }, }, // 项目使用的vite插件。 单独提取到build/vite/plugin中管理 plugins: createVitePlugins(),