1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
| <template>
| <el-dialog
| :close-on-click-modal="false"
| title="选择参照配置"
| append-to-body
| :visible.sync="isShowReferConfigCrud"
| width="95%"
| top="0"
| class= "avue-dialog avue-dialog--top"
| id="refer-config-dialog"
| style="height: 115vh; margin-top: -14vh; overflow-y: hidden">
| <div style="width: 100%; overflow-y: auto; height: 70vh">
| <el-row style="width: 100%; height:70%">
| <el-col :style="toggleBasicCrudWidth">
| <basic-container style="width: 100%;">
| <avue-crud :option="referConfigCrudOption"
| class="refer-config-crud"
| :page.sync="referConfigParams.referConfigPage"
| :table-loading="referConfigParams.referConfigLoading"
| :data="referConfigParams.referConfigData"
| :ref= "referConfigParams.ref"
| @row-click="referConfigRowClick"
| @search-change="referConfigSearchChange"
| @search-reset="referConfigSearchReset"
| @current-change="referConfigCurrentChange"
| @size-change="referConfigSizeChange"
| @on-load="referConfigOnload">
| <template #radio="{row}">
| <el-radio v-model="referConfigParams.referConfigSelectedRow"
| :label="row.$index">
|
| </el-radio>
| </template>
| </avue-crud>
| </basic-container>
| </el-col>
| <el-col v-show="isShowForm" style="height: 100%; width: 30%;">
| <basic-container style="width: 100%; height: 100vh; overflow-y: hidden">
| <avue-form ref="refereConfigForm"
| style="height: 65vh; overflow-y: auto;"
| :option="formOption"
| v-model="referConfigForm"
| class="refer-confg-form">
| </avue-form>
| </basic-container>
| </el-col>
| </el-row>
| <el-row style="width: 100%; height:30%; margin-top: 130px">
| <el-col
| :style="toggleSrchCrudWidth">
| <basic-container style="width: 100%; height:100%;">
| <avue-crud :option="srchCondOption"
| class="refer-srchcond-crud"
| :table-loading="srchCondParams.srchCondLoading"
| :data="srchCondParams.srchCondData"
| :ref= "srchCondParams.ref">
| </avue-crud>
| </basic-container>
| </el-col>
| <el-col v-show="showAttrParams.isShow" style="width: 60%; height: 100%;">
| <basic-container style="width: 100%; height:100%;">
| <avue-crud :option="showAttrOption"
| class="refer-attr-crud"
| :table-loading="showAttrParams.showAttrLoading"
| :data="showAttrParams.showAttrData"
| :ref= "showAttrParams.ref">
| </avue-crud>
| </basic-container>
| </el-col>
| </el-row>
| </div>
| <div slot="footer" class="dialog-footer">
| <el-button type="primary" @click="selectedreferConfig('selectedSave')">选择并保存</el-button>
| <el-button @click="selectedreferConfig('selectedEdit')">选择并修改</el-button>
| </div>
| </el-dialog>
| </template>
|
| <script>
| //import func from "@/util/func";
| import { getReferConfigPage } from "@/api/code/codeReferConfig";
| export default {
| name: "referConfigCrudDialog",
| props: {
|
| },
| data() {
| return{
| isShowReferConfigCrud: false,
| referConfigCrudOption: {
| border: true,
| height: '45vh',
| tip: false,
| searchShow: true,
| searchMenuSpan: 6,
| index: true,
| selection: false,
| menu: false,
| addBtn: false,
| refreshBtn: false,
| searchShowBtn: false,
| columnBtn: false,
| dialogClickModal: false,
| highlightCurrentRow: true,
| align: 'center',
| menuAlign: 'center',
| column: [
| {
| label: '-',
| prop: 'radio',
| width: 60,
| hide: false
| },{
| label: '参照配置编号',
| width: 120,
| search: true,
| searchSpan: 9,
| searchLabelWidth: 100,
| prop: 'id'
| },{
| label: '参照配置名称',
| search: true,
| searchSpan: 9,
| searchLabelWidth: 100,
| prop: 'name'
| },{
| label: '参照的业务类型',
| search: false,
| prop: 'referTypeName'
| },{
| label: '显示的属性',
| search: false,
| prop: 'textField'
| },{
| label: '存储值的属性',
| search: false,
| prop: 'valueField'
| },{
| label: '参照窗口类型',
| search: false,
| prop: 'typeText',
| }
| ],
| },
| referConfigParams: {
| ref: "referConfigCrud",
| referConfigLoading: false,
| referConfigData: [],
| referConfigPage: {
| pageSize: 10,
| currentPage: 1,
| total: 0
| },
| referConfigQuery: {},
| referConfigSelectedRowData: '',
| // 当前选中行
| referConfigSelectedRow: '',
| },
| formOption: {
| submitBtn: false,
| emptyBtn: false,
| labelWidth: '150', //默认标签宽度
| // 默认配置就为树形类型,改了会出现问题
| column: [
| {
| label: '树形的上级属性',
| prop: 'parentFieldName',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '上级属性值对应属性',
| prop: 'parentUsedField',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '根节点的值',
| prop: 'parentValue',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '树加载方式',
| prop: 'loadType',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| dicData: [{
| label: '全部', value: 'all'
| }, {
| label: '逐级加载', value: 'node'
| }],
| },{
| label: '是否只能选择叶子节点',
| prop: 'onlyLeaf',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '排序字段',
| prop: 'sortField',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '排序类型',
| prop: 'sortType',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| dicData: [{
| label: '升序', value: 'asc'
| }, {
| label: '降序', value: 'desc'
| }],
| },
| ],
| },
| referConfigForm:{},
| // 排序类型的表单配置
| sortColumn:[{
| label: '每页显示条数',
| prop: 'limit',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '排序字段',
| prop: 'sortField',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '排序类型',
| prop: 'sortType',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| dicData: [{
| label: '升序', value: 'asc'
| }, {
| label: '降序', value: 'desc'
| }],
| }],
| // 树形类型的表单配置
| treeColumn:[{
| label: '树形的上级属性',
| prop: 'parentFieldName',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '上级属性值对应属性',
| prop: 'parentUsedField',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '根节点的值',
| prop: 'parentValue',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },
| {
| label: '树加载方式',
| prop: 'loadType',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| dicData: [{
| label: '全部', value: 'all'
| }, {
| label: '逐级加载', value: 'node'
| }],
| },{
| label: '是否只能选择叶子节点',
| prop: 'onlyLeaf',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '排序字段',
| prop: 'sortField',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },{
| label: '排序类型',
| prop: 'sortType',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| dicData: [{
| label: '升序', value: 'asc'
| }, {
| label: '降序', value: 'desc'
| }],
| },
| ],
| // 平台类型的表单配置
| standColumn:[{
| label: '参考的UI上下文',
| prop: 'referContent',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| },
| {
| label: '平台的表格编号',
| prop: 'displayTable',
| span: 24,
| disabled: true,
| row: true,
| placeholder: ' ',
| }],
|
| // 查询条件表格区域
| srchCondOption: {
| border: true,
| height: '40vh',
| tip: false,
| searchShow: false,
| searchMenuSpan: 6,
| index: true,
| selection: false,
| menu: false,
| addBtn: false,
| refreshBtn: false,
| searchShowBtn: false,
| columnBtn: false,
| dialogClickModal: false,
| highlightCurrentRow: true,
| align: 'center',
| menuAlign: 'center',
| column: [
| {
| label: '查询条件',
| children: [
| {
| label: '筛选字段',
| prop: 'filterField',
| },{
| label: '筛选类型',
| prop: 'filterType',
| },{
| label: '筛选的值',
| prop: 'filterValue',
| }
| ],
| },
| ],
| },
| srchCondParams: {
| ref: "srchCondCrud",
| srchCondLoading: false,
| srchCondData: [],
| isShow: true,
| },
| toggleSrchCrudWidth: {
| width: '40%',
| height: '100%',
| },
|
| //显示的属性表格配置区域
| showAttrOption: {
| border: true,
| height: '40vh',
| tip: false,
| searchShow: false,
| searchMenuSpan: 6,
| index: true,
| selection: false,
| menu: false,
| addBtn: false,
| refreshBtn: false,
| searchShowBtn: false,
| columnBtn: false,
| dialogClickModal: false,
| highlightCurrentRow: true,
| align: 'center',
| menuAlign: 'center',
| column: [
| {
| label: '显示的属性',
| children: [
| {
| label: '列字段',
| // width: 120,
| prop: 'field',
| //type: 'select',
| // props: {
| // label: 'name',
| // value: 'code'
| // },
| // dicUrl: 'https://cli.avuejs.com/api/area/getProvince'
| },{
| label: '列名',
| prop: 'title'
| },{
| label: '字段类型',
| prop: 'fieldTypeText'
| },{
| label: '列表可排序',
| prop: 'sort'
| },{
| label: '排序字段',
| prop: 'attrSortField'
| },{
| label: '字段宽度',
| prop: 'width'
| },{
| label: '列固定位置',
| prop: 'fixedPositionText'
| },{
| label: 'js显示代码',
| prop: 'templet'
| },{
| label: '是否快速查询',
| prop: 'isQuery'
| }
| ]
| },
| ],
| },
| showAttrParams: {
| ref: "showAttrCrud",
| showAttrLoading: false,
| showAttrData: [],
| isShow: true,
| },
|
| // 是否显示变动的表单区域
| isShowForm: true,
| toggleBasicCrudWidth: {
| height: '100%',
| width: '70%',
| },
|
| // 是否显示属性表格
| isShowAttrCrud: true,
|
| defaultOrGridForm: ['limit','sortField','sortType'],
| standForm: ['referContent','displayTable'],
| treeForm: [
| 'parentFieldName',
| 'parentUsedField',
| 'parentValue',
| 'loadType',
| 'onlyLeaf',
| 'sortField',
| 'sortType'
| ],
| }
| },
| watch: {
| // 监听父组件传的窗口显示隐藏的值
| isShowReferConfigCrud (){
| if(this.isShowReferConfigCrud){
| this.referConfigOnload();
| }
| }
| },
| methods: {
|
| // 下一步要进行的操作选择并保存或选择并修改
| selectedreferConfig(condition) {
| // 当前选中的参照配置行
| let currentSeletedRow = this.referConfigParams.referConfigSelectedRowData;
| if(!currentSeletedRow){
| this.$message.warning("请选择一条数据!");
| return;
| }
| let filterForm = this.filterForm(currentSeletedRow);
| if(condition == "selectedSave"){
| // 直接保存,所以直接调用code界面的界面回显
| this.$emit('echoReferConfig',filterForm);
| // console.log(filterForm);
| }else {
| // 选择并修改,执行code服务中的打开界面,所以要先构造出所需的数据
| let submitForm = {
| referBtmName: filterForm.referType,
| referBtmId: filterForm.referTypeName,
| referConfig: JSON.stringify(filterForm),
| }
| this.$emit('openReconfigInterFace',submitForm);
| }
| this.isShowReferConfigCrud = false;
| },
| // 过滤出当前类型所需要的属性
| filterForm(currentRow){
| // 需要保留的基础属性
| let submittDefaultForm = [
| 'referTypeName',
| 'referType',
| 'textField',
| 'valueField',
| 'type', //参照窗口类型
| 'url',
| 'backPath',
| 'method',
| 'height',
| 'useFormKey',
| 'paramForFormKey',
| 'isMuti',
| 'mapFields',
| 'isOpenGlobal', //是否开启全局
| 'isPersistence',
| 'id',
| 'name',
| ];
| // 需要根据类型添加的属性
| let addArray = [];
| let newForm ={};
| // 根据不同类型过滤出不同的的表单属性
| if(currentRow.type == 'stand'){
| addArray = ['referContent', 'displayTable'];
| } else if(currentRow.type == 'default' || currentRow.type == 'grid'){
| addArray = ['limit', 'sortField', 'sortType'];
| } else if(currentRow.type == 'tree'){
| addArray = [
| "parentFieldName",
| 'parentUsedField',
| 'parentValue',
| 'loadType',
| 'onlyLeaf',
| 'sortField',
| 'sortType'
| ];
| }
| // 拼接两个数组
| submittDefaultForm = submittDefaultForm.concat(addArray);
| if(currentRow.codeSrchCondConfigVOS.length > 0){
| //console.log(currentRow.codeSrchCondConfigVOS);
| newForm = {
| codeSrchCondConfigVOS: currentRow.codeSrchCondConfigVOS,
| }
| }
| if((currentRow.type == 'default' || currentRow.type == 'grid') && currentRow.codeShowFieldConfigVOS.length >= 0){
| newForm = Object.assign(newForm,{codeShowFieldConfigVOS: currentRow.codeShowFieldConfigVOS});
| }
| // 过滤出空值属性和不需要的属性
| submittDefaultForm.forEach(item=>{
| // console.log(!this.checkStringIsEmpty(currentRow[item]) || !this.checkArrayIsUndefined(currentRow[item]));
| if((item == 'isMuti' || item == 'onlyLeaf') || (!this.checkStringIsEmpty(currentRow[item]) || !this.checkArrayIsUndefined(currentRow[item]))){
| //console.log(item,currentRow[item]);
| newForm = Object.assign(newForm,{[item]:currentRow[item]});
| }
| });
| // console.log(newForm);
| return newForm;
| },
| /**
| * 为空
| * @param val
| * @returns {boolean}
| */
| checkStringIsEmpty(val){
| if (
| val === null ||
| typeof val === 'undefined' ||
| (typeof val === 'string' && val === "" && val !== 'undefined')
| ) {
| return true;
| }
| return false;
| },
| /**
| * 是否为定义
| * @param val
| * @returns {boolean}
| */
| checkArrayIsUndefined(val){
| return typeof val === 'array' && (val.length === 0 || val === null || typeof val === 'undefined' || val === []);
| },
| referConfigOnload(){
| let refer = this.referConfigParams;
| refer.referConfigLoading = true;
| let param = {};
| // 多个conditionMap这样传参
| if(refer.referConfigQuery){
| Object.keys(refer.referConfigQuery).forEach(key=>{
| param['conditionMap['+key+']'] = refer.referConfigQuery[key];
| });
| }
| getReferConfigPage(
| refer.referConfigPage.currentPage,
| refer.referConfigPage.pageSize,
| param
| ).then(res=>{
| const data = res.data.data;
| this.referConfigParams.referConfigPage.total = data.total;
| this.referConfigParams.referConfigData = data.records;
| this.referConfigParams.referConfigLoading = false;
| //console.log(this.referConfigParams.referConfigData.length > 0);
| // 渲染其他区域数据
| if(this.referConfigParams.referConfigData.length > 0) {
| this.$nextTick(() => {
| // 表格错行问题
| this.$refs[this.referConfigParams.ref].doLayout()
| // 默认选中第一行
| this.referConfigParams.referConfigSelectedRow = 0;
| this.$refs[this.referConfigParams.ref].setCurrentRow(this.referConfigParams.referConfigData[0]);
| this.referConfigParams.referConfigSelectedRowData = this.referConfigParams.referConfigData[0];
| this.attrAndSrchCondOnload(this.referConfigParams.referConfigData[0]);
| this.loadDefaultOrGridOrStandOrTreeForm(this.referConfigParams.referConfigData[0]);
| })
| }
| });
| },
| referBtmTypeSizeChange(pageSize){
| this.referConfigParams.referConfigPage.pageSize = pageSize;
| },
| referBtmTypeCurrentChange(currentPage){
| this.referConfigParams.referConfigPage.currentPage = currentPage;
| },
| referConfigRowClick(row){
| // 对当前选中行进行记录
| this.referConfigParams.referConfigSelectedRowData = row;
| // 单选框选中
| this.referConfigParams.referConfigSelectedRow = row.$index
| this.attrAndSrchCondOnload(row);
| this.loadDefaultOrGridOrStandOrTreeForm(row);
| },
| referConfigSearchChange(params, done){
| this.referConfigParams.referConfigQuery = params;
| this.referConfigParams.referConfigPage.currentPage = 1;
| this.referConfigOnload();
| done();
| },
| referConfigSearchReset(){
| this.referConfigParams.referConfigQuery = {};
| this.referConfigOnload(this.referConfigParams.referConfigPage);
| },
| referConfigCurrentChange(currentPage){
| this.referConfigParams.referConfigPage.currentPage = currentPage;
| },
| referConfigSizeChange(pageSize){
| this.referConfigParams.referConfigPage.pageSize = pageSize;
| },
| // 加载表单显示内容
| loadDefaultOrGridOrStandOrTreeForm(currentFormData){
| if(currentFormData.type != 'tree' &
| currentFormData.type != 'stand' &
| currentFormData.type != 'default'&
| currentFormData.type != 'grid') {
| //控制参照配置表格和表单显示比例
| this.isShowForm = false;
| this.toggleBasicCrudWidth.width = '100%';
| }else {
| this.isShowForm = true;
| this.toggleBasicCrudWidth.width = '70%';
| this.toggleFormOption(currentFormData);
| }
| this.toggleCurdWidth(currentFormData);
| //console.log(this.isShowForm);
| //console.log(this.toggleBasicCrudWidth.width);
| },
|
| // 根据type的变动切换表单的配置option
| toggleFormOption(data){
| //console.log(data);
| let currentForm = '';
| if(data.type=='default' || data.type=='grid'){
| this.formOption.column = this.sortColumn;
| currentForm = 'defaultOrGridForm';
| }else if(data.type == 'stand'){
| this.formOption.column = this.standColumn;
| currentForm = 'standForm';
| }else if(data.type == 'tree'){
| this.formOption.column = this.treeColumn;
| currentForm = 'treeForm'
| }
| this.referConfigForm = {},
| //console.log( this.formOption);
| this[currentForm].forEach(item=>{
| Vue.set(this.referConfigForm, item, data[item])
| //this.referConfigForm = Object.assign(this.referConfigForm,{[item]:data[item]})
| })
| // console.log(this.referConfigForm);
| },
| // 根据type的变动切换attr表格的显示隐藏,调整查询条件表格的宽度
| toggleCurdWidth(data) {
| if(data.type=='default' || data.type=='grid'){
| this.showAttrParams.isShow = true;
| // 不需要显示属性表格所有需要将查询调价表格缩小为100%
| this.toggleSrchCrudWidth.width = '40%';
| }else {
| this.showAttrParams.isShow = false;
| // 不需要显示属性表格所有需要将查询调价表格缩小为100%
| this.toggleSrchCrudWidth.width = '100%';
| }
| // console.log(this.toggleSrchCrudWidth);
| // console.log(this.showAttrParams.isShow);
| },
|
| // 显示的属性和查询条件相关方法
| attrAndSrchCondOnload(row){
| this.srchCondParams.srchCondLoading = true;
| this.showAttrParams.showAttrLoading = true;
| this.$nextTick(() => {
| this.$refs[this.srchCondParams.ref].doLayout()
| this.$refs[this.showAttrParams.ref].doLayout()
| });
| this.srchCondParams.srchCondData = row.codeSrchCondConfigVOS
| this.showAttrParams.showAttrData = row.codeShowFieldConfigVOS
| //console.log(this.showAttrParams.showAttrData);
| this.srchCondParams.srchCondLoading = false;
| this.showAttrParams.showAttrLoading = false;
| },
|
| },
| }
| </script>
|
| <style>
|
| .refer-config-crud > .el-card > .el-card__body > .avue-crud__menu {
| display: none!important;
| }
| .refer-srchcond-crud > .el-card > .el-card__body > .avue-crud__menu {
| display: none!important;
| }
| .refer-attr-crud > .el-card > .el-card__body > .avue-crud__menu {
| display: none!important;
| }
|
| </style>
|
|