RightPanel.vue
28.5 KB
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
748
749
750
751
752
753
754
755
756
757
<template>
<div class="right-board">
<el-tabs v-model="currentTab" class="center-tabs">
<el-tab-pane label="组件属性" name="field" />
<el-tab-pane label="表单属性" name="form" />
</el-tabs>
<div class="field-box">
<el-scrollbar class="right-scrollbar">
<!-- 组件属性 -->
<el-form v-show="currentTab==='field' && showField" size="small" label-width="90px"
labelPosition="left">
<template v-if="activeData.__config__">
<template v-if="$store.getters.hasTable">
<template v-if="activeData.__config__.nccKey==='table'">
<el-form-item v-if="activeData.__vModel__!==undefined" label="控件字段">
<el-input v-model="activeData.__vModel__" placeholder="请输入控件字段(v-model)"
disabled />
</el-form-item>
</template>
<template v-else>
<template v-if="!activeData.__config__.isSubTable">
<el-form-item v-if="activeData.__vModel__!==undefined" label="控件字段">
<el-select v-model="activeData.__vModel__" placeholder="请选择控件字段(v-model)"
clearable @change="fieldChange">
<el-option v-for="item in formItemList" :key="item.field" :value="item.field"
:label="item.fieldName?item.field+'('+item.fieldName+')':item.field">
</el-option>
</el-select>
</el-form-item>
</template>
<template v-if="activeData.__config__.isSubTable && subTable.length">
<el-form-item v-if="activeData.__vModel__!==undefined" label="控件字段">
<el-select v-model="activeData.__vModel__" placeholder="请选择控件字段(v-model)"
clearable @change="fieldChange1">
<el-option
v-for="item in getSubTalebFiled(activeData.__config__.relationTable)"
:key="item.field" :value="item.field"
:label="item.fieldName?item.field+'('+item.fieldName+')':item.field">
</el-option>
</el-select>
</el-form-item>
</template>
</template>
</template>
<template v-else>
<el-form-item v-if="activeData.__vModel__!==undefined" label="控件字段">
<el-input v-model="activeData.__vModel__" placeholder="请输入控件字段(v-model)" disabled />
</el-form-item>
</template>
<NCCComInput v-if="activeData.__config__.nccKey==='comInput'"
:active-data="activeData" />
<NCC-textarea v-if="activeData.__config__.nccKey==='textarea'"
:active-data="activeData" />
<NCCText v-if="activeData.__config__.nccKey==='NCCText'" :active-data="activeData" />
<NCCNumInput v-if="activeData.__config__.nccKey==='numInput'"
:active-data="activeData" />
<NCCAmount v-if="activeData.__config__.nccKey==='NCCAmount'"
:active-data="activeData" />
<NCCPsdInput v-if="activeData.__config__.nccKey==='PsdInput'"
:active-data="activeData" />
<NCCRadio v-if="activeData.__config__.nccKey==='radio'" :active-data="activeData" />
<NCCCheckbox v-if="activeData.__config__.nccKey==='checkbox'"
:active-data="activeData" />
<NCCSelect v-if="activeData.__config__.nccKey==='select'" :active-data="activeData"
:key="activeData.__config__.renderKey" :dictionaryOptions="dictionaryOptions"
:dataInterfaceOptions="dataInterfaceOptions" />
<NCCCascader v-if="activeData.__config__.nccKey==='cascader'"
:active-data="activeData" />
<NCCTime v-if="activeData.__config__.nccKey==='time'" :active-data="activeData" />
<NCCTimeRange v-if="activeData.__config__.nccKey==='timeRange'"
:active-data="activeData" />
<NCCDate v-if="activeData.__config__.nccKey==='date'" :active-data="activeData" />
<NCCDateRange v-if="activeData.__config__.nccKey==='dateRange'"
:active-data="activeData" />
<NCCColorPicker v-if="activeData.__config__.nccKey==='colorPicker'"
:active-data="activeData" />
<NCCRate v-if="activeData.__config__.nccKey==='rate'" :active-data="activeData" />
<NCCSwitch v-if="activeData.__config__.nccKey==='switch'" :active-data="activeData" />
<NCCSlider v-if="activeData.__config__.nccKey==='slider'" :active-data="activeData" />
<NCCDivider v-if="activeData.__config__.nccKey==='divider'"
:active-data="activeData" />
<NCCUploadFz v-if="activeData.__config__.nccKey==='uploadFz'"
:active-data="activeData" />
<NCCUploadImg v-if="activeData.__config__.nccKey==='uploadImg'"
:active-data="activeData" />
<NCCComRight v-if="isCommon" :active-data="activeData" />
<NCCAddress v-if="activeData.__config__.nccKey==='address'"
:active-data="activeData" />
<TreeSelect v-if="activeData.__config__.nccKey==='treeSelect'"
:active-data="activeData" />
<GroupTitle v-if="activeData.__config__.nccKey==='groupTitle'"
:active-data="activeData" />
<RelationForm v-if="activeData.__config__.nccKey==='relationForm'"
:active-data="activeData" v-on="$listeners" />
<RelationFormAttr v-if="activeData.__config__.nccKey==='relationFormAttr'"
:active-data="activeData" ref="relationFormAttr" />
<RelationFlow v-if="activeData.__config__.nccKey==='relationFlow'"
:active-data="activeData" v-on="$listeners" />
<RelationFlowAttr v-if="activeData.__config__.nccKey==='relationFlowAttr'"
:active-data="activeData" ref="relationFlowAttr" />
<NCCCalculate v-if="activeData.__config__.nccKey==='calculate'"
:active-data="activeData" ref="calculate" />
<PopupSelect v-if="activeData.__config__.nccKey==='popupSelect'"
:active-data="activeData" />
<Tab v-if="activeData.__config__.nccKey==='tab'" :active-data="activeData" />
<Collapse v-if="activeData.__config__.nccKey==='collapse'" :active-data="activeData" />
<template v-if="isSystem">
<el-form-item label="控件标题">
<el-input v-model="activeData.__config__.label" placeholder="请输入控件标题" />
</el-form-item>
<el-form-item label="控件栅格">
<el-slider v-model="activeData.__config__.span" :max="24" :min="6" show-stops
:step="2" show-tooltip />
</el-form-item>
<el-form-item label="标题宽度">
<el-input-number v-model="activeData.__config__.labelWidth" placeholder="标题宽度"
:min="0" :precision="0" controls-position="right" />
</el-form-item>
<el-form-item label="选择模板" v-if="activeData.__config__.nccKey==='billRule'">
<BillRule v-model="activeData.__config__.rule" placeholder="选择模板" />
</el-form-item>
<el-form-item label="是否隐藏">
<el-switch v-model="activeData.__config__.noShow" />
</el-form-item>
</template>
<template v-if="activeData.on && (modelType==1||modelType==6)">
<el-divider>组件事件</el-divider>
<div v-for="(value,key) in activeData.on" :key="key">
<el-form-item :label="key">
<el-button style="width: 100%;" @click="editFunc(value,key)">
{{getTipText(key)}}
</el-button>
</el-form-item>
</div>
</template>
<template v-if="activeData.__config__.nccKey==='table'">
<el-form-item label="关联子表" v-if="$store.getters.hasTable">
<el-select v-model="activeData.__config__.tableName" placeholder="请选择关联子表" clearable
@change="onTableNameChange">
<el-option v-for="item in subTable" :key="item.table" :label="item.table"
:value="item.table">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="控件标题">
<el-input v-model="activeData.__config__.label" placeholder="请输入控件标题" />
</el-form-item>
<el-form-item label="显示标题">
<el-switch v-model="activeData.__config__.showTitle" />
</el-form-item>
<el-form-item v-if="activeData.actionText !== undefined" label="动作文字">
<el-input v-model="activeData.actionText" placeholder="请输入动作文字" />
</el-form-item>
</template>
<template v-if="activeData.__config__.nccKey==='card'">
<el-form-item label="控件栅格" label-width="76px">
<el-slider v-model="activeData.__config__.span" :max="24" :min="6" show-stops
:step="2" show-tooltip />
</el-form-item>
<el-form-item label="卡片标题" label-width="76px">
<el-input v-model="activeData.header" placeholder="请输入卡片标题" />
</el-form-item>
<el-form-item label="显示阴影" label-width="76px">
<el-radio-group v-model="activeData.shadow" size="small">
<el-radio-button label="always">一直显示</el-radio-button>
<el-radio-button label="hover">移入显示</el-radio-button>
<el-radio-button label="never">永不显示</el-radio-button>
</el-radio-group>
</el-form-item>
</template>
<!-- row 布局 -->
<template v-if="activeData.__config__.nccKey==='row'">
<el-form-item v-if="activeData.__config__.componentName!==undefined" label="组件名">
{{ activeData.__config__.componentName }}
</el-form-item>
<el-form-item label="控件栅格">
<el-slider v-model="activeData.__config__.span" :max="24" :min="6" show-stops
:step="2" show-tooltip />
</el-form-item>
</template>
<el-form-item
v-if="activeData.__config__.layout==='rowFormItem'&&activeData.gutter!==undefined"
label="栅格间隔">
<el-input-number v-model="activeData.gutter" :min="0" placeholder="栅格间隔"
controls-position="right" />
</el-form-item>
</template>
</el-form>
<!-- 表单属性 -->
<el-form v-show="currentTab === 'form'" size="small" label-width="100px"
labelPosition="left">
<el-form-item label="表单尺寸">
<el-radio-group v-model="formConf.size">
<el-radio-button label="medium">中等</el-radio-button>
<el-radio-button label="small">较小</el-radio-button>
<el-radio-button label="mini">迷你</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="标签对齐">
<el-radio-group v-model="formConf.labelPosition">
<el-radio-button label="left">左对齐</el-radio-button>
<el-radio-button label="right">右对齐</el-radio-button>
<el-radio-button label="top" :disabled="formConf.formStyle==='word-form'">顶部对齐
</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="标题宽度">
<el-input-number v-model="formConf.labelWidth" :min="0" placeholder="标题宽度"
controls-position="right" />
</el-form-item>
<el-form-item label="栅格间隔">
<el-input-number v-model="formConf.gutter" :min="0" placeholder="栅格间隔"
controls-position="right" />
</el-form-item>
<el-form-item label="弹窗类型" v-if="modelType != 3 && modelType!=6">
<el-select v-model="formConf.popupType" placeholder="请选择">
<el-option label="普通弹窗" value="general"></el-option>
<el-option label="全屏弹窗" value="fullScreen"></el-option>
</el-select>
</el-form-item>
<el-form-item label="表单样式" v-if="modelType != 3">
<el-select v-model="formConf.formStyle" placeholder="请选择">
<el-option label="默认风格" value=""></el-option>
<el-option label="公文风格" value="word-form"></el-option>
</el-select>
</el-form-item>
<el-form-item label="表单宽度"
v-if="formConf.popupType==='general' && modelType != 3 && modelType!=6">
<el-select v-model="formConf.generalWidth" placeholder="请选择">
<el-option v-for="item in generalWidthOptions" :label="item" :value="item"
:key="item" />
</el-select>
</el-form-item>
<el-form-item label="表单宽度"
v-if="formConf.popupType==='fullScreen' || modelType == 3 || modelType ==6">
<el-select v-model="formConf.fullScreenWidth" placeholder="请选择">
<el-option v-for="item in fullScreenWidthOptions" :label="item" :value="item"
:key="item" />
</el-select>
</el-form-item>
<template v-if="modelType!=3 && modelType!=6 && webType!=3">
<el-divider>表单按钮</el-divider>
<div class="per-cell">
<el-checkbox v-model="formConf.hasConfirmBtn" disabled>确定</el-checkbox>
<el-input v-model="formConf.confirmButtonText" />
</div>
<div class="per-cell">
<el-checkbox v-model="formConf.hasCancelBtn" disabled>取消</el-checkbox>
<el-input v-model="formConf.cancelButtonText" />
</div>
<template v-if="modelType==1 && webType==2">
<div class="per-cell" :class="{'last':!formConf.hasPrintBtn}">
<el-checkbox v-model="formConf.hasPrintBtn">打印</el-checkbox>
<el-input v-model="formConf.printButtonText" />
</div>
<el-form-item label="打印设置" v-if="formConf.hasPrintBtn">
<NCC-TreeSelect :options="printTplList" v-model="formConf.printId"
placeholder="请选择打印模板" lastLevel clearable></NCC-TreeSelect>
</el-form-item>
</template>
</template>
<template v-if="formConf.funcs && (modelType==1||modelType==6)">
<el-divider>表单事件</el-divider>
<el-form-item label="onLoad">
<el-button style="width: 100%;"
@click="editFunc(formConf.funcs.onLoad,'onLoad',true)">表单加载触发
</el-button>
</el-form-item>
<el-form-item label="beforeSubmit">
<el-button style="width: 100%;"
@click="editFunc(formConf.funcs.beforeSubmit,'beforeSubmit',true)">提交前置触发
</el-button>
</el-form-item>
<el-form-item label="afterSubmit">
<el-button style="width: 100%;"
@click="editFunc(formConf.funcs.afterSubmit,'afterSubmit',true)">提交后置触发</el-button>
</el-form-item>
</template>
</el-form>
</el-scrollbar>
</div>
<form-script :visible.sync="formScriptVisible" :tpl="activeScript" :fields="drawingList"
@updateScript="updateScript" />
</div>
</template>
<script>
import { isNumberStr } from '@/components/Generator/utils'
import { saveFormConf, getDrawingList } from '@/components/Generator/utils/db'
import { getDictionaryTypeSelector } from "@/api/systemData/dictionary"
import { getDataInterfaceSelector } from "@/api/systemData/dataInterface"
import FormScript from './FormScript'
import NCCComInput from './RightComponents/ComInput'
import NCCTextarea from './RightComponents/Textarea'
import NCCText from './RightComponents/NCCText'
import NCCNumInput from './RightComponents/NumInput'
import NCCAmount from './RightComponents/NCCAmount'
import NCCPsdInput from './RightComponents/PsdInput'
import NCCRadio from './RightComponents/Radio'
import NCCCheckbox from './RightComponents/Checkbox'
import NCCSelect from './RightComponents/Select'
import NCCCascader from './RightComponents/Cascader/index'
import NCCTime from './RightComponents/Time'
import NCCTimeRange from './RightComponents/TimeRange'
import NCCDate from './RightComponents/Date'
import NCCDateRange from './RightComponents/DateRange'
import NCCColorPicker from './RightComponents/ColorPicker'
import NCCRate from './RightComponents/Rate'
import NCCSwitch from './RightComponents/Switch'
import NCCSlider from './RightComponents/Slider'
import NCCDivider from './RightComponents/Divider'
import NCCUploadFz from './RightComponents/UploadFz'
import NCCUploadImg from './RightComponents/UploadImg'
import NCCComRight from './RightComponents/ComRight'
import NCCAddress from './RightComponents/Address'
import TreeSelect from './RightComponents/TreeSelect'
import GroupTitle from './RightComponents/GroupTitle'
import RelationForm from './RightComponents/RelationForm'
import RelationFormAttr from './RightComponents/RelationFormAttr'
import RelationFlow from './RightComponents/RelationFlow'
import RelationFlowAttr from './RightComponents/RelationFlowAttr'
import NCCCalculate from './RightComponents/Calculate'
import PopupSelect from './RightComponents/PopupSelect'
import Tab from './RightComponents/Tab'
import Collapse from './RightComponents/Collapse'
const commonRightList = ['comSelect', 'depSelect', 'posSelect', 'userSelect', 'dicSelect', 'editor']
const systemList = ['createUser', 'createTime', 'modifyUser', 'modifyTime', 'currOrganize', 'currDept', 'currPosition', 'billRule']
export default {
components: {
FormScript,
NCCComInput,
NCCTextarea,
NCCText,
NCCNumInput,
NCCAmount,
NCCPsdInput,
NCCRadio,
NCCCheckbox,
NCCSelect,
NCCCascader,
NCCTime,
NCCTimeRange,
NCCDate,
NCCDateRange,
NCCColorPicker,
NCCRate,
NCCSwitch,
NCCSlider,
NCCDivider,
NCCUploadFz,
NCCUploadImg,
NCCComRight,
NCCAddress,
TreeSelect,
GroupTitle,
RelationForm,
RelationFormAttr,
RelationFlow,
RelationFlowAttr,
NCCCalculate,
PopupSelect,
Tab,
Collapse
},
props: ['showField', 'activeData', 'formConf', 'modelType', 'webType', 'drawingList'],
data() {
return {
currentTab: 'field',
currentNode: null,
dialogVisible: false,
iconsVisible: false,
formScriptVisible: false,
comScriptVisible: false,
currentIconModel: null,
activeScript: '',
activeFunc: '',
isConf: false,
printTplList: [],
dictionaryOptions: [],
dataInterfaceOptions: [],
justifyOptions: [
{
label: 'start',
value: 'start'
},
{
label: 'end',
value: 'end'
},
{
label: 'center',
value: 'center'
},
{
label: 'space-around',
value: 'space-around'
},
{
label: 'space-between',
value: 'space-between'
}
],
generalWidthOptions: ['600px', '800px', '1000px', '40%', '50%', '60%', '70%', '80%'],
fullScreenWidthOptions: ['800px', '1000px', '1200px', '1400px', '50%', '60%', '70%', '80%', '90%', '100%'],
layoutTreeProps: {
label(data, node) {
const config = data.__config__
return data.componentName || `${config.label}: ${data.__vModel__}`
}
}
}
},
computed: {
activeTag() {
return this.activeData.__config__.tag
},
formItemList() {
return this.$store.state.generator.formItemList
},
subTable() {
return this.$store.state.generator.subTable || []
},
isCommon() {
return commonRightList.indexOf(this.activeData.__config__.nccKey) > -1
},
isSystem() {
return systemList.indexOf(this.activeData.__config__.nccKey) > -1
},
},
watch: {
formConf: {
handler(val) {
// saveFormConf(val)
if (val.formStyle === 'word-form' && val.labelPosition === 'top') {
val.labelPosition = 'left'
}
},
deep: true
},
activeData(val) {
if (val.__config__.nccKey === 'relationFormAttr') {
this.$nextTick(() => {
this.$refs.relationFormAttr && this.$refs.relationFormAttr.getOptions()
})
}
if (val.__config__.nccKey === 'relationFlowAttr') {
this.$nextTick(() => {
this.$refs.relationFlowAttr && this.$refs.relationFlowAttr.getOptions()
})
}
if (val.__config__.nccKey !== 'calculate') {
this.$nextTick(() => {
this.$refs.calculate && this.$refs.calculate.reloadExpressionTemp()
})
}
}
},
created() {
this.getDictionaryType()
this.getDataInterfaceSelector()
this.getPringTplList()
},
methods: {
addReg() {
this.activeData.__config__.regList.push({
pattern: '',
message: ''
})
},
setDefaultValue(val) {
if (Array.isArray(val)) {
return val.join(',')
}
// if (['string', 'number'].indexOf(typeof val) > -1) {
// return val
// }
if (typeof val === 'boolean') {
return `${val}`
}
return val
},
onDefaultValueInput(str) {
if (Array.isArray(this.activeData.__config__.defaultValue)) {
// 数组
this.$set(
this.activeData.__config__,
'defaultValue',
str.split(',').map(val => (isNumberStr(val) ? +val : val))
)
} else if (['true', 'false'].indexOf(str) > -1) {
// 布尔
this.$set(this.activeData.__config__, 'defaultValue', JSON.parse(str))
} else {
// 字符串和数字
this.$set(
this.activeData.__config__,
'defaultValue',
isNumberStr(str) ? +str : str
)
}
},
getSubTalebFiled(key) {
let item = {}
let list = this.subTable.filter(o => o.table === key)
if (list.length) {
item = list[0]
}
let arr = []
if (item && item.fields) arr = item.fields
return arr
},
fieldChange1(val) {
if (!val) return
const drawingList = getDrawingList() || []
let boo = false
const loop = list => {
for (let i = 0; i < list.length; i++) {
const e = list[i]
const config = e.__config__
if (config.nccKey === 'table' && config.tableName === this.activeData.__config__.relationTable) {
for (let j = 0; j < config.children.length; j++) {
const child = config.children[j]
if (child.__vModel__ === val) {
boo = true
break
}
}
}
if (config && config.nccKey != 'table' && config.children && Array.isArray(config.children)) {
loop(config.children)
}
}
}
loop(drawingList)
if (boo) {
this.$message.warning(`子表字段【${val}】已存在,请重新选择!`)
this.activeData.__vModel__ = ''
return
}
let options = this.getSubTalebFiled(this.activeData.__config__.relationTable)
let item = options.filter(o => o.field == val)[0]
if (!item || !item.fieldName) return
this.activeData.__config__.label = item.fieldName
},
fieldChange(val) {
if (!val) return
const drawingList = getDrawingList() || []
let boo = false
const loop = list => {
for (let i = 0; i < list.length; i++) {
const e = list[i]
const config = e.__config__
if (e.__vModel__ === val) {
boo = true
break
}
if (config && config.nccKey != 'table' && config.children && Array.isArray(config.children)) {
loop(config.children)
}
}
}
loop(drawingList)
if (boo) {
this.$message.warning(`字段【${val}】已存在,请重新选择!`)
this.activeData.__vModel__ = ''
return
}
let item = this.formItemList.filter(o => o.field == val)[0]
if (!item || !item.fieldName) return
this.activeData.__config__.label = item.fieldName
},
spanChange(val) {
this.formConf.span = val
},
onTableNameChange(tableName) {
if (!tableName) return
const drawingList = getDrawingList() || []
let boo = false
const loop = list => {
for (let i = 0; i < list.length; i++) {
const e = list[i]
const config = e.__config__
if (config.nccKey === 'table' && config.tableName === tableName) {
boo = true
break
}
if (config && config.nccKey != 'table' && config.children && Array.isArray(config.children)) {
loop(config.children)
}
}
}
loop(drawingList)
if (boo) {
this.$message.warning(`子表【${tableName}】已存在,请重新选择!`)
this.activeData.__config__.tableName = ''
return
}
for (let i = 0; i < this.activeData.__config__.children.length; i++) {
this.$set(this.activeData.__config__.children[i].__config__, 'relationTable', tableName)
this.$set(this.activeData.__config__.children[i], '__vModel__', '')
}
},
getDictionaryType() {
getDictionaryTypeSelector().then(res => {
this.dictionaryOptions = res.data.list
})
},
getDataInterfaceSelector() {
getDataInterfaceSelector().then(res => {
this.dataInterfaceOptions = res.data
})
},
getPringTplList() {
this.$store.dispatch('base/getPrintFormTree').then(res => {
let list = res.filter(o => o.children && o.children.length)
this.printTplList = list.map(o => ({
...o,
hasChildren: true
}))
})
},
getTipText(key) {
let text = ''
switch (key) {
case 'change':
text = '发生变化时触发'
break;
case 'blur':
text = '失去焦点时触发'
break;
case 'tab-click':
text = '面板点击时触发'
break;
default:
text = ''
break;
}
return text
},
updateScript(data) {
if (this.isConf) {
this.formConf.funcs[this.activeFunc] = data
} else {
this.activeData.on[this.activeFunc] = data
}
},
editFunc(str, funcName, isConf) {
this.activeScript = str
this.activeFunc = funcName
this.isConf = isConf || false
this.formScriptVisible = true
},
}
}
</script>
<style lang="scss" scoped>
.right-board {
width: 340px;
position: absolute;
right: 0;
top: 0;
padding-top: 3px;
height: 100%;
background: #fff;
border-radius: 4px;
.field-box {
position: relative;
height: calc(100% - 42px);
box-sizing: border-box;
overflow: hidden;
}
.el-scrollbar {
height: 100%;
}
}
.select-item {
display: flex;
border: 1px dashed #fff;
box-sizing: border-box;
& .close-btn {
cursor: pointer;
color: #f56c6c;
}
& .el-input + .el-input {
margin-left: 4px;
}
}
.select-item + .select-item {
margin-top: 4px;
}
.select-item.sortable-chosen {
border: 1px dashed #409eff;
}
.select-line-icon {
line-height: 32px;
font-size: 22px;
padding: 0 4px;
color: #777;
}
.option-drag {
cursor: move;
}
.time-range {
.el-date-editor {
width: 227px;
}
::v-deep .el-icon-time {
display: none;
}
}
.document-link {
position: absolute;
display: block;
width: 26px;
height: 26px;
top: 0;
left: 0;
cursor: pointer;
background: #409eff;
z-index: 1;
border-radius: 0 0 6px 0;
text-align: center;
line-height: 26px;
color: #fff;
font-size: 18px;
}
.node-label {
font-size: 14px;
}
.node-icon {
color: #bebfc3;
}
.right-scrollbar {
.el-form {
>>> .el-date-editor,
>>> .el-cascader,
>>> .el-select {
width: 100%;
}
}
}
.per-cell {
display: flex;
align-items: center;
margin-bottom: 18px;
.el-checkbox {
width: 146px;
}
&.last {
margin-bottom: 0;
}
}
</style>