Commit f70c7aa5 by linjinhong

测试提交

parent 879eca7b
......@@ -296,11 +296,12 @@ export default {
// 使用getBoundingClientRect获取更精确的位置信息
const imageRect = image.getBoundingClientRect();
const lineRect = line.getBoundingClientRect();
console.log("lineRect", lineRect);
console.log("imageRect", imageRect);
// 计算image相对于line的坐标位置
const relativeX = imageRect.left - lineRect.left;
const relativeY = imageRect.top - lineRect.top;
console.log(dom_id);
// 获取图片的宽高
let w = image.clientWidth / this.WHproportion; // 图片宽
let h = image.clientHeight / this.WHproportion; // 图片高
......@@ -308,18 +309,15 @@ export default {
const x = relativeX / this.WHproportion;
const y = relativeY / this.WHproportion;
const r = this.imgList[0].r;
console.log(w, h);
console.log(x, y, "x,y");
const x_mm = this.pxToUnit(x, "mm");
const y_mm = this.pxToUnit(y, "mm");
const w_mm = this.pxToUnit(w, "mm");
const h_mm = this.pxToUnit(h, "mm");
// console.log({
// x: Number((x_mm - 0.8).toFixed(1)),
// y: Number((y_mm - 0.9).toFixed(1)),
// w: Number((w_mm - 0.3).toFixed(1)),
// h: Number((h_mm - 0.3).toFixed(1)),
// r
// });
console.log("x_mm", x_mm);
console.log("y_mm", y_mm);
console.log("w_mm", w_mm);
console.log("h_mm", h_mm);
return {
x: x_mm,
y: y_mm,
......
......@@ -366,12 +366,12 @@ export default {
let item = this.imgList.find((img) => img.fileName === it.fileName);
if (item) return;
console.log(this.detail.designImageSize);
let size = null
if(this.detail.mssWidth && this.detail.mssHeight){
let size = null;
if (this.detail.mssWidth && this.detail.mssHeight) {
size = {
width: this.detail.mssWidth,
height: this.detail.mssHeight,
}
};
}
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this.getBackFile({ files: [it], size }, (file) => {
......@@ -530,37 +530,41 @@ export default {
});
},
getComputedName(title) {
let img = this.selectImgList.find((it) => it.title === title || it.title.includes(title));
let img = this.selectImgList.find(
(it) => it.title === title || it.title.includes(title)
);
return img?.designId;
},
getComputedTitle(title) {
console.log(this.selectImgList, "this.selectImgList");
let img = this.selectImgList.find((it) => it.title === title || it.title.includes(title));
let img = this.selectImgList.find(
(it) => it.title === title || it.title.includes(title)
);
return img?.productionFile;
},
getBackFile({ files, size }, callback) {
let that = this;
let bw = document.getElementById('line')
bw = bw.clientWidth
let bw = document.getElementById("line");
bw = bw.clientWidth;
// bw = Number(bw.replace("px", ""));
for (let i = 0; i < files.length; i++) {
files[i].url = files[i].productionFile || files[i].url;
that.$nextTick(async () => {
let w = bw / 2;
let width_px, height_px, rate, x ,y;
let width_px, height_px, rate, x, y;
if (size) {
width_px = that.WHproportion * mmToPx(size.width);
height_px = that.WHproportion * mmToPx(size.height);
x = w * that.WHproportion
y = (height_px / 2) * that.WHproportion
x = w * that.WHproportion;
y = (height_px / 2) * that.WHproportion;
rate = height_px / width_px;
} else {
let data = await that.getImageSize(files[i].url);
rate = data.height / data.width;
width_px = bw * (2 / 3);
x = w
y = (height_px / 2)
x = w;
y = height_px / 2;
height_px = width_px * rate;
}
......@@ -569,11 +573,11 @@ export default {
url: files[i].url,
fileName: files[i].fileName,
rate,
w:width_px,
w: width_px,
zIndex: that.imgList.length,
x,
y,
h:height_px,
h: height_px,
r: 0,
});
that.selectIndex = that.imgList.length - 1;
......@@ -809,7 +813,7 @@ export default {
this.hasSize = false;
}
this.detail.designImageSize = size;
console.log(this.detail,'this.detail');
console.log(this.detail, "this.detail");
this.imgList = [];
this.selectIndex = -1;
if (value.length > 0) {
......@@ -1154,7 +1158,7 @@ export default {
<div v-if="isView" id="img">
<div
id="line"
style="left: 22%;top: 57%;background-color: transparent;overflow: hidden;cursor: none;"
style="left: 22%;top: 52%;background-color: transparent;overflow: hidden;cursor: none;"
>
<div
class="sucaitu vieWsucaitu"
......@@ -1290,7 +1294,12 @@ export default {
</div>
<div
class="print-tip"
v-if="detail && detail.mssWidth && detail.mssHeight && selectImgList.length"
v-if="
detail &&
detail.mssWidth &&
detail.mssHeight &&
selectImgList.length
"
>
<b style="color: green" v-if="hasSize"
>该生产单无需拖动设计,直接打印</b
......
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