doway-coms 1.5.12 → 1.5.14

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,868 +1,888 @@
1
1
  <template>
2
- <div class="d-control-container">
3
- <div
4
- class="d-control-label"
5
- v-if="showLabel === true"
6
- :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
7
- >
8
- {{ label
9
- }}
10
- <span v-if="rules && rules['required']" class="d-control-label-required"
2
+ <div class="d-control-container">
3
+ <div
4
+ class="d-control-label"
5
+ v-if="showLabel === true"
6
+ :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
7
+ >
8
+ {{ label }}
9
+ <span v-if="rules && rules['required']" class="d-control-label-required"
11
10
  >*</span
12
- >
13
- <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
14
- <img src="../../styles/icon/help.png" alt="" style="width: 14px">
15
- </Tooltip>
16
- </div>
17
- <div
18
- :class="{
19
- 'd-control': showLabel === true,
20
- 'd-grid-control': showLabel === false
21
- }"
22
11
  >
23
- <VxePulldown
24
- style="width:100%"
25
- @hide-panel="pullDownHideEvent"
26
- ref="pulldownRef"
27
- v-if="edit === true"
28
- transfer
29
- >
30
- <template #default>
31
- <ValidationProvider :name="label" v-slot="v" :rules="rules">
32
- <a-input
33
- :size="'small'"
34
- allow-clear
35
- @change="inputChangeEvent"
36
- class="inner-cell-control"
37
- v-model="currentValue"
38
- @click="inputClickEvent"
39
- @focus="inputFocusEvent"
40
- @blur="inputBlurEvent"
41
- @keydown="inputKeydownEvent"
42
- @keyup="inputKeyupEvent"
43
- :class="{ 'd-error-input': v.errors.length > 0 }"
44
- ></a-input>
45
- <div class="d-error-msg">
46
- {{ v.errors[0] }}
47
- </div>
48
- </ValidationProvider>
49
- </template>
50
- <template #dropdown>
51
- <div class="pulldown-grid interceptor-class">
52
- <vxe-grid
53
- size="mini"
54
- border
55
- :row-class-name="gridRowStyle"
56
- highlight-current-row
57
- :keyboard-config="{ isArrow: true }"
58
- highlight-hover-row
59
- auto-resize
60
- resizable
61
- :loading="gridLoading"
62
- height="auto"
63
- ref="pupupGridView"
64
- :data="searchRows"
65
- @cell-click="gridCellClick"
66
- :columns="internalColumns"
67
- :checkbox-config="{ checkMethod: checkMethod }"
68
- >
69
- <!-- :pager-config="gridPagerConfig" -->
70
- <!-- @page-change="pageChangeEvent" -->
71
- <template #matCode_header="{column}">
72
- <div class="first-col">
73
- <div class="first-col-top">
74
- {{ column.title }}
75
- </div>
76
- <div class="first-col-bottom">
77
- <input style="width:100%" />
78
- </div>
12
+ <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
13
+ <img src="../../styles/icon/help.png" alt="" style="width: 14px" />
14
+ </Tooltip>
15
+ </div>
16
+ <div
17
+ :class="{
18
+ 'd-control': showLabel === true,
19
+ 'd-grid-control': showLabel === false,
20
+ }"
21
+ >
22
+ <VxePulldown
23
+ style="width: 100%"
24
+ @hide-panel="pullDownHideEvent"
25
+ ref="pulldownRef"
26
+ v-if="edit === true"
27
+ transfer
28
+ >
29
+ <template #default>
30
+ <ValidationProvider :name="label" v-slot="v" :rules="rules">
31
+ <a-input
32
+ :size="'small'"
33
+ allow-clear
34
+ @change="inputChangeEvent"
35
+ class="inner-cell-control"
36
+ v-model="currentValue"
37
+ @click="inputClickEvent"
38
+ @focus="inputFocusEvent"
39
+ @blur="inputBlurEvent"
40
+ @keydown="inputKeydownEvent"
41
+ @keyup="inputKeyupEvent"
42
+ :class="{ 'd-error-input': v.errors.length > 0 }"
43
+ ></a-input>
44
+ <div class="d-error-msg">
45
+ {{ v.errors[0] }}
46
+ </div>
47
+ </ValidationProvider>
48
+ </template>
49
+ <template #dropdown>
50
+ <div class="pulldown-grid interceptor-class">
51
+ <vxe-grid
52
+ size="mini"
53
+ border
54
+ :row-class-name="gridRowStyle"
55
+ highlight-current-row
56
+ :keyboard-config="{ isArrow: true }"
57
+ highlight-hover-row
58
+ auto-resize
59
+ resizable
60
+ :loading="gridLoading"
61
+ height="auto"
62
+ ref="pupupGridView"
63
+ :data="searchRows"
64
+ @cell-click="gridCellClick"
65
+ :columns="internalColumns"
66
+ :checkbox-config="{ checkMethod: checkMethod }"
67
+ @sort-change="sortChange"
68
+ :sort-config="{
69
+ multiple: true,
70
+ remote: true,
71
+ chronological: true,
72
+ defaultSort: defaultSort,
73
+ }"
74
+ >
75
+ <!-- :pager-config="gridPagerConfig" -->
76
+ <!-- @page-change="pageChangeEvent" -->
77
+ <template #matCode_header="{ column }">
78
+ <div class="first-col">
79
+ <div class="first-col-top">
80
+ {{ column.title }}
79
81
  </div>
80
- </template>
81
- <template #pager>
82
- <a-row>
83
- <a-col :span="8">
84
- <a-button
85
- v-if="isMultiSelect === true"
86
- type="primary"
87
- size="small"
88
- style="margin: 5px"
89
- @click="multiSelectConfirm"
90
- >
91
- 确认选择
92
- </a-button>
82
+ <div class="first-col-bottom">
83
+ <input style="width: 100%" />
84
+ </div>
85
+ </div>
86
+ </template>
87
+ <template #pager>
88
+ <a-row>
89
+ <a-col :span="8">
90
+ <a-button
91
+ v-if="isMultiSelect === true"
92
+ type="primary"
93
+ size="small"
94
+ style="margin: 5px"
95
+ @click="multiSelectConfirm"
96
+ >
97
+ 确认选择
98
+ </a-button>
99
+ <a-button
100
+ v-if="popupAddName"
101
+ type="primary"
102
+ size="small"
103
+ style="margin: 5px"
104
+ @click="pagerBtnClick(btn)"
105
+ >
106
+ 新增
107
+ </a-button>
108
+
109
+ <template v-if="optBtns.length > 0">
93
110
  <a-button
94
- v-if="popupAddName"
111
+ v-for="btn in optBtns"
112
+ :key="btn.field"
95
113
  type="primary"
96
114
  size="small"
97
115
  style="margin: 5px"
98
116
  @click="pagerBtnClick(btn)"
99
117
  >
100
- 新增
118
+ {{ btn.name }}
101
119
  </a-button>
102
-
103
- <template v-if="optBtns.length > 0">
104
- <a-button
105
- v-for="btn in optBtns"
106
- :key="btn.field"
107
- type="primary"
108
- size="small"
109
- style="margin: 5px"
110
- @click="pagerBtnClick(btn)"
111
- >
112
- {{ btn.name }}
113
- </a-button>
114
- </template>
115
- </a-col>
116
- <a-col :span="16">
117
- <vxe-pager
118
- align="right"
119
- size="mini"
120
- :current-page.sync="gridPagerConfig.currentPage"
121
- :page-size.sync="gridPagerConfig.pageSize"
122
- :total="gridPagerConfig.total"
123
- @page-change="pageChangeEvent"
124
- >
125
- </vxe-pager>
126
- </a-col>
127
- </a-row>
128
- </template>
129
- </vxe-grid>
130
- </div>
131
- </template>
132
- </VxePulldown>
133
- <span v-if="edit === false">
134
- <a v-if="route" @click="routeLinkClick">{{ currentValue }}</a>
135
- <span v-else> {{ currentValue }}</span>
136
- </span>
137
- </div>
138
-
139
- <keep-alive>
140
- <div
141
- :is="popupAddName"
142
- ref="pupupAddView"
143
- @popupSaveAfter="popupSaveAfter"
144
- ></div>
145
- </keep-alive>
120
+ </template>
121
+ </a-col>
122
+ <a-col :span="16">
123
+ <vxe-pager
124
+ align="right"
125
+ size="mini"
126
+ :current-page.sync="gridPagerConfig.currentPage"
127
+ :page-size.sync="gridPagerConfig.pageSize"
128
+ :total="gridPagerConfig.total"
129
+ @page-change="pageChangeEvent"
130
+ >
131
+ </vxe-pager>
132
+ </a-col>
133
+ </a-row>
134
+ </template>
135
+ </vxe-grid>
136
+ </div>
137
+ </template>
138
+ </VxePulldown>
139
+ <span v-if="edit === false">
140
+ <a v-if="route" @click="routeLinkClick">{{ currentValue }}</a>
141
+ <span v-else> {{ currentValue }}</span>
142
+ </span>
146
143
  </div>
147
- </template>
148
-
149
- <script>
150
- import XEUtils from 'xe-utils'
151
- import { sysRowState, sysFormState, controlType } from '../../utils/enum'
152
- import { replaceParamString, replaceParam } from '../../utils/common'
153
- import request from '../../utils/request'
154
- import { Input,Button,Row,Col } from 'ant-design-vue'
155
- import { ValidationProvider } from 'vee-validate'
156
- import {Pulldown} from 'vxe-table'
157
- import { Tooltip } from 'ant-design-vue'
158
- export default {
159
- name: 'BasePulldown',
160
- components:{
161
- 'a-input':Input,
162
- 'a-button':Button,
163
- 'a-row':Row,
164
- 'a-col':Col,
165
- 'VxePulldown':Pulldown,
166
- ValidationProvider,
167
- Tooltip,
168
144
 
169
- },
170
- data() {
171
- return {
172
- fetchFields: '',
173
- internalColumns: [],
174
- isInputChanged: false,
175
- inputTimeout: null,
176
- searchRows: [],
177
- filterCols: [],
178
- gridLoading: false,
179
- gridPagerConfig: {
180
- total: 0,
181
- currentPage: 1,
182
- pageSize: 10
183
- }
184
- }
185
- },
186
- props: {
187
- labelWidth: {
188
- type: Number,
189
- default: function() {
190
- return 0
191
- }
192
- },
193
- isMultiSelect: {
194
- type: Boolean,
195
- default: function() {
196
- return false
197
- }
198
- },
199
- popupAddName: {
200
- type: String,
201
- default: function() {
202
- return null
203
- }
204
- },
205
- popupAddPath: {
206
- type: String,
207
- default: function() {
208
- return null
209
- }
145
+ <keep-alive>
146
+ <div
147
+ :is="popupAddName"
148
+ ref="pupupAddView"
149
+ @popupSaveAfter="popupSaveAfter"
150
+ ></div>
151
+ </keep-alive>
152
+ </div>
153
+ </template>
154
+
155
+ <script>
156
+ import XEUtils from "xe-utils";
157
+ import { sysRowState, sysFormState, controlType } from "../../utils/enum";
158
+ import { replaceParamString, replaceParam } from "../../utils/common";
159
+ import request from "../../utils/request";
160
+ import { Input, Button, Row, Col } from "ant-design-vue";
161
+ import { ValidationProvider } from "vee-validate";
162
+ import { Pulldown } from "vxe-table";
163
+ import { Tooltip } from "ant-design-vue";
164
+ export default {
165
+ name: "BasePulldown",
166
+ components: {
167
+ "a-input": Input,
168
+ "a-button": Button,
169
+ "a-row": Row,
170
+ "a-col": Col,
171
+ VxePulldown: Pulldown,
172
+ ValidationProvider,
173
+ Tooltip,
174
+ },
175
+ data() {
176
+ return {
177
+ fetchFields: "",
178
+ internalColumns: [],
179
+ isInputChanged: false,
180
+ inputTimeout: null,
181
+ searchRows: [],
182
+ filterCols: [],
183
+ gridLoading: false,
184
+ gridPagerConfig: {
185
+ total: 0,
186
+ currentPage: 1,
187
+ pageSize: 10,
188
+ },
189
+ sorts: [],
190
+ defaultSort: [],
191
+ };
192
+ },
193
+ props: {
194
+ labelWidth: {
195
+ type: Number,
196
+ default: function () {
197
+ return 0;
210
198
  },
211
- rules: {
212
- type: Object,
213
- default: function() {
214
- return null
215
- }
199
+ },
200
+ isMultiSelect: {
201
+ type: Boolean,
202
+ default: function () {
203
+ return false;
216
204
  },
217
- showLabel: {
218
- type: Boolean,
219
- default: function() {
220
- return true
221
- }
205
+ },
206
+ popupAddName: {
207
+ type: String,
208
+ default: function () {
209
+ return null;
222
210
  },
223
- label: {
224
- type: String,
225
- default: function() {
226
- return ''
227
- }
211
+ },
212
+ popupAddPath: {
213
+ type: String,
214
+ default: function () {
215
+ return null;
228
216
  },
229
- defaultExpression: {
230
- type: String,
231
- default: function() {
232
- return ''
233
- }
217
+ },
218
+ rules: {
219
+ type: Object,
220
+ default: function () {
221
+ return null;
234
222
  },
235
- formRow: {
236
- type: Object,
237
- default: function() {
238
- return {}
239
- }
223
+ },
224
+ showLabel: {
225
+ type: Boolean,
226
+ default: function () {
227
+ return true;
240
228
  },
241
- row: {
242
- type: Object,
243
- default: function() {
244
- return {}
245
- }
229
+ },
230
+ label: {
231
+ type: String,
232
+ default: function () {
233
+ return "";
246
234
  },
247
- edit: {
248
- type: Boolean,
249
- default: function() {
250
- return false
251
- }
235
+ },
236
+ defaultExpression: {
237
+ type: String,
238
+ default: function () {
239
+ return "";
252
240
  },
253
- route: Object,
254
- placeholder: {
255
- // 提示信息
256
- type: String
241
+ },
242
+ formRow: {
243
+ type: Object,
244
+ default: function () {
245
+ return {};
257
246
  },
258
- api: {
259
- // api接口
260
- type: String
247
+ },
248
+ row: {
249
+ type: Object,
250
+ default: function () {
251
+ return {};
261
252
  },
262
- field: {
263
- type: String
253
+ },
254
+ edit: {
255
+ type: Boolean,
256
+ default: function () {
257
+ return false;
264
258
  },
265
- pageSize: {
266
- // 分页数量,默认不分页
267
- type: Number,
268
- default: () => {
269
- return 0
270
- }
259
+ },
260
+ route: Object,
261
+ placeholder: {
262
+ // 提示信息
263
+ type: String,
264
+ },
265
+ api: {
266
+ // api接口
267
+ type: String,
268
+ },
269
+ field: {
270
+ type: String,
271
+ },
272
+ pageSize: {
273
+ // 分页数量,默认不分页
274
+ type: Number,
275
+ default: () => {
276
+ return 0;
271
277
  },
272
- columns: {
273
- // 列集合
274
- type: Array,
275
- default: () => {
276
- return []
277
- }
278
+ },
279
+ columns: {
280
+ // 列集合
281
+ type: Array,
282
+ default: () => {
283
+ return [];
278
284
  },
279
- isOld: {
280
- // 列集合
281
- type: Boolean,
282
- default: () => {
283
- return false
284
- }
285
+ },
286
+ isOld: {
287
+ // 列集合
288
+ type: Boolean,
289
+ default: () => {
290
+ return false;
285
291
  },
286
- exps: {
287
- // 条件
288
- type: Array,
289
- default: () => {
290
- return []
291
- }
292
+ },
293
+ exps: {
294
+ // 条件
295
+ type: Array,
296
+ default: () => {
297
+ return [];
292
298
  },
293
- value: {
294
- type: String,
295
- default: function() {
296
- return ''
297
- }
299
+ },
300
+ value: {
301
+ type: String,
302
+ default: function () {
303
+ return "";
298
304
  },
299
- optBtns: {
300
- // 操作按钮
301
- type: Array,
302
- default: () => {
303
- return []
304
- }
305
+ },
306
+ optBtns: {
307
+ // 操作按钮
308
+ type: Array,
309
+ default: () => {
310
+ return [];
305
311
  },
306
- gridTable: {
307
- // 操作按钮
308
- type: Object,
309
- default: () => {
310
- return null
311
- }
312
+ },
313
+ gridTable: {
314
+ // 操作按钮
315
+ type: Object,
316
+ default: () => {
317
+ return null;
312
318
  },
313
- immediate: {
314
- type: Boolean,
315
- default: true
319
+ },
320
+ immediate: {
321
+ type: Boolean,
322
+ default: true,
323
+ },
324
+ isLocalData: {
325
+ type: Boolean,
326
+ default: false,
327
+ },
328
+ tooltip: {
329
+ type: String,
330
+ default: function () {
331
+ return "";
316
332
  },
317
- isLocalData: {
318
- type: Boolean,
319
- default: false
333
+ },
334
+ propTableData: {
335
+ type: Array,
336
+ default: function () {
337
+ return [];
320
338
  },
321
- tooltip: {
322
- type: String,
323
- default: function() {
324
- return ''
325
- }
339
+ },
340
+ },
341
+ watch: {},
342
+ computed: {
343
+ currentValue: {
344
+ // 动态计算currentValue的值
345
+ get: function () {
346
+ return this.value; // 将props中的value赋值给currentValue
326
347
  },
327
- propTableData: {
328
- type: Array,
329
- default: function() {
330
- return []
331
- }
348
+ set: function (val) {
349
+ this.$emit("input", val); // 通过$emit触发父组件
332
350
  },
333
351
  },
334
- watch: {},
335
- computed: {
336
- currentValue: {
337
- // 动态计算currentValue的值
338
- get: function() {
339
- return this.value // 将props中的value赋值给currentValue
340
- },
341
- set: function(val) {
342
- this.$emit('input', val) // 通过$emit触发父组件
343
- }
344
- }
345
- },
346
- created() {
352
+ },
353
+ created() {
347
354
  // if (this.popupAddName && !this.$options.components[this.popupAddName]) {
348
355
  // // const tempRequire = require('@/views' + this.popupAddPath + '.vue').default
349
356
  // // this.$options.components[this.popupAddName] = tempRequire
350
357
  // this.$options.components[this.popupAddName] = () =>
351
358
  // import('@/views' + this.popupAddPath + '.vue')
352
359
  // }
353
- this.gridPagerConfig.pageSize = this.pageSize
354
-
360
+ this.gridPagerConfig.pageSize = this.pageSize;
361
+
362
+ this.internalColumns.push({
363
+ type: "seq",
364
+ fixed: "left",
365
+ width: 50,
366
+ });
367
+
368
+ if (this.isMultiSelect === true) {
355
369
  this.internalColumns.push({
356
- type: 'seq',
357
- fixed: 'left',
358
- width: 50
359
- })
360
-
361
- if (this.isMultiSelect === true) {
362
- this.internalColumns.push({
363
- type: 'checkbox',
364
- fixed: 'left',
365
- width: 40
366
- })
370
+ type: "checkbox",
371
+ fixed: "left",
372
+ width: 40,
373
+ });
374
+ }
375
+
376
+ for (let i = 0; i < this.columns.length; i++) {
377
+ this.fetchFields = this.fetchFields + this.columns[i].field + ",";
378
+ this.columns[i]["params"] = {
379
+ dataSource: [],
380
+ };
381
+ if (this.columns[i].dataSource) {
382
+ this.columns[i]["params"].dataSource = this.columns[i].dataSource;
367
383
  }
368
-
369
- for (let i = 0; i < this.columns.length; i++) {
370
- this.fetchFields = this.fetchFields + this.columns[i].field + ','
371
- this.columns[i]['params'] = {
372
- dataSource: []
373
- }
374
- if (this.columns[i].dataSource) {
375
- this.columns[i]['params'].dataSource = this.columns[i].dataSource
376
- }
377
- if (!this.columns[i].width) {
378
- this.columns[i]['width'] = 100
379
- }
380
- if (this.columns[i].isCheckbox === true) {
381
- this.columns[i]['type'] = 'checkbox'
382
- // colInfo['field'] = 'matCode'
383
- }
384
- // if(this.columns[i].formatter){
385
- // this.columns[i].formatter=
386
-
387
- // }
388
- this.internalColumns.push(this.columns[i])
389
- if (this.columns[i].filter === true) {
390
- this.filterCols.push(this.columns[i])
391
- }
384
+ if (!this.columns[i].width) {
385
+ this.columns[i]["width"] = 100;
386
+ }
387
+ if (this.columns[i].isCheckbox === true) {
388
+ this.columns[i]["type"] = "checkbox";
392
389
  }
390
+ // 默认排序
391
+ if (this.columns[i].defaultSort) {
392
+ this.defaultSort.push({
393
+ field: this.columns[i].field,
394
+ order: this.columns[i].defaultSort,
395
+ });
396
+ this.sorts.push([this.columns[i].field, this.columns[i].defaultSort]);
397
+ }
398
+ this.internalColumns.push(this.columns[i]);
399
+ if (this.columns[i].filter === true) {
400
+ this.filterCols.push(this.columns[i]);
401
+ }
402
+ }
403
+ },
404
+ methods: {
405
+ gridRowStyle(scope) {
406
+ if (scope.row.sysRepeat === true) {
407
+ return "row--pending";
408
+ }
409
+ // if(scope.row.)
393
410
  },
394
- methods: {
395
- gridRowStyle(scope) {
396
- if (scope.row.sysRepeat === true) {
397
- return 'row--pending'
398
- }
399
- // if(scope.row.)
400
- },
401
- clearInputValue() {
402
- if (this.isInputChanged === true) {
403
- this.setLinkValue(null, this.row)
404
- this.$emit('selectChanged', null)
405
- }
406
- },
407
- routeLinkClick() {
408
- //首先需要判断是否有权限
409
- // let treeModule = XEUtils.findTree(
410
- // this.$store.getters.addRouters,
411
- // item => item.name === this.route.name
412
- // )
413
- // if (!treeModule) {
414
- // this.$antwarning('没有权限')
415
- // return
416
- // }
417
- this.$router.pushRoute({
418
- name: this.route.name,
419
- query: { id: this.row[this.route.field] }
420
- })
421
- },
422
- /**
423
- * 输入框改变事件
424
- */
425
- inputChangeEvent(event) {
426
- this.isInputChanged = true
427
- if (event.type === 'click' && event.pointerType === 'mouse') {
428
- //点击了清空按钮
429
- this.$nextTick(() => {
430
- this.clearInputValue()
431
- this.inputClickEvent(null)
432
- })
433
- }
434
- },
435
- inputBlurEvent(event) {},
436
- /**
437
- * 输入框获取焦点事件
438
- */
439
- inputFocusEvent(event) {
440
- event.currentTarget.select()
441
- // this.$refs.pulldownRef.showPanel()
442
- // this.searchData()
443
- },
444
- /**
445
- * Tab键隐藏面板
446
- */
447
- inputKeydownEvent(event) {
448
- if (event.keyCode === 9) {
449
- //tab事件
450
- this.$refs.pulldownRef.hidePanel()
451
- this.clearInputValue()
452
- }
453
- },
454
- inputClickEvent(event) {
455
- if (this.$refs.pulldownRef.isPanelVisible() === false) {
456
- this.$refs.pulldownRef.showPanel()
457
- this.searchData()
458
- } else {
459
- this.$refs.pulldownRef.hidePanel()
460
- }
461
- },
462
- /**
463
- * 输入库输入事件
464
- */
465
- inputKeyupEvent(event) {
466
- //好像ok
467
- if (!this.immediate && event.keyCode !== 13) {
468
- console.debug('davistest')
469
- } else {
470
- if (this.inputTimeout) {
471
- clearTimeout(this.inputTimeout)
411
+ clearInputValue() {
412
+ if (this.isInputChanged === true) {
413
+ this.setLinkValue(null, this.row);
414
+ this.$emit("selectChanged", null);
415
+ }
416
+ },
417
+ routeLinkClick() {
418
+ //首先需要判断是否有权限
419
+ // let treeModule = XEUtils.findTree(
420
+ // this.$store.getters.addRouters,
421
+ // item => item.name === this.route.name
422
+ // )
423
+ // if (!treeModule) {
424
+ // this.$antwarning('没有权限')
425
+ // return
426
+ // }
427
+ this.$router.pushRoute({
428
+ name: this.route.name,
429
+ query: { id: this.row[this.route.field] },
430
+ });
431
+ },
432
+ /**
433
+ * 输入框改变事件
434
+ */
435
+ inputChangeEvent(event) {
436
+ this.isInputChanged = true;
437
+ if (event.type === "click" && event.pointerType === "mouse") {
438
+ //点击了清空按钮
439
+ this.$nextTick(() => {
440
+ this.clearInputValue();
441
+ this.inputClickEvent(null);
442
+ });
443
+ }
444
+ },
445
+ inputBlurEvent(event) {},
446
+ /**
447
+ * 输入框获取焦点事件
448
+ */
449
+ inputFocusEvent(event) {
450
+ event.currentTarget.select();
451
+ // this.$refs.pulldownRef.showPanel()
452
+ // this.searchData()
453
+ },
454
+ /**
455
+ * Tab键隐藏面板
456
+ */
457
+ inputKeydownEvent(event) {
458
+ if (event.keyCode === 9) {
459
+ //tab事件
460
+ this.$refs.pulldownRef.hidePanel();
461
+ this.clearInputValue();
462
+ }
463
+ },
464
+ inputClickEvent(event) {
465
+ if (this.$refs.pulldownRef.isPanelVisible() === false) {
466
+ this.$refs.pulldownRef.showPanel();
467
+ this.searchData();
468
+ } else {
469
+ this.$refs.pulldownRef.hidePanel();
470
+ }
471
+ },
472
+ /**
473
+ * 输入库输入事件
474
+ */
475
+ inputKeyupEvent(event) {
476
+ //好像ok
477
+ if (!this.immediate && event.keyCode !== 13) {
478
+ console.debug("davistest");
479
+ } else {
480
+ if (this.inputTimeout) {
481
+ clearTimeout(this.inputTimeout);
482
+ }
483
+ let vm = this;
484
+ this.inputTimeout = setTimeout(() => {
485
+ //判断面板是否打开
486
+ if (vm.$refs.pulldownRef.isPanelVisible() === false) {
487
+ vm.$refs.pulldownRef.showPanel();
472
488
  }
473
- let vm = this
474
- this.inputTimeout = setTimeout(() => {
475
- //判断面板是否打开
476
- if (vm.$refs.pulldownRef.isPanelVisible() === false) {
477
- vm.$refs.pulldownRef.showPanel()
478
- }
479
- vm.searchData()
480
- }, 500)
481
- }
482
- },
483
- /**
484
- * 网格列选中事件
485
- */
486
- gridCellClick({ row, column }) {
487
- if (row.sysRepeat === true) {
488
- return
489
- }
490
- if (column.type === 'seq' || column.type === 'checkbox') {
491
- return
492
- }
493
- this.isInputChanged = false
494
- this.setLinkValue(row, this.row)
495
- this.$emit('selectChanged', row)
496
- this.$refs.pulldownRef.hidePanel()
497
- },
498
- setLinkValue(pulldownRow, oriRow) {
499
- for (let i = 0; i < this.internalColumns.length; i++) {
500
- if (this.internalColumns[i].linkField) {
501
- let tempLinkFields = this.internalColumns[i].linkField.split('.')
502
- let tempRow = oriRow
503
- // for(let j=0;j<tempLinkFields.length;j++){
504
- // let tempField = tempLinkFields[j]
505
- // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
506
- // if (!(tempField in tempRow)) {
507
- // this.$antwarning(
508
- // '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
509
- // )
510
- // break
511
- // }
512
- // if(j===tempLinkFields.length-1){
513
- // if (pulldownRow === null) {
514
- // if (this.internalColumns[i].nullClear === false) {
515
- // //是否空值清除数据,用于可选可输入的控件
516
- // continue
517
- // }
518
- // this.$set(tempRow, tempField, null)
519
- // } else {
520
- // this.$set(
521
- // tempRow,
522
- // tempField,
523
- // this.getLinkValue(tempField, pulldownRow)
524
- // )
525
- // }
526
- // }else{
527
- // tempRow = tempRow[tempField]
528
- // }
529
- // }
530
-
531
- //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
532
- if (!(this.internalColumns[i].linkField in oriRow)) {
533
- this.$antwarning(
534
- '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
535
- )
536
- continue
537
- }
538
- if (pulldownRow === null) {
539
- if (this.internalColumns[i].nullClear === false) {
540
- //是否空值清楚数据,用于可选可输入的控件
541
- continue
542
- }
543
- this.$set(oriRow, this.internalColumns[i].linkField, null)
544
- } else {
545
- this.$set(
546
- oriRow,
547
- this.internalColumns[i].linkField,
548
- this.getLinkValue(this.internalColumns[i].field, pulldownRow)
549
- )
550
- }
489
+ vm.searchData();
490
+ }, 500);
491
+ }
492
+ },
493
+ /**
494
+ * 网格列选中事件
495
+ */
496
+ gridCellClick({ row, column }) {
497
+ if (row.sysRepeat === true) {
498
+ return;
499
+ }
500
+ if (column.type === "seq" || column.type === "checkbox") {
501
+ return;
502
+ }
503
+ this.isInputChanged = false;
504
+ this.setLinkValue(row, this.row);
505
+ this.$emit("selectChanged", row);
506
+ this.$refs.pulldownRef.hidePanel();
507
+ },
508
+ setLinkValue(pulldownRow, oriRow) {
509
+ for (let i = 0; i < this.internalColumns.length; i++) {
510
+ if (this.internalColumns[i].linkField) {
511
+ let tempLinkFields = this.internalColumns[i].linkField.split(".");
512
+ let tempRow = oriRow;
513
+ // for(let j=0;j<tempLinkFields.length;j++){
514
+ // let tempField = tempLinkFields[j]
515
+ // //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
516
+ // if (!(tempField in tempRow)) {
517
+ // this.$antwarning(
518
+ // '赋值字段[' + this.internalColumns[i].linkField + ']不存在'
519
+ // )
520
+ // break
521
+ // }
522
+ // if(j===tempLinkFields.length-1){
523
+ // if (pulldownRow === null) {
524
+ // if (this.internalColumns[i].nullClear === false) {
525
+ // //是否空值清除数据,用于可选可输入的控件
526
+ // continue
527
+ // }
528
+ // this.$set(tempRow, tempField, null)
529
+ // } else {
530
+ // this.$set(
531
+ // tempRow,
532
+ // tempField,
533
+ // this.getLinkValue(tempField, pulldownRow)
534
+ // )
535
+ // }
536
+ // }else{
537
+ // tempRow = tempRow[tempField]
538
+ // }
539
+ // }
540
+
541
+ //如果赋值的属性不存在数据集中,就忽略更新,防止修改后网格单元格值不更细
542
+ if (!(this.internalColumns[i].linkField in oriRow)) {
543
+ this.$antwarning(
544
+ "赋值字段[" + this.internalColumns[i].linkField + "]不存在"
545
+ );
546
+ continue;
551
547
  }
552
- }
553
- },
554
- getLinkValue(field, row) {
555
- let linkField = field.split('.')
556
- if (linkField.length > 1) {
557
- let fieldValue = row
558
- for (let i = 0; i < linkField.length; i++) {
559
- if (
560
- fieldValue[linkField[i]] === undefined ||
561
- fieldValue[linkField[i]] === null
562
- ) {
563
- return null
548
+ if (pulldownRow === null) {
549
+ if (this.internalColumns[i].nullClear === false) {
550
+ //是否空值清楚数据,用于可选可输入的控件
551
+ continue;
564
552
  }
565
- fieldValue = fieldValue[linkField[i]]
553
+ this.$set(oriRow, this.internalColumns[i].linkField, null);
554
+ } else {
555
+ this.$set(
556
+ oriRow,
557
+ this.internalColumns[i].linkField,
558
+ this.getLinkValue(this.internalColumns[i].field, pulldownRow)
559
+ );
566
560
  }
567
- return fieldValue
568
561
  }
569
- return row[field]
570
- },
571
- /**
572
- * 左下角按钮点击事件
573
- */
574
- pagerBtnClick(btn) {
575
- this.$refs.pupupAddView.show()
576
- // this.$emit('pulldownBtnClick', btn)
577
- this.$refs.pulldownRef.hidePanel()
578
- },
579
- // 多选内容时,若数据不满足条件,不可选中
580
- checkMethod({ row }) {
581
- if (row.sysRepeat) {
582
- return false
583
- }
584
- return true
585
- },
586
- /**
587
- * 确认多选
588
- */
589
- multiSelectConfirm() {
590
- this.isInputChanged = false
591
- this.$emit(
592
- 'confirmMultiSelect',
593
- this,
594
- this.$refs.pupupGridView.getCheckboxRecords(true)
595
- )
596
- this.$refs.pulldownRef.hidePanel()
597
- },
598
- popupSaveAfter(pupupAddRowInfo) {
599
- let postData = {
600
- fields: null,
601
- begin: 1,
602
- size: 1,
603
- expression: {},
604
- sort: ''
605
- }
606
- let tempKeyExp = XEUtils.find(
607
- this.internalColumns,
608
- item => item.isKey === true
609
- )
610
- postData.expression = {
611
- operator: 'and',
612
- expressions: [
613
- {
614
- operator: 'and',
615
- expressions: [
616
- {
617
- field: tempKeyExp.field,
618
- operator: 'EQ',
619
- value: pupupAddRowInfo['id']
620
- }
621
- ]
622
- }
623
- ]
562
+ }
563
+ },
564
+ getLinkValue(field, row) {
565
+ let linkField = field.split(".");
566
+ if (linkField.length > 1) {
567
+ let fieldValue = row;
568
+ for (let i = 0; i < linkField.length; i++) {
569
+ if (
570
+ fieldValue[linkField[i]] === undefined ||
571
+ fieldValue[linkField[i]] === null
572
+ ) {
573
+ return null;
574
+ }
575
+ fieldValue = fieldValue[linkField[i]];
624
576
  }
625
- let vm = this
626
- let tempApi = this.getPostApi(postData)
627
- request({
628
- url: tempApi,
629
- method: 'post',
630
- data: postData
577
+ return fieldValue;
578
+ }
579
+ return row[field];
580
+ },
581
+ /**
582
+ * 左下角按钮点击事件
583
+ */
584
+ pagerBtnClick(btn) {
585
+ this.$refs.pupupAddView.show();
586
+ // this.$emit('pulldownBtnClick', btn)
587
+ this.$refs.pulldownRef.hidePanel();
588
+ },
589
+ // 多选内容时,若数据不满足条件,不可选中
590
+ checkMethod({ row }) {
591
+ if (row.sysRepeat) {
592
+ return false;
593
+ }
594
+ return true;
595
+ },
596
+ /**
597
+ * 确认多选
598
+ */
599
+ multiSelectConfirm() {
600
+ this.isInputChanged = false;
601
+ this.$emit(
602
+ "confirmMultiSelect",
603
+ this,
604
+ this.$refs.pupupGridView.getCheckboxRecords(true)
605
+ );
606
+ this.$refs.pulldownRef.hidePanel();
607
+ },
608
+ popupSaveAfter(pupupAddRowInfo) {
609
+ let postData = {
610
+ fields: null,
611
+ begin: 1,
612
+ size: 1,
613
+ expression: {},
614
+ sorts: "",
615
+ };
616
+ let tempKeyExp = XEUtils.find(
617
+ this.internalColumns,
618
+ (item) => item.isKey === true
619
+ );
620
+ postData.expression = {
621
+ operator: "and",
622
+ expressions: [
623
+ {
624
+ operator: "and",
625
+ expressions: [
626
+ {
627
+ field: tempKeyExp.field,
628
+ operator: "EQ",
629
+ value: pupupAddRowInfo["id"],
630
+ },
631
+ ],
632
+ },
633
+ ],
634
+ };
635
+ let vm = this;
636
+ let tempApi = this.getPostApi(postData);
637
+ request({
638
+ url: tempApi,
639
+ method: "post",
640
+ data: postData,
641
+ })
642
+ .then((responseData) => {
643
+ if (responseData.content.length > 0) {
644
+ vm.setLinkValue(responseData.content[0], vm.row);
645
+ vm.$emit("selectChanged", responseData.content[0]);
646
+ }
647
+ })
648
+ .catch((error) => {
649
+ console.error(error);
631
650
  })
632
- .then(responseData => {
633
- if (responseData.content.length > 0) {
634
- vm.setLinkValue(responseData.content[0], vm.row)
635
- vm.$emit('selectChanged', responseData.content[0])
651
+ .finally(() => {});
652
+ },
653
+ /**
654
+ * 分页改变事件
655
+ */
656
+ pageChangeEvent({ currentPage, pageSize }) {
657
+ this.gridPagerConfig.currentPage = currentPage;
658
+ this.gridPagerConfig.pageSize = pageSize;
659
+ this.searchData();
660
+ },
661
+ /**
662
+ * 面板隐藏事件
663
+ */
664
+ pullDownHideEvent({ $event }) {
665
+ this.clearInputValue();
666
+ },
667
+ /**
668
+ * 查询数据
669
+ */
670
+ searchData() {
671
+ if (this.isLocalData === true) {
672
+ let tempSearch = {
673
+ value: this.currentValue,
674
+ dataSource: [],
675
+ };
676
+ this.$emit("preSearch", tempSearch);
677
+ this.searchRows = tempSearch.dataSource;
678
+ this.gridPagerConfig.total = tempSearch.dataSource.length;
679
+ return;
680
+ }
681
+
682
+ let tempExp = {
683
+ operator: "or",
684
+ expressions: [],
685
+ };
686
+ if (this.isOld === true) {
687
+ tempExp = "";
688
+ }
689
+ if (this.currentValue) {
690
+ for (let i = 0; i < this.filterCols.length; i++) {
691
+ if (this.isOld === true) {
692
+ tempExp =
693
+ tempExp +
694
+ this.filterCols[i].field +
695
+ '.contains("' +
696
+ this.currentValue +
697
+ '")';
698
+ if (i < this.filterCols.length - 1) {
699
+ tempExp = tempExp + " or ";
636
700
  }
637
- })
638
- .catch(error => {
639
- console.error(error)
640
- })
641
- .finally(() => {})
642
- },
643
- /**
644
- * 分页改变事件
645
- */
646
- pageChangeEvent({ currentPage, pageSize }) {
647
- this.gridPagerConfig.currentPage = currentPage
648
- this.gridPagerConfig.pageSize = pageSize
649
- this.searchData()
650
- },
651
- /**
652
- * 面板隐藏事件
653
- */
654
- pullDownHideEvent({ $event }) {
655
- this.clearInputValue()
656
- },
657
- /**
658
- * 查询数据
659
- */
660
- searchData() {
661
- if (this.isLocalData === true) {
662
- let tempSearch = {
663
- value: this.currentValue,
664
- dataSource: []
665
- }
666
- this.$emit('preSearch', tempSearch)
667
- this.searchRows = tempSearch.dataSource
668
- this.gridPagerConfig.total = tempSearch.dataSource.length
669
- return
670
- }
671
-
672
- let tempExp = {
673
- operator: 'or',
674
- expressions: []
675
- }
676
- if (this.isOld === true) {
677
- tempExp = ''
678
- }
679
- if (this.currentValue) {
680
- for (let i = 0; i < this.filterCols.length; i++) {
681
- if (this.isOld === true) {
682
- tempExp =
683
- tempExp +
684
- this.filterCols[i].field +
685
- '.contains("' +
686
- this.currentValue +
687
- '")'
688
- if (i < this.filterCols.length - 1) {
689
- tempExp = tempExp + ' or '
690
- }
701
+ } else {
702
+ if (this.filterCols[i].controlType == "number") {
703
+ tempExp.expressions.push({
704
+ field: this.filterCols[i].field,
705
+ operator: "EQ",
706
+ value: Number(this.currentValue),
707
+ });
691
708
  } else {
692
- if (this.filterCols[i].controlType == 'number') {
693
- tempExp.expressions.push({
694
- field: this.filterCols[i].field,
695
- operator: 'EQ',
696
- value: Number(this.currentValue)
697
- })
698
- } else {
699
- tempExp.expressions.push({
700
- field: this.filterCols[i].field,
701
- operator: 'CO',
702
- value: this.currentValue
703
- })
704
- }
709
+ tempExp.expressions.push({
710
+ field: this.filterCols[i].field,
711
+ operator: "CO",
712
+ value: this.currentValue,
713
+ });
705
714
  }
706
715
  }
707
716
  }
708
- if (this.isOld === true && tempExp.length > 0) {
709
- tempExp = '(' + tempExp + ')'
717
+ }
718
+ if (this.isOld === true && tempExp.length > 0) {
719
+ tempExp = "(" + tempExp + ")";
720
+ }
721
+
722
+ if (this.defaultExpression) {
723
+ let tempDefault = replaceParamString(
724
+ this.defaultExpression,
725
+ this.formRow,
726
+ this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
727
+ );
728
+
729
+ if (tempExp) {
730
+ tempExp = tempExp + " and (" + tempDefault + ")";
731
+ } else {
732
+ tempExp = tempDefault;
710
733
  }
711
-
712
- if (this.defaultExpression) {
713
- let tempDefault = replaceParamString(
714
- this.defaultExpression,
715
- this.formRow,
716
- this.$store.getters.moduleSelectItems[this.$route.meta.moduleId]
717
- )
718
-
719
- if (tempExp) {
720
- tempExp = tempExp + ' and (' + tempDefault + ')'
734
+ }
735
+
736
+ let postExpression = {
737
+ field: this.field,
738
+ expression: tempExp,
739
+ extendParams: {},
740
+ };
741
+ let repeatRowInfo = {
742
+ field: "",
743
+ values: [],
744
+ };
745
+ //查询之前从外部组件构造其他的条件
746
+ this.$emit("preSearch", postExpression, repeatRowInfo);
747
+ let postData = {
748
+ fields: this.fetchFields,
749
+ begin:
750
+ (this.gridPagerConfig.currentPage - 1) *
751
+ this.gridPagerConfig.pageSize +
752
+ 1,
753
+ size: this.gridPagerConfig.pageSize,
754
+ expression: postExpression.expression,
755
+ sorts: this.sorts,
756
+ extendParams: postExpression.extendParams,
757
+ };
758
+ console.log(postData.sorts);
759
+ let tempApi = this.getPostApi(postData);
760
+
761
+ // let tempApi = this.api
762
+ // if (this.api.indexOf('?') > 0) {
763
+ // tempApi = this.api.substring(0, this.api.indexOf('?'))
764
+ // let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
765
+ // tempExtenParams = replaceParam(tempExtenParams, this.formRow)
766
+ // let tempSplitParams = tempExtenParams.split('&')
767
+ // for (let i = 0; i < tempSplitParams.length; i++) {
768
+ // let tempSplitValue = tempSplitParams[i].split('=')
769
+ // this.$set(
770
+ // postData.extendParams,
771
+ // tempSplitValue[0],
772
+ // tempSplitValue[1]
773
+ // )
774
+ // }
775
+ // }
776
+ let vm = this;
777
+ vm.gridLoading = true;
778
+ request({
779
+ url: tempApi,
780
+ method: "post",
781
+ data: postData,
782
+ })
783
+ .then((responseData) => {
784
+ if (vm.isOld === true) {
785
+ vm.searchRows = responseData.data;
786
+ vm.gridPagerConfig.total = responseData.extData.totalRows;
721
787
  } else {
722
- tempExp = tempDefault
788
+ vm.searchRows = responseData.content;
789
+ vm.gridPagerConfig.total = responseData.otherContent.totalRows;
723
790
  }
724
- }
725
-
726
- let postExpression = {
727
- field: this.field,
728
- expression: tempExp,
729
- extendParams: {}
730
- }
731
- let repeatRowInfo = {
732
- field: '',
733
- values: []
734
- }
735
- //查询之前从外部组件构造其他的条件
736
- this.$emit('preSearch', postExpression, repeatRowInfo)
737
- let postData = {
738
- fields: this.fetchFields,
739
- begin:
740
- (this.gridPagerConfig.currentPage - 1) *
741
- this.gridPagerConfig.pageSize +
742
- 1,
743
- size: this.gridPagerConfig.pageSize,
744
- expression: postExpression.expression,
745
- sort: '',
746
- extendParams: postExpression.extendParams
747
- }
748
-
749
- let tempApi = this.getPostApi(postData)
750
-
751
- // let tempApi = this.api
752
- // if (this.api.indexOf('?') > 0) {
753
- // tempApi = this.api.substring(0, this.api.indexOf('?'))
754
- // let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
755
- // tempExtenParams = replaceParam(tempExtenParams, this.formRow)
756
- // let tempSplitParams = tempExtenParams.split('&')
757
- // for (let i = 0; i < tempSplitParams.length; i++) {
758
- // let tempSplitValue = tempSplitParams[i].split('=')
759
- // this.$set(
760
- // postData.extendParams,
761
- // tempSplitValue[0],
762
- // tempSplitValue[1]
763
- // )
764
- // }
765
- // }
766
- let vm = this
767
- vm.gridLoading = true
768
- request({
769
- url: tempApi,
770
- method: 'post',
771
- data: postData
772
- })
773
- .then(responseData => {
774
- if (vm.isOld === true) {
775
- vm.searchRows = responseData.data
776
- vm.gridPagerConfig.total = responseData.extData.totalRows
777
- } else {
778
- vm.searchRows = responseData.content
779
- vm.gridPagerConfig.total = responseData.otherContent.totalRows
780
- }
781
- if (repeatRowInfo.field) {
782
- //设置重复值
783
- XEUtils.arrayEach(vm.searchRows, item => {
784
- if (
785
- XEUtils.arrayIndexOf(
786
- repeatRowInfo.values,
787
- item[repeatRowInfo.field]
788
- ) > -1
789
- ) {
790
- item['sysRepeat'] = true
791
- } else {
792
- item['sysRepeat'] = false
791
+ if (repeatRowInfo.field) {
792
+ //设置重复值
793
+ XEUtils.arrayEach(vm.searchRows, (item) => {
794
+ if (
795
+ XEUtils.arrayIndexOf(
796
+ repeatRowInfo.values,
797
+ item[repeatRowInfo.field]
798
+ ) > -1
799
+ ) {
800
+ item["sysRepeat"] = true;
801
+ } else {
802
+ item["sysRepeat"] = false;
803
+ }
804
+ });
805
+ }
806
+ // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
807
+ let fieldNames = vm.columns
808
+ .filter((x) => x.sysRepeat)
809
+ .map((y) => {
810
+ return {
811
+ field: y.field,
812
+ linkField: y.linkField,
813
+ };
814
+ });
815
+ if (fieldNames.length) {
816
+ vm.searchRows.forEach((info) => {
817
+ vm.propTableData.forEach((item) => {
818
+ // 接口字段可能和表字段field不一致,linkField一致
819
+ let arr = [];
820
+ for (let j = 0; j < fieldNames.length; j++) {
821
+ if (
822
+ info[fieldNames[j].field] == item[fieldNames[j].linkField]
823
+ ) {
824
+ arr.push(true);
825
+ }
793
826
  }
794
- })
795
- }
796
- // 设置字段sysRepeat后,所定字段的值全部相同则不可选择
797
- let fieldNames = vm.columns.filter(x => x.sysRepeat)
798
- .map(y=> {
799
- return {
800
- field: y.field,
801
- linkField: y.linkField,
827
+ if (fieldNames.length === arr.length) {
828
+ info.sysRepeat = true;
802
829
  }
803
- })
804
- if (fieldNames.length) {
805
- vm.searchRows.forEach(info => {
806
- vm.propTableData.forEach(item=>{
807
- // 接口字段可能和表字段field不一致,linkField一致
808
- let arr= []
809
- for(let j=0;j<fieldNames.length;j++){
810
- if(info[fieldNames[j].field] == item[fieldNames[j].linkField]){
811
- arr.push(true)
812
- }
813
- }
814
- if(fieldNames.length === arr.length){
815
- info.sysRepeat = true
816
- }
817
- })
818
- })
819
- }
820
- })
821
- .catch(error => {
822
- console.error(error)
823
- })
824
- .finally(() => {
825
- vm.gridLoading = false
826
- })
827
- },
828
- getPostApi(postData) {
829
- let tempApi = this.api
830
- if (this.api.indexOf('?') > 0) {
831
- tempApi = this.api.substring(0, this.api.indexOf('?'))
832
- let tempExtenParams = this.api.substring(this.api.indexOf('?') + 1)
833
- tempExtenParams = replaceParam(tempExtenParams, this.formRow)
834
- let tempSplitParams = tempExtenParams.split('&')
835
- for (let i = 0; i < tempSplitParams.length; i++) {
836
- let tempSplitValue = tempSplitParams[i].split('=')
837
- this.$set(
838
- postData.extendParams,
839
- tempSplitValue[0],
840
- tempSplitValue[1]
841
- )
830
+ });
831
+ });
842
832
  }
833
+ })
834
+ .catch((error) => {
835
+ console.error(error);
836
+ })
837
+ .finally(() => {
838
+ vm.gridLoading = false;
839
+ });
840
+ },
841
+ getPostApi(postData) {
842
+ let tempApi = this.api;
843
+ if (this.api.indexOf("?") > 0) {
844
+ tempApi = this.api.substring(0, this.api.indexOf("?"));
845
+ let tempExtenParams = this.api.substring(this.api.indexOf("?") + 1);
846
+ tempExtenParams = replaceParam(tempExtenParams, this.formRow);
847
+ let tempSplitParams = tempExtenParams.split("&");
848
+ for (let i = 0; i < tempSplitParams.length; i++) {
849
+ let tempSplitValue = tempSplitParams[i].split("=");
850
+ this.$set(
851
+ postData.extendParams,
852
+ tempSplitValue[0],
853
+ tempSplitValue[1]
854
+ );
843
855
  }
844
- return tempApi
845
856
  }
846
- }
847
- }
848
- </script>
849
-
850
- <style lang="scss" scoped>
851
- .pulldown-grid {
852
- min-width: 600px;
853
- width: auto;
854
- height: 350px;
855
- background-color: #fff;
856
- box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
857
- }
858
-
859
- .d-grid-control {
860
- width: 100%;
861
- height: 30px;
862
- }
863
- </style>
864
-
857
+ return tempApi;
858
+ },
859
+ sortChange({ column, property, order, sortBy, sortList, $event }) {
860
+ let currentSort = sortList.map((x) => {
861
+ return [x.field, x.order];
862
+ });
863
+ this.sorts = currentSort;
864
+ this.searchData();
865
+ },
866
+ },
867
+ };
868
+ </script>
869
+
870
+ <style lang="scss" scoped>
871
+ .pulldown-grid {
872
+ min-width: 600px;
873
+ width: auto;
874
+ height: 350px;
875
+ background-color: #fff;
876
+ box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
877
+ }
878
+
879
+ .d-grid-control {
880
+ width: 100%;
881
+ height: 30px;
882
+ }
883
+ </style>
884
+
865
885
 
866
- <style lang="less">
867
- @import '../../styles/default.less';
886
+ <style lang="less">
887
+ @import "../../styles/default.less";
868
888
  </style>