<template>
|
<div class="deliver-params-config-modal">
|
<CommonModal v-model="modelData" @close="modelData = false">
|
<template #title>配置</template>
|
<div class="config-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>
|
<template #footer>
|
<div class="config-footer">
|
<BigButton class="btn" bg-color="#0dfde6" color="#333333" @click="setConfig">保存</BigButton>
|
</div>
|
</template>
|
</CommonModal>
|
</div>
|
</template>
|
<script setup lang="ts">
|
import BigButton from '@/views/dashboard/components/BigButton.vue'
|
import { useVModel } from '@vueuse/core'
|
import { ref, watch } from 'vue'
|
import { useDevicesStore } from '@/stores/devices'
|
import { storeToRefs } from 'pinia'
|
import { apiSetCurrentDeviceConfig } from '@/api'
|
import { ElMessage } from 'element-plus'
|
const props = withDefaults(
|
defineProps<{
|
modelValue: boolean
|
}>(),
|
{
|
modelValue: false
|
}
|
)
|
|
const emit = defineEmits<{
|
'update:modelValue': [show: boolean]
|
}>()
|
const modelData = useVModel(props, 'modelValue', emit)
|
const deviceStore = useDevicesStore()
|
const { currentDeviceAllowNoParams } = storeToRefs(deviceStore)
|
watch(modelData, () => {
|
// 打开弹窗时初始化选中项
|
if (modelData.value) {
|
config.value = currentDeviceAllowNoParams.value
|
}
|
})
|
|
const config = ref(false)
|
|
function setConfig() {
|
apiSetCurrentDeviceConfig({
|
// 选中允许下发即不需要工艺参数 ,这俩是反的
|
needSetProcessParams: !config.value
|
})
|
.then(() => {
|
ElMessage({
|
message: '设置成功',
|
type: 'success',
|
duration: 3 * 1000
|
})
|
modelData.value = false
|
deviceStore.startPollingDevice()
|
})
|
.catch((err) => {
|
console.error(err)
|
})
|
}
|
</script>
|
<style scoped lang="scss">
|
.config-content {
|
padding: 10px 20px;
|
}
|
.config-radio-group {
|
display: flex;
|
flex-direction: column;
|
justify-content: start;
|
align-items: start;
|
:deep(.el-radio__label) {
|
color: #fff;
|
}
|
}
|
.config-footer {
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
.btn {
|
height: 40px;
|
width: 100px;
|
font-size: 14px;
|
font-weight: 500;
|
line-height: 40px;
|
border-radius: 4px;
|
}
|
}
|
</style>
|