App4Add
# 一、简介
App4Add 是基于 BasicForm 和 App1 封装的自带保存功能的增加功能组件。
# 二、效果
http://210.12.53.106:8888/outer/test/App4Add (opens new window)
# 三、代码示例
<template>
<app4-add ref="app4add" :mainGrid="mainGrid" :detailGridList="detailGridList" @tSaveBefore="tSaveBefore" />
</template>
<script>
export default {
name: 'TestApp4Add',
data () {
return {
mainGrid: {
colSpan: 6,
columns: [
{
title: '编码',
dataIndex: 'code',
xtype: 'textfield'
},
{
title: '名称',
dataIndex: 'name',
xtype: 'textfield'
}
],
saveUrl: '/.../batchsave'
},
detailGridList: [
{
name: 'detailTable1',
columns: [
{
title: '编码',
dataIndex: 'code',
xtype: 'textfield',
allowBlank: false
},
{
title: '名称',
dataIndex: 'name',
xtype: 'textfield'
}
],
isEditGrid: true,
isCheckBoxModel: true,
rowNumber: true,
autoRetrieve: false,
defaultOption: true,
tbar: [
{
text: '增加',
iconCls: 'add'
},
{
text: '删除',
iconCls: 'del'
}
],
findForm: [
{
title: '编码',
dataIndex: 'code',
xtype: 'textfield',
width: 150
}
]
}
]
}
},
methods: {
tSaveBefore ({ data, proData }) {
const { formData, detailTableData0: detailTableData } = data
if (detailTableData.length !== 0) {
formData.detailList = detailTableData
}
proData(formData)
}
}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
76
77
78
79
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
76
77
78
79