doway-coms 1.1.78 → 1.1.79

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.
@@ -1,119 +1,124 @@
1
1
  <template>
2
- <div :style="{'height':height+'px'}">
3
- <VxeGrid
4
- ref="baseGrid"
5
- border
6
- keep-source
7
- :loading="loading"
8
- auto-resize
9
- :edit-config="{
10
- trigger: 'manual',
11
- mode: 'row',
12
- activeMethod: activeCellMethod,
13
- showStatus: true,
14
- showUpdateStatus: true,
15
- showInsertStatus: true,
16
- showIcon: !showFilter
17
- }"
18
- :filter-config="{
19
- remote: filterRemote
20
- }"
21
- :toolbar-config="toolBarConfig"
22
- :menu-config="menuConfig"
23
- @menu-click="contextMenuClickEvent"
24
- @filter-change="filterChange"
25
- :footer-method="footerMethod"
26
- @cell-click="cellClick"
27
- resizable
28
- :show-overflow="showOverFlow"
29
- :show-header-overflow="showHeaderOverflow"
30
- show-footer-overflow
31
- highlight-current-row
32
- highlight-hover-row
33
- :span-method="rowspanMethod"
34
- @current-change="currentChange"
35
- @sort-change="sortChange"
36
- @cellValueChange="cellValueChange"
37
- @operationButtonClick="operationButtonClick"
38
- @preSearch="preSearch"
39
- @pulldownBtnClick="pulldownBtnClick"
40
- @pulldownMultiSelect="pulldownMultiSelect"
41
- :edit-rules="validRules"
42
- :tree-config="treeConfig"
43
- @resizable-change="resizableChange"
44
- :checkbox-config="checkboxConfig"
45
- :expand-config="expandConfig"
46
- @edit-closed="editClosedEvent"
47
- @edit-actived="editActived"
48
- @filter-visible="filterVisible"
49
- :sort-config="{
50
- multiple: true,
51
- remote: sortRemote,
52
- chronological: true,
53
- defaultSort: defaultSort
54
- }"
55
- @checkbox-all="checkBoxAllChanged"
56
- @checkbox-change="checkBoxChanged"
57
- :cell-class-name="cellClassName"
58
- :row-style="rowStyle"
59
- :size="'mini'"
60
- :data="rows"
61
- :columns="internalColumns"
62
- class="base-grid-view"
63
- :height="'auto'"
64
- :show-footer="showFooter"
65
- @scroll="bodyScroll"
66
- >
2
+ <div :style="{ height: height + 'px' }">
3
+ <VxeGrid
4
+ ref="baseGrid"
5
+ border
6
+ keep-source
7
+ :loading="loading"
8
+ auto-resize
9
+ :edit-config="{
10
+ trigger: 'manual',
11
+ mode: 'row',
12
+ activeMethod: activeCellMethod,
13
+ showStatus: true,
14
+ showUpdateStatus: true,
15
+ showInsertStatus: true,
16
+ showIcon: !showFilter,
17
+ }"
18
+ :filter-config="{
19
+ remote: filterRemote,
20
+ }"
21
+ :toolbar-config="toolBarConfig"
22
+ :menu-config="menuConfig"
23
+ @menu-click="contextMenuClickEvent"
24
+ @filter-change="filterChange"
25
+ :footer-method="footerMethod"
26
+ @cell-click="cellClick"
27
+ resizable
28
+ :show-overflow="showOverFlow"
29
+ :show-header-overflow="showHeaderOverflow"
30
+ show-footer-overflow
31
+ highlight-current-row
32
+ highlight-hover-row
33
+ :span-method="rowspanMethod"
34
+ @current-change="currentChange"
35
+ @sort-change="sortChange"
36
+ @cellValueChange="cellValueChange"
37
+ @operationButtonClick="operationButtonClick"
38
+ @preSearch="preSearch"
39
+ @pulldownBtnClick="pulldownBtnClick"
40
+ @pulldownMultiSelect="pulldownMultiSelect"
41
+ :edit-rules="validRules"
42
+ :tree-config="treeConfig"
43
+ @resizable-change="resizableChange"
44
+ :checkbox-config="checkboxConfig"
45
+ :expand-config="expandConfig"
46
+ @edit-closed="editClosedEvent"
47
+ @edit-actived="editActived"
48
+ @filter-visible="filterVisible"
49
+ :sort-config="{
50
+ multiple: true,
51
+ remote: sortRemote,
52
+ chronological: true,
53
+ defaultSort: defaultSort,
54
+ }"
55
+ @checkbox-all="checkBoxAllChanged"
56
+ @checkbox-change="checkBoxChanged"
57
+ :cell-class-name="cellClassName"
58
+ :row-style="rowStyle"
59
+ :size="'mini'"
60
+ :data="rows"
61
+ :columns="internalColumns"
62
+ class="base-grid-view"
63
+ :height="'auto'"
64
+ :show-footer="showFooter"
65
+ @scroll="bodyScroll"
66
+ >
67
67
  <template #toolbar_buttons>
68
- <div
69
- ><span v-for="loopFilterStr in filterStr" :key="loopFilterStr.field">
68
+ <div>
69
+ <span v-for="loopFilterStr in filterStr" :key="loopFilterStr.field">
70
70
  {{ loopFilterStr.title }} {{ loopFilterStr.exp }} 并且</span
71
71
  >
72
72
  </div>
73
73
  </template>
74
- <template #seqHeader>
75
- <div
76
- @click="clickHeader"
77
- v-if="moduleCode && dataCode"
78
- style="color: #219bff"
79
- >
80
- <a-icon type="ordered-list" style="font-size: 25px;cursor:pointer" />
81
- </div>
82
- </template>
83
- <template #empty>
84
- <span v-if="emptyText">{{ emptyText }}</span>
85
- <a-empty v-else size="small" />
86
- </template>
74
+ <template #seqHeader>
75
+ <div
76
+ @click="clickHeader"
77
+ v-if="moduleCode && dataCode"
78
+ style="color: #219bff"
79
+ >
80
+ <a-icon
81
+ type="ordered-list"
82
+ style="font-size: 25px; cursor: pointer"
83
+ />
84
+ </div>
85
+ </template>
86
+ <template #empty>
87
+ <span v-if="emptyText">{{ emptyText }}</span>
88
+ <a-empty v-else size="small" />
89
+ </template>
87
90
 
88
- <template #default="scope">
89
- <div v-if="scope.column.params" class="grid-valid-display">
90
- <!-- {{ scope.row[scope.column.field] }} -->
91
- {{gridDefaultValueDisplay(scope.row,scope.column)}}
92
- <!-- {{ defaultValueDisplay(scope.row, scope.column) }} -->
93
- </div>
94
- </template>
91
+ <template #default="scope">
92
+ <div v-if="scope.column.params" class="grid-valid-display">
93
+ <!-- {{ scope.row[scope.column.field] }} -->
94
+ {{ gridDefaultValueDisplay(scope.row, scope.column) }}
95
+ <!-- {{ defaultValueDisplay(scope.row, scope.column) }} -->
96
+ </div>
97
+ </template>
95
98
 
96
- <template #text_edit="scope">
97
- <div class="interceptor-class">
98
- <a-input
99
- class="inner-cell-control"
100
- size="small"
101
- v-model="scope.row[scope.column.property]"
102
- @change="cellValueChange(scope)"
103
- type="text"
104
- />
105
- </div>
106
- </template>
107
- <template #checkbox_edit="scope">
108
- <div class="interceptor-class">
109
- <a-checkbox class="inner-cell-control"
110
- size="small"
111
- @change="cellValueChange(scope)"
112
- v-model="scope.row[scope.column.property]" />
99
+ <template #text_edit="scope">
100
+ <div class="interceptor-class">
101
+ <a-input
102
+ class="inner-cell-control"
103
+ size="small"
104
+ v-model="scope.row[scope.column.property]"
105
+ @change="cellValueChange(scope)"
106
+ type="text"
107
+ />
108
+ </div>
109
+ </template>
110
+ <template #checkbox_edit="scope">
111
+ <div class="interceptor-class">
112
+ <a-checkbox
113
+ class="inner-cell-control"
114
+ size="small"
115
+ @change="cellValueChange(scope)"
116
+ v-model="scope.row[scope.column.property]"
117
+ />
113
118
  </div>
114
- </template>
115
- <template #number_edit="scope">
116
- <div class="interceptor-class">
119
+ </template>
120
+ <template #number_edit="scope">
121
+ <div class="interceptor-class">
117
122
  <a-input-number
118
123
  class="inner-cell-control"
119
124
  size="small"
@@ -123,55 +128,64 @@
123
128
  :max="scope.column.numberMax"
124
129
  />
125
130
  </div>
126
- </template>
127
- <template #date_edit="scope" >
128
- <div class="interceptor-class">
129
- <a-date-picker v-model="scope.row[scope.column.property]"
131
+ </template>
132
+ <template #date_edit="scope">
133
+ <div class="interceptor-class">
134
+ <a-date-picker
135
+ v-model="scope.row[scope.column.property]"
130
136
  class="inner-cell-control"
131
137
  size="small"
132
138
  @change="cellValueChange(scope)"
133
- value-format="YYYY-MM-DD" />
134
- </div>
135
- </template>
136
- <template #datetime_edit="scope" >
137
- <div class="interceptor-class">
138
- <a-date-picker v-model="scope.row[scope.column.property]"
139
+ value-format="YYYY-MM-DD"
140
+ />
141
+ </div>
142
+ </template>
143
+ <template #datetime_edit="scope">
144
+ <div class="interceptor-class">
145
+ <a-date-picker
146
+ v-model="scope.row[scope.column.property]"
139
147
  format="YYYY-MM-DD HH:mm:ss"
140
148
  size="small"
141
149
  value-format="YYYY-MM-DD HH:mm:ss"
142
150
  class="inner-cell-control"
143
151
  :showTime="true"
144
- @change="cellValueChange(scope)"/>
145
- </div>
146
- </template>
147
- <template #select_edit="scope">
148
- <div class="interceptor-class">
149
- <a-select v-model="scope.row[scope.column.property]"
150
152
  @change="cellValueChange(scope)"
151
- size="small" class="inner-cell-control">
152
- <a-select-option
153
- v-for="loopSource in scope.column.params.dataSource"
154
- :key="loopSource.value"
155
- :value="loopSource.value"
156
- >{{ loopSource.caption }}</a-select-option
157
- >
158
- </a-select>
159
- </div>
160
- </template>
161
- <template #time_edit="scope" class="interceptor-class">
162
- <div class="interceptor-class">
163
- <a-time-picker v-model="scope.row[scope.column.property]"
153
+ />
154
+ </div>
155
+ </template>
156
+ <template #select_edit="scope">
157
+ <div class="interceptor-class">
158
+ <a-select
159
+ v-model="scope.row[scope.column.property]"
160
+ @change="cellValueChange(scope)"
161
+ size="small"
162
+ class="inner-cell-control"
163
+ >
164
+ <a-select-option
165
+ v-for="loopSource in scope.column.params.dataSource"
166
+ :key="loopSource.value"
167
+ :value="loopSource.value"
168
+ >{{ loopSource.caption }}</a-select-option
169
+ >
170
+ </a-select>
171
+ </div>
172
+ </template>
173
+ <template #time_edit="scope" class="interceptor-class">
174
+ <div class="interceptor-class">
175
+ <a-time-picker
176
+ v-model="scope.row[scope.column.property]"
164
177
  format="HH:mm:ss"
165
178
  value-format="HH:mm:ss"
166
179
  size="small"
167
180
  class="inner-cell-control"
168
- @change="cellValueChange(scope)"/>
169
- </div>
170
- </template>
181
+ @change="cellValueChange(scope)"
182
+ />
183
+ </div>
184
+ </template>
171
185
 
172
- <template #pulldown_edit="scope" class="interceptor-class">
173
- <div class="interceptor-class">
174
- <BasePulldown
186
+ <template #pulldown_edit="scope" class="interceptor-class">
187
+ <div class="interceptor-class">
188
+ <BasePulldown
175
189
  v-model="scope.row[scope.column.property]"
176
190
  :field="scope.column.property"
177
191
  :formRow="formRow"
@@ -188,126 +202,164 @@
188
202
  :optBtns="scope.column.params.optBtns"
189
203
  :popupAddName="scope.column.params.popupAddName"
190
204
  :popupAddPath="scope.column.params.popupAddPath"
191
- @pre-search="(searchInfo)=>preSearch(searchInfo , scope)"
205
+ @pre-search="(searchInfo) => preSearch(searchInfo, scope)"
192
206
  @select-changed="cellValueChange(scope)"
193
207
  @confirm-multi-select="
194
- (pulldownView, selectRows) => pulldownMultiSelect(scope, pulldownView, selectRows)
208
+ (pulldownView, selectRows) =>
209
+ pulldownMultiSelect(scope, pulldownView, selectRows)
195
210
  "
196
211
  @pulldown-btn-click="pulldownBtnClick"
197
- />
198
- </div>
199
- </template>
200
-
212
+ />
213
+ </div>
214
+ </template>
201
215
 
202
- <template #expandContent="{ row, column, $table }">
203
- <slot name="expandContent" :item="{ row, column, $table }"></slot>
204
- </template>
205
- <template #expandDefault="{ row, column }">
206
- <slot name="expandDefault" :item="{ row, column }"></slot>
207
- </template>
208
- <template #linkCell="{ row, column }">
209
- <span
216
+ <template #expandContent="{ row, column, $table }">
217
+ <slot name="expandContent" :item="{ row, column, $table }"></slot>
218
+ </template>
219
+ <template #expandDefault="{ row, column }">
220
+ <slot name="expandDefault" :item="{ row, column }"></slot>
221
+ </template>
222
+ <template #linkCell="{ row, column }">
223
+ <span
210
224
  ><a>{{ row[column.property] }}</a></span
225
+ >
226
+ </template>
227
+ <template #operation_edit="scope">
228
+ <div class="interceptor-class">
229
+ <a-button
230
+ type="link"
231
+ @click="operationButtonClick(item, scope)"
232
+ v-show="
233
+ item.visible === true &&
234
+ !(scope.row['sysOperationDisVisible_' + item.field] === true)
235
+ "
236
+ v-for="item in scope.column.params.columns"
237
+ :key="item.field"
211
238
  >
212
- </template>
213
- <template #operation_edit="scope">
214
- <div class="interceptor-class">
215
- <a-button type="link" @click="operationButtonClick(item,scope)"
216
- v-show="item.visible === true && !(scope.row['sysOperationDisVisible_' + item.field] === true)"
217
- v-for="item in scope.column.params.columns" :key="item.field">
218
- {{item.title}}
219
- </a-button>
239
+ {{ item.title }}
240
+ </a-button>
220
241
  </div>
221
- </template>
222
- <template #customCell="{ row, column }">
223
- <slot name="customCell" :item="{ row, column }"></slot>
224
- </template>
225
- <template #customRadio="{ row, checked }">
226
- <slot name="customRadio" :item="{ row, checked }"></slot>
227
- </template>
228
- <template #customFooter="{ column, items, _columnIndex }">
229
- <slot
230
- name="customFooter"
231
- :item="{ column, items, _columnIndex }"
232
- ></slot>
233
- </template>
234
- <template #pager v-if="pager && !pager.notShow">
235
- <a-row>
236
- <a-col :span="12" style="text-align: left; padding: 10px">
237
- <a-space>
238
- <template v-for="loopPagerBtn in pager.buttons">
239
- <a-button
240
- :key="loopPagerBtn.field"
241
- v-if="loopPagerBtn.visible"
242
- type="primary"
243
- size="small"
244
- :disabled="loopPagerBtn.edit === false"
245
- @click="pagerBtnClick(loopPagerBtn)"
242
+ </template>
243
+ <template #customCell="{ row, column }">
244
+ <slot name="customCell" :item="{ row, column }"></slot>
245
+ </template>
246
+ <template #customRadio="{ row, checked }">
247
+ <slot name="customRadio" :item="{ row, checked }"></slot>
248
+ </template>
249
+ <template #customFooter="{ column, items, _columnIndex }">
250
+ <slot
251
+ name="customFooter"
252
+ :item="{ column, items, _columnIndex }"
253
+ ></slot>
254
+ </template>
255
+ <template #pager v-if="pager && !pager.notShow">
256
+ <a-row>
257
+ <a-col :span="12" style="text-align: left; padding: 10px">
258
+ <a-space>
259
+ <template v-for="loopPagerBtn in pager.buttons">
260
+ <a-button
261
+ :key="loopPagerBtn.field"
262
+ v-if="loopPagerBtn.visible"
263
+ type="primary"
264
+ size="small"
265
+ :disabled="loopPagerBtn.edit === false"
266
+ @click="pagerBtnClick(loopPagerBtn)"
246
267
  >{{ loopPagerBtn.title }}</a-button
247
- >
248
- </template>
249
- </a-space>
250
- </a-col>
251
- <a-col :span="12" style="text-align: right">
252
- <BasePagination
253
- v-if="pager.size"
254
- :totalRows="pager.totalRows"
255
- :pageSize="pager.size"
256
- :currentPage="pager.current"
257
- @pageChange="pageChange"
258
- @pageSizeChange="pageSizeChange"
259
- :pageSizeOptions="pager.sizeOptions"
260
- />
261
- </a-col>
262
- </a-row>
263
- </template>
264
-
265
- <!-- 筛选过滤 -->
266
- <template #text_filter="scope">
267
- <div class="interceptor-class">
268
- <div
269
- :class="scope.column.field + '_filter_' + $index"
270
- v-for="(loopFilterValue, $index) in scope.column.filters[0].data.displayValues"
271
- :key="$index"
272
- >
273
- <a-input allowClear v-model="loopFilterValue.value[0]" />
274
- </div>
275
- <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
276
- <a-button @click="filterConfirm(scope.column)">确认</a-button>
268
+ >
269
+ </template>
270
+ </a-space>
271
+ </a-col>
272
+ <a-col :span="12" style="text-align: right">
273
+ <BasePagination
274
+ v-if="pager.size"
275
+ :totalRows="pager.totalRows"
276
+ :pageSize="pager.size"
277
+ :currentPage="pager.current"
278
+ @pageChange="pageChange"
279
+ @pageSizeChange="pageSizeChange"
280
+ :pageSizeOptions="pager.sizeOptions"
281
+ />
282
+ </a-col>
283
+ </a-row>
284
+ </template>
285
+
286
+ <!-- 筛选过滤 -->
287
+ <template #text_filter="scope">
288
+ <div class="interceptor-class">
289
+ <div
290
+ :class="scope.column.field + '_filter_' + $index"
291
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
292
+ .displayValues"
293
+ :key="$index"
294
+ >
295
+ <a-input allowClear v-model="loopFilterValue.value[0]" />
296
+ </div>
297
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
298
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
277
299
  </div>
278
- </template>
279
- <template #select_filter="scope">
280
- <div class="interceptor-class">
281
- <a-checkbox-group v-model="scope.column.filters[0].data.displayValues">
282
- <a-checkbox
283
- v-for="loopData in scope.column.params.dataSource"
284
- :key="loopData.value"
285
- :value="loopData.value"
286
- >
287
- {{ loopData.caption }}</a-checkbox
288
- >
289
- </a-checkbox-group>
290
- <a-button @click="filterConfirm(scope.column)">确认</a-button>
300
+ </template>
301
+ <template #number_filter="scope">
302
+ <div class="interceptor-class">
303
+ <div
304
+ :class="scope.column.field + '_filter_' + $index"
305
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
306
+ .displayValues"
307
+ :key="$index"
308
+ >
309
+ <a-input-number
310
+ style="width: 100%"
311
+ v-model:value="loopFilterValue.value[0]"
312
+ ></a-input-number>
291
313
  </div>
314
+ <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
315
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
316
+ </div>
317
+ </template>
318
+ <template #select_filter="scope">
319
+ <div class="interceptor-class">
320
+ <a-checkbox-group
321
+ v-model="scope.column.filters[0].data.displayValues"
322
+ >
323
+ <a-checkbox
324
+ v-for="loopData in scope.column.params.dataSource"
325
+ :key="loopData.value"
326
+ :value="loopData.value"
327
+ >
328
+ {{ loopData.caption }}</a-checkbox
329
+ >
330
+ </a-checkbox-group>
331
+ <a-button @click="filterConfirm(scope.column)">确认</a-button>
332
+ </div>
292
333
  </template>
293
334
  <template #datetime_filter="scope">
294
335
  <div class="interceptor-class">
295
336
  <div
296
337
  :class="scope.column.field + '_filter_' + $index"
297
- v-for="(loopFilterValue, $index) in scope.column.filters[0].data.displayValues"
338
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
339
+ .displayValues"
298
340
  :key="$index"
299
341
  >
300
342
  <a-date-picker
301
343
  valueFormat="YYYY-MM-DD HH:mm:ss"
302
344
  format="YYYY-MM-DD HH:mm:ss"
303
- :show-time="{ defaultValue: moment('2000-01-01 00:00:00', 'YYYY-MM-DD HH:mm:ss') }"
345
+ :show-time="{
346
+ defaultValue: moment(
347
+ '2000-01-01 00:00:00',
348
+ 'YYYY-MM-DD HH:mm:ss'
349
+ ),
350
+ }"
304
351
  placeholder="开始时间"
305
352
  v-model="loopFilterValue.value[0]"
306
353
  />
307
354
  <a-date-picker
308
355
  valueFormat="YYYY-MM-DD HH:mm:ss"
309
356
  format="YYYY-MM-DD HH:mm:ss"
310
- :show-time="{ defaultValue: moment('2000-01-01 23:59:59', 'YYYY-MM-DD HH:mm:ss') }"
357
+ :show-time="{
358
+ defaultValue: moment(
359
+ '2000-01-01 23:59:59',
360
+ 'YYYY-MM-DD HH:mm:ss'
361
+ ),
362
+ }"
311
363
  placeholder="结束时间"
312
364
  v-model="loopFilterValue.value[1]"
313
365
  />
@@ -320,7 +372,8 @@
320
372
  <div class="interceptor-class">
321
373
  <div
322
374
  :class="scope.column.field + '_filter_' + $index"
323
- v-for="(loopFilterValue, $index) in scope.column.filters[0].data.displayValues"
375
+ v-for="(loopFilterValue, $index) in scope.column.filters[0].data
376
+ .displayValues"
324
377
  :key="$index"
325
378
  >
326
379
  <a-date-picker
@@ -340,917 +393,930 @@
340
393
  <a-button @click="filterAddExp(scope.column)">添加条件</a-button>
341
394
  <a-button @click="filterConfirm(scope.column)">确认</a-button>
342
395
  </template>
343
- </VxeGrid>
344
- <VxeModal
345
- v-model="showGridColumnUserDefine"
346
- title="表格布局设置"
347
- width="70%"
348
- height="70%"
349
- show-zoom
350
- transfer
351
- resize
352
- :zIndex="15"
353
- show-footer
354
- destroy-on-close
355
- >
356
- <BaseGridAdjust
357
- :userDefineColumns="userDefineColumns"
358
- ref="baseAdjustGridView"
359
- ></BaseGridAdjust>
360
- <template #footer>
361
- <a-button
362
- type="primary"
363
- :size="'small'"
364
- @click="confirmUserDefineColumn"
365
- >
366
- 确认
367
- </a-button>
368
- </template>
369
- </VxeModal>
370
- </div>
396
+ </VxeGrid>
397
+ <VxeModal
398
+ v-model="showGridColumnUserDefine"
399
+ title="表格布局设置"
400
+ width="70%"
401
+ height="70%"
402
+ show-zoom
403
+ transfer
404
+ resize
405
+ :zIndex="15"
406
+ show-footer
407
+ destroy-on-close
408
+ >
409
+ <BaseGridAdjust
410
+ :userDefineColumns="userDefineColumns"
411
+ ref="baseAdjustGridView"
412
+ ></BaseGridAdjust>
413
+ <template #footer>
414
+ <a-button
415
+ type="primary"
416
+ :size="'small'"
417
+ @click="confirmUserDefineColumn"
418
+ >
419
+ 确认
420
+ </a-button>
421
+ </template>
422
+ </VxeModal>
423
+ </div>
371
424
  </template>
372
425
  <script>
373
- //轻量级剪贴板复制函数
374
- import XEClipboard from 'xe-clipboard'
375
- //引入全局文件
376
- import { controlType } from '../../utils/enum'
377
- //日期处理类库
378
- import moment from 'moment'
379
- //拖拽排序功能
380
- //辅助函数 将store 中的 getter 映射到局部计算属性
381
- import { mapGetters } from 'vuex'
382
- //xe-utils提供了一套实用的基础函数、任意格式的日期转换函数,浏览器相关操作函数等,详细使用百度
383
- import XEUtils from 'xe-utils'
384
- //VXETable插件
385
- import VXETable from 'vxe-table'
386
- //ant的空状态展示占位图
387
- import { Empty,Row,Col,Space,Input,Select,DatePicker,Checkbox,InputNumber,TimePicker,Button } from 'ant-design-vue'
388
- import BasePagination from '../../BasePagination/index'
389
- import BasePulldown from '../../BasePulldown/index'
390
- import BaseGridAdjust from '../../BaseGridAdjust/index'
391
- import { saveUserModuleDataFieldApi } from '../../utils/api'
392
- import {gridDefaultValueDisplay } from '../../utils/filters'
393
- export default {
394
- name: 'BaseGrid',
395
- components: {
396
- 'a-empty':Empty,
397
- 'a-row':Row,
398
- 'a-col':Col,
399
- 'a-space':Space,
400
- 'a-input':Input,
401
- 'a-select':Select,
402
- 'a-select-option':Select.Option,
403
- 'a-date-picker':DatePicker,
404
- 'a-checkbox':Checkbox,
405
- 'a-input-number':InputNumber,
406
- 'a-time-picker':TimePicker,
407
- 'a-button':Button,
408
- BasePagination,
409
- BasePulldown,
410
- BaseGridAdjust
411
- },
412
- data() {
413
- return {
414
- gridDefaultValueDisplay:gridDefaultValueDisplay,
415
- // gridOptions:{
416
- // border:true,
417
- // stripe:true,
418
- // columns:[
419
- //
420
- // ]
421
- // },
422
- showFooter: false,
423
- showGridColumnUserDefine: false,
424
- userDefineColumns: [],
425
- loading: false,
426
- internalCols: {},
427
- moment,
428
- internalColumns: [],
429
- gridEdit: false,
430
- addBtnEdit: true,
431
- validRules: {},
432
- footerSum: [],
433
- mergeFields: [],
434
- simpleImage: null,
435
- dragOptions: {
436
- animation: 0,
437
- group: 'description',
438
- disabled: false,
439
- ghostClass: 'ghost'
440
- },
441
- menuConfig: {
442
- header: {
443
- options: [
444
- [
445
- {
446
- code: 'clearFilter',
447
- name: '清空筛选',
448
- visible: true,
449
- disabled: false
450
- }
451
- ]
452
- ]
453
- },
454
- body: {
455
- options: [
456
- [
457
- {
458
- code: 'refresh',
459
- name: '刷新',
460
- visible: true
461
- },
462
- {
463
- code: 'copy',
464
- name: '复制',
465
- visible: true,
466
- disabled: false
467
- },
468
- {
469
- code: 'sort',
470
- name: '排序',
471
- prefixIcon: 'fa fa-sort color-blue',
472
- children: [
473
- { code: 'clearSort', name: '清除排序' },
474
- {
475
- code: 'asc',
476
- name: '升序',
477
- prefixIcon: 'fa fa-sort-alpha-asc color-orange'
478
- },
479
- {
480
- code: 'desc',
481
- name: '倒序',
482
- prefixIcon: 'fa fa-sort-alpha-desc color-orange'
483
- }
484
- ]
485
- }
486
- ]
487
- ]
488
- }
489
- // body:{
490
- // options: [
491
- // [
492
- // { code: 'clearFilter', name: '清除所有筛选', visible: true, disabled: false }
493
- // ]
494
- // ]
495
- // }
426
+ //轻量级剪贴板复制函数
427
+ import XEClipboard from "xe-clipboard";
428
+ //引入全局文件
429
+ import { controlType } from "../../utils/enum";
430
+ //日期处理类库
431
+ import moment from "moment";
432
+ //拖拽排序功能
433
+ //辅助函数 将store 中的 getter 映射到局部计算属性
434
+ import { mapGetters } from "vuex";
435
+ //xe-utils提供了一套实用的基础函数、任意格式的日期转换函数,浏览器相关操作函数等,详细使用百度
436
+ import XEUtils from "xe-utils";
437
+ //VXETable插件
438
+ import VXETable from "vxe-table";
439
+ //ant的空状态展示占位图
440
+ import {
441
+ Empty,
442
+ Row,
443
+ Col,
444
+ Space,
445
+ Input,
446
+ Select,
447
+ DatePicker,
448
+ Checkbox,
449
+ InputNumber,
450
+ TimePicker,
451
+ Button,
452
+ } from "ant-design-vue";
453
+ import BasePagination from "../../BasePagination/index";
454
+ import BasePulldown from "../../BasePulldown/index";
455
+ import BaseGridAdjust from "../../BaseGridAdjust/index";
456
+ import { saveUserModuleDataFieldApi } from "../../utils/api";
457
+ import { gridDefaultValueDisplay } from "../../utils/filters";
458
+ export default {
459
+ name: "BaseGrid",
460
+ components: {
461
+ "a-empty": Empty,
462
+ "a-row": Row,
463
+ "a-col": Col,
464
+ "a-space": Space,
465
+ "a-input": Input,
466
+ "a-select": Select,
467
+ "a-select-option": Select.Option,
468
+ "a-date-picker": DatePicker,
469
+ "a-checkbox": Checkbox,
470
+ "a-input-number": InputNumber,
471
+ "a-time-picker": TimePicker,
472
+ "a-button": Button,
473
+ BasePagination,
474
+ BasePulldown,
475
+ BaseGridAdjust,
476
+ },
477
+ data() {
478
+ return {
479
+ gridDefaultValueDisplay: gridDefaultValueDisplay,
480
+ // gridOptions:{
481
+ // border:true,
482
+ // stripe:true,
483
+ // columns:[
484
+ //
485
+ // ]
486
+ // },
487
+ showFooter: false,
488
+ showGridColumnUserDefine: false,
489
+ userDefineColumns: [],
490
+ loading: false,
491
+ internalCols: {},
492
+ moment,
493
+ internalColumns: [],
494
+ gridEdit: false,
495
+ addBtnEdit: true,
496
+ validRules: {},
497
+ footerSum: [],
498
+ mergeFields: [],
499
+ simpleImage: null,
500
+ dragOptions: {
501
+ animation: 0,
502
+ group: "description",
503
+ disabled: false,
504
+ ghostClass: "ghost",
505
+ },
506
+ menuConfig: {
507
+ header: {
508
+ options: [
509
+ [
510
+ {
511
+ code: "clearFilter",
512
+ name: "清空筛选",
513
+ visible: true,
514
+ disabled: false,
515
+ },
516
+ ],
517
+ ],
496
518
  },
497
- toolBarConfig:{
498
- custom: true,
499
- slots: { buttons: 'toolbar_buttons' },
500
- enabled: false,
519
+ body: {
520
+ options: [
521
+ [
522
+ {
523
+ code: "refresh",
524
+ name: "刷新",
525
+ visible: true,
526
+ },
527
+ {
528
+ code: "copy",
529
+ name: "复制",
530
+ visible: true,
531
+ disabled: false,
532
+ },
533
+ {
534
+ code: "sort",
535
+ name: "排序",
536
+ prefixIcon: "fa fa-sort color-blue",
537
+ children: [
538
+ { code: "clearSort", name: "清除排序" },
539
+ {
540
+ code: "asc",
541
+ name: "升序",
542
+ prefixIcon: "fa fa-sort-alpha-asc color-orange",
543
+ },
544
+ {
545
+ code: "desc",
546
+ name: "倒序",
547
+ prefixIcon: "fa fa-sort-alpha-desc color-orange",
548
+ },
549
+ ],
550
+ },
551
+ ],
552
+ ],
501
553
  },
502
- filterExpression:[],
503
- filterStr:[]
504
- }
505
- },
506
- computed: {
507
- //使用对象展开运算符 将 getter 混入 computer 对象中
508
- ...mapGetters(['controlSize'])
509
- },
510
- filters: {
511
- displayText: function(row, column) {
512
- if (column.params.controlType === 'select') {
513
- let tempItem = XEUtils.find(
514
- column.params.dataSource,
515
- p => p.value === row[column.property]
516
- )
517
- // let tempItems = column.params.dataSource.filter(filterItem => {
518
- // return filterItem.value === row[column.property]
519
- // })
520
- if (tempItem) {
521
- return tempItem.caption
522
- } else {
523
- return row[column.property]
524
- }
554
+ // body:{
555
+ // options: [
556
+ // [
557
+ // { code: 'clearFilter', name: '清除所有筛选', visible: true, disabled: false }
558
+ // ]
559
+ // ]
560
+ // }
561
+ },
562
+ toolBarConfig: {
563
+ custom: true,
564
+ slots: { buttons: "toolbar_buttons" },
565
+ enabled: false,
566
+ },
567
+ filterExpression: [],
568
+ filterStr: [],
569
+ };
570
+ },
571
+ computed: {
572
+ //使用对象展开运算符 getter 混入 computer 对象中
573
+ ...mapGetters(["controlSize"]),
574
+ },
575
+ filters: {
576
+ displayText: function (row, column) {
577
+ if (column.params.controlType === "select") {
578
+ let tempItem = XEUtils.find(
579
+ column.params.dataSource,
580
+ (p) => p.value === row[column.property]
581
+ );
582
+ // let tempItems = column.params.dataSource.filter(filterItem => {
583
+ // return filterItem.value === row[column.property]
584
+ // })
585
+ if (tempItem) {
586
+ return tempItem.caption;
587
+ } else {
588
+ return row[column.property];
525
589
  }
526
-
527
- let linkField = column.property.split('.')
528
- if (linkField.length > 1) {
529
- let fieldValue = row
530
- for (let i = 0; i < linkField.length; i++) {
531
- if (
532
- fieldValue[linkField[i]] === undefined ||
533
- fieldValue[linkField[i]] === null
534
- ) {
535
- return null
536
- }
537
- fieldValue = fieldValue[linkField[i]]
590
+ }
591
+
592
+ let linkField = column.property.split(".");
593
+ if (linkField.length > 1) {
594
+ let fieldValue = row;
595
+ for (let i = 0; i < linkField.length; i++) {
596
+ if (
597
+ fieldValue[linkField[i]] === undefined ||
598
+ fieldValue[linkField[i]] === null
599
+ ) {
600
+ return null;
538
601
  }
539
- return fieldValue
602
+ fieldValue = fieldValue[linkField[i]];
540
603
  }
541
- if (column.params.controlType === 'checkbox') {
542
- return row[column.property] === true ? '是' : '否'
543
- }
544
-
545
- if (column.params.displayField) {
546
- return row[column.params.displayField]
547
- }
548
- return row[column.property]
604
+ return fieldValue;
605
+ }
606
+ if (column.params.controlType === "checkbox") {
607
+ return row[column.property] === true ? "是" : "否";
549
608
  }
609
+
610
+ if (column.params.displayField) {
611
+ return row[column.params.displayField];
612
+ }
613
+ return row[column.property];
550
614
  },
551
- props: {
552
- showOverFlow: {
553
- type: Boolean,
554
- default: true
615
+ },
616
+ props: {
617
+ showOverFlow: {
618
+ type: Boolean,
619
+ default: true,
620
+ },
621
+ defaultSort: {
622
+ type: Object,
623
+ default: function () {
624
+ return {};
555
625
  },
556
- defaultSort: {
557
- type: Object,
558
- default: function() {
559
- return {}
560
- }
626
+ },
627
+ showFilter: {
628
+ type: Boolean,
629
+ default: true,
630
+ },
631
+ showHeaderOverflow: {
632
+ type: Boolean,
633
+ default: true,
634
+ },
635
+ cellClassName: {
636
+ type: Function,
637
+ default: null,
638
+ },
639
+ sortRemote: {
640
+ type: Boolean,
641
+ default: () => {
642
+ return true;
561
643
  },
562
- showFilter: {
563
- type: Boolean,
564
- default: true
644
+ },
645
+ //筛选判断是否远程
646
+ filterRemote: {
647
+ type: Boolean,
648
+ default: () => {
649
+ return false;
565
650
  },
566
- showHeaderOverflow: {
567
- type: Boolean,
568
- default: true
651
+ },
652
+ checkboxConfig: {
653
+ type: Object,
654
+ default: () => {
655
+ return null;
569
656
  },
570
- cellClassName: {
571
- type: Function,
572
- default: null
657
+ deep: true,
658
+ },
659
+ treeConfig: {
660
+ type: Object,
661
+ default: () => {
662
+ return null;
573
663
  },
574
- sortRemote: {
575
- type: Boolean,
576
- default: () => {
577
- return true
578
- }
664
+ deep: true,
665
+ },
666
+ expandConfig: {
667
+ type: Object,
668
+ default: () => {
669
+ return null;
579
670
  },
580
- //筛选判断是否远程
581
- filterRemote: {
582
- type: Boolean,
583
- default: () => {
584
- return false
585
- }
671
+ deep: true,
672
+ },
673
+ rowStyle: {
674
+ type: Function,
675
+ },
676
+ height: {
677
+ default: null,
678
+ },
679
+ pager: {
680
+ type: Object,
681
+ default: () => {
682
+ return null;
586
683
  },
587
- checkboxConfig: {
588
- type: Object,
589
- default: () => {
590
- return null
591
- },
592
- deep: true
684
+ deep: true,
685
+ },
686
+ showSeq: {
687
+ type: Boolean,
688
+ default: () => {
689
+ return true;
593
690
  },
594
- treeConfig: {
595
- type: Object,
596
- default: () => {
597
- return null
598
- },
599
- deep: true
691
+ },
692
+ showMenu: {
693
+ type: Boolean,
694
+ default: () => {
695
+ return true;
600
696
  },
601
- expandConfig: {
602
- type: Object,
603
- default: () => {
604
- return null
605
- },
606
- deep: true
697
+ },
698
+ showExpand: {
699
+ type: Boolean,
700
+ default: () => {
701
+ return false;
607
702
  },
608
- rowStyle: {
609
- type: Function
703
+ },
704
+ isOld: {
705
+ type: Boolean,
706
+ default: () => {
707
+ return false;
610
708
  },
611
- height: {
612
- default: null
709
+ },
710
+ emptyText: {
711
+ type: String,
712
+ default: () => {
713
+ return "";
613
714
  },
614
- pager: {
615
- type: Object,
616
- default: () => {
617
- return null
618
- },
619
- deep: true
715
+ },
716
+ columns: {
717
+ type: Array,
718
+ default: () => {
719
+ return [];
620
720
  },
621
- showSeq: {
622
- type: Boolean,
623
- default: () => {
624
- return true
625
- }
721
+ deep: true,
722
+ },
723
+ editStates: {
724
+ type: Array,
725
+ default: () => {
726
+ return null;
626
727
  },
627
- showMenu: {
628
- type: Boolean,
629
- default: () => {
630
- return true
631
- }
728
+ deep: true,
729
+ },
730
+ edit: {
731
+ type: Boolean,
732
+ default: false,
733
+ },
734
+ formRow: {
735
+ type: Object,
736
+ default: () => {
737
+ return {};
632
738
  },
633
- showExpand: {
634
- type: Boolean,
635
- default: () => {
636
- return false
637
- }
739
+ deep: true,
740
+ },
741
+ editStatuss: {
742
+ type: Array,
743
+ default: () => {
744
+ return null;
638
745
  },
639
- isOld: {
640
- type: Boolean,
641
- default: () => {
642
- return false
643
- }
746
+ deep: true,
747
+ },
748
+ showCheckBox: {
749
+ type: Boolean,
750
+ default: false,
751
+ },
752
+ showRadio: {
753
+ type: Boolean,
754
+ default: false,
755
+ },
756
+ // checkboxConfigReserve: {
757
+ // type: Boolean,
758
+ // default: false
759
+ // },
760
+ dataName: {
761
+ type: String,
762
+ default: "",
763
+ },
764
+ moduleCode: {
765
+ type: String,
766
+ default: "",
767
+ },
768
+ dataCode: {
769
+ type: String,
770
+ default: "",
771
+ },
772
+ rows: {
773
+ type: Array,
774
+ default: () => {
775
+ return [];
644
776
  },
645
- emptyText: {
646
- type: String,
647
- default: () => {
648
- return ''
777
+ deep: true,
778
+ },
779
+ },
780
+ beforeCreate() {
781
+ this.simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;
782
+ },
783
+
784
+ created() {
785
+ //拖动后输入框有错位问题,暂时不启用
786
+ // this.initColumnDrop()
787
+
788
+ // this.internalColumns.push({
789
+ // field: 'sysRowState',
790
+ // visible:false,
791
+ // filterMethod:this.sysRowStateFilter,
792
+ // filters:[{label:'筛选删除行',value:'delete',checked:true}]
793
+ // })
794
+ if (this.showSeq) {
795
+ this.internalColumns.push(
796
+ // {
797
+ // children: [
798
+ {
799
+ type: "seq",
800
+ fixed: "left",
801
+ width: 50,
802
+ slots: {
803
+ header: "seqHeader",
804
+ },
805
+ params: {
806
+ disableUserVisible: true,
807
+ },
649
808
  }
650
- },
651
- columns: {
652
- type: Array,
653
- default: () => {
654
- return []
655
- },
656
- deep: true
657
- },
658
- editStates: {
659
- type: Array,
660
- default: () => {
661
- return null
662
- },
663
- deep: true
664
- },
665
- edit: {
666
- type: Boolean,
667
- default: false
668
- },
669
- formRow: {
670
- type: Object,
671
- default: () => {
672
- return {}
673
- },
674
- deep: true
675
- },
676
- editStatuss: {
677
- type: Array,
678
- default: () => {
679
- return null
680
- },
681
- deep: true
682
- },
683
- showCheckBox: {
684
- type: Boolean,
685
- default: false
686
- },
687
- showRadio: {
688
- type: Boolean,
689
- default: false
690
- },
691
- // checkboxConfigReserve: {
692
- // type: Boolean,
693
- // default: false
694
- // },
695
- dataName: {
696
- type: String,
697
- default: ''
698
- },
699
- moduleCode: {
700
- type: String,
701
- default: ''
702
- },
703
- dataCode: {
704
- type: String,
705
- default: ''
706
- },
707
- rows: {
708
- type: Array,
709
- default: () => {
710
- return []
809
+ // ],
810
+ // slots: {
811
+ // header: 'seqHeader'
812
+ // }
813
+ // }
814
+ );
815
+ }
816
+
817
+ if (this.showCheckBox) {
818
+ this.internalColumns.push({
819
+ type: "checkbox",
820
+ fixed: "left",
821
+ width: 40,
822
+ params: {
823
+ disableUserVisible: true,
711
824
  },
712
- deep: true
713
- }
714
- },
715
- beforeCreate() {
716
- this.simpleImage = Empty.PRESENTED_IMAGE_SIMPLE
717
- },
718
-
719
- created() {
720
- //拖动后输入框有错位问题,暂时不启用
721
- // this.initColumnDrop()
722
-
723
- // this.internalColumns.push({
724
- // field: 'sysRowState',
725
- // visible:false,
726
- // filterMethod:this.sysRowStateFilter,
727
- // filters:[{label:'筛选删除行',value:'delete',checked:true}]
728
- // })
729
- if (this.showSeq) {
730
- this.internalColumns.push(
731
- // {
732
- // children: [
733
- {
734
- type: 'seq',
735
- fixed: 'left',
736
- width: 50,
737
- slots: {
738
- header: 'seqHeader'
739
- },
740
- params: {
741
- disableUserVisible: true
742
- }
825
+ });
826
+ }
827
+ for (let i = 0; i < this.columns.length; i++) {
828
+ this.internalColumns.push(this.initColumns(this.columns[i]));
829
+ }
830
+ this.gridEdit = this.edit;
831
+ },
832
+
833
+ mounted() {
834
+ // this.toggleFixedColumn('operation','right')
835
+ //设置默认筛选的到表格
836
+ // let filterCol = this.internalColumns.filter(
837
+ // x =>
838
+ // (x.filters && x.filters.length > 0) ||
839
+ // (x.children &&
840
+ // x.children.length > 0 &&
841
+ // x.children[0].filters &&
842
+ // x.children[0].filters.length > 0)
843
+ // )
844
+ // for (let i = 0; i < filterCol.length; i++) {
845
+ // this.$refs.baseGrid
846
+ // .setFilter(filterCol[i].field, filterCol[i].filters)
847
+ // .then(() => {
848
+ // // if (i == filterCol.length - 1) {
849
+ // // }
850
+ // })
851
+ // }
852
+ },
853
+ methods: {
854
+ getExpTags(filterList) {
855
+ //构造查询条件
856
+ let returnExp = [];
857
+ for (let loopProp in filterList) {
858
+ let tempExpTag = {
859
+ expressions: [],
860
+ operator: "or",
861
+ };
862
+ let tempControlType = filterList[loopProp].column.params.controlType;
863
+ let tempIsAddTime = filterList[loopProp].isAddTime;
864
+ for (let i = 0; i < filterList[loopProp].column.filters.length; i++) {
865
+ let tempValue = filterList[loopProp].column.filters[i];
866
+
867
+ if (tempControlType === controlType.text) {
868
+ // 文本框
869
+ tempExpTag.expressions.push({
870
+ field: filterList[loopProp].property,
871
+ operator: "CO",
872
+ value: tempValue.value,
873
+ });
743
874
  }
744
- // ],
745
- // slots: {
746
- // header: 'seqHeader'
747
- // }
875
+ // if (tempControlType === controlType.date)
876
+ // {
877
+ // //日期
878
+ // if (tempExpTag.value) {
879
+ // tempExpTag.value.push(tempValue.value)
880
+ // } else {
881
+ // tempExpTag.value = [tempValue.value]
882
+ // tempExpTag.operator = 'IN'
883
+ // tempExpTag.field = filterList[loopProp].property
884
+ // }
748
885
  // }
749
- )
750
- }
751
-
752
- if (this.showCheckBox) {
753
- this.internalColumns.push({
754
- type: 'checkbox',
755
- fixed: 'left',
756
- width: 40,
757
- params: {
758
- disableUserVisible: true
886
+ // else
887
+ else if (tempControlType === controlType.number) {
888
+ // 数字范围
889
+ tempExpTag.expressions.push({
890
+ field: filterList[loopProp].property,
891
+ operator: "RA",
892
+ value: [tempValue.value.min, tempValue.value.max],
893
+ });
894
+ } else if (
895
+ tempControlType === controlType.datetime ||
896
+ tempControlType === controlType.date
897
+ ) {
898
+ //日期范围
899
+ // if (tempIsAddTime === true) {
900
+ tempExpTag.expressions.push({
901
+ field: filterList[loopProp].property,
902
+ operator: "RA",
903
+ value: [
904
+ // tempValue.value[0] + ' 00:00:00',
905
+ // tempValue.value[1] + ' 23:59:59'
906
+ tempValue.value[0],
907
+ tempValue.value[1],
908
+ ],
909
+ });
910
+ // } else {
911
+ // tempExpTag.expressions.push({
912
+ // field: filterList[loopProp].property,
913
+ // operator: 'RA',
914
+ // value: tempValue.value
915
+ // })
916
+ // }
917
+ } else if (
918
+ tempControlType === controlType.dropmulti ||
919
+ tempControlType === controlType.select
920
+ ) {
921
+ //下拉多选
922
+ tempExpTag.expressions.push({
923
+ field: filterList[loopProp].property,
924
+ operator: "IN",
925
+ value: filterList[loopProp].datas[0],
926
+ });
927
+ } else if (tempControlType === controlType.checkbox) {
928
+ //实际上checkbox的value数组里就一个值 这边是为了兼容select的结构
929
+ tempExpTag.expressions.push({
930
+ field: filterList[loopProp].property,
931
+ operator: "EQ",
932
+ value: tempValue.value.indexOf("true") >= 0 ? true : false,
933
+ });
934
+ } else {
935
+ // 文本框
936
+ tempExpTag.expressions.push({
937
+ field: filterList[loopProp].property,
938
+ operator: "CO",
939
+ value: tempValue.value,
940
+ });
759
941
  }
760
- })
761
- }
762
- for (let i = 0; i < this.columns.length; i++) {
763
- this.internalColumns.push(this.initColumns(this.columns[i]))
942
+ }
943
+ if (tempExpTag.expressions.length > 0 || tempExpTag.field) {
944
+ returnExp.push(tempExpTag);
945
+ }
764
946
  }
765
- this.gridEdit = this.edit
947
+ return returnExp;
766
948
  },
767
-
768
- mounted() {
769
- // this.toggleFixedColumn('operation','right')
770
- //设置默认筛选的到表格
771
- // let filterCol = this.internalColumns.filter(
772
- // x =>
773
- // (x.filters && x.filters.length > 0) ||
774
- // (x.children &&
775
- // x.children.length > 0 &&
776
- // x.children[0].filters &&
777
- // x.children[0].filters.length > 0)
778
- // )
779
- // for (let i = 0; i < filterCol.length; i++) {
780
- // this.$refs.baseGrid
781
- // .setFilter(filterCol[i].field, filterCol[i].filters)
782
- // .then(() => {
783
- // // if (i == filterCol.length - 1) {
784
- // // }
785
- // })
786
- // }
787
- },
788
- methods: {
789
- getExpTags(filterList) {
790
- //构造查询条件
791
- let returnExp = []
792
- for (let loopProp in filterList) {
793
- let tempExpTag = {
794
- expressions: [],
795
- operator: 'or'
796
- }
797
- let tempControlType = filterList[loopProp].column.params.controlType
798
- let tempIsAddTime = filterList[loopProp].isAddTime
799
- for (let i = 0; i < filterList[loopProp].column.filters.length; i++) {
800
- let tempValue = filterList[loopProp].column.filters[i]
801
-
802
- if (tempControlType === controlType.text) {
803
- // 文本框
804
- tempExpTag.expressions.push({
805
- field: filterList[loopProp].property,
806
- operator: 'CO',
807
- value: tempValue.value
808
- })
809
- }
810
- // if (tempControlType === controlType.date)
811
- // {
812
- // //日期
813
- // if (tempExpTag.value) {
814
- // tempExpTag.value.push(tempValue.value)
815
- // } else {
816
- // tempExpTag.value = [tempValue.value]
817
- // tempExpTag.operator = 'IN'
818
- // tempExpTag.field = filterList[loopProp].property
819
- // }
820
- // }
821
- // else
822
- else if (tempControlType === controlType.number) {
823
- // 数字范围
824
- tempExpTag.expressions.push({
825
- field: filterList[loopProp].property,
826
- operator: 'RA',
827
- value: [tempValue.value.min, tempValue.value.max]
828
- })
829
- } else if (
830
- tempControlType === controlType.datetime ||
831
- tempControlType === controlType.date
832
- ) {
833
- //日期范围
834
- // if (tempIsAddTime === true) {
835
- tempExpTag.expressions.push({
836
- field: filterList[loopProp].property,
837
- operator: 'RA',
838
- value: [
839
- // tempValue.value[0] + ' 00:00:00',
840
- // tempValue.value[1] + ' 23:59:59'
841
- tempValue.value[0],
842
- tempValue.value[1]
843
- ]
844
- })
845
- // } else {
846
- // tempExpTag.expressions.push({
847
- // field: filterList[loopProp].property,
848
- // operator: 'RA',
849
- // value: tempValue.value
850
- // })
851
- // }
852
- } else if (
853
- tempControlType === controlType.dropmulti ||
854
- tempControlType === controlType.select
855
- ) {
856
- //下拉多选
857
- tempExpTag.expressions.push({
858
- field: filterList[loopProp].property,
859
- operator: 'IN',
860
- value: filterList[loopProp].datas[0]
861
- })
862
- } else if (tempControlType === controlType.checkbox) {
863
- //实际上checkbox的value数组里就一个值 这边是为了兼容select的结构
864
- tempExpTag.expressions.push({
865
- field: filterList[loopProp].property,
866
- operator: 'EQ',
867
- value: tempValue.value.indexOf('true') >= 0 ? true : false
868
- })
869
- } else {
870
- // 文本框
871
- tempExpTag.expressions.push({
872
- field: filterList[loopProp].property,
873
- operator: 'CO',
874
- value: tempValue.value
875
- })
876
- }
877
- }
878
- if (tempExpTag.expressions.length > 0 || tempExpTag.field) {
879
- returnExp.push(tempExpTag)
949
+ rangeChange(column) {
950
+ let vm = this;
951
+ if (vm.filterRemote) {
952
+ column.filters.forEach((f) => {
953
+ f.checked = true;
954
+ });
955
+ vm.$refs.baseGrid.setFilter(column.field, column.filters).then(() => {
956
+ this.$emit("filterChange");
957
+ });
958
+ } else {
959
+ const xTable = this.$refs.baseGrid;
960
+ // 设置为选中状态
961
+ for (let i = 0; i < column.filters.length; i++) {
962
+ if (!column.filters[i].value) {
963
+ column.filters[i].checked = false;
964
+ } else {
965
+ column.filters[i].checked = true;
880
966
  }
881
967
  }
882
- return returnExp
883
- },
884
- rangeChange(column) {
885
- let vm = this
886
- if (vm.filterRemote) {
887
- column.filters.forEach(f => {
888
- f.checked = true
889
- })
890
- vm.$refs.baseGrid.setFilter(column.field, column.filters).then(() => {
891
- this.$emit('filterChange')
892
- })
968
+ // 修改条件之后,需要手动调用 updateData 处理表格数据
969
+ xTable.updateData();
970
+ }
971
+ },
972
+ //日期筛选变化
973
+ dateChange(column, dates) {
974
+ let vm = this;
975
+ if (vm.filterRemote) {
976
+ if (dates.length > 0) {
977
+ column.filters[0].checked = true;
978
+ column.filters[0].data.range = dates; //显示的值
979
+ column.filters[0].data.beginDate = dates[0];
980
+ column.filters[0].data.endDate = dates[1];
981
+ vm.$refs.baseGrid.setFilter(column.field, column.filters);
893
982
  } else {
894
- const xTable = this.$refs.baseGrid
895
- // 设置为选中状态
896
- for (let i = 0; i < column.filters.length; i++) {
897
- if (!column.filters[i].value) {
898
- column.filters[i].checked = false
899
- } else {
900
- column.filters[i].checked = true
901
- }
902
- }
903
- // 修改条件之后,需要手动调用 updateData 处理表格数据
904
- xTable.updateData()
983
+ column.filters[0].checked = false;
984
+ column.filters[0].data.range = dates;
985
+ vm.$refs.baseGrid
986
+ .setFilter(column.field, column.filters)
987
+ .then((res) => {
988
+ this.$emit("filterChange");
989
+ });
905
990
  }
906
- },
907
- //日期筛选变化
908
- dateChange(column, dates) {
909
- let vm = this
910
- if (vm.filterRemote) {
911
- if (dates.length > 0) {
912
- column.filters[0].checked = true
913
- column.filters[0].data.range = dates //显示的值
914
- column.filters[0].data.beginDate = dates[0]
915
- column.filters[0].data.endDate = dates[1]
916
- vm.$refs.baseGrid.setFilter(column.field, column.filters)
991
+ } else {
992
+ const xTable = this.$refs.baseGrid;
993
+ // 设置为选中状态
994
+ for (let i = 0; i < column.filters.length; i++) {
995
+ if (!column.filters[i].value) {
996
+ column.filters[i].checked = false;
917
997
  } else {
918
- column.filters[0].checked = false
919
- column.filters[0].data.range = dates
920
- vm.$refs.baseGrid
921
- .setFilter(column.field, column.filters)
922
- .then(res => {
923
- this.$emit('filterChange')
924
- })
998
+ column.filters[i].checked = true;
925
999
  }
926
- } else {
927
- const xTable = this.$refs.baseGrid
928
- // 设置为选中状态
929
- for (let i = 0; i < column.filters.length; i++) {
930
- if (!column.filters[i].value) {
931
- column.filters[i].checked = false
932
- } else {
933
- column.filters[i].checked = true
934
- }
1000
+ }
1001
+ // 修改条件之后,需要手动调用 updateData 处理表格数据
1002
+ xTable.updateData();
1003
+ }
1004
+ },
1005
+ inputChange(column) {
1006
+ let vm = this;
1007
+ if (vm.filterRemote) {
1008
+ for (let i = 0; i < column.filters.length; i++) {
1009
+ if (!column.filters[i].value) {
1010
+ column.filters[i].checked = false;
1011
+ } else {
1012
+ column.filters[i].checked = true;
935
1013
  }
936
- // 修改条件之后,需要手动调用 updateData 处理表格数据
937
- xTable.updateData()
938
1014
  }
939
- },
940
- inputChange(column) {
941
- let vm = this
942
- if (vm.filterRemote) {
943
- for (let i = 0; i < column.filters.length; i++) {
944
- if (!column.filters[i].value) {
945
- column.filters[i].checked = false
946
- } else {
947
- column.filters[i].checked = true
1015
+ vm.$refs.baseGrid
1016
+ .setFilter(column.field, column.filters)
1017
+ .then((res) => {
1018
+ this.$emit("filterChange");
1019
+ });
1020
+ } else {
1021
+ const xTable = this.$refs.baseGrid;
1022
+ // 设置为选中状态
1023
+ for (let i = 0; i < column.filters.length; i++) {
1024
+ if (!column.filters[i].value) {
1025
+ column.filters[i].checked = false;
1026
+ } else {
1027
+ column.filters[i].checked = true;
1028
+ }
1029
+ }
1030
+ // 修改条件之后,需要手动调用 updateData 处理表格数据
1031
+ xTable.updateData();
1032
+ }
1033
+ },
1034
+ textEditEnter(valueInfo) {
1035
+ if (this.textValue) {
1036
+ valueInfo.visible = false;
1037
+ valueInfo.value = this.textValue;
1038
+ this.textValue = "";
1039
+ }
1040
+ this.$emit("searchBtnClick", null);
1041
+ },
1042
+ editPopupVisibleChange(editKey, originValue, valueIndex, visible) {
1043
+ if (visible === true) {
1044
+ let vm = this;
1045
+ this.textValue = originValue.value;
1046
+ setTimeout(() => {
1047
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el.focus();
1048
+ vm.$refs[editKey + "_edit_" + valueIndex][0].$el.select();
1049
+ }, 10);
1050
+ }
1051
+ },
1052
+ closeTagPreventDefault(colValue, valueIndex, event) {
1053
+ colValue.values.splice(valueIndex, 1);
1054
+ event.preventDefault();
1055
+ this.$emit("searchBtnClick", null);
1056
+ },
1057
+ //右键菜单事件
1058
+ contextMenuClickEvent({ menu, row, column }) {
1059
+ let vm = this;
1060
+ const $table = this.$refs.baseGrid;
1061
+ if (column && column.field) {
1062
+ if (
1063
+ menu.code !== "sort" &&
1064
+ menu.code !== "copy" &&
1065
+ menu.code !== "refresh"
1066
+ ) {
1067
+ $table.sort(column.field, menu.code);
1068
+ }
1069
+ }
1070
+ switch (menu.code) {
1071
+ case "copy":
1072
+ // 示例
1073
+ if (row && column) {
1074
+ if (XEClipboard.copy(row[column.property])) {
1075
+ VXETable.modal.message({
1076
+ content: "已复制到剪贴板!",
1077
+ status: "success",
1078
+ });
948
1079
  }
949
1080
  }
950
- vm.$refs.baseGrid.setFilter(column.field, column.filters).then(res => {
951
- this.$emit('filterChange')
952
- })
953
- } else {
954
- const xTable = this.$refs.baseGrid
955
- // 设置为选中状态
956
- for (let i = 0; i < column.filters.length; i++) {
957
- if (!column.filters[i].value) {
958
- column.filters[i].checked = false
1081
+ break;
1082
+ case "clearFilter":
1083
+ // 示例
1084
+ const filterList = vm.$refs.baseGrid.getCheckedFilters();
1085
+ filterList.forEach((col) => {
1086
+ if (
1087
+ col.column.params.controlType === "select" ||
1088
+ col.column.params.controlType === "checkbox"
1089
+ ) {
1090
+ col.column.filters = [{ data: [] }];
959
1091
  } else {
960
- column.filters[i].checked = true
1092
+ col.column.filters = [];
961
1093
  }
1094
+ });
1095
+ // vm.$refs.baseGrid.clearFilter()
1096
+ vm.$emit("filterChange");
1097
+ break;
1098
+ case "desc":
1099
+ if (this.sortRemote) {
1100
+ this.$emit("sortChange", $table.getSortColumns());
962
1101
  }
963
- // 修改条件之后,需要手动调用 updateData 处理表格数据
964
- xTable.updateData()
965
- }
966
- },
967
- textEditEnter(valueInfo) {
968
- if (this.textValue) {
969
- valueInfo.visible = false
970
- valueInfo.value = this.textValue
971
- this.textValue = ''
972
- }
973
- this.$emit('searchBtnClick', null)
974
- },
975
- editPopupVisibleChange(editKey, originValue, valueIndex, visible) {
976
- if (visible === true) {
977
- let vm = this
978
- this.textValue = originValue.value
979
- setTimeout(() => {
980
- vm.$refs[editKey + '_edit_' + valueIndex][0].$el.focus()
981
- vm.$refs[editKey + '_edit_' + valueIndex][0].$el.select()
982
- }, 10)
983
- }
984
- },
985
- closeTagPreventDefault(colValue, valueIndex, event) {
986
- colValue.values.splice(valueIndex, 1)
987
- event.preventDefault()
988
- this.$emit('searchBtnClick', null)
989
- },
990
- //右键菜单事件
991
- contextMenuClickEvent({ menu, row, column }) {
992
- let vm = this
993
- const $table = this.$refs.baseGrid
994
- if (column && column.field) {
995
- if (
996
- menu.code !== 'sort' &&
997
- menu.code !== 'copy' &&
998
- menu.code !== 'refresh'
999
- ) {
1000
- $table.sort(column.field, menu.code)
1102
+ break;
1103
+ case "asc":
1104
+ if (this.sortRemote) {
1105
+ this.$emit("sortChange", $table.getSortColumns());
1001
1106
  }
1002
- }
1003
- switch (menu.code) {
1004
- case 'copy':
1005
- // 示例
1006
- if (row && column) {
1007
- if (XEClipboard.copy(row[column.property])) {
1008
- VXETable.modal.message({
1009
- content: '已复制到剪贴板!',
1010
- status: 'success'
1011
- })
1012
- }
1013
- }
1014
- break
1015
- case 'clearFilter':
1016
- // 示例
1017
- const filterList = vm.$refs.baseGrid.getCheckedFilters()
1018
- filterList.forEach(col => {
1019
- if (
1020
- col.column.params.controlType === 'select' ||
1021
- col.column.params.controlType === 'checkbox'
1022
- ) {
1023
- col.column.filters = [{ data: [] }]
1024
- } else {
1025
- col.column.filters = []
1026
- }
1027
- })
1028
- // vm.$refs.baseGrid.clearFilter()
1029
- vm.$emit('filterChange')
1030
- break
1031
- case 'desc':
1032
- if (this.sortRemote) {
1033
- this.$emit('sortChange', $table.getSortColumns())
1034
- }
1035
- break
1036
- case 'asc':
1037
- if (this.sortRemote) {
1038
- this.$emit('sortChange', $table.getSortColumns())
1039
- }
1040
- break
1041
- case 'clearSort':
1042
- let sortColumns = $table.getSortColumns()
1043
- sortColumns.forEach(col => {
1044
- col.column.order = ''
1045
- })
1046
- if (this.sortRemote) {
1047
- this.$emit('sortChange', [])
1048
- }
1049
- break
1050
- case 'refresh':
1051
- this.$emit('sortChange', $table.getSortColumns())
1052
- break
1053
- default:
1054
- }
1055
- },
1056
- getFiltersList() {
1057
- return this.filterExpression
1058
- // let vm = this
1059
- // const filterList = vm.$refs.baseGrid.getCheckedFilters()
1060
-
1061
- // let expList = []
1062
- // expList = vm.getExpTags(filterList)
1063
- // return expList
1064
- },
1065
- filterChange({ column, property, values, datas, filterList, $event }) {
1066
- let vm = this
1067
- //如果不是远程筛选 就不emit了
1068
- if (!this.filterRemote) {
1069
- return
1070
- }
1071
- vm.$emit('filterChange')
1072
- },
1073
- // sysRowStateFilter(scope){
1074
- // return scope.row.sysRowState!==scope.value
1075
- // },
1076
- initColumns(originCol) {
1077
- let vm = this
1078
- let colParams = {}
1079
-
1080
- let colInfo = {
1081
- field: originCol.field,
1082
- title: originCol.title,
1083
- visible: true
1084
- }
1085
-
1086
- let customSlot = {
1087
- 'default':'default'
1088
- };
1089
-
1090
- if (originCol.slots) {
1091
- customSlot = originCol.slots
1107
+ break;
1108
+ case "clearSort":
1109
+ let sortColumns = $table.getSortColumns();
1110
+ sortColumns.forEach((col) => {
1111
+ col.column.order = "";
1112
+ });
1113
+ if (this.sortRemote) {
1114
+ this.$emit("sortChange", []);
1092
1115
  }
1093
-
1094
- if (originCol.treeNode === true) {
1095
- colInfo['treeNode'] = true
1096
- }
1097
- if (originCol.isMerge === true) {
1098
- //合并行
1099
- this.mergeFields.push(originCol.field)
1100
- }
1101
- //判断originCol的showHeaderOverflow是否为true
1102
- // if (originCol.showHeaderOverflow) {
1103
- // //当表头内容过长时显示为省略号
1104
- // colInfo['showHeaderOverflow'] = false
1105
- // }
1106
- //判断组件传递自定义属性filterRemote值是否为true
1107
- // if (this.filterRemote) {
1108
- // //是就给colInfo加一个属性showHeaderOverflow并赋值false,这样当表头内容过长时就不会显示为省略
1109
- // colInfo['showHeaderOverflow'] = false
1110
- // }
1111
- //判断originCol的filters是否为数组 暂时不知道是否有被用到
1112
- if (XEUtils.isArray(originCol.filters)) {
1113
- //是就给colInfo加一个属性filters并把传入的形参传给新加的属性
1114
- colInfo['filters'] = originCol.filters
1115
- }
1116
- //vxe-table列配置
1117
- //判断originCol的filterMethod是否为true
1118
- if (originCol.filterMethod) {
1119
- //是就给colInfo加一个属性filterMethod并把形参赋值给新加的属性,这样
1120
- colInfo['filterMethod'] = originCol.filterMethod
1121
- }
1122
- if (originCol.align) {
1123
- colInfo['align'] = originCol.align
1124
- }
1125
- if (originCol.visible === false) {
1126
- colInfo.visible = false
1127
- }
1128
- //在不启用 筛选框的情况下 可以显示 因为 表头分组的关系
1129
- if (originCol.sortable === true) {
1130
- colInfo['sortable'] = true
1131
- colInfo['sortType'] = 'auto'
1132
- }
1133
- if (originCol.fixed) {
1134
- colInfo['fixed'] = originCol.fixed === 'left' ? 'left' : 'right'
1135
- }
1136
- if (originCol.formatter) {
1137
- colInfo['formatter'] = originCol.formatter
1138
- }
1139
- if (originCol.params) {
1140
- colParams = originCol.params
1141
- }
1142
-
1143
- if (originCol.footerSum === true) {
1144
- this.showFooter = true
1145
- this.footerSum.push(colInfo.field)
1146
- }
1147
- if (originCol.route) {
1148
- colParams['route'] = originCol.route
1149
- customSlot['default'] = 'linkCell'
1150
- }
1151
- //默认text
1152
- if (!originCol.controlType) {
1153
- originCol.controlType = controlType.text
1154
- }
1155
-
1156
- if (originCol.controlType === controlType.customRadio) {
1157
- colInfo['type'] = 'radio'
1158
- customSlot['radio'] = 'customRadio'
1159
- customSlot['footer'] = 'customFooter'
1160
- }
1161
- if (originCol.isExpand === true) {
1162
- colInfo['type'] = 'expand'
1163
- customSlot['content'] = 'expandContent'
1164
- customSlot['default'] = 'expandDefault'
1165
- }
1166
- if (originCol.controlType === controlType.customCell) {
1167
- customSlot['default']= 'customCell'
1168
- customSlot['footer'] = 'customFooter'
1169
- }
1170
- if (originCol.isCheckbox === true) {
1171
- colInfo['type'] = 'checkbox'
1172
- // colInfo['field'] = 'matCode'
1173
- }
1174
- colParams.dataSource = originCol.dataSource
1175
- if (originCol.rules) {
1176
- this.validRules[colInfo.field] = originCol.rules
1177
- }
1178
- if (originCol.precision) {
1179
- colParams['precision'] = originCol.precision
1180
- //加入验证逻辑
1181
- // if(!this.validRules[colInfo.field]){
1182
- // this.validRules[colInfo.field] = []
1183
- // }
1184
- // this.validRules[colInfo.field].push({
1185
- // validator: this.validPrecision
1186
- // })
1187
- }
1188
- if (XEUtils.isInteger(originCol.min)) {
1189
- colParams['min'] = originCol.min
1190
- }
1191
- if (XEUtils.isInteger(originCol.max)) {
1192
- colParams['max'] = originCol.max
1193
- }
1194
- // else{
1195
- // colParams['precision'] = 10 //默认十位小数
1116
+ break;
1117
+ case "refresh":
1118
+ this.$emit("sortChange", $table.getSortColumns());
1119
+ break;
1120
+ default:
1121
+ }
1122
+ },
1123
+ getFiltersList() {
1124
+ return this.filterExpression;
1125
+ // let vm = this
1126
+ // const filterList = vm.$refs.baseGrid.getCheckedFilters()
1127
+
1128
+ // let expList = []
1129
+ // expList = vm.getExpTags(filterList)
1130
+ // return expList
1131
+ },
1132
+ filterChange({ column, property, values, datas, filterList, $event }) {
1133
+ let vm = this;
1134
+ //如果不是远程筛选 就不emit了
1135
+ if (!this.filterRemote) {
1136
+ return;
1137
+ }
1138
+ vm.$emit("filterChange");
1139
+ },
1140
+ // sysRowStateFilter(scope){
1141
+ // return scope.row.sysRowState!==scope.value
1142
+ // },
1143
+ initColumns(originCol) {
1144
+ let vm = this;
1145
+ let colParams = {};
1146
+
1147
+ let colInfo = {
1148
+ field: originCol.field,
1149
+ title: originCol.title,
1150
+ visible: true,
1151
+ };
1152
+
1153
+ let customSlot = {
1154
+ default: "default",
1155
+ };
1156
+
1157
+ if (originCol.slots) {
1158
+ customSlot = originCol.slots;
1159
+ }
1160
+
1161
+ if (originCol.treeNode === true) {
1162
+ colInfo["treeNode"] = true;
1163
+ }
1164
+ if (originCol.isMerge === true) {
1165
+ //合并行
1166
+ this.mergeFields.push(originCol.field);
1167
+ }
1168
+ //判断originCol的showHeaderOverflow是否为true
1169
+ // if (originCol.showHeaderOverflow) {
1170
+ // //当表头内容过长时显示为省略号
1171
+ // colInfo['showHeaderOverflow'] = false
1172
+ // }
1173
+ //判断组件传递自定义属性filterRemote值是否为true
1174
+ // if (this.filterRemote) {
1175
+ // //是就给colInfo加一个属性showHeaderOverflow并赋值false,这样当表头内容过长时就不会显示为省略
1176
+ // colInfo['showHeaderOverflow'] = false
1177
+ // }
1178
+ //判断originCol的filters是否为数组 暂时不知道是否有被用到
1179
+ if (XEUtils.isArray(originCol.filters)) {
1180
+ //是就给colInfo加一个属性filters并把传入的形参传给新加的属性
1181
+ colInfo["filters"] = originCol.filters;
1182
+ }
1183
+ //vxe-table列配置
1184
+ //判断originCol的filterMethod是否为true
1185
+ if (originCol.filterMethod) {
1186
+ //是就给colInfo加一个属性filterMethod并把形参赋值给新加的属性,这样
1187
+ colInfo["filterMethod"] = originCol.filterMethod;
1188
+ }
1189
+ if (originCol.align) {
1190
+ colInfo["align"] = originCol.align;
1191
+ }
1192
+ if (originCol.visible === false) {
1193
+ colInfo.visible = false;
1194
+ }
1195
+ //在不启用 筛选框的情况下 可以显示 因为 表头分组的关系
1196
+ if (originCol.sortable === true) {
1197
+ colInfo["sortable"] = true;
1198
+ colInfo["sortType"] = "auto";
1199
+ }
1200
+ if (originCol.fixed) {
1201
+ colInfo["fixed"] = originCol.fixed === "left" ? "left" : "right";
1202
+ }
1203
+ if (originCol.formatter) {
1204
+ colInfo["formatter"] = originCol.formatter;
1205
+ }
1206
+ if (originCol.params) {
1207
+ colParams = originCol.params;
1208
+ }
1209
+
1210
+ if (originCol.footerSum === true) {
1211
+ this.showFooter = true;
1212
+ this.footerSum.push(colInfo.field);
1213
+ }
1214
+ if (originCol.route) {
1215
+ colParams["route"] = originCol.route;
1216
+ customSlot["default"] = "linkCell";
1217
+ }
1218
+ //默认text
1219
+ if (!originCol.controlType) {
1220
+ originCol.controlType = controlType.text;
1221
+ }
1222
+
1223
+ if (originCol.controlType === controlType.customRadio) {
1224
+ colInfo["type"] = "radio";
1225
+ customSlot["radio"] = "customRadio";
1226
+ customSlot["footer"] = "customFooter";
1227
+ }
1228
+ if (originCol.isExpand === true) {
1229
+ colInfo["type"] = "expand";
1230
+ customSlot["content"] = "expandContent";
1231
+ customSlot["default"] = "expandDefault";
1232
+ }
1233
+ if (originCol.controlType === controlType.customCell) {
1234
+ customSlot["default"] = "customCell";
1235
+ customSlot["footer"] = "customFooter";
1236
+ }
1237
+ if (originCol.isCheckbox === true) {
1238
+ colInfo["type"] = "checkbox";
1239
+ // colInfo['field'] = 'matCode'
1240
+ }
1241
+ colParams.dataSource = originCol.dataSource;
1242
+ if (originCol.rules) {
1243
+ this.validRules[colInfo.field] = originCol.rules;
1244
+ }
1245
+ if (originCol.precision) {
1246
+ colParams["precision"] = originCol.precision;
1247
+ //加入验证逻辑
1248
+ // if(!this.validRules[colInfo.field]){
1249
+ // this.validRules[colInfo.field] = []
1196
1250
  // }
1197
- colParams['le'] = originCol.le
1198
- colParams['controlType'] = originCol.controlType
1199
- colParams['edit'] = false
1200
- if (originCol.editStates) {
1201
- colParams['editStates'] = originCol.editStates
1202
- }
1203
- if (originCol.editStatuss) {
1204
- colParams['editStatuss'] = originCol.editStatuss
1205
- }
1206
- if (originCol.width) {
1207
- colInfo.width = originCol.width
1208
- } else {
1209
- colInfo.width = 100
1210
- }
1211
-
1212
- if (originCol.controlType === 'operation') {
1213
- customSlot['default'] = 'operation_edit'
1251
+ // this.validRules[colInfo.field].push({
1252
+ // validator: this.validPrecision
1253
+ // })
1254
+ }
1255
+ if (XEUtils.isInteger(originCol.min)) {
1256
+ colParams["min"] = originCol.min;
1257
+ }
1258
+ if (XEUtils.isInteger(originCol.max)) {
1259
+ colParams["max"] = originCol.max;
1260
+ }
1261
+ // else{
1262
+ // colParams['precision'] = 10 //默认十位小数
1263
+ // }
1264
+ colParams["le"] = originCol.le;
1265
+ colParams["controlType"] = originCol.controlType;
1266
+ colParams["edit"] = false;
1267
+ if (originCol.editStates) {
1268
+ colParams["editStates"] = originCol.editStates;
1269
+ }
1270
+ if (originCol.editStatuss) {
1271
+ colParams["editStatuss"] = originCol.editStatuss;
1272
+ }
1273
+ if (originCol.width) {
1274
+ colInfo.width = originCol.width;
1275
+ } else {
1276
+ colInfo.width = 100;
1277
+ }
1278
+
1279
+ if (originCol.controlType === "operation") {
1280
+ customSlot["default"] = "operation_edit";
1281
+ }
1282
+
1283
+ if (
1284
+ originCol.editStates &&
1285
+ originCol.editStates.length > 0 &&
1286
+ originCol.edit === true
1287
+ ) {
1288
+ let tempAutoSelect = true;
1289
+ let tempAutoFocus = ".inner-cell-control";
1290
+ switch (originCol.controlType) {
1291
+ case controlType.number:
1292
+ tempAutoFocus = ".ant-input-number-input";
1293
+ break;
1294
+ case controlType.pulldown:
1295
+ tempAutoFocus = ".inner-cell-control>input";
1296
+ break;
1297
+ case controlType.date:
1298
+ tempAutoFocus = ".ant-calendar-picker-input";
1299
+ break;
1300
+ case controlType.time:
1301
+ tempAutoFocus = ".ant-time-picker-input";
1302
+ tempAutoSelect = false;
1303
+ break;
1304
+ case controlType.checkbox:
1305
+ tempAutoFocus = ".ant-checkbox-input";
1306
+ break;
1307
+ case controlType.select:
1308
+ tempAutoSelect = false;
1309
+ break;
1214
1310
  }
1215
-
1216
- if (
1217
- originCol.editStates &&
1218
- originCol.editStates.length > 0 &&
1219
- originCol.edit === true
1220
- ) {
1221
- let tempAutoSelect = true
1222
- let tempAutoFocus = '.inner-cell-control'
1223
- switch (originCol.controlType) {
1224
- case controlType.number:
1225
- tempAutoFocus = '.ant-input-number-input'
1226
- break
1227
- case controlType.pulldown:
1228
- tempAutoFocus = '.inner-cell-control>input'
1229
- break
1230
- case controlType.date:
1231
- tempAutoFocus = '.ant-calendar-picker-input'
1232
- break
1233
- case controlType.time:
1234
- tempAutoFocus = '.ant-time-picker-input'
1235
- tempAutoSelect = false
1236
- break
1237
- case controlType.checkbox:
1238
- tempAutoFocus = '.ant-checkbox-input'
1239
- break
1240
- case controlType.select:
1241
- tempAutoSelect = false
1242
- break
1243
- }
1244
1311
 
1245
-
1246
- //可以编辑
1247
- colInfo.editRender = {
1248
- // autofocus: tempAutoSelect,
1249
- // autoselect:tempAutoSelect,
1250
- // name:'$input' //originCol.controlType + '_edit',
1251
- };
1252
- //编辑插槽
1253
- customSlot['edit'] = originCol.controlType + '_edit';
1312
+ //可以编辑
1313
+ colInfo.editRender = {
1314
+ // autofocus: tempAutoSelect,
1315
+ // autoselect:tempAutoSelect,
1316
+ // name:'$input' //originCol.controlType + '_edit',
1317
+ };
1318
+ //编辑插槽
1319
+ customSlot["edit"] = originCol.controlType + "_edit";
1254
1320
  // colInfo['editRender'] = {
1255
1321
  // name: originCol.controlType + '_edit',
1256
1322
  // autofocus: tempAutoFocus,
@@ -1260,1123 +1326,1134 @@
1260
1326
  // colParams['edit'] = true
1261
1327
  // colInfo['editRender']['enabled'] = true
1262
1328
  // }
1329
+ }
1330
+ if (originCol.controlType === controlType.pulldown) {
1331
+ colParams["api"] = originCol.api;
1332
+ colParams["defaultExpression"] = originCol.defaultExpression;
1333
+ colParams["pageSize"] = originCol.pageSize;
1334
+ colParams["optBtns"] = originCol.optBtns;
1335
+ colParams["displayField"] = originCol.displayField;
1336
+ colParams["popupAddName"] = originCol.popupAddName;
1337
+ colParams["popupAddPath"] = originCol.popupAddPath;
1338
+ colParams["columns"] = originCol.columns;
1339
+ colParams["isLocalData"] = originCol.isLocalData;
1340
+ colParams["isMultiSelect"] = originCol.isMultiSelect;
1341
+ colParams["controlEdit"] = true;
1342
+ }
1343
+ if (originCol.controlType === controlType.text) {
1344
+ colParams["controlEdit"] = true;
1345
+ }
1346
+ if (originCol.controlType === controlType.select) {
1347
+ colParams["controlEdit"] = true;
1348
+ }
1349
+ if (originCol.controlType === controlType.checkbox) {
1350
+ colParams["controlEdit"] = true;
1351
+ }
1352
+ if (originCol.controlType === controlType.date) {
1353
+ colParams["pastDate"] = originCol.pastDate;
1354
+ }
1355
+ colParams["disableUserVisible"] = originCol.disableUserVisible === true;
1356
+ colInfo["params"] = colParams;
1357
+ colInfo["params"]["sysOriValue"] = {};
1358
+ if (originCol.children) {
1359
+ colInfo["children"] = [];
1360
+ for (let x = 0; x < originCol.children.length; x++) {
1361
+ colInfo["children"].push(this.initColumns(originCol.children[i]));
1263
1362
  }
1264
- if (originCol.controlType === controlType.pulldown) {
1265
- colParams['api'] = originCol.api
1266
- colParams['defaultExpression'] = originCol.defaultExpression
1267
- colParams['pageSize'] = originCol.pageSize
1268
- colParams['optBtns'] = originCol.optBtns
1269
- colParams['displayField'] = originCol.displayField
1270
- colParams['popupAddName'] = originCol.popupAddName
1271
- colParams['popupAddPath'] = originCol.popupAddPath
1272
- colParams['columns'] = originCol.columns
1273
- colParams['isLocalData'] = originCol.isLocalData
1274
- colParams['isMultiSelect'] = originCol.isMultiSelect
1275
- colParams['controlEdit'] = true
1276
- }
1277
- if (originCol.controlType === controlType.text) {
1278
- colParams['controlEdit'] = true
1279
- }
1280
- if (originCol.controlType === controlType.select) {
1281
- colParams['controlEdit'] = true
1282
- }
1283
- if (originCol.controlType === controlType.checkbox) {
1284
- colParams['controlEdit'] = true
1285
- }
1286
- if (originCol.controlType === controlType.date) {
1287
- colParams['pastDate'] = originCol.pastDate
1363
+ }
1364
+ //防止报错 有slots值就走前面 没有slots这个键key就走后面
1365
+ if (
1366
+ originCol.controlType !== controlType.operation &&
1367
+ originCol.filters === true
1368
+ ) {
1369
+ let filterTypeName = `${originCol.controlType}_filter`;
1370
+ //网格筛选
1371
+ colInfo["filters"] = [
1372
+ { data: { bindingValues: [], displayValues: [] }, checked: false },
1373
+ ];
1374
+ colInfo["filterMultiple"] = false;
1375
+ // colInfo['filterRender'] ={name: filterTypeName,showFilterFooter:false}
1376
+ customSlot["filter"] = filterTypeName;
1377
+ }
1378
+ // console.debug(customSlot)
1379
+ colInfo.slots = customSlot;
1380
+ // console.debug(colInfo)
1381
+ return colInfo;
1382
+ },
1383
+ validPrecision({ cellValue, column }) {
1384
+ if (XEUtils.isNumber(cellValue)) {
1385
+ let reg = new RegExp(
1386
+ "^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0," +
1387
+ column.params.precision +
1388
+ "})?$"
1389
+ );
1390
+ if (!reg.test(cellValue)) {
1391
+ return new Error("超过小数点" + column.params.precision + "位");
1288
1392
  }
1289
- colParams['disableUserVisible'] = originCol.disableUserVisible === true
1290
- colInfo['params'] = colParams
1291
- colInfo['params']['sysOriValue'] = {}
1292
- if (originCol.children) {
1293
- colInfo['children'] = []
1294
- for (let x = 0; x < originCol.children.length; x++) {
1295
- colInfo['children'].push(this.initColumns(originCol.children[i]))
1393
+ }
1394
+ },
1395
+ numberInputKeyDown(scope, event) {
1396
+ let rowTag = scope.row;
1397
+ let columnTag = scope.column;
1398
+ let ROW_XIDS = scope.data.map((mapItem) => mapItem._XID);
1399
+ let currentRowIndex = ROW_XIDS.indexOf(rowTag._XID);
1400
+ let targetRow;
1401
+ switch (event.keyCode) {
1402
+ case 39: //向右
1403
+ //当前光标已在输入文本末尾,向右找到第一个可编辑的列,设为编辑状态
1404
+ break;
1405
+ case 37: //向左
1406
+ //当前光标已在输入文本开头,向左找到第一个可编辑的列,设为编辑状态
1407
+ break;
1408
+ case 38: //向上
1409
+ if (0 < currentRowIndex - 1) {
1410
+ targetRow = scope.data[currentRowIndex - 1];
1411
+ this.$refs.baseGrid.setActiveCell(targetRow, columnTag);
1296
1412
  }
1297
- }
1298
- //防止报错 有slots值就走前面 没有slots这个键key就走后面
1299
- if (
1300
- originCol.controlType !== controlType.operation &&
1301
- originCol.filters === true
1302
- ) {
1303
- let filterTypeName = `${originCol.controlType}_filter`
1304
- //网格筛选
1305
- colInfo['filters'] = [{ data: { bindingValues: [], displayValues: [] }, checked: false }]
1306
- colInfo['filterMultiple'] = false
1307
- // colInfo['filterRender'] ={name: filterTypeName,showFilterFooter:false}
1308
- customSlot['filter'] = filterTypeName
1309
- }
1310
- // console.debug(customSlot)
1311
- colInfo.slots = customSlot
1312
- // console.debug(colInfo)
1313
- return colInfo
1314
- },
1315
- validPrecision({ cellValue, column }) {
1316
- if (XEUtils.isNumber(cellValue)) {
1317
- let reg = new RegExp(
1318
- '^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,' +
1319
- column.params.precision +
1320
- '})?$'
1321
- )
1322
- if (!reg.test(cellValue)) {
1323
- return new Error('超过小数点' + column.params.precision + '位')
1413
+ break;
1414
+ case 40: //向下
1415
+ if (scope.data.length > currentRowIndex + 1) {
1416
+ targetRow = scope.data[currentRowIndex + 1];
1417
+ this.$refs.baseGrid.setActiveCell(targetRow, columnTag);
1324
1418
  }
1325
- }
1326
- },
1327
- numberInputKeyDown(scope, event) {
1328
- let rowTag = scope.row
1329
- let columnTag = scope.column
1330
- let ROW_XIDS = scope.data.map(mapItem => mapItem._XID)
1331
- let currentRowIndex = ROW_XIDS.indexOf(rowTag._XID)
1332
- let targetRow
1333
- switch (event.keyCode) {
1334
- case 39: //向右
1335
- //当前光标已在输入文本末尾,向右找到第一个可编辑的列,设为编辑状态
1336
- break
1337
- case 37: //向左
1338
- //当前光标已在输入文本开头,向左找到第一个可编辑的列,设为编辑状态
1339
- break
1340
- case 38: //向上
1341
- if (0 < currentRowIndex - 1) {
1342
- targetRow = scope.data[currentRowIndex - 1]
1343
- this.$refs.baseGrid.setActiveCell(targetRow, columnTag)
1344
- }
1345
- break
1346
- case 40: //向下
1347
- if (scope.data.length > currentRowIndex + 1) {
1348
- targetRow = scope.data[currentRowIndex + 1]
1349
- this.$refs.baseGrid.setActiveCell(targetRow, columnTag)
1350
- }
1351
- break
1352
- }
1353
- },
1354
- getValid(column, row) {
1355
- if (column.params.rules) {
1356
- v.verify(row[column.property], column.params.rules).then(validData => {
1357
- return 'davis'
1358
- })
1359
- }
1360
- },
1361
- getGridView() {
1362
- return this.$refs.baseGrid
1363
- },
1364
- //拖动输入框功能 未启用
1365
- initColumnDrop() {
1366
- this.$nextTick(() => {
1367
- const $table = this.$refs.baseGrid
1368
- this.sortable2 = Sortable.create(
1369
- $table.$el.querySelector(
1370
- '.body--wrapper>.vxe-table--header .vxe-header--row'
1371
- ),
1372
- {
1373
- handle: '.vxe-header--column:not(.col--fixed)',
1374
- onEnd: ({ item, newIndex, oldIndex }) => {
1375
- const { fullColumn, tableColumn } = $table.getTableColumn()
1376
- const targetThElem = item
1377
- const wrapperElem = targetThElem.parentNode
1378
- const newColumn = fullColumn[newIndex]
1379
- if (newColumn.fixed) {
1380
- // 错误的移动
1381
- if (newIndex > oldIndex) {
1382
- wrapperElem.insertBefore(
1383
- targetThElem,
1384
- wrapperElem.children[oldIndex]
1385
- )
1386
- } else {
1387
- wrapperElem.insertBefore(
1388
- wrapperElem.children[oldIndex],
1389
- targetThElem
1390
- )
1391
- }
1392
- return this.$XModal.message({
1393
- content: '固定列不允许拖动!',
1394
- status: 'error'
1395
- })
1419
+ break;
1420
+ }
1421
+ },
1422
+ getValid(column, row) {
1423
+ if (column.params.rules) {
1424
+ v.verify(row[column.property], column.params.rules).then(
1425
+ (validData) => {
1426
+ return "davis";
1427
+ }
1428
+ );
1429
+ }
1430
+ },
1431
+ getGridView() {
1432
+ return this.$refs.baseGrid;
1433
+ },
1434
+ //拖动输入框功能 未启用
1435
+ initColumnDrop() {
1436
+ this.$nextTick(() => {
1437
+ const $table = this.$refs.baseGrid;
1438
+ this.sortable2 = Sortable.create(
1439
+ $table.$el.querySelector(
1440
+ ".body--wrapper>.vxe-table--header .vxe-header--row"
1441
+ ),
1442
+ {
1443
+ handle: ".vxe-header--column:not(.col--fixed)",
1444
+ onEnd: ({ item, newIndex, oldIndex }) => {
1445
+ const { fullColumn, tableColumn } = $table.getTableColumn();
1446
+ const targetThElem = item;
1447
+ const wrapperElem = targetThElem.parentNode;
1448
+ const newColumn = fullColumn[newIndex];
1449
+ if (newColumn.fixed) {
1450
+ // 错误的移动
1451
+ if (newIndex > oldIndex) {
1452
+ wrapperElem.insertBefore(
1453
+ targetThElem,
1454
+ wrapperElem.children[oldIndex]
1455
+ );
1456
+ } else {
1457
+ wrapperElem.insertBefore(
1458
+ wrapperElem.children[oldIndex],
1459
+ targetThElem
1460
+ );
1396
1461
  }
1397
- // 转换真实索引
1398
- const oldColumnIndex = $table.getColumnIndex(
1399
- tableColumn[oldIndex]
1400
- )
1401
- const newColumnIndex = $table.getColumnIndex(
1402
- tableColumn[newIndex]
1403
- )
1404
- // 移动到目标列
1405
- const currRow = fullColumn.splice(oldColumnIndex, 1)[0]
1406
- fullColumn.splice(newColumnIndex, 0, currRow)
1407
- $table.loadColumn(fullColumn)
1462
+ return this.$XModal.message({
1463
+ content: "固定列不允许拖动!",
1464
+ status: "error",
1465
+ });
1408
1466
  }
1409
- }
1410
- )
1411
- })
1412
- },
1413
- sortChange({ column, property, order, sortBy, sortList, $event }) {
1414
-
1415
- if(this.filterRemote){
1416
- let tempSortList = []
1417
- XEUtils.arrayEach(sortList, (loopSort) => {
1418
- tempSortList.push([loopSort.field, loopSort.order])
1419
- });
1420
- this.$emit('sortChange', tempSortList)
1421
- }
1422
-
1423
- // let vm = this
1424
- // const $table = this.$refs.baseGrid
1425
- // //有children说明是 有筛选框
1426
- // if (column.children && column.children.length > 0) {
1427
- // if (column.children[0].order == order) {
1428
- // $table.clearSort(column.children[0].field)
1429
- // column.children[0].order = null
1430
- // } else if (order == 'asc') {
1431
- // $table.sort(column.children[0].property, order)
1432
- // } else if (order == 'desc') {
1433
- // $table.sort(column.children[0].property, order)
1434
- // }
1435
- // } else {
1436
- // if (column.order == order) {
1437
- // $table.clearSort(column.field)
1438
- // column.order = null
1439
- // } else if (order == 'asc') {
1440
- // $table.sort(column.property, order)
1441
- // } else if (order == 'desc') {
1442
- // $table.sort(column.property, order)
1443
- // }
1444
- // }
1445
- //远程emit 不是的话就调vxe的sort
1446
- // if (vm.sortRemote) {
1447
- // if (column.children && column.children.length > 0) {
1448
- // if (column.children[0].order == order) {
1449
- // column.children[0].order = null
1450
- // } else
1451
- // if (order == 'asc') {
1452
- // column.children[0].order = order
1453
- // } else if (order == 'desc') {
1454
- // column.children[0].order = order
1455
- // }
1456
- // } else {
1457
- // if (column.order == order) {
1458
- // column.order = null
1459
- // } else
1460
- // if (order == 'asc') {
1461
- // column.order = 'asc'
1462
- // } else if (order == 'desc') {
1463
- // column.order = 'desc'
1464
- // }
1465
- // }
1466
- // let tmp = $table.getSortColumns()
1467
- // vm.$emit('sortChange', tmp)
1468
- // }
1469
- },
1470
- currentChange(scope) {
1471
- this.$emit('currentChange', scope.row)
1472
- },
1473
- pageSizeChange(page, pageSize) {
1474
- this.$emit('pageSizeChange', page, pageSize)
1475
- },
1476
- pageChange(page, pageSize) {
1477
- this.$emit('pageChange', page, pageSize)
1478
- },
1479
- getCheckboxRecords() {
1480
- return this.$refs.baseGrid.getCheckboxRecords(true)
1481
- },
1482
- setCheckboxRow(rows, checked) {
1483
- this.$refs.baseGrid.setCheckboxRow(rows, checked)
1484
- },
1485
- setAllCheckboxRow(checked) {
1486
- return this.$refs.baseGrid.setAllCheckboxRow(checked)
1487
- },
1488
- reloadRow(rows, record) {
1489
- return this.$refs.baseGrid.reloadRow(rows, record)
1490
- },
1491
- /**
1492
- * 确认保存用户自定义表格信息
1493
- */
1494
- confirmUserDefineColumn() {
1495
- let vm = this
1496
- let postData = {
1497
- moduleCode: this.moduleCode,
1498
- dataCode: this.dataCode,
1499
- fields: []
1500
- }
1501
- let tableCollectColumn = this.$refs.baseGrid.getTableColumn()
1502
- .collectColumn
1503
- let baseAdjustGridViewColumn = this.$refs.baseAdjustGridView
1504
- .adjustUserDefineColumns
1505
- // XEUtils.arrayEach(this.userDefineColumns, (loopCol) => {
1506
- XEUtils.arrayEach(baseAdjustGridViewColumn, loopCol => {
1507
- let tempData = {
1508
- field: loopCol.field,
1509
- sort: postData.fields.length + 1,
1510
- hidden: loopCol.visible !== true,
1511
- width: loopCol.width
1512
- // width: colWidth,
1467
+ // 转换真实索引
1468
+ const oldColumnIndex = $table.getColumnIndex(
1469
+ tableColumn[oldIndex]
1470
+ );
1471
+ const newColumnIndex = $table.getColumnIndex(
1472
+ tableColumn[newIndex]
1473
+ );
1474
+ // 移动到目标列
1475
+ const currRow = fullColumn.splice(oldColumnIndex, 1)[0];
1476
+ fullColumn.splice(newColumnIndex, 0, currRow);
1477
+ $table.loadColumn(fullColumn);
1478
+ },
1513
1479
  }
1514
- postData.fields.push(tempData)
1515
- let tempCol = XEUtils.findTree(
1516
- tableCollectColumn,
1517
- p => p.field === loopCol.field
1518
- ).item
1519
- tempCol.visible = loopCol.visible
1520
- tempCol.width = loopCol.width
1521
- // tempCol.width = colWidth;
1522
- //设置顺序
1523
- tempCol.params['tempCustomSort'] = tempData.sort
1524
- this.setCustomGridParentSort(
1525
- tableCollectColumn,
1526
- tempCol.parentId,
1527
- tempData.sort
1528
- )
1529
- })
1530
- saveUserModuleDataFieldApi(postData)
1531
- .then(res => {
1532
- //设置表格顺序
1533
- tableCollectColumn = XEUtils.orderBy(
1534
- tableCollectColumn,
1535
- p => p.params.tempCustomSort
1536
- )
1537
- vm.$refs.baseGrid.reloadColumn(tableCollectColumn)
1538
- //清空store缓存
1539
- vm.$store.dispatch(
1540
- 'setModuleLoadViewInfo',
1541
- this.moduleCode,
1542
- res.content
1543
- )
1544
- vm.showGridColumnUserDefine = false
1545
- })
1546
- .catch(() => {})
1547
- },
1548
- setCustomGridParentSort(tableCollectColumn, parentId, sort) {
1549
- let tempParentCol = XEUtils.findTree(
1480
+ );
1481
+ });
1482
+ },
1483
+ sortChange({ column, property, order, sortBy, sortList, $event }) {
1484
+ if (this.filterRemote) {
1485
+ let tempSortList = [];
1486
+ XEUtils.arrayEach(sortList, (loopSort) => {
1487
+ tempSortList.push([loopSort.field, loopSort.order]);
1488
+ });
1489
+ this.$emit("sortChange", tempSortList);
1490
+ }
1491
+
1492
+ // let vm = this
1493
+ // const $table = this.$refs.baseGrid
1494
+ // //有children说明是 有筛选框
1495
+ // if (column.children && column.children.length > 0) {
1496
+ // if (column.children[0].order == order) {
1497
+ // $table.clearSort(column.children[0].field)
1498
+ // column.children[0].order = null
1499
+ // } else if (order == 'asc') {
1500
+ // $table.sort(column.children[0].property, order)
1501
+ // } else if (order == 'desc') {
1502
+ // $table.sort(column.children[0].property, order)
1503
+ // }
1504
+ // } else {
1505
+ // if (column.order == order) {
1506
+ // $table.clearSort(column.field)
1507
+ // column.order = null
1508
+ // } else if (order == 'asc') {
1509
+ // $table.sort(column.property, order)
1510
+ // } else if (order == 'desc') {
1511
+ // $table.sort(column.property, order)
1512
+ // }
1513
+ // }
1514
+ //远程emit 不是的话就调vxe的sort
1515
+ // if (vm.sortRemote) {
1516
+ // if (column.children && column.children.length > 0) {
1517
+ // if (column.children[0].order == order) {
1518
+ // column.children[0].order = null
1519
+ // } else
1520
+ // if (order == 'asc') {
1521
+ // column.children[0].order = order
1522
+ // } else if (order == 'desc') {
1523
+ // column.children[0].order = order
1524
+ // }
1525
+ // } else {
1526
+ // if (column.order == order) {
1527
+ // column.order = null
1528
+ // } else
1529
+ // if (order == 'asc') {
1530
+ // column.order = 'asc'
1531
+ // } else if (order == 'desc') {
1532
+ // column.order = 'desc'
1533
+ // }
1534
+ // }
1535
+ // let tmp = $table.getSortColumns()
1536
+ // vm.$emit('sortChange', tmp)
1537
+ // }
1538
+ },
1539
+ currentChange(scope) {
1540
+ this.$emit("currentChange", scope.row);
1541
+ },
1542
+ pageSizeChange(page, pageSize) {
1543
+ this.$emit("pageSizeChange", page, pageSize);
1544
+ },
1545
+ pageChange(page, pageSize) {
1546
+ this.$emit("pageChange", page, pageSize);
1547
+ },
1548
+ getCheckboxRecords() {
1549
+ return this.$refs.baseGrid.getCheckboxRecords(true);
1550
+ },
1551
+ setCheckboxRow(rows, checked) {
1552
+ this.$refs.baseGrid.setCheckboxRow(rows, checked);
1553
+ },
1554
+ setAllCheckboxRow(checked) {
1555
+ return this.$refs.baseGrid.setAllCheckboxRow(checked);
1556
+ },
1557
+ reloadRow(rows, record) {
1558
+ return this.$refs.baseGrid.reloadRow(rows, record);
1559
+ },
1560
+ /**
1561
+ * 确认保存用户自定义表格信息
1562
+ */
1563
+ confirmUserDefineColumn() {
1564
+ let vm = this;
1565
+ let postData = {
1566
+ moduleCode: this.moduleCode,
1567
+ dataCode: this.dataCode,
1568
+ fields: [],
1569
+ };
1570
+ let tableCollectColumn =
1571
+ this.$refs.baseGrid.getTableColumn().collectColumn;
1572
+ let baseAdjustGridViewColumn =
1573
+ this.$refs.baseAdjustGridView.adjustUserDefineColumns;
1574
+ // XEUtils.arrayEach(this.userDefineColumns, (loopCol) => {
1575
+ XEUtils.arrayEach(baseAdjustGridViewColumn, (loopCol) => {
1576
+ let tempData = {
1577
+ field: loopCol.field,
1578
+ sort: postData.fields.length + 1,
1579
+ hidden: loopCol.visible !== true,
1580
+ width: loopCol.width,
1581
+ // width: colWidth,
1582
+ };
1583
+ postData.fields.push(tempData);
1584
+ let tempCol = XEUtils.findTree(
1585
+ tableCollectColumn,
1586
+ (p) => p.field === loopCol.field
1587
+ ).item;
1588
+ tempCol.visible = loopCol.visible;
1589
+ tempCol.width = loopCol.width;
1590
+ // tempCol.width = colWidth;
1591
+ //设置顺序
1592
+ tempCol.params["tempCustomSort"] = tempData.sort;
1593
+ this.setCustomGridParentSort(
1550
1594
  tableCollectColumn,
1551
- p => p.id === parentId
1552
- )
1553
- if (tempParentCol) {
1554
- tempParentCol.item.params['tempCustomSort'] = sort
1555
- this.setCustomGridParentSort(
1595
+ tempCol.parentId,
1596
+ tempData.sort
1597
+ );
1598
+ });
1599
+ saveUserModuleDataFieldApi(postData)
1600
+ .then((res) => {
1601
+ //设置表格顺序
1602
+ tableCollectColumn = XEUtils.orderBy(
1556
1603
  tableCollectColumn,
1557
- tempParentCol.item.parentId,
1558
- sort
1559
- )
1560
- }
1561
- },
1562
- getFetchField() {
1563
- let tempStr = ''
1564
- let tempFullColumn = this.$refs.baseGrid.getTableColumn().fullColumn
1565
- XEUtils.arrayEach(tempFullColumn, loopCol => {
1566
- if (!loopCol.field) {
1567
- return
1568
- }
1569
- if (
1570
- loopCol.visible === true ||
1571
- loopCol.params.disableUserVisible === true
1572
- ) {
1573
- tempStr = tempStr + loopCol.field + ','
1574
- }
1604
+ (p) => p.params.tempCustomSort
1605
+ );
1606
+ vm.$refs.baseGrid.reloadColumn(tableCollectColumn);
1607
+ //清空store缓存
1608
+ vm.$store.dispatch(
1609
+ "setModuleLoadViewInfo",
1610
+ this.moduleCode,
1611
+ res.content
1612
+ );
1613
+ vm.showGridColumnUserDefine = false;
1575
1614
  })
1576
- return tempStr.substring(0, tempStr.length - 1)
1577
- },
1578
- clickHeader() {
1579
- let tableCollectColumn = XEUtils.toTreeArray(
1580
- this.$refs.baseGrid.getTableColumn().collectColumn
1581
- )
1582
- this.userDefineColumns = XEUtils.filter(
1615
+ .catch(() => {});
1616
+ },
1617
+ setCustomGridParentSort(tableCollectColumn, parentId, sort) {
1618
+ let tempParentCol = XEUtils.findTree(
1619
+ tableCollectColumn,
1620
+ (p) => p.id === parentId
1621
+ );
1622
+ if (tempParentCol) {
1623
+ tempParentCol.item.params["tempCustomSort"] = sort;
1624
+ this.setCustomGridParentSort(
1583
1625
  tableCollectColumn,
1584
- p => !p.children && p.params.disableUserVisible !== true
1585
- )
1586
- this.showGridColumnUserDefine = true
1587
- },
1588
- operationButtonClick(btn, scope) {
1589
- if (btn.edit === false) {
1590
- return
1626
+ tempParentCol.item.parentId,
1627
+ sort
1628
+ );
1629
+ }
1630
+ },
1631
+ getFetchField() {
1632
+ let tempStr = "";
1633
+ let tempFullColumn = this.$refs.baseGrid.getTableColumn().fullColumn;
1634
+ XEUtils.arrayEach(tempFullColumn, (loopCol) => {
1635
+ if (!loopCol.field) {
1636
+ return;
1591
1637
  }
1592
- this.$emit('operationBtnClick', btn, scope.row, this)
1593
- },
1594
- activeCellMethod({ row, column }) {
1595
- // let emitData ={
1596
- // row:row,
1597
- // column:column,
1598
- // edit:column.params.edit
1599
- // }
1600
- // this.$emit('activeCellMethod',emitData)
1601
-
1602
- if (row['sysDisableEdit'] === true) {
1603
- //禁止编辑
1604
- return false
1638
+ if (
1639
+ loopCol.visible === true ||
1640
+ loopCol.params.disableUserVisible === true
1641
+ ) {
1642
+ tempStr = tempStr + loopCol.field + ",";
1605
1643
  }
1606
- console.debug('davis activeCellMethod')
1607
-
1608
- return column.params.edit
1609
- },
1610
- editActived(scope) {
1611
- let colElId = scope.column.id
1612
- let rowElId = scope.row._X_ROW_KEY
1613
- //延迟设置输入框自动获取焦点以及选中
1614
- this.$nextTick(()=>{
1615
- let cellEl = scope.$table.$el.querySelector('[rowid="'+rowElId+'"]>[colid="'+colElId+'"]')
1616
- let inputEl = cellEl.querySelector('input')
1617
- if(inputEl){
1618
- inputEl.focus()
1619
- inputEl.select()
1620
- }
1621
- })
1622
- this.$emit('editActived', scope)
1623
- },
1624
- setColumnEdit(field, edit) {
1625
- for (let i = 0; i < this.internalColumns.length; i++) {
1626
- if (this.internalColumns[i].children) {
1627
- let colInfo = XEUtils.find(
1628
- this.internalColumns[i].children,
1629
- p => p.field === field
1630
- )
1631
- if (colInfo) {
1632
- colInfo.editRender.enabled = edit
1633
- colInfo.params.edit = edit
1634
- }
1644
+ });
1645
+ return tempStr.substring(0, tempStr.length - 1);
1646
+ },
1647
+ clickHeader() {
1648
+ let tableCollectColumn = XEUtils.toTreeArray(
1649
+ this.$refs.baseGrid.getTableColumn().collectColumn
1650
+ );
1651
+ this.userDefineColumns = XEUtils.filter(
1652
+ tableCollectColumn,
1653
+ (p) => !p.children && p.params.disableUserVisible !== true
1654
+ );
1655
+ this.showGridColumnUserDefine = true;
1656
+ },
1657
+ operationButtonClick(btn, scope) {
1658
+ if (btn.edit === false) {
1659
+ return;
1660
+ }
1661
+ this.$emit("operationBtnClick", btn, scope.row, this);
1662
+ },
1663
+ activeCellMethod({ row, column }) {
1664
+ // let emitData ={
1665
+ // row:row,
1666
+ // column:column,
1667
+ // edit:column.params.edit
1668
+ // }
1669
+ // this.$emit('activeCellMethod',emitData)
1670
+
1671
+ if (row["sysDisableEdit"] === true) {
1672
+ //禁止编辑
1673
+ return false;
1674
+ }
1675
+ console.debug("davis activeCellMethod");
1676
+
1677
+ return column.params.edit;
1678
+ },
1679
+ editActived(scope) {
1680
+ let colElId = scope.column.id;
1681
+ let rowElId = scope.row._X_ROW_KEY;
1682
+ //延迟设置输入框自动获取焦点以及选中
1683
+ this.$nextTick(() => {
1684
+ let cellEl = scope.$table.$el.querySelector(
1685
+ '[rowid="' + rowElId + '"]>[colid="' + colElId + '"]'
1686
+ );
1687
+ let inputEl = cellEl.querySelector("input");
1688
+ if (inputEl) {
1689
+ inputEl.focus();
1690
+ inputEl.select();
1691
+ }
1692
+ });
1693
+ this.$emit("editActived", scope);
1694
+ },
1695
+ setColumnEdit(field, edit) {
1696
+ for (let i = 0; i < this.internalColumns.length; i++) {
1697
+ if (this.internalColumns[i].children) {
1698
+ let colInfo = XEUtils.find(
1699
+ this.internalColumns[i].children,
1700
+ (p) => p.field === field
1701
+ );
1702
+ if (colInfo) {
1703
+ colInfo.editRender.enabled = edit;
1704
+ colInfo.params.edit = edit;
1635
1705
  }
1636
1706
  }
1637
- this.$refs.baseGrid.refreshColumn()
1638
- },
1639
- setEdit(currentState, currentStatus) {
1640
- //设置添加按钮
1641
- if (this.pager.buttons) {
1642
- for (let i = 0; i < this.pager.buttons.length; i++) {
1643
- let editVisible = this.getColumnEdit(
1644
- this.pager.buttons[i].edit,
1645
- currentState,
1646
- currentStatus,
1647
- this.pager.buttons[i].editStates,
1648
- this.pager.buttons[i].editStatuss,
1649
- this.pager.buttons[i].visibleStates,
1650
- this.pager.buttons[i].visibleStatuss
1651
- )
1652
- this.$set(this.pager.buttons[i], 'visible', editVisible.visible)
1653
- this.$set(this.pager.buttons[i], 'edit', editVisible.edit)
1654
- this.$forceUpdate()
1655
- }
1707
+ }
1708
+ this.$refs.baseGrid.refreshColumn();
1709
+ },
1710
+ setEdit(currentState, currentStatus) {
1711
+ //设置添加按钮
1712
+ if (this.pager.buttons) {
1713
+ for (let i = 0; i < this.pager.buttons.length; i++) {
1714
+ let editVisible = this.getColumnEdit(
1715
+ this.pager.buttons[i].edit,
1716
+ currentState,
1717
+ currentStatus,
1718
+ this.pager.buttons[i].editStates,
1719
+ this.pager.buttons[i].editStatuss,
1720
+ this.pager.buttons[i].visibleStates,
1721
+ this.pager.buttons[i].visibleStatuss
1722
+ );
1723
+ this.$set(this.pager.buttons[i], "visible", editVisible.visible);
1724
+ this.$set(this.pager.buttons[i], "edit", editVisible.edit);
1725
+ this.$forceUpdate();
1656
1726
  }
1657
- // if (this.pager.add) {
1658
- // this.addBtnEdit = false
1659
- // this.addBtnEdit = this.getColumnEdit(
1660
- // this.addBtnEdit,
1661
- // currentState,
1662
- // currentStatus,
1663
- // this.pager.add.editStates,
1664
- // this.pager.add.editStatuss
1665
- // )
1666
- // }
1667
- //设置网格可编辑状态
1668
-
1669
- if (this.editStates.indexOf(currentState) > -1) {
1670
- this.gridEdit = true
1727
+ }
1728
+ // if (this.pager.add) {
1729
+ // this.addBtnEdit = false
1730
+ // this.addBtnEdit = this.getColumnEdit(
1731
+ // this.addBtnEdit,
1732
+ // currentState,
1733
+ // currentStatus,
1734
+ // this.pager.add.editStates,
1735
+ // this.pager.add.editStatuss
1736
+ // )
1737
+ // }
1738
+ //设置网格可编辑状态
1739
+
1740
+ if (this.editStates.indexOf(currentState) > -1) {
1741
+ this.gridEdit = true;
1742
+ } else {
1743
+ this.gridEdit = false;
1744
+ }
1745
+ if (currentStatus && this.editStatuss) {
1746
+ if (this.editStatuss.indexOf(currentStatus) > -1) {
1747
+ this.gridEdit = true;
1671
1748
  } else {
1672
- this.gridEdit = false
1749
+ this.gridEdit = false;
1673
1750
  }
1674
- if (currentStatus && this.editStatuss) {
1675
- if (this.editStatuss.indexOf(currentStatus) > -1) {
1676
- this.gridEdit = true
1677
- } else {
1678
- this.gridEdit = false
1679
- }
1751
+ }
1752
+ for (let i = 0; i < this.internalColumns.length; i++) {
1753
+ if (!this.internalColumns[i].params) {
1754
+ continue;
1680
1755
  }
1681
- for (let i = 0; i < this.internalColumns.length; i++) {
1682
- if (!this.internalColumns[i].params) {
1683
- continue
1684
- }
1685
- this.internalColumns[i].params.edit = false
1686
- if (
1687
- this.internalColumns[i].params.controlType === controlType.operation
1756
+ this.internalColumns[i].params.edit = false;
1757
+ if (
1758
+ this.internalColumns[i].params.controlType === controlType.operation
1759
+ ) {
1760
+ for (
1761
+ let j = 0;
1762
+ j < this.internalColumns[i].params.columns.length;
1763
+ j++
1688
1764
  ) {
1689
- for (
1690
- let j = 0;
1691
- j < this.internalColumns[i].params.columns.length;
1692
- j++
1693
- ) {
1694
- this.internalColumns[i].params.columns[j].edit = false
1695
- //设置工具栏可编辑状态
1696
- let editVisible = this.getColumnEdit(
1697
- this.internalColumns[i].params.columns[j].edit,
1698
- currentState,
1699
- currentStatus,
1700
- this.internalColumns[i].params.columns[j].editStates,
1701
- this.internalColumns[i].params.columns[j].editStatuss,
1702
- this.internalColumns[i].params.columns[j].visibleStates,
1703
- this.internalColumns[i].params.columns[j].visibleStatuss
1704
- )
1705
- this.$set(
1706
- this.internalColumns[i].params.columns[j],
1707
- 'visible',
1708
- editVisible.visible
1709
- )
1710
- this.$set(
1711
- this.internalColumns[i].params.columns[j],
1712
- 'edit',
1713
- editVisible.edit
1714
- )
1715
- }
1716
- continue
1717
- }
1718
- //设置网格列编辑状态
1719
- if (this.gridEdit === true) {
1765
+ this.internalColumns[i].params.columns[j].edit = false;
1766
+ //设置工具栏可编辑状态
1720
1767
  let editVisible = this.getColumnEdit(
1721
- this.internalColumns[i].params.edit,
1768
+ this.internalColumns[i].params.columns[j].edit,
1722
1769
  currentState,
1723
1770
  currentStatus,
1724
- this.internalColumns[i].params.editStates,
1725
- this.internalColumns[i].params.editStatuss,
1726
- this.internalColumns[i].params.visibleStates,
1727
- this.internalColumns[i].params.visibleStatuss
1728
- )
1729
- this.internalColumns[i].params.edit = editVisible.edit
1730
- if (this.internalColumns[i].editRender) {
1731
- this.internalColumns[i].editRender.enabled = editVisible.edit
1732
- }
1771
+ this.internalColumns[i].params.columns[j].editStates,
1772
+ this.internalColumns[i].params.columns[j].editStatuss,
1773
+ this.internalColumns[i].params.columns[j].visibleStates,
1774
+ this.internalColumns[i].params.columns[j].visibleStatuss
1775
+ );
1776
+ this.$set(
1777
+ this.internalColumns[i].params.columns[j],
1778
+ "visible",
1779
+ editVisible.visible
1780
+ );
1781
+ this.$set(
1782
+ this.internalColumns[i].params.columns[j],
1783
+ "edit",
1784
+ editVisible.edit
1785
+ );
1733
1786
  }
1734
- }
1735
- },
1736
- getColumnEdit(
1737
- originEdit,
1738
- currentState,
1739
- currentStatus,
1740
- editStates,
1741
- editStatuss,
1742
- visibleStates,
1743
- visibleStatuss
1744
- ) {
1745
- //显示状态控制
1746
- let fieldVisible = true
1747
- if (currentState && visibleStates && visibleStates.length > 0) {
1748
- //有显示状态控制
1749
- if (visibleStates.indexOf(currentState) < 0) {
1750
- fieldVisible = false
1751
- }
1752
- }
1753
- if (currentStatus && visibleStatuss && visibleStatuss.length > 0) {
1754
- if (visibleStatuss.indexOf(currentStatus) < 0) {
1755
- fieldVisible = false
1787
+ continue;
1788
+ }
1789
+ //设置网格列编辑状态
1790
+ if (this.gridEdit === true) {
1791
+ let editVisible = this.getColumnEdit(
1792
+ this.internalColumns[i].params.edit,
1793
+ currentState,
1794
+ currentStatus,
1795
+ this.internalColumns[i].params.editStates,
1796
+ this.internalColumns[i].params.editStatuss,
1797
+ this.internalColumns[i].params.visibleStates,
1798
+ this.internalColumns[i].params.visibleStatuss
1799
+ );
1800
+ this.internalColumns[i].params.edit = editVisible.edit;
1801
+ if (this.internalColumns[i].editRender) {
1802
+ this.internalColumns[i].editRender.enabled = editVisible.edit;
1756
1803
  }
1757
1804
  }
1758
-
1759
- //编辑状态控制
1760
- if (currentState && editStates) {
1761
- originEdit = editStates.indexOf(currentState) > -1
1762
- }
1763
- if (currentStatus && editStatuss) {
1764
- originEdit = editStatuss.indexOf(currentStatus) > -1
1805
+ }
1806
+ },
1807
+ getColumnEdit(
1808
+ originEdit,
1809
+ currentState,
1810
+ currentStatus,
1811
+ editStates,
1812
+ editStatuss,
1813
+ visibleStates,
1814
+ visibleStatuss
1815
+ ) {
1816
+ //显示状态控制
1817
+ let fieldVisible = true;
1818
+ if (currentState && visibleStates && visibleStates.length > 0) {
1819
+ //有显示状态控制
1820
+ if (visibleStates.indexOf(currentState) < 0) {
1821
+ fieldVisible = false;
1765
1822
  }
1766
- return { visible: fieldVisible, edit: originEdit }
1767
- },
1768
- cellValueChange(scope, e) {
1769
- console.debug(scope.column.field+'value change')
1770
- if (
1771
- scope.row['sysRowState'] !== 'add' &&
1772
- scope.row['sysRowState'] !== 'delete'
1773
- ) {
1774
- scope.row['sysRowState'] = 'update'
1823
+ }
1824
+ if (currentStatus && visibleStatuss && visibleStatuss.length > 0) {
1825
+ if (visibleStatuss.indexOf(currentStatus) < 0) {
1826
+ fieldVisible = false;
1775
1827
  }
1776
- this.$emit('valueChange', scope, this.dataName)
1777
- this.$refs.baseGrid.updateStatus(scope)
1778
- },
1779
- /**
1780
- * 异步插入
1781
- */
1782
- async insertAtAsync(row, index, autoSelect = true) {
1783
- let vm = this
1784
- row['sysRowState'] = 'add'
1785
- if (!row['id']) {
1786
- row['id'] = this.$store.getters.newId() + ''
1828
+ }
1829
+
1830
+ //编辑状态控制
1831
+ if (currentState && editStates) {
1832
+ originEdit = editStates.indexOf(currentState) > -1;
1833
+ }
1834
+ if (currentStatus && editStatuss) {
1835
+ originEdit = editStatuss.indexOf(currentStatus) > -1;
1836
+ }
1837
+ return { visible: fieldVisible, edit: originEdit };
1838
+ },
1839
+ cellValueChange(scope, e) {
1840
+ console.debug(scope.column.field + "value change");
1841
+ if (
1842
+ scope.row["sysRowState"] !== "add" &&
1843
+ scope.row["sysRowState"] !== "delete"
1844
+ ) {
1845
+ scope.row["sysRowState"] = "update";
1846
+ }
1847
+ this.$emit("valueChange", scope, this.dataName);
1848
+ this.$refs.baseGrid.updateStatus(scope);
1849
+ },
1850
+ /**
1851
+ * 异步插入
1852
+ */
1853
+ async insertAtAsync(row, index, autoSelect = true) {
1854
+ let vm = this;
1855
+ row["sysRowState"] = "add";
1856
+ if (!row["id"]) {
1857
+ row["id"] = this.$store.getters.newId() + "";
1858
+ }
1859
+ let insertRow = await this.$refs.baseGrid.insertAt(row, index);
1860
+ if (autoSelect === true) {
1861
+ this.$refs.baseGrid.setActiveRow(row);
1862
+ this.$refs.baseGrid.setCurrentRow(row);
1863
+ this.$emit("currentChange", row);
1864
+ }
1865
+ return insertRow;
1866
+ },
1867
+ insertAt(row, index, autoSelect = true, callback) {
1868
+ let vm = this;
1869
+ row["sysRowState"] = "add";
1870
+ if (!row["id"]) {
1871
+ row["id"] = this.$store.getters.newId() + "";
1872
+ }
1873
+ this.$refs.baseGrid.insertAt(row, index).then(({ row }) => {
1874
+ if (callback) {
1875
+ callback(row);
1787
1876
  }
1788
- let insertRow = await this.$refs.baseGrid.insertAt(row, index)
1877
+
1789
1878
  if (autoSelect === true) {
1790
- this.$refs.baseGrid.setActiveRow(row)
1791
- this.$refs.baseGrid.setCurrentRow(row)
1792
- this.$emit('currentChange', row)
1793
- }
1794
- return insertRow
1795
- },
1796
- insertAt(row, index, autoSelect = true, callback) {
1797
- let vm = this
1798
- row['sysRowState'] = 'add'
1799
- if (!row['id']) {
1800
- row['id'] = this.$store.getters.newId() + ''
1801
- }
1802
- this.$refs.baseGrid.insertAt(row, index).then(({ row }) => {
1803
- if (callback) {
1804
- callback(row)
1805
- }
1806
-
1807
- if (autoSelect === true) {
1808
- vm.$refs.baseGrid.setActiveRow(row)
1809
- vm.$refs.baseGrid.setCurrentRow(row)
1810
- // vm.rows.push(row)
1811
- vm.$emit('currentChange', row)
1812
- }
1813
- })
1814
- },
1815
- // insertTree(row,)
1816
- setCurrentRow(rowInfo) {
1817
- let vm = this
1818
- this.$refs.baseGrid.setCurrentRow(rowInfo).then(() => {
1819
- vm.$emit('currentChange', vm.$refs.baseGrid.getCurrentRecord())
1820
- })
1821
- },
1822
- getCurrentRow() {
1823
- return this.$refs.baseGrid.getCurrentRecord()
1824
- },
1825
- checkBoxChanged({ checked, records, row }) {
1826
- this.$emit('checkBoxChanged', checked, records, row)
1827
- },
1828
- checkBoxAllChanged({ checked, records }) {
1829
- this.$emit('checkBoxAllChanged', checked, records)
1830
- },
1831
- clearCurrentRow() {
1832
- this.$refs.baseGrid.clearCurrentRow()
1833
- },
1834
- clearCheckboxReserve() {
1835
- this.$refs.baseGrid.clearCheckboxReserve()
1836
- },
1837
- /**
1838
- * 表尾按钮操作
1839
- */
1840
- pagerBtnClick(pagerBtnInfo) {
1841
- this.$emit('pagerButtonClick', pagerBtnInfo, this)
1842
- },
1843
- /**
1844
- * 删除行
1845
- */
1846
- removeRow(row) {
1847
- return this.$refs.baseGrid.remove(row)
1848
- },
1849
- /**
1850
- * 删除所有行
1851
- */
1852
- removeAll() {
1853
- return this.$refs.baseGrid.remove()
1854
- },
1855
- getTableData() {
1856
- return this.$refs.baseGrid.getTableData().fullData
1857
- },
1858
- getVisibleData() {
1859
- return this.$refs.baseGrid.getTableData().visibleData
1860
- },
1861
- /**
1862
- * 获取更新的行
1863
- */
1864
- getUpdateRows() {
1865
- let tempRows = []
1866
- let tempTableData = this.$refs.baseGrid.getTableData().fullData
1867
- for (let i = 0; i < tempTableData.length; i++) {
1868
- let tempRow = tempTableData[i]
1869
- if (this.$refs.baseGrid.isInsertByRow(tempRow) === true) {
1870
- tempRow['sysRowState'] = 'add'
1871
- tempRows.push(tempRow)
1872
- continue
1873
- }
1874
- if (this.$refs.baseGrid.isUpdateByRow(tempRow) === true) {
1875
- // tempRow['sysRowState'] = 'update'
1876
- // tempRows.push(tempRow)
1877
- // continue
1878
- }
1879
- }
1880
-
1881
- let tempRemoveRows = this.$refs.baseGrid.getRemoveRecords()
1882
- for (let i = 0; i < tempRemoveRows.length; i++) {
1883
- let tempRow = tempRemoveRows[i]
1884
- tempRow['sysRowState'] = 'delete'
1885
- tempRows.push(tempRow)
1879
+ vm.$refs.baseGrid.setActiveRow(row);
1880
+ vm.$refs.baseGrid.setCurrentRow(row);
1881
+ // vm.rows.push(row)
1882
+ vm.$emit("currentChange", row);
1886
1883
  }
1887
- let tempUpdateRows = this.$refs.baseGrid.getUpdateRecords()
1888
- for (let i = 0; i < tempUpdateRows.length; i++) {
1889
- let tempRow = tempUpdateRows[i]
1890
- tempRow['sysRowState'] = 'update'
1891
- tempRows.push(tempRow)
1892
- }
1893
-
1894
- return tempRows
1895
- },
1896
- async fullValidate() {
1897
- const errMap = await this.$refs.baseGrid
1898
- .fullValidate(true)
1899
- .catch(errMap => errMap)
1900
- let errorMsgList = []
1901
- if (errMap) {
1902
- Object.values(errMap).forEach(errList => {
1903
- errList.forEach(params => {
1904
- const { rowIndex, column, rules, row } = params
1905
- let tempRowIndex = this.$refs.baseGrid.getVTRowIndex(row)
1906
- rules.forEach(rule => {
1907
- errorMsgList.push(
1908
- `第 ${tempRowIndex + 1} 行 ${column.title} 校验错误:${
1909
- rule.message
1910
- }`
1911
- )
1912
- })
1913
- })
1914
- })
1915
- }
1916
-
1917
- return errorMsgList
1918
- },
1919
- preSearch(searchInfo, scope) {
1920
- this.$emit('preSearch', searchInfo, scope)
1921
- },
1922
- pulldownBtnClick(btn) {
1923
- this.$emit('pulldownBtnClick', btn)
1924
- },
1925
- pulldownMultiSelect(scope, pulldownView, selectRows) {
1926
- //第一行选中
1927
- pulldownView.setLinkValue(selectRows[0], scope.row)
1928
- this.cellValueChange(scope)
1929
- let vm = this
1930
- for (let i = 1; i < selectRows.length; i++) {
1931
- let tempSelectRow = selectRows[i]
1932
- this.$emit('defaultRow', newRow => {
1933
- pulldownView.setLinkValue(tempSelectRow, newRow)
1934
- vm.insertAt(newRow, -1, false, insertRow => {
1935
- vm.cellValueChange({ row: insertRow, column: scope.column })
1936
- })
1937
- })
1938
- }
1939
- },
1940
- resizableChange(scope) {
1941
- this.$emit('resizableChange', scope)
1942
- },
1943
- setVisiable(fields, visible) {
1944
- fields.forEach(field => {
1945
- let column = this.$refs.baseGrid.getColumnByField(field)
1946
- column.visible = visible
1947
- })
1948
- this.$refs.baseGrid.refreshColumn()
1949
- },
1950
- reloadColumn(columns) {
1951
- this.internalColumns = []
1952
- if (this.showSeq) {
1953
- this.internalColumns.push({
1954
- type: 'seq',
1955
- fixed: 'left',
1956
- width: 50,
1957
- slots: {
1958
- header: 'seqHeader'
1959
- },
1960
- params: {
1961
- disableUserVisible: true
1962
- }
1963
- })
1884
+ });
1885
+ },
1886
+ // insertTree(row,)
1887
+ setCurrentRow(rowInfo) {
1888
+ let vm = this;
1889
+ this.$refs.baseGrid.setCurrentRow(rowInfo).then(() => {
1890
+ vm.$emit("currentChange", vm.$refs.baseGrid.getCurrentRecord());
1891
+ });
1892
+ },
1893
+ getCurrentRow() {
1894
+ return this.$refs.baseGrid.getCurrentRecord();
1895
+ },
1896
+ checkBoxChanged({ checked, records, row }) {
1897
+ this.$emit("checkBoxChanged", checked, records, row);
1898
+ },
1899
+ checkBoxAllChanged({ checked, records }) {
1900
+ this.$emit("checkBoxAllChanged", checked, records);
1901
+ },
1902
+ clearCurrentRow() {
1903
+ this.$refs.baseGrid.clearCurrentRow();
1904
+ },
1905
+ clearCheckboxReserve() {
1906
+ this.$refs.baseGrid.clearCheckboxReserve();
1907
+ },
1908
+ /**
1909
+ * 表尾按钮操作
1910
+ */
1911
+ pagerBtnClick(pagerBtnInfo) {
1912
+ this.$emit("pagerButtonClick", pagerBtnInfo, this);
1913
+ },
1914
+ /**
1915
+ * 删除行
1916
+ */
1917
+ removeRow(row) {
1918
+ return this.$refs.baseGrid.remove(row);
1919
+ },
1920
+ /**
1921
+ * 删除所有行
1922
+ */
1923
+ removeAll() {
1924
+ return this.$refs.baseGrid.remove();
1925
+ },
1926
+ getTableData() {
1927
+ return this.$refs.baseGrid.getTableData().fullData;
1928
+ },
1929
+ getVisibleData() {
1930
+ return this.$refs.baseGrid.getTableData().visibleData;
1931
+ },
1932
+ /**
1933
+ * 获取更新的行
1934
+ */
1935
+ getUpdateRows() {
1936
+ let tempRows = [];
1937
+ let tempTableData = this.$refs.baseGrid.getTableData().fullData;
1938
+ for (let i = 0; i < tempTableData.length; i++) {
1939
+ let tempRow = tempTableData[i];
1940
+ if (this.$refs.baseGrid.isInsertByRow(tempRow) === true) {
1941
+ tempRow["sysRowState"] = "add";
1942
+ tempRows.push(tempRow);
1943
+ continue;
1944
+ }
1945
+ if (this.$refs.baseGrid.isUpdateByRow(tempRow) === true) {
1946
+ // tempRow['sysRowState'] = 'update'
1947
+ // tempRows.push(tempRow)
1948
+ // continue
1964
1949
  }
1965
- if (this.showCheckBox) {
1966
- this.internalColumns.push({
1967
- type: 'checkbox',
1968
- fixed: 'left',
1969
- width: 40,
1970
- params: {
1971
- disableUserVisible: true
1950
+ }
1951
+
1952
+ let tempRemoveRows = this.$refs.baseGrid.getRemoveRecords();
1953
+ for (let i = 0; i < tempRemoveRows.length; i++) {
1954
+ let tempRow = tempRemoveRows[i];
1955
+ tempRow["sysRowState"] = "delete";
1956
+ tempRows.push(tempRow);
1957
+ }
1958
+ let tempUpdateRows = this.$refs.baseGrid.getUpdateRecords();
1959
+ for (let i = 0; i < tempUpdateRows.length; i++) {
1960
+ let tempRow = tempUpdateRows[i];
1961
+ tempRow["sysRowState"] = "update";
1962
+ tempRows.push(tempRow);
1963
+ }
1964
+
1965
+ return tempRows;
1966
+ },
1967
+ async fullValidate() {
1968
+ const errMap = await this.$refs.baseGrid
1969
+ .fullValidate(true)
1970
+ .catch((errMap) => errMap);
1971
+ let errorMsgList = [];
1972
+ if (errMap) {
1973
+ Object.values(errMap).forEach((errList) => {
1974
+ errList.forEach((params) => {
1975
+ const { rowIndex, column, rules, row } = params;
1976
+ let tempRowIndex = this.$refs.baseGrid.getVTRowIndex(row);
1977
+ rules.forEach((rule) => {
1978
+ errorMsgList.push(
1979
+ `第 ${tempRowIndex + 1} 行 ${column.title} 校验错误:${
1980
+ rule.message
1981
+ }`
1982
+ );
1983
+ });
1984
+ });
1985
+ });
1986
+ }
1987
+
1988
+ return errorMsgList;
1989
+ },
1990
+ preSearch(searchInfo, scope) {
1991
+ this.$emit("preSearch", searchInfo, scope);
1992
+ },
1993
+ pulldownBtnClick(btn) {
1994
+ this.$emit("pulldownBtnClick", btn);
1995
+ },
1996
+ pulldownMultiSelect(scope, pulldownView, selectRows) {
1997
+ //第一行选中
1998
+ pulldownView.setLinkValue(selectRows[0], scope.row);
1999
+ this.cellValueChange(scope);
2000
+ let vm = this;
2001
+ for (let i = 1; i < selectRows.length; i++) {
2002
+ let tempSelectRow = selectRows[i];
2003
+ this.$emit("defaultRow", (newRow) => {
2004
+ pulldownView.setLinkValue(tempSelectRow, newRow);
2005
+ vm.insertAt(newRow, -1, false, (insertRow) => {
2006
+ vm.cellValueChange({ row: insertRow, column: scope.column });
2007
+ });
2008
+ });
2009
+ }
2010
+ },
2011
+ resizableChange(scope) {
2012
+ this.$emit("resizableChange", scope);
2013
+ },
2014
+ setVisiable(fields, visible) {
2015
+ fields.forEach((field) => {
2016
+ let column = this.$refs.baseGrid.getColumnByField(field);
2017
+ column.visible = visible;
2018
+ });
2019
+ this.$refs.baseGrid.refreshColumn();
2020
+ },
2021
+ reloadColumn(columns) {
2022
+ this.internalColumns = [];
2023
+ if (this.showSeq) {
2024
+ this.internalColumns.push({
2025
+ type: "seq",
2026
+ fixed: "left",
2027
+ width: 50,
2028
+ slots: {
2029
+ header: "seqHeader",
2030
+ },
2031
+ params: {
2032
+ disableUserVisible: true,
2033
+ },
2034
+ });
2035
+ }
2036
+ if (this.showCheckBox) {
2037
+ this.internalColumns.push({
2038
+ type: "checkbox",
2039
+ fixed: "left",
2040
+ width: 40,
2041
+ params: {
2042
+ disableUserVisible: true,
2043
+ },
2044
+ });
2045
+ }
2046
+ columns.forEach((column) => {
2047
+ this.internalColumns.push(this.initColumns(column));
2048
+ });
2049
+ this.$refs.baseGrid.refreshColumn();
2050
+ },
2051
+ addRules(fields, rules) {
2052
+ fields.forEach((field) => {
2053
+ this.$set(this.validRules, field, rules);
2054
+ });
2055
+ this.$refs.baseGrid.refreshColumn();
2056
+ },
2057
+ /**
2058
+ * 表尾
2059
+ */
2060
+ footerMethod({ columns, data }) {
2061
+ if (this.footerSum.length > 0) {
2062
+ return [
2063
+ columns.map((column, columnIndex) => {
2064
+ if (columnIndex === 0) {
2065
+ return "合计";
1972
2066
  }
1973
- })
1974
- }
1975
- columns.forEach(column => {
1976
- this.internalColumns.push(this.initColumns(column))
1977
- })
1978
- this.$refs.baseGrid.refreshColumn()
1979
- },
1980
- addRules(fields, rules) {
1981
- fields.forEach(field => {
1982
- this.$set(this.validRules, field, rules)
1983
- })
1984
- this.$refs.baseGrid.refreshColumn()
1985
- },
1986
- /**
1987
- * 表尾
1988
- */
1989
- footerMethod({ columns, data }) {
1990
- if (this.footerSum.length > 0) {
1991
- return [
1992
- columns.map((column, columnIndex) => {
1993
- if (columnIndex === 0) {
1994
- return '合计'
1995
- }
1996
- if (this.footerSum.includes(column.property)) {
1997
- let tempSumVal = XEUtils.sum(data, column.property)
1998
- if (
1999
- column.formatter &&
2000
- column.formatter !== 'defaultFormat' &&
2001
- VXETable.formats.store[column.formatter]
2002
- ) {
2003
- tempSumVal = VXETable.formats.store[column.formatter]({
2004
- cellValue: tempSumVal
2005
- })
2006
- }
2007
- return tempSumVal
2067
+ if (this.footerSum.includes(column.property)) {
2068
+ let tempSumVal = XEUtils.sum(data, column.property);
2069
+ if (
2070
+ column.formatter &&
2071
+ column.formatter !== "defaultFormat" &&
2072
+ VXETable.formats.store[column.formatter]
2073
+ ) {
2074
+ tempSumVal = VXETable.formats.store[column.formatter]({
2075
+ cellValue: tempSumVal,
2076
+ });
2008
2077
  }
2009
- return null
2010
- })
2011
- ]
2012
- } else {
2013
- return []
2014
- }
2015
- },
2016
- cellClick({ row, column }) {
2017
- this.$emit('cellClick', { row, column })
2018
- //判断是否可以跳转
2019
- if (
2020
- this.gridEdit != true ||
2021
- !(column.editRender && column.editRender.enabled === true)
2022
- ) {
2023
- if (column.params && column.params.route) {
2024
- let tempRouteName = column.params.route.name
2025
- if (XEUtils.isArray(tempRouteName)) {
2026
- //需要不同条件跳转不同页面
2027
- for (let i = 0; i < tempRouteName.length; i++) {
2028
- if (tempRouteName[i].value === row[tempRouteName[i].field]) {
2029
- tempRouteName = tempRouteName[i].name
2030
- break
2031
- }
2078
+ return tempSumVal;
2079
+ }
2080
+ return null;
2081
+ }),
2082
+ ];
2083
+ } else {
2084
+ return [];
2085
+ }
2086
+ },
2087
+ cellClick({ row, column }) {
2088
+ this.$emit("cellClick", { row, column });
2089
+ //判断是否可以跳转
2090
+ if (
2091
+ this.gridEdit != true ||
2092
+ !(column.editRender && column.editRender.enabled === true)
2093
+ ) {
2094
+ if (column.params && column.params.route) {
2095
+ let tempRouteName = column.params.route.name;
2096
+ if (XEUtils.isArray(tempRouteName)) {
2097
+ //需要不同条件跳转不同页面
2098
+ for (let i = 0; i < tempRouteName.length; i++) {
2099
+ if (tempRouteName[i].value === row[tempRouteName[i].field]) {
2100
+ tempRouteName = tempRouteName[i].name;
2101
+ break;
2032
2102
  }
2033
2103
  }
2034
-
2035
- this.$router.pushRoute({
2036
- name: tempRouteName,
2037
- query: { id: row[column.params.route.field] }
2038
- })
2039
- return
2040
2104
  }
2105
+
2106
+ this.$router.pushRoute({
2107
+ name: tempRouteName,
2108
+ query: { id: row[column.params.route.field] },
2109
+ });
2110
+ return;
2041
2111
  }
2042
- // 判断当前网格是否可以编辑状态
2043
- if (this.gridEdit !== true) {
2044
- return
2045
- }
2046
- if (this.$refs.baseGrid.isActiveByRow(row) === true) {
2047
- //判断当前行是否是编辑行
2048
- return
2049
- }
2050
- // column.editRender.enabled = false
2051
- if (column.editRender && column.editRender.enabled === true) {
2052
- this.$refs.baseGrid.setActiveCell(row, column)
2112
+ }
2113
+ // 判断当前网格是否可以编辑状态
2114
+ if (this.gridEdit !== true) {
2115
+ return;
2116
+ }
2117
+ if (this.$refs.baseGrid.isActiveByRow(row) === true) {
2118
+ //判断当前行是否是编辑行
2119
+ return;
2120
+ }
2121
+ // column.editRender.enabled = false
2122
+ if (column.editRender && column.editRender.enabled === true) {
2123
+ this.$refs.baseGrid.setActiveCell(row, column);
2124
+ } else {
2125
+ this.$refs.baseGrid.setActiveRow(row);
2126
+ }
2127
+ },
2128
+ customSetActive(id) {
2129
+ let fullData = this.$refs.baseGrid.getTableData().fullData;
2130
+ let row = fullData.find((x) => x.id == id);
2131
+ this.$refs.baseGrid.setCurrentRow(row);
2132
+ },
2133
+ gridRowStyle(scope) {},
2134
+ bodyScroll(scrollInfo) {
2135
+ this.$emit("scroll", scrollInfo);
2136
+ // if (scrollInfo.isX === true) {
2137
+ // // this.$refs.lineArea.style.marginLeft =
2138
+ // // (scrollInfo.scrollLeft-(this.fixedColWidth-this.colWidth)) * -1 + 'px'
2139
+
2140
+ // // this.$refs.headMonth.scrollTo(scrollInfo.scrollLeft)
2141
+ // this.$refs.headDay.scrollTo(scrollInfo.scrollLeft)
2142
+ // this.$refs.headHour.scrollTo(scrollInfo.scrollLeft)
2143
+ // }
2144
+ },
2145
+ getRadioRecord(isFull) {
2146
+ return this.$refs.baseGrid.getRadioRecord(isFull);
2147
+ },
2148
+ setRadioRow(rowInfo) {
2149
+ this.$refs.baseGrid.setRadioRow(rowInfo);
2150
+ },
2151
+ editClosedEvent({ row, column }) {
2152
+ // const $table = this.$refs.baseGrid
2153
+ // const field = column.property
2154
+ // const cellValue = row[field]
2155
+ // $table.reloadRow(row, null, field)
2156
+ // 判断单元格值是否被修改
2157
+ // if ($table.isUpdateByRow(row, field)) {
2158
+ // $table.reloadRow(row, null, field)
2159
+ // // setTimeout(() => {
2160
+ // // this.$XModal.message({
2161
+ // // content: `局部保存成功! ${field}=${cellValue}`,
2162
+ // // status: 'success'
2163
+ // // })
2164
+ // // // 局部更新单元格为已保存状态
2165
+ // // $table.reloadRow(row, null, field)
2166
+ // // }, 300)
2167
+ // }
2168
+ },
2169
+ // 通用行合并函数(将相同多列数据合并为一行)
2170
+ rowspanMethod({ row, _rowIndex, column, visibleData }) {
2171
+ // let fields = ['role']
2172
+ let cellValue = row[column.property];
2173
+ if (cellValue && this.mergeFields.includes(column.property)) {
2174
+ let prevRow = visibleData[_rowIndex - 1];
2175
+ let nextRow = visibleData[_rowIndex + 1];
2176
+ if (prevRow && prevRow[column.property] === cellValue) {
2177
+ return { rowspan: 0, colspan: 0 };
2053
2178
  } else {
2054
- this.$refs.baseGrid.setActiveRow(row)
2179
+ let countRowspan = 1;
2180
+ while (nextRow && nextRow[column.property] === cellValue) {
2181
+ nextRow = visibleData[++countRowspan + _rowIndex];
2182
+ }
2183
+ if (countRowspan > 1) {
2184
+ return { rowspan: countRowspan, colspan: 1 };
2185
+ }
2055
2186
  }
2056
- },
2057
- customSetActive(id) {
2058
- let fullData = this.$refs.baseGrid.getTableData().fullData
2059
- let row = fullData.find(x => x.id == id)
2060
- this.$refs.baseGrid.setCurrentRow(row)
2061
- },
2062
- gridRowStyle(scope) {},
2063
- bodyScroll(scrollInfo) {
2064
- this.$emit('scroll', scrollInfo)
2065
- // if (scrollInfo.isX === true) {
2066
- // // this.$refs.lineArea.style.marginLeft =
2067
- // // (scrollInfo.scrollLeft-(this.fixedColWidth-this.colWidth)) * -1 + 'px'
2068
-
2069
- // // this.$refs.headMonth.scrollTo(scrollInfo.scrollLeft)
2070
- // this.$refs.headDay.scrollTo(scrollInfo.scrollLeft)
2071
- // this.$refs.headHour.scrollTo(scrollInfo.scrollLeft)
2072
- // }
2073
- },
2074
- getRadioRecord(isFull) {
2075
- return this.$refs.baseGrid.getRadioRecord(isFull)
2076
- },
2077
- setRadioRow(rowInfo) {
2078
- this.$refs.baseGrid.setRadioRow(rowInfo)
2079
- },
2080
- editClosedEvent({ row, column }) {
2081
- // const $table = this.$refs.baseGrid
2082
- // const field = column.property
2083
- // const cellValue = row[field]
2084
- // $table.reloadRow(row, null, field)
2085
- // 判断单元格值是否被修改
2086
- // if ($table.isUpdateByRow(row, field)) {
2087
- // $table.reloadRow(row, null, field)
2088
- // // setTimeout(() => {
2089
- // // this.$XModal.message({
2090
- // // content: `局部保存成功! ${field}=${cellValue}`,
2091
- // // status: 'success'
2092
- // // })
2093
- // // // 局部更新单元格为已保存状态
2094
- // // $table.reloadRow(row, null, field)
2095
- // // }, 300)
2096
- // }
2097
- },
2098
- // 通用行合并函数(将相同多列数据合并为一行)
2099
- rowspanMethod({ row, _rowIndex, column, visibleData }) {
2100
- // let fields = ['role']
2101
- let cellValue = row[column.property]
2102
- if (cellValue && this.mergeFields.includes(column.property)) {
2103
- let prevRow = visibleData[_rowIndex - 1]
2104
- let nextRow = visibleData[_rowIndex + 1]
2105
- if (prevRow && prevRow[column.property] === cellValue) {
2106
- return { rowspan: 0, colspan: 0 }
2107
- } else {
2108
- let countRowspan = 1
2109
- while (nextRow && nextRow[column.property] === cellValue) {
2110
- nextRow = visibleData[++countRowspan + _rowIndex]
2111
- }
2112
- if (countRowspan > 1) {
2113
- return { rowspan: countRowspan, colspan: 1 }
2114
- }
2187
+ }
2188
+ },
2189
+ clearAll() {
2190
+ let vm = this;
2191
+ vm.$refs.baseGrid.clearAll();
2192
+ },
2193
+ reloadData(data) {
2194
+ let vm = this;
2195
+ vm.$refs.baseGrid.reloadData(data);
2196
+ },
2197
+ setLoading(e) {
2198
+ this.loading = e;
2199
+ },
2200
+ //清空筛选
2201
+ clearFilter() {
2202
+ let vm = this;
2203
+ // 示例
2204
+ const filterList = vm.$refs.baseGrid.getCheckedFilters();
2205
+ filterList.forEach((col) => {
2206
+ col.column.filters = [];
2207
+ });
2208
+ vm.$refs.baseGrid.clearFilter();
2209
+ },
2210
+ filterAddExp(colInfo) {
2211
+ colInfo.filters[0].data.displayValues.push({
2212
+ value: [null, null],
2213
+ });
2214
+ },
2215
+ filterConfirm(colInfo) {
2216
+ colInfo.filters[0].data.bindingValues = [];
2217
+ XEUtils.arrayEach(colInfo.filters[0].data.displayValues, (item) => {
2218
+ if (colInfo.params.controlType === controlType.select) {
2219
+ colInfo.filters[0].data.bindingValues.push(item);
2220
+ } else {
2221
+ if (item.value[0] || item.value[1]) {
2222
+ colInfo.filters[0].data.bindingValues.push(item);
2115
2223
  }
2116
2224
  }
2117
- },
2118
- clearAll() {
2119
- let vm = this
2120
- vm.$refs.baseGrid.clearAll()
2121
- },
2122
- reloadData(data) {
2123
- let vm = this
2124
- vm.$refs.baseGrid.reloadData(data)
2125
- },
2126
- setLoading(e) {
2127
- this.loading = e
2128
- },
2129
- //清空筛选
2130
- clearFilter() {
2131
- let vm = this
2132
- // 示例
2133
- const filterList = vm.$refs.baseGrid.getCheckedFilters()
2134
- filterList.forEach(col => {
2135
- col.column.filters = []
2136
- })
2137
- vm.$refs.baseGrid.clearFilter()
2138
- },
2139
- filterAddExp(colInfo){
2140
- colInfo.filters[0].data.displayValues.push({
2141
- value: [null, null],
2142
- });
2143
- },
2144
- filterConfirm(colInfo){
2145
- colInfo.filters[0].data.bindingValues = [];
2146
- XEUtils.arrayEach(colInfo.filters[0].data.displayValues, (item) => {
2147
- if (colInfo.params.controlType === controlType.select) {
2148
- colInfo.filters[0].data.bindingValues.push(item);
2149
- } else {
2150
- if (item.value[0] || item.value[1]) {
2151
- colInfo.filters[0].data.bindingValues.push(item);
2152
- }
2153
- }
2225
+ });
2226
+ colInfo.filters[0].checked =
2227
+ colInfo.filters[0].data.bindingValues.length > 0;
2228
+
2229
+ //设置筛选过滤条件
2230
+ this.setFilterExpression();
2231
+ //通知外部筛选改变事件
2232
+ this.$emit("filterChange", { filterCol: colInfo });
2233
+ },
2234
+ setFilterExpression() {
2235
+ XEUtils.clear(this.filterExpression);
2236
+ XEUtils.clear(this.filterStr);
2237
+ XEUtils.arrayEach(this.internalColumns, (loopColInfo) => {
2238
+ if (!loopColInfo.filters) {
2239
+ return;
2240
+ }
2241
+ if (loopColInfo.filters[0].data.bindingValues.length === 0) {
2242
+ return;
2243
+ }
2244
+ //开始构造条件
2245
+ let tempStr = {
2246
+ field: loopColInfo.field,
2247
+ title: loopColInfo.title,
2248
+ exp: "",
2249
+ };
2250
+ let expStr = "";
2251
+ let filterBindingValues = loopColInfo.filters[0].data.bindingValues;
2252
+
2253
+ //筛选条件过滤
2254
+ let colFilterExpression = { operator: "or", expressions: [] };
2255
+
2256
+ if (loopColInfo.params.controlType === controlType.select) {
2257
+ colFilterExpression.expressions.push({
2258
+ field: loopColInfo.field,
2259
+ operator: "IN",
2260
+ value: filterBindingValues,
2154
2261
  });
2155
- colInfo.filters[0].checked = colInfo.filters[0].data.bindingValues.length > 0;
2156
-
2157
- //设置筛选过滤条件
2158
- this.setFilterExpression();
2159
- //通知外部筛选改变事件
2160
- this.$emit('filterChange', { filterCol: colInfo });
2161
- },
2162
- setFilterExpression(){
2163
- XEUtils.clear(this.filterExpression);
2164
- XEUtils.clear(this.filterStr);
2165
- XEUtils.arrayEach(this.internalColumns, (loopColInfo) => {
2166
- if (!loopColInfo.filters) {
2167
- return
2168
- }
2169
- if (loopColInfo.filters[0].data.bindingValues.length === 0) {
2170
- return
2171
- }
2172
- //开始构造条件
2173
- let tempStr = {
2174
- field: loopColInfo.field,
2175
- title: loopColInfo.title,
2176
- exp: '',
2177
- }
2178
- let expStr = ''
2179
- let filterBindingValues = loopColInfo.filters[0].data.bindingValues;
2180
-
2181
- //筛选条件过滤
2182
- let colFilterExpression = { operator: 'or', expressions: [] };
2183
-
2184
- if (loopColInfo.params.controlType === controlType.select) {
2185
- colFilterExpression.expressions.push({
2186
- field: loopColInfo.field,
2187
- operator: 'IN',
2188
- value: filterBindingValues,
2189
- });
2190
- this.filterExpression.push(colFilterExpression);
2191
- tempStr.exp = '存在于 ' + filterBindingValues;
2192
- this.filterStr.push(tempStr);
2193
- return;
2194
- }
2195
-
2196
- XEUtils.arrayEach(filterBindingValues, (loopBindingValue) => {
2197
- let tempPushExp = {
2198
- field: loopColInfo.field,
2199
- operator: 'CO',
2200
- value: [],
2201
- };
2202
- switch (loopColInfo.params.controlType) {
2203
- case controlType.date:
2204
- case controlType.datetime:
2205
- if (loopBindingValue.value[0] && loopBindingValue.value[1]) {
2206
- tempPushExp.operator = 'RA';
2207
- tempPushExp.value = loopBindingValue.value;
2208
- expStr = '范围';
2209
- tempStr.exp =
2210
- tempStr.exp +
2211
- loopBindingValue.value[0] +
2212
- '到' +
2213
- loopBindingValue.value[1] +
2214
- '或';
2215
- } else if (loopBindingValue.value[0]) {
2216
- tempPushExp.operator = 'GE';
2217
- tempPushExp.value = loopBindingValue.value[0];
2218
- tempStr.exp = tempStr.exp + tempPushExp.value + '或';
2219
- expStr = '大于等于';
2220
- } else {
2221
- tempPushExp.operator = 'LE';
2222
- tempPushExp.value = loopBindingValue.value[1];
2223
- tempStr.exp = tempStr.exp + tempPushExp.value + '或';
2224
- expStr = '小于等于';
2225
- }
2226
- break;
2227
- default:
2228
- tempPushExp.value = loopBindingValue.value[0];
2229
- expStr = '包含';
2230
- tempStr.exp = tempStr.exp + loopBindingValue.value[0] + '或';
2262
+ this.filterExpression.push(colFilterExpression);
2263
+ tempStr.exp = "存在于 " + filterBindingValues;
2264
+ this.filterStr.push(tempStr);
2265
+ return;
2266
+ }
2267
+
2268
+ XEUtils.arrayEach(filterBindingValues, (loopBindingValue) => {
2269
+ let tempPushExp = {
2270
+ field: loopColInfo.field,
2271
+ operator: "CO",
2272
+ value: [],
2273
+ };
2274
+ switch (loopColInfo.params.controlType) {
2275
+ case controlType.date:
2276
+ case controlType.datetime:
2277
+ if (loopBindingValue.value[0] && loopBindingValue.value[1]) {
2278
+ tempPushExp.operator = "RA";
2279
+ tempPushExp.value = loopBindingValue.value;
2280
+ expStr = "范围";
2281
+ tempStr.exp =
2282
+ tempStr.exp +
2283
+ loopBindingValue.value[0] +
2284
+ "到" +
2285
+ loopBindingValue.value[1] +
2286
+ "或";
2287
+ } else if (loopBindingValue.value[0]) {
2288
+ tempPushExp.operator = "GE";
2289
+ tempPushExp.value = loopBindingValue.value[0];
2290
+ tempStr.exp = tempStr.exp + tempPushExp.value + "或";
2291
+ expStr = "大于等于";
2292
+ } else {
2293
+ tempPushExp.operator = "LE";
2294
+ tempPushExp.value = loopBindingValue.value[1];
2295
+ tempStr.exp = tempStr.exp + tempPushExp.value + "或";
2296
+ expStr = "小于等于";
2231
2297
  }
2232
- colFilterExpression.expressions.push(tempPushExp);
2233
- });
2234
- this.filterExpression.push(colFilterExpression);
2235
- tempStr.exp = expStr + tempStr.exp.substring(0, tempStr.exp.length - 1)
2236
- this.filterStr.push(tempStr);
2237
- });
2238
-
2239
- this.toolBarConfig.enabled = this.filterExpression.length > 0
2240
- },
2241
- filterVisible({column,visible}){
2242
- if (visible) {
2243
- //重新赋值过滤的显示值
2244
- column.filters[0].data.displayValues = []
2245
- XEUtils.arrayEach(column.filters[0].data.bindingValues, (item) => {
2246
- column.filters[0].data.displayValues.push(item)
2247
- });
2248
- if (column.params.controlType !== controlType.select) {
2249
- column.filters[0].data.displayValues.push({
2250
- value: [null, null],
2251
- });
2252
- }
2253
- //设置第一个输入框光标选中
2254
- let tempClassName = column.field + '_filter_0';
2255
- setTimeout(() => {
2256
- document.getElementsByClassName(tempClassName)[0].children[0].select();
2257
- document.getElementsByClassName(tempClassName)[0].children[0].focus();
2258
- }, 10);
2298
+ break;
2299
+ default:
2300
+ tempPushExp.value = loopBindingValue.value[0];
2301
+ expStr = "包含";
2302
+ tempStr.exp = tempStr.exp + loopBindingValue.value[0] + "或";
2259
2303
  }
2304
+ colFilterExpression.expressions.push(tempPushExp);
2305
+ });
2306
+ this.filterExpression.push(colFilterExpression);
2307
+ tempStr.exp = expStr + tempStr.exp.substring(0, tempStr.exp.length - 1);
2308
+ this.filterStr.push(tempStr);
2309
+ });
2310
+
2311
+ this.toolBarConfig.enabled = this.filterExpression.length > 0;
2312
+ },
2313
+ filterVisible({ column, visible }) {
2314
+ if (visible) {
2315
+ //重新赋值过滤的显示值
2316
+ column.filters[0].data.displayValues = [];
2317
+ XEUtils.arrayEach(column.filters[0].data.bindingValues, (item) => {
2318
+ column.filters[0].data.displayValues.push(item);
2319
+ });
2320
+ if (column.params.controlType !== controlType.select) {
2321
+ column.filters[0].data.displayValues.push({
2322
+ value: [null, null],
2323
+ });
2324
+ }
2325
+ //设置第一个输入框光标选中
2326
+ let tempClassName = column.field + "_filter_0";
2327
+ console.log(tempClassName);
2328
+ console.log(document);
2329
+ console.log(document.getElementsByClassName(tempClassName)[0]);
2330
+ setTimeout(() => {
2331
+ document
2332
+ .getElementsByClassName(tempClassName)[0]
2333
+ .children[0].select();
2334
+ document.getElementsByClassName(tempClassName)[0].children[0].focus();
2335
+ }, 10);
2260
2336
  }
2261
- }
2262
- }
2263
- </script>
2337
+ },
2338
+ },
2339
+ };
2340
+ </script>
2264
2341
 
2265
2342
  <style>
2266
- .base-grid-view .ant-btn-link {
2267
- padding: 0 6px;
2268
- }
2269
- .base-grid-view .vxe-body--column.col-red {
2270
- background-color: rgb(227, 9, 53);
2271
- color: rgb(55, 55, 55);
2272
- /* font-weight: bold; */
2273
- }
2274
- .base-grid-view .vxe-body--column.col-orange {
2275
- background-color: rgb(237, 216, 20);
2276
- color: rgb(55, 55, 55);
2277
- /* font-weight: bold; */
2278
- }
2279
- .base-grid-view .vxe-body--column.col-grey {
2280
- background-color: rgb(140, 140, 138);
2281
- color: rgb(55, 55, 55);
2282
- /* font-weight: bold; */
2283
- }
2284
- .base-grid-view .vxe-body--column.col-blue {
2285
- background-color: #1890ff;
2286
- color: rgb(55, 55, 55);
2287
- /* font-weight: bold; */
2288
- }
2289
-
2290
- .base-grid-view .vxe-icon--caret-top {
2291
- color: "#c0c4cc" !important;
2292
- }
2293
- .base-grid-view .vxe-icon--caret-bottom {
2294
- color: "#c0c4cc" !important;
2295
- }
2296
- .vxe-icon--caret-top:hover {
2297
- color: #409eff;
2298
- }
2299
- .vxe-icon--caret-bottom:hover {
2300
- color: #409eff;
2301
- }
2302
- </style>
2343
+ .base-grid-view .ant-btn-link {
2344
+ padding: 0 6px;
2345
+ }
2346
+ .base-grid-view .vxe-body--column.col-red {
2347
+ background-color: rgb(227, 9, 53);
2348
+ color: rgb(55, 55, 55);
2349
+ /* font-weight: bold; */
2350
+ }
2351
+ .base-grid-view .vxe-body--column.col-orange {
2352
+ background-color: rgb(237, 216, 20);
2353
+ color: rgb(55, 55, 55);
2354
+ /* font-weight: bold; */
2355
+ }
2356
+ .base-grid-view .vxe-body--column.col-grey {
2357
+ background-color: rgb(140, 140, 138);
2358
+ color: rgb(55, 55, 55);
2359
+ /* font-weight: bold; */
2360
+ }
2361
+ .base-grid-view .vxe-body--column.col-blue {
2362
+ background-color: #1890ff;
2363
+ color: rgb(55, 55, 55);
2364
+ /* font-weight: bold; */
2365
+ }
2366
+
2367
+ .base-grid-view .vxe-icon--caret-top {
2368
+ color: "#c0c4cc" !important;
2369
+ }
2370
+ .base-grid-view .vxe-icon--caret-bottom {
2371
+ color: "#c0c4cc" !important;
2372
+ }
2373
+ .vxe-icon--caret-top:hover {
2374
+ color: #409eff;
2375
+ }
2376
+ .vxe-icon--caret-bottom:hover {
2377
+ color: #409eff;
2378
+ }
2379
+ </style>
2303
2380
  <style lang="scss" scoped>
2304
- .base-grid-view .vxe-header--row .vxe-header--column.sortable-ghost,
2305
- .base-grid-view .vxe-header--row .vxe-header--column.sortable-chosen {
2306
- background-color: #dfecfb;
2307
- }
2308
- .base-grid-view .vxe-header--row .vxe-header--column.col--fixed {
2309
- cursor: no-drop;
2310
- }
2311
- .inner-cell-control {
2312
- width: 100% !important;
2313
- min-width:unset!important;
2314
- }
2315
- .input-box {
2316
- width: 100%;
2317
- border: 1px solid;
2318
- min-height: 24px;
2319
- border-radius: 4px;
2320
- border-color: rgb(217, 217, 217);
2321
- padding-left: 5px;
2322
- line-height: 24px !important;
2323
- }
2324
- .test_filter {
2325
- text-align: left;
2326
- // display: inline-block;
2327
- // width:90%
2328
- }
2329
- .test_filter_title {
2330
- margin-left: 2%;
2331
- }
2332
- /*滚动条整体部分*/
2333
- .base-grid-view ::-webkit-scrollbar {
2334
- width: 10px;
2335
- height: 10px;
2336
- z-index: 10;
2337
- }
2338
- /*滚动条的轨道*/
2339
- .base-grid-view ::-webkit-scrollbar-track {
2340
- background-color: #ffffff;
2341
- z-index: 10;
2342
- }
2343
- /*滚动条里面的小方块,能向上向下移动*/
2344
- .base-grid-view ::-webkit-scrollbar-thumb {
2345
- background-color: #bfbfbf;
2346
- border-radius: 5px;
2347
- border: 1px solid #f1f1f1;
2348
- box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
2349
- z-index: 10;
2350
- }
2351
- .base-grid-view ::-webkit-scrollbar-thumb:hover {
2352
- background-color: #a8a8a8;
2353
- z-index: 10;
2354
- }
2355
- .base-grid-view ::-webkit-scrollbar-thumb:active {
2356
- background-color: #787878;
2357
- z-index: 10;
2358
- }
2359
- /*边角,即两个滚动条的交汇处*/
2360
- .base-grid-view ::-webkit-scrollbar-corner {
2361
- background-color: #ffffff;
2362
- z-index: 10;
2363
- }
2364
- .draggableItem {
2365
- display: inline-block;
2366
- height: 100%;
2367
- line-height: 30px;
2368
- border: 1.3px solid #e8eaec;
2369
- margin: 0 !important;
2370
- margin: 0 10px;
2371
- // overflow: hidden;
2372
- // text-overflow: ellipsis;
2373
- // white-space: nowrap;
2374
- }
2375
- .sortable-column-demo .vxe-header--row .vxe-header--column.sortable-ghost,
2376
- .sortable-column-demo .vxe-header--row .vxe-header--column.sortable-chosen {
2377
- background-color: #dfecfb;
2378
- }
2379
- .sortable-column-demo .vxe-header--row .vxe-header--column.col--fixed {
2380
- cursor: no-drop;
2381
- }
2382
- </style>
2381
+ .base-grid-view .vxe-header--row .vxe-header--column.sortable-ghost,
2382
+ .base-grid-view .vxe-header--row .vxe-header--column.sortable-chosen {
2383
+ background-color: #dfecfb;
2384
+ }
2385
+ .base-grid-view .vxe-header--row .vxe-header--column.col--fixed {
2386
+ cursor: no-drop;
2387
+ }
2388
+ .inner-cell-control {
2389
+ width: 100% !important;
2390
+ min-width: unset !important;
2391
+ }
2392
+ .input-box {
2393
+ width: 100%;
2394
+ border: 1px solid;
2395
+ min-height: 24px;
2396
+ border-radius: 4px;
2397
+ border-color: rgb(217, 217, 217);
2398
+ padding-left: 5px;
2399
+ line-height: 24px !important;
2400
+ }
2401
+ .test_filter {
2402
+ text-align: left;
2403
+ // display: inline-block;
2404
+ // width:90%
2405
+ }
2406
+ .test_filter_title {
2407
+ margin-left: 2%;
2408
+ }
2409
+ /*滚动条整体部分*/
2410
+ .base-grid-view ::-webkit-scrollbar {
2411
+ width: 10px;
2412
+ height: 10px;
2413
+ z-index: 10;
2414
+ }
2415
+ /*滚动条的轨道*/
2416
+ .base-grid-view ::-webkit-scrollbar-track {
2417
+ background-color: #ffffff;
2418
+ z-index: 10;
2419
+ }
2420
+ /*滚动条里面的小方块,能向上向下移动*/
2421
+ .base-grid-view ::-webkit-scrollbar-thumb {
2422
+ background-color: #bfbfbf;
2423
+ border-radius: 5px;
2424
+ border: 1px solid #f1f1f1;
2425
+ box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
2426
+ z-index: 10;
2427
+ }
2428
+ .base-grid-view ::-webkit-scrollbar-thumb:hover {
2429
+ background-color: #a8a8a8;
2430
+ z-index: 10;
2431
+ }
2432
+ .base-grid-view ::-webkit-scrollbar-thumb:active {
2433
+ background-color: #787878;
2434
+ z-index: 10;
2435
+ }
2436
+ /*边角,即两个滚动条的交汇处*/
2437
+ .base-grid-view ::-webkit-scrollbar-corner {
2438
+ background-color: #ffffff;
2439
+ z-index: 10;
2440
+ }
2441
+ .draggableItem {
2442
+ display: inline-block;
2443
+ height: 100%;
2444
+ line-height: 30px;
2445
+ border: 1.3px solid #e8eaec;
2446
+ margin: 0 !important;
2447
+ margin: 0 10px;
2448
+ // overflow: hidden;
2449
+ // text-overflow: ellipsis;
2450
+ // white-space: nowrap;
2451
+ }
2452
+ .sortable-column-demo .vxe-header--row .vxe-header--column.sortable-ghost,
2453
+ .sortable-column-demo .vxe-header--row .vxe-header--column.sortable-chosen {
2454
+ background-color: #dfecfb;
2455
+ }
2456
+ .sortable-column-demo .vxe-header--row .vxe-header--column.col--fixed {
2457
+ cursor: no-drop;
2458
+ }
2459
+ </style>