af-mobile-client-vue3 1.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/.editorconfig +38 -0
  2. package/.env +7 -0
  3. package/.env.development +4 -0
  4. package/.env.envoiceShow +7 -0
  5. package/.env.production +7 -0
  6. package/.husky/commit-msg +1 -0
  7. package/.husky/pre-commit +1 -0
  8. package/.vscode/extensions.json +7 -0
  9. package/.vscode/settings.json +61 -0
  10. package/LICENSE +21 -0
  11. package/README.md +181 -0
  12. package/af-example-mobile-vue-web.iml +9 -0
  13. package/build/vite/index.ts +91 -0
  14. package/build/vite/vconsole.ts +44 -0
  15. package/eslint.config.js +7 -0
  16. package/index.html +17 -0
  17. package/mock/data.ts +20 -0
  18. package/mock/index.ts +5 -0
  19. package/mock/modules/prose.mock.ts +16 -0
  20. package/mock/modules/user.mock.ts +152 -0
  21. package/netlify.toml +12 -0
  22. package/package.json +107 -0
  23. package/public/favicon-dark.svg +4 -0
  24. package/public/favicon.ico +0 -0
  25. package/public/favicon.svg +4 -0
  26. package/public/pwa-192x192.png +0 -0
  27. package/public/pwa-512x512.png +0 -0
  28. package/public/safari-pinned-tab.svg +32 -0
  29. package/scripts/verifyCommit.js +19 -0
  30. package/src/App.vue +43 -0
  31. package/src/api/mock/index.ts +30 -0
  32. package/src/api/user/index.ts +40 -0
  33. package/src/assets/common/default-user-profile.png +0 -0
  34. package/src/assets/img/apps/apply-web.png +0 -0
  35. package/src/assets/img/apps/example-web.png +0 -0
  36. package/src/assets/img/apps/iot-web.png +0 -0
  37. package/src/assets/img/apps/linepatrol-web.png +0 -0
  38. package/src/assets/img/apps/monitor-web.png +0 -0
  39. package/src/assets/img/apps/oa-web.png +0 -0
  40. package/src/assets/img/apps/revenue-web.png +0 -0
  41. package/src/assets/img/apps/safe-check-web.png +0 -0
  42. package/src/assets/img/component/logo.png +0 -0
  43. package/src/assets/img/home/banner1.png +0 -0
  44. package/src/assets/img/home/banner2.png +0 -0
  45. package/src/assets/img/home/banner3.png +0 -0
  46. package/src/assets/img/home/banner4.png +0 -0
  47. package/src/assets/img/home/notice/icon.png +0 -0
  48. package/src/assets/img/user/login/background-shadow-1.svg +20 -0
  49. package/src/assets/img/user/login/logo-background.svg +20 -0
  50. package/src/assets/img/user/login/logo.png +0 -0
  51. package/src/assets/img/user/my/exit-login.png +0 -0
  52. package/src/assets/img/user/my/setting-arrow.png +0 -0
  53. package/src/assets/img/user/my/setting.png +0 -0
  54. package/src/bootstrap.ts +32 -0
  55. package/src/components/core/App/MicroAppView.vue +59 -0
  56. package/src/components/core/BeautifulLoading/index.vue +47 -0
  57. package/src/components/core/NavBar/index.vue +12 -0
  58. package/src/components/core/SvgIcon/index.vue +61 -0
  59. package/src/components/core/Tabbar/index.vue +38 -0
  60. package/src/components/core/Uploader/index.vue +104 -0
  61. package/src/components/core/XMultiSelect/index.vue +196 -0
  62. package/src/components/core/XSelect/index.vue +130 -0
  63. package/src/components/data/XBadge/index.vue +85 -0
  64. package/src/components/data/XCellDetail/index.vue +106 -0
  65. package/src/components/data/XCellList/index.vue +358 -0
  66. package/src/components/data/XCellListFilter/index.vue +392 -0
  67. package/src/components/data/XForm/index.vue +127 -0
  68. package/src/components/data/XFormItem/index.vue +472 -0
  69. package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -0
  70. package/src/components/data/XReportForm/index.vue +1058 -0
  71. package/src/components/layout/NormalDataLayout/index.vue +70 -0
  72. package/src/components/layout/TabBarLayout/index.vue +40 -0
  73. package/src/components.d.ts +53 -0
  74. package/src/enums/requestEnum.ts +25 -0
  75. package/src/env.d.ts +16 -0
  76. package/src/font-style/PingFangSC-Regular.woff2 +0 -0
  77. package/src/font-style/font.css +4 -0
  78. package/src/hooks/useCommon.ts +9 -0
  79. package/src/hooks/useLogin.ts +97 -0
  80. package/src/icons/svg/bird.svg +1 -0
  81. package/src/icons/svg/check-in.svg +33 -0
  82. package/src/icons/svg/dark.svg +5 -0
  83. package/src/icons/svg/github.svg +5 -0
  84. package/src/icons/svg/light.svg +5 -0
  85. package/src/icons/svg/link.svg +5 -0
  86. package/src/icons/svg/loadError.svg +1 -0
  87. package/src/icons/svg/notFound.svg +1 -0
  88. package/src/icons/svgo.yml +22 -0
  89. package/src/layout/PageLayout.vue +51 -0
  90. package/src/layout/SingleLayout.vue +35 -0
  91. package/src/locales/en-US.json +25 -0
  92. package/src/locales/zh-CN.json +25 -0
  93. package/src/main.ts +48 -0
  94. package/src/plugins/AppData.ts +38 -0
  95. package/src/plugins/GetLoginInfoService.ts +10 -0
  96. package/src/plugins/index.ts +11 -0
  97. package/src/router/README.md +8 -0
  98. package/src/router/guards.ts +60 -0
  99. package/src/router/index.ts +60 -0
  100. package/src/router/invoiceRoutes.ts +33 -0
  101. package/src/router/routes.ts +84 -0
  102. package/src/services/api/Login.ts +6 -0
  103. package/src/services/api/common.ts +98 -0
  104. package/src/services/api/index.ts +7 -0
  105. package/src/services/api/manage.ts +8 -0
  106. package/src/services/restTools.ts +37 -0
  107. package/src/settings.ts +1 -0
  108. package/src/stores/index.ts +7 -0
  109. package/src/stores/modules/cachedView.ts +31 -0
  110. package/src/stores/modules/counter.ts +19 -0
  111. package/src/stores/modules/routeTransitionName.ts +26 -0
  112. package/src/stores/modules/setting.ts +28 -0
  113. package/src/stores/modules/user.ts +180 -0
  114. package/src/stores/mutation-type.ts +7 -0
  115. package/src/styles/app.less +67 -0
  116. package/src/styles/login.less +81 -0
  117. package/src/typing.ts +3 -0
  118. package/src/utils/Storage.ts +124 -0
  119. package/src/utils/authority-utils.ts +87 -0
  120. package/src/utils/common.ts +41 -0
  121. package/src/utils/crypto.ts +39 -0
  122. package/src/utils/dataUtil.ts +42 -0
  123. package/src/utils/dictUtil.ts +51 -0
  124. package/src/utils/http/index.ts +158 -0
  125. package/src/utils/i18n.ts +41 -0
  126. package/src/utils/indexedDB.ts +180 -0
  127. package/src/utils/local-storage.ts +9 -0
  128. package/src/utils/mobileUtil.ts +26 -0
  129. package/src/utils/progress.ts +19 -0
  130. package/src/utils/routerUtil.ts +271 -0
  131. package/src/utils/set-page-title.ts +7 -0
  132. package/src/utils/validate.ts +6 -0
  133. package/src/views/chat/index.vue +153 -0
  134. package/src/views/common/LoadError.vue +64 -0
  135. package/src/views/common/NotFound.vue +68 -0
  136. package/src/views/component/EvaluateRecordView/index.vue +40 -0
  137. package/src/views/component/XCellDetailView/index.vue +216 -0
  138. package/src/views/component/XCellListView/index.vue +36 -0
  139. package/src/views/component/XFormView/index.vue +478 -0
  140. package/src/views/component/XReportFormIframeView/index.vue +45 -0
  141. package/src/views/component/XReportFormView/index.vue +295 -0
  142. package/src/views/component/index.vue +111 -0
  143. package/src/views/component/menu.vue +117 -0
  144. package/src/views/component/notice.vue +46 -0
  145. package/src/views/component/topNav.vue +36 -0
  146. package/src/views/invoiceShow/index.vue +62 -0
  147. package/src/views/user/login/ForgetPasswordForm.vue +93 -0
  148. package/src/views/user/login/LoginForm.vue +145 -0
  149. package/src/views/user/login/LoginTitle.vue +68 -0
  150. package/src/views/user/login/LoginWave.vue +109 -0
  151. package/src/views/user/login/index.vue +22 -0
  152. package/src/views/user/my/index.vue +230 -0
  153. package/src/vue-router.d.ts +9 -0
  154. package/tsconfig.json +43 -0
  155. package/uno.config.ts +32 -0
  156. package/vite.config.ts +110 -0
package/src/main.ts ADDED
@@ -0,0 +1,48 @@
1
+ import { createApp } from 'vue'
2
+ import { createHead } from '@unhead/vue'
3
+ import bootstrap from '@af-mobile-client-vue3/bootstrap'
4
+ import App from '@af-mobile-client-vue3/App.vue'
5
+ import router from '@af-mobile-client-vue3/router'
6
+ import pinia from '@af-mobile-client-vue3/stores'
7
+ import 'virtual:uno.css'
8
+ import '@af-mobile-client-vue3/styles/app.less'
9
+ import 'vant/lib/index.css'
10
+ import 'vant/lib/tabbar/index.css'
11
+ import 'vant/lib/tabbar-item/index.css'
12
+
13
+ // svg icon
14
+ import 'virtual:svg-icons-register'
15
+
16
+ // Vant 桌面端适配
17
+ import '@vant/touch-emulator'
18
+
19
+ /* --------------------------------
20
+ Vant 中有个别组件是以函数的形式提供的,
21
+ 包括 Toast,Dialog,Notify 和 ImagePreview 组件。
22
+ 在使用函数组件时,unplugin-vue-components
23
+ 无法自动引入对应的样式,因此需要手动引入样式。
24
+ ------------------------------------- */
25
+ import 'vant/es/toast/style'
26
+ import 'vant/es/dialog/style'
27
+ import 'vant/es/notify/style'
28
+ import 'vant/es/image-preview/style'
29
+ import Plugins from '@af-mobile-client-vue3/plugins'
30
+
31
+ const app = createApp(App)
32
+ const head = createHead()
33
+
34
+ app.use(head)
35
+ app.use(router)
36
+ app.use(pinia)
37
+ app.use(Plugins)
38
+
39
+ async function main() {
40
+ await bootstrap(router)
41
+ app.mount('#system-app')
42
+ }
43
+ main().then((_r) => {})
44
+
45
+ // 👇 将卸载操作放入 unmount 函数,就是上面步骤2中的卸载函数
46
+ window.unmount = () => {
47
+ app.unmount()
48
+ }
@@ -0,0 +1,38 @@
1
+ import type { App } from 'vue'
2
+ import { manageApi } from '@af-mobile-client-vue3/services/api/manage'
3
+ import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
4
+ import { handleTree } from '@af-mobile-client-vue3/utils/dataUtil'
5
+ import { createStorage } from '@af-mobile-client-vue3/utils/Storage'
6
+ import { APP_WEB_CONFIG_KEY } from '@af-mobile-client-vue3/stores/mutation-type'
7
+
8
+ const Storage = createStorage({ storage: localStorage })
9
+
10
+ export const GetAppDataService = {
11
+ install(app: App<Element>) {
12
+ app.provide('$appdata', GetAppDataService)
13
+ },
14
+ async load() {
15
+ },
16
+ // 返回树形省市区
17
+ async getDivisionsOhChinaForTree() {
18
+ // 获取省市区数据
19
+ return new Promise((resolve, reject) => {
20
+ try {
21
+ indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, (res) => {
22
+ resolve(res)
23
+ }, (processRes) => {
24
+ return handleTree(processRes, 'code', 'parentcode', null)
25
+ })
26
+ }
27
+ catch (e) {
28
+ reject(e)
29
+ }
30
+ })
31
+ },
32
+ getWebConfigByKey(key: string) {
33
+ const object = Storage.get(APP_WEB_CONFIG_KEY)
34
+ return object[key]
35
+ },
36
+ }
37
+
38
+ export default GetAppDataService
@@ -0,0 +1,10 @@
1
+ import type { App } from 'vue'
2
+
3
+ const GetLoginInfoService = {
4
+ install(app: App<Element>) {
5
+ app.provide('$login', GetLoginInfoService)
6
+ },
7
+ f: {},
8
+ }
9
+
10
+ export default GetLoginInfoService
@@ -0,0 +1,11 @@
1
+ import type { App } from 'vue'
2
+ import GetLoginInfoService from '@af-mobile-client-vue3/plugins/GetLoginInfoService'
3
+ import GetAppDataService from '@af-mobile-client-vue3/plugins/AppData'
4
+
5
+ const Plugins = {
6
+ install(app: App<Element>) {
7
+ app.use(GetLoginInfoService)
8
+ app.use(GetAppDataService)
9
+ },
10
+ }
11
+ export default Plugins
@@ -0,0 +1,8 @@
1
+ # `File-based Routing`
2
+
3
+ Routes will be auto-generated for Vue files in the **src/views** dir with the same file structure.
4
+ Check out [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router) for more details.
5
+
6
+ 在 **src/views** 目录下的 Vue 文件会自动生成相同结构的路由。
7
+
8
+ 查看[`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router)了解更多细节。
@@ -0,0 +1,60 @@
1
+ import { showToast } from 'vant'
2
+ import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
3
+ import { hasAuthority } from '@af-mobile-client-vue3/utils/authority-utils'
4
+
5
+ // 不需要登录拦截的路由配置
6
+ const loginIgnore = {
7
+ names: ['404', '403'], // 根据路由名称匹配
8
+ paths: ['/login', '/XReportFormIframeView', '/invoiceShow'], // 根据路由fullPath匹配
9
+ /**
10
+ * 判断路由是否包含在该配置中
11
+ * @param route vue-router 的 route 对象
12
+ */
13
+ includes(route) {
14
+ return this.names.includes(route.name) || this.paths.includes(route.path)
15
+ },
16
+ }
17
+
18
+ /**
19
+ * 登录守卫
20
+ * @param to
21
+ * @param form
22
+ * @param next
23
+ * @param options
24
+ */
25
+ function loginGuard(to, from, next?) {
26
+ if (!loginIgnore.includes(to) && !useUserStore().getToken()) {
27
+ showToast({
28
+ message: '登录态已失效,请重新登录',
29
+ position: 'bottom',
30
+ })
31
+ next({ path: '/login' })
32
+ }
33
+ else {
34
+ if (to.path === '/login' && useUserStore().getToken())
35
+ next({ path: '/' })
36
+
37
+ next()
38
+ }
39
+ }
40
+
41
+ /**
42
+ * 权限守卫
43
+ * @param to
44
+ * @param form
45
+ * @param next
46
+ */
47
+ function authorityGuard(to, from, next?) {
48
+ const permissions = useUserStore().getPermissions()
49
+ const roles = useUserStore().getRoles()
50
+ if (!hasAuthority(to, permissions, roles))
51
+ next({ path: '/' })
52
+
53
+ else
54
+ next()
55
+ }
56
+
57
+ export default {
58
+ beforeEach: [loginGuard, authorityGuard],
59
+ afterEach: [],
60
+ }
@@ -0,0 +1,60 @@
1
+ // https://router.vuejs.org/zh/
2
+ import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
3
+ import 'nprogress/nprogress.css'
4
+ import type { RouteLocationNormalized } from 'vue-router'
5
+ import setPageTitle from '@af-mobile-client-vue3/utils/set-page-title'
6
+ import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
7
+ import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
8
+ import routes from '@af-mobile-client-vue3/router/routes'
9
+ const baseUrl = import.meta.env.VITE_APP_PUBLIC_PATH
10
+ // 创建路由实例并传递 `routes` 配置
11
+ const router = createRouter({
12
+ history: import.meta.env.NODE_ENV === 'development' ? createWebHistory(baseUrl) : createWebHashHistory(baseUrl),
13
+ routes,
14
+ })
15
+
16
+ export interface toRouteType extends RouteLocationNormalized {
17
+ meta: {
18
+ title?: string
19
+ noCache?: boolean
20
+ index?: number
21
+ }
22
+ }
23
+
24
+ router.beforeEach((to: toRouteType, _from: toRouteType, next) => {
25
+ const toDepth = to.path.split('/').length
26
+ const fromDepth = _from.path.split('/').length
27
+ // 路由过渡动画
28
+ const routeTransitionNameStore = useRouteTransitionNameStore()
29
+ let name: string
30
+ if (toDepth > fromDepth || to.name === '404') {
31
+ console.warn('in')
32
+ // 进入动画
33
+ name = 'slide-fadein-left'
34
+ }
35
+ else if (toDepth < fromDepth) {
36
+ // 返回动画
37
+ name = 'slide-fadein-right'
38
+ }
39
+ else {
40
+ const toIndex = to.meta.index ? to.meta.index : 0
41
+ const fromIndex = _from.meta.index ? _from.meta.index : 0
42
+ if (toIndex > fromIndex)
43
+ name = 'slide-right'
44
+ else if (toIndex < fromIndex)
45
+ name = 'slide-left'
46
+ else
47
+ name = ''
48
+ }
49
+ routeTransitionNameStore.setName(name)
50
+ // 路由缓存
51
+ useCachedViewStore().addCachedView(to)
52
+ // 页面 title
53
+ setPageTitle(to.meta.title)
54
+ next()
55
+ })
56
+
57
+ router.afterEach(() => {})
58
+
59
+ // 导出路由实例,并在 `main.ts` 挂载
60
+ export default router
@@ -0,0 +1,33 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
3
+ import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
4
+ import invoiceShow from '@af-mobile-client-vue3/views/invoiceShow/index.vue'
5
+
6
+ const routes: Array<RouteRecordRaw> = [
7
+ {
8
+ path: '/',
9
+ name: 'root',
10
+ component: PageLayout,
11
+ redirect: { name: 'Component' },
12
+ children: [
13
+ {
14
+ path: '/invoiceShow',
15
+ name: 'invoiceShow',
16
+ component: invoiceShow,
17
+ },
18
+ ],
19
+ },
20
+ {
21
+ path: '/404',
22
+ name: '404',
23
+ component: NotFound,
24
+ },
25
+ {
26
+ path: '/:pathMatch(.*)',
27
+ redirect: {
28
+ name: '404',
29
+ },
30
+ },
31
+ ]
32
+
33
+ export default routes
@@ -0,0 +1,84 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+ import ComponentView from '@af-mobile-client-vue3/views/component/index.vue'
3
+ import XCellListView from '@af-mobile-client-vue3/views/component/XCellListView/index.vue'
4
+ import XCellDetailView from '@af-mobile-client-vue3/views/component/XCellDetailView/index.vue'
5
+ import XReportFormView from '@af-mobile-client-vue3/views/component/XReportFormView/index.vue'
6
+ import XFormView from '@af-mobile-client-vue3/views/component/XFormView/index.vue'
7
+ import EvaluateRecordView from '@af-mobile-client-vue3/views/component/EvaluateRecordView/index.vue'
8
+ import XReportFormIframeView from '@af-mobile-client-vue3/views/component/XReportFormIframeView/index.vue'
9
+ import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
10
+ import login from '@af-mobile-client-vue3/views/user/login/index.vue'
11
+ import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
12
+ import SingleLayout from '@af-mobile-client-vue3/layout/SingleLayout.vue'
13
+
14
+ const routes: Array<RouteRecordRaw> = [
15
+ {
16
+ path: '/',
17
+ name: 'root',
18
+ component: PageLayout,
19
+ redirect: { name: 'Component' },
20
+ children: [
21
+ {
22
+ path: '/XReportFormIframeView',
23
+ name: 'XReportFormIframeView',
24
+ component: XReportFormIframeView,
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ path: '/Component',
30
+ name: 'Component',
31
+ component: SingleLayout,
32
+ redirect: { name: 'ComponentView' },
33
+ children: [
34
+ {
35
+ path: '/Component/main',
36
+ name: 'ComponentView',
37
+ component: ComponentView,
38
+ },
39
+ {
40
+ path: '/Component/XCellListView',
41
+ name: 'XCellListView',
42
+ component: XCellListView,
43
+ },
44
+ {
45
+ path: '/Component/XCellDetailView/:id',
46
+ name: 'XCellDetailView',
47
+ component: XCellDetailView,
48
+ },
49
+ {
50
+ path: '/Component/XReportFormView',
51
+ name: 'XReportFormView',
52
+ component: XReportFormView,
53
+ },
54
+ {
55
+ path: '/Component/XFormView/:id/:openid',
56
+ name: 'XFormView',
57
+ component: XFormView,
58
+ },
59
+ {
60
+ path: '/Component/EvaluateRecordView',
61
+ name: 'EvaluateRecordView',
62
+ component: EvaluateRecordView
63
+ }
64
+ ],
65
+ },
66
+ {
67
+ path: '/login',
68
+ name: 'login',
69
+ component: login,
70
+ },
71
+ {
72
+ path: '/404',
73
+ name: '404',
74
+ component: NotFound,
75
+ },
76
+ {
77
+ path: '/:pathMatch(.*)',
78
+ redirect: {
79
+ name: '404',
80
+ },
81
+ },
82
+ ]
83
+
84
+ export default routes
@@ -0,0 +1,6 @@
1
+ const loginApi = {
2
+ Login: '/af-auth/login',
3
+ Logout: '/af-auth/logout',
4
+ }
5
+
6
+ export { loginApi }
@@ -0,0 +1,98 @@
1
+ import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
2
+ import { post, postWithConfig } from '@af-mobile-client-vue3/services/restTools'
3
+
4
+ const commonApi = {
5
+ // 获取配置
6
+ getConfig: 'logic/openapi/getLiuliConfiguration',
7
+ // 通用查询
8
+ query: 'logic/commonQuery',
9
+ // 编辑前查询
10
+ queryWithResource: 'logic/commonQueryWithResource',
11
+ // 通用新增/修改
12
+ addOrModify: 'logic/commonAddOrModify',
13
+ // 通用删除
14
+ delete: 'logic/commonDelete',
15
+ }
16
+
17
+ export function getConfigByName(configName: string, callback: Function): void
18
+ /**
19
+ * 根据配置名获取配置内容
20
+ * @param configName 配置名称
21
+ * @param callback 回调函数
22
+ * @param serviceName 服务名
23
+ */
24
+ export function getConfigByName(configName: string, callback: Function, serviceName?: string): void {
25
+ const namespaceName = serviceName || import.meta.env.VITE_APP_SYSTEM_NAME
26
+ indexedDB.getByWeb(configName, `/${namespaceName}/${commonApi.getConfig}`, { configName }, callback, null)
27
+ }
28
+
29
+ /**
30
+ * 临时使用
31
+ * 获取琉璃配置,不走indexedDB缓存
32
+ * @param configName
33
+ * @param serviceName
34
+ */
35
+ export function getConfigByNameWithoutIndexedDB(configName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
36
+ return post(`/${serviceName}/${commonApi.getConfig}`, { configName })
37
+ }
38
+
39
+ /**
40
+ * 通用执行业务逻辑
41
+ */
42
+ export function runLogic(logicName: string, parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
43
+ return post(`/${serviceName}/logic/${logicName}`, parameter)
44
+ }
45
+
46
+ /**
47
+ * 通用查询
48
+ */
49
+ export function query(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
50
+ return post(`/${serviceName}/${commonApi.query}`, parameter)
51
+ }
52
+
53
+ /**
54
+ * 编辑前查询
55
+ */
56
+ export function queryWithResource(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
57
+ return post(`/${serviceName}/${commonApi.queryWithResource}`, parameter)
58
+ }
59
+
60
+ /**
61
+ * 通用新增/修改
62
+ */
63
+ export function addOrModify(parameter: object, tableName = 't_files', serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
64
+ return post(`/${serviceName}/entity/${tableName}`, parameter)
65
+ }
66
+
67
+ /**
68
+ * 通用新增/修改
69
+ */
70
+ export function addOrModifyEntity(parameter: object, tableName: String, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
71
+ return post(`/${serviceName}/entity/save/${tableName}`, parameter)
72
+ }
73
+
74
+ /**
75
+ * 通用删除
76
+ */
77
+ export function remove(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
78
+ return post(`/${serviceName}/${commonApi.delete}`, parameter)
79
+ }
80
+
81
+ /**
82
+ * @description: 上传
83
+ */
84
+ export function upload(parameter, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME, config) {
85
+ return postWithConfig(`/${serviceName}/resource/upload`, parameter, config)
86
+ }
87
+
88
+ /**
89
+ * @description: 删除
90
+ */
91
+ export function deleteFile(parameter, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
92
+ return post(`/${serviceName}/entity/t_files`, parameter)
93
+ }
94
+
95
+ export function openApiLogic(parameter, logicName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
96
+ return post(`/${serviceName}/logic/openapi/${logicName}`, parameter)
97
+ }
98
+ export { commonApi }
@@ -0,0 +1,7 @@
1
+ import { commonApi } from '@af-mobile-client-vue3/services/api/common'
2
+ import { loginApi } from '@af-mobile-client-vue3/services/api/Login'
3
+
4
+ export default {
5
+ commonApi,
6
+ loginApi,
7
+ }
@@ -0,0 +1,8 @@
1
+ const manageApi = {
2
+ // 查询:获取省市区街道三级分类
3
+ getDivisionsOhChina: '/af-system/logic/getDivisionsOhChina',
4
+ }
5
+
6
+ export {
7
+ manageApi,
8
+ }
@@ -0,0 +1,37 @@
1
+ import { http } from '@af-mobile-client-vue3/utils/http'
2
+ import type { BasicResponseModel } from '@af-mobile-client-vue3/api/user'
3
+
4
+ /**
5
+ * GET请求
6
+ * @param url 请求地址
7
+ * @param params 路径参数
8
+ */
9
+ export function get(url: string, params?: any) {
10
+ return http.request<BasicResponseModel>({
11
+ url,
12
+ method: 'GET',
13
+ params,
14
+ })
15
+ }
16
+
17
+ /**
18
+ * POST请求
19
+ * @param url 请求地址
20
+ * @param data 请求参数
21
+ */
22
+ export function post(url: string, data: any) {
23
+ return http.request<BasicResponseModel>({
24
+ url,
25
+ method: 'POST',
26
+ data,
27
+ })
28
+ }
29
+
30
+ export function postWithConfig(url: string, data: any, config: any) {
31
+ return http.request<BasicResponseModel>({
32
+ url,
33
+ method: 'POST',
34
+ data,
35
+ headers: { ...config },
36
+ })
37
+ }
@@ -0,0 +1 @@
1
+ export const pageDefaultTitle = '智慧燃气'
@@ -0,0 +1,7 @@
1
+ import { createPinia } from 'pinia'
2
+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
3
+
4
+ const pinia = createPinia()
5
+ pinia.use(piniaPluginPersistedstate)
6
+
7
+ export default pinia
@@ -0,0 +1,31 @@
1
+ import { defineStore } from 'pinia'
2
+ import { ref } from 'vue'
3
+ import type { toRouteType } from '@af-mobile-client-vue3/router'
4
+
5
+ const useCachedViewStore = defineStore('cached-view', () => {
6
+ // 缓存页面 keepAlive
7
+ const cachedViewList = ref([] as string[])
8
+ const addCachedView = (view: toRouteType) => {
9
+ // 不重复添加
10
+ if (cachedViewList.value.includes(view.name as string))
11
+ return
12
+ if (!view?.meta?.noCache)
13
+ cachedViewList.value.push(view.name as string)
14
+ }
15
+ const delCachedView = (view: toRouteType) => {
16
+ const index = cachedViewList.value.indexOf(view.name as string)
17
+ index > -1 && cachedViewList.value.splice(index, 1)
18
+ }
19
+ const delAllCachedViews = () => {
20
+ cachedViewList.value = [] as string[]
21
+ }
22
+
23
+ return {
24
+ cachedViewList,
25
+ addCachedView,
26
+ delCachedView,
27
+ delAllCachedViews,
28
+ }
29
+ })
30
+
31
+ export default useCachedViewStore
@@ -0,0 +1,19 @@
1
+ import { defineStore } from 'pinia'
2
+ import { ref } from 'vue'
3
+
4
+ const useCounterStore = defineStore('counter', () => {
5
+ const counter = ref(0)
6
+
7
+ const increment = () => {
8
+ counter.value++
9
+ }
10
+
11
+ return {
12
+ counter,
13
+ increment,
14
+ }
15
+ }, {
16
+ persist: true,
17
+ })
18
+
19
+ export default useCounterStore
@@ -0,0 +1,26 @@
1
+ import { defineStore } from 'pinia'
2
+ import { ref } from 'vue'
3
+
4
+ const useRouteTransitionNameStore = defineStore('route-transition-name', () => {
5
+ // 过渡动画名称
6
+ const routeTransitionName = ref('')
7
+ // homeLayout动画名称
8
+ const routeTransitionHomeName = ref('')
9
+
10
+ const setName = (name: string) => {
11
+ routeTransitionName.value = name
12
+ }
13
+
14
+ const setHomeName = (name: string) => {
15
+ routeTransitionHomeName.value = name
16
+ }
17
+
18
+ return {
19
+ routeTransitionName,
20
+ routeTransitionHomeName,
21
+ setName,
22
+ setHomeName,
23
+ }
24
+ })
25
+
26
+ export default useRouteTransitionNameStore
@@ -0,0 +1,28 @@
1
+ import { defineStore } from 'pinia'
2
+ import { ref } from 'vue'
3
+
4
+ export interface WebConfig {
5
+ systemName: string
6
+ routerName: string
7
+ systemDesc: string
8
+ homePage: string
9
+ defaultAvatarUrl: string
10
+ }
11
+
12
+ // 存放 webConfig 中的 setting 配置
13
+ export const useSettingStore = defineStore('setting', () => {
14
+ const setting = ref<WebConfig>(undefined)
15
+ const setSetting = (newSetting: WebConfig) => {
16
+ setting.value = newSetting
17
+ }
18
+ const getSetting = () => {
19
+ return setting.value
20
+ }
21
+
22
+ return {
23
+ setSetting,
24
+ getSetting,
25
+ }
26
+ })
27
+
28
+ export default useSettingStore