@houaoran/designer 1.0.0
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/LICENSE +21 -0
- package/README.md +98 -0
- package/dist/components.es.js +11424 -0
- package/dist/components.umd.js +878 -0
- package/dist/index.es.js +39113 -0
- package/dist/index.umd.js +1187 -0
- package/package.json +96 -0
- package/src/components/DragBox.vue +49 -0
- package/src/components/DragTool.vue +235 -0
- package/src/components/EventConfig.vue +557 -0
- package/src/components/FcDesigner.vue +2569 -0
- package/src/components/FcTitle.vue +69 -0
- package/src/components/FetchConfig.vue +415 -0
- package/src/components/FieldInput.vue +371 -0
- package/src/components/FnConfig.vue +315 -0
- package/src/components/FnEditor.vue +327 -0
- package/src/components/FnInput.vue +103 -0
- package/src/components/FormLabel.vue +47 -0
- package/src/components/HtmlEditor.vue +125 -0
- package/src/components/JsonPreview.vue +146 -0
- package/src/components/OptionsTextInput.vue +151 -0
- package/src/components/PropsInput.vue +72 -0
- package/src/components/Required.vue +75 -0
- package/src/components/Row.vue +26 -0
- package/src/components/SignaturePad.vue +176 -0
- package/src/components/Struct.vue +153 -0
- package/src/components/StructEditor.vue +121 -0
- package/src/components/StructTree.vue +209 -0
- package/src/components/TableOptions.vue +164 -0
- package/src/components/TreeOptions.vue +167 -0
- package/src/components/TypeSelect.vue +144 -0
- package/src/components/Validate.vue +302 -0
- package/src/components/ValueInput.vue +89 -0
- package/src/components/Warning.vue +46 -0
- package/src/components/ai/AiPanel.vue +1122 -0
- package/src/components/ai/MarkdownRenderer.vue +548 -0
- package/src/components/language/LanguageConfig.vue +174 -0
- package/src/components/language/LanguageInput.vue +191 -0
- package/src/components/style/BackgroundInput.vue +315 -0
- package/src/components/style/BorderInput.vue +242 -0
- package/src/components/style/BoxSizeInput.vue +166 -0
- package/src/components/style/BoxSpaceInput.vue +269 -0
- package/src/components/style/ColorInput.vue +90 -0
- package/src/components/style/ConfigItem.vue +118 -0
- package/src/components/style/FontInput.vue +197 -0
- package/src/components/style/PositionInput.vue +146 -0
- package/src/components/style/RadiusInput.vue +164 -0
- package/src/components/style/ShadowContent.vue +335 -0
- package/src/components/style/ShadowInput.vue +91 -0
- package/src/components/style/SizeInput.vue +118 -0
- package/src/components/style/StyleConfig.vue +307 -0
- package/src/components/table/Table.vue +252 -0
- package/src/components/table/TableView.vue +1058 -0
- package/src/components/tableForm/TableForm.vue +471 -0
- package/src/components/tableForm/TableFormColumnView.vue +103 -0
- package/src/components/tableForm/TableFormView.vue +46 -0
- package/src/components/tree/FcTree.vue +713 -0
- package/src/components/tree/FcTreeNode.vue +216 -0
- package/src/config/base/field.js +43 -0
- package/src/config/base/form.js +132 -0
- package/src/config/base/style.js +26 -0
- package/src/config/base/validate.js +15 -0
- package/src/config/index.js +70 -0
- package/src/config/menu.js +24 -0
- package/src/config/rule/alert.js +45 -0
- package/src/config/rule/button.js +49 -0
- package/src/config/rule/card.js +40 -0
- package/src/config/rule/cascader.js +121 -0
- package/src/config/rule/checkbox.js +68 -0
- package/src/config/rule/col.js +86 -0
- package/src/config/rule/collapse.js +30 -0
- package/src/config/rule/collapseItem.js +36 -0
- package/src/config/rule/color.js +53 -0
- package/src/config/rule/date.js +66 -0
- package/src/config/rule/dateRange.js +60 -0
- package/src/config/rule/divider.js +31 -0
- package/src/config/rule/editor.js +31 -0
- package/src/config/rule/group.js +86 -0
- package/src/config/rule/html.js +43 -0
- package/src/config/rule/image.js +32 -0
- package/src/config/rule/input.js +62 -0
- package/src/config/rule/number.js +49 -0
- package/src/config/rule/password.js +52 -0
- package/src/config/rule/radio.js +43 -0
- package/src/config/rule/rate.js +44 -0
- package/src/config/rule/row.js +46 -0
- package/src/config/rule/select.js +70 -0
- package/src/config/rule/signaturePad.js +59 -0
- package/src/config/rule/slider.js +53 -0
- package/src/config/rule/space.js +44 -0
- package/src/config/rule/subForm.js +47 -0
- package/src/config/rule/switch.js +46 -0
- package/src/config/rule/tabPane.js +29 -0
- package/src/config/rule/table.js +37 -0
- package/src/config/rule/tableForm.js +115 -0
- package/src/config/rule/tableFormColumn.js +55 -0
- package/src/config/rule/tabs.js +38 -0
- package/src/config/rule/tag.js +69 -0
- package/src/config/rule/text.js +41 -0
- package/src/config/rule/textarea.js +63 -0
- package/src/config/rule/time.js +58 -0
- package/src/config/rule/timeRange.js +49 -0
- package/src/config/rule/title.js +37 -0
- package/src/config/rule/transfer.js +59 -0
- package/src/config/rule/tree.js +70 -0
- package/src/config/rule/treeSelect.js +77 -0
- package/src/config/rule/upload.js +107 -0
- package/src/form/index.js +19 -0
- package/src/index.js +173 -0
- package/src/locale/en.js +981 -0
- package/src/locale/zh-cn.js +983 -0
- package/src/style/fonts/fc-icons.woff +0 -0
- package/src/style/icon.css +1052 -0
- package/src/style/index.css +836 -0
- package/src/utils/form.js +9 -0
- package/src/utils/highlight/highlight.min.js +307 -0
- package/src/utils/highlight/javascript.min.js +80 -0
- package/src/utils/highlight/style.css +1 -0
- package/src/utils/highlight/xml.min.js +29 -0
- package/src/utils/hintStubs.js +120 -0
- package/src/utils/index.js +544 -0
- package/src/utils/jsonDiff.js +173 -0
- package/src/utils/locale.js +23 -0
- package/src/utils/message.js +19 -0
- package/src/utils/template.js +105 -0
- package/types/index.d.ts +575 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fc-table-form" :class="{ '_fc-disabled': disabled, '_fc-undeletable': !deletable }">
|
|
3
|
+
<component
|
|
4
|
+
:is="Form"
|
|
5
|
+
:option="options"
|
|
6
|
+
:rule="rule"
|
|
7
|
+
:extendOption="true"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
@change="formChange"
|
|
10
|
+
v-model:api="fapi"
|
|
11
|
+
@emit-event="$emit"
|
|
12
|
+
></component>
|
|
13
|
+
<el-button link type="primary" class="fc-clock" v-if="addable && (!max || max > this.trs.length)" @click="addRaw(true)"
|
|
14
|
+
><i class="fc-icon icon-add-circle" style="font-weight: 700"></i>
|
|
15
|
+
{{ formCreateInject.t('add') || '添加' }}
|
|
16
|
+
</el-button>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import {markRaw, reactive} from 'vue';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: 'TableForm',
|
|
25
|
+
emits: ['change', 'add', 'delete', 'update:modelValue'],
|
|
26
|
+
props: {
|
|
27
|
+
formCreateInject: Object,
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => [],
|
|
31
|
+
},
|
|
32
|
+
columns: {
|
|
33
|
+
type: Array,
|
|
34
|
+
required: true,
|
|
35
|
+
default: () => [],
|
|
36
|
+
},
|
|
37
|
+
filterEmptyColumn: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: true,
|
|
40
|
+
},
|
|
41
|
+
deletable: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
addable: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
options: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () =>
|
|
52
|
+
reactive({
|
|
53
|
+
submitBtn: false,
|
|
54
|
+
resetBtn: false,
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
max: Number,
|
|
58
|
+
min: Number,
|
|
59
|
+
disabled: Boolean,
|
|
60
|
+
showIndex: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
beforeRemove: Function,
|
|
65
|
+
},
|
|
66
|
+
watch: {
|
|
67
|
+
modelValue: {
|
|
68
|
+
handler() {
|
|
69
|
+
this.updateTable();
|
|
70
|
+
},
|
|
71
|
+
deep: true,
|
|
72
|
+
},
|
|
73
|
+
'formCreateInject.preview': function () {
|
|
74
|
+
this.updateEmptyColspan();
|
|
75
|
+
},
|
|
76
|
+
deletable() {
|
|
77
|
+
this.updateEmptyColspan();
|
|
78
|
+
},
|
|
79
|
+
showIndex() {
|
|
80
|
+
this.rebuildTable();
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
rule: [],
|
|
86
|
+
trs: [],
|
|
87
|
+
fapi: {},
|
|
88
|
+
Form: markRaw(this.formCreateInject.form.$form()),
|
|
89
|
+
copyTrs: '',
|
|
90
|
+
oldValue: '',
|
|
91
|
+
emptyRule: {
|
|
92
|
+
type: 'tr',
|
|
93
|
+
_isEmpty: true,
|
|
94
|
+
native: true,
|
|
95
|
+
subRule: true,
|
|
96
|
+
children: [
|
|
97
|
+
{
|
|
98
|
+
type: 'td',
|
|
99
|
+
style: {
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
},
|
|
102
|
+
native: true,
|
|
103
|
+
subRule: true,
|
|
104
|
+
props: {
|
|
105
|
+
colspan: 0,
|
|
106
|
+
},
|
|
107
|
+
children: [this.formCreateInject.t('dataEmpty') || '暂无数据'],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
getColspan() {
|
|
115
|
+
const visibleCols = this.columns.filter(column => column.hidden !== true).length;
|
|
116
|
+
let extra = this.formCreateInject.preview || !this.deletable ? 1 : 2;
|
|
117
|
+
if (this.showIndex === false) {
|
|
118
|
+
extra -= 1;
|
|
119
|
+
}
|
|
120
|
+
return visibleCols + extra;
|
|
121
|
+
},
|
|
122
|
+
updateEmptyColspan() {
|
|
123
|
+
this.emptyRule.children[0].props.colspan = this.getColspan();
|
|
124
|
+
},
|
|
125
|
+
rebuildTable() {
|
|
126
|
+
const oldValue = this.oldValue;
|
|
127
|
+
this.loadRule();
|
|
128
|
+
this.updateEmptyColspan();
|
|
129
|
+
this.trs.splice(0, this.trs.length);
|
|
130
|
+
this.oldValue = '';
|
|
131
|
+
this.updateTable();
|
|
132
|
+
this.oldValue = oldValue;
|
|
133
|
+
},
|
|
134
|
+
formChange() {
|
|
135
|
+
this.updateValue();
|
|
136
|
+
},
|
|
137
|
+
updateValue() {
|
|
138
|
+
const value = this.trs
|
|
139
|
+
.map((tr, idx) => {
|
|
140
|
+
return {
|
|
141
|
+
...(this.modelValue[idx] || {}),
|
|
142
|
+
...this.fapi.getChildrenFormData(tr),
|
|
143
|
+
};
|
|
144
|
+
})
|
|
145
|
+
.filter(v => {
|
|
146
|
+
if (!this.filterEmptyColumn) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (v === undefined || v === null) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
let flag = false;
|
|
153
|
+
Object.keys(v).forEach(k => {
|
|
154
|
+
flag = flag || (v[k] !== undefined && v[k] !== '' && v[k] !== null);
|
|
155
|
+
});
|
|
156
|
+
return flag;
|
|
157
|
+
});
|
|
158
|
+
const str = JSON.stringify(value);
|
|
159
|
+
if (str !== this.oldValue) {
|
|
160
|
+
this.oldValue = str;
|
|
161
|
+
this.$emit('update:modelValue', value);
|
|
162
|
+
this.$emit('change', value);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
setRawData(idx, formData) {
|
|
166
|
+
const raw = this.trs[idx];
|
|
167
|
+
this.fapi.setChildrenFormData(raw, formData, true);
|
|
168
|
+
},
|
|
169
|
+
updateTable() {
|
|
170
|
+
const str = JSON.stringify(this.modelValue);
|
|
171
|
+
if (this.oldValue === str) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.oldValue = str;
|
|
175
|
+
this.trs = this.trs.splice(0, this.modelValue.length);
|
|
176
|
+
if (!this.modelValue.length) {
|
|
177
|
+
this.addEmpty();
|
|
178
|
+
} else {
|
|
179
|
+
this.clearEmpty();
|
|
180
|
+
}
|
|
181
|
+
this.modelValue.forEach((data, idx) => {
|
|
182
|
+
if (!this.trs[idx]) {
|
|
183
|
+
this.addRaw();
|
|
184
|
+
}
|
|
185
|
+
this.setRawData(idx, data || {});
|
|
186
|
+
});
|
|
187
|
+
this.rule[0].children[1].children = this.trs;
|
|
188
|
+
},
|
|
189
|
+
addEmpty() {
|
|
190
|
+
if (this.trs.length) {
|
|
191
|
+
this.trs.splice(0, this.trs.length);
|
|
192
|
+
}
|
|
193
|
+
this.trs.push(this.emptyRule);
|
|
194
|
+
},
|
|
195
|
+
clearEmpty() {
|
|
196
|
+
if (this.trs[0] && this.trs[0]._isEmpty) {
|
|
197
|
+
this.trs.splice(0, 1);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
async delRaw(idx) {
|
|
201
|
+
if (this.disabled || !this.deletable || (this.min > 0 && this.trs.length <= this.min)) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
// 检查是否有删除前置回调
|
|
205
|
+
if (this.beforeRemove) {
|
|
206
|
+
const result = await this.beforeRemove({index: idx, row: this.modelValue[idx] || {}});
|
|
207
|
+
// 如果回调返回 false,则停止删除
|
|
208
|
+
if (result === false) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this.trs.splice(idx, 1);
|
|
213
|
+
this.updateValue();
|
|
214
|
+
if (this.trs.length) {
|
|
215
|
+
this.trs.forEach(tr => this.updateRaw(tr));
|
|
216
|
+
} else {
|
|
217
|
+
this.addEmpty();
|
|
218
|
+
}
|
|
219
|
+
this.$emit('delete', idx);
|
|
220
|
+
},
|
|
221
|
+
addRaw(flag) {
|
|
222
|
+
if (flag && this.disabled) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const tr = this.formCreateInject.form.parseJson(this.copyTrs)[0];
|
|
226
|
+
if (this.trs.length === 1 && this.trs[0]._isEmpty) {
|
|
227
|
+
this.trs.splice(0, 1);
|
|
228
|
+
}
|
|
229
|
+
this.trs.push(tr);
|
|
230
|
+
this.updateRaw(tr);
|
|
231
|
+
if (flag) {
|
|
232
|
+
this.$emit('add', this.trs.length);
|
|
233
|
+
this.updateValue();
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
updateRaw(tr) {
|
|
237
|
+
const idx = this.trs.indexOf(tr);
|
|
238
|
+
if (this.showIndex !== false) {
|
|
239
|
+
tr.children[0].props.innerText = idx + 1;
|
|
240
|
+
}
|
|
241
|
+
tr.children[tr.children.length - 1].children[0].props.onClick = () => {
|
|
242
|
+
this.delRaw(idx);
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
loadRule() {
|
|
246
|
+
const header = [];
|
|
247
|
+
const body = [];
|
|
248
|
+
if (this.showIndex !== false) {
|
|
249
|
+
header.push({
|
|
250
|
+
type: 'th',
|
|
251
|
+
native: true,
|
|
252
|
+
class: '_fc-tf-head-idx',
|
|
253
|
+
});
|
|
254
|
+
body.push({
|
|
255
|
+
type: 'td',
|
|
256
|
+
class: '_fc-tf-idx',
|
|
257
|
+
native: true,
|
|
258
|
+
props: {
|
|
259
|
+
innerText: '0',
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
this.columns.forEach(column => {
|
|
264
|
+
if (column.hidden !== true) {
|
|
265
|
+
header.push({
|
|
266
|
+
type: 'th',
|
|
267
|
+
native: true,
|
|
268
|
+
style: {...(column.style || {}), textAlign: column.align || 'center'},
|
|
269
|
+
class: column.required ? '_fc-tf-head-required' : '',
|
|
270
|
+
props: {
|
|
271
|
+
innerText: column.label || '',
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
body.push({
|
|
275
|
+
type: 'td',
|
|
276
|
+
native: true,
|
|
277
|
+
children: [...(column.rule || [])],
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
header.push({
|
|
282
|
+
type: 'th',
|
|
283
|
+
native: true,
|
|
284
|
+
class: '_fc-tf-edit fc-clock',
|
|
285
|
+
props: {
|
|
286
|
+
innerText: this.formCreateInject.t('operation') || '操作',
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
body.push({
|
|
290
|
+
type: 'td',
|
|
291
|
+
native: true,
|
|
292
|
+
class: '_fc-tf-btn fc-clock',
|
|
293
|
+
children: [
|
|
294
|
+
{
|
|
295
|
+
type: 'i',
|
|
296
|
+
native: true,
|
|
297
|
+
class: 'fc-icon icon-delete',
|
|
298
|
+
props: {},
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
});
|
|
302
|
+
this.copyTrs = this.formCreateInject.form.toJson([
|
|
303
|
+
{
|
|
304
|
+
type: 'tr',
|
|
305
|
+
native: true,
|
|
306
|
+
subRule: true,
|
|
307
|
+
children: body,
|
|
308
|
+
},
|
|
309
|
+
]);
|
|
310
|
+
this.rule = [
|
|
311
|
+
{
|
|
312
|
+
type: 'table',
|
|
313
|
+
native: true,
|
|
314
|
+
class: '_fc-tf-table',
|
|
315
|
+
props: {
|
|
316
|
+
border: '1',
|
|
317
|
+
cellspacing: '0',
|
|
318
|
+
cellpadding: '0',
|
|
319
|
+
},
|
|
320
|
+
children: [
|
|
321
|
+
{
|
|
322
|
+
type: 'thead',
|
|
323
|
+
native: true,
|
|
324
|
+
children: [
|
|
325
|
+
{
|
|
326
|
+
type: 'tr',
|
|
327
|
+
native: true,
|
|
328
|
+
children: header,
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
type: 'tbody',
|
|
334
|
+
native: true,
|
|
335
|
+
children: this.trs,
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
];
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
created() {
|
|
343
|
+
this.loadRule();
|
|
344
|
+
this.updateEmptyColspan();
|
|
345
|
+
},
|
|
346
|
+
mounted() {
|
|
347
|
+
this.updateTable();
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
</script>
|
|
351
|
+
|
|
352
|
+
<style>
|
|
353
|
+
._fc-table-form {
|
|
354
|
+
width: 100%;
|
|
355
|
+
color: #666666;
|
|
356
|
+
}
|
|
357
|
+
._fc-table-form .form-create,
|
|
358
|
+
._fc-table-form .form-create-m {
|
|
359
|
+
overflow: auto;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
._fc-table-form .form-create td .el-form-item {
|
|
363
|
+
margin-bottom: 1px;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
._fc-table-form .form-create td .el-form-item.is-error {
|
|
367
|
+
margin-bottom: 22px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
._fc-table-form .el-form-item__label,
|
|
371
|
+
._fc-table-form .van-field__label {
|
|
372
|
+
display: none !important;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
._fc-table-form .el-form-item__content {
|
|
376
|
+
display: flex;
|
|
377
|
+
margin-left: 0px !important;
|
|
378
|
+
width: 100% !important;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
._fc-tf-head-idx,
|
|
382
|
+
._fc-tf-idx {
|
|
383
|
+
width: 40px;
|
|
384
|
+
min-width: 40px;
|
|
385
|
+
font-weight: 500;
|
|
386
|
+
text-align: center;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
._fc-tf-edit,
|
|
390
|
+
._fc-tf-btn {
|
|
391
|
+
width: 70px;
|
|
392
|
+
min-width: 70px;
|
|
393
|
+
text-align: center;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
._fc-tf-btn .fc-icon {
|
|
397
|
+
cursor: pointer;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
._fc-table-form._fc-disabled ._fc-tf-btn .fc-icon,
|
|
401
|
+
._fc-table-form._fc-disabled > .el-button {
|
|
402
|
+
cursor: not-allowed;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
._fc-tf-table {
|
|
406
|
+
width: 100%;
|
|
407
|
+
height: 100%;
|
|
408
|
+
overflow: hidden;
|
|
409
|
+
table-layout: fixed;
|
|
410
|
+
border: 1px solid #ebeef5;
|
|
411
|
+
border-bottom: 0 none;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
._fc-table-form ._fc-tf-table > thead > tr > th {
|
|
415
|
+
border: 0 none;
|
|
416
|
+
border-bottom: 1px solid #ebeef5;
|
|
417
|
+
height: 40px;
|
|
418
|
+
font-weight: 500;
|
|
419
|
+
padding: 0 5px;
|
|
420
|
+
box-sizing: border-box;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
._fc-table-form ._fc-tf-table > thead > tr > th + th {
|
|
424
|
+
border-left: 1px solid #ebeef5;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
._fc-table-form tr {
|
|
428
|
+
min-height: 50px;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
._fc-table-form ._fc-read-view {
|
|
432
|
+
text-align: center;
|
|
433
|
+
width: 100%;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
._fc-table-form td {
|
|
437
|
+
padding: 5px;
|
|
438
|
+
min-height: 50px;
|
|
439
|
+
min-width: 80px;
|
|
440
|
+
position: relative;
|
|
441
|
+
box-sizing: border-box;
|
|
442
|
+
overflow-wrap: break-word;
|
|
443
|
+
/*white-space: nowrap;*/
|
|
444
|
+
overflow: hidden;
|
|
445
|
+
border: 0 none;
|
|
446
|
+
border-bottom: 1px solid #ebeef5;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
._fc-table-form td + td {
|
|
450
|
+
border-left: 1px solid #ebeef5;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
._fc-tf-table .el-input-number,
|
|
454
|
+
._fc-tf-table .el-select,
|
|
455
|
+
._fc-tf-table .el-slider,
|
|
456
|
+
._fc-tf-table .el-cascader,
|
|
457
|
+
._fc-tf-table .el-date-editor {
|
|
458
|
+
width: 100%;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
._fc-tf-head-required:before {
|
|
462
|
+
content: '*';
|
|
463
|
+
color: #f56c6c;
|
|
464
|
+
margin-right: 4px;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
._fc-undeletable ._fc-tf-edit,
|
|
468
|
+
._fc-undeletable ._fc-tf-btn {
|
|
469
|
+
display: none !important;
|
|
470
|
+
}
|
|
471
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-tf-col" :style="colStyle">
|
|
3
|
+
<div class="_fd-tf-title" :style="{textAlign: align || 'center'}">
|
|
4
|
+
<span v-if="required" class="_fd-tf-required">*</span>{{ label || '' }}
|
|
5
|
+
</div>
|
|
6
|
+
<div class="_fd-tf-con">
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import is from '@form-create/utils/lib/type';
|
|
14
|
+
import {defineComponent} from 'vue';
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: 'TableFormColumnView',
|
|
18
|
+
props: {
|
|
19
|
+
label: String,
|
|
20
|
+
align: String,
|
|
21
|
+
width: [Number, String],
|
|
22
|
+
color: String,
|
|
23
|
+
required: Boolean,
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
colStyle() {
|
|
27
|
+
const w = this.width;
|
|
28
|
+
const style = {width: is.Number(w) ? `${w}px` : ((!w || w === 'auto') ? '180px' : w)};
|
|
29
|
+
if (this.color) {
|
|
30
|
+
style.color = this.color;
|
|
31
|
+
}
|
|
32
|
+
return style;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
|
|
43
|
+
._fd-tf-col ._fd-tf-con .el-form-item {
|
|
44
|
+
margin-bottom: 1px !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
._fd-tf-col {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
width: 180px;
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
._fd-tf-con .el-form-item__label, ._fd-tf-con .van-field__label {
|
|
56
|
+
display: none !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
._fd-tf-con {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex: 1;
|
|
62
|
+
width: 100%;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
._fd-tf-con .el-form-item__content {
|
|
66
|
+
display: flex;
|
|
67
|
+
margin-left: 0px !important;
|
|
68
|
+
width: 100% !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
._fd-tf-title {
|
|
73
|
+
height: 40px;
|
|
74
|
+
border-bottom: 1px solid #ebeef5;
|
|
75
|
+
margin-bottom: 0px;
|
|
76
|
+
padding: 0 5px;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
._fd-tf-required {
|
|
81
|
+
color: #f56c6c;
|
|
82
|
+
margin-right: 4px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
._fd-tf-con ._fc-l-item {
|
|
86
|
+
display: flex;
|
|
87
|
+
width: 100%;
|
|
88
|
+
margin-top: 4px;
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
._fd-tf-con ._fc-l-item > * {
|
|
93
|
+
display: none !important;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
._fd-tf-con .el-input-number, ._fd-tf-con .el-select, ._fd-tf-con .el-slider, ._fd-tf-con .el-cascader, ._fd-tf-con .el-date-editor {
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
._fd-tf-col:has(._fd-tf-col) {
|
|
101
|
+
width: auto !important;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="_fd-table-form">
|
|
3
|
+
<div class="_fd-tf-wrap" v-if="$slots.default">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="_fc-child-empty" v-else></div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import {defineComponent} from 'vue';
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: 'TableFormView',
|
|
15
|
+
data() {
|
|
16
|
+
return {};
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
._fd-table-form {
|
|
23
|
+
min-height: 130px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
border: 1px solid #ECECEC;
|
|
26
|
+
background: #fff;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
._fc-child-empty {
|
|
30
|
+
min-height: 130px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
._fd-tf-wrap {
|
|
34
|
+
display: flex;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
._fd-tf-wrap > ._fd-drag-tool {
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
display: flex;
|
|
41
|
+
margin: 2px;
|
|
42
|
+
height: auto;
|
|
43
|
+
overflow: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
</style>
|