af-mobile-client-vue3 1.1.8 → 1.1.9
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.
- package/.env +6 -6
- package/.env.development +4 -4
- package/.env.envoiceShow +6 -6
- package/.env.production +6 -6
- package/.husky/commit-msg +1 -1
- package/.husky/pre-commit +1 -1
- package/.vscode/settings.json +61 -61
- package/mock/modules/user.mock.ts +152 -152
- package/package.json +1 -1
- package/public/favicon.svg +4 -4
- package/public/safari-pinned-tab.svg +32 -32
- package/scripts/verifyCommit.js +19 -19
- package/src/App.vue +43 -43
- package/src/api/user/index.ts +40 -40
- package/src/bootstrap.ts +18 -18
- package/src/components/core/NavBar/index.vue +12 -12
- package/src/components/core/Tabbar/index.vue +38 -38
- package/src/components/core/XGridDropOption/index.vue +151 -151
- package/src/components/core/XMultiSelect/index.vue +183 -183
- package/src/components/data/XCellDetail/index.vue +106 -106
- package/src/components/data/XFormItem/index.vue +26 -7
- package/src/components/data/XOlMap/XLocationPicker/index.vue +7 -9
- package/src/components/data/XOlMap/index.vue +103 -96
- package/src/components/data/XOlMap/utils/wgs84ToGcj02.js +154 -154
- package/src/components/data/XReportForm/XReportFormJsonRender.vue +220 -220
- package/src/components/data/XReportForm/index.vue +1079 -1079
- package/src/components/data/XReportGrid/XAddReport/index.ts +1 -1
- package/src/components/data/XReportGrid/XReportDrawer/index.ts +1 -1
- package/src/components/data/XSignature/index.vue +285 -285
- package/src/components/data/XTag/index.vue +10 -10
- package/src/components/layout/NormalDataLayout/index.vue +70 -70
- package/src/components/layout/TabBarLayout/index.vue +40 -40
- package/src/components.d.ts +53 -53
- package/src/env.d.ts +16 -16
- package/src/font-style/font.css +3 -3
- package/src/hooks/useCommon.ts +9 -9
- package/src/locales/en-US.json +25 -25
- package/src/locales/zh-CN.json +25 -25
- package/src/plugins/AppData.ts +38 -38
- package/src/router/guards.ts +59 -59
- package/src/router/index.ts +61 -61
- package/src/router/invoiceRoutes.ts +33 -33
- package/src/services/api/common.ts +109 -109
- package/src/services/api/manage.ts +8 -8
- package/src/services/api/search.ts +16 -16
- package/src/services/restTools.ts +56 -56
- package/src/services/v3Api.ts +11 -11
- package/src/stores/modules/setting.ts +52 -52
- package/src/stores/mutation-type.ts +7 -7
- package/src/utils/authority-utils.ts +84 -84
- package/src/utils/crypto.ts +39 -39
- package/src/utils/i18n.ts +41 -41
- package/src/utils/indexedDB.ts +180 -180
- package/src/utils/mobileUtil.ts +26 -26
- package/src/utils/routerUtil.ts +271 -271
- package/src/utils/runEvalFunction.ts +13 -13
- package/src/utils/wechatUtil.ts +9 -9
- package/src/views/common/LoadError.vue +64 -64
- package/src/views/common/NotFound.vue +68 -68
- package/src/views/component/EvaluateRecordView/index.vue +40 -40
- package/src/views/component/XCellDetailView/index.vue +217 -217
- package/src/views/component/XCellListView/index.vue +3 -88
- package/src/views/component/XFormGroupView/index.vue +0 -37
- package/src/views/component/XFormView/index.vue +30 -119
- package/src/views/component/XFormView/oldindex.vue +50 -0
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +118 -120
- package/src/views/component/XOlMapView/index.vue +3 -5
- package/src/views/component/XReportFormIframeView/index.vue +47 -47
- package/src/views/component/XReportFormView/index.vue +13 -13
- package/src/views/component/XSignatureView/index.vue +50 -50
- package/src/views/component/menu.vue +117 -117
- package/src/views/component/notice.vue +46 -46
- package/src/views/component/topNav.vue +36 -36
- package/src/views/invoiceShow/index.vue +61 -61
- package/src/views/user/login/ForgetPasswordForm.vue +94 -94
- package/src/views/user/login/LoginTitle.vue +68 -68
- package/src/views/user/login/index.vue +22 -22
- package/src/views/user/my/index.vue +230 -230
- package/src/vue-router.d.ts +9 -9
- package/tsconfig.json +43 -43
package/src/router/guards.ts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
|
|
2
|
-
import { hasAuthority } from '@af-mobile-client-vue3/utils/authority-utils'
|
|
3
|
-
import { showToast } from 'vant'
|
|
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 from
|
|
22
|
-
* @param next
|
|
23
|
-
*/
|
|
24
|
-
function loginGuard(to, from, next?) {
|
|
25
|
-
if (!loginIgnore.includes(to) && !useUserStore().getToken()) {
|
|
26
|
-
showToast({
|
|
27
|
-
message: '登录态已失效,请重新登录',
|
|
28
|
-
position: 'bottom',
|
|
29
|
-
})
|
|
30
|
-
next({ path: '/login' })
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
if (to.path === '/login' && useUserStore().getToken())
|
|
34
|
-
next({ path: '/' })
|
|
35
|
-
|
|
36
|
-
next()
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 权限守卫
|
|
42
|
-
* @param to
|
|
43
|
-
* @param from
|
|
44
|
-
* @param next
|
|
45
|
-
*/
|
|
46
|
-
function authorityGuard(to, from, next?) {
|
|
47
|
-
const permissions = useUserStore().getPermissions()
|
|
48
|
-
const roles = useUserStore().getRoles()
|
|
49
|
-
if (!hasAuthority(to, permissions, roles))
|
|
50
|
-
next({ path: '/' })
|
|
51
|
-
|
|
52
|
-
else
|
|
53
|
-
next()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default {
|
|
57
|
-
beforeEach: [loginGuard, authorityGuard],
|
|
58
|
-
afterEach: [],
|
|
59
|
-
}
|
|
1
|
+
import useUserStore from '@af-mobile-client-vue3/stores/modules/user'
|
|
2
|
+
import { hasAuthority } from '@af-mobile-client-vue3/utils/authority-utils'
|
|
3
|
+
import { showToast } from 'vant'
|
|
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 from
|
|
22
|
+
* @param next
|
|
23
|
+
*/
|
|
24
|
+
function loginGuard(to, from, next?) {
|
|
25
|
+
if (!loginIgnore.includes(to) && !useUserStore().getToken()) {
|
|
26
|
+
showToast({
|
|
27
|
+
message: '登录态已失效,请重新登录',
|
|
28
|
+
position: 'bottom',
|
|
29
|
+
})
|
|
30
|
+
next({ path: '/login' })
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (to.path === '/login' && useUserStore().getToken())
|
|
34
|
+
next({ path: '/' })
|
|
35
|
+
|
|
36
|
+
next()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 权限守卫
|
|
42
|
+
* @param to
|
|
43
|
+
* @param from
|
|
44
|
+
* @param next
|
|
45
|
+
*/
|
|
46
|
+
function authorityGuard(to, from, next?) {
|
|
47
|
+
const permissions = useUserStore().getPermissions()
|
|
48
|
+
const roles = useUserStore().getRoles()
|
|
49
|
+
if (!hasAuthority(to, permissions, roles))
|
|
50
|
+
next({ path: '/' })
|
|
51
|
+
|
|
52
|
+
else
|
|
53
|
+
next()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default {
|
|
57
|
+
beforeEach: [loginGuard, authorityGuard],
|
|
58
|
+
afterEach: [],
|
|
59
|
+
}
|
package/src/router/index.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import type { RouteLocationNormalized } from 'vue-router'
|
|
2
|
-
import routes from '@af-mobile-client-vue3/router/routes'
|
|
3
|
-
import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
|
|
4
|
-
import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
|
|
5
|
-
import setPageTitle from '@af-mobile-client-vue3/utils/set-page-title'
|
|
6
|
-
// https://router.vuejs.org/zh/
|
|
7
|
-
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
|
8
|
-
import 'nprogress/nprogress.css'
|
|
9
|
-
|
|
10
|
-
const baseUrl = import.meta.env.VITE_APP_PUBLIC_PATH
|
|
11
|
-
// 创建路由实例并传递 `routes` 配置
|
|
12
|
-
const router = createRouter({
|
|
13
|
-
history: import.meta.env.NODE_ENV === 'development' ? createWebHistory(baseUrl) : createWebHashHistory(baseUrl),
|
|
14
|
-
routes,
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
export interface toRouteType extends RouteLocationNormalized {
|
|
18
|
-
meta: {
|
|
19
|
-
title?: string
|
|
20
|
-
noCache?: boolean
|
|
21
|
-
index?: number
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
router.beforeEach((to: toRouteType, _from: toRouteType, next) => {
|
|
26
|
-
const toDepth = to.path.split('/').length
|
|
27
|
-
const fromDepth = _from.path.split('/').length
|
|
28
|
-
// 路由过渡动画
|
|
29
|
-
const routeTransitionNameStore = useRouteTransitionNameStore()
|
|
30
|
-
let name: string
|
|
31
|
-
if (toDepth > fromDepth || to.name === '404') {
|
|
32
|
-
console.warn('in')
|
|
33
|
-
// 进入动画
|
|
34
|
-
name = 'slide-fadein-left'
|
|
35
|
-
}
|
|
36
|
-
else if (toDepth < fromDepth) {
|
|
37
|
-
// 返回动画
|
|
38
|
-
name = 'slide-fadein-right'
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const toIndex = to.meta.index ? to.meta.index : 0
|
|
42
|
-
const fromIndex = _from.meta.index ? _from.meta.index : 0
|
|
43
|
-
if (toIndex > fromIndex)
|
|
44
|
-
name = 'slide-right'
|
|
45
|
-
else if (toIndex < fromIndex)
|
|
46
|
-
name = 'slide-left'
|
|
47
|
-
else
|
|
48
|
-
name = ''
|
|
49
|
-
}
|
|
50
|
-
routeTransitionNameStore.setName(name)
|
|
51
|
-
// 路由缓存
|
|
52
|
-
useCachedViewStore().addCachedView(to)
|
|
53
|
-
// 页面 title
|
|
54
|
-
setPageTitle(to.meta.title)
|
|
55
|
-
next()
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
router.afterEach(() => {})
|
|
59
|
-
|
|
60
|
-
// 导出路由实例,并在 `main.ts` 挂载
|
|
61
|
-
export default router
|
|
1
|
+
import type { RouteLocationNormalized } from 'vue-router'
|
|
2
|
+
import routes from '@af-mobile-client-vue3/router/routes'
|
|
3
|
+
import useCachedViewStore from '@af-mobile-client-vue3/stores/modules/cachedView'
|
|
4
|
+
import useRouteTransitionNameStore from '@af-mobile-client-vue3/stores/modules/routeTransitionName'
|
|
5
|
+
import setPageTitle from '@af-mobile-client-vue3/utils/set-page-title'
|
|
6
|
+
// https://router.vuejs.org/zh/
|
|
7
|
+
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
|
|
8
|
+
import 'nprogress/nprogress.css'
|
|
9
|
+
|
|
10
|
+
const baseUrl = import.meta.env.VITE_APP_PUBLIC_PATH
|
|
11
|
+
// 创建路由实例并传递 `routes` 配置
|
|
12
|
+
const router = createRouter({
|
|
13
|
+
history: import.meta.env.NODE_ENV === 'development' ? createWebHistory(baseUrl) : createWebHashHistory(baseUrl),
|
|
14
|
+
routes,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export interface toRouteType extends RouteLocationNormalized {
|
|
18
|
+
meta: {
|
|
19
|
+
title?: string
|
|
20
|
+
noCache?: boolean
|
|
21
|
+
index?: number
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
router.beforeEach((to: toRouteType, _from: toRouteType, next) => {
|
|
26
|
+
const toDepth = to.path.split('/').length
|
|
27
|
+
const fromDepth = _from.path.split('/').length
|
|
28
|
+
// 路由过渡动画
|
|
29
|
+
const routeTransitionNameStore = useRouteTransitionNameStore()
|
|
30
|
+
let name: string
|
|
31
|
+
if (toDepth > fromDepth || to.name === '404') {
|
|
32
|
+
console.warn('in')
|
|
33
|
+
// 进入动画
|
|
34
|
+
name = 'slide-fadein-left'
|
|
35
|
+
}
|
|
36
|
+
else if (toDepth < fromDepth) {
|
|
37
|
+
// 返回动画
|
|
38
|
+
name = 'slide-fadein-right'
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const toIndex = to.meta.index ? to.meta.index : 0
|
|
42
|
+
const fromIndex = _from.meta.index ? _from.meta.index : 0
|
|
43
|
+
if (toIndex > fromIndex)
|
|
44
|
+
name = 'slide-right'
|
|
45
|
+
else if (toIndex < fromIndex)
|
|
46
|
+
name = 'slide-left'
|
|
47
|
+
else
|
|
48
|
+
name = ''
|
|
49
|
+
}
|
|
50
|
+
routeTransitionNameStore.setName(name)
|
|
51
|
+
// 路由缓存
|
|
52
|
+
useCachedViewStore().addCachedView(to)
|
|
53
|
+
// 页面 title
|
|
54
|
+
setPageTitle(to.meta.title)
|
|
55
|
+
next()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
router.afterEach(() => {})
|
|
59
|
+
|
|
60
|
+
// 导出路由实例,并在 `main.ts` 挂载
|
|
61
|
+
export default router
|
|
@@ -1,33 +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
|
|
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
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { del, post, postWithConfig } from '@af-mobile-client-vue3/services/restTools'
|
|
2
|
-
import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
|
|
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
|
-
/**
|
|
18
|
-
* 根据配置名获取配置内容
|
|
19
|
-
* @param configName 配置名称
|
|
20
|
-
* @param callback 回调函数
|
|
21
|
-
*/
|
|
22
|
-
export function getConfigByName(configName: string, callback: Function): void
|
|
23
|
-
export function getConfigByName(configName: string, callback: Function, serviceName: string): void
|
|
24
|
-
/**
|
|
25
|
-
* 根据配置名获取配置内容
|
|
26
|
-
* @param configName 配置名称
|
|
27
|
-
* @param callback 回调函数
|
|
28
|
-
* @param serviceName 服务名
|
|
29
|
-
*/
|
|
30
|
-
export function getConfigByName(configName: string, callback: Function, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): void {
|
|
31
|
-
indexedDB.getByWeb(configName, `/${serviceName}/${commonApi.getConfig}`, { configName }, callback, null)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function getConfigByNameAsync(configName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): Promise<any> {
|
|
35
|
-
return new Promise((resolve, reject) => {
|
|
36
|
-
indexedDB.getByWeb(configName, `/${serviceName}/${commonApi.getConfig}`, { configName }, resolve, null)
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 临时使用
|
|
42
|
-
* 获取琉璃配置,不走indexedDB缓存
|
|
43
|
-
* @param configName
|
|
44
|
-
* @param serviceName
|
|
45
|
-
*/
|
|
46
|
-
export function getConfigByNameWithoutIndexedDB(configName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
47
|
-
return post(`/${serviceName}/${commonApi.getConfig}`, { configName })
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 通用执行业务逻辑
|
|
52
|
-
*/
|
|
53
|
-
export function runLogic<T>(logicName: string, parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): Promise<T> {
|
|
54
|
-
return post<T>(`/${serviceName}/logic/${logicName}`, parameter)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 通用查询
|
|
59
|
-
*/
|
|
60
|
-
export function query(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
61
|
-
return post(`/${serviceName}/${commonApi.query}`, parameter)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 编辑前查询
|
|
66
|
-
*/
|
|
67
|
-
export function queryWithResource(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
68
|
-
return post(`/${serviceName}/${commonApi.queryWithResource}`, parameter)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 通用新增/修改
|
|
73
|
-
*/
|
|
74
|
-
export function addOrModify(parameter: object, tableName = 't_files', serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
75
|
-
return post(`/${serviceName}/entity/${tableName}`, parameter)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 通用新增/修改
|
|
80
|
-
*/
|
|
81
|
-
export function addOrModifyEntity(parameter: object, tableName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
82
|
-
return post(`/${serviceName}/entity/save/${tableName}`, parameter)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 通用删除
|
|
87
|
-
*/
|
|
88
|
-
export function remove(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
89
|
-
return post(`/${serviceName}/${commonApi.delete}`, parameter)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @description: 上传
|
|
94
|
-
*/
|
|
95
|
-
export function upload(parameter, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME, config) {
|
|
96
|
-
return postWithConfig(`/${serviceName}/resource/upload`, parameter, config)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @description: 删除
|
|
101
|
-
*/
|
|
102
|
-
export function deleteFile(data, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
103
|
-
return del(`/${serviceName}/entity/t_files`, data)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function openApiLogic(parameter, logicName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
107
|
-
return post(`/${serviceName}/logic/openapi/${logicName}`, parameter)
|
|
108
|
-
}
|
|
109
|
-
export { commonApi }
|
|
1
|
+
import { del, post, postWithConfig } from '@af-mobile-client-vue3/services/restTools'
|
|
2
|
+
import { indexedDB } from '@af-mobile-client-vue3/utils/indexedDB'
|
|
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
|
+
/**
|
|
18
|
+
* 根据配置名获取配置内容
|
|
19
|
+
* @param configName 配置名称
|
|
20
|
+
* @param callback 回调函数
|
|
21
|
+
*/
|
|
22
|
+
export function getConfigByName(configName: string, callback: Function): void
|
|
23
|
+
export function getConfigByName(configName: string, callback: Function, serviceName: string): void
|
|
24
|
+
/**
|
|
25
|
+
* 根据配置名获取配置内容
|
|
26
|
+
* @param configName 配置名称
|
|
27
|
+
* @param callback 回调函数
|
|
28
|
+
* @param serviceName 服务名
|
|
29
|
+
*/
|
|
30
|
+
export function getConfigByName(configName: string, callback: Function, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): void {
|
|
31
|
+
indexedDB.getByWeb(configName, `/${serviceName}/${commonApi.getConfig}`, { configName }, callback, null)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function getConfigByNameAsync(configName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): Promise<any> {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
indexedDB.getByWeb(configName, `/${serviceName}/${commonApi.getConfig}`, { configName }, resolve, null)
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 临时使用
|
|
42
|
+
* 获取琉璃配置,不走indexedDB缓存
|
|
43
|
+
* @param configName
|
|
44
|
+
* @param serviceName
|
|
45
|
+
*/
|
|
46
|
+
export function getConfigByNameWithoutIndexedDB(configName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
47
|
+
return post(`/${serviceName}/${commonApi.getConfig}`, { configName })
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 通用执行业务逻辑
|
|
52
|
+
*/
|
|
53
|
+
export function runLogic<T>(logicName: string, parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME): Promise<T> {
|
|
54
|
+
return post<T>(`/${serviceName}/logic/${logicName}`, parameter)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 通用查询
|
|
59
|
+
*/
|
|
60
|
+
export function query(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
61
|
+
return post(`/${serviceName}/${commonApi.query}`, parameter)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 编辑前查询
|
|
66
|
+
*/
|
|
67
|
+
export function queryWithResource(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
68
|
+
return post(`/${serviceName}/${commonApi.queryWithResource}`, parameter)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 通用新增/修改
|
|
73
|
+
*/
|
|
74
|
+
export function addOrModify(parameter: object, tableName = 't_files', serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
75
|
+
return post(`/${serviceName}/entity/${tableName}`, parameter)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 通用新增/修改
|
|
80
|
+
*/
|
|
81
|
+
export function addOrModifyEntity(parameter: object, tableName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
82
|
+
return post(`/${serviceName}/entity/save/${tableName}`, parameter)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 通用删除
|
|
87
|
+
*/
|
|
88
|
+
export function remove(parameter: object, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
89
|
+
return post(`/${serviceName}/${commonApi.delete}`, parameter)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @description: 上传
|
|
94
|
+
*/
|
|
95
|
+
export function upload(parameter, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME, config) {
|
|
96
|
+
return postWithConfig(`/${serviceName}/resource/upload`, parameter, config)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @description: 删除
|
|
101
|
+
*/
|
|
102
|
+
export function deleteFile(data, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
103
|
+
return del(`/${serviceName}/entity/t_files`, data)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function openApiLogic(parameter, logicName: string, serviceName = import.meta.env.VITE_APP_SYSTEM_NAME) {
|
|
107
|
+
return post(`/${serviceName}/logic/openapi/${logicName}`, parameter)
|
|
108
|
+
}
|
|
109
|
+
export { commonApi }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const manageApi = {
|
|
2
|
-
// 查询:获取省市区街道三级分类
|
|
3
|
-
getDivisionsOhChina: '/af-system/logic/getDivisionsOhChina',
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
manageApi,
|
|
8
|
-
}
|
|
1
|
+
const manageApi = {
|
|
2
|
+
// 查询:获取省市区街道三级分类
|
|
3
|
+
getDivisionsOhChina: '/af-system/logic/getDivisionsOhChina',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
manageApi,
|
|
8
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { post } from '@af-mobile-client-vue3/services/restTools'
|
|
2
|
-
|
|
3
|
-
export async function getUserPermissions(userid: string) {
|
|
4
|
-
interface permissions {
|
|
5
|
-
name: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const res = await post<permissions[]>(`/af-system/search`, {
|
|
9
|
-
source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
|
|
10
|
-
userid,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
return res.map((row) => {
|
|
14
|
-
return row.name
|
|
15
|
-
})
|
|
16
|
-
}
|
|
1
|
+
import { post } from '@af-mobile-client-vue3/services/restTools'
|
|
2
|
+
|
|
3
|
+
export async function getUserPermissions(userid: string) {
|
|
4
|
+
interface permissions {
|
|
5
|
+
name: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const res = await post<permissions[]>(`/af-system/search`, {
|
|
9
|
+
source: 'this.getRights().where(row.getType()==$function$ && row.getPath($name$).indexOf($功能权限$) != -1)',
|
|
10
|
+
userid,
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
return res.map((row) => {
|
|
14
|
+
return row.name
|
|
15
|
+
})
|
|
16
|
+
}
|