hd-idevvue3 3.0.2 → 3.0.4

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 (147) hide show
  1. package/dist/assets/index.9c127719.css +1 -0
  2. package/dist/hd-idevvue3.mjs +3521 -3305
  3. package/dist/hd-idevvue3.umd.js +29 -29
  4. package/npminstall-debug.log +2 -10
  5. package/package.json +4 -2
  6. package/pnpm-lock.yaml +37 -4
  7. package/src/App.vue +11 -15
  8. package/src/assets/sound/notify.wav +0 -0
  9. package/src/demo/demo.vue +9 -10
  10. package/src/demo/dropdemo.vue +42 -43
  11. package/src/demo/extsets.vue +140 -39
  12. package/src/demo/formedit.vue +157 -145
  13. package/src/demo/hightquery.vue +263 -66
  14. package/src/demo/inlineedit.vue +129 -35
  15. package/src/demo/selfdrop.vue +32 -15
  16. package/src/directive/el-dragDialog/drag.js +13 -13
  17. package/src/directive/el-dragDialog/index.js +13 -13
  18. package/src/errorLog.js +3 -3
  19. package/src/hdcom/BigGrid.js +54 -48
  20. package/src/hdcom/BillShow.vue +84 -63
  21. package/src/hdcom/BillUpload.vue +144 -86
  22. package/src/hdcom/BtnRight.vue +26 -23
  23. package/src/hdcom/ErrHint.vue +36 -24
  24. package/src/hdcom/ExtendColumn.vue +97 -90
  25. package/src/hdcom/ExtendCommon.js +24 -13
  26. package/src/hdcom/ExtendForm.vue +107 -80
  27. package/src/hdcom/FacePicUpload.vue +59 -50
  28. package/src/hdcom/FaceRecTest.vue +87 -77
  29. package/src/hdcom/GridChart.vue +175 -162
  30. package/src/hdcom/GridExField.vue +328 -234
  31. package/src/hdcom/GridShow.vue +89 -39
  32. package/src/hdcom/HdAside.vue +192 -145
  33. package/src/hdcom/HdBtn.vue +44 -32
  34. package/src/hdcom/HdButton.vue +141 -117
  35. package/src/hdcom/HdComFaceRec.vue +80 -32
  36. package/src/hdcom/HdComGrid.vue +329 -229
  37. package/src/hdcom/HdComQuery.vue +179 -90
  38. package/src/hdcom/HdComQueryDetail.vue +159 -115
  39. package/src/hdcom/HdComSortDetail.vue +136 -130
  40. package/src/hdcom/HdDatePicker.vue +32 -16
  41. package/src/hdcom/HdDialog.vue +62 -44
  42. package/src/hdcom/HdDrop.vue +163 -138
  43. package/src/hdcom/HdFileUpload.vue +138 -119
  44. package/src/hdcom/HdFilterBox.vue +62 -62
  45. package/src/hdcom/HdFooter.vue +152 -119
  46. package/src/hdcom/HdForm.vue +276 -203
  47. package/src/hdcom/HdFormBtn.vue +81 -39
  48. package/src/hdcom/HdFormItem.vue +14 -10
  49. package/src/hdcom/HdGrid.vue +353 -156
  50. package/src/hdcom/HdGridEditBtn.vue +34 -20
  51. package/src/hdcom/HdGridExt.js +78 -47
  52. package/src/hdcom/HdGridSel.vue +227 -193
  53. package/src/hdcom/HdHeader.vue +149 -117
  54. package/src/hdcom/HdHotKey.vue +70 -67
  55. package/src/hdcom/HdInputHint.vue +40 -36
  56. package/src/hdcom/HdMain.vue +25 -27
  57. package/src/hdcom/HdMessage.vue +180 -171
  58. package/src/hdcom/HdNum.vue +67 -57
  59. package/src/hdcom/HdPopSel.vue +46 -24
  60. package/src/hdcom/HdRightMenu.vue +63 -61
  61. package/src/hdcom/HdSel/SelGridFieldcod.vue +46 -28
  62. package/src/hdcom/HdTableColumn.vue +156 -109
  63. package/src/hdcom/HdTempSave.vue +138 -116
  64. package/src/hdcom/HdTree.vue +89 -72
  65. package/src/hdcom/HdTreeTable/eval.js +8 -3
  66. package/src/hdcom/HdTreeTable/index.vue +229 -174
  67. package/src/hdcom/ImportExcel.vue +69 -34
  68. package/src/hdcom/index.js +39 -44
  69. package/src/idev.common.js +54 -47
  70. package/src/index.js +3 -6
  71. package/src/utils/HdQuery.js +25 -14
  72. package/src/utils/comutils.js +50 -28
  73. package/src/utils/gogocodeTransfer.js +59 -0
  74. package/src/utils/utils.js +30 -19
  75. package/src/vendor/Blob.js +187 -179
  76. package/src/vendor/Export2Excel.js +231 -220
  77. package/src/vendor/Export2Zip.js +25 -22
  78. package/src/views/layout/AppMain.vue +34 -32
  79. package/src/views/layout/HdLayout.vue +64 -52
  80. package/src/views/layout/header/ElasticSearch.vue +196 -159
  81. package/src/views/layout/header/HZRecorder.js +163 -135
  82. package/src/views/layout/header/HeaderSearch.vue +165 -145
  83. package/src/views/layout/header/Levelbar.vue +55 -49
  84. package/src/views/layout/header/MainHeader.vue +233 -189
  85. package/src/views/layout/header/Navbar.vue +74 -78
  86. package/src/views/layout/header/ScrollPane.vue +103 -81
  87. package/src/views/layout/header/TagsView.vue +169 -164
  88. package/src/views/layout/header/VocRec.vue +86 -78
  89. package/src/views/layout/header/changepswform.vue +98 -64
  90. package/src/views/layout/index.js +5 -7
  91. package/src/views/layout/menu/Hamburger.vue +63 -45
  92. package/src/views/layout/menu/HdMenu.vue +155 -118
  93. package/src/views/layout/menu/index.vue +21 -19
  94. package/src/views/privilege/commsg/commsg.vue +115 -41
  95. package/src/views/privilege/commsg/commsgOrgn.vue +40 -31
  96. package/src/views/privilege/commsg/commsgRole.vue +180 -109
  97. package/src/views/privilege/commsg/commsgform.vue +125 -101
  98. package/src/views/privilege/commsg/commsgiframe.vue +30 -23
  99. package/src/views/privilege/commsg/commsgto.vue +163 -84
  100. package/src/views/privilege/commsg/commsgtoform.vue +64 -58
  101. package/src/views/privilege/commsg/commsgtrans.vue +187 -115
  102. package/src/views/privilege/exfield/comexcolumn.vue +133 -43
  103. package/src/views/privilege/exfield/comexcolumnform.vue +85 -58
  104. package/src/views/privilege/exfield/comexfield.vue +15 -17
  105. package/src/views/privilege/exfield/comexfieldform.vue +71 -53
  106. package/src/views/privilege/exfield/comexfieldsub.vue +137 -46
  107. package/src/views/privilege/index.js +19 -20
  108. package/src/views/privilege/menu/comMenu.vue +49 -41
  109. package/src/views/privilege/menu/menu.vue +166 -49
  110. package/src/views/privilege/menu/menuinfo.vue +41 -34
  111. package/src/views/privilege/menu/rolelist.vue +78 -33
  112. package/src/views/privilege/menu/userlist.vue +76 -33
  113. package/src/views/privilege/mobile/authmobileupdate.vue +119 -43
  114. package/src/views/privilege/mobile/authmobileupdateform.vue +76 -46
  115. package/src/views/privilege/orgDept/authOrgn.vue +157 -65
  116. package/src/views/privilege/orgDept/authorgnform.vue +50 -38
  117. package/src/views/privilege/orgDept/orgDept.vue +38 -37
  118. package/src/views/privilege/orgDept/orgTree.vue +99 -88
  119. package/src/views/privilege/orgDept/orgnselect.vue +132 -111
  120. package/src/views/privilege/personDept/authuser.vue +197 -91
  121. package/src/views/privilege/personDept/authuserform.vue +123 -71
  122. package/src/views/privilege/personDept/facerec.vue +128 -83
  123. package/src/views/privilege/personDept/orgncascader.vue +134 -115
  124. package/src/views/privilege/personDept/personDept.vue +9 -7
  125. package/src/views/privilege/quartz/comquartzjob.vue +123 -38
  126. package/src/views/privilege/quartz/comquartzjobform.vue +67 -51
  127. package/src/views/privilege/quartz/comquartzlog.vue +116 -32
  128. package/src/views/privilege/role/btnRole.vue +123 -67
  129. package/src/views/privilege/role/menuRole.vue +65 -45
  130. package/src/views/privilege/role/orgnRole.vue +63 -41
  131. package/src/views/privilege/role/role.vue +26 -9
  132. package/src/views/privilege/role/rolelist.vue +114 -45
  133. package/src/views/privilege/role/roleselect.vue +34 -17
  134. package/src/views/privilege/search/comsearch.vue +164 -73
  135. package/src/views/privilege/search/menu.vue +38 -22
  136. package/src/views/privilege/syscode/syscode.vue +157 -69
  137. package/src/views/privilege/syscode/sysfield.vue +96 -43
  138. package/src/views/privilege/syscode/sysfieldframe.vue +30 -30
  139. package/src/views/privilege/syslog/menulog.vue +38 -22
  140. package/src/views/privilege/syslog/syslog.vue +145 -78
  141. package/src/views/privilege/syslog/syslogconfig.vue +91 -24
  142. package/src/views/privilege/syslog/syslogform.vue +45 -43
  143. package/src/views/privilege/syslog/syslogframe.vue +26 -26
  144. package/src/views/privilege/userRole/userRole.vue +187 -89
  145. package/vite.config.js +7 -0
  146. package/dist/assets/index.774ef40e.css +0 -1
  147. package/src/views/privilege.zip +0 -0
@@ -1,43 +1,70 @@
1
1
  <template>
2
- <el-dialog title="展示设置" :visible.sync="visible" width='50%' append-to-body top="2vh">
2
+ <el-dialog
3
+ title="展示设置"
4
+ :visible.sync="visible"
5
+ width="50%"
6
+ append-to-body
7
+ top="2vh"
8
+ >
3
9
  <el-container style="height: 80vh; border: 1px solid #eee">
4
10
  <el-main class="gridShow">
5
11
  <el-table :data="list" row-key="property">
6
- <el-table-column align="center" label="名称" prop="label" width="150" noQuery>
12
+ <el-table-column
13
+ align="center"
14
+ label="名称"
15
+ prop="label"
16
+ width="150"
17
+ noQuery
18
+ >
7
19
  </el-table-column>
8
- <el-table-column align="center" label="宽度(px)" prop="width" width="150" noQuery>
20
+ <el-table-column
21
+ align="center"
22
+ label="宽度(px)"
23
+ prop="width"
24
+ width="150"
25
+ noQuery
26
+ >
9
27
  <template slot-scope="scope">
10
28
  <hd-num v-model.number="scope.row.width" :step="10"></hd-num>
11
29
  </template>
12
30
  </el-table-column>
13
31
  <el-table-column align="center" label="展示" prop="showFlg" noQuery>
14
32
  <template slot-scope="scope">
15
- <el-switch v-model="scope.row.showFlg" active-value="1" inactive-value="0"></el-switch>
33
+ <el-switch
34
+ v-model="scope.row.showFlg"
35
+ active-value="1"
36
+ inactive-value="0"
37
+ ></el-switch>
16
38
  </template>
17
39
  </el-table-column>
18
40
  <el-table-column align="center" label="冻结" prop="freezeFlg" noQuery>
19
41
  <template slot-scope="scope">
20
- <el-switch v-model="scope.row.freezeFlg" active-value="1" inactive-value="0"></el-switch>
42
+ <el-switch
43
+ v-model="scope.row.freezeFlg"
44
+ active-value="1"
45
+ inactive-value="0"
46
+ ></el-switch>
21
47
  </template>
22
48
  </el-table-column>
23
49
  <el-table-column align="center" label="排序" width="80" noQuery>
24
50
  <template slot-scope="scope">
25
- <svg-icon class='drag-handler' icon-class="drag"></svg-icon>
51
+ <svg-icon class="drag-handler" icon-class="drag"></svg-icon>
26
52
  </template>
27
53
  </el-table-column>
28
54
  </el-table>
29
-
30
55
  </el-main>
31
56
  </el-container>
32
57
  <div slot="footer" class="dialog-footer">
33
58
  <el-button @click="reset">{{ $t('重置') }}</el-button>
34
59
  <el-button @click="visible = false">{{ $t('取 消') }}</el-button>
35
- <el-button type="primary" @click="submit" :loading="loading"> {{ $t('确 定') }}</el-button>
60
+ <el-button type="primary" @click="submit" :loading="loading">
61
+ {{ $t('确 定') }}</el-button
62
+ >
36
63
  </div>
37
64
  </el-dialog>
38
65
  </template>
39
- <script>
40
66
 
67
+ <script>
41
68
  import Sortable from 'sortablejs'
42
69
 
43
70
  export default {
@@ -53,9 +80,8 @@ export default {
53
80
  loading: false,
54
81
  menuId: '',
55
82
  gridId: '',
56
- specCkForGrid: true // HdTableColumn判断是否来自HdGrid用
83
+ specCkForGrid: true, // HdTableColumn判断是否来自HdGrid用
57
84
  // shipId: ""
58
-
59
85
  }
60
86
  },
61
87
  mounted() {
@@ -66,42 +92,50 @@ export default {
66
92
  this.menuId = menuId
67
93
  this.gridId = gridId
68
94
  this.visible = true
69
- this.list = JSON.parse(JSON.stringify(disCol.filter(item => item.property)))// 判断有property的展示,使用复制采用新对象(否则chrome有问题)
95
+ this.list = JSON.parse(
96
+ JSON.stringify(disCol.filter((item) => item.property))
97
+ ) // 判断有property的展示,使用复制采用新对象(否则chrome有问题)
70
98
  // console.log('list',this.list)
71
99
  //过滤掉子序列
72
- this.list.forEach(v => v.children = []);
73
- this.oldList = this.list.map(v => v.property)
100
+ this.list.forEach((v) => (v.children = []))
101
+ this.oldList = this.list.map((v) => v.property)
74
102
  this.newList = this.oldList.slice() //清空
75
103
  this.$nextTick(() => {
76
104
  this.setSort()
77
105
  })
78
106
  },
79
107
  setSort() {
80
- const elAll = document.querySelectorAll('.gridShow .el-table__body-wrapper > table > tbody')
108
+ const elAll = document.querySelectorAll(
109
+ '.gridShow .el-table__body-wrapper > table > tbody'
110
+ )
81
111
  for (let i = 0; i < elAll.length; i++) {
82
112
  const el = elAll[i]
83
113
  this.sortable = Sortable.create(el, {
84
114
  ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
85
- onEnd: evt => {
115
+ onEnd: (evt) => {
86
116
  const targetRow = this.list.splice(evt.oldIndex, 1)[0]
87
117
  this.list.splice(evt.newIndex, 0, targetRow)
88
118
 
89
119
  // for show the changes, you can delete in you code
90
120
  const tempIndex = this.newList.splice(evt.oldIndex, 1)[0]
91
121
  this.newList.splice(evt.newIndex, 0, tempIndex)
92
- }
122
+ },
93
123
  })
94
124
  }
95
125
  },
96
126
  submit() {
97
- const url = '/webresources/login/com/ComGridShow/save?menuId=' + this.menuId + '&gridId=' + this.gridId
127
+ const url =
128
+ '/webresources/login/com/ComGridShow/save?menuId=' +
129
+ this.menuId +
130
+ '&gridId=' +
131
+ this.gridId
98
132
  this.loading = true
99
- this.$http.post(url, this.list).then(response => {
133
+ this.$http.post(url, this.list).then((response) => {
100
134
  this.loading = false
101
135
  const data = response.data
102
136
  this.$message({
103
137
  type: data.code == '-1' ? 'error' : 'success',
104
- message: data.message
138
+ message: data.message,
105
139
  })
106
140
  if (data.code == '-1') {
107
141
  return
@@ -112,12 +146,13 @@ export default {
112
146
  },
113
147
  reset() {
114
148
  //江阴港特色,重置需要弹窗确认框,确认后方可重置
115
- let resetFlag = this.$store.state.app.sysParam.JYG_CONTROL.RESET_BUTTON_CONFIRM
149
+ let resetFlag =
150
+ this.$store.state.app.sysParam.JYG_CONTROL.RESET_BUTTON_CONFIRM
116
151
  if (resetFlag && resetFlag == '1') {
117
152
  this.$confirm('是否确认重置?', '提示', {
118
153
  confirmButtonText: '确定',
119
154
  cancelButtonText: '取消',
120
- type: 'warning'
155
+ type: 'warning',
121
156
  }).then(() => {
122
157
  // 确定
123
158
  this.resetColumn()
@@ -127,12 +162,16 @@ export default {
127
162
  }
128
163
  },
129
164
  resetColumn() {
130
- const url = '/webresources/login/com/ComGridShow/reset?menuId=' + this.menuId + '&gridId=' + this.gridId
131
- this.$http.post(url, this.list).then(response => {
165
+ const url =
166
+ '/webresources/login/com/ComGridShow/reset?menuId=' +
167
+ this.menuId +
168
+ '&gridId=' +
169
+ this.gridId
170
+ this.$http.post(url, this.list).then((response) => {
132
171
  const data = response.data
133
172
  this.$message({
134
173
  type: data.code == '-1' ? 'error' : 'success',
135
- message: data.message
174
+ message: data.message,
136
175
  })
137
176
  if (data.code == '-1') {
138
177
  return
@@ -140,15 +179,14 @@ export default {
140
179
  this.visible = false
141
180
  this.$emit('save-ok')
142
181
  })
143
- }
144
-
145
- }
182
+ },
183
+ },
146
184
  }
147
185
  </script>
148
186
 
149
- <style rel="stylesheet/scss" lang="scss">
187
+ <style lang="scss" rel="stylesheet/scss">
150
188
  .sortable-ghost {
151
- opacity: .8;
189
+ opacity: 0.8;
152
190
  color: #fff !important;
153
191
  background: #42b983 !important;
154
192
  }
@@ -167,19 +205,27 @@ export default {
167
205
  padding-bottom: 30px;
168
206
  }
169
207
 
170
- .el-table__header-wrapper th { //列表标题
208
+ .el-table__header-wrapper th {
209
+ //列表标题
171
210
  background-color: #f6f6f6;
172
211
  }
173
212
 
174
- .el-table__fixed-header-wrapper th { //固定的列表标题
213
+ .el-table__fixed-header-wrapper th {
214
+ //固定的列表标题
175
215
  background-color: #8cbda4;
176
216
  }
177
217
 
178
- td, th { //列表标题及内容
218
+ td,
219
+ th {
220
+ //列表标题及内容
179
221
  padding: 2px 0;
180
222
  }
181
223
 
182
- .cell, .el-table th div, .el-table--border th:first-child .cell, .el-table--border td:first-child .cell { //列表的margin
224
+ .cell,
225
+ .el-table th div,
226
+ .el-table--border th:first-child .cell,
227
+ .el-table--border td:first-child .cell {
228
+ //列表的margin
183
229
  padding-left: 2px !important;
184
230
  padding-right: 2px !important;
185
231
  }
@@ -188,10 +234,11 @@ export default {
188
234
  position: static;
189
235
  text-align: center;
190
236
  width: 100%;
191
- height: 80%
237
+ height: 80%;
192
238
  }
193
239
 
194
- .el-table__body { //列表下面加了空白
240
+ .el-table__body {
241
+ //列表下面加了空白
195
242
  margin-bottom: 10px;
196
243
  }
197
244
 
@@ -205,7 +252,10 @@ export default {
205
252
  margin-bottom: 0px;
206
253
  }
207
254
 
208
- .el-input, .el-form-item__content, .el-form-item__label, .el-input__icon {
255
+ .el-input,
256
+ .el-form-item__content,
257
+ .el-form-item__label,
258
+ .el-input__icon {
209
259
  line-height: 30px;
210
260
  }
211
261
 
@@ -213,12 +263,12 @@ export default {
213
263
  padding: 5px;
214
264
  }
215
265
 
216
- .el-input--prefix .el-input__inner { //日期的有logo不一样
266
+ .el-input--prefix .el-input__inner {
267
+ //日期的有logo不一样
217
268
  padding-left: 30px;
218
269
  }
219
270
  }
220
271
  }
221
-
222
272
  </style>
223
273
 
224
274
  <style scoped>
@@ -1,178 +1,225 @@
1
1
  <template>
2
- <ExAside :width="nowWidth" ref="aside" style="display: flex;">
2
+ <ExAside :width="nowWidth" ref="aside" style="display: flex">
3
3
  <div class="hdAside">
4
4
  <template v-if="title">
5
- <div class="hd-title" v-show="!isShrink">{{$t(title)}}
5
+ <div class="hd-title" v-show="!isShrink">
6
+ {{ $t(title) }}
6
7
  <slot name="title"></slot>
7
- <div align="right" style="margin: -15px 10px 0px 0px;" v-if="arrowShow">
8
- <i @click="isShrink?doShrink(false):doShrink(true)"
9
- style="cursor:pointer;" v-bind:class="['fa', isShrink?'fa-chevron-right':'fa-chevron-left']">
8
+ <div
9
+ align="right"
10
+ style="margin: -15px 10px 0px 0px"
11
+ v-if="arrowShow"
12
+ >
13
+ <i
14
+ @click="isShrink ? doShrink(false) : doShrink(true)"
15
+ style="cursor: pointer"
16
+ v-bind:class="[
17
+ 'fa',
18
+ isShrink ? 'fa-chevron-right' : 'fa-chevron-left',
19
+ ]"
20
+ >
10
21
  </i>
11
22
  </div>
12
23
  </div>
13
24
  </template>
14
25
  <div class="hd-title" v-show="isShrink">
15
- <i @click="isShrink?doShrink(false):doShrink(true)"
16
- style="cursor:pointer;" v-bind:class="['fa', isShrink?'fa-chevron-right':'fa-chevron-left']">
26
+ <i
27
+ @click="isShrink ? doShrink(false) : doShrink(true)"
28
+ style="cursor: pointer"
29
+ v-bind:class="[
30
+ 'fa',
31
+ isShrink ? 'fa-chevron-right' : 'fa-chevron-left',
32
+ ]"
33
+ >
17
34
  </i>
18
35
  </div>
19
- <div style="flex:1;position: relative;height:100%; width: 100%" v-show="!isShrink">
20
- <div style="position: absolute; width: 100%;height: 100%;">
36
+ <div
37
+ style="flex: 1; position: relative; height: 100%; width: 100%"
38
+ v-show="!isShrink"
39
+ >
40
+ <div style="position: absolute; width: 100%; height: 100%">
21
41
  <slot></slot>
22
42
  </div>
23
43
  </div>
24
44
  </div>
25
- <div :class="{asideDrag:true,dragShowCls:dragShow}" @mousedown="mousedown($event)" @mouseout="dragShow=false"
26
- @mouseover="dragShow=true" v-if="!noDrag"></div>
27
- <div class="moveline" ref="moveline" v-show="dragFrom!=null"></div>
45
+ <div
46
+ :class="{ asideDrag: true, dragShowCls: dragShow }"
47
+ @mousedown="mousedown($event)"
48
+ @mouseout="dragShow = false"
49
+ @mouseover="dragShow = true"
50
+ v-if="!noDrag"
51
+ ></div>
52
+ <div class="moveline" ref="moveline" v-show="dragFrom != null"></div>
28
53
  </ExAside>
29
54
  </template>
30
55
 
31
56
  <script>
57
+ /**
58
+ * 覆写ElAside,增加拖动和title
59
+ * @module HdAside
60
+ */
61
+ export default {
62
+ name: 'HdAside',
63
+ component: {},
64
+ inheritAttrs: false,
32
65
  /**
33
- * 覆写ElAside,增加拖动和title
34
- * @module HdAside
66
+ * Props 继承ELAside属性和事件,如果仅需要elementui的ElAside请使用ExAside
67
+ * 插槽:<slot name="title"></slot> title进行额外扩展如增加按钮等
68
+ * @prop {String} title 标题
69
+ * @prop {String} width 禁止在style中写width
70
+ * @prop {Boolen} arrowShow 是否显示一键收缩
71
+ * @prop {Boolen} noDrag 是否可拖动,默认否
72
+ * @prop {String} showType 字符串:"1" 普通 2 收缩 3 全屏
73
+ *
35
74
  */
36
- export default {
37
- name: 'HdAside',
38
- component: {},
39
- inheritAttrs: false,
40
- /**
41
- * Props 继承ELAside属性和事件,如果仅需要elementui的ElAside请使用ExAside
42
- * 插槽:<slot name="title"></slot> title进行额外扩展如增加按钮等
43
- * @prop {String} title 标题
44
- * @prop {String} width 禁止在style中写width
45
- * @prop {Boolen} arrowShow 是否显示一键收缩
46
- * @prop {Boolen} noDrag 是否可拖动,默认否
47
- * @prop {String} showType 字符串:"1" 普通 2 收缩 3 全屏
48
- *
49
- */
50
- props: {
51
- width: String,
52
- title: String, arrowShow: {type: Boolean, default: true},
53
- noDrag: {type: Boolean, default: false},
54
- showType: {type: String, default: '1'} // 注意是字符串:"1" 普通 2 收缩 3 全屏
55
- },
56
- data() {
57
- return {
58
- isShrink: false, // 收缩还是展开
59
- isFull: false,// 是否全屏
60
- differ: 0,//鼠标点击的位置与元素上级位置的差
61
- dragFrom: null, //开始点击的点
62
- inputWidth: 0, //第一次进来时的,宽度
63
- nowWidth: '300px',//无设置默认300px
64
- dragShow: false
65
-
75
+ props: {
76
+ width: String,
77
+ title: String,
78
+ arrowShow: { type: Boolean, default: true },
79
+ noDrag: { type: Boolean, default: false },
80
+ showType: { type: String, default: '1' }, // 注意是字符串:"1" 普通 2 收缩 3 全屏
81
+ },
82
+ data() {
83
+ return {
84
+ isShrink: false, // 收缩还是展开
85
+ isFull: false, // 是否全屏
86
+ differ: 0, //鼠标点击的位置与元素上级位置的差
87
+ dragFrom: null, //开始点击的点
88
+ inputWidth: 0, //第一次进来时的,宽度
89
+ nowWidth: '300px', //无设置默认300px
90
+ dragShow: false,
91
+ }
92
+ },
93
+ mounted() {
94
+ if (this.width) {
95
+ this.nowWidth = this.width
96
+ }
97
+ this.inputWidth = this.nowWidth
98
+ },
99
+ methods: {
100
+ doShrink(isShrink) {
101
+ this.isShrink = isShrink
102
+ this.isFull = false // 收缩时,全屏还原
103
+ if (isShrink) {
104
+ this.$emit('update:showType', '2')
105
+ this.nowWidth = '15px'
106
+ } else {
107
+ //点还原按钮
108
+ this.$emit('update:showType', '1')
109
+ this.nowWidth = this.inputWidth
66
110
  }
67
111
  },
68
- mounted() {
69
- if (this.width) {
70
- this.nowWidth = this.width
112
+ doFullScreen(isFull) {
113
+ // 全屏
114
+ this.isFull = isFull
115
+ this.isShrink = false //
116
+ if (isFull) {
117
+ this.$emit('update:showType', '3')
118
+ this.nowWidth = '100%'
119
+ } else {
120
+ this.$emit('update:showType', '1')
121
+ this.nowWidth = this.inputWidth
71
122
  }
72
- this.inputWidth = this.nowWidth
73
123
  },
74
- methods: {
75
- doShrink(isShrink) {
76
- this.isShrink = isShrink
77
- this.isFull = false // 收缩时,全屏还原
78
- if (isShrink) {
79
- this.$emit('update:showType', '2')
80
- this.nowWidth = '15px'
81
- } else {//点还原按钮
82
- this.$emit('update:showType', '1')
83
- this.nowWidth = this.inputWidth
84
- }
85
- },
86
- doFullScreen(isFull) { // 全屏
87
- this.isFull = isFull
88
- this.isShrink = false //
89
- if (isFull) {
90
- this.$emit('update:showType', '3')
91
- this.nowWidth = "100%"
92
- } else {
93
- this.$emit('update:showType', '1')
94
- this.nowWidth = this.inputWidth
95
- }
96
- },
97
- mousedown: function (event) {
98
- this.$set(this.$store.state, 'hotKey', "-1") //避免热键样式影响体验
99
- this.dragFrom = event.x
100
- this.$refs.moveline.style.left = this.dragFrom + "px"
101
- document.documentElement.addEventListener('mousemove', this.handleMove, true)
102
- document.documentElement.addEventListener('mouseup', this.handleMouseup, true)
103
- },
104
- handleMove: function (event) {
105
- this.$refs.moveline.style.left = event.x + "px"
106
- },
107
- handleMouseup: function (event) {
108
- document.documentElement.removeEventListener('mousemove', this.handleMove, true)
109
- document.documentElement.removeEventListener('mouseup', this.handleMouseup, true)
110
- let newWidth = this.$refs.aside.$el.offsetWidth + event.x - this.dragFrom
111
- this.nowWidth = newWidth + 'px';
112
- this.dragFrom = null
113
- this.$set(this.$store.state, 'hotKey', null) //避免热键样式影响体验
114
- if (newWidth <= 100) { // 少于一定宽度自动收缩
115
- this.doShrink(true)
116
- }
117
- if (newWidth >= 150) { // 少于一定宽度自动收缩
118
- this.isShrink = false
119
- }
120
- },
124
+ mousedown: function (event) {
125
+ this.$set(this.$store.state, 'hotKey', '-1') //避免热键样式影响体验
126
+ this.dragFrom = event.x
127
+ this.$refs.moveline.style.left = this.dragFrom + 'px'
128
+ document.documentElement.addEventListener(
129
+ 'mousemove',
130
+ this.handleMove,
131
+ true
132
+ )
133
+ document.documentElement.addEventListener(
134
+ 'mouseup',
135
+ this.handleMouseup,
136
+ true
137
+ )
121
138
  },
122
- watch: {
123
- // 如果 `activeName` 发生改变,这个函数就会运行
124
- showType: {
125
- immediate: true,
126
- handler:
127
- function (newVal) {
128
- this.$nextTick(() => {
129
- if (newVal == '1') { // 第一次显示查询,以后不查询
130
- this.doShrink(false)
131
- } else if (newVal == '2') { // 第一次显示查询,以后不查询
132
- this.doShrink(true)
133
- } else if (newVal == '3') { // 第一次显示查询,以后不查询
134
- this.doFullScreen(true)
135
- }
136
- })
139
+ handleMove: function (event) {
140
+ this.$refs.moveline.style.left = event.x + 'px'
141
+ },
142
+ handleMouseup: function (event) {
143
+ document.documentElement.removeEventListener(
144
+ 'mousemove',
145
+ this.handleMove,
146
+ true
147
+ )
148
+ document.documentElement.removeEventListener(
149
+ 'mouseup',
150
+ this.handleMouseup,
151
+ true
152
+ )
153
+ let newWidth = this.$refs.aside.$el.offsetWidth + event.x - this.dragFrom
154
+ this.nowWidth = newWidth + 'px'
155
+ this.dragFrom = null
156
+ this.$set(this.$store.state, 'hotKey', null) //避免热键样式影响体验
157
+ if (newWidth <= 100) {
158
+ // 少于一定宽度自动收缩
159
+ this.doShrink(true)
160
+ }
161
+ if (newWidth >= 150) {
162
+ // 少于一定宽度自动收缩
163
+ this.isShrink = false
164
+ }
165
+ },
166
+ },
167
+ watch: {
168
+ // 如果 `activeName` 发生改变,这个函数就会运行
169
+ showType: {
170
+ immediate: true,
171
+ handler: function (newVal) {
172
+ this.$nextTick(() => {
173
+ if (newVal == '1') {
174
+ // 第一次显示查询,以后不查询
175
+ this.doShrink(false)
176
+ } else if (newVal == '2') {
177
+ // 第一次显示查询,以后不查询
178
+ this.doShrink(true)
179
+ } else if (newVal == '3') {
180
+ // 第一次显示查询,以后不查询
181
+ this.doFullScreen(true)
137
182
  }
183
+ })
138
184
  },
139
- nowWidth(val) {
140
- this.$emit('update:width', val);
141
- },
142
- width(val) {
143
- this.nowWidth = val
144
- }
145
- }
146
- }
147
-
185
+ },
186
+ nowWidth(val) {
187
+ this.$emit('update:width', val)
188
+ },
189
+ width(val) {
190
+ this.nowWidth = val
191
+ },
192
+ },
193
+ }
148
194
  </script>
149
- <style rel="stylesheet/scss" lang="scss" scoped>
150
- .hdAside {
151
- display: flex;
152
- flex-direction: column;
153
- flex: 1;
154
- }
155
195
 
156
- .asideDrag {
157
- width: 5px;
158
- height: 100%;
159
- overflow: hidden;
160
- cursor: ew-resize;
161
- user-select: none;
162
- }
196
+ <style lang="scss" rel="stylesheet/scss" scoped>
197
+ .hdAside {
198
+ display: flex;
199
+ flex-direction: column;
200
+ flex: 1;
201
+ }
202
+
203
+ .asideDrag {
204
+ width: 5px;
205
+ height: 100%;
206
+ overflow: hidden;
207
+ cursor: ew-resize;
208
+ user-select: none;
209
+ }
163
210
 
164
- .moveline {
165
- width: 5px;
166
- height: 100%;
167
- overflow: hidden;
168
- position: fixed;
169
- cursor: ew-resize;
170
- background-color: red;
171
- z-index: 9999;
172
- user-select: none;
173
- }
211
+ .moveline {
212
+ width: 5px;
213
+ height: 100%;
214
+ overflow: hidden;
215
+ position: fixed;
216
+ cursor: ew-resize;
217
+ background-color: red;
218
+ z-index: 9999;
219
+ user-select: none;
220
+ }
174
221
 
175
- .dragShowCls {
176
- background-color: #409EFF;
177
- }
222
+ .dragShowCls {
223
+ background-color: #409eff;
224
+ }
178
225
  </style>