yudao-dev/src/views/extend/processEquValueBom/statusBtn.vue
‘937886381’ 0fa651fccf 修改bug
2024-03-29 09:51:19 +08:00

68 lines
1.5 KiB
Vue

<!--
* @Author: zhp
* @Date: 2023-11-08 14:00:52
* @LastEditTime: 2024-03-29 08:46:42
* @LastEditors: zhp
* @Description:
-->
<template>
<el-switch v-model="state" type="text" size="small" @change="changeHandler" />
</template>
<script>
import {
// processEquMaterialBomPage,
updateProcessEquValueBom,
// getWorkOrderList,
// getTeamList
} from '@/api/extend/processEquValueBom';
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false
}
},
// computed: {
// state() {
// return this.injectData.enabled === 1 ? true : false
// }
// },
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData.prop === 'enabled') {
this.state = this.injectData.enabled === 1 ? true : false
}
},
changeHandler() {
// let params = {}
let payload = {}
// params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? 1 : 0
payload.code = this.injectData.code
payload.name = this.injectData.name
payload.equipmentId = this.injectData.equipmentId
payload.remark = this.injectData.remark
// params.payload = payload
updateProcessEquValueBom(payload).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
}
})
// this.$emit('emitData', params)
}
}
}
</script>