vue2-client 1.12.82 → 1.12.84
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 +109 -109
- package/src/base-client/components/common/XCollapse/XCollapse.vue +234 -214
- package/src/base-client/components/common/XReportGrid/XReport.vue +1014 -1014
- package/src/base-client/components/common/XReportGrid/XReportDemo.vue +44 -44
- package/src/base-client/components/common/XReportGrid/XReportDesign.vue +616 -616
- package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +708 -708
- package/src/base-client/components/his/XList/XList.vue +90 -90
- package/src/base-client/components/his/XRadio/XRadio.vue +66 -50
- package/src/base-client/components/his/XRadio/index.md +106 -0
- package/src/base-client/plugins/AppData.js +126 -126
- package/src/pages/ReportGrid/index.vue +76 -76
- package/src/pages/userInfoDetailManage/uploadFilesHistory/index.vue +130 -0
- package/src/pages/userInfoDetailManage/userInfoDetailQueryTabs.vue +3 -0
- package/src/router/async/router.map.js +119 -123
- package/src/base-client/components/common/XCollapse/XCollapseDemo.vue +0 -15
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="list-wrapper" >
|
|
3
|
-
<a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container" ref="listRef">
|
|
4
|
-
<a-list-item slot="renderItem" slot-scope="item, index" class="list-item" @click="handleClick(index)">
|
|
5
|
-
{{ item.number }} {{ item.name }}
|
|
6
|
-
</a-list-item>
|
|
7
|
-
</a-list>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
|
|
13
|
-
import { runLogic } from '@vue2-client/services/api/common'
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
name: 'XList',
|
|
17
|
-
props: {
|
|
18
|
-
queryParamsName: {
|
|
19
|
-
type: Object,
|
|
20
|
-
default: 'outpatientWaitLogic'
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
inject: ['getComponentByName'],
|
|
24
|
-
data () {
|
|
25
|
-
return {
|
|
26
|
-
data: []
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
created () {
|
|
30
|
-
this.getData(this.queryParamsName)
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
async getData (config) {
|
|
34
|
-
runLogic(config, {}, 'af-his').then(res => {
|
|
35
|
-
this.data = res
|
|
36
|
-
})
|
|
37
|
-
},
|
|
38
|
-
handleClick (index) {
|
|
39
|
-
this.$emit('listClick', this.data[index])
|
|
40
|
-
},
|
|
41
|
-
refreshList () {
|
|
42
|
-
this.getData(this.queryParamsName)
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<style scoped>
|
|
50
|
-
.list-wrapper {
|
|
51
|
-
max-height: 240px;
|
|
52
|
-
overflow-y: auto;
|
|
53
|
-
cursor: pointer;
|
|
54
|
-
padding-right: 2px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.list-container {
|
|
58
|
-
width: 100%;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.list-item {
|
|
62
|
-
height: 35px;
|
|
63
|
-
border-radius: 6px;
|
|
64
|
-
background-color: #F4F4F4;
|
|
65
|
-
padding: 8px 15px 7px 15px;
|
|
66
|
-
font-size: 16px;
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
width: 100%;
|
|
70
|
-
border: 1px solid #D9D9D9;
|
|
71
|
-
box-sizing: border-box;
|
|
72
|
-
margin-bottom: 16px;
|
|
73
|
-
white-space: nowrap;
|
|
74
|
-
overflow: clip;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* 自定义滚动条样式 */
|
|
78
|
-
.list-wrapper::-webkit-scrollbar {
|
|
79
|
-
width: 6px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.list-wrapper::-webkit-scrollbar-thumb {
|
|
83
|
-
background-color: #d9d9d9;
|
|
84
|
-
border-radius: 3px;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.list-wrapper::-webkit-scrollbar-track {
|
|
88
|
-
background-color: #f0f0f0;
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="list-wrapper" >
|
|
3
|
+
<a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container" ref="listRef">
|
|
4
|
+
<a-list-item slot="renderItem" slot-scope="item, index" class="list-item" @click="handleClick(index)">
|
|
5
|
+
{{ item.number }} {{ item.name }}
|
|
6
|
+
</a-list-item>
|
|
7
|
+
</a-list>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
|
|
13
|
+
import { runLogic } from '@vue2-client/services/api/common'
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: 'XList',
|
|
17
|
+
props: {
|
|
18
|
+
queryParamsName: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: 'outpatientWaitLogic'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
inject: ['getComponentByName'],
|
|
24
|
+
data () {
|
|
25
|
+
return {
|
|
26
|
+
data: []
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
created () {
|
|
30
|
+
this.getData(this.queryParamsName)
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
async getData (config) {
|
|
34
|
+
runLogic(config, {}, 'af-his').then(res => {
|
|
35
|
+
this.data = res
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
handleClick (index) {
|
|
39
|
+
this.$emit('listClick', this.data[index])
|
|
40
|
+
},
|
|
41
|
+
refreshList () {
|
|
42
|
+
this.getData(this.queryParamsName)
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<style scoped>
|
|
50
|
+
.list-wrapper {
|
|
51
|
+
max-height: 240px;
|
|
52
|
+
overflow-y: auto;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
padding-right: 2px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.list-container {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.list-item {
|
|
62
|
+
height: 35px;
|
|
63
|
+
border-radius: 6px;
|
|
64
|
+
background-color: #F4F4F4;
|
|
65
|
+
padding: 8px 15px 7px 15px;
|
|
66
|
+
font-size: 16px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
width: 100%;
|
|
70
|
+
border: 1px solid #D9D9D9;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
margin-bottom: 16px;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
overflow: clip;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* 自定义滚动条样式 */
|
|
78
|
+
.list-wrapper::-webkit-scrollbar {
|
|
79
|
+
width: 6px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.list-wrapper::-webkit-scrollbar-thumb {
|
|
83
|
+
background-color: #d9d9d9;
|
|
84
|
+
border-radius: 3px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.list-wrapper::-webkit-scrollbar-track {
|
|
88
|
+
background-color: #f0f0f0;
|
|
89
|
+
}
|
|
90
|
+
</style>
|
|
@@ -1,50 +1,66 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a-radio-group v-model="innerValue" @change="onChange">
|
|
4
|
-
<a-radio v-for="item in data" :key="item.value" :value="item.value">
|
|
5
|
-
{{ item.label }}
|
|
6
|
-
</a-radio>
|
|
7
|
-
</a-radio-group>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
name: 'XRadio',
|
|
16
|
-
inject: ['getComponentByName'],
|
|
17
|
-
props: {
|
|
18
|
-
queryParamsName: {
|
|
19
|
-
type: Object,
|
|
20
|
-
default: null
|
|
21
|
-
},
|
|
22
|
-
value: [String, Number]
|
|
23
|
-
},
|
|
24
|
-
data () {
|
|
25
|
-
return {
|
|
26
|
-
data: [],
|
|
27
|
-
innerValue: null
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
created () {
|
|
31
|
-
this.getData(this.queryParamsName)
|
|
32
|
-
},
|
|
33
|
-
watch: {
|
|
34
|
-
value (val) {
|
|
35
|
-
this.innerValue = val
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-radio-group v-model="innerValue" @change="onChange">
|
|
4
|
+
<a-radio v-for="item in data" :key="item.value" :value="item.value">
|
|
5
|
+
{{ item.label }}
|
|
6
|
+
</a-radio>
|
|
7
|
+
</a-radio-group>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { getConfigByName } from '@vue2-client/services/api/common'
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'XRadio',
|
|
16
|
+
inject: ['getComponentByName'],
|
|
17
|
+
props: {
|
|
18
|
+
queryParamsName: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: null
|
|
21
|
+
},
|
|
22
|
+
value: [String, Number]
|
|
23
|
+
},
|
|
24
|
+
data () {
|
|
25
|
+
return {
|
|
26
|
+
data: [],
|
|
27
|
+
innerValue: null
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
created () {
|
|
31
|
+
this.getData(this.queryParamsName)
|
|
32
|
+
},
|
|
33
|
+
watch: {
|
|
34
|
+
value (val) {
|
|
35
|
+
this.innerValue = val
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
emits: ['change', 'init'],
|
|
39
|
+
methods: {
|
|
40
|
+
async getData (data) {
|
|
41
|
+
getConfigByName(data, 'af-his', res => {
|
|
42
|
+
// 1. 先加载选项
|
|
43
|
+
if (res.radio && Array.isArray(res.radio)) {
|
|
44
|
+
this.data = res.radio
|
|
45
|
+
// 2. 初始化默认值(优先级: 配置defaultValue > 第一个选项)
|
|
46
|
+
if (res.defaultValue !== undefined && res.defaultValue !== null) {
|
|
47
|
+
// 否则使用配置中的defaultValue
|
|
48
|
+
this.innerValue = res.defaultValue
|
|
49
|
+
} else if (this.data.length > 0) {
|
|
50
|
+
// 如果没有默认值但有选项,使用第一个选项
|
|
51
|
+
this.innerValue = this.data[0].value
|
|
52
|
+
}
|
|
53
|
+
// 3. 触发初始化事件
|
|
54
|
+
this.$emit('init', this.innerValue)
|
|
55
|
+
} else {
|
|
56
|
+
this.$message.error('配置错误,radio字段不是数组')
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
onChange (e) {
|
|
61
|
+
this.innerValue = e.target.value
|
|
62
|
+
this.$emit('change', e.target.value)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# XRadio
|
|
2
|
+
|
|
3
|
+
基于配置的单选组件,支持从配置中动态加载选项和默认值。
|
|
4
|
+
|
|
5
|
+
## 何时使用
|
|
6
|
+
|
|
7
|
+
当需要一个通过配置动态加载的单选控件时使用,特别是选项需要从后端获取的场景。
|
|
8
|
+
|
|
9
|
+
## 引用方式
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import XRadio from '@vue2-client/base-client/components/his/XRadio/XRadio'
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
components: {
|
|
16
|
+
XRadio
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 代码演示
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<x-radio
|
|
25
|
+
:queryParamsName="radioConfigName"
|
|
26
|
+
@change="handleChange"
|
|
27
|
+
@init="handleInit">
|
|
28
|
+
</x-radio>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
34
|
+
|-----------------|----------------------|-------------------|------|
|
|
35
|
+
| queryParamsName | 查询配置名称 | String/Object | null |
|
|
36
|
+
| value | 当前选中值(可用于外部控制) | String/Number | null |
|
|
37
|
+
|
|
38
|
+
### 事件
|
|
39
|
+
|
|
40
|
+
| 事件名 | 说明 | 回调参数 |
|
|
41
|
+
|--------|--------------|-----------------------------------------------|
|
|
42
|
+
| change | 选项变化时的回调 | function(value) |
|
|
43
|
+
| radio | 选项变化时的回调(兼容) | function(value) |
|
|
44
|
+
| init | 组件初始化完成时的回调 | function({config, options, value}) |
|
|
45
|
+
|
|
46
|
+
### 配置说明
|
|
47
|
+
|
|
48
|
+
组件通过 `queryParamsName` 从后端获取配置,配置格式如下:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"radio": [
|
|
53
|
+
{
|
|
54
|
+
"label": "选项A",
|
|
55
|
+
"value": 1
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"label": "选项B",
|
|
59
|
+
"value": 2
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"label": "选项C",
|
|
63
|
+
"value": 3
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"label": "选项D",
|
|
67
|
+
"value": 4
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"defaultValue": 2
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 配置示例
|
|
75
|
+
----
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"radio": [
|
|
80
|
+
{
|
|
81
|
+
"label": "A",
|
|
82
|
+
"value": 1
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"label": "B",
|
|
86
|
+
"value": 2
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"label": "C",
|
|
90
|
+
"value": 3
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"label": "D",
|
|
94
|
+
"value": 4
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"defaultValue": 2
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
注意事项
|
|
102
|
+
----
|
|
103
|
+
|
|
104
|
+
1. 如果配置中有 `defaultValue`,组件将默认选中该值对应的选项
|
|
105
|
+
2. 如果没有 `defaultValue` 但有选项,将默认选中第一个选项
|
|
106
|
+
3. 如果外部通过 `value` 属性传入值,优先使用外部值
|
|
@@ -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
|