vue2-client 1.18.47 → 1.18.51
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/.claude/settings.local.json +28 -21
- package/.eslintrc.js +84 -84
- package/Components.md +60 -60
- package/docs/image.png +0 -0
- package/docs/index.md +30 -30
- package/index.js +31 -31
- package/jest-transform-stub.js +8 -8
- package/jest.setup.js +7 -7
- package/package.json +1 -1
- package/src/assets/img/querySlotDemo.svg +15 -15
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
- package/src/base-client/components/common/CitySelect/index.js +3 -3
- package/src/base-client/components/common/CitySelect/index.md +109 -109
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
- package/src/base-client/components/common/CreateQuery/index.js +3 -3
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
- package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
- package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
- package/src/base-client/components/common/PersonSetting/index.js +3 -3
- package/src/base-client/components/common/Tree/Tree.vue +149 -149
- package/src/base-client/components/common/Tree/index.js +2 -2
- package/src/base-client/components/common/Upload/index.js +3 -3
- package/src/base-client/components/common/XAddNativeForm/demo.vue +20 -24
- package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
- package/src/base-client/components/common/XCard/XCard.vue +64 -64
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
- package/src/base-client/components/common/XDataDrawer/index.js +3 -3
- package/src/base-client/components/common/XDataDrawer/index.md +41 -41
- package/src/base-client/components/common/XDescriptions/index.js +3 -3
- package/src/base-client/components/common/XDescriptions/index.md +322 -322
- package/src/base-client/components/common/XForm/XForm.vue +121 -64
- package/src/base-client/components/common/XForm/XFormItem.vue +464 -407
- package/src/base-client/components/common/XForm/index.md +178 -178
- package/src/base-client/components/common/XFormCol/XFormCol.vue +43 -36
- package/src/base-client/components/common/XFormTable/XFormTable.vue +4 -1
- package/src/base-client/components/common/XFormTable/demo.vue +24 -35
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/components/common/XStepView/index.js +3 -3
- package/src/base-client/components/common/XStepView/index.md +31 -31
- package/src/base-client/components/common/XTable/XTable.vue +1715 -1715
- package/src/base-client/components/common/XTable/XTableWrapper.vue +786 -786
- package/src/base-client/components/common/XTable/index.md +255 -255
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
- package/src/base-client/plugins/Config.js +19 -19
- package/src/base-client/plugins/tabs-page-plugin.js +39 -39
- package/src/components/Charts/Bar.vue +62 -62
- package/src/components/Charts/ChartCard.vue +134 -134
- package/src/components/Charts/Liquid.vue +67 -67
- package/src/components/Charts/MiniArea.vue +39 -39
- package/src/components/Charts/MiniBar.vue +39 -39
- package/src/components/Charts/MiniProgress.vue +75 -75
- package/src/components/Charts/MiniSmoothArea.vue +40 -40
- package/src/components/Charts/Radar.vue +68 -68
- package/src/components/Charts/RankList.vue +77 -77
- package/src/components/Charts/TagCloud.vue +113 -113
- package/src/components/Charts/TransferBar.vue +64 -64
- package/src/components/Charts/Trend.vue +82 -82
- package/src/components/Charts/chart.less +12 -12
- package/src/components/Charts/smooth.area.less +13 -13
- package/src/components/NumberInfo/NumberInfo.vue +54 -54
- package/src/components/NumberInfo/index.js +3 -3
- package/src/components/NumberInfo/index.less +54 -54
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/card/ChartCard.vue +79 -79
- package/src/components/chart/Bar.vue +60 -60
- package/src/components/chart/MiniArea.vue +67 -67
- package/src/components/chart/MiniBar.vue +59 -59
- package/src/components/chart/MiniProgress.vue +57 -57
- package/src/components/chart/Radar.vue +80 -80
- package/src/components/chart/RankingList.vue +60 -60
- package/src/components/chart/Trend.vue +79 -79
- package/src/components/chart/index.less +9 -9
- package/src/components/checkbox/ColorCheckbox.vue +157 -157
- package/src/components/input/IInput.vue +66 -66
- package/src/components/menu/SideMenu.vue +75 -75
- package/src/components/menu/menu.js +273 -273
- package/src/components/tool/AStepItem.vue +60 -60
- package/src/layouts/CommonLayout.vue +56 -56
- package/src/layouts/header/HeaderNotice.vue +177 -177
- package/src/lib.js +1 -1
- package/src/mock/extend/index.js +84 -84
- package/src/mock/goods/index.js +108 -108
- package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
- package/src/pages/system/dictionary/index.vue +44 -44
- package/src/pages/system/monitor/loginInfor/index.vue +37 -37
- package/src/pages/system/monitor/operLog/index.vue +37 -37
- package/src/router/async/router.map.js +10 -15
- package/src/services/api/cas.js +79 -79
- package/src/services/api/common.js +10 -2
- package/src/services/api/restTools.js +11 -0
- package/src/services/v3Api.js +25 -17
- package/src/store/modules/setting.js +119 -119
- package/src/utils/authority-utils.js +85 -85
- package/src/utils/errorCode.js +6 -6
- package/src/utils/request.js +68 -80
- package/src/utils/requestDedupe.js +245 -0
- package/vue.config.js +40 -42
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
- package/assets/c__Users_QXLL_AppData_Roaming_Cursor_User_workspaceStorage_4fb3d7e3441d32bc6f2c7358b4188b48_images_e8c132e6dde513250d7f9721712df1f8-f1522a08-1aa0-4866-b4e5-b34cf2e21109.png +0 -0
- package/docs/HChart/351/205/215/347/275/256/346/226/207/346/241/243.md +0 -960
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-card :bordered="false">
|
|
3
|
-
<x-form-table
|
|
4
|
-
title="操作日志"
|
|
5
|
-
:queryParamsName="queryParamsName"
|
|
6
|
-
serviceName="af-system"
|
|
7
|
-
@action="toDetail">
|
|
8
|
-
</x-form-table>
|
|
9
|
-
</a-card>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
name: 'OperLog',
|
|
17
|
-
components: {
|
|
18
|
-
XFormTable
|
|
19
|
-
},
|
|
20
|
-
data () {
|
|
21
|
-
return {
|
|
22
|
-
// 选中的编号
|
|
23
|
-
selectNo: undefined,
|
|
24
|
-
// 查询配置文件名
|
|
25
|
-
queryParamsName: 'crud_oper_log_manage',
|
|
26
|
-
// 是否显示详情抽屉
|
|
27
|
-
detailVisible: false
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
toDetail (record, id) {
|
|
32
|
-
this.selectNo = id + ''
|
|
33
|
-
this.detailVisible = true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<a-card :bordered="false">
|
|
3
|
+
<x-form-table
|
|
4
|
+
title="操作日志"
|
|
5
|
+
:queryParamsName="queryParamsName"
|
|
6
|
+
serviceName="af-system"
|
|
7
|
+
@action="toDetail">
|
|
8
|
+
</x-form-table>
|
|
9
|
+
</a-card>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'OperLog',
|
|
17
|
+
components: {
|
|
18
|
+
XFormTable
|
|
19
|
+
},
|
|
20
|
+
data () {
|
|
21
|
+
return {
|
|
22
|
+
// 选中的编号
|
|
23
|
+
selectNo: undefined,
|
|
24
|
+
// 查询配置文件名
|
|
25
|
+
queryParamsName: 'crud_oper_log_manage',
|
|
26
|
+
// 是否显示详情抽屉
|
|
27
|
+
detailVisible: false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
toDetail (record, id) {
|
|
32
|
+
this.selectNo = id + ''
|
|
33
|
+
this.detailVisible = true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
@@ -25,8 +25,7 @@ routerResource.chargeQuery = () => import('@vue2-client/base-client/components/c
|
|
|
25
25
|
// --------------------------------------仪表盘--------------------------------------
|
|
26
26
|
routerResource.dashboard = view.blank
|
|
27
27
|
// 工作台
|
|
28
|
-
routerResource.workplace = () =>
|
|
29
|
-
import('@vue2-client/pages/dashboard/workplace')
|
|
28
|
+
routerResource.workplace = () => import('@vue2-client/pages/dashboard/workplace')
|
|
30
29
|
// --------------------------------------系统配置--------------------------------------
|
|
31
30
|
routerResource.system = view.blank
|
|
32
31
|
// 字典管理
|
|
@@ -51,18 +50,18 @@ routerResource.dynamicStatistics = () => import('@vue2-client/pages/DynamicStati
|
|
|
51
50
|
routerResource.newDynamicStatistics = () => import('@vue2-client/pages/NewDynamicStatistics')
|
|
52
51
|
// 示例页面
|
|
53
52
|
routerResource.example = {
|
|
54
|
-
path: 'example',
|
|
53
|
+
path: 'example',
|
|
55
54
|
name: '示例主页面',
|
|
56
55
|
// component: () => import('@vue2-client/base-client/components/common/XDescriptions/demo.vue'),
|
|
57
56
|
// component: () => import('@vue2-client/base-client/components/his/HChart/demo.vue'),
|
|
58
57
|
// component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
|
|
59
|
-
// component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue')
|
|
60
|
-
component: () => import('@vue2-client/base-client/components/common/ImagePreviewModal/demo.vue'),
|
|
58
|
+
// component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue')
|
|
59
|
+
// component: () => import('@vue2-client/base-client/components/common/ImagePreviewModal/demo.vue'),
|
|
61
60
|
// component: () => import('@vue2-client/components/xScrollBox/example.vue'),
|
|
62
61
|
// component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
|
|
63
62
|
// component: () => import('@vue2-client/pages/addressSelect/addressDemo.vue'),
|
|
64
63
|
// component: () => import('@vue2-client/base-client/components/common/XDescriptions/demo.vue'),
|
|
65
|
-
|
|
64
|
+
component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue')
|
|
66
65
|
// component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
|
|
67
66
|
// component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
|
|
68
67
|
// component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
|
|
@@ -103,34 +102,30 @@ const routerMap = {
|
|
|
103
102
|
login: {
|
|
104
103
|
authority: '*',
|
|
105
104
|
path: '/login',
|
|
106
|
-
component: process.env.VUE_APP_LOGIN_VERSION === 'V3'
|
|
107
|
-
? view.loginv3 : view.login
|
|
105
|
+
component: process.env.VUE_APP_LOGIN_VERSION === 'V3' ? view.loginv3 : view.login
|
|
108
106
|
},
|
|
109
107
|
root: {
|
|
110
108
|
path: '/',
|
|
111
109
|
name: '首页',
|
|
112
110
|
// 只有在非微前端环境下才进行重定向,或者通过环境变量控制
|
|
113
111
|
redirect: window.__MICRO_APP_ENVIRONMENT__ ? undefined : homePage,
|
|
114
|
-
component: process.env.VUE_APP_SINGLE_PAPER === 'TRUE' ? view.blank : view.tabs
|
|
112
|
+
component: process.env.VUE_APP_SINGLE_PAPER === 'TRUE' ? view.blank : view.tabs
|
|
115
113
|
},
|
|
116
114
|
exp403: {
|
|
117
115
|
authority: '*',
|
|
118
116
|
name: 'exp403',
|
|
119
117
|
path: '403',
|
|
120
|
-
component: () =>
|
|
121
|
-
import('@vue2-client/pages/exception/403')
|
|
118
|
+
component: () => import('@vue2-client/pages/exception/403')
|
|
122
119
|
},
|
|
123
120
|
exp404: {
|
|
124
121
|
name: 'exp404',
|
|
125
122
|
path: '404',
|
|
126
|
-
component: () =>
|
|
127
|
-
import('@vue2-client/pages/exception/404')
|
|
123
|
+
component: () => import('@vue2-client/pages/exception/404')
|
|
128
124
|
},
|
|
129
125
|
exp500: {
|
|
130
126
|
name: 'exp500',
|
|
131
127
|
path: '500',
|
|
132
|
-
component: () =>
|
|
133
|
-
import('@vue2-client/pages/exception/500')
|
|
128
|
+
component: () => import('@vue2-client/pages/exception/500')
|
|
134
129
|
}
|
|
135
130
|
}
|
|
136
131
|
Object.assign(routerMap, routerResource)
|
package/src/services/api/cas.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { post } from '@vue2-client/services/api/restTools'
|
|
2
|
-
import notification from 'ant-design-vue/lib/notification'
|
|
3
|
-
import { logout } from '@vue2-client/services/user'
|
|
4
|
-
import Cookie from 'js-cookie'
|
|
5
|
-
|
|
6
|
-
const casApi = {
|
|
7
|
-
// 根据用户信息校验服务访问权限并生成ST
|
|
8
|
-
createSTByUserInfo: '/api/af-sso/logic/createSTByUserInfo',
|
|
9
|
-
// 根据TGC生成ST
|
|
10
|
-
createSTByTGC: '/api/af-sso/logic/createSTByTGC',
|
|
11
|
-
// 验证ST
|
|
12
|
-
serviceValidate: '/api/af-sso/logic/openapi/serviceValidate',
|
|
13
|
-
// 其他验证
|
|
14
|
-
otherValidate: '/api/af-sso/logic'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function setTGTCookie (cookie) {
|
|
18
|
-
return Cookie.set('TGT-Cookie', cookie)
|
|
19
|
-
}
|
|
20
|
-
function removeTGTCookie () {
|
|
21
|
-
return Cookie.remove('TGT-Cookie')
|
|
22
|
-
}
|
|
23
|
-
export function getTGTCookie () {
|
|
24
|
-
return Cookie.get('TGT-Cookie')
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function CASLoginByAuth (serviceKey) {
|
|
28
|
-
return new Promise((resolve, reject) => {
|
|
29
|
-
post(casApi.createSTByUserInfo, {
|
|
30
|
-
serviceKey: serviceKey
|
|
31
|
-
}).then(res => {
|
|
32
|
-
setTGTCookie(res.tgc)
|
|
33
|
-
resolve(res)
|
|
34
|
-
}).catch(msg => {
|
|
35
|
-
reject(msg)
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function CASLogin (serviceKey, inner) {
|
|
41
|
-
// 从第三方跳转登录
|
|
42
|
-
const tgc = getTGTCookie()
|
|
43
|
-
if (tgc && !inner) {
|
|
44
|
-
return new Promise((resolve, reject) => {
|
|
45
|
-
post(casApi.createSTByTGC, {
|
|
46
|
-
serviceKey: serviceKey,
|
|
47
|
-
tgc: tgc
|
|
48
|
-
}).then(res => {
|
|
49
|
-
resolve(res)
|
|
50
|
-
}).catch(msg => {
|
|
51
|
-
if (msg === '当前操作没有权限') {
|
|
52
|
-
removeTGTCookie()
|
|
53
|
-
notification.error({
|
|
54
|
-
message: '授权已过期,请重新登录',
|
|
55
|
-
description: '2秒后自动跳转回登陆页面'
|
|
56
|
-
})
|
|
57
|
-
logout().then(() => {
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
window.location.href = '/login?serviceKey=' + serviceKey
|
|
60
|
-
}, 1500)
|
|
61
|
-
})
|
|
62
|
-
} else {
|
|
63
|
-
reject(msg)
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
} else {
|
|
68
|
-
return CASLoginByAuth(serviceKey)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function doOtherValidate (logicName, st, serviceKey) {
|
|
73
|
-
return post(casApi.otherValidate + '/' + logicName, {
|
|
74
|
-
st: st,
|
|
75
|
-
serviceKey: serviceKey
|
|
76
|
-
}, null)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export default casApi
|
|
1
|
+
import { post } from '@vue2-client/services/api/restTools'
|
|
2
|
+
import notification from 'ant-design-vue/lib/notification'
|
|
3
|
+
import { logout } from '@vue2-client/services/user'
|
|
4
|
+
import Cookie from 'js-cookie'
|
|
5
|
+
|
|
6
|
+
const casApi = {
|
|
7
|
+
// 根据用户信息校验服务访问权限并生成ST
|
|
8
|
+
createSTByUserInfo: '/api/af-sso/logic/createSTByUserInfo',
|
|
9
|
+
// 根据TGC生成ST
|
|
10
|
+
createSTByTGC: '/api/af-sso/logic/createSTByTGC',
|
|
11
|
+
// 验证ST
|
|
12
|
+
serviceValidate: '/api/af-sso/logic/openapi/serviceValidate',
|
|
13
|
+
// 其他验证
|
|
14
|
+
otherValidate: '/api/af-sso/logic'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function setTGTCookie (cookie) {
|
|
18
|
+
return Cookie.set('TGT-Cookie', cookie)
|
|
19
|
+
}
|
|
20
|
+
function removeTGTCookie () {
|
|
21
|
+
return Cookie.remove('TGT-Cookie')
|
|
22
|
+
}
|
|
23
|
+
export function getTGTCookie () {
|
|
24
|
+
return Cookie.get('TGT-Cookie')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function CASLoginByAuth (serviceKey) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
post(casApi.createSTByUserInfo, {
|
|
30
|
+
serviceKey: serviceKey
|
|
31
|
+
}).then(res => {
|
|
32
|
+
setTGTCookie(res.tgc)
|
|
33
|
+
resolve(res)
|
|
34
|
+
}).catch(msg => {
|
|
35
|
+
reject(msg)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function CASLogin (serviceKey, inner) {
|
|
41
|
+
// 从第三方跳转登录
|
|
42
|
+
const tgc = getTGTCookie()
|
|
43
|
+
if (tgc && !inner) {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
post(casApi.createSTByTGC, {
|
|
46
|
+
serviceKey: serviceKey,
|
|
47
|
+
tgc: tgc
|
|
48
|
+
}).then(res => {
|
|
49
|
+
resolve(res)
|
|
50
|
+
}).catch(msg => {
|
|
51
|
+
if (msg === '当前操作没有权限') {
|
|
52
|
+
removeTGTCookie()
|
|
53
|
+
notification.error({
|
|
54
|
+
message: '授权已过期,请重新登录',
|
|
55
|
+
description: '2秒后自动跳转回登陆页面'
|
|
56
|
+
})
|
|
57
|
+
logout().then(() => {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
window.location.href = '/login?serviceKey=' + serviceKey
|
|
60
|
+
}, 1500)
|
|
61
|
+
})
|
|
62
|
+
} else {
|
|
63
|
+
reject(msg)
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
} else {
|
|
68
|
+
return CASLoginByAuth(serviceKey)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function doOtherValidate (logicName, st, serviceKey) {
|
|
73
|
+
return post(casApi.otherValidate + '/' + logicName, {
|
|
74
|
+
st: st,
|
|
75
|
+
serviceKey: serviceKey
|
|
76
|
+
}, null)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default casApi
|
|
@@ -141,13 +141,21 @@ export function parseConfig (configContent, configType) {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* 通用执行业务逻辑
|
|
144
|
+
* @param {string} logicName - 业务逻辑名称
|
|
145
|
+
* @param {object} parameter - 请求参数
|
|
146
|
+
* @param {string} serviceName - 服务名称
|
|
147
|
+
* @param {boolean} isDev - 是否开发环境
|
|
148
|
+
* @param {object} config - 请求配置
|
|
149
|
+
* @param {boolean} config.dedupe - 是否启用去重(默认 true)
|
|
150
|
+
* @param {string} config.dedupeStrategy - 去重策略:'reject'(拒绝)或 'reuse'(复用结果)
|
|
151
|
+
* @param {boolean|string} config.globalLoading - 是否显示全局 Loading
|
|
144
152
|
*/
|
|
145
|
-
export function runLogic (logicName, parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME, isDev) {
|
|
153
|
+
export function runLogic (logicName, parameter, serviceName = process.env.VUE_APP_SYSTEM_NAME, isDev, config = {}) {
|
|
146
154
|
let apiPre = '/api/'
|
|
147
155
|
if (isDev) {
|
|
148
156
|
apiPre = '/devApi/'
|
|
149
157
|
}
|
|
150
|
-
return post(apiPre + serviceName + '/logic/' + logicName, parameter)
|
|
158
|
+
return post(apiPre + serviceName + '/logic/' + logicName, parameter, config)
|
|
151
159
|
}
|
|
152
160
|
|
|
153
161
|
/**
|
|
@@ -19,7 +19,18 @@ function get (url, parameter) {
|
|
|
19
19
|
* @param config 配置项
|
|
20
20
|
* @param {boolean|string} config.globalLoading - 是否显示全局 Loading,可传入字符串作为提示文字
|
|
21
21
|
* @param {boolean} config.dedupe - 是否启用请求去重(POST 默认开启,设为 false 可关闭)
|
|
22
|
+
* @param {string} config.dedupeStrategy - 去重策略:'reject'(拒绝,默认)或 'reuse'(复用结果)
|
|
22
23
|
* @returns {Promise<AxiosResponse<T>>}
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // 表单提交 - 默认拒绝重复(防止重复提交)
|
|
27
|
+
* post('/api/save', formData)
|
|
28
|
+
*
|
|
29
|
+
* // 下拉框数据 - 复用结果(多处同时请求共享结果)
|
|
30
|
+
* post('/api/options', params, { dedupe: true, dedupeStrategy: 'reuse' })
|
|
31
|
+
*
|
|
32
|
+
* // 列表查询 - 关闭去重(允许重复查询)
|
|
33
|
+
* post('/api/list', params, { dedupe: false })
|
|
23
34
|
*/
|
|
24
35
|
function post (url, parameter, config = {}) {
|
|
25
36
|
// 兼容 config 为 null 的情况
|
package/src/services/v3Api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { METHOD, request } from '@vue2-client/utils/request'
|
|
2
2
|
import { runLogic } from '@vue2-client/services/api/common'
|
|
3
3
|
|
|
4
|
-
function getLeafNodes
|
|
4
|
+
function getLeafNodes(nodes) {
|
|
5
5
|
// 确保 nodes 是数组
|
|
6
6
|
const nodeArray = Array.isArray(nodes) ? nodes : [nodes]
|
|
7
7
|
return nodeArray.reduce((leaves, node) => {
|
|
@@ -16,7 +16,7 @@ function getLeafNodes (nodes) {
|
|
|
16
16
|
}, [])
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function getLeafNodesByCondition
|
|
19
|
+
function getLeafNodesByCondition(type, nodes, parent = null) {
|
|
20
20
|
// 确保 nodes 是数组
|
|
21
21
|
const nodeArray = Array.isArray(nodes) ? nodes : [nodes]
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ function getLeafNodesByCondition (type, nodes, parent = null) {
|
|
|
29
29
|
if (isValidNode) {
|
|
30
30
|
leaves.push({
|
|
31
31
|
...node,
|
|
32
|
-
name: parent ? `${node.name}-${parent}` : node.name
|
|
32
|
+
name: parent ? `${node.name}-${parent}` : node.name
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
// 递归处理子节点
|
|
@@ -38,7 +38,7 @@ function getLeafNodesByCondition (type, nodes, parent = null) {
|
|
|
38
38
|
// 无子节点但符合条件时,直接加入叶子节点列表
|
|
39
39
|
leaves.push({
|
|
40
40
|
...node,
|
|
41
|
-
name: parent ? `${node.name}-${parent}` : node.name
|
|
41
|
+
name: parent ? `${node.name}-${parent}` : node.name
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -46,8 +46,8 @@ function getLeafNodesByCondition (type, nodes, parent = null) {
|
|
|
46
46
|
}, [])
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function transformData
|
|
50
|
-
function transform
|
|
49
|
+
function transformData(inputData) {
|
|
50
|
+
function transform(node) {
|
|
51
51
|
return {
|
|
52
52
|
label: node.name,
|
|
53
53
|
value: node.id,
|
|
@@ -61,23 +61,31 @@ function transformData (inputData) {
|
|
|
61
61
|
return inputData.map(transform)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
// 复用策略配置:相同请求共享结果,避免重复网络请求
|
|
65
|
+
const REUSE_CONFIG = { dedupe: true, dedupeStrategy: 'reuse' }
|
|
66
|
+
|
|
67
|
+
function getResData(params, toCallback) {
|
|
68
|
+
const data = {
|
|
69
|
+
userId: params.userid,
|
|
70
|
+
roleName: params.roleName,
|
|
71
|
+
filter: params.filter,
|
|
72
|
+
filterType: params.filterType
|
|
73
|
+
}
|
|
66
74
|
if (params.source === '获取分公司') {
|
|
67
|
-
runLogic('getOrgBySearch', data, 'af-system').then(res => toCallback(res))
|
|
75
|
+
runLogic('getOrgBySearch', data, 'af-system', false, REUSE_CONFIG).then(res => toCallback(res))
|
|
68
76
|
} else if (params.source === '获取部门') {
|
|
69
|
-
runLogic('getDepBySearch', data, 'af-system').then(res => toCallback(res))
|
|
77
|
+
runLogic('getDepBySearch', data, 'af-system', false, REUSE_CONFIG).then(res => toCallback(res))
|
|
70
78
|
} else if (params.source === '获取人员') {
|
|
71
|
-
runLogic('getUserBySearch', data, 'af-system').then(res => toCallback(res))
|
|
79
|
+
runLogic('getUserBySearch', data, 'af-system', false, REUSE_CONFIG).then(res => toCallback(res))
|
|
72
80
|
} else if (params.source === '根据角色获取人员') {
|
|
73
|
-
runLogic('getUserBySearchRole', data, 'af-system').then(res => toCallback(res))
|
|
81
|
+
runLogic('getUserBySearchRole', data, 'af-system', false, REUSE_CONFIG).then(res => toCallback(res))
|
|
74
82
|
} else {
|
|
75
83
|
return search(params).then(res => toCallback(res))
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
|
|
79
|
-
export async function searchToOption
|
|
80
|
-
function toCallback
|
|
87
|
+
export async function searchToOption(params, callback) {
|
|
88
|
+
function toCallback(res) {
|
|
81
89
|
if (res.length) {
|
|
82
90
|
if (res[0].children && res[0].children.length) {
|
|
83
91
|
if (res[0].children[0].children) {
|
|
@@ -96,8 +104,8 @@ export async function searchToOption (params, callback) {
|
|
|
96
104
|
await getResData(params, toCallback)
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
export async function searchToListOption
|
|
100
|
-
function toCallback
|
|
107
|
+
export async function searchToListOption(params, callback) {
|
|
108
|
+
function toCallback(res) {
|
|
101
109
|
if (params.source.includes('人员')) {
|
|
102
110
|
callback(transformData(getLeafNodes(res)))
|
|
103
111
|
} else {
|
|
@@ -109,7 +117,7 @@ export async function searchToListOption (params, callback) {
|
|
|
109
117
|
await getResData(params, toCallback)
|
|
110
118
|
}
|
|
111
119
|
|
|
112
|
-
export async function search
|
|
120
|
+
export async function search(params) {
|
|
113
121
|
return request('/rs/search', METHOD.POST, params)
|
|
114
122
|
}
|
|
115
123
|
|