| | |
| | | <script setup> |
| | | import {ref} from "vue"; |
| | | import {onMounted, ref} from "vue"; |
| | | import {defineEmits} from 'vue'; |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | |
| | | |
| | | onMounted(async() => { |
| | | await firstLoading() |
| | | }) |
| | | |
| | | const firstLoading = async() => { |
| | | request.post(`/glassOptimize/getConfiguration/修边`).then((res) => { |
| | | if (res.code == "200") { |
| | | const rawData = res.data.data; |
| | | if (Array.isArray(rawData) && rawData.length > 0) { |
| | | const formattedData = rawData.map(item => { |
| | | const formattedItem = {}; |
| | | for (const key in item) { |
| | | if (typeof item[key] === 'string') { |
| | | //去除字符串属性值开头和结尾的双引号 |
| | | formattedItem[key] = item[key].replace(/^\"|\"$/g, ''); |
| | | } else { |
| | | formattedItem[key] = item[key]; |
| | | } |
| | | } |
| | | return formattedItem; |
| | | }); |
| | | quicksetLeft.value=formattedData[0].leftTrim |
| | | quicksetTop.value=formattedData[0].upTrim |
| | | quicksetRight.value=formattedData[0].rightTrim |
| | | quicksetBottom.value=formattedData[0].downTrim |
| | | |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | function setupComponent() { |
| | | // 各个输入框绑定的值,初始化为0 |
| | |
| | | }); |
| | | |
| | | const setTrimming = () => { |
| | | let json = "{" |
| | | json+='"left_trim":"'+quicksetLeft.value+'",' |
| | | json+='"up_trim":"'+quicksetTop.value+'",' |
| | | json+='"right_trim":"'+quicksetRight.value+'",' |
| | | json+='"down_trim":"'+quicksetBottom.value+'",' |
| | | json+='"auto_fill_trim":"'+true+'",' |
| | | json+='"quick_trim":"'+15+'"' |
| | | json+="}" |
| | | |
| | | let configuration={ |
| | | json:json, |
| | | } |
| | | |
| | | request.post(`/glassOptimize/saveConfiguration/修边`,configuration).then((res) => { |
| | | if(res.code==200 && res.data===true){ |
| | | const dataToSend = { |
| | | quicksetTop: quicksetTop.value, |
| | | quicksetRight: quicksetRight.value, |
| | |
| | | }; |
| | | emit('send-data-event', dataToSend); |
| | | props.closeDialog(3); |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }); |
| | | |
| | | }; |
| | | |
| | | </script> |