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