<template>
|
<div class="params-config-modal">
|
<el-dialog
|
title="配置"
|
:visible.sync="visible"
|
width="30%"
|
:before-close="handleClose">
|
<div class="content">
|
<el-radio-group v-model="config" class="config-radio-group">
|
<el-radio :label="false" size="large">无工艺参数,不允许下发生产任务</el-radio>
|
<el-radio :label="true" size="large">无工艺参数,允许下发生产任务</el-radio>
|
</el-radio-group>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button class="submit" @click="setConfig">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {apiSetCurrentDeviceConfig, getDeviceList} from "@/api/home";
|
import {Message} from "element-ui";
|
|
export default {
|
name: "ParamsConfigModal",
|
props:{
|
visible:{
|
type: Boolean,
|
default:false
|
}
|
},
|
data(){
|
return{
|
config:false,
|
deviceInfo:null
|
}
|
},
|
watch:{
|
visible(val){
|
if (val){
|
this.getDeviceInfo()
|
}
|
}
|
},
|
methods:{
|
handleClose(){
|
this.$emit('update:visible', false)
|
this.$emit('close')
|
},
|
getDeviceInfo(){
|
getDeviceList().then(res=>{
|
this.deviceInfo = res.data
|
this.config=this.getConfig(this.deviceInfo)
|
}).catch(err=>{
|
console.error(err)
|
})
|
},
|
setConfig() {
|
apiSetCurrentDeviceConfig({
|
// 选中允许下发即不需要工艺参数 ,这俩是反的
|
needSetProcessParams: !this.config
|
})
|
.then(() => {
|
Message({
|
message: '设置成功',
|
type: 'success',
|
duration: 3 * 1000
|
})
|
this.handleClose()
|
})
|
.catch((err) => {
|
console.error(err)
|
})
|
},
|
getConfig(deviceInfo){
|
const currentDeviceInfo = deviceInfo.deviceList?.find((ele) => {
|
return ele.deviceID === deviceInfo.currentDeviceID
|
})
|
return !currentDeviceInfo?.needSetProcessParams
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
::v-deep {
|
.el-dialog{
|
background-color: #10256c;
|
color: #fff;
|
}
|
.el-dialog__title,.el-dialog__body{
|
color: #fff;
|
}
|
}
|
.submit{
|
background-color: #0dfde6;
|
outline: none;
|
border: none;
|
color:#333333;
|
width: 100px;
|
height: 40px;
|
font-size: 14px;
|
font-weight: 500;
|
&:hover{
|
background-color: #0dfde6;
|
color:#333333;
|
}
|
&:focus{
|
background-color: #0dfde6;
|
color:#333333;
|
}
|
&:active{
|
background-color: #0dfde6;
|
color:#333333;
|
}
|
}
|
.dialog-footer{
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.content{
|
height: 160px;
|
padding:30px 20px;
|
box-sizing: border-box;
|
}
|
|
.config-radio-group {
|
display: flex;
|
flex-direction: column;
|
justify-content: start;
|
align-items: start;
|
|
}
|
::v-deep .el-radio__label {
|
color: #fff!important;
|
}
|
.el-radio{
|
margin-bottom: 20px;
|
}
|
</style>
|