tianheng-ui 0.0.78 → 0.0.81
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/lib/tianheng-ui.js +32 -18
- package/package.json +1 -1
- package/packages/FormMaking/GenerateForm.vue +4 -8
- package/packages/FormMaking/GenerateFormItem.vue +10 -15
- package/packages/FormMaking/index.js +1 -1
- package/packages/FormMaking/{Container.vue → index.vue} +2 -1
- package/packages/FormMaking/making.js +1 -1
- package/packages/Table/index.vue +64 -59
- package/packages/Table/search.vue +19 -1
- package/packages/TableMaking/custom/items/search/index.vue +158 -0
- package/packages/TableMaking/custom/items/tools/index.vue +49 -0
- package/packages/TableMaking/generate.js +5 -0
- package/packages/TableMaking/generateTable.vue +428 -0
- package/packages/TableMaking/util/Log.js +99 -0
- package/packages/TableMaking/util/axios.js +85 -0
- package/packages/TableMaking/util/index.js +448 -0
- package/packages/TableMaking/widgetConfig.vue +21 -14
- package/packages/TableMaking/widgetTable.vue +1 -0
- package/packages/index.js +4 -0
package/package.json
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
:models.sync="models"
|
18
18
|
:widget="item"
|
19
19
|
:slotKeys="slotKeys"
|
20
|
-
:remote="
|
20
|
+
:remote="remoteData"
|
21
21
|
:config="formJson.config"
|
22
22
|
:prop="item.type === 'grid' ? '' : item.model"
|
23
23
|
:componentsData="componentsData"
|
@@ -44,7 +44,7 @@
|
|
44
44
|
:models.sync="models"
|
45
45
|
:widget="item"
|
46
46
|
:slotKeys="slotKeys"
|
47
|
-
:remote="
|
47
|
+
:remote="remoteData"
|
48
48
|
:config="formJson.config"
|
49
49
|
:prop="item.type === 'grid' ? '' : item.model"
|
50
50
|
:componentsData="componentsData"
|
@@ -60,13 +60,9 @@
|
|
60
60
|
|
61
61
|
<script>
|
62
62
|
import GenetateFormItem from "./GenerateFormItem";
|
63
|
-
// import GenetateFormItemH5 from "./GenerateFormItemH5";
|
64
|
-
// import Vue from "vue";
|
65
|
-
// import { Form } from "vant";
|
66
|
-
// Vue.use(Form);
|
67
63
|
|
68
64
|
export default {
|
69
|
-
name: "
|
65
|
+
name: "thFormGenerate",
|
70
66
|
components: { GenetateFormItem },
|
71
67
|
props: {
|
72
68
|
data: {
|
@@ -75,7 +71,7 @@ export default {
|
|
75
71
|
return {};
|
76
72
|
}
|
77
73
|
},
|
78
|
-
|
74
|
+
remoteData: {
|
79
75
|
type: Object,
|
80
76
|
default: () => {
|
81
77
|
return {};
|
@@ -728,18 +728,14 @@ export default {
|
|
728
728
|
}
|
729
729
|
},
|
730
730
|
created() {
|
731
|
-
if (
|
732
|
-
this.widget.
|
733
|
-
this.
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
label: item[this.widget.options.props.label],
|
740
|
-
children: item[this.widget.options.props.children]
|
741
|
-
};
|
742
|
-
});
|
731
|
+
if (this.widget.options.remote) {
|
732
|
+
const remoteData = this.remote[this.widget.model] || [];
|
733
|
+
this.widget.options.remoteOptions = remoteData.map(item => {
|
734
|
+
return {
|
735
|
+
value: item[this.widget.options.props.value],
|
736
|
+
label: item[this.widget.options.props.label],
|
737
|
+
children: item[this.widget.options.props.children]
|
738
|
+
};
|
743
739
|
});
|
744
740
|
}
|
745
741
|
|
@@ -747,9 +743,8 @@ export default {
|
|
747
743
|
this.widget.type === "upload" &&
|
748
744
|
this.remote[this.widget.options.remoteFunc]
|
749
745
|
) {
|
750
|
-
this.remote[this.widget.options.remoteFunc]
|
751
|
-
|
752
|
-
});
|
746
|
+
const remoteData = this.remote[this.widget.options.remoteFunc] || {};
|
747
|
+
this.widget.options.remoteApi = remoteData;
|
753
748
|
}
|
754
749
|
},
|
755
750
|
mounted() {
|
@@ -3,7 +3,7 @@ import "./iconfont/iconfont.css";
|
|
3
3
|
// import "./styles/cover.scss";
|
4
4
|
import "./styles/index.scss";
|
5
5
|
|
6
|
-
import FormMaking from "./
|
6
|
+
import FormMaking from "./index.vue";
|
7
7
|
FormMaking.install = function(Vue) {
|
8
8
|
Vue.component(FormMaking.name, FormMaking);
|
9
9
|
};
|
@@ -387,7 +387,7 @@ import generateCode from "./util/generateCode.js";
|
|
387
387
|
import * as XLSX from "xlsx/xlsx.mjs";
|
388
388
|
|
389
389
|
export default {
|
390
|
-
name: "
|
390
|
+
name: "thFormMaking",
|
391
391
|
components: {
|
392
392
|
Draggable,
|
393
393
|
WidgetConfig,
|
@@ -526,6 +526,7 @@ export default {
|
|
526
526
|
deep: true,
|
527
527
|
handler: function(val) {
|
528
528
|
this.$emit("update:data", val);
|
529
|
+
this.$emit("on-change", val);
|
529
530
|
}
|
530
531
|
},
|
531
532
|
data(val) {
|
@@ -2,7 +2,7 @@ import "normalize.css/normalize.css";
|
|
2
2
|
import "./iconfont/iconfont.css";
|
3
3
|
// import "./styles/cover.scss";
|
4
4
|
import "./styles/index.scss";
|
5
|
-
import FormMaking from "./
|
5
|
+
import FormMaking from "./index.vue";
|
6
6
|
FormMaking.install = function(Vue) {
|
7
7
|
Vue.component(FormMaking.name, FormMaking);
|
8
8
|
};
|
package/packages/Table/index.vue
CHANGED
@@ -15,65 +15,63 @@
|
|
15
15
|
@row-dblclick="dblclick"
|
16
16
|
@selection-change="handleSelectionChange"
|
17
17
|
>
|
18
|
-
<template v-for="(item, index) in
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
>
|
54
|
-
<
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
</el-table-column>
|
76
|
-
</template>
|
18
|
+
<template v-for="(item, index) in widgetList">
|
19
|
+
<el-table-column
|
20
|
+
v-if="item.type"
|
21
|
+
:key="index"
|
22
|
+
:type="item.type"
|
23
|
+
:label="item.label"
|
24
|
+
width="50"
|
25
|
+
>
|
26
|
+
</el-table-column>
|
27
|
+
<el-table-column
|
28
|
+
v-else-if="item.children"
|
29
|
+
:key="index"
|
30
|
+
:prop="item.prop"
|
31
|
+
:label="item.label"
|
32
|
+
:width="item.width"
|
33
|
+
:align="item.align || 'left'"
|
34
|
+
:fixed="item.fixed || null"
|
35
|
+
:sortable="item.sortable"
|
36
|
+
:sort-method="item.sortMethod"
|
37
|
+
:show-overflow-tooltip="item.showOverflowTooltip"
|
38
|
+
>
|
39
|
+
<table-column :options="item.children"></table-column>
|
40
|
+
</el-table-column>
|
41
|
+
<el-table-column
|
42
|
+
v-else
|
43
|
+
:key="index"
|
44
|
+
:prop="item.prop"
|
45
|
+
:label="item.label"
|
46
|
+
:width="item.width"
|
47
|
+
:align="item.align || 'left'"
|
48
|
+
:fixed="item.fixed || null"
|
49
|
+
:sortable="item.sortable"
|
50
|
+
:sort-method="item.sortMethod"
|
51
|
+
:show-overflow-tooltip="item.showOverflowTooltip"
|
52
|
+
>
|
53
|
+
<template slot-scope="scope">
|
54
|
+
<slot
|
55
|
+
v-if="item.slot"
|
56
|
+
:name="item.slot"
|
57
|
+
:scope="scope"
|
58
|
+
:option="item"
|
59
|
+
/>
|
60
|
+
<span v-else-if="item.formatTime">
|
61
|
+
{{
|
62
|
+
handleFormatTime(
|
63
|
+
scope.row[item.alias || item.prop],
|
64
|
+
item.format
|
65
|
+
)
|
66
|
+
}}
|
67
|
+
</span>
|
68
|
+
<span v-else-if="item.format">
|
69
|
+
{{ item.format(scope.row) }}
|
70
|
+
</span>
|
71
|
+
<span v-else-if="item.alias">{{ scope.row[item.alias] }}</span>
|
72
|
+
<span v-else>{{ scope.row[item.prop] }}</span>
|
73
|
+
</template>
|
74
|
+
</el-table-column>
|
77
75
|
</template>
|
78
76
|
<template #empty>
|
79
77
|
<div>
|
@@ -200,6 +198,13 @@ export default {
|
|
200
198
|
data() {
|
201
199
|
return {};
|
202
200
|
},
|
201
|
+
computed: {
|
202
|
+
widgetList() {
|
203
|
+
return this.options.filter(item => {
|
204
|
+
return !item.hide;
|
205
|
+
});
|
206
|
+
}
|
207
|
+
},
|
203
208
|
methods: {
|
204
209
|
handleSelectionChange(currentRow) {
|
205
210
|
if (currentRow) {
|
@@ -81,11 +81,17 @@ export default {
|
|
81
81
|
default: () => {
|
82
82
|
return [];
|
83
83
|
}
|
84
|
+
},
|
85
|
+
data: {
|
86
|
+
type: Object,
|
87
|
+
default: () => {
|
88
|
+
return {};
|
89
|
+
}
|
84
90
|
}
|
85
91
|
},
|
86
92
|
data() {
|
87
93
|
return {
|
88
|
-
params:
|
94
|
+
params: this.data,
|
89
95
|
datePickerTypes: [
|
90
96
|
"year",
|
91
97
|
"month",
|
@@ -114,6 +120,15 @@ export default {
|
|
114
120
|
},
|
115
121
|
deep: true,
|
116
122
|
immediate: true
|
123
|
+
},
|
124
|
+
data(val) {
|
125
|
+
this.params = val;
|
126
|
+
},
|
127
|
+
params: {
|
128
|
+
deep: true,
|
129
|
+
handler(val) {
|
130
|
+
this.$emit("update:data", val);
|
131
|
+
}
|
117
132
|
}
|
118
133
|
},
|
119
134
|
methods: {
|
@@ -121,6 +136,9 @@ export default {
|
|
121
136
|
this.$emit("on-search", this.params);
|
122
137
|
},
|
123
138
|
doReset() {
|
139
|
+
this.options.map(item => {
|
140
|
+
this.$set(this.params, item.prop, item.defaultValue || "");
|
141
|
+
});
|
124
142
|
this.$emit("on-reset", this.params);
|
125
143
|
}
|
126
144
|
}
|
@@ -0,0 +1,158 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="th-table-search" v-if="options.length">
|
3
|
+
<div
|
4
|
+
v-for="(item, index) in options"
|
5
|
+
class="th-table-search-item"
|
6
|
+
:key="index"
|
7
|
+
>
|
8
|
+
<span class="th-table-search-item-title">{{ item.label }}:</span>
|
9
|
+
<el-input
|
10
|
+
v-if="item.type === 'input'"
|
11
|
+
v-model="params[item.prop]"
|
12
|
+
:style="{ width: `${item.width || '180'}px` }"
|
13
|
+
:placeholder="item.placeholder || '请输入'"
|
14
|
+
:disabled="item.disabled"
|
15
|
+
clearable
|
16
|
+
></el-input>
|
17
|
+
<el-date-picker
|
18
|
+
v-if="item.type === 'date'"
|
19
|
+
v-model="params[item.prop]"
|
20
|
+
:style="{ width: `${item.width || '180'}px` }"
|
21
|
+
:type="item.dateType || 'date'"
|
22
|
+
:format="item.format"
|
23
|
+
:value-format="item.valueFormat"
|
24
|
+
range-separator="至"
|
25
|
+
start-placeholder="开始日期"
|
26
|
+
end-placeholder="结束日期"
|
27
|
+
clearable
|
28
|
+
>
|
29
|
+
</el-date-picker>
|
30
|
+
<el-select
|
31
|
+
v-if="item.type === 'select'"
|
32
|
+
v-model="params[item.prop]"
|
33
|
+
:style="{ width: `${item.width || '180'}px` }"
|
34
|
+
:placeholder="item.placeholder || '请选择'"
|
35
|
+
:multiple="item.multiple"
|
36
|
+
:multiple-limit="item.multipleLimit"
|
37
|
+
:filterable="item.filterable"
|
38
|
+
:disabled="item.disabled"
|
39
|
+
clearable
|
40
|
+
>
|
41
|
+
<template v-if="item.remote">
|
42
|
+
<el-option
|
43
|
+
v-for="option in item.remoteData"
|
44
|
+
:key="option[item.props.value]"
|
45
|
+
:label="option[item.props.label]"
|
46
|
+
:value="option[item.props.value]"
|
47
|
+
>
|
48
|
+
</el-option>
|
49
|
+
</template>
|
50
|
+
<template v-else>
|
51
|
+
<el-option
|
52
|
+
v-for="option in item.staticData"
|
53
|
+
:key="option.value"
|
54
|
+
:label="option.label"
|
55
|
+
:value="option.value"
|
56
|
+
>
|
57
|
+
</el-option>
|
58
|
+
</template>
|
59
|
+
</el-select>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<el-button type="primary" icon="el-icon-search" plain @click="doSearch"
|
63
|
+
>查询</el-button
|
64
|
+
>
|
65
|
+
<el-button
|
66
|
+
type="primary"
|
67
|
+
icon="el-icon-refresh-right"
|
68
|
+
plain
|
69
|
+
@click="doReset"
|
70
|
+
>重置</el-button
|
71
|
+
>
|
72
|
+
</div>
|
73
|
+
</template>
|
74
|
+
|
75
|
+
<script>
|
76
|
+
export default {
|
77
|
+
props: {
|
78
|
+
options: {
|
79
|
+
type: Array,
|
80
|
+
default: () => {
|
81
|
+
return [];
|
82
|
+
}
|
83
|
+
},
|
84
|
+
data: {
|
85
|
+
type: Object,
|
86
|
+
default: () => {
|
87
|
+
return {};
|
88
|
+
}
|
89
|
+
}
|
90
|
+
},
|
91
|
+
data() {
|
92
|
+
return {
|
93
|
+
params: this.data,
|
94
|
+
datePickerTypes: [
|
95
|
+
"year",
|
96
|
+
"month",
|
97
|
+
"date",
|
98
|
+
"dates",
|
99
|
+
"week",
|
100
|
+
"datetime",
|
101
|
+
"datetimerange",
|
102
|
+
"daterange",
|
103
|
+
"monthrange"
|
104
|
+
]
|
105
|
+
};
|
106
|
+
},
|
107
|
+
watch: {
|
108
|
+
options: {
|
109
|
+
handler(newVal, oldVal) {
|
110
|
+
if (newVal && newVal.length) {
|
111
|
+
newVal.map(item => {
|
112
|
+
this.$set(this.params, item.prop, item.defaultValue || "");
|
113
|
+
});
|
114
|
+
}
|
115
|
+
},
|
116
|
+
deep: true,
|
117
|
+
immediate: true
|
118
|
+
},
|
119
|
+
data(val) {
|
120
|
+
this.params = val;
|
121
|
+
},
|
122
|
+
params: {
|
123
|
+
deep: true,
|
124
|
+
handler(val) {
|
125
|
+
this.$emit("update:data", val);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
},
|
129
|
+
methods: {
|
130
|
+
doSearch() {
|
131
|
+
this.$emit("on-search", this.params);
|
132
|
+
},
|
133
|
+
doReset() {
|
134
|
+
this.options.map(item => {
|
135
|
+
this.$set(this.params, item.prop, item.defaultValue || "");
|
136
|
+
});
|
137
|
+
this.$emit("on-reset", this.params);
|
138
|
+
}
|
139
|
+
}
|
140
|
+
};
|
141
|
+
</script>
|
142
|
+
|
143
|
+
<style lang="scss" scoped>
|
144
|
+
.th-table-search {
|
145
|
+
margin-bottom: 10px;
|
146
|
+
&-item {
|
147
|
+
display: inline-block;
|
148
|
+
margin-right: 15px;
|
149
|
+
margin-bottom: 10px;
|
150
|
+
&-title {
|
151
|
+
font-size: 14px;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
.th-table-search-item:last-child {
|
155
|
+
margin-right: 20px !important;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
</style>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="th-table-tools">
|
3
|
+
<el-button
|
4
|
+
v-for="(item, index) in options"
|
5
|
+
:key="index"
|
6
|
+
:style="item.style"
|
7
|
+
:type="item.type"
|
8
|
+
:icon="item.icon"
|
9
|
+
:disabled="item.disabled || disabled[item.act]"
|
10
|
+
:loading="item.loading"
|
11
|
+
@click="handleClick(item)"
|
12
|
+
>{{ item.name }}</el-button
|
13
|
+
>
|
14
|
+
</div>
|
15
|
+
</template>
|
16
|
+
|
17
|
+
<script>
|
18
|
+
export default {
|
19
|
+
name: "ThTableTools",
|
20
|
+
props: {
|
21
|
+
options: {
|
22
|
+
type: Array,
|
23
|
+
default: () => {
|
24
|
+
return [];
|
25
|
+
}
|
26
|
+
},
|
27
|
+
disabled: {
|
28
|
+
type: Object,
|
29
|
+
default: () => {
|
30
|
+
return {};
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
data() {
|
35
|
+
return {};
|
36
|
+
},
|
37
|
+
methods: {
|
38
|
+
handleClick(item) {
|
39
|
+
this.$emit("on-click", item);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
};
|
43
|
+
</script>
|
44
|
+
|
45
|
+
<style lang="less" scoped>
|
46
|
+
.th-table-tools {
|
47
|
+
margin-bottom: 10px;
|
48
|
+
}
|
49
|
+
</style>
|