| | |
| | | <script setup> |
| | | import {onMounted, reactive, ref} from "vue"; |
| | | import {nextTick, onMounted, reactive, ref, watch} from "vue"; |
| | | import {useI18n} from "vue-i18n"; |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | |
| | | |
| | | const route = useRoute(); |
| | | |
| | | const thickness = ref(route.query.thickNess); |
| | | const model = ref(route.query.model); |
| | | const thickness = ref(route.params.thickNess); |
| | | const model = ref(route.params.model); |
| | | |
| | | |
| | | const selectMaterialStore = () =>{ |
| | |
| | | item.upTrim = 0; |
| | | }); |
| | | xGrid.value.loadData(formattedData); |
| | | gridOptions.data = formattedData; |
| | | } else { |
| | | console.error('返回数据格式不符合预期,不是有效的对象数组格式'); |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | |
| | | selectMaterialStore(); |
| | | }); |
| | | |
| | | watch(() => props.receivedData, (newData) => { |
| | | if (newData) { |
| | | Trimming(newData); |
| | | } |
| | | }, { immediate: true }); |
| | | |
| | | const props = defineProps({ |
| | | receivedData : { |
| | | type: Object, |
| | | required: false, |
| | | properties: { |
| | | quicksetLeft: { type: Number }, |
| | | quicksetBottom: { type: Number }, |
| | | quicksetRight: { type: Number }, |
| | | quicksetTop: { type: Number } |
| | | }} |
| | | }); |
| | | |
| | | //接受SetTrimming的值 (修边) |
| | | const Trimming = (receivedData) => { |
| | | nextTick(() => { |
| | | const data = gridOptions.data; |
| | | console.log('接收到的receivedData:', receivedData); |
| | | console.log('表格原始数据:', data); |
| | | if (data) { |
| | | try { |
| | | const updatedData = []; |
| | | for (let i = 0; i < data.length; i++) { |
| | | const item = data[i]; |
| | | const updatedItem = { |
| | | ...item, |
| | | // 此处修改为从 receivedData 中获取对应的值来更新表格数据项 |
| | | leftTrim: Number(receivedData.quicksetLeft), |
| | | downTrim: Number(receivedData.quicksetBottom), |
| | | rigthTrim: Number(receivedData.quicksetRight), |
| | | upTrim: Number(receivedData.quicksetTop), |
| | | }; |
| | | updatedData.push(updatedItem); |
| | | } |
| | | gridOptions.data = updatedData; |
| | | xGrid.value.loadData(updatedData); |
| | | } catch (error) { |
| | | console.error('更新表格数据时出错:', error); |
| | | // 这里可以根据实际需求添加一些回滚操作或者提示用户的逻辑,比如显示一个错误提示框等 |
| | | ElMessage.error('更新表格数据时出现错误,请检查输入或联系管理员'); |
| | | } |
| | | } else { |
| | | console.warn('表格数据为空,无法更新磨量值'); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="width: 100%;height: 100%"> |
| | | <vxe-grid |
| | | @filter-change="filterChanged" |
| | | height="100%" |
| | | class="mytable-scrollbar" |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | > |
| | | |
| | | |