tianheng-ui 0.0.46 → 0.0.49

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,5 +1,21 @@
1
1
  <template>
2
- <el-form-item :label="widget.name" :prop="widget.model">
2
+ <el-form-item
3
+ :class="widget.model"
4
+ :label="widget.options.hideLabel || hideLabel ? '' : widget.name"
5
+ :label-width="
6
+ widget.options.hideLabel
7
+ ? '0'
8
+ : widget.options.isLabelWidth
9
+ ? `${widget.options.labelWidth}px`
10
+ : ''
11
+ "
12
+ :prop="
13
+ tableInfo
14
+ ? `${tableInfo.data.model}.${tableInfo.index}.${widget.model}`
15
+ : widget.model
16
+ "
17
+ :rules="rules[widget.model]"
18
+ >
3
19
  <template v-if="widget.type == 'input'">
4
20
  <el-input
5
21
  v-if="
@@ -10,7 +26,7 @@
10
26
  type="number"
11
27
  v-model.number="dataModel"
12
28
  :placeholder="widget.options.placeholder"
13
- :style="{ width: widget.options.width }"
29
+ :style="{ width: width ? width : widget.options.width }"
14
30
  :disabled="widget.options.disabled"
15
31
  :readonly="widget.options.readonly"
16
32
  :clearable="widget.options.clearable"
@@ -24,7 +40,7 @@
24
40
  type="text"
25
41
  v-model="dataModel"
26
42
  :placeholder="widget.options.placeholder"
27
- :style="{ width: widget.options.width }"
43
+ :style="{ width: width ? width : widget.options.width }"
28
44
  :disabled="widget.options.disabled"
29
45
  :readonly="widget.options.readonly"
30
46
  :clearable="widget.options.clearable"
@@ -49,7 +65,7 @@
49
65
  v-model="dataModel"
50
66
  :disabled="widget.options.disabled"
51
67
  :placeholder="widget.options.placeholder"
52
- :style="{ width: widget.options.width }"
68
+ :style="{ width: width ? width : widget.options.width }"
53
69
  :maxlength="widget.options.maxlength"
54
70
  :clearable="widget.options.clearable"
55
71
  :show-word-limit="widget.options.showWordLimit"
@@ -63,7 +79,7 @@
63
79
  <template v-if="widget.type == 'number'">
64
80
  <el-input-number
65
81
  v-model="dataModel"
66
- :style="{ width: widget.options.width }"
82
+ :style="{ width: width ? width : widget.options.width }"
67
83
  :step="widget.options.step"
68
84
  :controls-position="widget.options.controlsPosition ? 'right' : ''"
69
85
  :disabled="widget.options.disabled"
@@ -76,7 +92,7 @@
76
92
  <template v-if="widget.type == 'radio'">
77
93
  <el-radio-group
78
94
  v-model="dataModel"
79
- :style="{ width: widget.options.width }"
95
+ :style="{ width: width ? width : widget.options.width }"
80
96
  :disabled="widget.options.disabled"
81
97
  >
82
98
  <template v-if="widget.options.buttonType">
@@ -121,7 +137,7 @@
121
137
  <template v-if="widget.type == 'checkbox'">
122
138
  <el-checkbox-group
123
139
  v-model="dataModel"
124
- :style="{ width: widget.options.width }"
140
+ :style="{ width: width ? width : widget.options.width }"
125
141
  :disabled="widget.options.disabled"
126
142
  :min="widget.options.min"
127
143
  :max="widget.options.max"
@@ -179,7 +195,7 @@
179
195
  :clearable="widget.options.clearable"
180
196
  :arrowControl="widget.options.arrowControl"
181
197
  :value-format="widget.options.format"
182
- :style="{ width: widget.options.width }"
198
+ :style="{ width: width ? width : widget.options.width }"
183
199
  >
184
200
  </el-time-picker>
185
201
  <template v-else>
@@ -195,7 +211,7 @@
195
211
  :editable="widget.options.editable"
196
212
  :clearable="widget.options.clearable"
197
213
  :arrowControl="widget.options.arrowControl"
198
- :style="{ width: widget.options.width }"
214
+ :style="{ width: width ? width : widget.options.width }"
199
215
  :picker-options="widget.options.stretTimePickerOptions"
200
216
  @change="e => handleTimePicker(e)"
201
217
  >
@@ -209,7 +225,7 @@
209
225
  :editable="widget.options.editable"
210
226
  :clearable="widget.options.clearable"
211
227
  :arrowControl="widget.options.arrowControl"
212
- :style="{ width: widget.options.width }"
228
+ :style="{ width: width ? width : widget.options.width }"
213
229
  :picker-options="widget.options.endTimePickerOptions"
214
230
  >
215
231
  </el-time-select>
@@ -228,7 +244,7 @@
228
244
  :disabled="widget.options.disabled"
229
245
  :editable="widget.options.editable"
230
246
  :clearable="widget.options.clearable"
231
- :style="{ width: widget.options.width }"
247
+ :style="{ width: width ? width : widget.options.width }"
232
248
  >
233
249
  </el-date-picker>
234
250
  </template>
@@ -264,7 +280,7 @@
264
280
  :filterable="
265
281
  widget.options.allowCreate ? true : widget.options.filterable
266
282
  "
267
- :style="{ width: widget.options.width }"
283
+ :style="{ width: width ? width : widget.options.width }"
268
284
  >
269
285
  <el-option
270
286
  v-for="item in widget.options.remote
@@ -302,7 +318,10 @@
302
318
  :step="widget.options.step"
303
319
  :show-input="widget.options.showInput"
304
320
  :range="widget.options.range"
305
- :style="{ width: widget.options.width, height: widget.options.height }"
321
+ :style="{
322
+ width: width ? width : widget.options.width,
323
+ height: widget.options.height
324
+ }"
306
325
  :show-tooltip="widget.options.showTooltip"
307
326
  :format-tooltip="
308
327
  val => formatTooltip(val, widget.options.formatTooltip)
@@ -316,7 +335,7 @@
316
335
  <!-- <fm-upload
317
336
  v-model="dataModel"
318
337
  :disabled="widget.options.disabled"
319
- :style="{ width: widget.options.width }"
338
+ :style="{ width: width ? width : widget.options.width }"
320
339
  :width="widget.options.size.width"
321
340
  :height="widget.options.size.height"
322
341
  :token="widget.options.token"
@@ -381,7 +400,7 @@
381
400
  <template v-if="widget.type == 'editor'">
382
401
  <vue-editor
383
402
  v-model="dataModel"
384
- :style="{ width: widget.options.width }"
403
+ :style="{ width: width ? width : widget.options.width }"
385
404
  :disabled="widget.options.disabled"
386
405
  >
387
406
  </vue-editor>
@@ -393,7 +412,10 @@
393
412
  :disabled="widget.options.disabled"
394
413
  :clearable="widget.options.clearable"
395
414
  :placeholder="widget.options.placeholder"
396
- :style="{ width: widget.options.width, height: widget.options.height }"
415
+ :style="{
416
+ width: width ? width : widget.options.width,
417
+ height: widget.options.height
418
+ }"
397
419
  :options="widget.options.remoteOptions"
398
420
  :props="widget.options.props"
399
421
  :show-all-levels="widget.options.showAllLevels ? false : true"
@@ -411,6 +433,150 @@
411
433
  <template v-if="widget.type == 'text'">
412
434
  <span>{{ dataModel }}</span>
413
435
  </template>
436
+
437
+ <template v-if="widget.type == 'blank'">
438
+ <slot :name="widget.model" />
439
+ </template>
440
+
441
+ <template v-if="widget.type == 'table'">
442
+ <el-table
443
+ v-if="!widget.options.hidden"
444
+ :data="dataModel"
445
+ style="width: 100%"
446
+ border
447
+ >
448
+ <el-table-column
449
+ v-if="widget.options.isSerial"
450
+ label="序号"
451
+ type="index"
452
+ width="50"
453
+ align="center"
454
+ >
455
+ </el-table-column>
456
+ <el-table-column
457
+ v-for="column in widget.list"
458
+ :key="column.key"
459
+ :label="column.name"
460
+ :prop="column.model"
461
+ :width="column.options.width"
462
+ >
463
+ <template slot-scope="scope">
464
+ <genetate-form-item
465
+ :models.sync="dataModel[scope.$index]"
466
+ :widget="column"
467
+ :remote="remote"
468
+ :rules="rules"
469
+ :hideLabel="true"
470
+ :tableInfo="{ index: scope.$index, data: widget }"
471
+ width="100%"
472
+ :slotKeys="slotKeys"
473
+ >
474
+ <template v-for="name in slotKeys" :slot="name">
475
+ <slot :name="name" />
476
+ </template>
477
+ </genetate-form-item>
478
+ </template>
479
+ </el-table-column>
480
+ <el-table-column
481
+ v-if="widget.options.isDelete"
482
+ fixed="right"
483
+ label="操作"
484
+ width="60"
485
+ align="center"
486
+ >
487
+ <template slot-scope="scope">
488
+ <el-button
489
+ style="color:#F56C6C"
490
+ type="text"
491
+ size="small"
492
+ @click.native.prevent="handleTableDelete(scope.$index)"
493
+ >
494
+ 移除
495
+ </el-button>
496
+ </template>
497
+ </el-table-column>
498
+ <template v-if="widget.options.isAdd" slot="append">
499
+ <div
500
+ style="text-align: center;"
501
+ :style="{
502
+ borderTop:
503
+ dataModel && dataModel.length != 0 ? '' : '1px solid #EBEEF5'
504
+ }"
505
+ >
506
+ <el-button
507
+ type="text"
508
+ :disabled="widget.options.disabled"
509
+ @click="handleTableAdd"
510
+ >新增</el-button
511
+ >
512
+ </div>
513
+ </template>
514
+ </el-table>
515
+ </template>
516
+
517
+ <template v-if="widget.type == 'grid'">
518
+ <el-row
519
+ type="flex"
520
+ :gutter="widget.options.gutter ? widget.options.gutter : 0"
521
+ :justify="widget.options.justify"
522
+ :align="widget.options.align"
523
+ >
524
+ <el-col
525
+ v-for="(col, colIndex) in widget.columns"
526
+ :key="colIndex"
527
+ :span="col.span"
528
+ >
529
+ <genetate-form-item
530
+ v-for="el in col.list"
531
+ :key="el.key"
532
+ :models="models"
533
+ :rules="rules"
534
+ :remote="remote"
535
+ :slotKeys="slotKeys"
536
+ :widget="el"
537
+ >
538
+ <template v-for="name in slotKeys" :slot="name">
539
+ <slot :name="name" />
540
+ </template>
541
+ </genetate-form-item>
542
+ </el-col>
543
+ </el-row>
544
+ </template>
545
+
546
+ <template v-if="widget.type == 'tabs'">
547
+ <el-tabs v-model="widget.options.defaultValue">
548
+ <el-tab-pane
549
+ v-for="tabItem in widget.tabs"
550
+ :key="tabItem.value"
551
+ :label="tabItem.label"
552
+ :name="tabItem.value"
553
+ >
554
+ <genetate-form-item
555
+ v-for="el in tabItem.list"
556
+ :key="el.key"
557
+ :models="dataModel[tabItem.value]"
558
+ :rules="rules"
559
+ :remote="remote"
560
+ :slotKeys="slotKeys"
561
+ :widget="el"
562
+ >
563
+ <template v-for="name in slotKeys" :slot="name">
564
+ <slot :name="name" />
565
+ </template>
566
+ </genetate-form-item>
567
+ </el-tab-pane>
568
+ </el-tabs>
569
+ </template>
570
+
571
+ <template v-if="widget.type == 'divider'">
572
+ <el-divider
573
+ :content-position="widget.options.contentPosition"
574
+ :style="{ height: `${widget.options.height}px` }"
575
+ >
576
+ {{ widget.name }}
577
+ </el-divider>
578
+ </template>
579
+
414
580
  <el-dialog :visible.sync="dialogVisible" append-to-body>
415
581
  <img width="100%" :src="dialogImageUrl" alt="" />
416
582
  </el-dialog>
@@ -421,7 +587,17 @@
421
587
  import FmUpload from "./Upload";
422
588
  import { VueEditor } from "vue2-editor";
423
589
  export default {
424
- props: ["widget", "models", "rules", "remote"],
590
+ name: "genetate-form-item",
591
+ props: [
592
+ "widget",
593
+ "models",
594
+ "rules",
595
+ "remote",
596
+ "hideLabel",
597
+ "width",
598
+ "tableInfo",
599
+ "slotKeys"
600
+ ],
425
601
  components: {
426
602
  FmUpload,
427
603
  VueEditor
@@ -491,6 +667,16 @@ export default {
491
667
  },
492
668
  handleAvatarError() {
493
669
  console.log("上传失败!");
670
+ },
671
+ handleTableAdd() {
672
+ let dic = {};
673
+ this.widget.list.forEach(item => {
674
+ dic[item.model] = item.options.defaultValue;
675
+ });
676
+ this.dataModel.push(dic);
677
+ },
678
+ handleTableDelete(index) {
679
+ this.dataModel.splice(index, 1);
494
680
  }
495
681
  },
496
682
  watch: {
@@ -16,6 +16,21 @@
16
16
  <el-input v-model="data.options.width"></el-input>
17
17
  </el-form-item>
18
18
 
19
+ <el-form-item
20
+ label="标签宽度"
21
+ v-if="Object.keys(data.options).indexOf('labelWidth') >= 0"
22
+ >
23
+ <div style="display: flex;">
24
+ <el-checkbox v-model="data.options.isLabelWidth">自定义</el-checkbox>
25
+ <el-input-number
26
+ v-model="data.options.labelWidth"
27
+ :min="0"
28
+ :max="200"
29
+ :disabled="!data.options.isLabelWidth"
30
+ ></el-input-number>
31
+ </div>
32
+ </el-form-item>
33
+
19
34
  <el-form-item
20
35
  label="高度"
21
36
  v-if="Object.keys(data.options).indexOf('height') >= 0"
@@ -54,6 +69,17 @@
54
69
  ></el-input>
55
70
  </el-form-item>
56
71
 
72
+ <el-form-item
73
+ label="对齐方式"
74
+ v-if="Object.keys(data.options).indexOf('contentPosition') >= 0"
75
+ >
76
+ <el-radio-group v-model="data.options.contentPosition">
77
+ <el-radio-button label="left">左对齐</el-radio-button>
78
+ <el-radio-button label="center">居中对齐</el-radio-button>
79
+ <el-radio-button label="right">右对齐</el-radio-button>
80
+ </el-radio-group>
81
+ </el-form-item>
82
+
57
83
  <el-form-item label="文件列表样式" v-if="data.type == 'imgupload'">
58
84
  <el-select
59
85
  v-model="data.options.listType"
@@ -163,7 +189,7 @@
163
189
  >
164
190
  <el-radio-group v-model="data.options.controlsPosition">
165
191
  <el-radio-button :label="false">两边</el-radio-button>
166
- <el-radio-button :label="true">right</el-radio-button>
192
+ <el-radio-button :label="true">右边</el-radio-button>
167
193
  </el-radio-group>
168
194
  </el-form-item>
169
195
 
@@ -449,12 +475,15 @@
449
475
  label="默认值"
450
476
  v-if="
451
477
  Object.keys(data.options).indexOf('defaultValue') >= 0 &&
452
- (data.type == 'textarea' ||
453
- data.type == 'input' ||
454
- data.type == 'rate' ||
455
- data.type == 'color' ||
456
- data.type == 'switch' ||
457
- data.type == 'text')
478
+ [
479
+ 'textarea',
480
+ 'input',
481
+ 'rate',
482
+ 'color',
483
+ 'switch',
484
+ 'text',
485
+ 'select'
486
+ ].includes(data.type)
458
487
  "
459
488
  >
460
489
  <el-input
@@ -464,23 +493,24 @@
464
493
  v-model="data.options.defaultValue"
465
494
  ></el-input>
466
495
  <el-input
467
- v-if="data.type == 'input'"
496
+ v-if="data.type == 'input' || data.type == 'select'"
468
497
  v-model="data.options.defaultValue"
469
498
  ></el-input>
470
- <el-rate
471
- v-if="data.type == 'rate'"
472
- style="display:inline-block;vertical-align: middle;"
473
- :max="data.options.max"
474
- :allow-half="data.options.allowHalf"
475
- v-model="data.options.defaultValue"
476
- ></el-rate>
477
- <el-button
478
- type="text"
479
- v-if="data.type == 'rate'"
480
- style="display:inline-block;vertical-align: middle;margin-left: 10px;"
481
- @click="data.options.defaultValue = 0"
482
- >清空</el-button
483
- >
499
+ <template v-if="data.type == 'rate'">
500
+ <el-rate
501
+ style="display:inline-block;vertical-align: middle;"
502
+ :max="data.options.max"
503
+ :allow-half="data.options.allowHalf"
504
+ v-model="data.options.defaultValue"
505
+ ></el-rate>
506
+ <el-button
507
+ type="text"
508
+ style="display:inline-block;vertical-align: middle;margin-left: 10px;"
509
+ @click="data.options.defaultValue = 0"
510
+ >清空</el-button
511
+ >
512
+ </template>
513
+
484
514
  <el-color-picker
485
515
  v-if="data.type == 'color'"
486
516
  v-model="data.options.defaultValue"
@@ -794,7 +824,7 @@
794
824
  </template>
795
825
 
796
826
  <template v-else>
797
- <el-form-item label="图片上传" :required="true">
827
+ <el-form-item label="文件上传" :required="true">
798
828
  <el-select
799
829
  class="remoteApis"
800
830
  v-model="data.options.remoteFunc"
@@ -879,7 +909,7 @@
879
909
  </li>
880
910
  </draggable>
881
911
  <div style="margin-left: 22px;">
882
- <el-button type="text" @click="handleAddColumn">添加列</el-button>
912
+ <el-button type="text" @click="handleAddOption">添加列</el-button>
883
913
  </div>
884
914
  </el-form-item>
885
915
 
@@ -902,6 +932,121 @@
902
932
  </el-form-item>
903
933
  </template>
904
934
 
935
+ <template v-if="data.type == 'tabs'">
936
+ <el-form-item label="标签对齐方式">
937
+ <el-radio-group v-model="data.options.type" size="mini">
938
+ <el-radio-button label="">默认</el-radio-button>
939
+ <el-radio-button label="card">选项卡</el-radio-button>
940
+ <el-radio-button label="border-card">卡片化</el-radio-button>
941
+ </el-radio-group>
942
+ </el-form-item>
943
+ <el-form-item label="选项卡位置">
944
+ <el-radio-group v-model="data.options.tabPosition" size="mini">
945
+ <el-radio-button label="top">顶部</el-radio-button>
946
+ <el-radio-button label="right">右侧</el-radio-button>
947
+ <el-radio-button label="bottom">底部</el-radio-button>
948
+ <el-radio-button label="left">左侧</el-radio-button>
949
+ </el-radio-group>
950
+ </el-form-item>
951
+ <el-form-item label="选项">
952
+ <el-radio-group
953
+ v-model="data.options.remote"
954
+ size="mini"
955
+ style="margin-bottom:10px;"
956
+ >
957
+ <el-radio-button :label="false">静态数据</el-radio-button>
958
+ <el-radio-button :label="true">远端数据</el-radio-button>
959
+ </el-radio-group>
960
+ <div v-if="data.options.remote">
961
+ <el-select
962
+ class="remoteApis"
963
+ size="mini"
964
+ v-model="data.options.remoteFunc"
965
+ placeholder="请选择远端方法"
966
+ >
967
+ <template slot="prefix">
968
+ <div style="width:70px;">接口名</div>
969
+ </template>
970
+ <el-option-group
971
+ v-for="group in remoteApis"
972
+ :key="group.label"
973
+ :label="group.label"
974
+ >
975
+ <el-option
976
+ v-for="item in group.options"
977
+ :key="item.value"
978
+ :label="item.label"
979
+ :value="item.value"
980
+ >
981
+ </el-option>
982
+ </el-option-group>
983
+ </el-select>
984
+
985
+ <el-input size="mini" style="" v-model="data.options.props.value">
986
+ <template slot="prepend">
987
+ <div style="width:30px;">值</div>
988
+ </template>
989
+ </el-input>
990
+ <el-input size="mini" style="" v-model="data.options.props.label">
991
+ <template slot="prepend">
992
+ <div style="width:30px;">标签</div>
993
+ </template>
994
+ </el-input>
995
+ </div>
996
+ <template v-else>
997
+ <el-radio-group v-model="data.options.defaultValue">
998
+ <draggable
999
+ tag="ul"
1000
+ :list="data.tabs"
1001
+ v-bind="{
1002
+ group: { name: 'tabs' },
1003
+ ghostClass: 'ghost',
1004
+ handle: '.drag-item'
1005
+ }"
1006
+ handle=".drag-item"
1007
+ >
1008
+ <li v-for="(item, index) in data.tabs" :key="index">
1009
+ <el-radio :label="item.value" style="margin-right: 5px;">
1010
+ <el-input
1011
+ v-model="item.value"
1012
+ style="width:90px;"
1013
+ size="mini"
1014
+ placeholder="value"
1015
+ ></el-input>
1016
+ <el-input
1017
+ v-model="item.label"
1018
+ style="width:90px;"
1019
+ size="mini"
1020
+ placeholder="label"
1021
+ ></el-input>
1022
+ </el-radio>
1023
+ <i
1024
+ class="drag-item"
1025
+ style="font-size: 16px;margin: 0 5px;cursor: move;"
1026
+ ><i class="iconfont icon-icon_bars"></i
1027
+ ></i>
1028
+ <el-button
1029
+ @click="handleOptionsRemove(index)"
1030
+ circle
1031
+ plain
1032
+ type="danger"
1033
+ size="mini"
1034
+ icon="el-icon-minus"
1035
+ style="padding: 4px;margin-left: 5px;"
1036
+ ></el-button>
1037
+ </li>
1038
+ </draggable>
1039
+ </el-radio-group>
1040
+
1041
+ <div style="margin-left: 22px;">
1042
+ <el-button type="text" @click="handleAddOption"
1043
+ >添加选项</el-button
1044
+ >
1045
+ </div>
1046
+ </template>
1047
+ </el-form-item>
1048
+ </template>
1049
+
905
1050
  <template v-if="data.type != 'grid'">
906
1051
  <el-form-item label="带入icon" v-if="data.type == 'input'">
907
1052
  <el-input
@@ -1045,6 +1190,16 @@
1045
1190
  v-if="Object.keys(data.options).indexOf('readonly') >= 0"
1046
1191
  >完全只读</el-checkbox
1047
1192
  >
1193
+ <el-checkbox
1194
+ v-model="data.options.hidden"
1195
+ v-if="Object.keys(data.options).indexOf('hidden') >= 0"
1196
+ >隐藏
1197
+ </el-checkbox>
1198
+ <el-checkbox
1199
+ v-model="data.options.hideLabel"
1200
+ v-if="Object.keys(data.options).indexOf('hideLabel') >= 0"
1201
+ >隐藏标签
1202
+ </el-checkbox>
1048
1203
  <el-checkbox
1049
1204
  v-model="data.options.disabled"
1050
1205
  v-if="Object.keys(data.options).indexOf('disabled') >= 0"
@@ -1065,16 +1220,26 @@
1065
1220
  v-if="Object.keys(data.options).indexOf('arrowControl') >= 0"
1066
1221
  >使用箭头进行时间选择</el-checkbox
1067
1222
  >
1223
+ <el-checkbox
1224
+ v-model="data.options.isAdd"
1225
+ v-if="Object.keys(data.options).indexOf('isAdd') >= 0"
1226
+ >可新增</el-checkbox
1227
+ >
1068
1228
  <el-checkbox
1069
1229
  v-model="data.options.isDelete"
1070
1230
  v-if="Object.keys(data.options).indexOf('isDelete') >= 0"
1071
- >删除</el-checkbox
1231
+ >可删除</el-checkbox
1072
1232
  >
1073
1233
  <el-checkbox
1074
1234
  v-model="data.options.isEdit"
1075
1235
  v-if="Object.keys(data.options).indexOf('isEdit') >= 0"
1076
1236
  >编辑</el-checkbox
1077
1237
  >
1238
+ <el-checkbox
1239
+ v-model="data.options.isSerial"
1240
+ v-if="Object.keys(data.options).indexOf('isSerial') >= 0"
1241
+ >显示序号</el-checkbox
1242
+ >
1078
1243
  <el-checkbox
1079
1244
  v-model="data.options.border"
1080
1245
  v-if="Object.keys(data.options).indexOf('border') >= 0"
@@ -1201,30 +1366,43 @@ export default {
1201
1366
  this.data.columns.splice(index, 1);
1202
1367
  } else if (this.data.type === "rate") {
1203
1368
  this.data.options.auxiliaryValue.splice(index, 1);
1369
+ } else if (this.data.type === "tabs") {
1370
+ this.data.tabs.splice(index, 1);
1204
1371
  } else {
1205
1372
  this.data.options.options.splice(index, 1);
1206
1373
  }
1207
1374
  },
1208
1375
  handleAddOption() {
1376
+ if (this.data.type === "grid") {
1377
+ this.data.columns.push({
1378
+ span: "",
1379
+ list: []
1380
+ });
1381
+ return;
1382
+ }
1383
+ if (this.data.type === "tabs") {
1384
+ this.data.tabs.push({
1385
+ label: `选项${this.data.tabs.length + 1}`,
1386
+ value: `tab_${this.data.tabs.length + 1}`,
1387
+ list: []
1388
+ });
1389
+ return;
1390
+ }
1209
1391
  if (this.data.type === "rate") {
1210
1392
  this.data.options.auxiliaryValue.push("新选项");
1211
1393
  return;
1212
1394
  }
1395
+
1213
1396
  if (this.data.options.showLabel) {
1214
1397
  this.data.options.options.push({
1215
1398
  value: "新选项",
1216
1399
  label: "新选项"
1217
1400
  });
1218
- } else {
1219
- this.data.options.options.push({
1220
- value: "新选项"
1221
- });
1401
+ return;
1222
1402
  }
1223
- },
1224
- handleAddColumn() {
1225
- this.data.columns.push({
1226
- span: "",
1227
- list: []
1403
+
1404
+ this.data.options.options.push({
1405
+ value: "新选项"
1228
1406
  });
1229
1407
  },
1230
1408
  generateRule() {