tianheng-ui 0.0.72 → 0.0.74

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.72",
4
+ "version": "0.0.74",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -41,7 +41,7 @@
41
41
  <el-button
42
42
  v-if="showAffirm"
43
43
  type="primary"
44
- :loading="loading"
44
+ :loading="affirmLoading"
45
45
  @click="handleAffirm"
46
46
  >{{ affirmText }}</el-button
47
47
  >
@@ -61,7 +61,6 @@ export default {
61
61
  },
62
62
  props: {
63
63
  visible: Boolean,
64
- loading: Boolean,
65
64
  title: { type: String, default: "" },
66
65
  width: { type: String, default: "800px" },
67
66
  fullscreen: { type: Boolean, default: false },
@@ -76,6 +75,7 @@ export default {
76
75
  destroyOnClose: { type: Boolean, default: false },
77
76
 
78
77
  showAffirm: { type: Boolean, default: true },
78
+ affirmLoading: Boolean,
79
79
  affirmText: { type: String, default: "确 认" },
80
80
 
81
81
  showCancel: { type: Boolean, default: true },
@@ -117,6 +117,7 @@
117
117
  style="margin:0 10px;"
118
118
  >
119
119
  <el-button
120
+ v-if="tools.includes('upload')"
120
121
  type="text"
121
122
  size="medium"
122
123
  icon="el-icon-upload2"
@@ -131,12 +132,9 @@
131
132
  :show-file-list="false"
132
133
  :on-change="onExcelFileChange"
133
134
  >
134
- <el-button v-if="upload" type="text" size="medium"
135
- >导入EXCEL
136
- </el-button>
135
+ <el-button type="text" size="medium">导入EXCEL </el-button>
137
136
  </el-upload>
138
137
  <el-button
139
- v-if="upload"
140
138
  type="text"
141
139
  size="medium"
142
140
  @click="dialog.import.visible = true"
@@ -146,7 +144,7 @@
146
144
  </el-popover>
147
145
 
148
146
  <el-button
149
- v-if="clearable"
147
+ v-if="tools.includes('clearable')"
150
148
  type="text"
151
149
  size="medium"
152
150
  icon="el-icon-delete"
@@ -154,7 +152,7 @@
154
152
  >清空
155
153
  </el-button>
156
154
  <el-button
157
- v-if="preview"
155
+ v-if="tools.includes('preview')"
158
156
  type="text"
159
157
  size="medium"
160
158
  icon="el-icon-view"
@@ -162,7 +160,7 @@
162
160
  >预览
163
161
  </el-button>
164
162
  <el-button
165
- v-if="generateJson"
163
+ v-if="tools.includes('generateJson')"
166
164
  type="text"
167
165
  size="medium"
168
166
  icon="el-icon-tickets"
@@ -170,7 +168,7 @@
170
168
  >生成JSON</el-button
171
169
  >
172
170
  <el-button
173
- v-if="generateCode"
171
+ v-if="tools.includes('generateCode')"
174
172
  type="text"
175
173
  size="medium"
176
174
  icon="el-icon-document"
@@ -368,8 +366,6 @@ import WidgetConfig from "./WidgetConfig";
368
366
  import FormConfig from "./FormConfig";
369
367
  import WidgetForm from "./WidgetForm";
370
368
  import GenerateForm from "./GenerateForm";
371
- import ThDialog from "ui/Dialog/index.vue";
372
- import ThCodeEditor from "ui/CodeEditor/index.vue";
373
369
  import {
374
370
  basicComponents,
375
371
  advanceComponents,
@@ -387,30 +383,26 @@ export default {
387
383
  WidgetConfig,
388
384
  FormConfig,
389
385
  WidgetForm,
390
- GenerateForm,
391
- ThDialog,
392
- ThCodeEditor
386
+ GenerateForm
393
387
  },
394
388
  props: {
395
- preview: {
396
- type: Boolean,
397
- default: false
398
- },
399
- generateCode: {
400
- type: Boolean,
401
- default: false
402
- },
403
- generateJson: {
404
- type: Boolean,
405
- default: false
406
- },
407
- upload: {
408
- type: Boolean,
409
- default: false
389
+ data: {
390
+ type: Object,
391
+ default: () => {
392
+ return { list: [], config: baseConfig };
393
+ }
410
394
  },
411
- clearable: {
412
- type: Boolean,
413
- default: false
395
+ tools: {
396
+ type: Array,
397
+ default: () => {
398
+ return [
399
+ "upload",
400
+ "clearable",
401
+ "preview",
402
+ "generateCode",
403
+ "generateJson"
404
+ ];
405
+ }
414
406
  },
415
407
  basicFields: {
416
408
  type: Array,
@@ -451,15 +443,12 @@ export default {
451
443
  }
452
444
  },
453
445
  data() {
446
+ this.basicComponents = basicComponents;
447
+ this.layoutComponents = layoutComponents;
448
+ this.advanceComponents = advanceComponents;
454
449
  return {
455
- basicComponents,
456
- layoutComponents,
457
- advanceComponents,
458
- widgetFormSelect: null,
459
- widgetFormData: {
460
- list: [],
461
- config: baseConfig
462
- },
450
+ widgetFormData: this.data,
451
+ widgetFormSelect: this.data.list[0],
463
452
  widgetValue: {},
464
453
  configTab: "widget",
465
454
  client: "monitor",
@@ -521,8 +510,14 @@ export default {
521
510
  widgetFormData: {
522
511
  deep: true,
523
512
  handler: function(val) {
524
- // console.log(this.$refs.widgetForm);
513
+ console.log("widgetFormData =>", val);
514
+ this.$emit("update:data", val);
525
515
  }
516
+ },
517
+ data(val) {
518
+ console.log("data =>", val);
519
+ this.setJSON(val);
520
+ // this.widgetFormData = val;
526
521
  }
527
522
  },
528
523
  mounted() {},
@@ -622,9 +617,9 @@ export default {
622
617
  const data = this.getComponentsConfig("input");
623
618
  let name = titleDom.innerText;
624
619
  if (name.charAt(0) === "*") {
625
- name = name.slice(1)
620
+ name = name.slice(1);
626
621
  data.options.required = true;
627
- data.rules = data.rules || []
622
+ data.rules = data.rules || [];
628
623
  data.rules.push({
629
624
  required: true,
630
625
  message: "单行文本必须填写"
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-if="show">
2
+ <div class="widgetConfig" v-if="show">
3
3
  <component
4
4
  :widget="data"
5
5
  :config="config"
@@ -12,6 +12,7 @@
12
12
  <th-dialog
13
13
  title="动作设置"
14
14
  v-model="eventsDialog.visible"
15
+ :modal-append-to-body="false"
15
16
  @on-fullscreen="$refs.codeEditor && $refs.codeEditor.resize()"
16
17
  >
17
18
  <div class="eventsSetting">
@@ -347,127 +348,125 @@ export default {
347
348
  </script>
348
349
 
349
350
  <style lang="less" scoped>
350
- .remoteApis {
351
- width: 100%;
352
- margin-bottom: 6px;
351
+ .widgetConfig {
352
+ .remoteApis {
353
+ width: 100%;
354
+ margin-bottom: 6px;
353
355
 
354
- /deep/ .el-input--prefix .el-input__inner {
355
- padding-left: 85px;
356
- }
356
+ /deep/ .el-input--prefix .el-input__inner {
357
+ padding-left: 85px;
358
+ }
357
359
 
358
- /deep/ .el-input__prefix {
359
- left: 0;
360
- width: 75px;
361
- color: #999;
360
+ /deep/ .el-input__prefix {
361
+ left: 0;
362
+ width: 75px;
363
+ color: #999;
364
+ }
362
365
  }
363
- }
364
366
 
365
- /deep/ .el-form-item__label {
366
- width: 100%;
367
- }
368
-
369
- .el-dialog__body {
370
- padding: 20px;
371
- }
367
+ .el-dialog__body {
368
+ padding: 20px;
369
+ }
372
370
 
373
- .eventsSetting {
374
- height: 100%;
375
- display: flex;
376
- border: 1px solid #eee;
371
+ .eventsSetting {
372
+ height: 100%;
373
+ display: flex;
374
+ border: 1px solid #eee;
377
375
 
378
- .list {
379
- width: 270px;
380
- min-height: 430px;
381
- overflow-y: overlay;
382
- border-right: 1px solid #eee;
376
+ .list {
377
+ width: 270px;
378
+ min-height: 430px;
379
+ overflow-y: overlay;
380
+ border-right: 1px solid #eee;
383
381
 
384
- .list-header {
385
- position: sticky;
386
- top: 0;
387
- display: flex;
388
- align-items: center;
389
- justify-content: space-between;
390
- padding: 5px;
391
- line-height: 30px;
392
- border-bottom: 1px solid #eee;
393
- background: #f2f6fc;
394
- }
382
+ .list-header {
383
+ position: sticky;
384
+ top: 0;
385
+ display: flex;
386
+ align-items: center;
387
+ justify-content: space-between;
388
+ padding: 5px;
389
+ line-height: 30px;
390
+ border-bottom: 1px solid #eee;
391
+ background: #f2f6fc;
392
+ }
395
393
 
396
- .list-item {
397
- display: flex;
398
- // align-items: center;
399
- margin: 5px;
400
- padding: 10px;
401
- border-radius: 3px;
402
- border: 1px solid #dcdfe6;
403
- transition: 0.25s;
394
+ .list-item {
395
+ display: flex;
396
+ // align-items: center;
397
+ margin: 5px;
398
+ padding: 10px;
399
+ border-radius: 3px;
400
+ border: 1px solid #dcdfe6;
401
+ transition: 0.25s;
404
402
 
405
- .list-item-title {
406
- color: var(--th-green);
407
- }
408
- .list-item-value {
409
- flex: 1;
410
- padding: 0 5px;
411
- }
412
- i {
413
- cursor: pointer;
403
+ .list-item-title {
404
+ color: var(--th-green);
405
+ }
406
+ .list-item-value {
407
+ flex: 1;
408
+ padding: 0 5px;
409
+ }
410
+ i {
411
+ cursor: pointer;
412
+ }
414
413
  }
415
- }
416
414
 
417
- .list-item:hover {
418
- background-color: #f2f6fc;
415
+ .list-item:hover {
416
+ background-color: #f2f6fc;
417
+ }
419
418
  }
420
- }
421
419
 
422
- .detail {
423
- flex: 1;
424
- padding: 10px;
420
+ .detail {
421
+ flex: 1;
422
+ padding: 10px;
425
423
 
426
- > div:nth-child(1) {
427
- position: relative;
428
- display: flex;
429
- align-items: center;
430
- margin-bottom: 20px;
431
- padding-left: 10px;
424
+ > div:nth-child(1) {
425
+ position: relative;
426
+ display: flex;
427
+ align-items: center;
428
+ margin-bottom: 20px;
429
+ padding-left: 10px;
432
430
 
433
- /deep/ .el-input {
434
- flex: 1;
435
- margin-left: 10px;
431
+ /deep/ .el-input {
432
+ flex: 1;
433
+ margin-left: 10px;
434
+ }
436
435
  }
437
- }
438
-
439
- > div:nth-child(1)::after {
440
- content: "*";
441
- position: absolute;
442
- left: 0;
443
- color: red;
444
- }
445
436
 
446
- > div:nth-child(2) {
447
- height: calc(100% - 48px);
448
- > div:nth-child(1) {
449
- margin-bottom: 10px;
450
- color: var(--th-blue);
437
+ > div:nth-child(1)::after {
438
+ content: "*";
439
+ position: absolute;
440
+ left: 0;
441
+ color: red;
451
442
  }
452
443
 
453
- > div:nth-child(3) {
454
- margin-top: 10px;
455
- color: var(--th-blue);
444
+ > div:nth-child(2) {
445
+ height: calc(100% - 48px);
446
+ > div:nth-child(1) {
447
+ margin-bottom: 10px;
448
+ color: var(--th-blue);
449
+ }
450
+
451
+ > div:nth-child(3) {
452
+ margin-top: 10px;
453
+ color: var(--th-blue);
454
+ }
456
455
  }
457
456
  }
458
457
  }
459
- }
460
- .selectableRange {
461
- width: 100%;
458
+ .selectableRange {
459
+ width: 100%;
462
460
 
463
- /deep/ .el-range-separator {
464
- width: 20px;
461
+ /deep/ .el-range-separator {
462
+ width: 20px;
463
+ }
465
464
  }
466
- }
467
465
 
468
- .functions {
469
- span {
470
- margin: 0 5px;
466
+ .functions {
467
+ span {
468
+ margin: 0 5px;
469
+ }
471
470
  }
472
471
  }
473
472
  </style>
@@ -1,6 +1,6 @@
1
1
  import "normalize.css/normalize.css";
2
2
  import "./iconfont/iconfont.css";
3
- import "./styles/cover.scss";
3
+ // import "./styles/cover.scss";
4
4
  import "./styles/index.scss";
5
5
 
6
6
  import FormMaking from "./Container.vue";
@@ -1,6 +1,6 @@
1
1
  import "normalize.css/normalize.css";
2
2
  import "./iconfont/iconfont.css";
3
- import "./styles/cover.scss";
3
+ // import "./styles/cover.scss";
4
4
  import "./styles/index.scss";
5
5
  import FormMaking from "./Container.vue";
6
6
  FormMaking.install = function(Vue) {
@@ -733,6 +733,10 @@ $primary-background-color: #ecf5ff;
733
733
  padding: 5px;
734
734
  }
735
735
  }
736
+
737
+ .el-form-item__label {
738
+ width: 100%;
739
+ }
736
740
  }
737
741
 
738
742
  .widget-actions {
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div>
3
+
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ data() {
10
+ return {};
11
+ },
12
+ mounted() {},
13
+ methods: {},
14
+ };
15
+ </script>
16
+
17
+ <style lang="scss" scoped></style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div></div>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ data() {
8
+ return {};
9
+ },
10
+ mounted() {},
11
+ methods: {}
12
+ };
13
+ </script>
14
+
15
+ <style lang="scss" scoped></style>
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div class="th-table-making">
3
+ <el-container>
4
+ <el-container>
5
+ <el-header>
6
+ <el-button type="text" size="medium" icon="el-icon-delete">
7
+ 桌面端
8
+ </el-button>
9
+ <el-button type="text" size="medium" icon="el-icon-delete">
10
+ 移动端
11
+ </el-button>
12
+ </el-header>
13
+ <el-main>
14
+ <widget-table
15
+ :searchFields="searchFields"
16
+ :tableFields="tableFields"
17
+ @move="handleMoveChange"
18
+ ></widget-table>
19
+ </el-main>
20
+ </el-container>
21
+ <el-aside width="300px">
22
+ <widget-config
23
+ :fields="fields"
24
+ ref="configRef"
25
+ @fields-change="handleFieldsChange"
26
+ ></widget-config>
27
+ </el-aside>
28
+ </el-container>
29
+ </div>
30
+ </template>
31
+
32
+ <script>
33
+ import WidgetTable from "./widgetTable.vue";
34
+ import WidgetConfig from "./widgetConfig.vue";
35
+ export default {
36
+ name: "ThTableMaking",
37
+ components: { WidgetTable, WidgetConfig },
38
+ props: {
39
+ fields: {
40
+ type: Array,
41
+ default: () => {
42
+ return [];
43
+ }
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ searchFields: [],
49
+ tableFields: []
50
+ };
51
+ },
52
+ mounted() {},
53
+ methods: {
54
+ handleFieldsChange(val) {
55
+ console.log("handleFieldsChange =>", val);
56
+ const type = val.type;
57
+ const data = val.data;
58
+ const list = [];
59
+ data.forEach(i => {
60
+ list.push(JSON.parse(JSON.stringify(this.fields[i])));
61
+ });
62
+ if (type === 0) {
63
+ this.searchFields = list;
64
+ } else {
65
+ this.tableFields = list;
66
+ }
67
+ },
68
+ handleMoveChange(val) {
69
+ console.log("handleMoveChange =>", val);
70
+ const type = val.type;
71
+ const data = val.data;
72
+ const newIndex = data.newIndex;
73
+ const oldIndex = data.oldIndex;
74
+ if (type === "search") {
75
+ let list = this.$refs.configRef.search.fields;
76
+ list = this.mobile(list, oldIndex, newIndex);
77
+ this.$refs.configRef.search.fields = list;
78
+ this.searchFields = this.mobile(this.searchFields, oldIndex, newIndex)
79
+ } else {
80
+ let list = this.$refs.configRef.table.fields;
81
+ list = this.mobile(list, oldIndex, newIndex);
82
+ this.$refs.configRef.table.fields = list;
83
+ this.tableFields = this.mobile(this.tableFields, oldIndex, newIndex)
84
+ }
85
+ },
86
+ mobile(list, oldIndex, newIndex) {
87
+ const item = JSON.parse(JSON.stringify(list[oldIndex]));
88
+ if (oldIndex < newIndex) {
89
+ list.splice(newIndex + 1, 0, item);
90
+ list.splice(oldIndex, 1);
91
+ }
92
+ if (oldIndex > newIndex) {
93
+ list.splice(newIndex, 0, item);
94
+ list.splice(oldIndex + 1, 1);
95
+ }
96
+ return list;
97
+ },
98
+ getJson(){}
99
+ }
100
+ };
101
+ </script>
102
+
103
+ <style lang="scss" scoped>
104
+ .th-table-making {
105
+ height: 100%;
106
+ background-color: white;
107
+ border: 1px solid #dcdfe6;
108
+
109
+ .el-container {
110
+ height: 100%;
111
+ }
112
+ .el-header {
113
+ height: 45px !important;
114
+ line-height: 45px;
115
+ border-bottom: 1px solid #dcdfe6;
116
+ }
117
+ .el-main {
118
+ padding: 5px;
119
+ background-color: #fafafa;
120
+ }
121
+ .el-aside {
122
+ border-left: 1px solid #dcdfe6;
123
+ box-sizing: border-box;
124
+ }
125
+ }
126
+ </style>
@@ -0,0 +1,5 @@
1
+ import TableMaking from "./index.vue";
2
+ TableMaking.install = function(Vue) {
3
+ Vue.component(TableMaking.name, TableMaking);
4
+ };
5
+ export default TableMaking;