tianheng-ui 0.1.32 → 0.1.34

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.1.32",
4
+ "version": "0.1.34",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -20,7 +20,7 @@
20
20
  export default {
21
21
  name: "ThEmpty",
22
22
  props: {
23
- image: { type: String, default: "" },
23
+ image: { type: String, default: '' },
24
24
  imageSize: { type: Number, default: 300 },
25
25
  description: { type: String, default: "暂无数据" }
26
26
  },
@@ -14,7 +14,7 @@
14
14
  <el-tooltip
15
15
  slot="label"
16
16
  effect="dark"
17
- content="会导致该组件配置信息重置,请谨慎使用!"
17
+ content="切换组件会导致该组件配置信息重置,请谨慎使用!"
18
18
  placement="top"
19
19
  >
20
20
  <span style="color: #409EFF;">组件切换</span>
@@ -81,8 +81,6 @@
81
81
  :fields="fields"
82
82
  :apiConfig="apiConfig"
83
83
  :is="compsData[data.type].content"
84
- @events-show="handleEventDialogShow"
85
- @events-edit="handleEventsCollapseClick"
86
84
  ></component>
87
85
 
88
86
  <el-collapse-item
@@ -93,7 +91,7 @@
93
91
  <span>动作设置</span>
94
92
  <span
95
93
  style="float: right;margin-right: 10px;"
96
- @click.stop="handleEventsShow"
94
+ @click.stop="handleEventDialogShow"
97
95
  >配置</span
98
96
  >
99
97
  </div>
@@ -102,7 +100,7 @@
102
100
  :key="event"
103
101
  :label="event"
104
102
  >
105
- <div class="eventsCollapse-item">
103
+ <div class="events-item">
106
104
  <el-select
107
105
  v-model="data.events[event]"
108
106
  placeholder="请选择"
@@ -119,7 +117,7 @@
119
117
  <i
120
118
  v-if="data.events[event]"
121
119
  class="el-icon-edit"
122
- @click="handleEventsEdit(data.events[event])"
120
+ @click="handleEventsCollapseClick(data.events[event])"
123
121
  ></i>
124
122
  </div>
125
123
  </el-form-item>
@@ -127,15 +125,6 @@
127
125
  </el-collapse>
128
126
  </el-form>
129
127
 
130
- <!-- <component
131
- :widget="data"
132
- :config="config"
133
- :fields="fields"
134
- :is="compsData[data.type].content"
135
- @events-show="handleEventDialogShow"
136
- @events-edit="handleEventsCollapseClick"
137
- ></component> -->
138
-
139
128
  <th-dialog
140
129
  title="动作设置"
141
130
  v-model="eventsDialog.visible"
@@ -498,13 +487,20 @@ export default {
498
487
  .el-radio-button__inner {
499
488
  padding: 7px !important;
500
489
  }
490
+ .el-dialog__body {
491
+ padding: 20px !important;
492
+ }
501
493
  }
502
494
  </style>
503
495
 
504
496
  <style lang="scss" scoped>
505
497
  .widget-config {
506
- .el-dialog__body {
507
- padding: 20px;
498
+ .events-item {
499
+ display: flex;
500
+ align-items: center;
501
+ > i {
502
+ margin-left: 10px;
503
+ }
508
504
  }
509
505
 
510
506
  .eventsSetting {
@@ -594,20 +590,5 @@ export default {
594
590
  }
595
591
  }
596
592
  }
597
- .selectableRange {
598
- width: 100%;
599
-
600
- .el-range-separator {
601
- width: 20px;
602
- }
603
- }
604
-
605
- .flexView {
606
- display: flex;
607
- align-items: center;
608
- padding-bottom: 10px;
609
- margin-bottom: 10px;
610
- border-bottom: 1px solid #e1e1e1;
611
- }
612
593
  }
613
594
  </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="widgetTools">
3
3
  <div class="left">
4
- <el-button
4
+ <!-- <el-button
5
5
  :class="{ active: client === 'monitor' }"
6
6
  type="text"
7
7
  size="medium"
@@ -16,7 +16,7 @@
16
16
  icon="el-icon-mobile"
17
17
  @click="handleClick('mobile')"
18
18
  >
19
- </el-button>
19
+ </el-button> -->
20
20
  </div>
21
21
  <div class="right">
22
22
  <slot> </slot>
@@ -30,14 +30,35 @@
30
30
  @click="handleClick('clear')"
31
31
  >重置
32
32
  </el-button>
33
- <el-button
34
- v-if="permissions.includes('preview')"
35
- type="text"
36
- size="medium"
37
- icon="el-icon-view"
38
- @click="handleDialogOpen('preview')"
39
- >预览
40
- </el-button>
33
+ <el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
34
+ <el-button
35
+ v-if="permissions.includes('preview')"
36
+ type="text"
37
+ size="medium"
38
+ icon="el-icon-view"
39
+ slot="reference"
40
+ >预览
41
+ </el-button>
42
+ <div>
43
+ <el-button
44
+ type="text"
45
+ size="medium"
46
+ icon="el-icon-monitor"
47
+ @click="handleDialogOpen('preview_pc')"
48
+ >电脑端
49
+ </el-button>
50
+ </div>
51
+ <div>
52
+ <el-button
53
+ type="text"
54
+ size="medium"
55
+ icon="el-icon-mobile"
56
+ @click="handleDialogOpen('preview_h5')"
57
+ >移动端
58
+ </el-button>
59
+ </div>
60
+ </el-popover>
61
+
41
62
  <el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
42
63
  <el-button
43
64
  v-if="permissions.includes('upload')"
@@ -48,37 +69,33 @@
48
69
  >导入</el-button
49
70
  >
50
71
  <div>
51
- <div>
52
- <el-button
53
- type="text"
54
- size="medium"
55
- @click="handleDialogOpen('importJson')"
56
- >导入JSON
57
- </el-button>
58
- </div>
59
- <div>
60
- <el-upload
61
- action
62
- accept=".xlsx, .xls"
63
- :auto-upload="false"
64
- :show-file-list="false"
65
- disabled
66
- :on-change="handleExcelFileChange"
67
- >
68
- <el-button type="text" size="medium" disabled
69
- >导入EXCEL</el-button
70
- >
71
- </el-upload>
72
- </div>
73
- <div>
74
- <el-button
75
- type="text"
76
- size="medium"
77
- disabled
78
- @click="handleDialogOpen('importTemplate')"
79
- >导入模板
80
- </el-button>
81
- </div>
72
+ <el-button
73
+ type="text"
74
+ size="medium"
75
+ @click="handleDialogOpen('importJson')"
76
+ >导入JSON
77
+ </el-button>
78
+ </div>
79
+ <div>
80
+ <el-upload
81
+ action
82
+ accept=".xlsx, .xls"
83
+ :auto-upload="false"
84
+ :show-file-list="false"
85
+ disabled
86
+ :on-change="handleExcelFileChange"
87
+ >
88
+ <el-button type="text" size="medium" disabled>导入EXCEL</el-button>
89
+ </el-upload>
90
+ </div>
91
+ <div>
92
+ <el-button
93
+ type="text"
94
+ size="medium"
95
+ disabled
96
+ @click="handleDialogOpen('importTemplate')"
97
+ >导入模板
98
+ </el-button>
82
99
  </div>
83
100
  </el-popover>
84
101
  <el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
@@ -128,9 +145,12 @@
128
145
  @on-close="handleDialogClose"
129
146
  @on-affirm="handleDialogAffirm"
130
147
  >
131
- <template v-if="dialog.action === 'preview'">
148
+ <template v-if="dialog.action === 'preview_pc'">
132
149
  <th-table-generate :config="deepClone(config)"> </th-table-generate>
133
150
  </template>
151
+ <template v-if="dialog.action === 'preview_h5'">
152
+ <th-list-generate :data="[]" :config="deepClone(config)"> </th-list-generate>
153
+ </template>
134
154
  <template v-else-if="dialog.action === 'importJson'">
135
155
  <el-alert
136
156
  type="info"
@@ -170,7 +190,8 @@ export default {
170
190
  data: {}
171
191
  },
172
192
  dialogTitles: {
173
- preview: "预览",
193
+ preview_pc: "预览-电脑端",
194
+ preview_h5: "预览-移动端",
174
195
  importJson: "导入JSON",
175
196
  importTemplate: "导入模板",
176
197
  generateJson: "生成JSON",
@@ -40,8 +40,6 @@ export const table = {
40
40
  table: {
41
41
  border: true,
42
42
  height: "",
43
- maxHeight: "",
44
- customStyle: ""
45
43
  },
46
44
  cell: {
47
45
  customStyle: "",
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <div class="generateTable-search">
3
+ <el-row :gutter="10">
4
+ <el-col
5
+ v-for="item in options"
6
+ :key="item.prop"
7
+ :span="24 / options.length"
8
+ >
9
+ <el-input
10
+ v-if="item.type === 'input' || item.elType === 'input'"
11
+ v-model="data[item.prop]"
12
+ :placeholder="item.label"
13
+ :disabled="item.disabled"
14
+ clearable
15
+ ></el-input>
16
+ <el-date-picker
17
+ v-if="item.type === 'date' || item.elType === 'date'"
18
+ v-model="data[item.prop]"
19
+ :type="item.dateType || 'date'"
20
+ :format="item.format"
21
+ :value-format="item.valueFormat"
22
+ range-separator="至"
23
+ start-placeholder="开始日期"
24
+ end-placeholder="结束日期"
25
+ clearable
26
+ >
27
+ </el-date-picker>
28
+ <el-select
29
+ v-if="item.type === 'select' || item.elType === 'select'"
30
+ v-model="data[item.prop]"
31
+ :placeholder="item.label"
32
+ :multiple="item.multiple"
33
+ :multiple-limit="item.multipleLimit"
34
+ :filterable="item.filterable"
35
+ :disabled="item.disabled"
36
+ clearable
37
+ >
38
+ <template v-if="item.remote">
39
+ <el-option
40
+ v-for="option in item.remoteData"
41
+ :key="option[item.props.value]"
42
+ :label="option[item.props.label]"
43
+ :value="option[item.props.value]"
44
+ >
45
+ </el-option>
46
+ </template>
47
+ <template v-else>
48
+ <el-option
49
+ v-for="option in item.staticData"
50
+ :key="option.value"
51
+ :label="option.label"
52
+ :value="option.value"
53
+ >
54
+ </el-option>
55
+ </template>
56
+ </el-select>
57
+ </el-col>
58
+ </el-row>
59
+ </div>
60
+ </template>
61
+
62
+ <script>
63
+ export default {
64
+ props: {
65
+ options: {
66
+ type: Array,
67
+ default: () => {
68
+ return [];
69
+ }
70
+ },
71
+ data: {
72
+ type: Object,
73
+ default: () => {
74
+ return {};
75
+ }
76
+ }
77
+ },
78
+ data() {
79
+ return {};
80
+ },
81
+ methods: {
82
+ doSearch() {
83
+ this.$emit("search", this.data);
84
+ },
85
+ doReset() {
86
+ this.options.map(item => {
87
+ this.$set(this.data, item.prop, item.defaultValue || "");
88
+ });
89
+ this.$emit("reset", this.data);
90
+ }
91
+ }
92
+ };
93
+ </script>
94
+
95
+ <style lang="scss" scoped>
96
+ .generateTable-search {
97
+ position: sticky;
98
+ top: 0;
99
+ width: 100%;
100
+ padding: 5px;
101
+ border-bottom: 1px solid #e5e5e5;
102
+ background-color: white;
103
+ z-index: 100;
104
+ }
105
+ </style>
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <div class="generateTable-table">
3
+ <div
4
+ v-for="item in data"
5
+ class="table-list-item"
6
+ :style="cellStyle"
7
+ :key="item.id"
8
+ @click="handleCellClick(item)"
9
+ >
10
+ <div
11
+ v-for="(column, index) in getList"
12
+ class="table-list-item-row"
13
+ :key="index"
14
+ >
15
+ <div class="table-list-item-row-label" :style="titleStyle">
16
+ {{ column.label }}
17
+ </div>
18
+ <div class="table-list-item-row-value" :style="valueStyle">
19
+ {{ item[column.prop] != null ? item[column.prop] : "" }}
20
+ </div>
21
+ </div>
22
+ <div class="table-list-item-tools">
23
+ <el-button
24
+ v-for="button in config.actions"
25
+ :key="button.name"
26
+ :type="button.style.type"
27
+ :icon="button.style.icon"
28
+ :plain="button.style.plain"
29
+ :round="button.style.round"
30
+ :circle="button.style.circle"
31
+ :size="button.style.size"
32
+ @click="handleActionClick(button, item)"
33
+ >{{ button.text }}</el-button
34
+ >
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </template>
39
+
40
+ <script>
41
+ export default {
42
+ props: {
43
+ data: Array,
44
+ config: Object
45
+ },
46
+ data() {
47
+ return {};
48
+ },
49
+ computed: {
50
+ getList() {
51
+ if (this.config.options) {
52
+ const data = this.config.options.filter(item => {
53
+ return !item.hide;
54
+ });
55
+ return data;
56
+ }
57
+ return [];
58
+ },
59
+ cellStyle() {
60
+ let styleText = "";
61
+ if (this.config.style) {
62
+ const style = this.config.style.cell || {};
63
+ const keys = Object.keys(style).filter(key => {
64
+ return key !== "customStyle";
65
+ });
66
+ for (let key of keys) {
67
+ styleText += `${key}: ${style[key]};`;
68
+ }
69
+ styleText += style.customStyle;
70
+ styleText = styleText.replace(/rpx/g, "px");
71
+ return styleText;
72
+ }
73
+ },
74
+ titleStyle() {
75
+ let styleText = "";
76
+ if (this.config.style) {
77
+ const style = this.config.style.title || {};
78
+ const keys = Object.keys(style).filter(key => {
79
+ return key !== "customStyle";
80
+ });
81
+ for (let key of keys) {
82
+ styleText += `${key}: ${style[key]};`;
83
+ }
84
+ styleText += style.customStyle;
85
+ styleText = styleText.replace(/rpx/g, "px");
86
+ return styleText;
87
+ }
88
+ },
89
+ valueStyle() {
90
+ let styleText = "";
91
+ if (this.config.style) {
92
+ const style = this.config.style.value || {};
93
+ const keys = Object.keys(style).filter(key => {
94
+ return key !== "customStyle";
95
+ });
96
+ for (let key of keys) {
97
+ styleText += `${key}: ${style[key]};`;
98
+ }
99
+ styleText += style.customStyle;
100
+ styleText = styleText.replace(/rpx/g, "px");
101
+ return styleText;
102
+ }
103
+ }
104
+ },
105
+ methods: {
106
+ stopClick() {},
107
+ handleCellClick(item) {
108
+ this.$emit("click", item);
109
+ },
110
+ handleActionClick(action, item) {
111
+ this.$emit("action", action, item);
112
+ }
113
+ }
114
+ };
115
+ </script>
116
+
117
+ <style lang="scss" scoped>
118
+ .generateTable-table {
119
+ width: 100%;
120
+
121
+ .table-list-item {
122
+ .table-list-item-row {
123
+ display: flex;
124
+ align-items: center;
125
+ padding: 5px 0;
126
+ .table-list-item-row-label {
127
+ }
128
+ .table-list-item-row-value {
129
+ flex: 1;
130
+ }
131
+ }
132
+
133
+ .table-list-item-tools {
134
+ display: flex;
135
+ align-items: center;
136
+ justify-content: flex-end;
137
+ }
138
+ }
139
+ }
140
+ </style>
@@ -5,7 +5,6 @@
5
5
  :data="data"
6
6
  :border="config.style.table.border"
7
7
  :height="config.style.table.height"
8
- :max-height="config.style.table.maxHeight"
9
8
  >
10
9
  <el-table-column
11
10
  v-for="item in config.options"
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div class="generateTable-tools">
3
+ <el-row :gutter="10">
4
+ <el-col
5
+ v-for="button in config"
6
+ :key="button.name"
7
+ :span="24 / config.length"
8
+ >
9
+ <el-button
10
+ style="width:100%"
11
+ :type="button.style.type"
12
+ :icon="button.style.icon"
13
+ :plain="button.style.plain"
14
+ :round="button.style.round"
15
+ :circle="button.style.circle"
16
+ :size="button.style.size"
17
+ @click="handleClick(button)"
18
+ >{{ button.text }}</el-button
19
+ >
20
+ </el-col>
21
+ </el-row>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ props: {
28
+ config: Array
29
+ },
30
+ data() {
31
+ return {};
32
+ },
33
+ methods: {
34
+ handleClick(item) {
35
+ this.$emit("click", item);
36
+ }
37
+ }
38
+ };
39
+ </script>
40
+
41
+ <style lang="less" scoped>
42
+ .generateTable-tools {
43
+ position: sticky;
44
+ bottom: 0;
45
+ width: 100%;
46
+ padding: 10px 5px;
47
+ background-color: white;
48
+ z-index: 100;
49
+ }
50
+ </style>
@@ -0,0 +1,5 @@
1
+ import GenerateList from "./generateList.vue";
2
+ GenerateList.install = function(Vue) {
3
+ Vue.component(GenerateList.name, GenerateList);
4
+ };
5
+ export default GenerateList;
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <div class="generateList">
3
+ <!-- 搜索栏 -->
4
+ <search v-if="searchConfig.show" :options="searchConfig.options" />
5
+ <list
6
+ v-if="tableData.length"
7
+ :data="tableData"
8
+ :config="tableConfig"
9
+ ></list>
10
+ <th-empty v-else style="padding:100px 0;">
11
+ <img
12
+ slot="image"
13
+ :src="require('../../lib/theme-chalk/images/notData.png')"
14
+ style="width:150px;"
15
+ alt=""
16
+ />
17
+ </th-empty>
18
+ <tools :config="toolsConfig" @click="handleActionClick"></tools>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import Search from "./custom/items/search/index-h5.vue";
24
+ import List from "./custom/items/table/index-h5.vue";
25
+ import Tools from "./custom/items/tools/index-h5.vue";
26
+ export default {
27
+ name: "thListGenerate",
28
+ components: { Search, List, Tools },
29
+ props: {
30
+ config: Object,
31
+ data: Array
32
+ },
33
+ data() {
34
+ return {
35
+ searchConfig: {},
36
+ toolsConfig: [],
37
+ tableConfig: {},
38
+ tableData: this.data,
39
+ networkConfig: {}
40
+ };
41
+ },
42
+ watch: {
43
+ config(val) {
44
+ this.initConfig();
45
+ },
46
+ data(val) {
47
+ this.tableData = val;
48
+ }
49
+ },
50
+ mounted() {
51
+ this.initConfig();
52
+ },
53
+ methods: {
54
+ // 处理配置信息
55
+ initConfig() {
56
+ if (!this.config || !this.config.table) return;
57
+ // 搜索配置
58
+ this.searchConfig = this.config.search;
59
+
60
+ // 操作配置
61
+ const toolsConfig = this.config.tools;
62
+ this.toolsConfig = Object.values(toolsConfig).filter(item => {
63
+ return item.position === "header" && item.show;
64
+ });
65
+
66
+ // 表格配置
67
+ const tableConfig = this.config.table;
68
+ const rowActions = Object.values(toolsConfig).filter(item => {
69
+ return item.position === "row" && item.show;
70
+ });
71
+ tableConfig.actions = rowActions;
72
+ this.tableConfig = tableConfig;
73
+
74
+ // 网络请求
75
+ this.networkConfig = this.config.network;
76
+ },
77
+ handleSearchChange(data) {
78
+ this.$emit("search", data);
79
+ },
80
+ handleTableClick(data) {
81
+ this.$emit("click", data);
82
+ },
83
+ handleActionClick(action, data) {
84
+ this.tableData.push({ id: new Date().getTime() });
85
+ this.$emit("action", action, data);
86
+ }
87
+ }
88
+ };
89
+ </script>
90
+
91
+ <style lang="scss" scoped>
92
+ .generateList {
93
+ width: 300px;
94
+ height: 649px;
95
+ margin: auto;
96
+ overflow-y: scroll;
97
+ border: 1px solid #e5e5e5;
98
+ border-radius: 10px;
99
+ }
100
+ </style>