| | |
| | | <template> |
| | | <div> |
| | | <el-button id="button" type="primary" @click="handlePrint">打印版图</el-button> |
| | | <el-select |
| | | v-model="printLayout" |
| | | placeholder="选择打印布局" |
| | | @change="handleLayoutChange" |
| | | style="width: 150px; margin-bottom: 10px;"> |
| | | <el-option label="四行两列" value="4rows-2cols"></el-option> |
| | | <el-option label="三行两列" value="3rows-2cols"></el-option> |
| | | <el-option label="三行一列" value="3rows-1col"></el-option> |
| | | <el-option label="两行两列" value="2rows-2cols"></el-option> |
| | | </el-select> |
| | | <el-button id="button" type="primary" @click="handlePrint">打印</el-button> |
| | | |
| | | <div ref="printContainer" style="position: relative;"> |
| | | <RectRenderer |
| | |
| | | :printLayout="printLayout" |
| | | :printWidth="currentPrintWidth" |
| | | :printHeight="currentPrintHeight" |
| | | style="position: absolute;" |
| | | :materialDetails="materialDetails" |
| | | :state="state" |
| | | style="" |
| | | v-if="dataLoaded" |
| | | /> |
| | | </div> |
| | |
| | | import RectRenderer from './page/RectRenderer.vue'; |
| | | import request from "@/utils/request"; |
| | | |
| | | const props = defineProps({ |
| | | project : null, |
| | | state : null |
| | | }); |
| | | const printLayout = ref('2rows-2cols'); |
| | | const rectRenderer = ref(null); |
| | | const savedProjectNo = localStorage.getItem('projectNo'); |
| | | const processId = savedProjectNo; |
| | | const layoutData = ref(null); |
| | | let processId = null; |
| | | const layoutData = ref(); |
| | | const dataLoaded = ref(false); |
| | | const materialDetails = ref(); |
| | | const state = ref(); |
| | | // 定义不同布局对应的尺寸 |
| | | const layoutDimensions = { |
| | | '4rows-2cols': { width: 1000, height: 1000 }, |
| | |
| | | .then((res) => { |
| | | if (res.code == 200) { |
| | | try { |
| | | const parsedData = JSON.parse(res.data.data[0].Layouts); |
| | | layoutData.value = parsedData; |
| | | dataLoaded.value = true; |
| | | layoutData.value = JSON.parse(res.data.data[0].Layouts); |
| | | materialDetails.value=res.data.optimizeUse; |
| | | dataLoaded.value=true; |
| | | } catch (error) { |
| | | console.error("解析布局数据失败:", error); |
| | | } |
| | |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | selectLayout(); |
| | | if (props.project) { |
| | | processId=props.project.projectNumber; |
| | | state.value=props.state; |
| | | selectLayout(); |
| | | } |
| | | |
| | | }); |
| | | |
| | | const handlePrint = () => { |