hd-idevvue3 3.0.0 → 3.0.2

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 (230) hide show
  1. package/.env.development +5 -0
  2. package/.env.production +5 -0
  3. package/README.md +22 -191
  4. package/dist/assets/index.774ef40e.css +1 -0
  5. package/dist/hd-idevvue3.mjs +45697 -0
  6. package/dist/hd-idevvue3.umd.js +153 -0
  7. package/index.html +1 -0
  8. package/npminstall-debug.log +10 -2
  9. package/package.json +35 -40
  10. package/pnpm-lock.yaml +2631 -0
  11. package/src/App.vue +15 -0
  12. package/src/assets/sound/notify.wav +0 -0
  13. package/src/demo/demo.vue +43 -0
  14. package/src/demo/dropdemo.vue +43 -0
  15. package/src/demo/extsets.vue +107 -0
  16. package/src/demo/formedit.vue +145 -0
  17. package/src/demo/hightquery.vue +169 -0
  18. package/src/demo/inlineedit.vue +88 -0
  19. package/src/demo/selfdrop.vue +41 -0
  20. package/src/demo//350/241/214/345/206/205/347/272/247/350/201/224.txt +2 -0
  21. package/src/directive/el-dragDialog/drag.js +124 -0
  22. package/src/directive/el-dragDialog/index.js +13 -0
  23. package/src/errorLog.js +16 -0
  24. package/src/hdcom/BigGrid.js +173 -0
  25. package/src/hdcom/BillShow.vue +90 -0
  26. package/src/hdcom/BillUpload.vue +253 -0
  27. package/src/hdcom/BtnRight.vue +98 -0
  28. package/src/hdcom/ErrHint.vue +30 -0
  29. package/src/hdcom/ExtendColumn.vue +108 -0
  30. package/src/hdcom/ExtendCommon.js +29 -0
  31. package/src/hdcom/ExtendForm.vue +114 -0
  32. package/src/hdcom/FacePicUpload.vue +71 -0
  33. package/src/hdcom/FaceRecTest.vue +104 -0
  34. package/src/hdcom/GridChart.vue +194 -0
  35. package/src/hdcom/GridExField.vue +281 -0
  36. package/src/hdcom/GridShow.vue +238 -0
  37. package/src/hdcom/HdAside.vue +178 -0
  38. package/src/hdcom/HdBtn.vue +113 -0
  39. package/src/hdcom/HdButton.vue +137 -0
  40. package/src/hdcom/HdComFaceRec.vue +58 -0
  41. package/src/hdcom/HdComGrid.vue +776 -0
  42. package/src/hdcom/HdComQuery.vue +273 -0
  43. package/src/hdcom/HdComQueryDetail.vue +161 -0
  44. package/src/hdcom/HdComSortDetail.vue +155 -0
  45. package/src/hdcom/HdDatePicker.vue +78 -0
  46. package/src/hdcom/HdDialog.vue +63 -0
  47. package/src/hdcom/HdDrop.vue +163 -0
  48. package/src/hdcom/HdFileUpload.vue +148 -0
  49. package/src/hdcom/HdFilterBox.vue +90 -0
  50. package/src/hdcom/HdFooter.vue +149 -0
  51. package/src/hdcom/HdForm.vue +278 -0
  52. package/src/hdcom/HdFormBtn.vue +89 -0
  53. package/src/hdcom/HdFormItem.vue +35 -0
  54. package/src/hdcom/HdGctosGrid +0 -0
  55. package/src/hdcom/HdGrid.vue +825 -0
  56. package/src/hdcom/HdGridEditBtn.vue +44 -0
  57. package/src/hdcom/HdGridExt.js +219 -0
  58. package/src/hdcom/HdGridSel.vue +223 -0
  59. package/src/hdcom/HdHeader.vue +148 -0
  60. package/src/hdcom/HdHotKey.vue +81 -0
  61. package/src/hdcom/HdInputHint.vue +49 -0
  62. package/src/hdcom/HdMain.vue +43 -0
  63. package/src/hdcom/HdMessage.vue +192 -0
  64. package/src/hdcom/HdNum.vue +69 -0
  65. package/src/hdcom/HdPopSel.vue +58 -0
  66. package/src/hdcom/HdRightMenu.vue +61 -0
  67. package/src/hdcom/HdSel/SelGridFieldcod.vue +36 -0
  68. package/src/hdcom/HdTableColumn.vue +334 -0
  69. package/src/hdcom/HdTempSave.vue +140 -0
  70. package/src/hdcom/HdTree.vue +86 -0
  71. package/src/hdcom/HdTreeTable/eval.js +34 -0
  72. package/src/hdcom/HdTreeTable/index.vue +174 -0
  73. package/src/hdcom/ImportExcel.vue +143 -0
  74. package/src/hdcom/index.js +80 -0
  75. package/src/idev.common.js +72 -0
  76. package/src/index.js +14 -0
  77. package/src/utils/HdQuery.js +54 -0
  78. package/src/utils/comutils.js +98 -0
  79. package/src/utils/utils.js +105 -0
  80. package/src/vendor/Blob.js +179 -0
  81. package/src/vendor/Export2Excel.js +220 -0
  82. package/src/vendor/Export2Zip.js +22 -0
  83. package/src/views/layout/AppMain.vue +32 -0
  84. package/src/views/layout/HdLayout.vue +78 -0
  85. package/src/views/layout/header/ElasticSearch.vue +225 -0
  86. package/src/views/layout/header/HZRecorder.js +231 -0
  87. package/src/views/layout/header/HeaderSearch.vue +198 -0
  88. package/src/views/layout/header/Levelbar.vue +49 -0
  89. package/src/views/layout/header/MainHeader.vue +271 -0
  90. package/src/views/layout/header/Navbar.vue +105 -0
  91. package/src/views/layout/header/ScrollPane.vue +81 -0
  92. package/src/views/layout/header/TagsView.vue +210 -0
  93. package/src/views/layout/header/VocRec.vue +97 -0
  94. package/src/views/layout/header/changepswform.vue +96 -0
  95. package/src/views/layout/index.js +12 -0
  96. package/src/views/layout/menu/Hamburger.vue +45 -0
  97. package/src/views/layout/menu/HdMenu.vue +167 -0
  98. package/src/views/layout/menu/css/menu.css +288 -0
  99. package/src/views/layout/menu/index.vue +25 -0
  100. package/src/views/privilege/commsg/commsg.vue +78 -0
  101. package/src/views/privilege/commsg/commsgOrgn.vue +42 -0
  102. package/src/views/privilege/commsg/commsgRole.vue +149 -0
  103. package/src/views/privilege/commsg/commsgform.vue +160 -0
  104. package/src/views/privilege/commsg/commsgiframe.vue +33 -0
  105. package/src/views/privilege/commsg/commsgto.vue +120 -0
  106. package/src/views/privilege/commsg/commsgtoform.vue +108 -0
  107. package/src/views/privilege/commsg/commsgtrans.vue +155 -0
  108. package/src/views/privilege/exfield/comexcolumn.vue +71 -0
  109. package/src/views/privilege/exfield/comexcolumnform.vue +101 -0
  110. package/src/views/privilege/exfield/comexfield.vue +31 -0
  111. package/src/views/privilege/exfield/comexfieldform.vue +94 -0
  112. package/src/views/privilege/exfield/comexfieldsub.vue +72 -0
  113. package/src/views/privilege/index.js +42 -0
  114. package/src/views/privilege/menu/comMenu.vue +41 -0
  115. package/src/views/privilege/menu/menu.vue +133 -0
  116. package/src/views/privilege/menu/menuinfo.vue +56 -0
  117. package/src/views/privilege/menu/rolelist.vue +47 -0
  118. package/src/views/privilege/menu/userlist.vue +49 -0
  119. package/src/views/privilege/mobile/authmobileupdate.vue +69 -0
  120. package/src/views/privilege/mobile/authmobileupdateform.vue +90 -0
  121. package/src/views/privilege/orgDept/authOrgn.vue +96 -0
  122. package/src/views/privilege/orgDept/authorgnform.vue +145 -0
  123. package/src/views/privilege/orgDept/orgDept.vue +37 -0
  124. package/src/views/privilege/orgDept/orgTree.vue +88 -0
  125. package/src/views/privilege/orgDept/orgnselect.vue +134 -0
  126. package/src/views/privilege/personDept/authuser.vue +123 -0
  127. package/src/views/privilege/personDept/authuserform.vue +154 -0
  128. package/src/views/privilege/personDept/facerec.vue +117 -0
  129. package/src/views/privilege/personDept/orgncascader.vue +125 -0
  130. package/src/views/privilege/personDept/personDept.vue +31 -0
  131. package/src/views/privilege/quartz/comquartzjob.vue +65 -0
  132. package/src/views/privilege/quartz/comquartzjobform.vue +99 -0
  133. package/src/views/privilege/quartz/comquartzlog.vue +59 -0
  134. package/src/views/privilege/role/btnRole.vue +117 -0
  135. package/src/views/privilege/role/menuRole.vue +64 -0
  136. package/src/views/privilege/role/orgnRole.vue +56 -0
  137. package/src/views/privilege/role/role.vue +67 -0
  138. package/src/views/privilege/role/rolelist.vue +67 -0
  139. package/src/views/privilege/role/roleselect.vue +57 -0
  140. package/src/views/privilege/search/comsearch.vue +105 -0
  141. package/src/views/privilege/search/menu.vue +52 -0
  142. package/src/views/privilege/syscode/syscode.vue +103 -0
  143. package/src/views/privilege/syscode/sysfield.vue +66 -0
  144. package/src/views/privilege/syscode/sysfieldframe.vue +30 -0
  145. package/src/views/privilege/syslog/menulog.vue +52 -0
  146. package/src/views/privilege/syslog/syslog.vue +115 -0
  147. package/src/views/privilege/syslog/syslogconfig.vue +61 -0
  148. package/src/views/privilege/syslog/syslogform.vue +83 -0
  149. package/src/views/privilege/syslog/syslogframe.vue +26 -0
  150. package/src/views/privilege/userRole/userRole.vue +122 -0
  151. package/src/views/privilege.zip +0 -0
  152. package/vite.config.js +93 -0
  153. package/.babelrc +0 -17
  154. package/.editorconfig +0 -14
  155. package/.eslintignore +0 -3
  156. package/.npminstall.done +0 -1
  157. package/.postcssrc.js +0 -8
  158. package/LICENSE +0 -21
  159. package/Listening +0 -28
  160. package/build/build.js +0 -70
  161. package/build/check-versions.js +0 -45
  162. package/build/config.js +0 -81
  163. package/build/dev-client.js +0 -9
  164. package/build/dev-server.js +0 -93
  165. package/build/utils.js +0 -78
  166. package/build/vue-loader.conf.js +0 -12
  167. package/build/webpack.common.js +0 -37
  168. package/build/webpack.component.js +0 -36
  169. package/build/webpack.prod.conf.js +0 -38
  170. package/components.json +0 -8
  171. package/conf.js +0 -42
  172. package/config/dev.env.js +0 -6
  173. package/config/index.js +0 -43
  174. package/config/prod.env.js +0 -6
  175. package/config/sit.env.js +0 -6
  176. package/favicon.ico +0 -0
  177. package/jsdoc-vue.js +0 -12
  178. package/lib/0.index.js +0 -12573
  179. package/lib/1.index.js +0 -6
  180. package/lib/2.index.js +0 -2
  181. package/lib/idev.common.js +0 -1
  182. package/lib/idv8.common.js +0 -1
  183. package/lib/index.js +0 -49170
  184. package/lib/js/ErrHint.js +0 -1
  185. package/lib/js/HdAside.js +0 -1
  186. package/lib/js/HdBtn.js +0 -1
  187. package/lib/js/HdButton.js +0 -1
  188. package/lib/js/HdComFaceRec.js +0 -1
  189. package/lib/js/HdComGrid.js +0 -1
  190. package/lib/js/HdDatePicker.js +0 -1
  191. package/lib/js/HdDialog.js +0 -1
  192. package/lib/js/HdDrop.js +0 -1
  193. package/lib/js/HdFileUpload.js +0 -1
  194. package/lib/js/HdFooter.js +0 -1
  195. package/lib/js/HdForm.js +0 -1
  196. package/lib/js/HdFormBtn.js +0 -1
  197. package/lib/js/HdFormItem.js +0 -1
  198. package/lib/js/HdGrid.js +0 -1
  199. package/lib/js/HdGridEditBtn.js +0 -1
  200. package/lib/js/HdGridSel.js +0 -1
  201. package/lib/js/HdHeader.js +0 -1
  202. package/lib/js/HdHotkey.js +0 -1
  203. package/lib/js/HdLayout.js +0 -1
  204. package/lib/js/HdMain.js +0 -1
  205. package/lib/js/HdMessage.js +0 -1
  206. package/lib/js/HdNum.js +0 -1
  207. package/lib/js/HdPopSel.js +0 -1
  208. package/lib/js/HdSearch.js +0 -1
  209. package/lib/js/HdTableColumn.js +0 -1
  210. package/lib/js/HdTempSave.js +0 -1
  211. package/lib/js/HdTree.js +0 -1
  212. package/lib/js/HdTreeTable.js +0 -1
  213. package/lib/js/authmobileupdate.js +0 -1
  214. package/lib/js/comexfield.js +0 -1
  215. package/lib/js/commsg.js +0 -1
  216. package/lib/js/commsgto.js +0 -1
  217. package/lib/js/comquartzjob.js +0 -1
  218. package/lib/js/comquartzlog.js +0 -1
  219. package/lib/js/comsearch.js +0 -1
  220. package/lib/js/menu.js +0 -1
  221. package/lib/js/menuinfo.js +0 -1
  222. package/lib/js/orgDept.js +0 -1
  223. package/lib/js/orgTree.js +0 -1
  224. package/lib/js/personDept.js +0 -1
  225. package/lib/js/role.js +0 -1
  226. package/lib/js/sysfieldframe.js +0 -1
  227. package/lib/js/syslog.js +0 -1
  228. package/lib/js/syslogframe.js +0 -1
  229. package/lib/js/userRole.js +0 -1
  230. package/ytgvue.rar +0 -0
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div>
3
+ <hd-btn icon="el-icon-edit" hint="编辑" @click.stop="$vnode.context.$refs[gridRef].doEdit(row)"
4
+ v-if="!row.isEdit">
5
+ </hd-btn>
6
+ <hd-btn hint="撤销" @click.stop="$vnode.context.$refs[gridRef].doCancel(row)" v-if="row.isEdit">
7
+ <svg-icon icon-class="undo"/>
8
+ </hd-btn>
9
+ <hd-btn icon="el-icon-check" hint="保存" @click.stop="$vnode.context.$refs[gridRef].doSave(row)" v-if="row.isEdit">
10
+ </hd-btn>
11
+ <hd-btn icon="el-icon-delete" hint="删除" @click.stop="$vnode.context.$refs[gridRef].doRemove(row)"
12
+ v-if="!row.isEdit">
13
+ </hd-btn>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+
19
+ /**
20
+ * GridEditBtn 列表内的增删改按钮
21
+ * @module HdGridEditBtn
22
+ */
23
+ export default {
24
+ name: 'HdGridEditBtn',
25
+ inheritAttrs: false,
26
+ /**
27
+ * Props
28
+ * @prop {String} gridRef 默认为grid
29
+ * @prop {Object} row 行对象
30
+ */
31
+ props: {
32
+ gridRef: {
33
+ type: String,
34
+ default: 'grid'
35
+ },
36
+ row: Object
37
+ },
38
+ data() {
39
+ return {}
40
+ }
41
+ }
42
+
43
+ </script>
44
+
@@ -0,0 +1,219 @@
1
+ // 快捷键实现及导出excel和pdf
2
+ export default {
3
+ data() {
4
+ return {
5
+ rowSelNum: -1// 选中行
6
+ }
7
+ },
8
+ methods: {
9
+ addHotKey() {
10
+ document.body.addEventListener('keydown', this.handleKeydown)
11
+ },
12
+ removeHotKey() {
13
+ document.body.removeEventListener('keydown', this.handleKeydown)
14
+ },
15
+ handleKeydown(event) {
16
+ const keyCode = event.keyCode
17
+ const list = [38, 40, 37, 39]
18
+ if (list.indexOf(keyCode) !== -1) {
19
+ if (keyCode === 38) { // up
20
+ this.rowSelNum -= 1
21
+ }
22
+ if (keyCode === 40) {
23
+ this.rowSelNum += 1
24
+ }
25
+ if (keyCode === 37) { // left
26
+ this.hdQuery.doCurPageChange(this.hdQuery.page - 1 < 1 ? 1 : this.hdQuery.page - 1)
27
+ }
28
+ if (keyCode === 39) {
29
+ let totalPageSize = (this.hdResult.total - 1) / this.hdQuery.rows + 1;
30
+ this.hdQuery.doCurPageChange(this.hdQuery.page + 1 > totalPageSize ? totalPageSize : this.hdQuery.page + 1);
31
+ }
32
+ event.stopPropagation()
33
+ event.preventDefault()
34
+ }
35
+ if (keyCode === 13) { // Enter
36
+ if (this.hdQuery.selRow) {
37
+ this.$emit('enterClick', this.hdQuery.selRow)
38
+ this.hdQuery.selRow = null
39
+ } else if (this.hdResultComRows.length > 0) {
40
+ this.hdQuery.selRow = this.hdResultComRows[0] // 这里必须这样赋值
41
+ this.$emit('enterClick', this.hdResultComRows[0])
42
+ this.hdQuery.selRow = null
43
+ }
44
+ }
45
+ if (event.altKey && keyCode === 13) { // alt+Enter
46
+ this.$emit('altEnterClick', this.hdQuery.selRow)
47
+ }
48
+ },
49
+ setCurrentRow(i, isDown) {
50
+ this.rowSelNum = i
51
+ this.$refs.ingrid.setCurrentRow(this.hdResultComRows[i])
52
+ if (this.hdQuery) {
53
+ this.hdQuery.selRow = this.hdResultComRows[this.rowSelNum]
54
+ }
55
+ const trSel = this.$refs.ingrid.$el.querySelectorAll('.el-table__body tr')[i]
56
+ if (!trSel) {
57
+ return true
58
+ }
59
+
60
+ const scrollParent = this.$refs.ingrid.$el.querySelector('.el-table__body-wrapper')
61
+ const conHeigh = scrollParent.getBoundingClientRect().height
62
+ // const cellNumPage = conHeigh / cellHeigh //当前页面有多少行
63
+
64
+ const top = trSel.offsetTop
65
+ const bottom = trSel.offsetTop + trSel.offsetHeight
66
+ const viewRectTop = scrollParent.scrollTop
67
+ const viewRectBottom = viewRectTop + scrollParent.clientHeight + trSel.clientHeight / 3// trSel.clientHeight/3确保滚出屏幕后才触发
68
+ if (top < viewRectTop) {
69
+ scrollParent.scrollTop = top
70
+ } else if (bottom > viewRectBottom) { // 向下移动触发
71
+ scrollParent.scrollTop = scrollParent.scrollTop + trSel.clientHeight
72
+ }
73
+ },
74
+ findLeafCol(col, leafCol, header, filterVal, par) {//获得叶子节点,并且返回叶子节点父类
75
+ if (!col.children) {
76
+ leafCol.push(col)
77
+ if (par) {
78
+ header.push(par.label + "-" + col.label)
79
+ } else {
80
+ header.push(col.label)
81
+ }
82
+ filterVal.push(col.property)
83
+ } else {
84
+ for (let i = 0; i < col.children.length; i++) {
85
+ this.findLeafCol(col.children[i], leafCol, header, filterVal, col)
86
+ }
87
+ }
88
+ },
89
+ comExport(exportdata) {
90
+ const header = []
91
+ const filterVal = []
92
+ // const filterFt = [] // 与filterVal1对1,导出的excel值进行转换
93
+ const disColWithProp = [] //统计表头时判断
94
+ for (let i = 0; i < this.disCol.length; i++) {
95
+ const oneCol = this.disCol[i]
96
+ if (!oneCol || (!oneCol.property && !oneCol.children) || !oneCol.showFlg || oneCol.showFlg == '0') {
97
+ continue
98
+ }
99
+ this.findLeafCol(oneCol, disColWithProp, header, filterVal)//将所有的叶子节点
100
+ }
101
+ const data = this.formatJson(filterVal, exportdata, header)
102
+ const merdata = [header].concat(data)// 中文+数据
103
+ this.summaryAdd(merdata, filterVal.length)
104
+ const title = this.$route.meta.title + new Date().format('yyyy-MM-dd HH:mm:ss')
105
+ return { header, filterVal, merdata, title }
106
+ },
107
+ excelExport(exportdata) {
108
+ let excelData = this.comExport(exportdata);
109
+ let exportData = {};
110
+ if (this.excelFormatter) {
111
+ exportData = this.excelFormatter(excelData);
112
+ } else {
113
+ let merdata = excelData.merdata;
114
+ if (this.excelPropHeader) {
115
+ merdata = this.formatJson(excelData.filterVal, merdata);
116
+ }
117
+ exportData = {
118
+ header: merdata[0],
119
+ data: merdata.slice(1),
120
+ filename: excelData.title
121
+ }
122
+ }
123
+ const excel = require('../vendor/Export2Excel')
124
+ excel.export_json_to_excel(exportData)// excelPropHeader:是否导出prop头
125
+ },
126
+ pdfExport(exportdata) {
127
+ let { header, filterVal, merdata, title } = this.comExport(exportdata)
128
+ this.$refs.pdfshow.genPdf(header, merdata, title)
129
+ },
130
+ summaryAdd(merdata, size) {//如果导出有合计项
131
+ if (this.$attrs.showSummary == undefined && this.$attrs['show-summary'] == undefined) {
132
+ return
133
+ }
134
+ const disColWithProp = [] //获取表头
135
+ for (let i = 0; i < this.disCol.length; i++) {
136
+ const oneCol = this.disCol[i]
137
+ if (!oneCol || !oneCol.property || !oneCol.showFlg) {
138
+ continue
139
+ }
140
+ disColWithProp.push(oneCol)
141
+ }
142
+ let sum = new Array(size)
143
+ let sumMethod = this.$attrs.summaryMethod || this.$attrs['summary-method']
144
+ let sumVal = sumMethod({ columns: disColWithProp })
145
+ for (let i = 0; i < sum.length; i++) {
146
+ if (sumVal[i]) {
147
+ sum[i] = sumVal[i]
148
+ } else {
149
+ sum[i] = ''
150
+ }
151
+ }
152
+ merdata.push(sum)
153
+ },
154
+
155
+ formatJson(filterVal, jsonData, header) {
156
+ if (!jsonData || jsonData.length == 0) {
157
+ return []
158
+ }
159
+ if (this.excelPropHeader) { // 导出所有头
160
+ for (const data in jsonData[0]) {
161
+ let isHas = false
162
+ for (const val in filterVal) {
163
+ if (filterVal[val] == data) {
164
+ isHas = true
165
+ break
166
+ }
167
+ }
168
+ if (!isHas) { // 所有json属性在filterval都要有
169
+ filterVal.push(data)
170
+ }
171
+ }
172
+ }
173
+ let noExLs = ['_obj', 'idevVersionUse', '_map']
174
+ if (this.noExcelExport) {
175
+ noExLs = noExLs.concat(this.noExcelExport)
176
+ }
177
+ for (let j = 0; j < noExLs.length; j++) { // 不需要导出的属性,header也需要删除
178
+ const index = filterVal.removeone(noExLs[j])
179
+ if (index != -1) {
180
+ header.splice(index, 1)
181
+ }
182
+ }
183
+ return jsonData.map(v => filterVal.map(j => {
184
+ try {
185
+ const inFt = this.getInputFormat(j) //支持多级prop如果有inutFormat会使用inputFormt
186
+ if (inFt) {
187
+ return inFt(v, j)
188
+ } else {
189
+ return v[j] + ''// 数字变为字符串
190
+ }
191
+ } catch (err) {//不存在时,直接返回空
192
+ console.info(err)
193
+ return null
194
+ }
195
+ }
196
+ ))
197
+ },
198
+ },
199
+ watch: {
200
+
201
+ rowSelNum: function (val, oldVal) {
202
+ if (val < 0) {
203
+ if (this.hdResult.rows.length == 0) { // 没有数据时不选中
204
+ this.rowSelNum = -1
205
+ return false
206
+ } else {
207
+ this.rowSelNum = 0
208
+ }
209
+ }
210
+ if (val > this.hdResult.rows.length - 1) {
211
+ this.rowSelNum = this.hdResult.rows.length - 1
212
+ }
213
+ if (this.hdQuery) {
214
+ this.hdQuery.selRow = this.hdResult.rows[this.rowSelNum]
215
+ }
216
+ this.setCurrentRow(this.rowSelNum, val - oldVal > 0) // >0是下移动,<0是上移
217
+ }
218
+ }
219
+ }
@@ -0,0 +1,223 @@
1
+ <template>
2
+ <div>
3
+ <el-popover :disabled="disabled" placement="bottom-start" popperClass="hd-grid-sel" ref="popSel"
4
+ v-model="visible">
5
+ <div :style="{height: height,width:width}">
6
+ <hd-com-grid :findUrl='url' :hdQuery="hdQuery" @enterClick="rowClick(hdQuery.selRow)" @row-click="rowClick"
7
+ ckHide
8
+ indexHide noSets notInit recHide ref="grid" v-bind="$attrs"
9
+ v-on="$listeners" :hd-btn-tool=false is-not-db-edit>
10
+ <slot name="query" slot="query"></slot>
11
+ <slot></slot>
12
+ </hd-com-grid>
13
+ </div>
14
+ </el-popover>
15
+ <div>
16
+ <!--readonly 在选择区隐藏时,不能输入-->
17
+ <el-input :clearable="false" :disabled="disabled"
18
+ :placeholder="placeholder?$t(placeholder):$t('请选择')" :readonly="!visible"
19
+ @blur="blur" @focus="focus" @mouseenter.native="doMouseEnter"
20
+ @mouseleave.native="doMouseLeave" ref="sel" v-model="searchVal" v-popover:popSel>
21
+ <i @click.stop="doClear" class="el-input__icon el-icon-circle-close" slot="suffix" style="cursor:pointer "
22
+ v-if="!threePointShow"></i>
23
+ <i @click="$emit('pop')" class="el-input__icon el-icon-more" slot="suffix" style="cursor:pointer"
24
+ v-if="threePointShow"></i>
25
+ </el-input>
26
+ </div>
27
+ </div>
28
+ </template>
29
+ <!--<style rel="stylesheet/scss" lang="scss">-->
30
+ <!--.hd-grid-sel {-->
31
+ <!--z-index: 4000 !important;-->
32
+ <!--}-->
33
+
34
+ <!--</style>-->
35
+ <script>
36
+ /**
37
+ * 自定义列表下拉
38
+ * @module HdGridSel
39
+ */
40
+ export default {
41
+ name: 'HdGridSel',
42
+ data() {
43
+ return {
44
+ openHandler: null,//快速切换焦点,避免出现很多下拉类别
45
+ threePointShow: true,
46
+ searchVal: this.txtVal,
47
+ // isFocus: false,
48
+ visible: false,
49
+ isFirst: true, // 是否第一次打开
50
+ searchHandler: Object,
51
+ isSoftFocus: false // 点击弹窗内容时,input重新获得焦点,但是不能触发focus
52
+ // focusTime: 0
53
+ }
54
+ },
55
+ inheritAttrs: false,
56
+ /**
57
+ * Props 继承hd-com-grid的属性和事件
58
+ * @prop {String} txtVal 双向绑定 这里是为了clear清空用
59
+ * @prop {String} idVal 双向绑定 这里是为了clear清空用
60
+ * @prop {String} placeholder
61
+ * @prop {Boolean} disabled 只读
62
+ * @prop {Object} hdQuery 查询封装类
63
+ * @prop {String} height 默认为40vh
64
+ * @prop {String} width 弹出选择框的宽度,非输入框的!!!
65
+ * @prop {Function} beforeQuery 查询前的事件,通常需要绑定anyQuery
66
+ * @prop {String} url 查询的url,hdGrid中的findUrl
67
+ */
68
+ props: {
69
+ txtVal: String,
70
+ idVal: String,
71
+ placeholder: String,
72
+ disabled: Boolean,
73
+ hdQuery: Object,
74
+ url: String, // 全路径
75
+ height: {// 弹出选择框的高度,非输入框的!!!
76
+ type: String,
77
+ default: '40vh'
78
+ },
79
+ width: {// 弹出选择框的宽度,非输入框的!!!
80
+ type: String,
81
+ default: '100%'
82
+ },
83
+ beforeQuery: Function
84
+ }, // 设置value为props属性-必须
85
+ mounted() {
86
+ this.$nextTick(() => {
87
+ if (this.$refs.popSel)
88
+ this.$refs.popSel.referenceElm.setAttribute('tabindex', -1); // 不可通过tab切换到popsel,因为有input存在
89
+ })
90
+ },
91
+ methods: {
92
+ focus() {
93
+ // this.focusTime = new Date().getTime()
94
+ this.$emit('focus')
95
+ if (this.isSoftFocus) { // click时
96
+ this.isSoftFocus = false // 点击时,防止焦点触发
97
+ return false
98
+ }
99
+ this.openHandler = setTimeout(() => { // 否则会和默认的冲突
100
+ this.visible = true
101
+ this.openHandler = null
102
+ }, 150)
103
+ // this.isFocus = true
104
+ },
105
+ blur() {
106
+ if (this.openHandler) {
107
+ clearTimeout(this.openHandler)
108
+ this.openHandler = null
109
+ }
110
+ },
111
+ // visibleChg() {
112
+ // setTimeout(() => {
113
+ // let nowClickTime = new Date().getTime()
114
+ // if (nowClickTime - focusTime > 500)//只有焦点时才可点击
115
+ // this.visible = !this.visible
116
+ // }, 150)
117
+ // },
118
+ // blur() {
119
+ // // setTimeout(() => {
120
+ // // console.info('blur' + this.isSoftFocus)
121
+ // // if (this.isSoftFocus) {
122
+ // // this.isSoftFocus = false;
123
+ // // } else {
124
+ // // this.$emit('blur', event);
125
+ // // this.isFocus = false
126
+ // // this.searchVal = this.txtVal //焦点切换,还原
127
+ // // this.visible = false
128
+ // // }
129
+ // // }, 150);
130
+ // },
131
+ doClear() {
132
+ this.$parent.$emit('update:txtVal', '')
133
+ this.$parent.$emit('update:idVal', '')
134
+ this.$emit('clear')
135
+ this.$nextTick(() => {
136
+ this.$refs.sel.focus(); // 确保input已渲染后再设置焦点
137
+ });
138
+ },
139
+ doMouseEnter() {
140
+ if (this.disabled) {
141
+ return false
142
+ }
143
+ if (this.idVal) {
144
+ this.threePointShow = false
145
+ }
146
+ },
147
+ doMouseLeave() {
148
+ this.threePointShow = true
149
+ },
150
+ /**
151
+ * @function 触发rowClick(row)事件
152
+ * */
153
+ rowClick(row) {
154
+ this.$emit('rowClick', row)
155
+ this.isSoftFocus = true
156
+ this.$refs.sel.focus()
157
+ this.visible = false
158
+ },
159
+ visbileKeyAdd() {
160
+ document.onkeydown = (e) => {
161
+ var key = window.event.keyCode
162
+ if (key == 9 || key == 27) { // 9 tab 27 esc
163
+ this.visible = false
164
+ }
165
+ }
166
+ },
167
+ visbileKeyRemove() {
168
+ document.onkeydown = function (e) {
169
+ }
170
+ }
171
+ },
172
+ watch: {
173
+ searchVal: function (newVal) {
174
+ if (!this.visible) {
175
+ return false
176
+ }
177
+ if (this.searchTimeHandler) {
178
+ clearTimeout(this.searchTimeHandler)
179
+ }
180
+ this.searchTimeHandler = setTimeout(() => { // 延迟300ms查询
181
+ this.searchTimeHandler = null
182
+ if (this.beforeQuery) {
183
+ this.beforeQuery(newVal)
184
+ }
185
+ // for(var key in this.hdQuery.query) {
186
+ // this.hdQuery.query[key]=this.hdQuery.query[key].toUpperCase();
187
+ // }
188
+ this.$refs.grid.doQuery().then(() => { // 默认选中第一行
189
+ this.$refs.grid.$refs.hdgrid.setCurrentRow(0)
190
+ })
191
+ }, 600)
192
+ // this.visible = true
193
+ },
194
+ txtVal: function (newVal) {
195
+ this.searchVal = this.txtVal
196
+ },
197
+
198
+ visible: function (newVal) {
199
+ if (newVal) {
200
+ //虚拟滚动时,防止页面空白
201
+ this.$refs.grid.$refs.hdgrid.scroller = 0
202
+ this.$refs.grid.addHotKey()
203
+ this.visbileKeyAdd()
204
+ } else {
205
+ this.$refs.grid.removeHotKey()
206
+ this.visbileKeyRemove()
207
+ this.searchVal = this.txtVal
208
+ }
209
+ if (newVal) {
210
+ if (this.beforeQuery) {
211
+ this.beforeQuery()
212
+ }
213
+ // for(var key in this.hdQuery.query) {
214
+ // this.hdQuery.query[key]=this.hdQuery.query[key].toUpperCase();
215
+ // }
216
+ this.$refs.grid.doQuery(null).then(() => {
217
+ this.$refs.grid.$refs.hdgrid.setCurrentRow(0)
218
+ })
219
+ }
220
+ }
221
+ }
222
+ }
223
+ </script>
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <ExHeader :height="nowHeight" ref="header" style="display: flex;flex-direction: column;">
3
+ <div class="hdHeader">
4
+ <template v-if="title">
5
+ <div class="hd-title">
6
+ <div align="left" style="float:left">{{$t(title)}}</div>
7
+ <slot name="title"></slot>
8
+ <div align="right" v-if="arrowShow">
9
+ <i @click="isShrink?doShrink(false):doShrink(true)" style="cursor:pointer;" v-bind:class="[fa, arrowClass]">
10
+ </i>
11
+ </div>
12
+ </div>
13
+ </template>
14
+ <!--title有20的高度-->
15
+ <div style="flex:1;height: 100%;position: relative;" v-show="!isShrink">
16
+ <div style="position: absolute; width: 100%;height: 100%;">
17
+ <slot></slot>
18
+ </div>
19
+ </div>
20
+ <div :class="{dragShowCls:dragShow}" @mousedown="mousedown($event)" @mouseout="dragShow=false" @mouseover="dragShow=true"
21
+ class="asideDrag" v-if="!noDrag"></div>
22
+ <div class="moveline" ref="moveline" v-show="dragFrom!=null"></div>
23
+ </div>
24
+ </ExHeader>
25
+ </template>
26
+
27
+ <script>
28
+
29
+ /**
30
+ * 覆写ElHeader,增加拖动和title
31
+ * 插槽:<slot name="title"></slot> title进行额外扩展如增加按钮等
32
+ * @module HdHeader
33
+ */
34
+ export default {
35
+ name: 'HdHeader',
36
+ component: {},
37
+ /**
38
+ * Props 继承ElHeader属性和事件,如果仅需要elementui的ElHeader请使用ExHeader
39
+ * @prop {String} title 标题
40
+ * @prop {Boolen} arrowShow 是否显示一键收缩
41
+ * @prop {Boolen} noDrag 是否可拖动,默认否
42
+ */
43
+ props: {
44
+ height: String,
45
+ title: String,
46
+ arrowShow: {type: Boolean, default: true},
47
+ noDrag: {type: Boolean, default: false}
48
+ },
49
+ inheritAttrs: false,
50
+ data() {
51
+ return {
52
+ inputHeight: 0, //未拖拽时的高度
53
+ iconCls: 'el-icon-d-caret',
54
+ arrowClass: 'fa-chevron-up',
55
+ fa: 'fa',
56
+ isShrink: false,
57
+ dragFrom: null,
58
+ nowHeight: '100px',
59
+ dragShow: false
60
+ }
61
+ },
62
+ mounted() {
63
+ if (this.height) {
64
+ this.nowHeight = this.height
65
+ }
66
+ this.inputHeight = this.nowHeight
67
+ },
68
+ methods: {
69
+ doShrink(isShrink) {
70
+ if (isShrink) {
71
+ if (this.title) {
72
+ this.nowHeight = "30px"
73
+ } else {
74
+ this.nowHeight = "15px"
75
+ }
76
+ this.arrowClass = 'fa-chevron-down'
77
+ } else {
78
+ this.nowHeight = this.inputHeight
79
+ this.arrowClass = 'fa-chevron-up'
80
+ }
81
+ this.isShrink = isShrink
82
+ },
83
+ mousedown: function (event) {
84
+ this.$set(this.$store.state, 'hotKey', "-1") //避免热键样式影响体验
85
+ this.dragFrom = event.y
86
+ this.$refs.moveline.style.top = this.dragFrom + "px"
87
+ document.documentElement.addEventListener('mousemove', this.handleMove, true)
88
+ document.documentElement.addEventListener('mouseup', this.handleMouseup, true)
89
+ },
90
+ handleMove: function (event) {
91
+ this.$refs.moveline.style.top = event.y + "px"
92
+ },
93
+ handleMouseup: function (event) {
94
+ document.documentElement.removeEventListener('mousemove', this.handleMove, true)
95
+ document.documentElement.removeEventListener('mouseup', this.handleMouseup, true)
96
+ let newHeight = this.$refs.header.$el.offsetHeight + event.y - this.dragFrom
97
+ this.nowHeight = newHeight + 'px';
98
+ this.dragFrom = null
99
+ this.$set(this.$store.state, 'hotKey', null) //避免热键样式影响体验
100
+ if (newHeight <= 70) { // 少于一定宽度自动收缩
101
+ this.doShrink(true)
102
+ }
103
+ if (newHeight >= 100) { // 少于一定宽度自动收缩
104
+ this.isShrink = false
105
+ }
106
+ }
107
+ },
108
+ watch: {
109
+ nowHeight(val) {
110
+ this.$emit('update:height', val);
111
+ },
112
+ width(val) {
113
+ this.nowHeight = val
114
+ }
115
+ }
116
+ }
117
+
118
+ </script>
119
+ <style rel="stylesheet/scss" lang="scss">
120
+ .hdHeader {
121
+ display: flex;
122
+ flex-direction: column;
123
+ flex: 1;
124
+ }
125
+
126
+ .asideDrag {
127
+ width: 100%;
128
+ height: 5px;
129
+ overflow: hidden;
130
+ cursor: ns-resize;
131
+ user-select: none;
132
+ }
133
+
134
+ .moveline {
135
+ width: 100%;
136
+ height: 5px;
137
+ overflow: hidden;
138
+ position: fixed;
139
+ cursor: ns-resize;
140
+ background-color: red;
141
+ z-index: 9999;
142
+ user-select: none;
143
+ }
144
+
145
+ .dragShowCls {
146
+ background-color: #409EFF;
147
+ }
148
+ </style>