cloud-web-corejs 1.0.54-dev.644 → 1.0.54-dev.646

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,1340 +0,0 @@
1
- <template>
2
- <container-item-wrapper :widget="widget" :class="widget.options.isFullscreen ? 'full-height':''">
3
- <div class="h5-header">{{ widget.options.label }}</div>
4
- <div class="h5-search-box">
5
- <el-input
6
- v-model="keyword"
7
- placeholder="请选择" class="txt">
8
- <i slot="suffix" class="el-input__icon el-icon-search"></i>
9
- <el-button slot="append" class="btn" @click="searchEvent">搜索</el-button>
10
- </el-input>
11
- <div class="icon-screen" @click="openAdvancedSearchDialog"><i class="iconfont icon-chaxuntiaojianshezhi"></i>筛选
12
- </div>
13
- </div>
14
- <div v-if="widget.options.isQueryTable" class="h5-fixed-top-btns" title-width="92px" title-align="right">
15
- <el-form label-position="top">
16
- <template v-if="!!widget.buttons && widget.buttons.length > 0">
17
- <template v-for="(subWidget, swIdx) in widget.buttons">
18
- <template v-if="'container' === subWidget.category">
19
- <component
20
- :is="subWidget.type + '-item'"
21
- :widget="subWidget"
22
- :key="swIdx"
23
- :parent-list="widget.buttons"
24
- :index-of-parent-list="swIdx"
25
- :parent-widget="widget"
26
- >
27
- <!-- 递归传递插槽!!! -->
28
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
29
- <slot :name="slot" v-bind="scope"/>
30
- </template>
31
- </component>
32
- </template>
33
- <template v-else>
34
- <component
35
- :is="subWidget.type + '-widget'"
36
- :field="subWidget"
37
- :designer="null"
38
- :key="swIdx"
39
- :parent-list="widget.buttons"
40
- :index-of-parent-list="swIdx"
41
- :parent-widget="widget"
42
- >
43
- <!-- 递归传递插槽!!! -->
44
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
45
- <slot :name="slot" v-bind="scope"/>
46
- </template>
47
- </component>
48
- </template>
49
- </template>
50
- </template>
51
- </el-form>
52
- </div>
53
- <div class="h5-list-box">
54
- <div v-for="(row,rowIndex) in fieldModel" :key="rowIndex" class="item" @click="itemCheck(row)"
55
- :class="{checked:checkItemIds.includes(row.id)}">
56
- <div v-if="!widget.options.isQueryTable" class="del-btn" @click.stop="deleteRow(row,rowIndex)"><i
57
- class="el-icon-delete"></i></div>
58
- <template v-if="vxeOption.columns.length>0">
59
- <div class="t1" v-if="widget.options.isQueryTable">
60
- <template v-for="(column,columnIndex) in vxeOption.columns.filter((item,index)=>item.isMainFiled)">
61
- <b :key="'1-'+columnIndex">{{ column.title }}:</b>
62
- <span :key="'2-'+columnIndex">
63
- <template v-if="!column.params.formatS">
64
- {{ row[column.field] }}
65
- </template>
66
- <template v-else-if="column.params.formatS == 'render'">
67
- {{ column.slots.default({column: column, rowIndex: rowIndex, row: row, items: fieldModel}) }}
68
- </template>
69
- <template v-else-if="column.slots && column.slots.default=='widget'">
70
- <component
71
- :is="getColumnWidgetName(column.params.widget)"
72
- :field="column.params.widget"
73
- :form-model="globalModel.formModel"
74
- :designer="null"
75
- :key="rowIndex"
76
- :parent-widget="widget"
77
- :columnConfig="column.params.columnConfig"
78
- :subFormRowIndex="rowIndex"
79
- :formItemProp="getColumnProp(widget,{column:column,rowIndex:rowIndex,row:row,items:fieldModel})"
80
- :tableParam="{column:column,rowIndex:rowIndex,row:row,items:fieldModel}"
81
- ></component>
82
- </template>
83
- <template v-else-if="column.params.formatS=='editDelete'">
84
- <a
85
- href="javascript:void(0);"
86
- class="a-link"
87
- @click="deleteRow(row,rowIndex)"
88
- >
89
- <el-tooltip :enterable="false" effect="dark" content="删除" placement="top"
90
- popper-class="tooltip-skin">
91
- <i class="el-icon-delete"/>
92
- </el-tooltip>
93
- </a>
94
- </template>
95
- <template v-else-if="column.params.formatS=='editButton'">
96
- <a
97
- href="javascript:void(0);"
98
- class="a-link"
99
- @click.stop="openEditDialog(obj.row)"
100
- >
101
- <el-tooltip :enterable="false" effect="dark" content="查看" placement="top"
102
- popper-class="tooltip-skin">
103
- <i class="el-icon-edit"/>
104
- </el-tooltip>
105
- </a>
106
- </template>
107
- <template v-else>
108
- {{
109
- column.formatter({
110
- cellValue: row[column.field],
111
- column: column,
112
- rowIndex: rowIndex,
113
- row: row,
114
- items: fieldModel
115
- })
116
- }}
117
- </template>
118
- </span>
119
- <!-- <div class="status">未审核</div>-->
120
- </template>
121
- </div>
122
- <div class="t2">
123
- <template v-if="!widget.options.isQueryTable || vxeOption.columns.length>1">
124
- <template v-for="(column,columnIndex) in vxeOption.columns">
125
- <template v-if="(!widget.options.isQueryTable || !column.isMainFiled) && column.showForRow">
126
- <dl :key="columnIndex">
127
- <div>
128
- <dt>{{ column.title }}:</dt>
129
- <dd>
130
- <template v-if="!column.params.formatS">
131
- {{ row[column.field] }}
132
- </template>
133
- <template v-else-if="column.params.formatS == 'render'">
134
- {{ column.slots.default({column: column, rowIndex: rowIndex, row: row, items: fieldModel}) }}
135
- </template>
136
-
137
- <template v-else-if="column.slots && column.slots.default=='widget'">
138
- <component
139
- :is="getColumnWidgetName(column.params.widget)"
140
- :field="column.params.widget"
141
- :form-model="globalModel.formModel"
142
- :designer="null"
143
- :key="rowIndex+'-'+columnIndex"
144
- :parent-widget="widget"
145
- :columnConfig="column.params.columnConfig"
146
- :subFormRowIndex="rowIndex"
147
- :formItemProp="getColumnProp(widget,{column:column,rowIndex:rowIndex,row:row,items:fieldModel})"
148
- :tableParam="{column:column,rowIndex:rowIndex,row:row,items:fieldModel}"
149
- ></component>
150
- </template>
151
- <template v-else-if="column.params.formatS=='editDelete'">
152
- <a
153
- href="javascript:void(0);"
154
- class="a-link"
155
- @click.stop="deleteRow(row,rowIndex)"
156
- >
157
- <el-tooltip :enterable="false" effect="dark" content="删除" placement="top"
158
- popper-class="tooltip-skin">
159
- <i class="el-icon-delete"/>
160
- </el-tooltip>
161
- </a>
162
- </template>
163
- <template v-else-if="column.params.formatS=='editButton'">
164
- <a
165
- href="javascript:void(0);"
166
- class="a-link"
167
- @click.stop="openEditDialog(row)"
168
- >
169
- <el-tooltip :enterable="false" effect="dark" content="查看" placement="top"
170
- popper-class="tooltip-skin">
171
- <i class="el-icon-edit"/>
172
- </el-tooltip>
173
- </a>
174
- </template>
175
- <template v-else>
176
- {{
177
- column.formatter({
178
- cellValue: row[column.field],
179
- column: column,
180
- rowIndex: rowIndex,
181
- row: row,
182
- items: fieldModel
183
- })
184
- }}
185
- </template>
186
- </dd>
187
- </div>
188
- </dl>
189
- </template>
190
- </template>
191
- </template>
192
- </div>
193
- <div class="btns">
194
- <!-- <div class="checkbox_fl">
195
- <el-checkbox></el-checkbox>
196
- </div> -->
197
- <!-- <a class="btn"><i class="el-icon-delete"/><span>删除</span></a>
198
- <a class="btn"><i class="el-icon-edit"/><span>查看</span></a>-->
199
- <template v-if="!!widget.lineButtons && widget.lineButtons.length > 0">
200
- <template v-for="(subWidget, swIdx) in widget.lineButtons">
201
- <template v-if="'container' === subWidget.category">
202
- <component
203
- :is="subWidget.type + '-item'"
204
- :widget="subWidget"
205
- :key="swIdx"
206
- :parent-list="widget.lineButtons"
207
- :index-of-parent-list="swIdx"
208
- :parent-widget="widget"
209
- :subFormRowIndex="rowIndex"
210
- :tableParam="{rowIndex:rowIndex,row:row,items:fieldModel}"
211
- >
212
- <!-- 递归传递插槽!!! -->
213
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
214
- <slot :name="slot" v-bind="scope"/>
215
- </template>
216
- </component>
217
- </template>
218
- <template v-else>
219
- <component
220
- :is="subWidget.type + '-widget'"
221
- :field="subWidget"
222
- :designer="null"
223
- :key="swIdx"
224
- :parent-list="widget.lineButtons"
225
- :index-of-parent-list="swIdx"
226
- :parent-widget="widget"
227
- :subFormRowIndex="rowIndex"
228
- :tableParam="{rowIndex:rowIndex,row:row,items:fieldModel}"
229
- >
230
- <!-- 递归传递插槽!!! -->
231
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
232
- <slot :name="slot" v-bind="scope"/>
233
- </template>
234
- </component>
235
- </template>
236
- </template>
237
- </template>
238
- </div>
239
- </template>
240
-
241
- <!-- <div class="t1">
242
- <b>订单号:21533666</b>
243
- <div class="status">未审核</div>
244
- </div>
245
- <div class="t2">
246
- <p>产地:广东佛山</p>
247
- <p>产地:广东佛山</p>
248
- <p>产地:广东佛山</p>
249
- </div>-->
250
- </div>
251
- </div>
252
- <div class="vxe-grid" v-if="widget.options.isQueryTable">
253
- <div class="vxe-grid&#45;&#45;pager-wrapper">
254
- <vxe-pager
255
- class="pages-box"
256
- :current-page.sync="page.current"
257
- :page-size.sync="page.size"
258
- :total="page.total"
259
- :layouts="['PrevPage', 'Number', 'NextPage']"
260
- @page-change="changePageNew"
261
- >
262
- <template #right>
263
- <span>
264
- <span>当前记录</span>
265
- <span class="f-red"> {{ page.records.length }} </span>
266
- <span>/</span>
267
- <span class="f-red"> {{ page.total }}</span>
268
- </span>
269
- </template>
270
- </vxe-pager>
271
- </div>
272
- </div>
273
-
274
-
275
- <advancedSearchDialog v-if="showAdvancedSearch" :visiable.sync="showAdvancedSearch" class="adSearchForm_all"
276
- :formData="advancedFormData" @confirm="confirmAdvancedSearchDialog" @clear="advancedClear">
277
- <template #form>
278
- <vxe-form :model="formModel" title-width="102px" :inline="true" class="adSearchForm">
279
- <template v-for="(searchColumn,index) in vxeOption.searchColumns">
280
- <vxe-form-item>
281
- <component
282
- :is="getColumnWidgetName(searchColumn.widget)"
283
- :field="searchColumn.widget"
284
- :form-model="globalModel.formModel"
285
- :designer="null"
286
- :key="index"
287
- :parent-widget="widget"
288
- ></component>
289
- </vxe-form-item>
290
- </template>
291
- </vxe-form>
292
- </template>
293
- </advancedSearchDialog>
294
- <el-dialog
295
- title="明细详情"
296
- :modal-append-to-body="false"
297
- :close-on-click-modal="false"
298
- :visible.sync="showRowDetailDialog"
299
- :modal="false"
300
- custom-class="dialog-style h5view-dialog"
301
- width="100%"
302
- top="0px"
303
- v-el-drag-dialog
304
- v-el-dialog-center
305
- :destroy-on-close="true"
306
- >
307
- <div class="cont" style="height: calc(100vh - 73px);">
308
- <div class="h5-list-box">
309
- <div v-for="(row,rowIndex) in [editRow]" :key="rowIndex" class="item">
310
- <!-- <div class="del-btn"><i class="el-icon-delete"></i></div>-->
311
- <template v-if="vxeOption.columns.length>0">
312
- <div class="t1" v-if="widget.options.isQueryTable">
313
- <template v-for="(column,columnIndex) in vxeOption.columns.filter((item,index)=>item.isMainFiled)">
314
- <b>{{ column.title }}:</b>
315
- <span>
316
- <template v-if="!column.params.formatS">
317
- {{ row[column.field] }}
318
- </template>
319
- <template v-else-if="column.params.formatS == 'render'">
320
- {{ column.slots.default({column: column, rowIndex: rowIndex, row: row, items: fieldModel}) }}
321
- </template>
322
- <template v-else-if="column.slots && column.slots.default=='widget'">
323
- <component
324
- :is="getColumnWidgetName(column.params.widget)"
325
- :field="column.params.widget"
326
- :form-model="globalModel.formModel"
327
- :designer="null"
328
- :key="rowIndex"
329
- :parent-widget="widget"
330
- :columnConfig="column.params.columnConfig"
331
- :subFormRowIndex="rowIndex"
332
- :formItemProp="getColumnProp(widget,{column:column,rowIndex:rowIndex,row:row,items:fieldModel})"
333
- :tableParam="{column:column,rowIndex:rowIndex,row:row,items:fieldModel}"
334
- ></component>
335
- </template>
336
- <template v-else-if="column.params.formatS=='editDelete'">
337
- <a
338
- href="javascript:void(0);"
339
- class="a-link"
340
- @click.stop="deleteRow(row,rowIndex)"
341
- >
342
- <el-tooltip :enterable="false" effect="dark" content="删除" placement="top"
343
- popper-class="tooltip-skin">
344
- <i class="el-icon-delete"/>
345
- </el-tooltip>
346
- </a>
347
- </template>
348
- <template v-else-if="column.params.formatS=='editButton'">
349
- <a
350
- href="javascript:void(0);"
351
- class="a-link"
352
- @click.stop="openEditDialog(obj.row)"
353
- >
354
- <el-tooltip :enterable="false" effect="dark" content="查看" placement="top"
355
- popper-class="tooltip-skin">
356
- <i class="el-icon-edit"/>
357
- </el-tooltip>
358
- </a>
359
- </template>
360
- <template v-else>
361
- {{
362
- column.formatter({
363
- cellValue: row[column.field],
364
- column: column,
365
- rowIndex: rowIndex,
366
- row: row,
367
- items: fieldModel
368
- })
369
- }}
370
- </template>
371
- </span>
372
- <!-- <div class="status">未审核</div>-->
373
- </template>
374
- </div>
375
- <div class="t2">
376
- <template v-if="!widget.options.isQueryTable || vxeOption.columns.length>1">
377
- <template v-for="(column,columnIndex) in vxeOption.columns">
378
- <template v-if="!widget.options.isQueryTable || !column.isMainFiled">
379
- <dl>
380
- <div>
381
- <dt>{{ column.title }}:</dt>
382
- <dd>
383
- <template v-if="!column.params.formatS">
384
- {{ row[column.field] }}
385
- </template>
386
- <template v-else-if="column.params.formatS == 'render'">
387
- {{
388
- column.slots.default({column: column, rowIndex: rowIndex, row: row, items: fieldModel})
389
- }}
390
- </template>
391
-
392
- <template v-else-if="column.slots && column.slots.default=='widget'">
393
- <component
394
- :is="getColumnWidgetName(column.params.widget)"
395
- :field="column.params.widget"
396
- :form-model="globalModel.formModel"
397
- :designer="null"
398
- :key="rowIndex+'-'+columnIndex"
399
- :parent-widget="widget"
400
- :columnConfig="column.params.columnConfig"
401
- :subFormRowIndex="rowIndex"
402
- :formItemProp="getColumnProp(widget,{column:column,rowIndex:rowIndex,row:row,items:fieldModel})"
403
- :tableParam="{column:column,rowIndex:rowIndex,row:row,items:fieldModel}"
404
- ></component>
405
- </template>
406
- <template v-else-if="column.params.formatS=='editDelete'">
407
- <a
408
- href="javascript:void(0);"
409
- class="a-link"
410
- @click="deleteRow(row,rowIndex)"
411
- >
412
- <el-tooltip :enterable="false" effect="dark" content="删除" placement="top"
413
- popper-class="tooltip-skin">
414
- <i class="el-icon-delete"/>
415
- </el-tooltip>
416
- </a>
417
- </template>
418
- <template v-else-if="column.params.formatS=='editButton'">
419
- <a
420
- href="javascript:void(0);"
421
- class="a-link"
422
- @click="openEditDialog(obj.row)"
423
- >
424
- <el-tooltip :enterable="false" effect="dark" content="查看" placement="top"
425
- popper-class="tooltip-skin">
426
- <i class="el-icon-edit"/>
427
- </el-tooltip>
428
- </a>
429
- </template>
430
- <template v-else>
431
- {{
432
- column.formatter({
433
- cellValue: row[column.field],
434
- column: column,
435
- rowIndex: rowIndex,
436
- row: row,
437
- items: fieldModel
438
- })
439
- }}
440
- </template>
441
- </dd>
442
- </div>
443
- </dl>
444
- </template>
445
- </template>
446
- </template>
447
- </div>
448
- <div class="btns">
449
- <template v-if="!!widget.lineButtons && widget.lineButtons.length > 0">
450
- <template v-for="(subWidget, swIdx) in widget.lineButtons">
451
- <template v-if="'container' === subWidget.category">
452
- <component
453
- :is="subWidget.type + '-item'"
454
- :widget="subWidget"
455
- :key="swIdx"
456
- :parent-list="widget.lineButtons"
457
- :index-of-parent-list="swIdx"
458
- :parent-widget="widget"
459
- :subFormRowIndex="rowIndex"
460
- :tableParam="{rowIndex:rowIndex,row:row,items:fieldModel}"
461
- >
462
- <!-- 递归传递插槽!!! -->
463
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
464
- <slot :name="slot" v-bind="scope"/>
465
- </template>
466
- </component>
467
- </template>
468
- <template v-else>
469
- <component
470
- :is="subWidget.type + '-widget'"
471
- :field="subWidget"
472
- :designer="null"
473
- :key="swIdx"
474
- :parent-list="widget.lineButtons"
475
- :index-of-parent-list="swIdx"
476
- :parent-widget="widget"
477
- :subFormRowIndex="rowIndex"
478
- :tableParam="{rowIndex:rowIndex,row:row,items:fieldModel}"
479
- >
480
- <!-- 递归传递插槽!!! -->
481
- <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
482
- <slot :name="slot" v-bind="scope"/>
483
- </template>
484
- </component>
485
- </template>
486
- </template>
487
- </template>
488
- </div>
489
- </template>
490
-
491
- <!-- <div class="t1">
492
- <b>订单号:21533666</b>
493
- <div class="status">未审核</div>
494
- </div>
495
- <div class="t2">
496
- <p>产地:广东佛山</p>
497
- <p>产地:广东佛山</p>
498
- <p>产地:广东佛山</p>
499
- </div>-->
500
- </div>
501
- </div>
502
- </div>
503
- </el-dialog>
504
- </container-item-wrapper>
505
- </template>
506
-
507
- <script>
508
- import emitter from '../../../../components/xform/utils/emitter';
509
- import i18n from '../../../../components/xform/utils/i18n';
510
- import refMixin from '../../../../components/xform/form-render/refMixin';
511
- import containerItemMixin from './containerItemMixin';
512
- import FieldComponents from '../../../../components/xform/form-designer/form-widget/field-widget/index';
513
- import {assembleAxiosConfig, generateId, getReportGlobalMap} from "../../../../components/xform/utils/util";
514
- import * as formatUtil from "../../../../components/xform/utils/format";
515
- import render from "../../../../views/user/bill_setting/render.vue";
516
-
517
- const baseRefUtil = {
518
- emitter,
519
- i18n,
520
- refMixin,
521
- containerItemMixin,
522
- formatUtil,
523
- assembleAxiosConfig,
524
- getReportGlobalMap
525
- };
526
-
527
- export default {
528
- name: 'list-h5-item',
529
- components: {
530
- ...FieldComponents
531
- },
532
- mixins: [emitter, i18n, refMixin, containerItemMixin],
533
- componentName: 'ContainerItem',
534
- props: {
535
- widget: Object,
536
- parentWidget: Object,
537
- parentList: Array,
538
- indexOfParentList: Number,
539
- subFormRowIndex: {
540
- type: Number,
541
- default: -1
542
- },
543
- subFormColIndex: {
544
- type: Number,
545
- default: -1
546
- },
547
- subFormRowId: {
548
- type: String,
549
- default: ''
550
- }
551
- },
552
- inject: ['refList', 'sfRefList', 'globalModel', 'getFormConfig', 'getGlobalDsv'],
553
- data: function () {
554
- let that = this;
555
- let pageSize = 2;
556
- return {
557
- showAdvancedSearch: false,
558
- showRowDetailDialog: false,
559
- editRow: {},
560
- fieldModel: [],
561
- selectedIndices: [],
562
- /*pageSize: this.widget.options.pagination.pageSize,
563
- pageSizes: this.widget.options.pagination.pageSizes,
564
- currentPage: this.widget.options.pagination.currentPage,
565
- total: this.widget.options.pagination.total,*/
566
- formData: {
567
- saleOrgName: '',
568
- loginAccount: '',
569
- mobile: '',
570
- enabled: 1
571
- },
572
- vxeOption: {columns: []},
573
- requestAccess: null,
574
- columnFormatMap: {
575
- editInput: 'input',
576
- editNumber: 'number',
577
- editDate: 'date',
578
- editSelect: 'select',
579
- editSearch: 'vabsearch',
580
- button: 'button'
581
- },
582
- dataTableConfig: {},
583
- advancedFormData: {},
584
-
585
- pageSize: pageSize,
586
- page: {
587
- current: 1,
588
- size: pageSize,
589
- total: 0,
590
- records: [],
591
- },
592
- keyword: null,
593
-
594
- checkItemIds: []
595
- };
596
- },
597
- watch: {
598
- fieldModel(val) {
599
- this.formModel[this.fieldKeyName] = val || [];
600
- }
601
- },
602
- computed: {
603
- formConfig: function () {
604
- return this.getFormConfig();
605
- },
606
- paginationLayout: function () {
607
- return this.widget.options.smallPagination ? 'prev, pager, next' : 'total, sizes, prev, pager, next, jumper';
608
- },
609
- customClass: function () {
610
- return this.widget.options.customClass || '';
611
- },
612
- singleRowSelectFlag: function () {
613
- return !this.widget.options.showCheckBox;
614
- },
615
- buttonsColumnFixed: function () {
616
- return void 0 === this.widget.options.buttonsColumnFixed ? 'right' : !!this.widget.options
617
- .buttonsColumnFixed && this.widget.options.buttonsColumnFixed;
618
- },
619
- columns() {
620
- let tableColumns = this.widget.options.tableColumns;
621
- let newColumns = [];
622
- /*newColumns.push({
623
- type: 'checkbox',
624
- width: 48,
625
- resizable: false,
626
- fixed: 'left'
627
- });*/
628
-
629
- let firstColumn = tableColumns.find(column => {
630
- return !!column.prop && !!column.showForRow;
631
- });
632
- let mainFiled = firstColumn?.prop;
633
-
634
- let formRef = this.getFormRef();
635
- let dateConfig = this.$baseLodash.cloneDeep(formRef.getFieldWidgetByType('date').options)
636
- tableColumns.forEach(t => {
637
- let columnOption;
638
- let widget;
639
- let columnWidgetConfig = this.getColumnWidgetConfig(t);
640
- let {columnSelectedWidget, columnEditFields} = columnWidgetConfig;
641
- if (columnSelectedWidget) {
642
- widget = columnSelectedWidget
643
- columnOption = widget.options;
644
- } else {
645
- columnOption = {}
646
- }
647
-
648
- let col = {
649
- fixed: !!t.fixed && t.fixed,
650
- field: t.prop,
651
- title: t.label,
652
- witdh: t.width,
653
- sortable: t.sortable,
654
- align: t.align ? t.align : 'center',
655
- formatter: this.formatterValue,
656
- isMainFiled: mainFiled == t.prop,
657
- showForRow: t.showForRow,
658
- params: {
659
- ...columnOption,
660
- widget: widget,
661
- formatS: t.formatS,
662
- required: t.required || false,
663
- columnConfig: t
664
- },
665
- visible: t.show
666
- };
667
-
668
- if (t.formatS == 'render') {
669
- let r = t.render ? new Function('params', 'h', t.render) : null;
670
- col.slots = {
671
- default: (params, h) => {
672
- return r ? r.call(this, params, h) : '';
673
- }
674
- };
675
- } else if (columnSelectedWidget) {
676
- col.slots = {
677
- default: 'widget'
678
- };
679
- } else if (['editDelete', 'editButton'].includes(t.formatS)) {
680
- col.slots = {
681
- default: t.formatS
682
- };
683
- }
684
-
685
- newColumns.push(col);
686
- });
687
-
688
- /*if (baseRefUtil.tableConfig && baseRefUtil.tableConfig.className == "list-table") {
689
- if (tableColumns.length) {
690
- let tableColumn = [tableColumns.length - 1];
691
- if (tableColumn.fixed != "right") {
692
- newColumns.push({
693
- width: 47,
694
- title: '',
695
- fixed: 'right',
696
- sortable: false,
697
- });
698
- }
699
- }
700
- }*/
701
- return newColumns;
702
- },
703
- formModel: {
704
- cache: !1,
705
- get: function () {
706
- return this.globalModel.formModel;
707
- }
708
- },
709
- formDataId() {
710
- let formRef = this.getFormRef();
711
- return formRef.dataId;
712
- }
713
- },
714
- created: function () {
715
- if (!this.formModel[this.fieldKeyName]) this.formModel[this.fieldKeyName] = [];
716
- this.initRefList();
717
- this.handleOnCreated();
718
- },
719
- mounted: async function () {
720
- this.handleOnMounted();
721
- this.initTableList();
722
- },
723
- beforeDestroy: function () {
724
- this.unregisterFromRefList();
725
- },
726
- methods: {
727
- openAdvancedSearchDialog() {
728
- /*let formData = this.formModel;
729
- let advancedFormData = {};
730
- this.vxeOption.searchColumns.forEach(form1Field => {
731
- let value = formData[form1Field.field];
732
- if (value !== null && value !== undefined) {
733
- advancedFormData[form1Field.field] = value
734
- } else {
735
- advancedFormData[form1Field.field] = null
736
- }
737
- });
738
- this.advancedFormData = advancedFormData;*/
739
- this.showAdvancedSearch = true;
740
- },
741
- confirmAdvancedSearchDialog() {
742
- let formModel = this.formModel;
743
- let advancedFormData = this.advancedFormData;
744
- this.vxeOption.searchColumns.forEach(form1Field => {
745
- let value = formModel[form1Field.field];
746
- if (value !== null && value !== undefined) {
747
- advancedFormData[form1Field.field] = value
748
- } else {
749
- advancedFormData[form1Field.field] = null
750
- }
751
- });
752
- this.searchEvent();
753
- },
754
- advancedClear() {
755
- this.vxeOption.searchColumns.forEach(form1Field => {
756
- let widgetRef = this.getWidgetRef(form1Field.widget.options.name)
757
- if (widgetRef && widgetRef.setValue) widgetRef.setValue(null);
758
- });
759
- },
760
- setValue(val) {
761
- let rows = val || []
762
- this.formModel[this.fieldKeyName] = rows;
763
- this.fieldModel = rows;
764
- },
765
- getValue() {
766
- return this.formModel[this.fieldKeyName];
767
- },
768
- getFieldKeyName(widget) {
769
- let o = widget.options.name;
770
- return (
771
- (widget.options.keyNameEnabled
772
- && widget.options.keyName)
773
- || o
774
- );
775
- },
776
- formatterValue: function ({cellValue, row, column}) {
777
- if (cellValue === null || cellValue === undefined) return cellValue;
778
-
779
- if (column.params && column.params.formatS)
780
- switch (column.params.formatS) {
781
- case 'd1':
782
- return baseRefUtil.formatUtil.formatDate1(cellValue);
783
- case 'd2':
784
- return baseRefUtil.formatUtil.formatDate2(cellValue);
785
- case 'd3':
786
- return baseRefUtil.formatUtil.formatDate3(cellValue);
787
- case 'd4':
788
- return baseRefUtil.formatUtil.formatDate4(cellValue);
789
- case 'd5':
790
- return baseRefUtil.formatUtil.formatDate4(cellValue);
791
- case 'n1':
792
- return baseRefUtil.formatUtil.formatNumber1(cellValue);
793
- case 'n2':
794
- return baseRefUtil.formatUtil.formatNumber2(cellValue);
795
- case 'n3':
796
- return baseRefUtil.formatUtil.formatNumber3(cellValue);
797
- case 'n4':
798
- return baseRefUtil.formatUtil.formatNumber4(cellValue);
799
- case 'n5':
800
- return baseRefUtil.formatUtil.formatNumber5(cellValue);
801
- case 'n6':
802
- return baseRefUtil.formatUtil.formatNumber6(cellValue);
803
- case 'n7':
804
- return baseRefUtil.formatUtil.formatNumber7(cellValue);
805
- }
806
- return cellValue;
807
- },
808
- searchEvent() {
809
- // this.getGridTable().commitProxy('reload');
810
- this.loadAccessData();
811
- },
812
- async resetEvent() {
813
- let formData = this.formModel;
814
- this.keyword = null;
815
- this.widget.widgetList && this.widget.widgetList.forEach(subWidget => {
816
- let widgetRef = this.getWidgetRef(subWidget.options.name)
817
- let fieldKeyName = this.getFieldKeyName(subWidget);
818
- formData[fieldKeyName] = null;
819
- this.advancedFormData[fieldKeyName] = null;
820
- if (widgetRef && widgetRef.setValue) widgetRef.setValue(null);
821
- });
822
- // this.getGridTable().commitProxy('reload');
823
- this.loadAccessData();
824
- },
825
- openEditDialog(row) {
826
- let formRef = this.getFormRef();
827
- let parentTarget = formRef.$attrs["parent-target"];
828
- parentTarget && parentTarget.$attrs.openEditDialog && parentTarget.$attrs.openEditDialog(row);
829
- },
830
- initTableList() {
831
- let that = this;
832
- let path = null;
833
- let paramFun = null;
834
- // let mainDataSetDTO = null;
835
- let requestAccess = this.requestAccess;
836
- let tableRef = this.getTableRef();
837
- let formDataModel = this.getFormRef().formDataModel;
838
- let isQueryTable = this.widget.options.isQueryTable || false;
839
- let isDataPage = this.widget.options.accessReturnType == "2";
840
- let formCode = this.getFormRef().reportTemplate.formCode;
841
- let dataId = this.formDataId;
842
- let accessScript = this.widget.options.accessScript;
843
- let searchColumns = null;
844
- if (isQueryTable) {
845
- path = this.getUrl();
846
- paramFun = () => {
847
- // let conditions = this.getSearchCondition();
848
- let conditions = {keyword: this.keyword, ...this.advancedFormData};
849
- if (this.widget.options.showPagination) {
850
- let searchCount = true;
851
- /*let isQueryAllPage = $grid.isQueryAllPage;
852
- if (isQueryAllPage == false) {
853
- searchCount = false;
854
- }*/
855
- /*let pager = proxyInfo ? proxyInfo.pager : null;
856
- if (pager) {
857
- conditions.current = pager.currentPage;
858
- conditions.size = pager.pageSize;
859
- conditions.searchCount = searchCount;
860
- }*/
861
- }
862
-
863
- /*let formData = {
864
- accessCode: requestAccess.accessCode,
865
- conditions: conditions
866
- };*/
867
- let formData = conditions;
868
- return formData;
869
- };
870
-
871
- searchColumns = [];
872
- let widgetList = this.widget.widgetList;
873
- let typeMap = {
874
- "input": "input",
875
- "number": "number",
876
- "inputBatch": "inputBatch",
877
- "date": "date"
878
- }
879
-
880
- widgetList.forEach(widget => {
881
- if ('container' !== widget.category) {
882
- let options = widget.options;
883
- let type = typeMap[widget.type] || null;
884
- searchColumns.push({
885
- title: options.label,
886
- field: this.getFieldKeyName(widget),
887
- type: type,
888
- common: true,
889
- disabled: options.disabled,
890
- defaultValueEnabled: !!type,
891
- slot: options.name,
892
- widget: widget,
893
- formItem: false
894
- });
895
- }
896
- });
897
- }
898
-
899
- let formRef = this.getFormRef();
900
- let dataTableConfig = formRef.$attrs.dataTableOption || {}
901
- this.dataTableConfig = dataTableConfig;
902
-
903
- let tableOption = {
904
- vue: this,
905
- tableRef: tableRef,
906
- tableName: this.widget.options.name,
907
- param: paramFun,
908
- columns: this.columns,
909
- searchColumns: searchColumns,
910
- vform: true,
911
- config: {
912
- height: isQueryTable ? "550px" : this.widget.options.tableHeight,
913
- /*pagerConfig: {
914
- autoHidden: !this.widget.options.showPagination
915
- },*/
916
- ...dataTableConfig.config
917
- },
918
- exportAjax: (param) => {
919
- let $grid = this.getGridTable();
920
- let pageSize = param.size;
921
- let currentPage = param.current;
922
- let page = {pageSize, currentPage};
923
- return this.vxeOption.config.proxyConfig.ajax.query.call(this, {page, param})
924
- }
925
- };
926
-
927
- if (isQueryTable) {
928
- tableOption.path = path;
929
- tableOption.config.proxyConfig = {
930
- props: {
931
- result: isDataPage ? 'objx.records' : 'objx', // 配置响应结果列表字段
932
- total: isDataPage ? 'objx.total' : 'objx.length' // 配置响应结果总页数字段
933
- },
934
- ajax: {
935
- // 接收 Promise 对象
936
- query: ({page, sorts, filters, form, param}) => {
937
- if (!path) {
938
- return;
939
- }
940
-
941
- let formData = tableOption.param ? tableOption.param() || {} : {};
942
- const queryParams = Object.assign({}, formData);
943
-
944
- // 处理排序条件
945
- if (sorts) {
946
- const firstSort = sorts[0];
947
- if (firstSort) {
948
- queryParams.sort = firstSort.property;
949
- queryParams.order = firstSort.order;
950
- }
951
- }
952
-
953
- // 处理筛选条件
954
- if (filters) {
955
- filters.forEach(({property, values}) => {
956
- queryParams[property] = values.join(",");
957
- });
958
- }
959
-
960
- if (page.pageSize !== undefined) {
961
- queryParams["size"] = `${page.pageSize}`;
962
- queryParams["current"] = `${page.currentPage}`;
963
- }
964
-
965
- /*let $grid = this.getGridTable();
966
- let isQueryAllPage = $grid.isQueryAllPage;
967
- let pathStr1 = "";
968
- if (isQueryAllPage === false) {
969
- queryParams.searchCount = false;
970
- }*/
971
- Object.assign(queryParams, param)
972
-
973
- var reqPath = typeof path == "function" ? path() : path;
974
-
975
- return new Promise((resolve, reject) => {
976
- let reqData = {
977
- formCode: formCode,
978
- ...queryParams
979
- }
980
- if (accessScript) {
981
- let index = 0;
982
- let toDo = () => {
983
- let f = new Function("dataId", "formCode", "param", "done", accessScript);
984
- let done = (res) => {
985
- resolve(res);
986
- if (res.type == "success") {
987
- let rows = res.objx ? res.objx.records || res.objx || [] : [];
988
- this.setValue(rows);
989
- if (res.objx && res.objx.records) {
990
- this.page = res.objx || {};
991
- }
992
- if (tableOption.callback) {
993
- that.$nextTick(() => {
994
- setTimeout(function () {
995
- tableOption.callback(rows);
996
- }, 0);
997
- });
998
- }
999
- } else {
1000
- this.setValue([]);
1001
- }
1002
- }
1003
- let r = f.call(that, dataId, formCode, reqData, done);
1004
- if (r) {
1005
- r.catch(error => {
1006
- reject(error);
1007
- });
1008
- }
1009
- };
1010
- let loopHandle = () => {
1011
- /*if (index < 500 && $grid.tableFormStop === true) {
1012
- //阻塞列表查询,或者次数达到500时,自动释放
1013
- index++
1014
- setTimeout(() => {
1015
- loopHandle();
1016
- }, 10)
1017
- } else {
1018
- if ($grid.tableFormStop) $grid.tableFormStop = false;
1019
- toDo();
1020
- }*/
1021
- toDo();
1022
- }
1023
- loopHandle();
1024
- } else {
1025
- resolve();
1026
- }
1027
- /*that.scriptHttp({
1028
- options: this.widget.options,
1029
- params: queryParams,
1030
- callback: (res) => {
1031
- resolve(res);
1032
- if (res.type == "success") {
1033
- let rows = res.objx ? res.objx.records || res.objx || [] : [];
1034
- /!*if (tableOption.treeNodeUrl) {
1035
- if (rows.length > 0) {
1036
- let $t = this.$refs[tableRef];
1037
- var treeConditions = $t.originOption.treeConditions || [
1038
- "enabled",
1039
- ];
1040
- let treeFiled = Object.keys(formData).some((key) => {
1041
- return (
1042
- !treeConditions.includes(key) && formData[key] != null && formData[key] != ""
1043
- );
1044
- });
1045
- if (treeFiled) {
1046
- that.$nextTick(() => {
1047
- setTimeout(function () {
1048
- let isLazy = $t.treeConfig.lazy;
1049
- $t.treeConfig.lazy = false;
1050
- $t.setAllTreeExpand(true).then(() => {
1051
- let fullAllDataRowMap = $t.$refs.xTable.fullAllDataRowMap;
1052
- let fullData = $t.getTableData().fullData;
1053
- fullData.forEach((lineData) => {
1054
- if (
1055
- $t.$refs.xTable.isTreeExpandByRow(lineData)
1056
- ) {
1057
- var rest = fullAllDataRowMap.get(lineData);
1058
- rest.treeLoaded = true;
1059
- }
1060
- });
1061
- $t.treeConfig.lazy = isLazy;
1062
- });
1063
- }, 0);
1064
- });
1065
- } else {
1066
- let row = rows[0];
1067
- if (row[result.treeConfig.hasChild]) {
1068
- that.$nextTick(() => {
1069
- setTimeout(function () {
1070
- $t.setTreeExpand(row, true);
1071
- }, 0);
1072
- });
1073
- }
1074
- }
1075
- }
1076
- }*!/
1077
- if (tableOption.callback) {
1078
- that.$nextTick(() => {
1079
- setTimeout(function () {
1080
- tableOption.callback(rows);
1081
- }, 0);
1082
- });
1083
- }
1084
- }
1085
- },
1086
- httpConfig: {
1087
- error: (error) => {
1088
- reject(error);
1089
- }
1090
- }
1091
- });*/
1092
- });
1093
- }
1094
- }
1095
- };
1096
- tableOption.callback = (rows) => {
1097
- // this.fieldModel = rows;
1098
- this.formModel[this.fieldKeyName] = rows
1099
- }
1100
- }
1101
- this.vxeOption = tableOption;
1102
- this.loadAccessData();
1103
-
1104
- /*this.$vxeTableUtil.initVxeTable(tableOption).then(opts => {
1105
- this.vxeOption = opts;
1106
- /!*if (!isQueryTable) {
1107
- this.$nextTick(() => {
1108
- this.loadAccessData();
1109
- });
1110
- }*!/
1111
- });
1112
- if (!isQueryTable) {
1113
- this.loadAccessData();
1114
- }*/
1115
- },
1116
- getSearchFormData() {
1117
- let map = {};
1118
- let formData = this.globalModel.formModel;
1119
- let widgetList = this.widget.widgetList;
1120
- if (!!widgetList && widgetList.length > 0) {
1121
- let loop = (wItem) => {
1122
- if (wItem.category === 'container') {
1123
- loop(wItem);
1124
- } else {
1125
- let formField = this.getFieldKeyName(wItem);
1126
- let vaule = formData[formField];
1127
- if (vaule !== null && vaule !== undefined && vaule !== '') {
1128
- map[formField] = vaule;
1129
- }
1130
- }
1131
- };
1132
- widgetList.forEach(wItem => {
1133
- loop(wItem);
1134
- });
1135
- }
1136
- return map;
1137
- },
1138
- loadTableData(param) {
1139
- if (this.dataTableConfig?.queryFormDialog !== true) {
1140
- this.checkItemIds = [];
1141
- }
1142
- param = param || {};
1143
- let pageSize = param.size || this.pageSize;
1144
- let currentPage = param.current || 1;
1145
- let page = {pageSize, currentPage};
1146
- return this.vxeOption.config.proxyConfig.ajax.query.call(this, {page, param})
1147
- },
1148
- loadAccessData() {
1149
- let isQueryTable = this.widget.options.isQueryTable || false;
1150
- if (isQueryTable) {
1151
- this.loadTableData({})
1152
- return;
1153
- }
1154
- if (!isQueryTable && !this.formDataId) return;
1155
-
1156
- let accessScript = this.widget.options.accessScript;
1157
- let formCode = this.getFormRef().reportTemplate.formCode;
1158
- if (accessScript) {
1159
- let f = new Function("dataId", "formCode", "param", "done", accessScript);
1160
- let toDo = (res) => {
1161
- let rows = res.objx ? res.objx.records || res.objx || [] : [];
1162
- // this.fieldModel = rows;
1163
- this.formModel[this.fieldKeyName] = rows
1164
- this.fieldModel = rows;
1165
- }
1166
-
1167
- f.call(this, this.formDataId, formCode, null, toDo)
1168
- }
1169
-
1170
- /*this.scriptHttp({
1171
- options: this.widget.options,
1172
- params: {},
1173
- success: (res) => {
1174
- let rows = res.objx ? res.objx.records || res.objx || [] : [];
1175
- this.fieldModel = rows;
1176
- }
1177
- });*/
1178
- },
1179
- getReqParam(item, dataId, billData) {
1180
- let param = {};
1181
- if (item.accessParam) {
1182
- if (typeof item.accessParam === "string") {
1183
- let n = new Function('billData', item.accessParam);
1184
- param = n.call(this, billData);
1185
- } else {
1186
- param = item.accessParam
1187
- }
1188
- } else {
1189
- param = {id: dataId}
1190
- }
1191
- return param;
1192
- },
1193
- async deleteRow(row, rowIndex) {
1194
- this.fieldModel.splice(rowIndex, 1);
1195
- },
1196
- createNewTableData() {
1197
- let vailColumns = this.widget.options.tableColumns.filter(item => item.prop && item.label);
1198
- let newData = {};
1199
- vailColumns.forEach(item => {
1200
- if (item.formatS == 'editSearch') {
1201
- newData[item.prop] = null;
1202
- let vabSearchName = item?.columnOption?.vabSearchName;
1203
- if (vabSearchName) newData[vabSearchName] = null;
1204
- } else {
1205
- newData[item.prop] = null;
1206
- }
1207
- });
1208
- return newData;
1209
- },
1210
- addTableData(rows, field) {
1211
- let formDataModel = this.formModel;
1212
- let tableRows = this.fieldModel;
1213
- let fullData = this.fieldModel;
1214
- let items;
1215
- if (field) {
1216
- let keys = fullData.map(item => {
1217
- return item[field] + "";
1218
- });
1219
- items = rows.filter(item => {
1220
- let value = item[field] + ""
1221
- return !keys.includes(value);
1222
- });
1223
- } else {
1224
- items = rows;
1225
- }
1226
- if (items) {
1227
- if (items.length) {
1228
- items.forEach(row => {
1229
- let newData = this.createNewTableData();
1230
- Object.assign(newData, row);
1231
-
1232
- tableRows.push(newData);
1233
- })
1234
- }
1235
- } else {
1236
- let newData = this.createNewTableData();
1237
- tableRows.push(newData);
1238
- }
1239
- // this.formModel[this.fieldKeyName] = this.$baseLodash(this.fieldModel)
1240
- // this.fieldModel = tableRows
1241
- // $grid.loadData(tableRows);
1242
- },
1243
- getColumnWidgetConfig(row) {
1244
- let formRef = this.getFormRef();
1245
- let formatS = row.formatS
1246
- let columnSelectedWidget = null;
1247
- let columnEditFields = null;
1248
-
1249
- let type = this.columnFormatMap[row.formatS];
1250
-
1251
-
1252
- if (type) {
1253
- columnSelectedWidget = this.$baseLodash.cloneDeep(formRef.getFieldWidgetByType(type));
1254
- let tmpId = generateId();
1255
- let idVal = row.prop ? row.prop : (type + tmpId);
1256
- columnSelectedWidget.id = idVal;
1257
- columnSelectedWidget.options.name = idVal;
1258
- if (row.columnOption && Object.keys(row.columnOption).length) {
1259
- row.columnOption.required = row.required || false;
1260
- columnSelectedWidget.options = row.columnOption;
1261
- } else {
1262
- columnSelectedWidget.options.required = row.required || false;
1263
- row.columnOption = columnSelectedWidget.options;
1264
- }
1265
- columnSelectedWidget.options.name = row.prop;
1266
- columnSelectedWidget.options.label = row.label;
1267
- columnSelectedWidget.options.labelHidden = true;
1268
- }
1269
- return {columnSelectedWidget, columnEditFields};
1270
- },
1271
- getColumnProp(widget, obj) {
1272
- let isQueryTable = this.widget.options.isQueryTable || false;
1273
- if (isQueryTable) {
1274
- return "false";
1275
- } else {
1276
- let propName = this.getFieldKeyName(widget) + '.' + obj.rowIndex + '.' + obj.column.field
1277
- if (this.isVabsearchFlagWidget(widget)) {
1278
- let vabSearchName = obj.column.params.widget.options.vabSearchName;
1279
- propName = this.getFieldKeyName(widget) + '.' + obj.rowIndex + '.' + vabSearchName;
1280
- }
1281
- return propName;
1282
- }
1283
- },
1284
- getColumnWidgetName(e) {
1285
- if (e && e.type) {
1286
- return e.type + '-widget';
1287
- }
1288
- },
1289
- getGridTable() {
1290
- let $grid = this.$refs[this.getTableRef()];
1291
- return $grid;
1292
- },
1293
- getTableRef() {
1294
- let tableRef = this.widget.id;
1295
- return tableRef;
1296
- },
1297
- getUrl() {
1298
- let accessUrl = this.widget.options.accessUrl
1299
- return accessUrl || (USER_PREFIX + `/form_ins/getFormInsData`);
1300
- },
1301
- openRowDetailDialog(row) {
1302
- /*let isQueryTable = this.widget.options.isQueryTable || false;
1303
- if(isQueryTable)return;*/
1304
- this.editRow = row;
1305
- this.showRowDetailDialog = true;
1306
- },
1307
- changePageNew({type, currentPage, pageSize, $event}) {
1308
- this.loadTableData({
1309
- size: pageSize + "",
1310
- current: currentPage + ""
1311
- })
1312
- },
1313
- exportData(option) {
1314
- let tableRef = this.getTableRef();
1315
- let serverName = this.getFormRef().reportTemplate.serverName;
1316
- option.prefix = option.prefix || serverName;
1317
- this.$excelExport({targetRef: tableRef, ...option})
1318
- },
1319
- itemCheck(row) {
1320
- let dataTableConfig = this.dataTableConfig;
1321
- if (dataTableConfig) {
1322
- let checkItemIds = this.checkItemIds;
1323
- let checked;
1324
- if (checkItemIds.includes(row.id)) {
1325
- checked = false;
1326
- checkItemIds.splice(checkItemIds.indexOf(row.id), 1);
1327
- } else {
1328
- checked = true;
1329
- checkItemIds.push(row.id)
1330
- }
1331
- let param = {row, checked};
1332
- dataTableConfig.onCheckboxChange && dataTableConfig.onCheckboxChange(param);
1333
- }
1334
-
1335
- }
1336
- }
1337
- };
1338
- </script>
1339
-
1340
- <style lang="scss" scoped></style>