tianheng-ui 0.1.37 → 0.1.39

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,5 @@
1
1
  <template>
2
- <div class="widgetTools">
2
+ <div class="widgetTools th-sticky_top">
3
3
  <div class="left">
4
4
  <slot> </slot>
5
5
  </div>
@@ -215,6 +215,7 @@
215
215
  title="获取数据"
216
216
  :modal-append-to-body="false"
217
217
  :showFooter="false"
218
+ :z-index="99999"
218
219
  @on-close="dialogResultData.show = false"
219
220
  @on-fullscreen="$refs.dataCodeEditor.resize()"
220
221
  >
@@ -505,7 +506,7 @@ export default {
505
506
  width: 100%;
506
507
  height: 45px;
507
508
  padding: 0 15px;
508
- border-bottom: solid 2px #e4e7ed;
509
+ z-index: 999;
509
510
 
510
511
  .left {
511
512
  }
@@ -1,181 +1,150 @@
1
1
  <template>
2
- <div class="formMaking">
3
- <el-container
4
- v-if="Object.keys(formConfig.config).length"
5
- class="container-box"
2
+ <div class="th-formMaking th-flex_box">
3
+ <!-- 左侧字段区 -->
4
+ <div
5
+ class="formMaking-fields th-flex_aside th-is_border_right"
6
+ style="width:250px"
6
7
  >
7
- <el-main>
8
- <el-container>
9
- <!-- 左侧字段区 -->
10
- <el-aside width="250px">
11
- <div class="components-list">
12
- <div v-if="basicFields.length">
13
- <div class="widget-cate">基础字段</div>
14
- <draggable
15
- tag="ul"
16
- :list="getBasicComponents"
17
- v-bind="{
18
- group: { name: 'people', pull: 'clone', put: false },
19
- sort: false,
20
- ghostClass: 'ghost'
21
- }"
22
- >
23
- <li
24
- v-for="(item, index) in getBasicComponents"
25
- class="form-edit-widget-label"
26
- :class="{
27
- 'no-put': item.type == 'divider',
28
- [item.type]: true
29
- }"
30
- :key="index"
31
- >
32
- <a>
33
- <i class="icon iconfont" :class="item.icon"></i>
34
- <span>{{ item.name }}</span>
35
- </a>
36
- </li>
37
- </draggable>
38
- </div>
39
-
40
- <div v-if="advanceFields.length">
41
- <div class="widget-cate">高级字段</div>
42
- <draggable
43
- tag="ul"
44
- :list="getAdvanceComponents"
45
- v-bind="{
46
- group: { name: 'people', pull: 'clone', put: false },
47
- sort: false,
48
- ghostClass: 'ghost'
49
- }"
50
- >
51
- <li
52
- v-for="(item, index) in getAdvanceComponents"
53
- class="form-edit-widget-label"
54
- :class="{
55
- 'no-put': ['table', 'tableH5', 'tabs'].includes(
56
- item.type
57
- ),
58
- [item.type]: true
59
- }"
60
- :key="index"
61
- >
62
- <a>
63
- <i class="icon iconfont" :class="item.icon"></i>
64
- <span>{{ item.name }}</span>
65
- </a>
66
- </li>
67
- </draggable>
68
- </div>
69
-
70
- <div v-if="layoutFields.length">
71
- <div class="widget-cate">布局字段</div>
72
- <draggable
73
- tag="ul"
74
- :list="getLayoutComponents"
75
- v-bind="{
76
- group: { name: 'people', pull: 'clone', put: false },
77
- sort: false,
78
- ghostClass: 'ghost'
79
- }"
80
- >
81
- <li
82
- v-for="(item, index) in getLayoutComponents"
83
- class="form-edit-widget-label"
84
- :class="{
85
- 'no-put': ['alliance'].includes(item.type),
86
- [item.type]: true
87
- }"
88
- :key="index"
89
- >
90
- <a>
91
- <i class="icon iconfont" :class="item.icon"></i>
92
- <span>{{ item.name }}</span>
93
- </a>
94
- </li>
95
- </draggable>
96
- </div>
97
- </div>
98
- </el-aside>
99
-
100
- <!-- 中间视图区 -->
101
- <el-container class="center-container" direction="vertical">
102
- <!-- 操作区 -->
103
- <widget-tools
104
- :baseConfig="baseConfig"
105
- :permissions="permissions"
106
- :client.sync="client"
107
- :basicComponents="basicComponents"
108
- :layoutComponents="layoutComponents"
109
- :formData="formConfig"
110
- :formValue="widgetValue"
111
- :oauthConfig="oauthConfig"
112
- :apiOptions="apiOptions"
113
- @click="handleWidgetToolsChange"
8
+ <div class="fields-header th-sticky_top">组件列表</div>
9
+ <el-collapse v-model="collapseValue">
10
+ <el-collapse-item
11
+ v-if="basicFields.length"
12
+ title="基础组件"
13
+ name="group-basic"
14
+ >
15
+ <draggable
16
+ tag="ul"
17
+ :list="getBasicComponents"
18
+ v-bind="{
19
+ group: { name: 'people', pull: 'clone', put: false },
20
+ sort: false,
21
+ ghostClass: 'ghost'
22
+ }"
23
+ >
24
+ <li
25
+ v-for="(item, index) in getBasicComponents"
26
+ class="fields-label"
27
+ :class="{
28
+ 'no-put': item.type == 'divider',
29
+ [item.type]: true
30
+ }"
31
+ :key="index"
32
+ >
33
+ <a>
34
+ <i class="icon iconfont" :class="item.icon"></i>
35
+ <span>{{ item.name }}</span>
36
+ </a>
37
+ </li>
38
+ </draggable>
39
+ </el-collapse-item>
40
+ <el-collapse-item
41
+ v-if="advanceFields.length"
42
+ title="高级组件"
43
+ name="group-advance"
44
+ >
45
+ <draggable
46
+ tag="ul"
47
+ :list="getAdvanceComponents"
48
+ v-bind="{
49
+ group: { name: 'people', pull: 'clone', put: false },
50
+ sort: false,
51
+ ghostClass: 'ghost'
52
+ }"
53
+ >
54
+ <li
55
+ v-for="(item, index) in getAdvanceComponents"
56
+ class="fields-label"
57
+ :class="{
58
+ 'no-put': ['table', 'tableH5', 'tabs'].includes(item.type),
59
+ [item.type]: true
60
+ }"
61
+ :key="index"
114
62
  >
115
- <slot name="action"></slot>
116
- </widget-tools>
63
+ <a>
64
+ <i class="icon iconfont" :class="item.icon"></i>
65
+ <span>{{ item.name }}</span>
66
+ </a>
67
+ </li>
68
+ </draggable>
69
+ </el-collapse-item>
70
+ <el-collapse-item
71
+ v-if="layoutFields.length"
72
+ title="布局组件"
73
+ name="group-layout"
74
+ >
75
+ <draggable
76
+ tag="ul"
77
+ :list="getLayoutComponents"
78
+ v-bind="{
79
+ group: { name: 'people', pull: 'clone', put: false },
80
+ sort: false,
81
+ ghostClass: 'ghost'
82
+ }"
83
+ >
84
+ <li
85
+ v-for="(item, index) in getLayoutComponents"
86
+ class="fields-label"
87
+ :class="{
88
+ 'no-put': ['alliance'].includes(item.type),
89
+ [item.type]: true
90
+ }"
91
+ :key="index"
92
+ >
93
+ <a>
94
+ <i class="icon iconfont" :class="item.icon"></i>
95
+ <span>{{ item.name }}</span>
96
+ </a>
97
+ </li>
98
+ </draggable>
99
+ </el-collapse-item>
100
+ </el-collapse>
101
+ </div>
102
+
103
+ <!-- 中间视图区 -->
104
+ <div class="formMaking-drawing th-fiex_content">
105
+ <!-- 操作区 -->
106
+ <widget-tools
107
+ :baseConfig="baseConfig"
108
+ :permissions="permissions"
109
+ :basicComponents="basicComponents"
110
+ :layoutComponents="layoutComponents"
111
+ :formData="formConfig"
112
+ :formValue="widgetValue"
113
+ :oauthConfig="oauthConfig"
114
+ :apiOptions="apiOptions"
115
+ @click="handleWidgetToolsChange"
116
+ >
117
+ <slot name="action"></slot>
118
+ </widget-tools>
117
119
 
118
- <!-- 工作区 -->
119
- <el-main>
120
- <widget-form
121
- ref="widgetForm"
122
- :data="formConfig"
123
- :select.sync="widgetFormSelect"
124
- :client="client"
125
- >
126
- </widget-form>
127
- </el-main>
128
- </el-container>
120
+ <!-- 工作区 -->
121
+ <widget-form
122
+ :data="formConfig"
123
+ :select.sync="widgetFormSelect"
124
+ ref="widgetForm"
125
+ >
126
+ </widget-form>
127
+ </div>
129
128
 
130
- <!-- 右侧配置区 -->
131
- <el-aside class="config-container">
132
- <el-container>
133
- <el-header height="45px">
134
- <div
135
- class="config-tab"
136
- :class="{ active: configTab == 'widget' }"
137
- @click="handleConfigSelect('widget')"
138
- >
139
- 字段属性
140
- </div>
141
- <div
142
- class="config-tab"
143
- :class="{ active: configTab == 'form' }"
144
- @click="handleConfigSelect('form')"
145
- >
146
- 表单属性
147
- </div>
148
- </el-header>
149
- <el-main class="config-container-content">
150
- <widget-config
151
- v-if="configTab == 'widget'"
152
- :data="widgetFormSelect"
153
- :config="formConfig.config"
154
- :fields="fields"
155
- :apiConfig="apiConfig"
156
- @update="handleWidgetConfigUpdate"
157
- >
158
- </widget-config>
159
- <form-config
160
- v-if="configTab == 'form'"
161
- :config="formConfig.config"
162
- :apiConfig="apiConfig"
163
- @fieldsChange="handleFieldsChange"
164
- ref="formConfigRef"
165
- ></form-config>
166
- </el-main>
167
- </el-container>
168
- </el-aside>
169
- </el-container>
170
- </el-main>
171
- </el-container>
129
+ <!-- 右侧配置区 -->
130
+ <div class="th-flex_aside th-is_border_left" style="width:300px">
131
+ <widget-config
132
+ :data="widgetFormSelect"
133
+ :config="formConfig.config"
134
+ :fields="fields"
135
+ :apiConfig="apiConfig"
136
+ ref="configRef"
137
+ @fieldsChange="handleFieldsChange"
138
+ @update="handleWidgetConfigUpdate"
139
+ >
140
+ </widget-config>
141
+ </div>
172
142
  </div>
173
143
  </template>
174
144
 
175
145
  <script>
176
146
  import Draggable from "vuedraggable";
177
147
  import WidgetConfig from "./WidgetConfig";
178
- import FormConfig from "./FormConfig";
179
148
  import WidgetTools from "./WidgetTools";
180
149
  import WidgetForm from "./WidgetForm";
181
150
  import GenerateForm from "./GenerateForm";
@@ -193,7 +162,6 @@ export default {
193
162
  components: {
194
163
  Draggable,
195
164
  WidgetConfig,
196
- FormConfig,
197
165
  WidgetTools,
198
166
  WidgetForm,
199
167
  GenerateForm
@@ -261,9 +229,9 @@ export default {
261
229
  widgetFormSelect: {},
262
230
  widgetValue: {},
263
231
  configTab: "form",
264
- client: "monitor",
265
232
  fields: [],
266
- apiConfig: {}
233
+ apiConfig: {},
234
+ collapseValue: ["group-basic", "group-advance", "group-layout"]
267
235
  };
268
236
  },
269
237
  computed: {
@@ -358,12 +326,6 @@ export default {
358
326
  },
359
327
  handleWidgetToolsChange(val, data) {
360
328
  switch (val) {
361
- case "mobile":
362
- this.client = val;
363
- break;
364
- case "monitor":
365
- this.client = val;
366
- break;
367
329
  case "import-excel":
368
330
  case "import-json":
369
331
  case "import-template":
@@ -372,7 +334,6 @@ export default {
372
334
  case "clear":
373
335
  this.handleClear();
374
336
  break;
375
-
376
337
  default:
377
338
  break;
378
339
  }
@@ -398,9 +359,10 @@ export default {
398
359
  this.handleClear();
399
360
  },
400
361
  getConfig() {
401
- if (this.$refs.formConfigRef) {
402
- return new Promise((resolve, reject) =>
403
- this.$refs.formConfigRef.formValidate().then(res => {
362
+ return new Promise((resolve, reject) =>
363
+ this.$refs.configRef
364
+ .formValidate()
365
+ .then(res => {
404
366
  if (res) {
405
367
  const data = deepClone(this.formConfig);
406
368
  data.config.network = this.apiConfig;
@@ -409,29 +371,27 @@ export default {
409
371
  reject();
410
372
  }
411
373
  })
412
- );
413
- } else {
414
- return new Promise((resolve, reject) => {
415
- if (!this.formConfig.config.fieldsType) {
416
- this.$message.warning("请选择字段类型");
417
- return reject();
418
- }
419
- if (
420
- this.formConfig.config.fieldsType === "fieldsApi" &&
421
- !this.formConfig.config.fieldsApi
422
- ) {
423
- this.$message.warning("请选择字段接口");
424
- return reject();
425
- }
426
- if (!this.formConfig.config.title) {
427
- this.$message.warning("请填写表单标题");
428
- return reject();
429
- }
430
- const data = deepClone(this.formConfig);
431
- data.config.network = this.apiConfig;
432
- resolve(data);
433
- });
434
- }
374
+ .catch(err => {
375
+ if (!this.formConfig.config.fieldsType) {
376
+ this.$message.warning("请选择字段类型");
377
+ return reject();
378
+ }
379
+ if (
380
+ this.formConfig.config.fieldsType === "fieldsApi" &&
381
+ !this.formConfig.config.fieldsApi
382
+ ) {
383
+ this.$message.warning("请选择字段接口");
384
+ return reject();
385
+ }
386
+ if (!this.formConfig.config.title) {
387
+ this.$message.warning("请填写表单标题");
388
+ return reject();
389
+ }
390
+ const data = deepClone(this.formConfig);
391
+ data.config.network = this.apiConfig;
392
+ resolve(data);
393
+ })
394
+ );
435
395
  },
436
396
  getHtml() {
437
397
  return generateCode(JSON.stringify(this.formConfig));
@@ -448,3 +408,86 @@ export default {
448
408
  }
449
409
  };
450
410
  </script>
411
+
412
+ <style lang="scss" scoped>
413
+ $primary-color: #409eff;
414
+ $primary-background-color: #ecf5ff;
415
+ .th-formMaking {
416
+ height: 100%;
417
+ background-color: white;
418
+ border: 1px solid #dcdfe6;
419
+
420
+ .formMaking-fields {
421
+ .fields-header {
422
+ display: flex;
423
+ align-items: center;
424
+ height: 45px;
425
+ padding: 0 15px;
426
+ }
427
+ ul {
428
+ position: relative;
429
+ overflow: hidden;
430
+ padding: 5px;
431
+ margin: 0;
432
+ }
433
+ .fields-label {
434
+ margin: 0 3px;
435
+ width: calc(50% - 6px);
436
+ line-height: 26px;
437
+ font-size: 12px;
438
+ color: #333;
439
+ display: inline-block;
440
+ overflow: hidden;
441
+ text-overflow: ellipsis;
442
+ white-space: nowrap;
443
+ border: 1px solid #f4f6fc;
444
+ box-sizing: border-box;
445
+ transition: 0.25s;
446
+
447
+ &:hover {
448
+ color: $primary-color !important;
449
+ border: 1px dashed $primary-color;
450
+
451
+ a {
452
+ color: $primary-color !important;
453
+ }
454
+ }
455
+
456
+ & > a {
457
+ color: #333;
458
+ display: block;
459
+ cursor: move;
460
+ background: #f4f6fc;
461
+ border: 1px solid #f4f6fc;
462
+ transition: 0.25s;
463
+
464
+ .icon {
465
+ margin-right: 6px;
466
+ margin-left: 8px;
467
+ font-size: 14px;
468
+ display: inline-block;
469
+ vertical-align: middle;
470
+ }
471
+
472
+ span {
473
+ display: inline-block;
474
+ vertical-align: middle;
475
+ }
476
+ }
477
+ }
478
+ }
479
+ .formMaking-drawing {
480
+ }
481
+ }
482
+ </style>
483
+
484
+ <style lang="scss">
485
+ .formMaking-fields {
486
+ .el-collapse-item__header {
487
+ padding: 0 10px;
488
+ height: 40px;
489
+ line-height: 40px;
490
+ background-color: #f5f7f9;
491
+ }
492
+ }
493
+ </style>