Merge tag 'd2_crud_example' into develop

no message


Former-commit-id: cde740aa77dcc23e8bb123754abe5511d55593f7 [formerly a0fd060bc745d8b3721e147ee184daef1b30ebf9] [formerly cde740aa77dcc23e8bb123754abe5511d55593f7 [formerly a0fd060bc745d8b3721e147ee184daef1b30ebf9] [formerly cde740aa77dcc23e8bb123754abe5511d55593f7 [formerly a0fd060bc745d8b3721e147ee184daef1b30ebf9] [formerly a0fd060bc745d8b3721e147ee184daef1b30ebf9 [formerly eeb3972c705967609aa6a54bb7be0a4094f84aac [formerly 43edd00fd6fee2ba167cc95ea6177f527d0e9807]]]]]
Former-commit-id: 79b54c1139435a0e6696a958b080e4fd48e84c0b
Former-commit-id: 7a18c80dce9a1a3279d4f43671b5c8934467d52e
Former-commit-id: f296768d0f9f2c5ec300ce76798438b604e1fd5e [formerly 9aef4e33157be230b9683f5bb117d95c88b61053]
Former-commit-id: aedd69f20430dbce289f3acf53b2b38fbc64af76
Former-commit-id: e7e2b8126bc602691667796cd650372799062e08
Former-commit-id: 991c47d505e44af3ae1071bff300950b2ddd04c4
Former-commit-id: 0dbea0524469ca39014e6d94b4909c0511d853d1
Former-commit-id: a412f380458d17ac47eaebaafeb24b8c087efc7e
This commit is contained in:
孙昊翔
2018-09-21 19:32:12 +08:00
2 changed files with 56 additions and 0 deletions

View File

@@ -4,9 +4,11 @@ export default `<template>
:columns="columns" :columns="columns"
:data="data" :data="data"
title="D2 CRUD" title="D2 CRUD"
add-mode
:rowHandle="rowHandle" :rowHandle="rowHandle"
:form-template="formTemplate" :form-template="formTemplate"
:form-options="formOptions" :form-options="formOptions"
@row-add="handleRowAdd"
@row-edit="handleRowEdit" @row-edit="handleRowEdit"
@dialog-cancel="handleDialogCancel"/> @dialog-cancel="handleDialogCancel"/>
</div> </div>
@@ -92,6 +94,20 @@ export default {
address: { address: {
title: '地址', title: '地址',
value: '' value: ''
},
forbidEdit: {
title: '禁用按钮',
value: false,
component: {
show: false
}
},
showEditButton: {
title: '显示按钮',
value: true,
component: {
show: false
}
} }
}, },
formOptions: { formOptions: {
@@ -102,6 +118,18 @@ export default {
} }
}, },
methods: { methods: {
handleRowAdd (row, done) {
this.formOptions.saveLoading = true
setTimeout(() => {
console.log(row)
this.$message({
message: '保存成功',
type: 'success'
})
done()
this.formOptions.saveLoading = false
}, 300)
},
handleRowEdit ({index, row}, done) { handleRowEdit ({index, row}, done) {
this.formOptions.saveLoading = true this.formOptions.saveLoading = true
setTimeout(() => { setTimeout(() => {

View File

@@ -5,9 +5,11 @@
:columns="columns" :columns="columns"
:data="data" :data="data"
title="D2 CRUD" title="D2 CRUD"
add-mode
:rowHandle="rowHandle" :rowHandle="rowHandle"
:form-template="formTemplate" :form-template="formTemplate"
:form-options="formOptions" :form-options="formOptions"
@row-add="handleRowAdd"
@row-edit="handleRowEdit" @row-edit="handleRowEdit"
@dialog-cancel="handleDialogCancel"> @dialog-cancel="handleDialogCancel">
</d2-crud> </d2-crud>
@@ -108,6 +110,20 @@ export default {
address: { address: {
title: '地址', title: '地址',
value: '' value: ''
},
forbidEdit: {
title: '禁用按钮',
value: false,
component: {
show: false
}
},
showEditButton: {
title: '显示按钮',
value: true,
component: {
show: false
}
} }
}, },
formOptions: { formOptions: {
@@ -118,6 +134,18 @@ export default {
} }
}, },
methods: { methods: {
handleRowAdd (row, done) {
this.formOptions.saveLoading = true
setTimeout(() => {
console.log(row)
this.$message({
message: '保存成功',
type: 'success'
})
done()
this.formOptions.saveLoading = false
}, 300)
},
handleRowEdit ({ index, row }, done) { handleRowEdit ({ index, row }, done) {
this.formOptions.saveLoading = true this.formOptions.saveLoading = true
setTimeout(() => { setTimeout(() => {