App4Update
# 一、简介
App4Update 是基于 BasicForm 和 App1 封装的自带保存功能的修改功能组件。
# 二、效果
http://210.12.53.106:8888/outer/test/App4Update (opens new window)
# 三、代码示例
<template>
<app4-add ref="app4Update" :mainGrid="mainGrid" :detailGridList="detailGridList" @tSaveBefore="tSaveBefore" />
</template>
<script>
<template>
<app4-update
ref="app4Update"
:formData="formData"
:tableData="tableData"
:mainGrid="mainGrid"
:detailGridList="detailGridList"
@tSaveBefore="tSaveBefore" />
</template>
<script>
export default {
name: 'TestApp4Update',
data () {
return {
formData: {},
tableData: [],
mainGrid: {
colSpan: 6,
columns: [
{
title: '编码',
dataIndex: 'code',
xtype: 'textfield'
},
{
title: '名称',
dataIndex: 'name',
xtype: 'textfield'
}
],
saveUrl: 'https://postman-echo.com/post'
},
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
}
]
}
]
}
},
created () {
this.formData = { code: '1', name: '1' }
this.tableData = [
{ code: '1', name: '1' },
{ code: '2', name: '2' }
]
},
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99