Browse Source

crud组件删除修改 bug修正

master
x_ying 3 years ago
parent
commit
c03b243319
  1. 2
      src/assets/styles/yxk-admin.scss
  2. 34
      src/components/Crud/CRUD.operation.vue

2
src/assets/styles/yxk-admin.scss

@ -431,7 +431,7 @@
} }
.el-icon-arrow-right:before{ .el-icon-arrow-right:before{
color: #fff;
color: #303133;
} }
// 分页 // 分页

34
src/components/Crud/CRUD.operation.vue

@ -12,7 +12,7 @@
修改 修改
</el-button> </el-button>
<!-- type="danger" --> <!-- type="danger" -->
<el-button v-if="crud.optShow.del" slot="reference" v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">
<el-button v-if="crud.optShow.del" slot="reference" v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="delVisible=true">
删除 删除
</el-button> </el-button>
<!-- type="warning" --> <!-- type="warning" -->
@ -20,6 +20,17 @@
<!--右侧--> <!--右侧-->
<slot name="right" /> <slot name="right" />
</div> </div>
<!-- 删除弹窗 -->
<el-dialog :visible.sync="delVisible" title="确认删除">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<p class="delMsg">确定删除所选{{ crud.selections.length }}条数据吗</p>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="crud.delAllLoading" @click="toDelete(crud.selections)">确定</el-button>
</div>
</div>
</el-dialog>
<el-button-group v-if="crud.optShow.group" class="crud-opts-right"> <el-button-group v-if="crud.optShow.group" class="crud-opts-right">
<el-button size="mini" plain type="info" icon="el-icon-search" @click="toggleSearch()" /> <el-button size="mini" plain type="info" icon="el-icon-search" @click="toggleSearch()" />
<el-button size="mini" icon="el-icon-refresh" @click="crud.refresh()" /> <el-button size="mini" icon="el-icon-refresh" @click="crud.refresh()" />
@ -79,7 +90,9 @@ export default {
allColumnsSelectedIndeterminate: false, allColumnsSelectedIndeterminate: false,
tableUnwatcher: null, tableUnwatcher: null,
// //
ignoreNextTableColumnsChange: false
ignoreNextTableColumnsChange: false,
delVisible: false
} }
}, },
watch: { watch: {
@ -128,14 +141,15 @@ export default {
this.tableColumns = columns this.tableColumns = columns
}, },
toDelete(datas) { toDelete(datas) {
this.$confirm(this.crud.confirmDeleteMsg ? this.crud.confirmDeleteMsg : `确认删除选中的${datas.length}条数据?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
// this.$confirm(this.crud.confirmDeleteMsg ? this.crud.confirmDeleteMsg : `${datas.length}?`, '', {
// confirmButtonText: '',
// cancelButtonText: ''
// }).then(() => {
this.crud.delAllLoading = true this.crud.delAllLoading = true
this.delVisible = false
this.crud.doDelete(datas) this.crud.doDelete(datas)
}).catch(() => {
})
// }).catch(() => {
// })
}, },
handleCheckAllChange(val) { handleCheckAllChange(val) {
if (val === false) { if (val === false) {
@ -207,4 +221,8 @@ export default {
.crud-opts .crud-opts-right span { .crud-opts .crud-opts-right span {
float: left; float: left;
} }
.delMsg{
color: #fff;
font-size: 16px;
}
</style> </style>
Loading…
Cancel
Save