vue2-client 1.12.71 → 1.12.73
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 +3 -2
- package/src/base-client/components/common/XCollapse/XCollapse.vue +209 -214
- package/src/base-client/components/common/XCollapse/XCollapseDemo.vue +15 -0
- 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 +3 -2
- package/src/base-client/components/common/XTimeline/XTimeline.vue +342 -0
- package/src/base-client/components/his/XHisEditor/XHisEditor.vue +62 -22
- package/src/base-client/components/his/XHisEditor/diagnosisAutocomplete.js +241 -0
- package/src/base-client/components/his/XList/XList.vue +90 -90
- package/src/base-client/plugins/AppData.js +126 -126
- package/src/pages/ReportGrid/index.vue +76 -76
- package/src/pages/userInfoDetailManage/PriceAdjustments/index.vue +64 -0
- package/src/pages/userInfoDetailManage/UserException/index.vue +64 -0
- package/src/pages/userInfoDetailManage/userInfoDetailQueryTabs.vue +7 -1
- package/src/router/async/router.map.js +122 -119
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
export function initDiagnosisDropdown (editor, data, identificationCode) {
|
|
2
|
+
if (typeof editor === 'undefined' || !editor.$) {
|
|
3
|
+
return
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// 确保元素存在
|
|
7
|
+
const diagnosisField = editor.$(identificationCode)
|
|
8
|
+
|
|
9
|
+
if (!diagnosisField.length) {
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 更详细的调试信息
|
|
14
|
+
const fieldElement = diagnosisField[0]
|
|
15
|
+
|
|
16
|
+
// 模拟诊断数据
|
|
17
|
+
const mockDiagnosisList = data
|
|
18
|
+
// 生成唯一的下拉框类名
|
|
19
|
+
const dropdownClassName = `diagnosis-dropdown-${identificationCode.replace('#', '')}`
|
|
20
|
+
// 创建下拉列表容器 - 使用 Ant Design 风格
|
|
21
|
+
editor.$(`.${dropdownClassName}`).remove() // 修改这里,使用唯一的类名
|
|
22
|
+
const dropdownList = editor.document.createElement('div')
|
|
23
|
+
dropdownList.className = dropdownClassName // 使用唯一的类名
|
|
24
|
+
|
|
25
|
+
// 添加 Ant Design 样式,修改样式选择器使用唯一的类名
|
|
26
|
+
const styleElement = editor.document.createElement('style')
|
|
27
|
+
styleElement.textContent = `
|
|
28
|
+
.${dropdownClassName} {
|
|
29
|
+
display: none;
|
|
30
|
+
position: absolute;
|
|
31
|
+
z-index: 999999;
|
|
32
|
+
background: #fff;
|
|
33
|
+
border-radius: 2px;
|
|
34
|
+
box-shadow: 0 3px 6px -4px rgba(0,0,0,.12), 0 6px 16px 0 rgba(0,0,0,.08), 0 9px 28px 8px rgba(0,0,0,.05);
|
|
35
|
+
padding: 4px 0;
|
|
36
|
+
min-width: 300px;
|
|
37
|
+
width: auto;
|
|
38
|
+
max-width: 400px;
|
|
39
|
+
max-height: 256px;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
}
|
|
42
|
+
.${dropdownClassName}::-webkit-scrollbar {
|
|
43
|
+
width: 6px;
|
|
44
|
+
height: 6px;
|
|
45
|
+
}
|
|
46
|
+
.${dropdownClassName}::-webkit-scrollbar-thumb {
|
|
47
|
+
background: rgba(0,0,0,.2);
|
|
48
|
+
border-radius: 3px;
|
|
49
|
+
}
|
|
50
|
+
.${dropdownClassName} .ant-list-item {
|
|
51
|
+
padding: 8px 12px;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
transition: all .3s;
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
}
|
|
56
|
+
.${dropdownClassName} .ant-list-item:hover {
|
|
57
|
+
background: #f5f5f5;
|
|
58
|
+
}
|
|
59
|
+
.${dropdownClassName} .ant-list-item-content {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
}
|
|
65
|
+
.${dropdownClassName} .ant-list-item-title {
|
|
66
|
+
color: rgba(0,0,0,.85);
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
line-height: 1.5715;
|
|
70
|
+
flex: 1;
|
|
71
|
+
min-width: 120px;
|
|
72
|
+
}
|
|
73
|
+
.${dropdownClassName} .ant-list-item-description {
|
|
74
|
+
color: rgba(0,0,0,.45);
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
line-height: 1.5715;
|
|
77
|
+
min-width: 80px;
|
|
78
|
+
}
|
|
79
|
+
.${dropdownClassName} .ant-list-empty {
|
|
80
|
+
padding: 16px;
|
|
81
|
+
color: rgba(0,0,0,.45);
|
|
82
|
+
text-align: center;
|
|
83
|
+
min-width: 200px;
|
|
84
|
+
}
|
|
85
|
+
`
|
|
86
|
+
editor.document.head.appendChild(styleElement)
|
|
87
|
+
|
|
88
|
+
// 将下拉列表添加到编辑器文档中
|
|
89
|
+
diagnosisField.after(dropdownList)
|
|
90
|
+
|
|
91
|
+
// 获取当前模式
|
|
92
|
+
function getCurrentMode () {
|
|
93
|
+
return editor.option.mode
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 检查是否允许编辑
|
|
97
|
+
function isEditableMode () {
|
|
98
|
+
const currentMode = getCurrentMode()
|
|
99
|
+
return currentMode === 'form' || currentMode === 'design'
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// 更新下拉列表位置的函数
|
|
103
|
+
function updateDropdownPosition () {
|
|
104
|
+
try {
|
|
105
|
+
// 获取输入框的位置和尺寸
|
|
106
|
+
const fieldRect = fieldElement.getBoundingClientRect()
|
|
107
|
+
|
|
108
|
+
// 获取父容器的滚动位置
|
|
109
|
+
const scrollTop = editor.$(editor.document).scrollTop()
|
|
110
|
+
const scrollLeft = editor.$(editor.document).scrollLeft()
|
|
111
|
+
|
|
112
|
+
// 计算绝对位置
|
|
113
|
+
const top = fieldRect.bottom + scrollTop
|
|
114
|
+
const left = fieldRect.left + scrollLeft
|
|
115
|
+
|
|
116
|
+
// 设置下拉列表位置,不设置宽度,让它自适应内容
|
|
117
|
+
dropdownList.style.cssText = `
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: ${top}px;
|
|
120
|
+
left: ${left}px;
|
|
121
|
+
display: block;
|
|
122
|
+
`
|
|
123
|
+
} catch (error) {
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 处理输入事件的函数
|
|
128
|
+
function handleInput () {
|
|
129
|
+
if (!isEditableMode()) {
|
|
130
|
+
dropdownList.style.display = 'none'
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const keyword = this.textContent.trim()
|
|
135
|
+
|
|
136
|
+
if (keyword && keyword !== '请输入') {
|
|
137
|
+
const results = mockDiagnosisList.filter(item =>
|
|
138
|
+
item.name.toLowerCase().includes(keyword.toLowerCase()) ||
|
|
139
|
+
item.code.toLowerCase().includes(keyword.toLowerCase())
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
// 1. 先清空内容
|
|
143
|
+
dropdownList.innerHTML = ''
|
|
144
|
+
|
|
145
|
+
// 2. 添加内容
|
|
146
|
+
if (results.length === 0) {
|
|
147
|
+
dropdownList.innerHTML = `
|
|
148
|
+
<div class="ant-list-empty">
|
|
149
|
+
<div style="color: rgba(0,0,0,.25);">
|
|
150
|
+
<svg viewBox="64 64 896 896" width="16" height="16" fill="currentColor">
|
|
151
|
+
<path d="M928 224H768v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H548v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H328v-56c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v56H96c-17.7 0-32 14.3-32 32v576c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V256c0-17.7-14.3-32-32-32zM424 688c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v48zm0-136c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v48zm136 136c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v48zm0-136c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v48zm136 136c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v48zm0-136c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v48z"/>
|
|
152
|
+
</svg>
|
|
153
|
+
<div style="margin-top: 8px;">无匹配结果</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
`
|
|
157
|
+
} else {
|
|
158
|
+
const itemsHtml = results.map(item => `
|
|
159
|
+
<div class="ant-list-item">
|
|
160
|
+
<div class="ant-list-item-content">
|
|
161
|
+
<div class="ant-list-item-title">${item.name}</div>
|
|
162
|
+
<div class="ant-list-item-description">${item.code}</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
`).join('')
|
|
166
|
+
dropdownList.innerHTML = itemsHtml
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// 3. 更新位置并显示
|
|
170
|
+
updateDropdownPosition()
|
|
171
|
+
} else {
|
|
172
|
+
dropdownList.style.display = 'none'
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 输入法编辑状态处理
|
|
177
|
+
let isCompositing = false
|
|
178
|
+
|
|
179
|
+
// 输入法开始
|
|
180
|
+
fieldElement.addEventListener('compositionstart', function (e) {
|
|
181
|
+
isCompositing = true
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
// 输入法结束
|
|
185
|
+
fieldElement.addEventListener('compositionend', function (e) {
|
|
186
|
+
isCompositing = false
|
|
187
|
+
handleInput.call(this)
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// 输入事件
|
|
191
|
+
fieldElement.addEventListener('input', function (e) {
|
|
192
|
+
if (!isCompositing) {
|
|
193
|
+
handleInput.call(this)
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
// 焦点事件
|
|
198
|
+
fieldElement.addEventListener('focus', function (e) {
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
// 失去焦点事件
|
|
202
|
+
fieldElement.addEventListener('blur', function (e) {
|
|
203
|
+
setTimeout(() => {
|
|
204
|
+
if (!this.textContent.trim()) {
|
|
205
|
+
this.textContent = '请输入'
|
|
206
|
+
}
|
|
207
|
+
}, 200)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
// 点击选项事件
|
|
211
|
+
editor.$(dropdownList).on('mousedown', '.ant-list-item', function (e) {
|
|
212
|
+
e.preventDefault()
|
|
213
|
+
e.stopPropagation()
|
|
214
|
+
if (isEditableMode()) {
|
|
215
|
+
const name = editor.$(this).find('.ant-list-item-title').text()
|
|
216
|
+
fieldElement.textContent = name
|
|
217
|
+
dropdownList.style.display = 'none'
|
|
218
|
+
fieldElement.focus()
|
|
219
|
+
}
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
// 点击文档其他区域时隐藏下拉列表,修改选择器
|
|
223
|
+
editor.$(editor.document).on('mousedown', function (e) {
|
|
224
|
+
if (!editor.$(e.target).closest(`.${dropdownClassName}, ${identificationCode}`).length) {
|
|
225
|
+
dropdownList.style.display = 'none'
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
// 添加滚动事件监听,实时更新下拉列表位置
|
|
230
|
+
editor.$(editor.window).on('scroll', function () {
|
|
231
|
+
if (dropdownList.style.display !== 'none') {
|
|
232
|
+
updateDropdownPosition()
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
editor.$(editor.window).on('resize', function () {
|
|
237
|
+
if (dropdownList.style.display !== 'none') {
|
|
238
|
+
updateDropdownPosition()
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
}
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="list-wrapper" >
|
|
3
|
-
<a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container">
|
|
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">
|
|
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,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
|