复现了问题 等待结局

Former-commit-id: 9f39432718832530f47b6a9faee92afe1b9ac86d [formerly 9f39432718832530f47b6a9faee92afe1b9ac86d [formerly 9f39432718832530f47b6a9faee92afe1b9ac86d [formerly 9f39432718832530f47b6a9faee92afe1b9ac86d [formerly ecb763d008a589ee3b83854517804b1468ca7a09 [formerly b18b87cc41e0c54a93a2f5021fe6022a6fa2c5fb]]]]]
Former-commit-id: 51a327f9f3d7a018f099f72ad564d6604aa5e9d7
Former-commit-id: 81c578d9cef74d8513c8a3c65107cfdfd3c6dfb7
Former-commit-id: caad4b29ff03d5878996ce52ff20252336128d97 [formerly 42d8aa2c0c3332d2c07057d6f4cdf21388c08fb9]
Former-commit-id: a81ea126d2fa05ae5555f872669792a08f9f2ff0
Former-commit-id: d27d0e66ed023c621d2cd2711664f498a21bb8ad
Former-commit-id: 61e0719ea25d0c67c1c38ded8cf41be50c17d7b5
Former-commit-id: 17291fab193dcf38a91f44137fa271d8f2d4ee56
Former-commit-id: 5218d72d35fb2d088198c37187d662eca768bd7b
This commit is contained in:
liyang
2018-11-28 16:49:46 +08:00
parent 63befd33c6
commit 947475bdc1
9 changed files with 228 additions and 8 deletions

View File

@@ -0,0 +1,80 @@
<template>
<d2-container
type="card"
class="demo-business-issues-142-edit">
<template slot="header">编辑 id: {{id}}</template>
<el-form ref="form" :model="form" label-width="80px" class="demo-business-issues-142-edit--form">
<el-form-item label="姓名">
<el-input v-model="form.name"/>
</el-form-item>
<el-form-item label="地址">
<el-input type="textarea" v-model="form.address"/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSubmit">修改</el-button>
<el-button @click="handleCancel">取消</el-button>
</el-form-item>
</el-form>
</d2-container>
</template>
<script>
import { mapActions } from 'vuex'
import { get } from '@/api/demo/business/issues/142'
export default {
props: {
id: {
type: String,
required: true
}
},
data () {
return {
form: {
name: '',
address: ''
}
}
},
created () {
// 自动加载一次表单数据
this.getFormData()
},
methods: {
...mapActions('d2admin/page', [
'close'
]),
// 根据 id 获取数据
getFormData () {
get(this.id)
.then(res => {
this.form.name = res.name
this.form.address = res.address
})
.catch(err => {
console.log('err', err)
})
},
// 提交
handleSubmit () {
console.log('submit!')
},
// 取消编辑
handleCancel () {
this.close({
tagName: this.$route.fullPath,
vm: this
})
}
}
}
</script>
<style lang="scss">
.demo-business-issues-142-edit {
.demo-business-issues-142-edit--form {
max-width: 460px;
margin: 0px auto;
}
}
</style>

View File

@@ -0,0 +1,60 @@
<template>
<d2-container type="card">
<d2-crud
v-bind="crud"
@edit="handleEdit"
style="margin: -15px 0;"/>
<template slot="footer">
<d2-link-btn
title="issue #142"
link="https://github.com/d2-projects/d2-admin/issues/142"/>
</template>
</d2-container>
</template>
<script>
export default {
data () {
return {
crud: {
columns: [
{ title: '姓名', key: 'name' },
{ title: '地址', key: 'address' }
],
data: [
{ id: '1', name: '王小虎1', address: '上海市普陀区金沙江路 1518 弄' },
{ id: '2', name: '王小虎2', address: '上海市普陀区金沙江路 1517 弄' },
{ id: '3', name: '王小虎3', address: '上海市普陀区金沙江路 1519 弄' },
{ id: '4', name: '王小虎4', address: '上海市普陀区金沙江路 1516 弄' }
],
options: {
border: true,
size: 'mini'
},
rowHandle: {
width: 80,
align: 'center',
custom: [
{
text: '编辑',
type: 'primary',
size: 'mini',
emit: 'edit'
}
]
}
}
}
},
methods: {
handleEdit ({ index, row }) {
this.$router.push({
name: 'demo-business-issues-142-edit',
params: {
id: row.id
}
})
}
}
}
</script>

View File

@@ -61,28 +61,28 @@ export default {
// 关闭当前
handleCloseCurrent () {
this.close({
tagName: this.$route.name,
tagName: this.$route.fullPath,
vm: this
})
},
// 关闭左侧
handleCloseLeft () {
this.closeLeft({
tagName: this.$route.name,
tagName: this.$route.fullPath,
vm: this
})
},
// 关闭右侧
handleCloseRight () {
this.closeRight({
tagName: this.$route.name,
tagName: this.$route.fullPath,
vm: this
})
},
// 关闭其他
handleCloseOther () {
this.closeOther({
tagName: this.$route.name,
tagName: this.$route.fullPath,
vm: this
})
},
@@ -92,7 +92,7 @@ export default {
},
// 清空当前页缓存并刷新此页面
handleCleanCacheAndRefreshCurrent () {
this.keepAliveRemove(this.$route.name)
this.keepAliveRemove(this.$route.fullPath)
this.$nextTick(this.$router.replace('/refresh'))
},
// 清空所有的缓存并刷新此页面