vue2-client 1.13.23 → 1.13.25
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/package.json +107 -107
- package/src/base-client/components/common/XDescriptions/XDescriptions.vue +174 -174
- package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +314 -314
- package/src/base-client/components/common/XReportGrid/XReportDemo.vue +44 -44
- package/src/base-client/components/common/XSimpleDescriptions/XSimpleDescriptions.vue +166 -166
- package/src/base-client/components/his/XSelect/XSelect.vue +72 -72
- package/src/base-client/components/his/XTimeSelect/XTimeSelect.vue +131 -131
- package/src/base-client/components/his/XTitle/XTitle.vue +62 -62
- package/src/base-client/components/layout/XPageView/XPageView.vue +155 -155
- package/src/base-client/plugins/AppData.js +126 -126
- package/src/config/CreateQueryConfig.js +325 -325
- package/src/pages/ReportGrid/index.vue +76 -76
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +876 -876
- package/src/pages/XTreeOneProExample/index.vue +67 -67
- package/src/router/async/router.map.js +119 -127
- package/src/services/api/common.js +1 -1
- package/src/base-client/components/common/XCollapse/XCollapseDemo.vue +0 -15
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
3
|
-
import { reactive, ref, provide } from 'vue'
|
|
4
|
-
import RenderRow from './RenderRow'
|
|
5
|
-
import Exp500 from '@vue2-client/pages/exception/500.vue'
|
|
6
|
-
|
|
7
|
-
const layout = ref(null)
|
|
8
|
-
|
|
9
|
-
// 加载状态,0:加载中,1:已加载,2:出现错误
|
|
10
|
-
const loaded = ref(0)
|
|
11
|
-
|
|
12
|
-
// 声明组件总数
|
|
13
|
-
const componentTotal = ref(0)
|
|
14
|
-
|
|
15
|
-
// 注册组件总数
|
|
16
|
-
const registerComponentTotal = ref(0)
|
|
17
|
-
|
|
18
|
-
// 组件注册集
|
|
19
|
-
const componentRefMap = reactive({})
|
|
20
|
-
|
|
21
|
-
// 通用参数
|
|
22
|
-
const data = {
|
|
23
|
-
comps: componentRefMap,
|
|
24
|
-
func: {
|
|
25
|
-
getConfigByName: getConfigByName
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 初始化构建页面组件
|
|
31
|
-
* @param params
|
|
32
|
-
*/
|
|
33
|
-
function init (params) {
|
|
34
|
-
const {
|
|
35
|
-
configName,
|
|
36
|
-
configValue,
|
|
37
|
-
serviceName
|
|
38
|
-
} = params
|
|
39
|
-
loaded.value = 0
|
|
40
|
-
const getConfigAfter = (res) => {
|
|
41
|
-
if (res == null) {
|
|
42
|
-
loaded.value = 2
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
layout.value = res
|
|
46
|
-
// 设置组件总量
|
|
47
|
-
setComponentTotal(layout.value.children)
|
|
48
|
-
loaded.value = 1
|
|
49
|
-
}
|
|
50
|
-
if (configName) {
|
|
51
|
-
getConfigByName(configName, serviceName, getConfigAfter)
|
|
52
|
-
} else {
|
|
53
|
-
getConfigAfter(JSON.parse(configValue))
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 注册组件
|
|
59
|
-
* @param name 组件名称
|
|
60
|
-
* @param vm 组件实例
|
|
61
|
-
*/
|
|
62
|
-
function registerComponent (name, vm) {
|
|
63
|
-
componentRefMap[name] = vm
|
|
64
|
-
registerComponentTotal.value = registerComponentTotal.value + 1
|
|
65
|
-
console.info(`总组件数量:${componentTotal.value},已注册数量:${registerComponentTotal.value}`)
|
|
66
|
-
// 初始化页面
|
|
67
|
-
initPage()
|
|
68
|
-
if (registerComponentTotal.value >= componentTotal.value) {
|
|
69
|
-
// 注册事件
|
|
70
|
-
registerEvents(layout.value.children)
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
provide('registerComponent', registerComponent)
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 初始化页面
|
|
77
|
-
*/
|
|
78
|
-
function initPage () {
|
|
79
|
-
if (layout.value.onMounted) {
|
|
80
|
-
// eslint-disable-next-line no-eval
|
|
81
|
-
const onMountedFun = eval('(' + layout.value.onMounted + ')')
|
|
82
|
-
onMountedFun(data)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* 设置需要注册的组件总数
|
|
88
|
-
* @param children 组件集合
|
|
89
|
-
*/
|
|
90
|
-
function setComponentTotal (children) {
|
|
91
|
-
children.forEach((child) => {
|
|
92
|
-
// 如果不是row类型,追加组件数量
|
|
93
|
-
if (child.type !== 'row') {
|
|
94
|
-
componentTotal.value = componentTotal.value + 1
|
|
95
|
-
}
|
|
96
|
-
// 递归追加子组件数量
|
|
97
|
-
if (child.children) {
|
|
98
|
-
setComponentTotal(child.children)
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* 注册组件事件
|
|
105
|
-
* @param children 组件集合
|
|
106
|
-
*/
|
|
107
|
-
function registerEvents (children) {
|
|
108
|
-
children.forEach((child) => {
|
|
109
|
-
// 如果有事件,注册它们
|
|
110
|
-
if (child.event) {
|
|
111
|
-
Object.entries(child.event).forEach(([eventName, handler]) => {
|
|
112
|
-
// eslint-disable-next-line no-eval
|
|
113
|
-
const eventHandler = eval('(' + handler + ')')
|
|
114
|
-
const componentInstance = componentRefMap[child.id]
|
|
115
|
-
if (componentInstance) {
|
|
116
|
-
// 创建一个包装函数以传递额外参数
|
|
117
|
-
const wrappedHandler = function (...args) {
|
|
118
|
-
// 这里可以传递额外的参数,例如:
|
|
119
|
-
eventHandler.call(componentInstance, ...args, data)
|
|
120
|
-
}
|
|
121
|
-
componentInstance.$on(eventName, wrappedHandler)
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// 递归注册子组件的事件
|
|
127
|
-
if (child.children) {
|
|
128
|
-
registerEvents(child.children)
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
defineExpose({
|
|
134
|
-
init
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
</script>
|
|
138
|
-
|
|
139
|
-
<template>
|
|
140
|
-
<div class="liuli_page">
|
|
141
|
-
<div class="liuli_page_main" v-if="loaded === 1">
|
|
142
|
-
<render-row
|
|
143
|
-
v-for="row in layout.children"
|
|
144
|
-
:key="row.id"
|
|
145
|
-
:row="row"
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
<div class="liuli_page_error" v-else-if="loaded === 2">
|
|
149
|
-
<exp500></exp500>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</template>
|
|
153
|
-
|
|
154
|
-
<style scoped lang="less">
|
|
155
|
-
</style>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
3
|
+
import { reactive, ref, provide } from 'vue'
|
|
4
|
+
import RenderRow from './RenderRow'
|
|
5
|
+
import Exp500 from '@vue2-client/pages/exception/500.vue'
|
|
6
|
+
|
|
7
|
+
const layout = ref(null)
|
|
8
|
+
|
|
9
|
+
// 加载状态,0:加载中,1:已加载,2:出现错误
|
|
10
|
+
const loaded = ref(0)
|
|
11
|
+
|
|
12
|
+
// 声明组件总数
|
|
13
|
+
const componentTotal = ref(0)
|
|
14
|
+
|
|
15
|
+
// 注册组件总数
|
|
16
|
+
const registerComponentTotal = ref(0)
|
|
17
|
+
|
|
18
|
+
// 组件注册集
|
|
19
|
+
const componentRefMap = reactive({})
|
|
20
|
+
|
|
21
|
+
// 通用参数
|
|
22
|
+
const data = {
|
|
23
|
+
comps: componentRefMap,
|
|
24
|
+
func: {
|
|
25
|
+
getConfigByName: getConfigByName
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 初始化构建页面组件
|
|
31
|
+
* @param params
|
|
32
|
+
*/
|
|
33
|
+
function init (params) {
|
|
34
|
+
const {
|
|
35
|
+
configName,
|
|
36
|
+
configValue,
|
|
37
|
+
serviceName
|
|
38
|
+
} = params
|
|
39
|
+
loaded.value = 0
|
|
40
|
+
const getConfigAfter = (res) => {
|
|
41
|
+
if (res == null) {
|
|
42
|
+
loaded.value = 2
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
layout.value = res
|
|
46
|
+
// 设置组件总量
|
|
47
|
+
setComponentTotal(layout.value.children)
|
|
48
|
+
loaded.value = 1
|
|
49
|
+
}
|
|
50
|
+
if (configName) {
|
|
51
|
+
getConfigByName(configName, serviceName, getConfigAfter)
|
|
52
|
+
} else {
|
|
53
|
+
getConfigAfter(JSON.parse(configValue))
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 注册组件
|
|
59
|
+
* @param name 组件名称
|
|
60
|
+
* @param vm 组件实例
|
|
61
|
+
*/
|
|
62
|
+
function registerComponent (name, vm) {
|
|
63
|
+
componentRefMap[name] = vm
|
|
64
|
+
registerComponentTotal.value = registerComponentTotal.value + 1
|
|
65
|
+
console.info(`总组件数量:${componentTotal.value},已注册数量:${registerComponentTotal.value}`)
|
|
66
|
+
// 初始化页面
|
|
67
|
+
initPage()
|
|
68
|
+
if (registerComponentTotal.value >= componentTotal.value) {
|
|
69
|
+
// 注册事件
|
|
70
|
+
registerEvents(layout.value.children)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
provide('registerComponent', registerComponent)
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 初始化页面
|
|
77
|
+
*/
|
|
78
|
+
function initPage () {
|
|
79
|
+
if (layout.value.onMounted) {
|
|
80
|
+
// eslint-disable-next-line no-eval
|
|
81
|
+
const onMountedFun = eval('(' + layout.value.onMounted + ')')
|
|
82
|
+
onMountedFun(data)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 设置需要注册的组件总数
|
|
88
|
+
* @param children 组件集合
|
|
89
|
+
*/
|
|
90
|
+
function setComponentTotal (children) {
|
|
91
|
+
children.forEach((child) => {
|
|
92
|
+
// 如果不是row类型,追加组件数量
|
|
93
|
+
if (child.type !== 'row') {
|
|
94
|
+
componentTotal.value = componentTotal.value + 1
|
|
95
|
+
}
|
|
96
|
+
// 递归追加子组件数量
|
|
97
|
+
if (child.children) {
|
|
98
|
+
setComponentTotal(child.children)
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 注册组件事件
|
|
105
|
+
* @param children 组件集合
|
|
106
|
+
*/
|
|
107
|
+
function registerEvents (children) {
|
|
108
|
+
children.forEach((child) => {
|
|
109
|
+
// 如果有事件,注册它们
|
|
110
|
+
if (child.event) {
|
|
111
|
+
Object.entries(child.event).forEach(([eventName, handler]) => {
|
|
112
|
+
// eslint-disable-next-line no-eval
|
|
113
|
+
const eventHandler = eval('(' + handler + ')')
|
|
114
|
+
const componentInstance = componentRefMap[child.id]
|
|
115
|
+
if (componentInstance) {
|
|
116
|
+
// 创建一个包装函数以传递额外参数
|
|
117
|
+
const wrappedHandler = function (...args) {
|
|
118
|
+
// 这里可以传递额外的参数,例如:
|
|
119
|
+
eventHandler.call(componentInstance, ...args, data)
|
|
120
|
+
}
|
|
121
|
+
componentInstance.$on(eventName, wrappedHandler)
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 递归注册子组件的事件
|
|
127
|
+
if (child.children) {
|
|
128
|
+
registerEvents(child.children)
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
defineExpose({
|
|
134
|
+
init
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<template>
|
|
140
|
+
<div class="liuli_page">
|
|
141
|
+
<div class="liuli_page_main" v-if="loaded === 1">
|
|
142
|
+
<render-row
|
|
143
|
+
v-for="row in layout.children"
|
|
144
|
+
:key="row.id"
|
|
145
|
+
:row="row"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="liuli_page_error" v-else-if="loaded === 2">
|
|
149
|
+
<exp500></exp500>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<style scoped lang="less">
|
|
155
|
+
</style>
|
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
import { manageApi, post } from '@vue2-client/services/api'
|
|
2
|
-
import { handleTree } from '@vue2-client/utils/util'
|
|
3
|
-
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
4
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
5
|
-
|
|
6
|
-
const GetAppDataService = {
|
|
7
|
-
install (Vue) {
|
|
8
|
-
// 给vue增添对话框显示方法
|
|
9
|
-
Vue.$appdata = Vue.prototype.$appdata = GetAppDataService
|
|
10
|
-
},
|
|
11
|
-
async load () {
|
|
12
|
-
const params = {}
|
|
13
|
-
await post(manageApi.getDictionaryValue, {}).then((res) => {
|
|
14
|
-
Object.assign(params, res)
|
|
15
|
-
const badgeItemArray = {}
|
|
16
|
-
for (const key of Object.keys(params)) {
|
|
17
|
-
badgeItemArray[key] = {}
|
|
18
|
-
for (const item of params[key]) {
|
|
19
|
-
let status
|
|
20
|
-
if (!item.status) {
|
|
21
|
-
status = 'none'
|
|
22
|
-
} else {
|
|
23
|
-
status = item.status
|
|
24
|
-
}
|
|
25
|
-
badgeItemArray[key][item.value] = {
|
|
26
|
-
status: status,
|
|
27
|
-
text: item.text
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
// 追加参数
|
|
32
|
-
localStorage.setItem(process.env.VUE_APP_DICTIONARY_KEY, JSON.stringify(params))
|
|
33
|
-
localStorage.setItem(process.env.VUE_APP_BADGE_KEY, JSON.stringify(badgeItemArray))
|
|
34
|
-
})
|
|
35
|
-
},
|
|
36
|
-
// 返回树形省市区
|
|
37
|
-
async getDivisionsOhChinaForTree () {
|
|
38
|
-
// 获取省市区数据
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
try {
|
|
41
|
-
indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, res => {
|
|
42
|
-
resolve(res)
|
|
43
|
-
}, processRes => {
|
|
44
|
-
return handleTree(processRes, 'code', 'parentcode')
|
|
45
|
-
})
|
|
46
|
-
} catch (e) {
|
|
47
|
-
reject(e)
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
},
|
|
51
|
-
// 旧版获取配置中心字典
|
|
52
|
-
getDictionaryList (key) {
|
|
53
|
-
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
54
|
-
const object = JSON.parse(str)
|
|
55
|
-
return object[key]
|
|
56
|
-
},
|
|
57
|
-
async getDictValue (dictKey, value, func, isDev = false, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
|
|
58
|
-
const processResult = (result) => {
|
|
59
|
-
if (!result.value) {
|
|
60
|
-
return {
|
|
61
|
-
status: 'none',
|
|
62
|
-
text: value
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const item = result.value.find(item => item.value == value)
|
|
66
|
-
if (item) {
|
|
67
|
-
return {
|
|
68
|
-
status: item.status || 'none',
|
|
69
|
-
text: item.label
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
status: 'none',
|
|
74
|
-
text: value
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (func) {
|
|
78
|
-
getConfigByName(dictKey, serviceName, result => {
|
|
79
|
-
func(processResult(result))
|
|
80
|
-
}, isDev)
|
|
81
|
-
} else {
|
|
82
|
-
const result = await new Promise((resolve) => {
|
|
83
|
-
getConfigByName(dictKey, serviceName, resolve, isDev)
|
|
84
|
-
})
|
|
85
|
-
return processResult(result)
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
// 新版获取配置中心字典推荐使用 服务名默认为当前服务
|
|
89
|
-
getDictByKey (dictKey, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback, isDev) {
|
|
90
|
-
getConfigByName(dictKey, undefined, result => {
|
|
91
|
-
callback(result.value)
|
|
92
|
-
}, isDev)
|
|
93
|
-
},
|
|
94
|
-
getParam (key, value, callback) {
|
|
95
|
-
const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
|
|
96
|
-
const object = JSON.parse(str)
|
|
97
|
-
if (object && object[key]) {
|
|
98
|
-
const result = object[key]
|
|
99
|
-
if (Object.prototype.hasOwnProperty.call(result, value)) {
|
|
100
|
-
return result[value]
|
|
101
|
-
} else {
|
|
102
|
-
return { status: 'none', text: value }
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return null
|
|
106
|
-
},
|
|
107
|
-
getParams () {
|
|
108
|
-
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
109
|
-
return JSON.parse(str)
|
|
110
|
-
},
|
|
111
|
-
getSingleValues () {
|
|
112
|
-
const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
|
|
113
|
-
return JSON.parse(str)
|
|
114
|
-
},
|
|
115
|
-
getWebConfigByKey (key) {
|
|
116
|
-
const str = localStorage.getItem(process.env.VUE_APP_WEB_CONFIG_KEY)
|
|
117
|
-
const object = JSON.parse(str)
|
|
118
|
-
return object[key]
|
|
119
|
-
},
|
|
120
|
-
getStylesByKey (key) {
|
|
121
|
-
const str = localStorage.getItem(process.env.VUE_APP_WEB_STYLES_KEY)
|
|
122
|
-
const object = JSON.parse(str)
|
|
123
|
-
return object[key]
|
|
124
|
-
},
|
|
125
|
-
}
|
|
126
|
-
export default GetAppDataService
|
|
1
|
+
import { manageApi, post } from '@vue2-client/services/api'
|
|
2
|
+
import { handleTree } from '@vue2-client/utils/util'
|
|
3
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
4
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
5
|
+
|
|
6
|
+
const GetAppDataService = {
|
|
7
|
+
install (Vue) {
|
|
8
|
+
// 给vue增添对话框显示方法
|
|
9
|
+
Vue.$appdata = Vue.prototype.$appdata = GetAppDataService
|
|
10
|
+
},
|
|
11
|
+
async load () {
|
|
12
|
+
const params = {}
|
|
13
|
+
await post(manageApi.getDictionaryValue, {}).then((res) => {
|
|
14
|
+
Object.assign(params, res)
|
|
15
|
+
const badgeItemArray = {}
|
|
16
|
+
for (const key of Object.keys(params)) {
|
|
17
|
+
badgeItemArray[key] = {}
|
|
18
|
+
for (const item of params[key]) {
|
|
19
|
+
let status
|
|
20
|
+
if (!item.status) {
|
|
21
|
+
status = 'none'
|
|
22
|
+
} else {
|
|
23
|
+
status = item.status
|
|
24
|
+
}
|
|
25
|
+
badgeItemArray[key][item.value] = {
|
|
26
|
+
status: status,
|
|
27
|
+
text: item.text
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// 追加参数
|
|
32
|
+
localStorage.setItem(process.env.VUE_APP_DICTIONARY_KEY, JSON.stringify(params))
|
|
33
|
+
localStorage.setItem(process.env.VUE_APP_BADGE_KEY, JSON.stringify(badgeItemArray))
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
// 返回树形省市区
|
|
37
|
+
async getDivisionsOhChinaForTree () {
|
|
38
|
+
// 获取省市区数据
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
try {
|
|
41
|
+
indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, res => {
|
|
42
|
+
resolve(res)
|
|
43
|
+
}, processRes => {
|
|
44
|
+
return handleTree(processRes, 'code', 'parentcode')
|
|
45
|
+
})
|
|
46
|
+
} catch (e) {
|
|
47
|
+
reject(e)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
// 旧版获取配置中心字典
|
|
52
|
+
getDictionaryList (key) {
|
|
53
|
+
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
54
|
+
const object = JSON.parse(str)
|
|
55
|
+
return object[key]
|
|
56
|
+
},
|
|
57
|
+
async getDictValue (dictKey, value, func, isDev = false, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
|
|
58
|
+
const processResult = (result) => {
|
|
59
|
+
if (!result.value) {
|
|
60
|
+
return {
|
|
61
|
+
status: 'none',
|
|
62
|
+
text: value
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const item = result.value.find(item => item.value == value)
|
|
66
|
+
if (item) {
|
|
67
|
+
return {
|
|
68
|
+
status: item.status || 'none',
|
|
69
|
+
text: item.label
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
status: 'none',
|
|
74
|
+
text: value
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (func) {
|
|
78
|
+
getConfigByName(dictKey, serviceName, result => {
|
|
79
|
+
func(processResult(result))
|
|
80
|
+
}, isDev)
|
|
81
|
+
} else {
|
|
82
|
+
const result = await new Promise((resolve) => {
|
|
83
|
+
getConfigByName(dictKey, serviceName, resolve, isDev)
|
|
84
|
+
})
|
|
85
|
+
return processResult(result)
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
// 新版获取配置中心字典推荐使用 服务名默认为当前服务
|
|
89
|
+
getDictByKey (dictKey, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback, isDev) {
|
|
90
|
+
getConfigByName(dictKey, undefined, result => {
|
|
91
|
+
callback(result.value)
|
|
92
|
+
}, isDev)
|
|
93
|
+
},
|
|
94
|
+
getParam (key, value, callback) {
|
|
95
|
+
const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
|
|
96
|
+
const object = JSON.parse(str)
|
|
97
|
+
if (object && object[key]) {
|
|
98
|
+
const result = object[key]
|
|
99
|
+
if (Object.prototype.hasOwnProperty.call(result, value)) {
|
|
100
|
+
return result[value]
|
|
101
|
+
} else {
|
|
102
|
+
return { status: 'none', text: value }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return null
|
|
106
|
+
},
|
|
107
|
+
getParams () {
|
|
108
|
+
const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
|
|
109
|
+
return JSON.parse(str)
|
|
110
|
+
},
|
|
111
|
+
getSingleValues () {
|
|
112
|
+
const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
|
|
113
|
+
return JSON.parse(str)
|
|
114
|
+
},
|
|
115
|
+
getWebConfigByKey (key) {
|
|
116
|
+
const str = localStorage.getItem(process.env.VUE_APP_WEB_CONFIG_KEY)
|
|
117
|
+
const object = JSON.parse(str)
|
|
118
|
+
return object[key]
|
|
119
|
+
},
|
|
120
|
+
getStylesByKey (key) {
|
|
121
|
+
const str = localStorage.getItem(process.env.VUE_APP_WEB_STYLES_KEY)
|
|
122
|
+
const object = JSON.parse(str)
|
|
123
|
+
return object[key]
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
export default GetAppDataService
|