2019-04-30 11:11:25 +08:00
|
|
|
export default {
|
2019-11-07 10:41:14 +08:00
|
|
|
title: '表格编辑',
|
|
|
|
body: {
|
|
|
|
type: 'form',
|
|
|
|
mode: 'horizontal',
|
|
|
|
api: '/api/mock2/form/saveForm?waitSeconds=2',
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
type: 'submit',
|
|
|
|
label: '提交',
|
|
|
|
primary: true
|
|
|
|
}
|
|
|
|
],
|
2021-06-07 10:09:55 +08:00
|
|
|
body: [
|
2022-07-01 10:06:33 +08:00
|
|
|
{
|
|
|
|
type: 'input-table',
|
|
|
|
name: 'tableAffixHeader',
|
|
|
|
label: '头部固定',
|
|
|
|
affixHeader: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
name: 'aa',
|
|
|
|
label: 'AA',
|
|
|
|
type: 'input-text'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'cc',
|
|
|
|
label: 'CC',
|
|
|
|
type: 'select',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'AA',
|
|
|
|
value: 'aa'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'CC',
|
|
|
|
value: 'cc'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
|
|
|
type: 'combo',
|
|
|
|
name: 'colors',
|
|
|
|
label: 'Combo',
|
|
|
|
multiple: true,
|
|
|
|
draggable: true,
|
|
|
|
multiLine: true,
|
|
|
|
value: [
|
|
|
|
{
|
|
|
|
color: 'green',
|
|
|
|
name: '颜色'
|
|
|
|
}
|
2019-04-30 11:11:25 +08:00
|
|
|
],
|
2021-06-07 10:09:55 +08:00
|
|
|
items: [
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-color',
|
|
|
|
name: 'color',
|
|
|
|
clearable: false
|
2019-11-07 10:41:14 +08:00
|
|
|
},
|
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-text',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'name',
|
|
|
|
placeholder: '说明文字'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'static',
|
|
|
|
label: '当前值',
|
|
|
|
tpl: '<pre>${colors|json}</pre>'
|
|
|
|
},
|
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-table',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'colors',
|
|
|
|
label: 'Table',
|
|
|
|
draggable: true,
|
2020-08-18 10:07:26 +08:00
|
|
|
addable: true,
|
|
|
|
removable: true,
|
|
|
|
needConfirm: false,
|
2019-11-07 10:41:14 +08:00
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
label: 'Color',
|
|
|
|
name: 'color',
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-color',
|
|
|
|
quickEdit: false
|
2019-11-07 10:41:14 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '说明文字',
|
2020-08-18 10:50:06 +08:00
|
|
|
name: 'name'
|
2019-11-07 10:41:14 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'control',
|
|
|
|
body: {
|
|
|
|
type: 'button',
|
|
|
|
label: 'Table2新增一行',
|
|
|
|
target: 'table2',
|
|
|
|
actionType: 'add'
|
|
|
|
}
|
2019-11-07 10:41:14 +08:00
|
|
|
},
|
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-table',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'table2',
|
|
|
|
label: 'Table2',
|
|
|
|
editable: true,
|
|
|
|
addable: true,
|
|
|
|
removable: true,
|
|
|
|
draggable: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
name: 'a',
|
|
|
|
label: 'A'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'b',
|
|
|
|
label: 'B',
|
|
|
|
quickEdit: {
|
|
|
|
type: 'select',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'A',
|
|
|
|
value: 'a'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'B',
|
|
|
|
value: 'b'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-04-30 11:11:25 +08:00
|
|
|
|
2019-11-07 10:41:14 +08:00
|
|
|
{
|
2021-06-07 10:09:55 +08:00
|
|
|
type: 'input-table',
|
2019-11-07 10:41:14 +08:00
|
|
|
name: 'table3',
|
|
|
|
label: 'Table3(指定第2列只有update时能编辑)',
|
|
|
|
editable: true,
|
|
|
|
addable: true,
|
|
|
|
removable: true,
|
|
|
|
draggable: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
name: 'a',
|
|
|
|
label: 'A',
|
|
|
|
quickEdit: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'b',
|
|
|
|
label: 'B',
|
|
|
|
quickEdit: false,
|
|
|
|
quickEditOnUpdate: {
|
|
|
|
type: 'select',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'A',
|
|
|
|
value: 'a'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'B',
|
|
|
|
value: 'b'
|
|
|
|
}
|
|
|
|
]
|
2019-04-30 11:11:25 +08:00
|
|
|
}
|
2019-11-07 10:41:14 +08:00
|
|
|
}
|
2019-04-30 11:11:25 +08:00
|
|
|
]
|
2022-07-01 10:06:33 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
type: 'input-table',
|
|
|
|
name: 'table5',
|
|
|
|
label: '内容自适应',
|
|
|
|
autoFillHeight: true,
|
|
|
|
tableContentClassName: 'max-h-60',
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
name: 'aa',
|
|
|
|
label: 'AA',
|
|
|
|
type: 'input-text'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'cc',
|
|
|
|
label: 'CC',
|
|
|
|
type: 'select',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'AA',
|
|
|
|
value: 'aa'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'CC',
|
|
|
|
value: 'cc'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2019-11-07 10:41:14 +08:00
|
|
|
}
|
2022-07-01 10:06:33 +08:00
|
|
|
],
|
|
|
|
data: {
|
|
|
|
table5: Array.from({length: 20}, (_, index) => ({
|
|
|
|
aa: index % 2 == 0 ? 'hello' : 'hi',
|
|
|
|
cc: index % 2 == 0 ? 'aa' : 'cc'
|
|
|
|
})),
|
|
|
|
tableAffixHeader: Array.from({length: 5}, (_, index) => ({
|
|
|
|
aa: index % 2 == 0 ? 'hello' : 'hi',
|
|
|
|
cc: index % 2 == 0 ? 'aa' : 'cc'
|
|
|
|
}))
|
|
|
|
}
|
2019-11-07 10:41:14 +08:00
|
|
|
}
|
2019-04-30 11:11:25 +08:00
|
|
|
};
|