vue2-client 1.8.166 → 1.8.167

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.
Files changed (167) hide show
  1. package/.env +19 -19
  2. package/.eslintrc.js +90 -90
  3. package/CHANGELOG.md +824 -824
  4. package/Components.md +60 -60
  5. package/babel.config.js +21 -21
  6. package/docs/index.md +30 -30
  7. package/index.js +31 -31
  8. package/jest-transform-stub.js +8 -8
  9. package/jest.config.js +21 -21
  10. package/jest.setup.js +7 -7
  11. package/package.json +97 -97
  12. package/public/index.html +27 -27
  13. package/src/App.vue +164 -164
  14. package/src/ReportView.js +19 -19
  15. package/src/assets/img/querySlotDemo.svg +15 -15
  16. package/src/assets/svg/badtwo.svg +1 -1
  17. package/src/assets/svg/goodtwo.svg +1 -1
  18. package/src/base-client/components/common/AMisRender/index.js +3 -3
  19. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  20. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  21. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  22. package/src/base-client/components/common/CitySelect/index.js +3 -3
  23. package/src/base-client/components/common/CitySelect/index.md +109 -109
  24. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  25. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  26. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  27. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  28. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  29. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  30. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  31. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  32. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  33. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  34. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  35. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  36. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  37. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  38. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  39. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  40. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  41. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  42. package/src/base-client/components/common/Tree/index.js +2 -2
  43. package/src/base-client/components/common/Upload/Upload.vue +197 -197
  44. package/src/base-client/components/common/Upload/index.js +3 -3
  45. package/src/base-client/components/common/XAddForm/XAddForm.vue +92 -92
  46. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +502 -502
  47. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  48. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  49. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  50. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  51. package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
  52. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  53. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  54. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  55. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  56. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -117
  57. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  58. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  59. package/src/base-client/components/common/XForm/XForm.vue +253 -253
  60. package/src/base-client/components/common/XForm/XFormItem.vue +545 -545
  61. package/src/base-client/components/common/XForm/XTreeSelect.vue +191 -191
  62. package/src/base-client/components/common/XForm/index.md +178 -178
  63. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  64. package/src/base-client/components/common/XFormTable/XFormTable.vue +418 -418
  65. package/src/base-client/components/common/XFormTable/index.md +98 -98
  66. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -131
  67. package/src/base-client/components/common/XReport/XReport.vue +694 -694
  68. package/src/base-client/components/common/XReport/XReportDesign.vue +423 -414
  69. package/src/base-client/components/common/XReport/XReportTrGroup.vue +602 -596
  70. package/src/base-client/components/common/XReport/index.js +3 -3
  71. package/src/base-client/components/common/XReport/index.md +44 -44
  72. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  73. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  74. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  75. package/src/base-client/components/common/XStepView/index.js +3 -3
  76. package/src/base-client/components/common/XStepView/index.md +31 -31
  77. package/src/base-client/components/common/XTable/XTable.vue +549 -549
  78. package/src/base-client/components/common/XTable/index.md +255 -255
  79. package/src/base-client/components/common/XTree/XTree.vue +76 -76
  80. package/src/base-client/components/common/XTree/index.js +3 -3
  81. package/src/base-client/components/common/XTree/index.md +36 -36
  82. package/src/base-client/components/index.js +47 -47
  83. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  84. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  85. package/src/base-client/plugins/AppData.js +115 -115
  86. package/src/base-client/plugins/Config.js +19 -19
  87. package/src/base-client/plugins/GetLoginInfoService.js +182 -182
  88. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  89. package/src/bootstrap.js +39 -39
  90. package/src/components/CodeMirror/inedx.vue +118 -118
  91. package/src/components/CodeMirror/setting.js +40 -40
  92. package/src/components/FilePreview/FilePreview.vue +166 -166
  93. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  94. package/src/components/STable/index.js +323 -323
  95. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  96. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  97. package/src/components/menu/SideMenu.vue +75 -75
  98. package/src/components/menu/menu.js +273 -273
  99. package/src/components/tool/AStepItem.vue +60 -60
  100. package/src/config/CreateQueryConfig.js +322 -322
  101. package/src/config/default/antd.config.js +89 -89
  102. package/src/config/default/setting.config.js +53 -53
  103. package/src/font-style/font.css +4 -4
  104. package/src/layouts/CommonLayout.vue +56 -56
  105. package/src/layouts/PageLayout.vue +151 -151
  106. package/src/layouts/SinglePageView.vue +138 -138
  107. package/src/layouts/header/AdminHeader.vue +132 -132
  108. package/src/layouts/header/HeaderNotice.vue +177 -177
  109. package/src/layouts/tabs/TabsHead.vue +189 -189
  110. package/src/layouts/tabs/TabsView.vue +387 -387
  111. package/src/lib.js +1 -1
  112. package/src/main.js +26 -26
  113. package/src/mock/extend/index.js +84 -84
  114. package/src/mock/goods/index.js +108 -108
  115. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  116. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  117. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  118. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  119. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  120. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  121. package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
  122. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  123. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  124. package/src/pages/DynamicStatistics/index.vue +282 -282
  125. package/src/pages/Example/index.vue +1432 -1305
  126. package/src/pages/ServiceReview/index.vue +284 -284
  127. package/src/pages/XReportView/index.vue +62 -62
  128. package/src/pages/login/Login.vue +378 -378
  129. package/src/pages/login/LoginV3.vue +389 -389
  130. package/src/pages/resourceManage/orgListManage.vue +98 -98
  131. package/src/pages/system/dictionary/index.vue +44 -44
  132. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  133. package/src/pages/system/monitor/operLog/index.vue +37 -37
  134. package/src/pages/system/settings/modifyPassword.vue +117 -117
  135. package/src/pages/system/ticket/index.vue +480 -480
  136. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  137. package/src/router/async/config.async.js +32 -32
  138. package/src/router/async/router.map.js +98 -98
  139. package/src/router/guards.js +214 -214
  140. package/src/router/index.js +27 -27
  141. package/src/router.js +18 -18
  142. package/src/services/api/TicketDetailsViewApi.js +46 -46
  143. package/src/services/api/cas.js +79 -79
  144. package/src/services/api/common.js +274 -274
  145. package/src/services/api/entity.js +18 -18
  146. package/src/services/api/index.js +17 -17
  147. package/src/services/api/restTools.js +46 -46
  148. package/src/services/apiService.js +14 -14
  149. package/src/services/user.js +71 -71
  150. package/src/store/modules/setting.js +119 -119
  151. package/src/theme/default/style.less +57 -57
  152. package/src/utils/authority-utils.js +85 -85
  153. package/src/utils/errorCode.js +6 -6
  154. package/src/utils/htmlToPDF.js +108 -108
  155. package/src/utils/htmlToPDFApi.js +5 -5
  156. package/src/utils/indexedDB.js +201 -201
  157. package/src/utils/login.js +141 -141
  158. package/src/utils/map-utils.js +47 -47
  159. package/src/utils/request.js +343 -343
  160. package/src/utils/routerUtil.js +428 -428
  161. package/src/utils/util.js +231 -231
  162. package/src/utils/waterMark.js +31 -31
  163. package/test/Amis.spec.js +163 -163
  164. package/test/Tree.spec.js +167 -167
  165. package/test/myDialog.spec.js +46 -46
  166. package/vue.config.js +166 -166
  167. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
package/src/utils/util.js CHANGED
@@ -1,231 +1,231 @@
1
- import enquireJs from 'enquire.js'
2
-
3
- const timeList = [
4
- {
5
- CN: '早上好',
6
- HK: '早晨啊',
7
- US: 'Good morning'
8
- }, {
9
- CN: '上午好',
10
- HK: '上午好',
11
- US: 'Good morning'
12
- }, {
13
- CN: '中午好',
14
- HK: '中午好',
15
- US: 'Good afternoon'
16
- }, {
17
- CN: '下午好',
18
- HK: '下午好',
19
- US: 'Good afternoon'
20
- }, {
21
- CN: '晚上好',
22
- HK: '晚上好',
23
- US: 'Good evening'
24
- }
25
- ]
26
- /**
27
- * 数组去空值
28
- */
29
- export function arrRemoveEmpty (arr) {
30
- for (let i = 0; i < arr.length; i++) {
31
- if (arr[i] === '' || typeof (arr[i]) == 'undefined') {
32
- arr.splice(i, 1)
33
- i--
34
- }
35
- }
36
- return arr
37
- }
38
-
39
- export function isDef (v) {
40
- return v !== undefined && v !== null
41
- }
42
-
43
- export function formatDate (dateStr, fmt) {
44
- if (dateStr == null) {
45
- return '--'
46
- }
47
- let date
48
- if (dateStr === 'now') {
49
- date = new Date()
50
- } else {
51
- date = new Date(dateStr)
52
- }
53
- const o = {
54
- 'M+': date.getMonth() + 1,
55
- 'd+': date.getDate(),
56
- 'h+': date.getHours(),
57
- 'm+': date.getMinutes(),
58
- 's+': date.getSeconds(),
59
- 'q+': Math.floor((date.getMonth() + 3) / 3),
60
- S: date.getMilliseconds()
61
- }
62
- if (!fmt) {
63
- fmt = 'yyyy-MM-dd hh:mm:ss'
64
- }
65
- if (/(y+)/.test(fmt)) {
66
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
67
- }
68
- for (const k in o) {
69
- if (new RegExp('(' + k + ')').test(fmt)) {
70
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
71
- }
72
- }
73
- return fmt
74
- }
75
-
76
- export function uuid () {
77
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
78
- const r = Math.random() * 16 | 0
79
- const v = c === 'x' ? r : (r & 0x3 | 0x8)
80
- return v.toString(16)
81
- })
82
- }
83
-
84
- export function timeCompare (date1, date2) {
85
- const date11 = new Date(date1)
86
- const date22 = new Date(date2)
87
- return date11.time > date22.time ? 1 : -1
88
- }
89
-
90
- export function timeFix () {
91
- const time = new Date()
92
- const hour = time.getHours()
93
- return hour < 9
94
- ? timeList[0]
95
- : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
96
- }
97
-
98
- /**
99
- * Remove an item from an array.
100
- */
101
- export function remove (arr, item) {
102
- if (arr.length) {
103
- const index = arr.indexOf(item)
104
- if (index > -1) {
105
- return arr.splice(index, 1)
106
- }
107
- }
108
- }
109
-
110
- export function isRegExp (v) {
111
- return _toString.call(v) === '[object RegExp]'
112
- }
113
-
114
- export function enquireScreen (call) {
115
- const handler = {
116
- match: function () {
117
- call && call(true)
118
- },
119
- unmatch: function () {
120
- call && call(false)
121
- }
122
- }
123
- enquireJs.register('only screen and (max-width: 767.99px)', handler)
124
- }
125
-
126
- export function showXml (str) {
127
- let text = str
128
-
129
- // 去掉多余的空格
130
- text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
131
- return name + props.replace(/\s+(\w+=)/g, ' $1')
132
- }).replace(/>\s*?</g, '>\n<')
133
-
134
- // 把注释编码
135
- text = text.replace(/\n/g, '\r').replace(/<!--(.+?)-->/g, function ($0, text) {
136
- return '<!--' + escape(text) + '-->'
137
- }).replace(/\r/g, '\n')
138
-
139
- // 调整格式
140
- const rgx = /\n(<(([^?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(\/)>|<(\/)\2>))?)/mg
141
- const nodeStack = []
142
- const output = text.replace(rgx, function ($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) {
143
- const isClosed = (isCloseFull1 === '/') || (isCloseFull2 === '/') || (isFull1 === '/') || (isFull2 === '/')
144
- let prefix
145
- if (isBegin === '!') {
146
- prefix = getPrefix(nodeStack.length)
147
- } else {
148
- if (isBegin !== '/') {
149
- prefix = getPrefix(nodeStack.length)
150
- if (!isClosed) {
151
- nodeStack.push(name)
152
- }
153
- } else {
154
- nodeStack.pop()
155
- prefix = getPrefix(nodeStack.length)
156
- }
157
- }
158
- return '\n' + prefix + all
159
- })
160
- let outputText = output.substring(1)
161
-
162
- // 把注释还原并解码,调格式
163
- outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)<!--(.+?)-->/g, function ($0, prefix, text) {
164
- if (prefix.charAt(0) === '\r') { prefix = prefix.substring(1) }
165
- text = unescape(text).replace(/\r/g, '\n')
166
- return '\n' + prefix + '<!--' + text.replace(/^\s*/mg, prefix) + '-->'
167
- })
168
- // alert(outputText);
169
-
170
- outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
171
-
172
- return outputText
173
- }
174
-
175
- function getPrefix (prefixIndex) {
176
- const span = ' '
177
- const output = []
178
- for (let i = 0; i < prefixIndex; ++i) {
179
- output.push(span)
180
- }
181
-
182
- return output.join('')
183
- }
184
-
185
- /**
186
- * 构造树型结构数据
187
- * [label,value,children]
188
- */
189
- export function handleTree (data, id, parentId, children) {
190
- const config = {
191
- id: id || 'id',
192
- parentId: parentId || 'parent_id',
193
- childrenList: children || 'children'
194
- }
195
- const childrenListMap = {}
196
- const nodeIds = {}
197
- const tree = []
198
- for (const d of data) {
199
- const parentId = d[config.parentId]
200
- if (childrenListMap[parentId] == null) {
201
- childrenListMap[parentId] = []
202
- }
203
- nodeIds[d[config.id]] = d
204
- childrenListMap[parentId].push(d)
205
- }
206
- for (const d of data) {
207
- const parentId = d[config.parentId]
208
- if (nodeIds[parentId] == null) {
209
- tree.push(d)
210
- }
211
- }
212
- for (const t of tree) {
213
- adaptToChildrenList(t)
214
- }
215
-
216
- function adaptToChildrenList (o) {
217
- o.label = o.name
218
- o.value = o.name
219
- if (childrenListMap[o[config.id]] !== null) {
220
- o[config.childrenList] = childrenListMap[o[config.id]]
221
- }
222
- if (o[config.childrenList]) {
223
- for (const c of o[config.childrenList]) {
224
- adaptToChildrenList(c)
225
- }
226
- }
227
- }
228
- return tree
229
- }
230
-
231
- const _toString = Object.prototype.toString
1
+ import enquireJs from 'enquire.js'
2
+
3
+ const timeList = [
4
+ {
5
+ CN: '早上好',
6
+ HK: '早晨啊',
7
+ US: 'Good morning'
8
+ }, {
9
+ CN: '上午好',
10
+ HK: '上午好',
11
+ US: 'Good morning'
12
+ }, {
13
+ CN: '中午好',
14
+ HK: '中午好',
15
+ US: 'Good afternoon'
16
+ }, {
17
+ CN: '下午好',
18
+ HK: '下午好',
19
+ US: 'Good afternoon'
20
+ }, {
21
+ CN: '晚上好',
22
+ HK: '晚上好',
23
+ US: 'Good evening'
24
+ }
25
+ ]
26
+ /**
27
+ * 数组去空值
28
+ */
29
+ export function arrRemoveEmpty (arr) {
30
+ for (let i = 0; i < arr.length; i++) {
31
+ if (arr[i] === '' || typeof (arr[i]) == 'undefined') {
32
+ arr.splice(i, 1)
33
+ i--
34
+ }
35
+ }
36
+ return arr
37
+ }
38
+
39
+ export function isDef (v) {
40
+ return v !== undefined && v !== null
41
+ }
42
+
43
+ export function formatDate (dateStr, fmt) {
44
+ if (dateStr == null) {
45
+ return '--'
46
+ }
47
+ let date
48
+ if (dateStr === 'now') {
49
+ date = new Date()
50
+ } else {
51
+ date = new Date(dateStr)
52
+ }
53
+ const o = {
54
+ 'M+': date.getMonth() + 1,
55
+ 'd+': date.getDate(),
56
+ 'h+': date.getHours(),
57
+ 'm+': date.getMinutes(),
58
+ 's+': date.getSeconds(),
59
+ 'q+': Math.floor((date.getMonth() + 3) / 3),
60
+ S: date.getMilliseconds()
61
+ }
62
+ if (!fmt) {
63
+ fmt = 'yyyy-MM-dd hh:mm:ss'
64
+ }
65
+ if (/(y+)/.test(fmt)) {
66
+ fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
67
+ }
68
+ for (const k in o) {
69
+ if (new RegExp('(' + k + ')').test(fmt)) {
70
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
71
+ }
72
+ }
73
+ return fmt
74
+ }
75
+
76
+ export function uuid () {
77
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
78
+ const r = Math.random() * 16 | 0
79
+ const v = c === 'x' ? r : (r & 0x3 | 0x8)
80
+ return v.toString(16)
81
+ })
82
+ }
83
+
84
+ export function timeCompare (date1, date2) {
85
+ const date11 = new Date(date1)
86
+ const date22 = new Date(date2)
87
+ return date11.time > date22.time ? 1 : -1
88
+ }
89
+
90
+ export function timeFix () {
91
+ const time = new Date()
92
+ const hour = time.getHours()
93
+ return hour < 9
94
+ ? timeList[0]
95
+ : (hour <= 11 ? timeList[1] : (hour <= 13 ? timeList[2] : (hour <= 20 ? timeList[3] : timeList[4])))
96
+ }
97
+
98
+ /**
99
+ * Remove an item from an array.
100
+ */
101
+ export function remove (arr, item) {
102
+ if (arr.length) {
103
+ const index = arr.indexOf(item)
104
+ if (index > -1) {
105
+ return arr.splice(index, 1)
106
+ }
107
+ }
108
+ }
109
+
110
+ export function isRegExp (v) {
111
+ return _toString.call(v) === '[object RegExp]'
112
+ }
113
+
114
+ export function enquireScreen (call) {
115
+ const handler = {
116
+ match: function () {
117
+ call && call(true)
118
+ },
119
+ unmatch: function () {
120
+ call && call(false)
121
+ }
122
+ }
123
+ enquireJs.register('only screen and (max-width: 767.99px)', handler)
124
+ }
125
+
126
+ export function showXml (str) {
127
+ let text = str
128
+
129
+ // 去掉多余的空格
130
+ text = '\n' + text.replace(/(<\w+)(\s.*?>)/g, function ($0, name, props) {
131
+ return name + props.replace(/\s+(\w+=)/g, ' $1')
132
+ }).replace(/>\s*?</g, '>\n<')
133
+
134
+ // 把注释编码
135
+ text = text.replace(/\n/g, '\r').replace(/<!--(.+?)-->/g, function ($0, text) {
136
+ return '<!--' + escape(text) + '-->'
137
+ }).replace(/\r/g, '\n')
138
+
139
+ // 调整格式
140
+ const rgx = /\n(<(([^?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(\/)>|<(\/)\2>))?)/mg
141
+ const nodeStack = []
142
+ const output = text.replace(rgx, function ($0, all, name, isBegin, isCloseFull1, isCloseFull2, isFull1, isFull2) {
143
+ const isClosed = (isCloseFull1 === '/') || (isCloseFull2 === '/') || (isFull1 === '/') || (isFull2 === '/')
144
+ let prefix
145
+ if (isBegin === '!') {
146
+ prefix = getPrefix(nodeStack.length)
147
+ } else {
148
+ if (isBegin !== '/') {
149
+ prefix = getPrefix(nodeStack.length)
150
+ if (!isClosed) {
151
+ nodeStack.push(name)
152
+ }
153
+ } else {
154
+ nodeStack.pop()
155
+ prefix = getPrefix(nodeStack.length)
156
+ }
157
+ }
158
+ return '\n' + prefix + all
159
+ })
160
+ let outputText = output.substring(1)
161
+
162
+ // 把注释还原并解码,调格式
163
+ outputText = outputText.replace(/\n/g, '\r').replace(/(\s*)<!--(.+?)-->/g, function ($0, prefix, text) {
164
+ if (prefix.charAt(0) === '\r') { prefix = prefix.substring(1) }
165
+ text = unescape(text).replace(/\r/g, '\n')
166
+ return '\n' + prefix + '<!--' + text.replace(/^\s*/mg, prefix) + '-->'
167
+ })
168
+ // alert(outputText);
169
+
170
+ outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
171
+
172
+ return outputText
173
+ }
174
+
175
+ function getPrefix (prefixIndex) {
176
+ const span = ' '
177
+ const output = []
178
+ for (let i = 0; i < prefixIndex; ++i) {
179
+ output.push(span)
180
+ }
181
+
182
+ return output.join('')
183
+ }
184
+
185
+ /**
186
+ * 构造树型结构数据
187
+ * [label,value,children]
188
+ */
189
+ export function handleTree (data, id, parentId, children) {
190
+ const config = {
191
+ id: id || 'id',
192
+ parentId: parentId || 'parent_id',
193
+ childrenList: children || 'children'
194
+ }
195
+ const childrenListMap = {}
196
+ const nodeIds = {}
197
+ const tree = []
198
+ for (const d of data) {
199
+ const parentId = d[config.parentId]
200
+ if (childrenListMap[parentId] == null) {
201
+ childrenListMap[parentId] = []
202
+ }
203
+ nodeIds[d[config.id]] = d
204
+ childrenListMap[parentId].push(d)
205
+ }
206
+ for (const d of data) {
207
+ const parentId = d[config.parentId]
208
+ if (nodeIds[parentId] == null) {
209
+ tree.push(d)
210
+ }
211
+ }
212
+ for (const t of tree) {
213
+ adaptToChildrenList(t)
214
+ }
215
+
216
+ function adaptToChildrenList (o) {
217
+ o.label = o.name
218
+ o.value = o.name
219
+ if (childrenListMap[o[config.id]] !== null) {
220
+ o[config.childrenList] = childrenListMap[o[config.id]]
221
+ }
222
+ if (o[config.childrenList]) {
223
+ for (const c of o[config.childrenList]) {
224
+ adaptToChildrenList(c)
225
+ }
226
+ }
227
+ }
228
+ return tree
229
+ }
230
+
231
+ const _toString = Object.prototype.toString
@@ -1,31 +1,31 @@
1
- /**
2
- * @description: createWaterMark.js 加水印功能
3
- */
4
- let waterMarkDOM
5
-
6
- const clearWaterMark = () => {
7
- if (waterMarkDOM) waterMarkDOM.remove()
8
- }
9
- /**
10
- * @description: 创建水印
11
- * @param waterMarkName 水印内容
12
- */
13
- export default function createWaterMark (waterMarkName) {
14
- clearWaterMark()
15
- if (!waterMarkName) {
16
- return
17
- }
18
- const width = window.parseInt(document.body.clientWidth)
19
- const canvasWidth = width / window.parseInt(width / 320)
20
- const fontFamily = window.getComputedStyle(document.body)['font-family']
21
- const fragment = document.createDocumentFragment()
22
- waterMarkDOM = document.createElement('div')
23
- waterMarkDOM.className = 'water-mark-wrap'
24
- let spanStr = ''
25
- for (let i = 0; i < 100; i++) {
26
- spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
27
- }
28
- waterMarkDOM.innerHTML = spanStr
29
- fragment.appendChild(waterMarkDOM)
30
- document.body.appendChild(fragment)
31
- }
1
+ /**
2
+ * @description: createWaterMark.js 加水印功能
3
+ */
4
+ let waterMarkDOM
5
+
6
+ const clearWaterMark = () => {
7
+ if (waterMarkDOM) waterMarkDOM.remove()
8
+ }
9
+ /**
10
+ * @description: 创建水印
11
+ * @param waterMarkName 水印内容
12
+ */
13
+ export default function createWaterMark (waterMarkName) {
14
+ clearWaterMark()
15
+ if (!waterMarkName) {
16
+ return
17
+ }
18
+ const width = window.parseInt(document.body.clientWidth)
19
+ const canvasWidth = width / window.parseInt(width / 320)
20
+ const fontFamily = window.getComputedStyle(document.body)['font-family']
21
+ const fragment = document.createDocumentFragment()
22
+ waterMarkDOM = document.createElement('div')
23
+ waterMarkDOM.className = 'water-mark-wrap'
24
+ let spanStr = ''
25
+ for (let i = 0; i < 100; i++) {
26
+ spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
27
+ }
28
+ waterMarkDOM.innerHTML = spanStr
29
+ fragment.appendChild(waterMarkDOM)
30
+ document.body.appendChild(fragment)
31
+ }