班组
This commit is contained in:
40
src/views/group/base/groupTeam/components/statusBtn.vue
Normal file
40
src/views/group/base/groupTeam/components/statusBtn.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
state: false,
|
||||
payload: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
readonly() {
|
||||
return !!this.injectData.readonly
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.mapToState()
|
||||
},
|
||||
methods: {
|
||||
mapToState() {
|
||||
if (this.injectData.prop === 'enabled') {
|
||||
this.state = this.injectData.enabled === 1 ? true : false
|
||||
}
|
||||
},
|
||||
changeHandler() {
|
||||
this.payload.id = this.injectData.id
|
||||
this.payload.enabled = this.state ? '1' : '0'
|
||||
this.$emit('emitData', this.payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user