Commit a17cdc74 authored by ytbdmhy's avatar ytbdmhy

禁用启用更换成switch

parent 8533a855
...@@ -13,12 +13,21 @@ ...@@ -13,12 +13,21 @@
<el-table-column :label="$t('action.operation')" width="185" fixed="right" v-if="showOperation" header-align="center" align="center"> <el-table-column :label="$t('action.operation')" width="185" fixed="right" v-if="showOperation" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<kt-button icon="fa fa-edit" :label="$t('action.edit')" :perms="permsEdit" :size="size" @click="handleEdit(scope.$index, scope.row)" style="float: left"/> <kt-button icon="fa fa-edit" :label="$t('action.edit')" :perms="permsEdit" :size="size" @click="handleEdit(scope.$index, scope.row)" style="float: left"/>
<div v-if="scope.row.status == 1"> <el-switch
<kt-button icon="fa fa-trash" label="禁用" :perms="permsDelete" :size="size" type="danger" @click="handleDelete(scope.$index, scope.row)" /> class="statusSwitch"
</div> style="display: block"
<div v-else> v-model="scope.row.status==0?true:false"
<kt-button icon="fa fa-check-circle" label="启用" :perms="permsDelete" :size="size" type="success" @click="handleDelete(scope.$index, scope.row)" /> active-color="#13ce66"
</div> inactive-color="#ff4949"
active-text="启"
inactive-text="禁" @change="handleDelete(scope.$index, scope.row)">
</el-switch>
<!-- <div v-if="scope.row.status == 1">-->
<!-- <kt-button icon="fa fa-trash" label="禁用" :perms="permsDelete" :size="size" type="danger" @click="handleDelete(scope.$index, scope.row)" />-->
<!-- </div>-->
<!-- <div v-else>-->
<!-- <kt-button icon="fa fa-check-circle" label="启用" :perms="permsDelete" :size="size" type="success" @click="handleDelete(scope.$index, scope.row)" />-->
<!-- </div>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -164,6 +173,28 @@ export default { ...@@ -164,6 +173,28 @@ export default {
} }
</script> </script>
<style scoped> <style>
.statusSwitch .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
.statusSwitch .el-switch__label--right {
z-index: 2;
left: 92px;
bottom: 0px;
color: #000;
}
/*关闭时文字位置设置*/
.statusSwitch .el-switch__label--left {
z-index: 2;
right: 22px;
bottom: 0px;
color: #fff;
}
/*显示文字*/
.statusSwitch .el-switch__label.is-active {
display: block;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment