Commit 3798ec8a by linjinhong

fix:修改切换设备时网格大小问题

parent ae3a0358
...@@ -814,7 +814,7 @@ export default { ...@@ -814,7 +814,7 @@ export default {
this.$store.commit("changeDesktopDevice", value); this.$store.commit("changeDesktopDevice", value);
this.$store.commit("changeImgList", []); this.$store.commit("changeImgList", []);
// this.$dataStore.set("desktopDevice", value); // window.location.reload();
}, },
changeDesktoVersionFn(value) { changeDesktoVersionFn(value) {
// console.log(553, value); // console.log(553, value);
......
...@@ -67,6 +67,7 @@ export default { ...@@ -67,6 +67,7 @@ export default {
!this.grid[this.systemSetting.gridValue] !this.grid[this.systemSetting.gridValue]
) )
return { w: 0, h: 0, v: 1 }; return { w: 0, h: 0, v: 1 };
console.log("current", this.grid[this.systemSetting.gridValue]);
return { return {
w: this.grid[this.systemSetting.gridValue].w, w: this.grid[this.systemSetting.gridValue].w,
...@@ -230,16 +231,9 @@ export default { ...@@ -230,16 +231,9 @@ export default {
const image = document.getElementById("imgBox"); const image = document.getElementById("imgBox");
if (newValue.length && image) { if (newValue.length && image) {
const w = newValue[0]?.w / this.getWHproportion(this.WHproportion);
const h = newValue[0]?.h / this.getWHproportion(this.WHproportion);
let bw = document.getElementById("line");
let bh = bw.clientHeight;
bw = bw.clientWidth;
// this.$nextTick(() => { // this.$nextTick(() => {
// let dom = document.getElementsByClassName("drr"); // let dom = document.getElementsByClassName("drr");
// console.log(228, dom); // console.log(228, dom);
// this.imgList.forEach((el, i) => { // this.imgList.forEach((el, i) => {
// let dom_i = document.getElementsByClassName("drr")[i]; // let dom_i = document.getElementsByClassName("drr")[i];
// dom_i.style.zIndex = // dom_i.style.zIndex =
...@@ -255,55 +249,7 @@ export default { ...@@ -255,55 +249,7 @@ export default {
// }); // });
// }); // });
// }); // });
}
const output = [
`-------------------------------------------------`,
`生产单号:${this.detail.factorySubOrderNumber}`,
`当前图片:宽度--${newValue[0]?.w}px,高度--${newValue[0]?.h}px`,
`当前图片地址:${newValue[0]?.url}`,
`扩大比例:${this.WHproportion}`,
`压板尺寸:${bh}px*${bw}px`,
`实际打印尺寸(当前图片/扩大比例):宽度--${w}px,高度--${h}px`,
`计算公式毫米(mm:((px * 0.84183).toFixed(1)`,
`打印尺寸毫米(mm:宽度--${Number(
(w * 0.84183).toFixed(1),
)}mm,高度--${Number((h * 0.84183).toFixed(1))}mm`,
`-------------------------------------------------`,
];
// if (this.downloadLocation1) {
// }
// console.log(240, newValue);
// if (this.downloadLocation1 && this.newDesktopDevice == 3) {
// try {
// copySingleImage(newValue[0].url, this.downloadLocation1);
// copySingleImage(newValue[0].url, this.downloadLocation2);
// this.$message.success("图片已发送目标文件夹下");
// } catch (error) {
// this.$message.error("发送失败");
// console.log(error);
// }
// }
// console.log(output.join("\n"));
// console.log(`后端返回图片大小:\n`, this.currentImgData);
// console.log(`当前网格大小:\n`, this.gridSpacing);
// console.log(
// `当前整体数据:\n`,
// newValue[0],
// `\n`,
// `rate由后端返回图片高度除以宽度得出\n`,
// `如果高度大于宽度则 height_px = 压板高度 * (7.5 / 10)\n`,
// `如果宽度度大于高度则 width_px = 压板宽度 * (2 / 3)\n`,
// `剩下的高度或宽度则由(height_px或者width_px)/rate\n`,
// );
// console.log(
// `获取当前图片在压板中的大小公式:\n 宽度:${image?.clientWidth}(image.clientWidth)px /${this.WHproportion}(扩大比例)=${w}\n 高度:${image?.clientHeight}(image.clientHeight)px /${this.WHproportion}(扩大比例)=${h}`,
// );
}
// console.log("触发了");
// console.log("newValue", newValue);
this.$store.commit("changeImgList", this.imgList); this.$store.commit("changeImgList", this.imgList);
}, },
deep: true, deep: true,
...@@ -328,6 +274,11 @@ export default { ...@@ -328,6 +274,11 @@ export default {
this.selectImgList = []; this.selectImgList = [];
this.selectIndex = -1; this.selectIndex = -1;
this.selectImgIndex = 0; this.selectImgIndex = 0;
console.log("this.gridWH", this.gridWH);
console.log("this.grid", this.grid);
console.log("gridSpacing", this.gridSpacing);
console.log("WHproportion", this.WHproportion);
console.log("this.systemSetting", this.systemSetting);
}, },
desktoVersion(newValue) { desktoVersion(newValue) {
if (newValue) { if (newValue) {
...@@ -433,7 +384,7 @@ export default { ...@@ -433,7 +384,7 @@ export default {
if (val == 3) { if (val == 3) {
this.systemSetting.gridValue = 5; this.systemSetting.gridValue = 5;
} else { } else {
this.systemSetting.gridValue = 1; this.systemSetting.gridValue = 0;
} }
}, },
immediate: true, immediate: true,
...@@ -1728,14 +1679,8 @@ export default { ...@@ -1728,14 +1679,8 @@ export default {
<div <div
:class="{ 'no-border-grid': systemSetting.gridShow !== 1 }" :class="{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:style="{ :style="{
width: width: gridWH.row * 30 + 'px',
newDesktopDevice == 3 height: gridWH.col * 30 + 'px',
? grid.row * 20 + 'px'
: gridWH.row * 30 + 'px',
height:
newDesktopDevice == 3
? grid.col * 20 + 'px'
: gridWH.col * 30 + 'px',
}" }"
class="grid" class="grid"
style="border-style:dashed" style="border-style:dashed"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment