vue2-client 1.13.26 → 1.13.27
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 +1 -1
- package/src/base-client/components/common/XFormTable/XFormTable.vue +874 -874
- package/src/base-client/components/common/XFormTable/demo.vue +1 -1
- package/src/base-client/components/common/XReportGrid/XReport.vue +1 -1
- package/src/base-client/components/common/XReportGrid/XReportDemo.vue +44 -44
- package/src/base-client/components/common/XTable/XTable.vue +19 -1
- package/src/base-client/components/common/XTable/XTableWrapper.vue +144 -7
- 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/plugins/AppData.js +126 -126
- package/src/pages/AMisDemo/AMisDemo2.vue +74 -91
- package/src/pages/ReportGrid/index.vue +76 -76
- package/src/router/async/router.map.js +119 -127
- package/src/base-client/components/common/XCollapse/XCollapseDemo.vue +0 -15
- package/vue2-client.iml +0 -9
|
@@ -1,131 +1,131 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="x-time-select">
|
|
3
|
-
<div class="time-select-container">
|
|
4
|
-
<span v-if="label" class="time-select-label">{{ label }}</span>
|
|
5
|
-
<div class="picker-wrapper">
|
|
6
|
-
<a-range-picker
|
|
7
|
-
:value="dateRange"
|
|
8
|
-
:placeholder="['开始日期', '结束日期']"
|
|
9
|
-
separator="至"
|
|
10
|
-
:disabled="disabled"
|
|
11
|
-
:allowClear="allowClear"
|
|
12
|
-
:format="format"
|
|
13
|
-
@change="handleDateChange"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
import moment from 'moment'
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
name: 'XTimeSelect',
|
|
25
|
-
props: {
|
|
26
|
-
queryParamsName: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: null
|
|
29
|
-
},
|
|
30
|
-
value: {
|
|
31
|
-
type: Array,
|
|
32
|
-
default: () => []
|
|
33
|
-
},
|
|
34
|
-
disabled: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: false
|
|
37
|
-
},
|
|
38
|
-
allowClear: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: true
|
|
41
|
-
},
|
|
42
|
-
format: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: 'YYYY/MM/DD'
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
data () {
|
|
48
|
-
return {
|
|
49
|
-
dateRange: [],
|
|
50
|
-
label: ''
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
watch: {
|
|
54
|
-
value: {
|
|
55
|
-
handler (newVal) {
|
|
56
|
-
if (newVal && newVal.length === 2) {
|
|
57
|
-
this.dateRange = [
|
|
58
|
-
newVal[0] ? moment(newVal[0]) : null,
|
|
59
|
-
newVal[1] ? moment(newVal[1]) : null
|
|
60
|
-
]
|
|
61
|
-
} else {
|
|
62
|
-
this.dateRange = []
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
immediate: true,
|
|
66
|
-
deep: true
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
created () {
|
|
70
|
-
this.getData(this.queryParamsName)
|
|
71
|
-
},
|
|
72
|
-
methods: {
|
|
73
|
-
handleDateChange (dates, dateStrings) {
|
|
74
|
-
this.dateRange = dates
|
|
75
|
-
console.warn(dateStrings)
|
|
76
|
-
this.$emit('change', dateStrings)
|
|
77
|
-
},
|
|
78
|
-
getData (data) {
|
|
79
|
-
this.label = data
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<style scoped>
|
|
86
|
-
.x-time-select {
|
|
87
|
-
position: relative;
|
|
88
|
-
width: 100%;
|
|
89
|
-
box-sizing: border-box;
|
|
90
|
-
display: block;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.time-select-container {
|
|
94
|
-
display: flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.time-select-label {
|
|
99
|
-
white-space: nowrap;
|
|
100
|
-
color: rgba(0, 0, 0, 0.85);
|
|
101
|
-
padding-right: 8px;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.picker-wrapper {
|
|
105
|
-
flex: 1;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.x-time-select :deep(.ant-picker-range),
|
|
109
|
-
.x-time-select :deep(.ant-picker) {
|
|
110
|
-
width: 100%;
|
|
111
|
-
height: 30px;
|
|
112
|
-
border-radius: 7px;
|
|
113
|
-
background: #FFFFFF;
|
|
114
|
-
border: 1px solid #E5E9F0;
|
|
115
|
-
}
|
|
116
|
-
.x-time-select :deep(.ant-calendar-picker) {
|
|
117
|
-
width: 100%;
|
|
118
|
-
display: block;
|
|
119
|
-
}
|
|
120
|
-
.x-time-select :deep(.ant-calendar-picker-input) {
|
|
121
|
-
width: 100%;
|
|
122
|
-
height: 30px;
|
|
123
|
-
border-radius: 7px;
|
|
124
|
-
background: #FFFFFF;
|
|
125
|
-
border: 1px solid #E5E9F0;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.x-time-select :deep(.ant-input) {
|
|
129
|
-
width: 100%;
|
|
130
|
-
}
|
|
131
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="x-time-select">
|
|
3
|
+
<div class="time-select-container">
|
|
4
|
+
<span v-if="label" class="time-select-label">{{ label }}</span>
|
|
5
|
+
<div class="picker-wrapper">
|
|
6
|
+
<a-range-picker
|
|
7
|
+
:value="dateRange"
|
|
8
|
+
:placeholder="['开始日期', '结束日期']"
|
|
9
|
+
separator="至"
|
|
10
|
+
:disabled="disabled"
|
|
11
|
+
:allowClear="allowClear"
|
|
12
|
+
:format="format"
|
|
13
|
+
@change="handleDateChange"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import moment from 'moment'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'XTimeSelect',
|
|
25
|
+
props: {
|
|
26
|
+
queryParamsName: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
value: {
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
disabled: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
allowClear: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: true
|
|
41
|
+
},
|
|
42
|
+
format: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'YYYY/MM/DD'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data () {
|
|
48
|
+
return {
|
|
49
|
+
dateRange: [],
|
|
50
|
+
label: ''
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
watch: {
|
|
54
|
+
value: {
|
|
55
|
+
handler (newVal) {
|
|
56
|
+
if (newVal && newVal.length === 2) {
|
|
57
|
+
this.dateRange = [
|
|
58
|
+
newVal[0] ? moment(newVal[0]) : null,
|
|
59
|
+
newVal[1] ? moment(newVal[1]) : null
|
|
60
|
+
]
|
|
61
|
+
} else {
|
|
62
|
+
this.dateRange = []
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
immediate: true,
|
|
66
|
+
deep: true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
created () {
|
|
70
|
+
this.getData(this.queryParamsName)
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
handleDateChange (dates, dateStrings) {
|
|
74
|
+
this.dateRange = dates
|
|
75
|
+
console.warn(dateStrings)
|
|
76
|
+
this.$emit('change', dateStrings)
|
|
77
|
+
},
|
|
78
|
+
getData (data) {
|
|
79
|
+
this.label = data
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style scoped>
|
|
86
|
+
.x-time-select {
|
|
87
|
+
position: relative;
|
|
88
|
+
width: 100%;
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
display: block;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.time-select-container {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.time-select-label {
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
color: rgba(0, 0, 0, 0.85);
|
|
101
|
+
padding-right: 8px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.picker-wrapper {
|
|
105
|
+
flex: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.x-time-select :deep(.ant-picker-range),
|
|
109
|
+
.x-time-select :deep(.ant-picker) {
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: 30px;
|
|
112
|
+
border-radius: 7px;
|
|
113
|
+
background: #FFFFFF;
|
|
114
|
+
border: 1px solid #E5E9F0;
|
|
115
|
+
}
|
|
116
|
+
.x-time-select :deep(.ant-calendar-picker) {
|
|
117
|
+
width: 100%;
|
|
118
|
+
display: block;
|
|
119
|
+
}
|
|
120
|
+
.x-time-select :deep(.ant-calendar-picker-input) {
|
|
121
|
+
width: 100%;
|
|
122
|
+
height: 30px;
|
|
123
|
+
border-radius: 7px;
|
|
124
|
+
background: #FFFFFF;
|
|
125
|
+
border: 1px solid #E5E9F0;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.x-time-select :deep(.ant-input) {
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="x-title" :class="{ 'with-underline': hasUnderline, 'only-line': isOnlyLine }">
|
|
3
|
-
<span v-show="!isOnlyLine">{{ processedTitle }}</span>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
export default {
|
|
9
|
-
name: 'XTitle',
|
|
10
|
-
props: {
|
|
11
|
-
queryParamsName: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: null
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
data () {
|
|
17
|
-
return {
|
|
18
|
-
title: ''
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
computed: {
|
|
22
|
-
processedTitle () {
|
|
23
|
-
return this.title.replace('</br>', '')
|
|
24
|
-
},
|
|
25
|
-
hasUnderline () {
|
|
26
|
-
return this.title.includes('</br>')
|
|
27
|
-
},
|
|
28
|
-
isOnlyLine () {
|
|
29
|
-
return this.title === '</br>'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
created () {
|
|
33
|
-
this.getData(this.queryParamsName)
|
|
34
|
-
},
|
|
35
|
-
methods: {
|
|
36
|
-
getData (data) {
|
|
37
|
-
this.title = data
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
<style scoped>
|
|
43
|
-
.x-title {
|
|
44
|
-
font-size: 18px;
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
height: 26px;
|
|
47
|
-
width: 100%;
|
|
48
|
-
text-align: left;
|
|
49
|
-
font-family: "Source Han Sans", sans-serif;
|
|
50
|
-
color: #5D5C5C;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.with-underline {
|
|
54
|
-
border-bottom: 1px solid #5D5C5C;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.only-line {
|
|
58
|
-
height: 1px;
|
|
59
|
-
background-color: #5D5C5C;
|
|
60
|
-
margin: 13px 0;
|
|
61
|
-
}
|
|
62
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="x-title" :class="{ 'with-underline': hasUnderline, 'only-line': isOnlyLine }">
|
|
3
|
+
<span v-show="!isOnlyLine">{{ processedTitle }}</span>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'XTitle',
|
|
10
|
+
props: {
|
|
11
|
+
queryParamsName: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: null
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
data () {
|
|
17
|
+
return {
|
|
18
|
+
title: ''
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
computed: {
|
|
22
|
+
processedTitle () {
|
|
23
|
+
return this.title.replace('</br>', '')
|
|
24
|
+
},
|
|
25
|
+
hasUnderline () {
|
|
26
|
+
return this.title.includes('</br>')
|
|
27
|
+
},
|
|
28
|
+
isOnlyLine () {
|
|
29
|
+
return this.title === '</br>'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
created () {
|
|
33
|
+
this.getData(this.queryParamsName)
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
getData (data) {
|
|
37
|
+
this.title = data
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
<style scoped>
|
|
43
|
+
.x-title {
|
|
44
|
+
font-size: 18px;
|
|
45
|
+
font-weight: bold;
|
|
46
|
+
height: 26px;
|
|
47
|
+
width: 100%;
|
|
48
|
+
text-align: left;
|
|
49
|
+
font-family: "Source Han Sans", sans-serif;
|
|
50
|
+
color: #5D5C5C;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.with-underline {
|
|
54
|
+
border-bottom: 1px solid #5D5C5C;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.only-line {
|
|
58
|
+
height: 1px;
|
|
59
|
+
background-color: #5D5C5C;
|
|
60
|
+
margin: 13px 0;
|
|
61
|
+
}
|
|
62
|
+
</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
|