hd-idevvue3 3.0.0 → 3.0.1

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 (226) hide show
  1. package/README.md +22 -191
  2. package/dist/index.html +17 -0
  3. package/package.json +13 -9
  4. package/pnpm-lock.yaml +5593 -0
  5. package/src/App.vue +15 -0
  6. package/src/assets/sound/notify.wav +0 -0
  7. package/src/demo/demo.vue +43 -0
  8. package/src/demo/dropdemo.vue +43 -0
  9. package/src/demo/extsets.vue +107 -0
  10. package/src/demo/formedit.vue +145 -0
  11. package/src/demo/hightquery.vue +169 -0
  12. package/src/demo/inlineedit.vue +88 -0
  13. package/src/demo/selfdrop.vue +41 -0
  14. package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +2 -0
  15. package/src/directive/el-dragDialog/drag.js +124 -0
  16. package/src/directive/el-dragDialog/index.js +13 -0
  17. package/src/errorLog.js +14 -0
  18. package/src/hdcom/BigGrid.js +173 -0
  19. package/src/hdcom/BillShow.vue +90 -0
  20. package/src/hdcom/BillUpload.vue +253 -0
  21. package/src/hdcom/BtnRight.vue +98 -0
  22. package/src/hdcom/ErrHint.vue +30 -0
  23. package/src/hdcom/ExtendColumn.vue +108 -0
  24. package/src/hdcom/ExtendCommon.js +29 -0
  25. package/src/hdcom/ExtendForm.vue +114 -0
  26. package/src/hdcom/FacePicUpload.vue +71 -0
  27. package/src/hdcom/FaceRecTest.vue +104 -0
  28. package/src/hdcom/GridChart.vue +194 -0
  29. package/src/hdcom/GridExField.vue +281 -0
  30. package/src/hdcom/GridShow.vue +238 -0
  31. package/src/hdcom/HdAside.vue +178 -0
  32. package/src/hdcom/HdBtn.vue +113 -0
  33. package/src/hdcom/HdButton.vue +137 -0
  34. package/src/hdcom/HdComFaceRec.vue +58 -0
  35. package/src/hdcom/HdComGrid.vue +776 -0
  36. package/src/hdcom/HdComQuery.vue +273 -0
  37. package/src/hdcom/HdComQueryDetail.vue +161 -0
  38. package/src/hdcom/HdComSortDetail.vue +155 -0
  39. package/src/hdcom/HdDatePicker.vue +78 -0
  40. package/src/hdcom/HdDialog.vue +63 -0
  41. package/src/hdcom/HdDrop.vue +163 -0
  42. package/src/hdcom/HdFileUpload.vue +148 -0
  43. package/src/hdcom/HdFilterBox.vue +90 -0
  44. package/src/hdcom/HdFooter.vue +149 -0
  45. package/src/hdcom/HdForm.vue +278 -0
  46. package/src/hdcom/HdFormBtn.vue +89 -0
  47. package/src/hdcom/HdFormItem.vue +35 -0
  48. package/src/hdcom/HdGctosGrid +0 -0
  49. package/src/hdcom/HdGrid.vue +825 -0
  50. package/src/hdcom/HdGridEditBtn.vue +44 -0
  51. package/src/hdcom/HdGridExt.js +219 -0
  52. package/src/hdcom/HdGridSel.vue +223 -0
  53. package/src/hdcom/HdHeader.vue +148 -0
  54. package/src/hdcom/HdHotKey.vue +81 -0
  55. package/src/hdcom/HdInputHint.vue +49 -0
  56. package/src/hdcom/HdMain.vue +43 -0
  57. package/src/hdcom/HdMessage.vue +192 -0
  58. package/src/hdcom/HdNum.vue +69 -0
  59. package/src/hdcom/HdPopSel.vue +58 -0
  60. package/src/hdcom/HdRightMenu.vue +61 -0
  61. package/src/hdcom/HdSel/SelGridFieldcod.vue +36 -0
  62. package/src/hdcom/HdTableColumn.vue +334 -0
  63. package/src/hdcom/HdTempSave.vue +140 -0
  64. package/src/hdcom/HdTree.vue +86 -0
  65. package/src/hdcom/HdTreeTable/eval.js +32 -0
  66. package/src/hdcom/HdTreeTable/index.vue +174 -0
  67. package/src/hdcom/ImportExcel.vue +143 -0
  68. package/src/hdcom/PdfShow.vue +266 -0
  69. package/src/hdcom/index.js +80 -0
  70. package/src/idev.common.js +72 -0
  71. package/src/index.js +13 -0
  72. package/src/utils/HdQuery.js +54 -0
  73. package/src/utils/comutils.js +98 -0
  74. package/src/utils/utils.js +105 -0
  75. package/src/vendor/Blob.js +179 -0
  76. package/src/vendor/Export2Excel.js +220 -0
  77. package/src/vendor/Export2Zip.js +22 -0
  78. package/src/views/layout/AppMain.vue +32 -0
  79. package/src/views/layout/HdLayout.vue +78 -0
  80. package/src/views/layout/header/ElasticSearch.vue +225 -0
  81. package/src/views/layout/header/HZRecorder.js +231 -0
  82. package/src/views/layout/header/HeaderSearch.vue +198 -0
  83. package/src/views/layout/header/Levelbar.vue +49 -0
  84. package/src/views/layout/header/MainHeader.vue +271 -0
  85. package/src/views/layout/header/Navbar.vue +105 -0
  86. package/src/views/layout/header/ScrollPane.vue +81 -0
  87. package/src/views/layout/header/TagsView.vue +210 -0
  88. package/src/views/layout/header/VocRec.vue +97 -0
  89. package/src/views/layout/header/changepswform.vue +96 -0
  90. package/src/views/layout/index.js +12 -0
  91. package/src/views/layout/menu/Hamburger.vue +45 -0
  92. package/src/views/layout/menu/HdMenu.vue +167 -0
  93. package/src/views/layout/menu/css/menu.css +288 -0
  94. package/src/views/layout/menu/index.vue +25 -0
  95. package/src/views/privilege/commsg/commsg.vue +78 -0
  96. package/src/views/privilege/commsg/commsgOrgn.vue +42 -0
  97. package/src/views/privilege/commsg/commsgRole.vue +149 -0
  98. package/src/views/privilege/commsg/commsgform.vue +160 -0
  99. package/src/views/privilege/commsg/commsgiframe.vue +33 -0
  100. package/src/views/privilege/commsg/commsgto.vue +120 -0
  101. package/src/views/privilege/commsg/commsgtoform.vue +108 -0
  102. package/src/views/privilege/commsg/commsgtrans.vue +155 -0
  103. package/src/views/privilege/exfield/comexcolumn.vue +71 -0
  104. package/src/views/privilege/exfield/comexcolumnform.vue +101 -0
  105. package/src/views/privilege/exfield/comexfield.vue +31 -0
  106. package/src/views/privilege/exfield/comexfieldform.vue +94 -0
  107. package/src/views/privilege/exfield/comexfieldsub.vue +72 -0
  108. package/src/views/privilege/index.js +42 -0
  109. package/src/views/privilege/menu/comMenu.vue +41 -0
  110. package/src/views/privilege/menu/menu.vue +133 -0
  111. package/src/views/privilege/menu/menuinfo.vue +56 -0
  112. package/src/views/privilege/menu/rolelist.vue +47 -0
  113. package/src/views/privilege/menu/userlist.vue +49 -0
  114. package/src/views/privilege/mobile/authmobileupdate.vue +69 -0
  115. package/src/views/privilege/mobile/authmobileupdateform.vue +90 -0
  116. package/src/views/privilege/orgDept/authOrgn.vue +96 -0
  117. package/src/views/privilege/orgDept/authorgnform.vue +145 -0
  118. package/src/views/privilege/orgDept/orgDept.vue +37 -0
  119. package/src/views/privilege/orgDept/orgTree.vue +88 -0
  120. package/src/views/privilege/orgDept/orgnselect.vue +134 -0
  121. package/src/views/privilege/personDept/authuser.vue +123 -0
  122. package/src/views/privilege/personDept/authuserform.vue +154 -0
  123. package/src/views/privilege/personDept/facerec.vue +117 -0
  124. package/src/views/privilege/personDept/orgncascader.vue +125 -0
  125. package/src/views/privilege/personDept/personDept.vue +31 -0
  126. package/src/views/privilege/quartz/comquartzjob.vue +65 -0
  127. package/src/views/privilege/quartz/comquartzjobform.vue +99 -0
  128. package/src/views/privilege/quartz/comquartzlog.vue +59 -0
  129. package/src/views/privilege/role/btnRole.vue +117 -0
  130. package/src/views/privilege/role/menuRole.vue +64 -0
  131. package/src/views/privilege/role/orgnRole.vue +56 -0
  132. package/src/views/privilege/role/role.vue +67 -0
  133. package/src/views/privilege/role/rolelist.vue +67 -0
  134. package/src/views/privilege/role/roleselect.vue +57 -0
  135. package/src/views/privilege/search/comsearch.vue +105 -0
  136. package/src/views/privilege/search/menu.vue +52 -0
  137. package/src/views/privilege/syscode/syscode.vue +103 -0
  138. package/src/views/privilege/syscode/sysfield.vue +66 -0
  139. package/src/views/privilege/syscode/sysfieldframe.vue +30 -0
  140. package/src/views/privilege/syslog/menulog.vue +52 -0
  141. package/src/views/privilege/syslog/syslog.vue +115 -0
  142. package/src/views/privilege/syslog/syslogconfig.vue +61 -0
  143. package/src/views/privilege/syslog/syslogform.vue +83 -0
  144. package/src/views/privilege/syslog/syslogframe.vue +26 -0
  145. package/src/views/privilege/userRole/userRole.vue +122 -0
  146. package/src/views/privilege.zip +0 -0
  147. package/vite.config.js +118 -0
  148. package/.babelrc +0 -17
  149. package/.editorconfig +0 -14
  150. package/.eslintignore +0 -3
  151. package/.npminstall.done +0 -1
  152. package/.postcssrc.js +0 -8
  153. package/LICENSE +0 -21
  154. package/Listening +0 -28
  155. package/build/build.js +0 -70
  156. package/build/check-versions.js +0 -45
  157. package/build/config.js +0 -81
  158. package/build/dev-client.js +0 -9
  159. package/build/dev-server.js +0 -93
  160. package/build/utils.js +0 -78
  161. package/build/vue-loader.conf.js +0 -12
  162. package/build/webpack.common.js +0 -37
  163. package/build/webpack.component.js +0 -36
  164. package/build/webpack.prod.conf.js +0 -38
  165. package/components.json +0 -8
  166. package/conf.js +0 -42
  167. package/config/dev.env.js +0 -6
  168. package/config/index.js +0 -43
  169. package/config/prod.env.js +0 -6
  170. package/config/sit.env.js +0 -6
  171. package/favicon.ico +0 -0
  172. package/jsdoc-vue.js +0 -12
  173. package/lib/0.index.js +0 -12573
  174. package/lib/1.index.js +0 -6
  175. package/lib/2.index.js +0 -2
  176. package/lib/idev.common.js +0 -1
  177. package/lib/idv8.common.js +0 -1
  178. package/lib/index.js +0 -49170
  179. package/lib/js/ErrHint.js +0 -1
  180. package/lib/js/HdAside.js +0 -1
  181. package/lib/js/HdBtn.js +0 -1
  182. package/lib/js/HdButton.js +0 -1
  183. package/lib/js/HdComFaceRec.js +0 -1
  184. package/lib/js/HdComGrid.js +0 -1
  185. package/lib/js/HdDatePicker.js +0 -1
  186. package/lib/js/HdDialog.js +0 -1
  187. package/lib/js/HdDrop.js +0 -1
  188. package/lib/js/HdFileUpload.js +0 -1
  189. package/lib/js/HdFooter.js +0 -1
  190. package/lib/js/HdForm.js +0 -1
  191. package/lib/js/HdFormBtn.js +0 -1
  192. package/lib/js/HdFormItem.js +0 -1
  193. package/lib/js/HdGrid.js +0 -1
  194. package/lib/js/HdGridEditBtn.js +0 -1
  195. package/lib/js/HdGridSel.js +0 -1
  196. package/lib/js/HdHeader.js +0 -1
  197. package/lib/js/HdHotkey.js +0 -1
  198. package/lib/js/HdLayout.js +0 -1
  199. package/lib/js/HdMain.js +0 -1
  200. package/lib/js/HdMessage.js +0 -1
  201. package/lib/js/HdNum.js +0 -1
  202. package/lib/js/HdPopSel.js +0 -1
  203. package/lib/js/HdSearch.js +0 -1
  204. package/lib/js/HdTableColumn.js +0 -1
  205. package/lib/js/HdTempSave.js +0 -1
  206. package/lib/js/HdTree.js +0 -1
  207. package/lib/js/HdTreeTable.js +0 -1
  208. package/lib/js/authmobileupdate.js +0 -1
  209. package/lib/js/comexfield.js +0 -1
  210. package/lib/js/commsg.js +0 -1
  211. package/lib/js/commsgto.js +0 -1
  212. package/lib/js/comquartzjob.js +0 -1
  213. package/lib/js/comquartzlog.js +0 -1
  214. package/lib/js/comsearch.js +0 -1
  215. package/lib/js/menu.js +0 -1
  216. package/lib/js/menuinfo.js +0 -1
  217. package/lib/js/orgDept.js +0 -1
  218. package/lib/js/orgTree.js +0 -1
  219. package/lib/js/personDept.js +0 -1
  220. package/lib/js/role.js +0 -1
  221. package/lib/js/sysfieldframe.js +0 -1
  222. package/lib/js/syslog.js +0 -1
  223. package/lib/js/syslogframe.js +0 -1
  224. package/lib/js/userRole.js +0 -1
  225. package/npminstall-debug.log +0 -200
  226. package/ytgvue.rar +0 -0
@@ -0,0 +1,220 @@
1
+ /* eslint-disable */
2
+ import { saveAs } from 'file-saver'
3
+ import XLSX from 'xlsx'
4
+
5
+ function generateArray(table) {
6
+ var out = [];
7
+ var rows = table.querySelectorAll('tr');
8
+ var ranges = [];
9
+ for (var R = 0; R < rows.length; ++R) {
10
+ var outRow = [];
11
+ var row = rows[R];
12
+ var columns = row.querySelectorAll('td');
13
+ for (var C = 0; C < columns.length; ++C) {
14
+ var cell = columns[C];
15
+ var colspan = cell.getAttribute('colspan');
16
+ var rowspan = cell.getAttribute('rowspan');
17
+ var cellValue = cell.innerText;
18
+ if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
19
+
20
+ //Skip ranges
21
+ ranges.forEach(function (range) {
22
+ if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
23
+ for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
24
+ }
25
+ });
26
+
27
+ //Handle Row Span
28
+ if (rowspan || colspan) {
29
+ rowspan = rowspan || 1;
30
+ colspan = colspan || 1;
31
+ ranges.push({
32
+ s: {
33
+ r: R,
34
+ c: outRow.length
35
+ },
36
+ e: {
37
+ r: R + rowspan - 1,
38
+ c: outRow.length + colspan - 1
39
+ }
40
+ });
41
+ };
42
+
43
+ //Handle Value
44
+ outRow.push(cellValue !== "" ? cellValue : null);
45
+
46
+ //Handle Colspan
47
+ if (colspan)
48
+ for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
49
+ }
50
+ out.push(outRow);
51
+ }
52
+ return [out, ranges];
53
+ };
54
+
55
+ function datenum(v, date1904) {
56
+ if (date1904) v += 1462;
57
+ var epoch = Date.parse(v);
58
+ return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
59
+ }
60
+
61
+ function sheet_from_array_of_arrays(data, opts) {
62
+ var ws = {};
63
+ var range = {
64
+ s: {
65
+ c: 10000000,
66
+ r: 10000000
67
+ },
68
+ e: {
69
+ c: 0,
70
+ r: 0
71
+ }
72
+ };
73
+ for (var R = 0; R != data.length; ++R) {
74
+ for (var C = 0; C != data[R].length; ++C) {
75
+ if (range.s.r > R) range.s.r = R;
76
+ if (range.s.c > C) range.s.c = C;
77
+ if (range.e.r < R) range.e.r = R;
78
+ if (range.e.c < C) range.e.c = C;
79
+ var cell = {
80
+ v: data[R][C]
81
+ };
82
+ if (cell.v == null) continue;
83
+ var cell_ref = XLSX.utils.encode_cell({
84
+ c: C,
85
+ r: R
86
+ });
87
+
88
+ if (typeof cell.v === 'number') cell.t = 'n';
89
+ else if (typeof cell.v === 'boolean') cell.t = 'b';
90
+ else if (cell.v instanceof Date) {
91
+ cell.t = 'n';
92
+ cell.z = XLSX.SSF._table[14];
93
+ cell.v = datenum(cell.v);
94
+ } else cell.t = 's';
95
+
96
+ ws[cell_ref] = cell;
97
+ }
98
+ }
99
+ if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
100
+ return ws;
101
+ }
102
+
103
+ function Workbook() {
104
+ if (!(this instanceof Workbook)) return new Workbook();
105
+ this.SheetNames = [];
106
+ this.Sheets = {};
107
+ }
108
+
109
+ function s2ab(s) {
110
+ var buf = new ArrayBuffer(s.length);
111
+ var view = new Uint8Array(buf);
112
+ for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
113
+ return buf;
114
+ }
115
+
116
+ export function export_table_to_excel(id) {
117
+ var theTable = document.getElementById(id);
118
+ var oo = generateArray(theTable);
119
+ var ranges = oo[1];
120
+
121
+ /* original data */
122
+ var data = oo[0];
123
+ var ws_name = "SheetJS";
124
+
125
+ var wb = new Workbook(),
126
+ ws = sheet_from_array_of_arrays(data);
127
+
128
+ /* add ranges to worksheet */
129
+ // ws['!cols'] = ['apple', 'banan'];
130
+ ws['!merges'] = ranges;
131
+
132
+ /* add worksheet to workbook */
133
+ wb.SheetNames.push(ws_name);
134
+ wb.Sheets[ws_name] = ws;
135
+
136
+ var wbout = XLSX.write(wb, {
137
+ bookType: 'xlsx',
138
+ bookSST: false,
139
+ type: 'binary'
140
+ });
141
+
142
+ saveAs(new Blob([s2ab(wbout)], {
143
+ type: "application/octet-stream"
144
+ }), "test.xlsx")
145
+ }
146
+
147
+ export function export_json_to_excel({
148
+ multiHeader = [],
149
+ header,
150
+ data,
151
+ filename,
152
+ merges = [],
153
+ autoWidth = true,
154
+ bookType = 'xlsx'
155
+ } = {}) {
156
+ /* original data */
157
+ filename = filename || 'excel-list'
158
+ data = [...data]
159
+ data.unshift(header);
160
+
161
+ for (let i = multiHeader.length - 1; i > -1; i--) {
162
+ data.unshift(multiHeader[i])
163
+ }
164
+
165
+ var ws_name = "SheetJS";
166
+ var wb = new Workbook(),
167
+ ws = sheet_from_array_of_arrays(data);
168
+
169
+ if (merges.length > 0) {
170
+ if (!ws['!merges']) ws['!merges'] = [];
171
+ merges.forEach(item => {
172
+ ws['!merges'].push(XLSX.utils.decode_range(item))
173
+ })
174
+ }
175
+
176
+ if (autoWidth) {
177
+ /*设置worksheet每列的最大宽度*/
178
+ const colWidth = data.map(row => row.map(val => {
179
+ /*先判断是否为null/undefined*/
180
+ if (val == null) {
181
+ return {
182
+ 'wch': 10
183
+ };
184
+ }
185
+ /*再判断是否为中文*/
186
+ else if (val.toString().charCodeAt(0) > 255) {
187
+ return {
188
+ 'wch': val.toString().length * 2
189
+ };
190
+ } else {
191
+ return {
192
+ 'wch': val.toString().length
193
+ };
194
+ }
195
+ }))
196
+ /*以第一行为初始值*/
197
+ let result = colWidth[0];
198
+ for (let i = 1; i < colWidth.length; i++) {
199
+ for (let j = 0; j < colWidth[i].length; j++) {
200
+ if (result[j]['wch'] < colWidth[i][j]['wch']) {
201
+ result[j]['wch'] = colWidth[i][j]['wch'];
202
+ }
203
+ }
204
+ }
205
+ ws['!cols'] = result;
206
+ }
207
+
208
+ /* add worksheet to workbook */
209
+ wb.SheetNames.push(ws_name);
210
+ wb.Sheets[ws_name] = ws;
211
+
212
+ var wbout = XLSX.write(wb, {
213
+ bookType: bookType,
214
+ bookSST: false,
215
+ type: 'binary'
216
+ });
217
+ saveAs(new Blob([s2ab(wbout)], {
218
+ type: "application/octet-stream"
219
+ }), `${filename}.${bookType}`);
220
+ }
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+ require('script-loader!file-saver');
3
+ import JSZip from 'jszip'
4
+
5
+ export function export_txt_to_zip(th, jsonData, txtName, zipName) {
6
+ const zip = new JSZip()
7
+ const txt_name = txtName || 'file'
8
+ const zip_name = zipName || 'file'
9
+ const data = jsonData
10
+ let txtData = `${th}\r\n`
11
+ data.forEach((row) => {
12
+ let tempStr = ''
13
+ tempStr = row.toString()
14
+ txtData += `${tempStr}\r\n`
15
+ })
16
+ zip.file(`${txt_name}.txt`, txtData)
17
+ zip.generateAsync({type:"blob"}).then((blob) => {
18
+ saveAs(blob, `${zip_name}.zip`)
19
+ }, (err) => {
20
+ alert('导出失败')
21
+ })
22
+ }
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="app-main">
3
+ <transition mode="out-in" name="fade">
4
+ <keep-alive :include="cachedViews">
5
+ <router-view :key="key" v-if="reload"/>
6
+ </keep-alive>
7
+ </transition>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ name: 'AppMain',
14
+ computed: {
15
+ cachedViews() {
16
+ return this.$store.state.app.cachedViews
17
+ },
18
+ key() {
19
+ return this.$route.name
20
+ },
21
+ reload() { // 刷新页面
22
+ return this.$store.state.app.refreshPage !== true
23
+ }
24
+ }
25
+ }
26
+ </script>
27
+ <style rel="stylesheet/scss" lang="scss">
28
+ .app-main {
29
+ height: 100%;
30
+ overflow: auto;
31
+ }
32
+ </style>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <div :class="[{hideSidebar:!sidebar.opened}, $store.state.user.skin]" class="hd-layout app-wrapper"
3
+ v-if="!onlyContent">
4
+ <main-header class="hd-header mainHeader" v-if="$store.state.app.headerShow!=false"></main-header>
5
+ <div class="hd-content">
6
+ <hdmenu class="hd-menu sidebar-container"></hdmenu>
7
+ <div class="hd-main main-container">
8
+ <Navbar></Navbar>
9
+ <AppMain style="flex:1"></AppMain>
10
+ <slot></slot>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <app-main :class="[{hideSidebar:!sidebar.opened}, $store.state.user.skin]" class="app-wrapper" v-else></app-main>
15
+ </template>
16
+
17
+ <script>
18
+ import Navbar from './header/Navbar'
19
+ import TagsView from './header/TagsView'
20
+ import MainHeader from './header/MainHeader'
21
+ import AppMain from './AppMain'
22
+ import hdmenu from './menu'
23
+
24
+ export default {
25
+ name: 'layout',
26
+ components: {
27
+ MainHeader,
28
+ Navbar,
29
+ hdmenu,
30
+ AppMain,
31
+ TagsView,
32
+ },
33
+ computed: {
34
+ sidebar() {
35
+ return this.$store.state.app.sidebar
36
+ },
37
+ onlyContent() {
38
+ return this.$route.query.onlycontent == 1
39
+ }
40
+ },
41
+ watch: {
42
+ '$store.state.user.skin': {//弹窗的因为和#app平级,无法换肤
43
+ handler: function (newVal, oldVal) {
44
+ document.getElementsByTagName('body')[0].className = 'body-' + newVal;
45
+ this.$emit("chgTheme", newVal)
46
+ },
47
+ immediate: true
48
+ }
49
+ }
50
+ }
51
+ </script>
52
+ <style rel="stylesheet/scss" lang="scss" scoped>
53
+ .hd-layout {
54
+ display: flex;
55
+ flex-direction: column;
56
+
57
+ .hd-header {
58
+ height: 52px;
59
+ width: 100%
60
+ }
61
+
62
+ .hd-content {
63
+ flex: 1;
64
+ display: flex;
65
+ flex-direction: row;
66
+
67
+ .hd-menu {
68
+ width: 50px
69
+ }
70
+
71
+ .hd-main {
72
+ flex: 1;
73
+ display: flex;
74
+ flex-direction: column;
75
+ }
76
+ }
77
+ }
78
+ </style>
@@ -0,0 +1,225 @@
1
+ <template>
2
+ <div :class="{'show':show}" class="header-search">
3
+ <svg @click="click" class="search-icon screenfull-svg" height="32" viewBox="-10 -10 150 150"
4
+ width="32" xmlns="http://www.w3.org/2000/svg">
5
+ <path
6
+ d="M124.884 109.812L94.256 79.166c-.357-.357-.757-.629-1.129-.914a50.366 50.366 0 0 0 8.186-27.59C101.327 22.689 78.656 0 50.67 0 22.685 0 0 22.688 0 50.663c0 27.989 22.685 50.663 50.656 50.663 10.186 0 19.643-3.03 27.6-8.201.286.385.557.771.9 1.114l30.628 30.632a10.633 10.633 0 0 0 7.543 3.129c2.728 0 5.457-1.043 7.543-3.115 4.171-4.157 4.171-10.915.014-15.073M50.671 85.338C31.557 85.338 16 69.78 16 50.663c0-19.102 15.557-34.661 34.67-34.661 19.115 0 34.657 15.559 34.657 34.675 0 19.102-15.557 34.661-34.656 34.661"/>
7
+ </svg>
8
+ <el-select
9
+ :placeholder="$t('菜单查询')"
10
+ :remote-method="querySearch"
11
+ @change="change"
12
+ class="header-search-select"
13
+ default-first-option
14
+ filterable
15
+ ref="headerSearchSelect"
16
+ remote
17
+ v-model="search"
18
+ >
19
+ <el-option-group :key="$t('检索菜单')" :label="$t('检索菜单')" v-if="options1.length>0">
20
+ <el-option :key="index" :label="item.title.join(' > ')" :value="item" v-for="item,index in options1"/>
21
+ </el-option-group>
22
+ <el-option-group :key="$t('更多结果')" :label="$t('更多结果')" v-if="options2.length>0">
23
+ <el-option :key="index" :label="item.text" :value="item" v-for="item,index in options2"/>
24
+ </el-option-group>
25
+ </el-select>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ import Fuse from 'fuse.js'
31
+ import path from 'path'
32
+
33
+ export default {
34
+ name: 'ElasticSearch',
35
+ data() {
36
+ return {
37
+ search: '',
38
+ options1: [],
39
+ options2: [],
40
+ searchPool: [],
41
+ show: false,
42
+ fuse: undefined
43
+ }
44
+ },
45
+ computed: {
46
+ routes() {
47
+ return this.$store.state.permission.hdMenu;
48
+ },
49
+ lang() {
50
+ return this.$store.getters.language
51
+ }
52
+ },
53
+ watch: {
54
+ lang() {
55
+ this.searchPool = this.generateRoutes(this.routes)
56
+ },
57
+ routes() {
58
+ this.searchPool = this.generateRoutes(this.routes)
59
+ },
60
+ searchPool(list) {
61
+ this.initFuse(list)
62
+ },
63
+ show(value) {
64
+ if (value) {
65
+ document.body.addEventListener('click', this.close)
66
+ } else {
67
+ document.body.removeEventListener('click', this.close)
68
+ }
69
+ }
70
+ },
71
+ mounted() {
72
+ this.searchPool = this.generateRoutes(this.routes)
73
+ },
74
+ methods: {
75
+ click() {
76
+ this.show = !this.show
77
+ if (this.show) {
78
+ this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
79
+ }
80
+ },
81
+ close() {
82
+ this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
83
+ this.options1 = [];
84
+ this.options2 = [];
85
+ this.show = false
86
+ },
87
+ change(val) {
88
+ this.$router.push(val.path)
89
+ this.search = ''
90
+ this.options1 = [];
91
+ this.options2 = [];
92
+ this.$nextTick(() => {
93
+ this.show = false
94
+ })
95
+ },
96
+ initFuse(list) {
97
+ this.fuse = new Fuse(list, {
98
+ shouldSort: true,
99
+ threshold: 0.4,
100
+ location: 0,
101
+ distance: 100,
102
+ maxPatternLength: 32,
103
+ minMatchCharLength: 1,
104
+ keys: [{
105
+ name: 'title',
106
+ weight: 0.7
107
+ }, {
108
+ name: 'path',
109
+ weight: 0.3
110
+ }]
111
+ })
112
+ },
113
+ // Filter out the routes that can be displayed in the sidebar
114
+ // And generate the internationalized title
115
+ generateRoutes(routes, basePath = '/', prefixTitle = []) {
116
+ let res = []
117
+ for (const router of routes) {
118
+ // skip hidden router
119
+ if (router.hidden) {
120
+ continue
121
+ }
122
+
123
+ const data = {
124
+ path: path.resolve(basePath, router.path),
125
+ title: [...prefixTitle]
126
+ }
127
+
128
+ if (router.meta && router.meta.title) {
129
+ // generate internationalized title
130
+ const i18ntitle = this.$i18n.locale == 'zh' ? router.meta.title : router.meta.enTitle;
131
+
132
+ data.title = [...data.title, i18ntitle]
133
+
134
+ if (router.redirect !== 'noredirect') {
135
+ // only push the routes with title
136
+ // special case: need to exclude parent router without redirect
137
+ res.push(data)
138
+ }
139
+ }
140
+
141
+ // recursive child routes
142
+ if (router.children) {
143
+ const tempRoutes = this.generateRoutes(router.children, data.path, data.title)
144
+ if (tempRoutes.length >= 1) {
145
+ res = [...res, ...tempRoutes]
146
+ }
147
+ }
148
+ }
149
+
150
+ return res
151
+ },
152
+ querySearch(query) {
153
+ if (query !== '') {
154
+ this.options1 = this.fuse.search(query)
155
+ } else {
156
+ this.options1 = []
157
+ }
158
+
159
+ if (this.$store.state.app.elsearch) {//
160
+ this.options2 = [{text: this.$t('加载中...')}];
161
+ this.$http.get(`/webresources/login/com/ComSearch/search?q=${query}&type=${this.$i18n.locale}`).then(response => {
162
+
163
+ this.options2 = [];
164
+ response.data.forEach(v => {
165
+ let t = v.menuPath.reverse().join('=>')
166
+ if (this.$i18n.locale == 'en') {
167
+ t = v.menuEnPath.reverse().join('=>')
168
+ }
169
+
170
+ this.options2.push({
171
+ path: '/' + v.menuUrl + '?q=' + query,
172
+ text: t + '=>' + v.content
173
+ })
174
+ })
175
+ })
176
+ }
177
+ }
178
+ }
179
+ }
180
+ </script>
181
+
182
+ <style lang="scss" scoped>
183
+ .header-search {
184
+ font-size: 0 !important;
185
+
186
+ .search-icon {
187
+ font-size: 18px;
188
+ vertical-align: middle;
189
+ display: inline-block;
190
+ cursor: pointer;
191
+ fill: #e4e9ef;
192
+ /* width: 20px;
193
+ height: 20px;
194
+ vertical-align: 10px;*/
195
+ }
196
+
197
+ .header-search-select {
198
+ font-size: 18px;
199
+ transition: width 0.2s;
200
+ width: 0;
201
+ overflow: hidden;
202
+ background: transparent;
203
+ border-radius: 0;
204
+ display: inline-block;
205
+ vertical-align: middle;
206
+
207
+ /deep/ .el-input__inner {
208
+ border-radius: 0;
209
+ border: 0;
210
+ padding-left: 0;
211
+ padding-right: 0;
212
+ box-shadow: none !important;
213
+ border-bottom: 1px solid #d9d9d9;
214
+ vertical-align: middle;
215
+ }
216
+ }
217
+
218
+ &.show {
219
+ .header-search-select {
220
+ width: 150px;
221
+ margin-left: 10px;
222
+ }
223
+ }
224
+ }
225
+ </style>