Commit f70c7aa5 by linjinhong

测试提交

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