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,25 +1,74 @@
1
1
  <template>
2
- <div style="height: 100%;">
3
- <hd-com-query :allColumn="allColumn" :hdQuery="hdQuery" ref="comQuery"></hd-com-query>
4
- <ImportExcel @on-selected-file='doImportExcel' ref="imExcel" v-if="imExcelIs"></ImportExcel>
5
- <GridChart :allColumn="allColumn" :hdQuery="hdQuery" :url="chartUrl" ref="gridChart" v-if="gridChartIs"></GridChart>
6
- <HdGrid :hdQuery="hdQuery" :hdResult="hdResult" @allExcel="doAllExcel" @extSets="extSets" ref="hdgrid"
7
- @sel-ok="operaData" v-bind="$attrs" v-loading="listLoading" v-on="$listeners">
2
+ <div style="height: 100%">
3
+ <hd-com-query
4
+ :allColumn="allColumn"
5
+ :hdQuery="hdQuery"
6
+ ref="comQuery"
7
+ ></hd-com-query>
8
+ <ImportExcel
9
+ @on-selected-file="doImportExcel"
10
+ ref="imExcel"
11
+ v-if="imExcelIs"
12
+ ></ImportExcel>
13
+ <GridChart
14
+ :allColumn="allColumn"
15
+ :hdQuery="hdQuery"
16
+ :url="chartUrl"
17
+ ref="gridChart"
18
+ v-if="gridChartIs"
19
+ ></GridChart>
20
+ <HdGrid
21
+ :hdQuery="hdQuery"
22
+ :hdResult="hdResult"
23
+ @allExcel="doAllExcel"
24
+ @extSets="extSets"
25
+ ref="hdgrid"
26
+ @sel-ok="operaData"
27
+ v-bind="$attrs"
28
+ v-loading="listLoading"
29
+ v-on="$listeners"
30
+ >
8
31
  <template slot="extSets">
9
- <el-dropdown-item command="flowHide">{{columnFlowThis.isShow ? $t('隐藏行按钮') : $t('显示行按钮')}}</el-dropdown-item>
32
+ <el-dropdown-item command="flowHide">{{
33
+ columnFlowThis.isShow ? $t('隐藏行按钮') : $t('显示行按钮')
34
+ }}</el-dropdown-item>
10
35
  <template v-if="!noAdQuery">
11
- <el-dropdown-item command="comQuery" v-if="adQueryTemplateNameList.length>0">
12
- <el-popover placement="left" width="160" v-model="visible" trigger="hover">
13
- <div class="adquery" v-for="item in adQueryTemplateNameList" :key="item.queryId"
14
- @click="adQueryTemplateClick(item.queryId)">{{item.name}} </div>
36
+ <el-dropdown-item
37
+ command="comQuery"
38
+ v-if="adQueryTemplateNameList.length > 0"
39
+ >
40
+ <el-popover
41
+ placement="left"
42
+ width="160"
43
+ v-model="visible"
44
+ trigger="hover"
45
+ >
46
+ <div
47
+ class="adquery"
48
+ v-for="item in adQueryTemplateNameList"
49
+ :key="item.queryId"
50
+ @click="adQueryTemplateClick(item.queryId)"
51
+ >
52
+ {{ item.name }}
53
+ </div>
15
54
 
16
- <span slot="reference">{{$t('高级查询')}}<i class="el-icon-arrow-down el-icon--right"></i></span>
55
+ <span slot="reference"
56
+ >{{ $t('高级查询')
57
+ }}<el-icon class="el-icon--right"
58
+ ><el-icon-arrow-down /></el-icon
59
+ ></span>
17
60
  </el-popover>
18
61
  </el-dropdown-item>
19
- <el-dropdown-item command="comQuery" v-else>{{$t('高级查询')}}</el-dropdown-item>
62
+ <el-dropdown-item command="comQuery" v-else>{{
63
+ $t('高级查询')
64
+ }}</el-dropdown-item>
20
65
  </template>
21
- <el-dropdown-item command="gridChart" v-if="genChart">{{$t('图表统计')}}</el-dropdown-item>
22
- <el-dropdown-item command="imExcel" v-if="imExcel">{{$t('导入excel')}}</el-dropdown-item>
66
+ <el-dropdown-item command="gridChart" v-if="genChart">{{
67
+ $t('图表统计')
68
+ }}</el-dropdown-item>
69
+ <el-dropdown-item command="imExcel" v-if="imExcel">{{
70
+ $t('导入excel')
71
+ }}</el-dropdown-item>
23
72
  <!-- <el-dropdown-item command="autoFilter" v-if="autoFilterVisable">{{autoFilterOpen ? $t('隐藏高级筛选') : $t('高级筛选')}}</el-dropdown-item>-->
24
73
  <!-- <el-dropdown-item command="customeTree" v-if="customeTreeVisable">{{$t('自定义树')}}</el-dropdown-item>-->
25
74
  <slot name="extSets"></slot>
@@ -42,18 +91,21 @@
42
91
  </template>
43
92
 
44
93
  <script>
94
+ import { ArrowDown as ElIconArrowDown } from '@element-plus/icons'
45
95
  import HdComQuery from './HdComQuery'
46
96
  import ImportExcel from './ImportExcel'
47
97
  import GridChart from './GridChart'
48
98
  import HdGrid from './HdGrid'
49
99
 
50
- /**
51
- * 封装了增删改查,导入导出excel,高级查询,列表展示设置等功能的列表
52
- * @module HdComGrid
53
- */
54
100
  export default {
101
+ components: {
102
+ HdComQuery,
103
+ ImportExcel,
104
+ GridChart,
105
+ HdGrid,
106
+ ElIconArrowDown,
107
+ },
55
108
  name: 'HdComGrid',
56
- components: { HdComQuery, ImportExcel, GridChart, HdGrid },
57
109
  data() {
58
110
  return {
59
111
  hdResult: {
@@ -64,9 +116,9 @@ export default {
64
116
  visible: false,
65
117
  allColumn: [], // 高级查询用,有prop的column
66
118
  columnFlowThis: {}, // 浮动区隐藏显示
67
- imExcelIs: false,// 提升效率
68
- gridChartIs: false,// 提升效率
69
- saveIng: false,//保存时,使点击失效
119
+ imExcelIs: false, // 提升效率
120
+ gridChartIs: false, // 提升效率
121
+ saveIng: false, //保存时,使点击失效
70
122
  autoFilterOpen: false,
71
123
  adQueryTemplateNameList: [],
72
124
  }
@@ -103,72 +155,79 @@ export default {
103
155
  */
104
156
  props: {
105
157
  imExcel: Boolean, // 是否开启导入excel
106
- hdQuery: {// 查询list
158
+ hdQuery: {
159
+ // 查询list
107
160
  type: Object,
108
161
  default: function () {
109
162
  return new HdQuery(this)
110
- }
163
+ },
111
164
  },
112
165
  notInit: Boolean, // 不立即显示,通过调用doQuery显示或者queryUrl变更触发
113
- validate: {// 校验
166
+ validate: {
167
+ // 校验
114
168
  type: Object,
115
169
  default: function () {
116
170
  return {}
117
- }
171
+ },
118
172
  }, // 校验
119
173
  url: String, // 默认url,通常用代码生成器,后面的url不需要改
120
- findUrl: {// 查询list
174
+ findUrl: {
175
+ // 查询list
121
176
  type: String,
122
177
  default: function () {
123
178
  return this.url + '/find'
124
- }
179
+ },
125
180
  },
126
- findoneUrl: {// 单值查询 doEdit
181
+ findoneUrl: {
182
+ // 单值查询 doEdit
127
183
  type: String,
128
184
  default: function () {
129
185
  return this.url + '/findone'
130
- }
186
+ },
131
187
  },
132
- saveoneUrl: {// 保存
188
+ saveoneUrl: {
189
+ // 保存
133
190
  type: String,
134
191
  default: function () {
135
192
  return this.url + '/saveone'
136
- }
193
+ },
137
194
  }, // 保存list
138
- saveAllUrl: {// 保存
195
+ saveAllUrl: {
196
+ // 保存
139
197
  type: String,
140
198
  default: function () {
141
199
  return this.url + '/saveAll'
142
- }
200
+ },
143
201
  },
144
- removeUrl: {// 单条删
202
+ removeUrl: {
203
+ // 单条删
145
204
  type: String,
146
205
  default: function () {
147
206
  return this.url + '/remove'
148
- }
207
+ },
149
208
  },
150
209
  removeAllUrl: {
151
210
  type: String,
152
211
  default: function () {
153
212
  return this.url + '/removeAll'
154
- }
213
+ },
155
214
  },
156
215
  imExcelUrl: {
157
216
  type: String,
158
217
  default: function () {
159
218
  return this.url + '/imExcel'
160
- }
219
+ },
161
220
  },
162
221
  genChart: Boolean, // 是否开启图表生成,后台需要写
163
222
  chartUrl: {
164
223
  type: String,
165
224
  default: function () {
166
225
  return this.url + '/genChart'
167
- }
226
+ },
168
227
  },
169
- noCopy: [Array, String],// 不拷贝的主键,请确保第一位是主键 //:noCopy="['codeId']"或者noCopy="codeId"
228
+ noCopy: [Array, String], // 不拷贝的主键,请确保第一位是主键 //:noCopy="['codeId']"或者noCopy="codeId"
170
229
  addWay: Function, //底部按钮工具栏的自定义增加方法传入
171
- saveWay: Function,//底部按钮工具栏的自定义保存方法传入
230
+ saveWay: Function, //底部按钮工具栏的自定义保存方法传入
172
231
  autoFilterVisable: {
173
232
  type: Boolean,
174
233
  default: false,
@@ -180,10 +239,9 @@ export default {
180
239
  },
181
240
  noAdQuery: {
182
241
  type: Boolean,
183
- default: false
184
- }
242
+ default: false,
243
+ },
185
244
  },
186
-
187
245
  mounted() {
188
246
  this.hdQuery.setThis(this) // 切换this指向,主要是因为doQuery已经封装
189
247
  if (!this.notInit) {
@@ -218,7 +276,7 @@ export default {
218
276
  this.$refs.gridChart.show()
219
277
  })
220
278
  } else if (command == 'autoFilter') {
221
- this.autoFilterOpen = !this.autoFilterOpen;
279
+ this.autoFilterOpen = !this.autoFilterOpen
222
280
  // this.$refs.hdgrid.$refs.ingrid.states._columns.forEach(v=>console.log('v',v))
223
281
  } else {
224
282
  this.$emit('extSets', command)
@@ -230,55 +288,62 @@ export default {
230
288
  * @param {data} data!=null,直接赋值,不走后台
231
289
  * return promise 用于在查询后执行的事件
232
290
  */
233
- doQuery(data) { // 存在data时,直接赋值,不走后台
291
+ doQuery(data) {
292
+ // 存在data时,直接赋值,不走后台
234
293
  if (data) {
235
294
  this.hdResult = data
236
295
  return true
237
296
  }
238
297
  this.hdQuery.selRow = null // 查询时,清除选中行
239
- if (!this.hdQuery._noLoadingOnce) { // form翻页时,会触发列表的loading出现闪屏
298
+ if (!this.hdQuery._noLoadingOnce) {
299
+ // form翻页时,会触发列表的loading出现闪屏
240
300
  this.listLoading = true
241
- } else { // 只当前一次
301
+ } else {
302
+ // 只当前一次
242
303
  this.hdQuery._noLoadingOnce = false
243
304
  }
244
305
  const promise = new Promise((resolve, reject) => {
245
306
  this.$nextTick(() => {
246
- this.$http.post(this.findUrl, this.hdQuery).then(response => {
247
- this.listLoading = false
307
+ this.$http
308
+ .post(this.findUrl, this.hdQuery)
309
+ .then((response) => {
310
+ this.listLoading = false
248
311
 
249
- // let grid = this.$refs.hdgrid.$refs.ingrid
250
- // grid.$refs.tableHeader ? grid.$refs.tableHeader.filterPanels = {} : '';
251
- // grid.$refs.fixedTableHeader ? grid.fixedTableHeader.tableHeader.filterPanels = {} : '';
252
- // grid.$refs.rightFixedTableHeader ? grid.$refs.rightFixedTableHeader.filterPanels = {} : '';
312
+ // let grid = this.$refs.hdgrid.$refs.ingrid
313
+ // grid.$refs.tableHeader ? grid.$refs.tableHeader.filterPanels = {} : '';
314
+ // grid.$refs.fixedTableHeader ? grid.fixedTableHeader.tableHeader.filterPanels = {} : '';
315
+ // grid.$refs.rightFixedTableHeader ? grid.$refs.rightFixedTableHeader.filterPanels = {} : '';
253
316
 
254
- this.hdResult = response.data
255
- // this.hdResult = Object.assign(response.data, {filters: this.hdResult.filters || []})
256
- // this.hdResult._rows = this.hdResult.rows
317
+ this.hdResult = response.data
318
+ // this.hdResult = Object.assign(response.data, {filters: this.hdResult.filters || []})
319
+ // this.hdResult._rows = this.hdResult.rows
257
320
 
258
- // this.$nextTick(() => {
259
- // this.$refs.hdgrid.filterHdResult();
260
- // })
261
- //选第一个
262
- // if (this.hdResult.rows.length > 0) {
263
- // this.$set(this.hdResult.rows[0], '_isCk', true)
264
- // this.$nextTick(() => {
265
- // this.$refs.hdgrid.$refs.ingrid.toggleRowSelection(this.hdResult.rows[0], true)
266
- // this.$refs.hdgrid.setCurrentRow(0, true)
267
- // })
268
- // }
269
- resolve(response.data)
270
- }).catch(response => {
271
- this.listLoading = false
272
- })
321
+ // this.$nextTick(() => {
322
+ // this.$refs.hdgrid.filterHdResult();
323
+ // })
324
+ //选第一个
325
+ // if (this.hdResult.rows.length > 0) {
326
+ // this.$set(this.hdResult.rows[0], '_isCk', true)
327
+ // this.$nextTick(() => {
328
+ // this.$refs.hdgrid.$refs.ingrid.toggleRowSelection(this.hdResult.rows[0], true)
329
+ // this.$refs.hdgrid.setCurrentRow(0, true)
330
+ // })
331
+ // }
332
+ resolve(response.data)
333
+ })
334
+ .catch((response) => {
335
+ this.listLoading = false
336
+ })
273
337
  })
274
338
  })
275
339
  return promise
276
340
  },
277
341
 
278
- doAllExcel(call) {//pdf也用了这个函数
342
+ doAllExcel(call) {
343
+ //pdf也用了这个函数
279
344
  const excelQuery = new HdQuery(this)
280
345
  Object.assign(excelQuery, this.hdQuery)
281
- excelQuery.rows = 2000;
346
+ excelQuery.rows = 2000
282
347
  console.log('导出全部excel,最多导出2000条')
283
348
  call(this.$http.post(this.findUrl, excelQuery))
284
349
  },
@@ -288,23 +353,30 @@ export default {
288
353
  * @param {row} row==''或null为增加,会从findoneUrl走后台查询,有值时,直接使用当前row
289
354
  *
290
355
  * */
291
- doEdit(row, rowData) { // 增加或编辑
356
+ doEdit(row, rowData) {
357
+ // 增加或编辑
292
358
  this.$nextTick(() => {
293
- if (!row) { // 空:增加
294
- this.$http.post(this.findoneUrl, this.hdQuery).then(response => {
359
+ if (!row) {
360
+ // 空:增加
361
+ this.$http.post(this.findoneUrl, this.hdQuery).then((response) => {
295
362
  this.$set(response.data, 'isEdit', true)
296
- this.$set(response.data, '_add', new Date().getTime() + Math.random())
297
- let row = Object.assign(response.data, rowData);
298
- this.hdResult.rows.unshift(row)// 从开头增加
299
- this.$refs.hdgrid.$refs.ingrid.$refs.bodyWrapper.scrollTop = 0;
300
- this.doVaild(row);
363
+ this.$set(
364
+ response.data,
365
+ '_add',
366
+ new Date().getTime() + Math.random()
367
+ )
368
+ let row = Object.assign(response.data, rowData)
369
+ this.hdResult.rows.unshift(row) // 从开头增加
370
+ this.$refs.hdgrid.$refs.ingrid.$refs.bodyWrapper.scrollTop = 0
371
+ this.doVaild(row)
301
372
  })
302
- } else { // 编辑,不走后台
373
+ } else {
374
+ // 编辑,不走后台
303
375
  this.$set(row, 'isEdit', true)
304
376
  row._oriData = {}
305
377
  //$.extend( row._oriData, row)
306
378
  row._oriData = Object.assign({}, row) //Object.assign(row._oriData, row)会无限递归
307
- this.doVaild(row);
379
+ this.doVaild(row)
308
380
  }
309
381
 
310
382
  this.resetCurHightRow()
@@ -313,9 +385,11 @@ export default {
313
385
  /**
314
386
  * @function doCancel 行内编辑取消
315
387
  * */
316
- doCancel(row, index) { // 撤销时\
388
+ doCancel(row, index) {
389
+ // 撤销时\
317
390
  this.clearValiHint(row)
318
- if (row._add) { // 没有保存的
391
+ if (row._add) {
392
+ // 没有保存的
319
393
  for (let i = 0; i < this.hdResult.rows.length; i++) {
320
394
  if (this.hdResult.rows[i]._add == row._add) {
321
395
  this.hdResult.rows.splice(i, 1)
@@ -334,28 +408,28 @@ export default {
334
408
  * */
335
409
  doRemove(row) {
336
410
  const promise = new Promise((resolve, reject) => {
337
- this.$confirm(this.$t('确定删除本数据?'), this.$t('提示'), {}).then(() => {
338
- this.$http.post(this.removeUrl, row).then(response => {
339
- const data = response.data
340
- this.$message({
341
- type: data.code == '-1' ? 'error' : 'success',
342
- showClose: true,
343
- duration: data.code == '-1' ? 6000 : 1500,
344
- message: data.message
411
+ this.$confirm(this.$t('确定删除本数据?'), this.$t('提示'), {})
412
+ .then(() => {
413
+ this.$http.post(this.removeUrl, row).then((response) => {
414
+ const data = response.data
415
+ this.$message({
416
+ type: data.code == '-1' ? 'error' : 'success',
417
+ showClose: true,
418
+ duration: data.code == '-1' ? 6000 : 1500,
419
+ message: data.message,
420
+ })
421
+ if (data.code == '-1') {
422
+ reject(data)
423
+ return
424
+ }
425
+ resolve(data)
426
+ this.hdResult.rows.remove(row)
427
+ // this.doQuery()
345
428
  })
346
- if (data.code == '-1') {
347
- reject(data)
348
- return
349
- }
350
- resolve(data)
351
- this.hdResult.rows.remove(row)
352
- // this.doQuery()
353
429
  })
354
- }).catch((e) => {
355
- })
356
- })
357
- promise.catch(function (error) {
430
+ .catch((e) => {})
358
431
  })
432
+ promise.catch(function (error) {})
359
433
  this.resetCurHightRow()
360
434
  return promise
361
435
  },
@@ -370,33 +444,34 @@ export default {
370
444
  type: 'error',
371
445
  message: this.$t('请选择数据'),
372
446
  showClose: true,
373
- duration: 1500
447
+ duration: 1500,
374
448
  })
375
449
  return false
376
450
  }
377
451
  const promise = new Promise((resolve, reject) => {
378
- this.$confirm(this.$t('确定删除选中数据?'), this.$t('提示'), {}).then(() => { // 有删除提示,所以不需要nextTrick
379
- this.$http.post(this.removeAllUrl, ckRows).then(response => {
380
- const data = response.data
381
- this.$message({
382
- type: data.code === '-1' ? 'error' : 'success',
383
- showClose: true,
384
- duration: data.code == '-1' ? 6000 : 1500,
385
- message: data.message
452
+ this.$confirm(this.$t('确定删除选中数据?'), this.$t('提示'), {})
453
+ .then(() => {
454
+ // 有删除提示,所以不需要nextTrick
455
+ this.$http.post(this.removeAllUrl, ckRows).then((response) => {
456
+ const data = response.data
457
+ this.$message({
458
+ type: data.code === '-1' ? 'error' : 'success',
459
+ showClose: true,
460
+ duration: data.code == '-1' ? 6000 : 1500,
461
+ message: data.message,
462
+ })
463
+ if (data.code === '-1') {
464
+ reject(data)
465
+ return
466
+ }
467
+ resolve(data)
468
+ this.hdResult.rows.remove(ckRows)
469
+ // this.doQuery()
386
470
  })
387
- if (data.code === '-1') {
388
- reject(data)
389
- return
390
- }
391
- resolve(data)
392
- this.hdResult.rows.remove(ckRows)
393
- // this.doQuery()
394
471
  })
395
- }).catch(() => {
396
- })
397
- })
398
- promise.catch(function (error) {
472
+ .catch(() => {})
399
473
  })
474
+ promise.catch(function (error) {})
400
475
  this.resetCurHightRow()
401
476
  return promise
402
477
  },
@@ -413,7 +488,8 @@ export default {
413
488
  this.clearValiHint(row)
414
489
  const promise = new Promise((resolve, reject) => {
415
490
  this.saveCheck().validate(row, (errors, fields) => {
416
- if (errors) { // 错误的提醒
491
+ if (errors) {
492
+ // 错误的提醒
417
493
 
418
494
  errors.forEach((err, index) => {
419
495
  console.info(err.field + '--' + err.message)
@@ -423,7 +499,7 @@ export default {
423
499
  type: 'error',
424
500
  message: this.$t('填写有误'),
425
501
  showClose: true,
426
- duration: 1500
502
+ duration: 1500,
427
503
  })
428
504
  } else {
429
505
  this.$nextTick(() => {
@@ -432,32 +508,34 @@ export default {
432
508
  return false
433
509
  }
434
510
  this.saveIng = true
435
- this.$http.post(this.saveoneUrl, row).then(response => {
436
- this.saveIng = false
437
- const data = response.data
438
- this.$message({
439
- type: data.code == '-1' ? 'error' : 'success',
440
- message: data.message,
441
- showClose: true,
442
- duration: data.code == '-1' ? 6000 : 1500,
511
+ this.$http
512
+ .post(this.saveoneUrl, row)
513
+ .then((response) => {
514
+ this.saveIng = false
515
+ const data = response.data
516
+ this.$message({
517
+ type: data.code == '-1' ? 'error' : 'success',
518
+ message: data.message,
519
+ showClose: true,
520
+ duration: data.code == '-1' ? 6000 : 1500,
521
+ })
522
+ if (data.code == '-1') {
523
+ reject(data)
524
+ return
525
+ }
526
+ resolve(data)
527
+ Object.assign(row, data.data) // 对象重新赋值
528
+ row._add = null
529
+ this.$set(row, 'isEdit', false)
530
+ })
531
+ .catch((response) => {
532
+ this.saveIng = false
443
533
  })
444
- if (data.code == '-1') {
445
- reject(data)
446
- return
447
- }
448
- resolve(data)
449
- Object.assign(row, data.data) // 对象重新赋值
450
- row._add = null
451
- this.$set(row, 'isEdit', false)
452
- }).catch(response => {
453
- this.saveIng = false
454
- })
455
534
  })
456
535
  }
457
536
  })
458
537
  })
459
- promise.catch(function (error) {
460
- })
538
+ promise.catch(function (error) {})
461
539
  this.resetCurHightRow()
462
540
  return promise
463
541
  },
@@ -478,29 +556,38 @@ export default {
478
556
  if (!ckRows || ckRows.length == 0) {
479
557
  this.$message({
480
558
  type: 'error',
481
- message: this.$t('请勾选数据')
559
+ message: this.$t('请勾选数据'),
482
560
  })
483
561
  return false
484
562
  }
485
563
  for (let i = 0; i < ckRows.length; i++) {
486
- this.doCopyOne(ckRows[i], i);
564
+ this.doCopyOne(ckRows[i], i)
487
565
  }
488
566
  this.resetCurHightRow()
489
567
  },
490
568
  doCopyOne(row, i) {
491
569
  let nowTime = new Date().getTime()
492
570
 
493
- const one = JSON.parse(JSON.stringify(row))// 深度复制
494
- one._add = nowTime + i//复制都是新增的
495
- let noCpLs = ['recNam', 'recTim', 'updNam', 'updNam', 'updTim', 'idevVersionUse']
571
+ const one = JSON.parse(JSON.stringify(row)) // 深度复制
572
+ one._add = nowTime + i //复制都是新增的
573
+ let noCpLs = [
574
+ 'recNam',
575
+ 'recTim',
576
+ 'updNam',
577
+ 'updNam',
578
+ 'updTim',
579
+ 'idevVersionUse',
580
+ ]
496
581
  if (this.noCopy) {
497
- if (typeof this.noCopy == 'string') { // 可以是字符串或者数组
582
+ if (typeof this.noCopy == 'string') {
583
+ // 可以是字符串或者数组
498
584
  noCpLs.push(this.noCopy)
499
585
  } else {
500
586
  noCpLs = noCpLs.concat(this.noCopy)
501
587
  }
502
- for (let j = 0; j < noCpLs.length; j++) { // 不需要复制的属性给null
503
- eval('one.' + noCpLs[j] + ' = null')// eval是为了支持深度
588
+ for (let j = 0; j < noCpLs.length; j++) {
589
+ // 不需要复制的属性给null
590
+ eval('one.' + noCpLs[j] + ' = null') // eval是为了支持深度
504
591
  }
505
592
  }
506
593
  this.$set(one, 'isEdit', true)
@@ -508,32 +595,35 @@ export default {
508
595
  this.$set(row, '_isCK', false)
509
596
  // console.log(row)
510
597
  this.doVaild(one)
511
- this.hdResult.rows.unshift(one)// 从开头增加
598
+ this.hdResult.rows.unshift(one) // 从开头增加
512
599
  },
513
600
  /**
514
601
  * @function doSaveAll 所有编辑状态的一起保存,有promise(data)回调
515
602
  * */
516
- doSaveAll() { // 批量保存
603
+ doSaveAll() {
604
+ // 批量保存
517
605
  const promise = new Promise((resolve, reject) => {
518
- const allEditRow = this.hdResult.rows.filter(v => {
606
+ const allEditRow = this.hdResult.rows.filter((v) => {
519
607
  this.clearValiHint(v)
520
- return v.isEdit// 只看编辑的
608
+ return v.isEdit // 只看编辑的
521
609
  })
522
610
  if (allEditRow.length == 0) {
523
611
  this.$message({
524
612
  type: 'error',
525
613
  message: this.$t('无数据保存'),
526
614
  showClose: true,
527
- duration: 1500
615
+ duration: 1500,
528
616
  })
529
617
  return false
530
618
  }
531
619
  this.$nextTick(() => {
532
- this.checkAllRow(allEditRow, 0, false, this.callSaveAll, { resolve, reject })
620
+ this.checkAllRow(allEditRow, 0, false, this.callSaveAll, {
621
+ resolve,
622
+ reject,
623
+ })
533
624
  })
534
625
  })
535
- promise.catch(function (error) {
536
- })
626
+ promise.catch(function (error) {})
537
627
  return promise
538
628
  },
539
629
 
@@ -543,7 +633,8 @@ export default {
543
633
  return true
544
634
  }
545
635
  this.saveCheck().validate(rows[index], (errors, fields) => {
546
- if (errors) { // 错误的提醒
636
+ if (errors) {
637
+ // 错误的提醒
547
638
  errors.forEach((err, i) => {
548
639
  this.$set(rows[index], '_err_' + err.field, err.message)
549
640
  })
@@ -559,13 +650,13 @@ export default {
559
650
  type: 'error',
560
651
  message: this.$t('填写有误'),
561
652
  showClose: true,
562
- duration: 1500
653
+ duration: 1500,
563
654
  })
564
655
  } else {
565
- const allEditRow = this.hdResult.rows.filter(v => {
656
+ const allEditRow = this.hdResult.rows.filter((v) => {
566
657
  return v.isEdit
567
658
  })
568
- this.$http.post(this.saveAllUrl, allEditRow).then(response => {
659
+ this.$http.post(this.saveAllUrl, allEditRow).then((response) => {
569
660
  const data = response.data
570
661
  this.$message({
571
662
  type: data.code == '-1' ? 'error' : 'success',
@@ -603,14 +694,16 @@ export default {
603
694
  /**
604
695
  * @function addHotKey 快捷键 上下选择 左右翻页,下拉列表会用到
605
696
  * */
606
- addHotKey() { // 使用快捷键
697
+ addHotKey() {
698
+ // 使用快捷键
607
699
  this.$refs.hdgrid.addHotKey()
608
700
  },
609
701
 
610
702
  /**
611
703
  * @function removeHotKey 移除快捷键
612
704
  * */
613
- removeHotKey() { // 移除快捷键
705
+ removeHotKey() {
706
+ // 移除快捷键
614
707
  this.$refs.hdgrid.removeHotKey()
615
708
  },
616
709
 
@@ -619,40 +712,45 @@ export default {
619
712
  * */
620
713
  doImportExcel(data) {
621
714
  // console.info(data)
622
- if (!data || data.results.length <= 0) { // 第一行为中文,不需要
715
+ if (!data || data.results.length <= 0) {
716
+ // 第一行为中文,不需要
623
717
  this.$message({
624
718
  type: 'error',
625
719
  message: this.$t('Excel模板解析错误'),
626
720
  showClose: true,
627
- duration: 1500
721
+ duration: 1500,
628
722
  })
629
723
  return false
630
724
  }
631
725
  const nwData = data.results
632
726
  const promise = new Promise((resolve, reject) => {
633
- this.$confirm(this.$t('本次上传数据为') + nwData.length + this.$t('行,是否继续?'), this.$t('提示'), {}).then(() => {
634
- this.$http.post(this.imExcelUrl, nwData).then(response => {
635
- const data = response.data
636
- this.$message({
637
- type: data.code == '-1' ? 'error' : 'success',
638
- showClose: true,
639
- duration: data.code == '-1' ? 6000 : 1500,
640
- message: data.message
727
+ this.$confirm(
728
+ this.$t('本次上传数据为') + nwData.length + this.$t('行,是否继续?'),
729
+ this.$t('提示'),
730
+ {}
731
+ )
732
+ .then(() => {
733
+ this.$http.post(this.imExcelUrl, nwData).then((response) => {
734
+ const data = response.data
735
+ this.$message({
736
+ type: data.code == '-1' ? 'error' : 'success',
737
+ showClose: true,
738
+ duration: data.code == '-1' ? 6000 : 1500,
739
+ message: data.message,
740
+ })
741
+ if (data.code == '-1') {
742
+ reject(data)
743
+ return
744
+ }
745
+ this.imExcelIs = false
746
+ resolve(data)
747
+ this.$emit('success-import', data)
748
+ this.doQuery()
641
749
  })
642
- if (data.code == '-1') {
643
- reject(data)
644
- return
645
- }
646
- this.imExcelIs = false
647
- resolve(data)
648
- this.$emit("success-import", data)
649
- this.doQuery()
650
750
  })
651
- }).catch((e) => {
652
- })
653
- })
654
- promise.catch(function (error) {
751
+ .catch((e) => {})
655
752
  })
753
+ promise.catch(function (error) {})
656
754
  this.resetCurHightRow()
657
755
  return promise
658
756
  },
@@ -668,27 +766,23 @@ export default {
668
766
  /**
669
767
  * @function beforeAdd 增加前的校验
670
768
  * */
671
- beforeAdd() {
672
-
673
- },
769
+ beforeAdd() {},
674
770
  /**
675
771
  * @function beforeSave 保存前的校验
676
772
  * */
677
- beforeSave() {
678
-
679
- },
773
+ beforeSave() {},
680
774
  /**
681
775
  * @function operaData 增加、删除、保存、复制 数据
682
776
  * */
683
777
  operaData(command, row) {
684
778
  /*let wayArr=[]
685
- if (this.noDefWay){
686
- if (typeof this.noCopy == 'string'){//字符串
687
- wayArr.push(this.noDefWay)
688
- }else{//数组
689
- wayArr = wayArr.concat(this.noDefWay)
690
- }
691
- }*/
779
+ if (this.noDefWay){
780
+ if (typeof this.noCopy == 'string'){//字符串
781
+ wayArr.push(this.noDefWay)
782
+ }else{//数组
783
+ wayArr = wayArr.concat(this.noDefWay)
784
+ }
785
+ }*/
692
786
  if (command == 'doAdd') {
693
787
  if (this.addWay) {
694
788
  this.addWay()
@@ -721,12 +815,12 @@ export default {
721
815
  this.resetCurHightRow()
722
816
  //this.$emit('doCopy')
723
817
  }
724
-
725
818
  },
726
819
  doVaild(row) {
727
820
  this.saveCheck().validate(row, (errors, fields) => {
728
821
  // console.log(row, errors)
729
- if (errors) { // 错误的提醒
822
+ if (errors) {
823
+ // 错误的提醒
730
824
 
731
825
  errors.forEach((err, index) => {
732
826
  console.info(err.field + '--' + err.message)
@@ -740,37 +834,43 @@ export default {
740
834
  const innHdQuery = { query: {} }
741
835
  innHdQuery.query.menuId = this.$route.name
742
836
  innHdQuery.query.gridId = this.$refs.hdgrid.gridId
743
- this.$http.post('/webresources/login/com/ComQuery/find/', innHdQuery).then(response => {
744
- this.adQueryTemplateNameList = response.data
745
- })
837
+ this.$http
838
+ .post('/webresources/login/com/ComQuery/find/', innHdQuery)
839
+ .then((response) => {
840
+ this.adQueryTemplateNameList = response.data
841
+ })
746
842
  },
747
843
  adQueryTemplateClick(queryId) {
748
844
  if (!this.$refs.comQuery) {
749
845
  return
750
846
  }
751
- this.$http.post('/webresources/login/com/ComQuery/findDetail?queryId=' + queryId).then(response => {
752
- const data = response.data
753
- this.hdQuery.vueleftQueryLs = []
754
- this.hdQuery.vuerightQueryLs = []
755
- this.$refs.comQuery.addToHdQuery(this.hdQuery.vueleftQueryLs, this.$refs.comQuery.listInit(data[0]))
756
- this.hdQuery.vueGroupRel = 'or'
757
- this.$refs.comQuery.addToHdQuery(this.hdQuery.vuerightQueryLs, this.$refs.comQuery.listInit(data[1]))
758
- this.hdQuery.sorts = { params: this.$refs.comQuery.sortInit(data[2]) }
759
- this.hdQuery.sort = ''
760
- this.doQuery()
761
- })
847
+ this.$http
848
+ .post('/webresources/login/com/ComQuery/findDetail?queryId=' + queryId)
849
+ .then((response) => {
850
+ const data = response.data
851
+ this.hdQuery.vueleftQueryLs = []
852
+ this.hdQuery.vuerightQueryLs = []
853
+ this.$refs.comQuery.addToHdQuery(
854
+ this.hdQuery.vueleftQueryLs,
855
+ this.$refs.comQuery.listInit(data[0])
856
+ )
857
+ this.hdQuery.vueGroupRel = 'or'
858
+ this.$refs.comQuery.addToHdQuery(
859
+ this.hdQuery.vuerightQueryLs,
860
+ this.$refs.comQuery.listInit(data[1])
861
+ )
862
+ this.hdQuery.sorts = { params: this.$refs.comQuery.sortInit(data[2]) }
863
+ this.hdQuery.sort = ''
864
+ this.doQuery()
865
+ })
762
866
  },
763
867
  selectPart(e) {
764
- this.$refs.hdgrid.selectPart(e);
868
+ this.$refs.hdgrid.selectPart(e)
765
869
  },
766
870
  unSelectPart(e) {
767
871
  this.$refs.hdgrid.selectPart(e, true)
768
- }
872
+ },
769
873
  },
770
-
771
- watch: {}
772
-
874
+ watch: {},
773
875
  }
774
876
  </script>
775
- <style scoped>
776
- </style>