tianheng-ui 0.1.80 → 0.1.82
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +66 -9
- package/lib/tianheng-ui.js +13 -13
- package/package.json +1 -1
- package/packages/CodeEditor/index.vue +3 -2
- package/packages/FormMaking/GenerateForm.vue +1 -1
- package/packages/FormMaking/WidgetFooter.vue +16 -0
- package/packages/FormMaking/WidgetForm.vue +0 -1
- package/packages/FormMaking/WidgetTools.vue +21 -16
- package/packages/FormMaking/custom/config.js +120 -2
- package/packages/FormMaking/custom/configs/number.vue +0 -5
- package/packages/FormMaking/custom/configs/page-table.vue +146 -0
- package/packages/FormMaking/custom/index.js +1 -1
- package/packages/FormMaking/custom/items/page-table.vue +250 -0
- package/packages/FormMaking/index.vue +6 -1
- package/packages/FormMaking/util/generateCode.js +427 -157
- package/packages/TableMaking/custom/config.js +7 -0
- package/packages/TableMaking/widgetConfig.vue +11 -0
- package/packages/TableMaking/widgetGuide.vue +5 -3
@@ -0,0 +1,250 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="pageTable">
|
3
|
+
<div v-if="widget.options.columns.tree.show" class="pageTable-tree">
|
4
|
+
<el-tree
|
5
|
+
:data="widget.options.columns.tree.props.data"
|
6
|
+
:current-node-key="widget.options.columns.tree.props.selectedKeys[0]"
|
7
|
+
:show-checkbox="widget.options.columns.tree.props.checkable"
|
8
|
+
:default-expanded-keys="widget.options.columns.tree.props.expandedKeys"
|
9
|
+
:default-checked-keys="widget.options.columns.tree.props.checkedKeys"
|
10
|
+
:props="widget.options.columns.tree.props.fieldNames"
|
11
|
+
:default-expand-all="widget.options.columns.tree.props.defaultExpandAll"
|
12
|
+
:node-key="widget.options.columns.tree.props.fieldNames.key"
|
13
|
+
>
|
14
|
+
</el-tree>
|
15
|
+
</div>
|
16
|
+
<div class="pageTable-content">
|
17
|
+
<div v-if="widget.options.columns.search.show" class="pageTable-search">
|
18
|
+
<draggable
|
19
|
+
v-model="widget.options.columns.search.list"
|
20
|
+
v-bind="{
|
21
|
+
group: 'people',
|
22
|
+
ghostClass: 'draggable-ghost',
|
23
|
+
animation: 200,
|
24
|
+
handle: '.drag-widget'
|
25
|
+
}"
|
26
|
+
:no-transition-on-drag="true"
|
27
|
+
@add="handleWidgetAdd($event, widget, 'search')"
|
28
|
+
>
|
29
|
+
<transition-group name="fade" tag="div" class="draggable-list">
|
30
|
+
<widget-form-item
|
31
|
+
v-for="(element,
|
32
|
+
elementIndex) in widget.options.columns.search.list.filter(
|
33
|
+
item => {
|
34
|
+
return item.key;
|
35
|
+
}
|
36
|
+
)"
|
37
|
+
:key="element.key"
|
38
|
+
:widget="element"
|
39
|
+
:widgetArray="widget.options.columns.search.list"
|
40
|
+
:widgetIndex="elementIndex"
|
41
|
+
:config="config"
|
42
|
+
:select.sync="selectWidget"
|
43
|
+
></widget-form-item>
|
44
|
+
</transition-group>
|
45
|
+
</draggable>
|
46
|
+
<th-empty
|
47
|
+
v-if="widget.options.columns.search.list.length == 0"
|
48
|
+
class="pageTable-empty"
|
49
|
+
description="从左侧拖拽来添加搜索字段"
|
50
|
+
></th-empty>
|
51
|
+
</div>
|
52
|
+
<div v-if="widget.options.columns.tools.show" class="pageTable-tools">
|
53
|
+
<draggable
|
54
|
+
v-model="widget.options.columns.tools.list"
|
55
|
+
v-bind="{
|
56
|
+
group: 'people',
|
57
|
+
ghostClass: 'draggable-ghost',
|
58
|
+
animation: 200,
|
59
|
+
handle: '.drag-widget'
|
60
|
+
}"
|
61
|
+
:no-transition-on-drag="true"
|
62
|
+
@add="handleWidgetAdd($event, widget, 'tools')"
|
63
|
+
>
|
64
|
+
<transition-group name="fade" tag="div" class="draggable-list">
|
65
|
+
<widget-form-item
|
66
|
+
v-for="(element,
|
67
|
+
elementIndex) in widget.options.columns.tools.list.filter(
|
68
|
+
item => {
|
69
|
+
return item.key;
|
70
|
+
}
|
71
|
+
)"
|
72
|
+
:key="element.key"
|
73
|
+
:widget="element"
|
74
|
+
:widgetArray="widget.options.columns.tools.list"
|
75
|
+
:widgetIndex="elementIndex"
|
76
|
+
:config="config"
|
77
|
+
:select.sync="selectWidget"
|
78
|
+
></widget-form-item>
|
79
|
+
</transition-group>
|
80
|
+
</draggable>
|
81
|
+
<th-empty
|
82
|
+
v-if="widget.options.columns.tools.list.length == 0"
|
83
|
+
class="pageTable-empty"
|
84
|
+
description="从左侧拖拽来添加功能按钮"
|
85
|
+
></th-empty>
|
86
|
+
</div>
|
87
|
+
<div class="pageTable-table">
|
88
|
+
<el-table
|
89
|
+
:data="widget.options.columns.table.data"
|
90
|
+
:size="widget.options.columns.table.size"
|
91
|
+
:border="widget.options.columns.table.border"
|
92
|
+
>
|
93
|
+
<el-table-column
|
94
|
+
v-for="column in widget.options.columns.table.columns"
|
95
|
+
:key="column.dataIndex"
|
96
|
+
:prop="column.dataIndex"
|
97
|
+
:label="column.title"
|
98
|
+
>
|
99
|
+
<template slot-scope="scope">
|
100
|
+
<template v-if="column.dataIndex === 'action'">
|
101
|
+
<el-button type="text" size="small">查看</el-button>
|
102
|
+
<el-button type="text" size="small">编辑</el-button>
|
103
|
+
</template>
|
104
|
+
<template v-else>{{ scope.row[column.dataIndex] }}</template>
|
105
|
+
</template>
|
106
|
+
</el-table-column>
|
107
|
+
</el-table>
|
108
|
+
</div>
|
109
|
+
<div
|
110
|
+
v-if="widget.options.columns.table.pagination.show"
|
111
|
+
class="pageTable-pagination"
|
112
|
+
>
|
113
|
+
<el-pagination
|
114
|
+
:current-page="
|
115
|
+
widget.options.columns.table.pagination.options.current
|
116
|
+
"
|
117
|
+
:page-sizes="
|
118
|
+
widget.options.columns.table.pagination.options.pageSizes
|
119
|
+
"
|
120
|
+
:page-size="widget.options.columns.table.pagination.options.pageSize"
|
121
|
+
layout="total, sizes, prev, pager, next, jumper"
|
122
|
+
:total="widget.options.columns.table.data.length"
|
123
|
+
>
|
124
|
+
</el-pagination>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
</template>
|
129
|
+
|
130
|
+
<script>
|
131
|
+
import { deepClone } from "../../util/index";
|
132
|
+
import { itemsComponent, eventMixin } from "../mixins/index";
|
133
|
+
import Draggable from "vuedraggable";
|
134
|
+
import WidgetFormItem from "../../WidgetFormItem.vue";
|
135
|
+
import compsData from "../register";
|
136
|
+
export default {
|
137
|
+
components: { Draggable, WidgetFormItem },
|
138
|
+
mixins: [itemsComponent, eventMixin],
|
139
|
+
data() {
|
140
|
+
return {
|
141
|
+
compsData: deepClone(compsData),
|
142
|
+
selectWidget: this.select
|
143
|
+
};
|
144
|
+
},
|
145
|
+
watch: {
|
146
|
+
select(val) {
|
147
|
+
this.selectWidget = val;
|
148
|
+
},
|
149
|
+
selectWidget(val) {
|
150
|
+
this.$emit("update:select", val);
|
151
|
+
}
|
152
|
+
},
|
153
|
+
created() {
|
154
|
+
const devComponentsPath = {
|
155
|
+
grid: "grid_dev",
|
156
|
+
table: "table_dev",
|
157
|
+
list: "list_dev",
|
158
|
+
tabs: "tabs_dev",
|
159
|
+
blank: "blank_dev"
|
160
|
+
};
|
161
|
+
const keys = Object.keys(this.compsData);
|
162
|
+
for (const key of keys) {
|
163
|
+
const element = this.compsData[key];
|
164
|
+
if (devComponentsPath[key])
|
165
|
+
element.content = require(`./${devComponentsPath[key]}`).default;
|
166
|
+
else element.content = require(`./${key}`).default;
|
167
|
+
}
|
168
|
+
},
|
169
|
+
mounted() {},
|
170
|
+
methods: {
|
171
|
+
handleWidgetAdd($event, row, colIndex) {
|
172
|
+
const newIndex = $event.newIndex;
|
173
|
+
const oldIndex = $event.oldIndex;
|
174
|
+
const item = $event.item;
|
175
|
+
const newComponent = JSON.parse(
|
176
|
+
JSON.stringify(row.options.columns[colIndex].list[newIndex])
|
177
|
+
);
|
178
|
+
|
179
|
+
// 防止布局元素的嵌套拖拽
|
180
|
+
if (item.className.indexOf("grid") >= 0) {
|
181
|
+
// 如果是列表中拖拽的元素需要还原到原来位置
|
182
|
+
item.tagName === "DIV" &&
|
183
|
+
this.widgetArray.splice(oldIndex, 0, newComponent);
|
184
|
+
|
185
|
+
row.options.columns[colIndex].list.splice(newIndex, 1);
|
186
|
+
return false;
|
187
|
+
}
|
188
|
+
|
189
|
+
if (!newComponent.key) {
|
190
|
+
const key =
|
191
|
+
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
192
|
+
newComponent.key = key;
|
193
|
+
newComponent.model = `${newComponent.type}_${key}`;
|
194
|
+
if (colIndex === "tools") newComponent.options.hideLabel = true;
|
195
|
+
}
|
196
|
+
this.$set(row.options.columns[colIndex].list, newIndex, newComponent);
|
197
|
+
this.selectWidget = newComponent;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
};
|
201
|
+
</script>
|
202
|
+
|
203
|
+
<style lang="scss" scoped>
|
204
|
+
.pageTable {
|
205
|
+
display: flex;
|
206
|
+
padding: 10px;
|
207
|
+
|
208
|
+
.pageTable-tree {
|
209
|
+
margin-right: 10px;
|
210
|
+
width: 200px;
|
211
|
+
}
|
212
|
+
|
213
|
+
.pageTable-content {
|
214
|
+
flex: 1;
|
215
|
+
width: 0;
|
216
|
+
.pageTable-search {
|
217
|
+
position: relative;
|
218
|
+
margin-bottom: 10px;
|
219
|
+
}
|
220
|
+
.pageTable-tools {
|
221
|
+
position: relative;
|
222
|
+
// margin-bottom: 10px;
|
223
|
+
}
|
224
|
+
.pageTable-table {
|
225
|
+
margin-bottom: 10px;
|
226
|
+
}
|
227
|
+
.pageTable-pagination {
|
228
|
+
text-align: right;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
.draggable-list {
|
232
|
+
display: flex;
|
233
|
+
}
|
234
|
+
|
235
|
+
.pageTable-empty {
|
236
|
+
position: absolute;
|
237
|
+
margin-left: -200px;
|
238
|
+
padding: 0;
|
239
|
+
width: 400px;
|
240
|
+
top: 0;
|
241
|
+
left: 50%;
|
242
|
+
text-align: center;
|
243
|
+
color: #ccc;
|
244
|
+
|
245
|
+
.th-empty-description {
|
246
|
+
font-size: 20px;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
</style>
|
@@ -125,6 +125,9 @@
|
|
125
125
|
ref="widgetForm"
|
126
126
|
>
|
127
127
|
</widget-form>
|
128
|
+
<widget-footer>
|
129
|
+
<slot name="footer"></slot>
|
130
|
+
</widget-footer>
|
128
131
|
</div>
|
129
132
|
|
130
133
|
<!-- 右侧配置区 -->
|
@@ -155,6 +158,7 @@ import Draggable from "vuedraggable";
|
|
155
158
|
import WidgetConfig from "./WidgetConfig";
|
156
159
|
import WidgetTools from "./WidgetTools";
|
157
160
|
import WidgetForm from "./WidgetForm";
|
161
|
+
import WidgetFooter from "./WidgetFooter";
|
158
162
|
import GenerateForm from "./GenerateForm";
|
159
163
|
import WidgetGuide from "./WidgetGuide.vue";
|
160
164
|
import {
|
@@ -175,6 +179,7 @@ export default {
|
|
175
179
|
WidgetConfig,
|
176
180
|
WidgetTools,
|
177
181
|
WidgetForm,
|
182
|
+
WidgetFooter,
|
178
183
|
GenerateForm,
|
179
184
|
WidgetGuide
|
180
185
|
},
|
@@ -232,7 +237,7 @@ export default {
|
|
232
237
|
},
|
233
238
|
businessFields: {
|
234
239
|
type: Array,
|
235
|
-
default: () => ["blank", "descriptions", "workflow"]
|
240
|
+
default: () => ["blank", "descriptions", "workflow", "page-table"]
|
236
241
|
},
|
237
242
|
guide: Boolean
|
238
243
|
},
|