Commit 9de22220 by zhuzhequan

bug修复

parent d4e47cf3
{ {
"apiApiHost":"https://factory.jomalls.com/api", "apiApiHost":"http://10.168.31.142:8060/api",
"fileApiUrl":"https://factory.jomalls.com/upload/factory", "fileApiUrl":"http://10.168.31.142:80/upload/factory",
"visionUrl":"https://console.jomalls.com" "visionUrl":"https://console.jomalls.com"
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "JomallProductionAssistant", "name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant", "productName": "JomallProductionAssistant",
"description": "", "description": "",
"version": "1.0.5", "version": "1.0.6",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"@minogin/vue-drag-resize-rotate": "^1.0.5", "@minogin/vue-drag-resize-rotate": "^1.0.5",
"@vue/composition-api": "^0.3.4", "@vue/composition-api": "^0.3.4",
"axios": "^0.19.2", "axios": "^0.19.2",
"bignumber.js": "^9.2.1",
"compressing": "^1.10.1", "compressing": "^1.10.1",
"core-js": "^3.6.4", "core-js": "^3.6.4",
"electron": "^6.1.1", "electron": "^6.1.1",
......
...@@ -91,9 +91,9 @@ export const downloadImage = list => { ...@@ -91,9 +91,9 @@ export const downloadImage = list => {
if (!list[i].list) list[i].list = []; if (!list[i].list) list[i].list = [];
const filename = list[i].url.split("/")[ const filename = list[i].url.split("/")[
list[i].url.split("/").length - 1 list[i].url.split("/").length - 1
] ];
list[i].list.push({ list[i].list.push({
fileName: filename, fileName,
productionFile: p, productionFile: p,
designId: filename.split("_GCPS")[0] designId: filename.split("_GCPS")[0]
}); });
......
export function pxToUnit(px, unit) { export function pxToUnit(px, unit) {
const setting = this.$dataStore.get("setting"); const setting = this.$dataStore.get("setting");
if (!unit) { if (!unit) {
...@@ -12,11 +13,13 @@ export function pxToUnit(px, unit) { ...@@ -12,11 +13,13 @@ export function pxToUnit(px, unit) {
} }
return px; return px;
} }
export function mmToPx(mm) {
return Number((Number(mm) / 0.84183).toFixed(1))
}
export function unitToPx(px) { export function unitToPx(px,unit) {
const setting = this.$dataStore.get("setting"); const setting = this.$dataStore.get("setting");
let unit = "mm"; if(!unit){
if (setting) {
unit = setting.unit; unit = setting.unit;
} }
if (unit === "mm") { if (unit === "mm") {
......
...@@ -216,7 +216,9 @@ export default { ...@@ -216,7 +216,9 @@ export default {
console.log(findByPodProductionNo.data, "findByPodProductionNo.data"); console.log(findByPodProductionNo.data, "findByPodProductionNo.data");
ipcRenderer.send("win-subScreen", findByPodProductionNo.data); ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示 // 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
let res = await this.$api.post("/downloadBySubOrderNumber", [this.detail.id]); let res = await this.$api.post("/downloadBySubOrderNumber", [
this.detail.id
]);
this.imgList = []; this.imgList = [];
res.data.forEach(el => { res.data.forEach(el => {
this.imgList = this.imgList.concat(el.list || []); this.imgList = this.imgList.concat(el.list || []);
...@@ -234,7 +236,11 @@ export default { ...@@ -234,7 +236,11 @@ export default {
}); });
console.log(arr, "arr"); console.log(arr, "arr");
res.data = arr.filter(el => el.type !== 1); res.data = arr.filter(el => el.type !== 1);
bus.$emit("busEmit", { type: "sendFile", value: res.data }); bus.$emit("busEmit", {
type: "sendFile",
value: res.data,
size: { width: 35, height: 39 }
});
this.productionNo = ""; this.productionNo = "";
...@@ -646,12 +652,11 @@ export default { ...@@ -646,12 +652,11 @@ export default {
z-index: 2; z-index: 2;
color: white; color: white;
} }
::v-deep .el-color-picker__trigger{ ::v-deep .el-color-picker__trigger {
background: white; background: white;
width: 41px; width: 41px;
} }
::v-deep .el-color-picker__color{ ::v-deep .el-color-picker__color {
border: none !important; border: none !important;
} }
</style> </style>
...@@ -6,6 +6,7 @@ import html2canvas from "html2canvas"; ...@@ -6,6 +6,7 @@ import html2canvas from "html2canvas";
import moment from "moment"; import moment from "moment";
import pkg from "../../../../package.json"; import pkg from "../../../../package.json";
import { pxToUnit } from "../../../utils/index"; import { pxToUnit } from "../../../utils/index";
export default { export default {
data() { data() {
return { return {
...@@ -294,9 +295,11 @@ export default { ...@@ -294,9 +295,11 @@ export default {
// 计算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; // 图片宽 let w = image.clientWidth; // 图片宽
let h = image.clientHeight; // 图片高 let h = image.clientHeight; // 图片高
console.log(w,h,'w,h');
const x = relativeX; const x = relativeX;
const y = relativeY; const y = relativeY;
const r = this.imgList[0].r; const r = this.imgList[0].r;
...@@ -328,7 +331,22 @@ export default { ...@@ -328,7 +331,22 @@ export default {
// r // r
// } // }
}, },
numberToStr4(num) {
num = Number(num);
num = num.toFixed(1);
num = num.toString().replace(".", "");
if (num.includes("-")) {
num = num.replace("-", "").slice(0, 4);
num = num.padStart(4, "0");
num = "-" + num;
} else {
num = num.padStart(4, "0");
num = num.slice(0, 4);
}
return num;
},
async getPrintCmd() { async getPrintCmd() {
if (this.imgList.length === 0) if (this.imgList.length === 0)
return this.$message.warning("素材不能为空"); return this.$message.warning("素材不能为空");
...@@ -345,32 +363,21 @@ export default { ...@@ -345,32 +363,21 @@ export default {
return; return;
} }
let { x, y, w, h, r } = this.return_data(); let { x, y, w, h, r } = this.return_data();
let x_sp = String(x).split("."); x = this.numberToStr4(x);
let y_sp = String(y).split("."); y = this.numberToStr4(y);
let w_sp = String(w).split("."); w = this.numberToStr4(w);
let h_sp = String(h).split("."); h = this.numberToStr4(h);
x = x_sp[0].length >= 4 ? x_sp[0].slice(0, 4) : x.toFixed(1); console.log(x, "x");
y = y_sp[0].length >= 4 ? y_sp[0].slice(0, 4) : y.toFixed(1); console.log(y, "y");
w = w_sp[0].length >= 4 ? w_sp[0].slice(0, 4) : w.toFixed(1); console.log(w, "w");
h = h_sp[0].length >= 4 ? h_sp[0].slice(0, 4) : h.toFixed(1); console.log(h, "h");
console.log(x, y, w, h);
r = Number(r).toFixed(0); r = Number(r).toFixed(0);
const imgFileName = this.imgList[0].fileName; const imgFileName = this.imgList[0].fileName;
let position = ""; // 位置 let position = ""; // 位置
let size = ""; // 图像大小 let size = ""; // 图像大小
console.log(x, y); position = `${x},${y}`;
if (Number(x) < 0 || Number(y) < 0) { size = `${w}${h}`;
position = `"${this.singleStr(Number(x))},${this.singleStr( console.log(position, size);
Number(y)
)}"`;
} else {
position = `${this.singleStr(x)}${this.singleStr(
y
)}`;
}
size = `${this.singleStr(Number(w))}${this.singleStr(
Number(h)
)}`;
await this.sendCmd(imgFileName, size, position, r); await this.sendCmd(imgFileName, size, position, r);
}, },
async sendCmd(imgFileName, size, position, r) { async sendCmd(imgFileName, size, position, r) {
......
...@@ -80,10 +80,13 @@ export default { ...@@ -80,10 +80,13 @@ export default {
formChange(t) { formChange(t) {
if (t && t === "w") { if (t && t === "w") {
this.form.h = this.form.w * this.form.rate; this.form.h = this.form.w * this.form.rate;
} }
if (t && t === "h") { if (t && t === "h") {
this.form.w = this.form.h * this.form.rate; this.form.w = this.form.h * this.form.rate;
} }
this.form.h = this.form.h? Math.abs(this.form.h):this.form.h
this.form.w = this.form.w? Math.abs(this.form.w):this.form.w
let f = JSON.parse(JSON.stringify(this.form)); let f = JSON.parse(JSON.stringify(this.form));
f.y = Number(f.y) + Number(f.h) / 2; f.y = Number(f.y) + Number(f.h) / 2;
f.x = Number(f.x) + Number(f.w) / 2; f.x = Number(f.x) + Number(f.w) / 2;
...@@ -95,6 +98,7 @@ export default { ...@@ -95,6 +98,7 @@ export default {
for (let k in f) { for (let k in f) {
f[k] = Number(f[k]); f[k] = Number(f[k]);
} }
this.$emit("change", f); this.$emit("change", f);
this.$dataStore.set("position_unit", JSON.parse(JSON.stringify(f))); this.$dataStore.set("position_unit", JSON.parse(JSON.stringify(f)));
}, },
...@@ -134,6 +138,7 @@ export default { ...@@ -134,6 +138,7 @@ export default {
<div class="img-form"> <div class="img-form">
<el-form <el-form
size="small" size="small"
:disabled="!item"
style="" style=""
:model="form" :model="form"
label-position="left" label-position="left"
......
...@@ -4,6 +4,8 @@ import { grid } from "../data"; ...@@ -4,6 +4,8 @@ import { grid } from "../data";
import ImgSetting from "./imgSetting.vue"; import ImgSetting from "./imgSetting.vue";
import bus from "@/bus"; import bus from "@/bus";
import PrintDialog from "@/views/design/head/printDialog.vue"; import PrintDialog from "@/views/design/head/printDialog.vue";
import { mmToPx } from "@/utils";
import { raw } from "express";
const img = require("../../../assets/bg_tshirt_shadow.png"); const img = require("../../../assets/bg_tshirt_shadow.png");
export default { export default {
...@@ -263,7 +265,7 @@ export default { ...@@ -263,7 +265,7 @@ 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;
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList)) // this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this.getBackFile([it], file => { this.getBackFile({files:[it]}, file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}); });
}, },
...@@ -277,8 +279,11 @@ export default { ...@@ -277,8 +279,11 @@ export default {
let w = document.getElementById("line").clientWidth / 2; let w = document.getElementById("line").clientWidth / 2;
let h = document.getElementById("line").clientHeight / 2; let h = document.getElementById("line").clientHeight / 2;
let dom = document.getElementsByClassName("drr")[this.selectIndex]; let dom = document.getElementsByClassName("drr")[this.selectIndex];
let z_index = let z_index
dom.style.zIndex === "" || !dom.style.zIndex ? 0 : dom.style.zIndex; if(dom){
z_index = dom.style.zIndex === "" || !dom.style.zIndex ? 0 : dom.style.zIndex;
}
switch (type) { switch (type) {
case "center": case "center":
this.$set(this.imgList[this.selectIndex], "x", Number(w)); this.$set(this.imgList[this.selectIndex], "x", Number(w));
...@@ -349,7 +354,8 @@ export default { ...@@ -349,7 +354,8 @@ export default {
this.$set(item, "x", data.x); this.$set(item, "x", data.x);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
resizing(index) {}, resizing(index) {
},
rotating(data, item) { rotating(data, item) {
console.log(data); console.log(data);
this.$set(item, "r", data.angle.toFixed(2)); this.$set(item, "r", data.angle.toFixed(2));
...@@ -412,33 +418,47 @@ export default { ...@@ -412,33 +418,47 @@ export default {
}; };
}); });
}, },
getBackFile(files, callback) { getBackFile({ files, size }, callback) {
let that = this; let that = this;
let bw = document.getElementById("line").clientWidth; let bw = document.getElementById("line").clientWidth;
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].productionFile;
that.$nextTick(() => { that.$nextTick(async () => {
that.getImageSize(files[i].url).then(data => {
let w = document.getElementById("line").clientWidth / 2; let w = document.getElementById("line").clientWidth / 2;
let rate = data.height / data.width; let width_px , height_px ,rate ;
if(size){
width_px = mmToPx(size.width)
height_px = mmToPx(size.height)
console.log(width_px,height_px,'w,h');
rate = height_px / width_px
}else{
let data = await that.getImageSize(files[i].url)
rate = data.height / data.width
width_px = bw * (2 / 3)
height_px = width_px* rate
}
that.imgList = []; that.imgList = [];
that.imgList.push({ that.imgList.push({
url: files[i].url, url: files[i].url,
fileName: files[i].fileName, fileName: files[i].fileName,
rate, rate,
w: bw * (2 / 3), w: width_px,
zIndex: that.imgList.length, zIndex: that.imgList.length,
x: w, x: w,
y: (bw * (2 / 3) * rate) / 2, y: height_px/ 2,
h: bw * (2 / 3) * rate, h: height_px,
r: 0 r: 0
}); });
that.selectIndex = that.imgList.length - 1; that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true; that.showImgSetting = true;
that.$nextTick(() => {
that.ev('center')
})
if (i === files.length - 1) { if (i === files.length - 1) {
callback && callback(); callback && callback();
} }
});
}); });
} }
}, },
...@@ -557,7 +577,7 @@ export default { ...@@ -557,7 +577,7 @@ export default {
this.imgHeight = window.screen.height + "px"; this.imgHeight = window.screen.height + "px";
this.systemSetting = this.$dataStore.get("setting"); this.systemSetting = this.$dataStore.get("setting");
bus.$on("busEmit", v => { bus.$on("busEmit", v => {
let { type, value } = v; let { type, value, size } = v;
switch (type) { switch (type) {
case "grid": case "grid":
this.row = value.row; this.row = value.row;
...@@ -587,7 +607,7 @@ export default { ...@@ -587,7 +607,7 @@ export default {
console.log(value); console.log(value);
this.selectImgList = value; this.selectImgList = value;
this.selectImgIndex = 0; this.selectImgIndex = 0;
this.getBackFile([value[0]], file => { this.getBackFile({ files: [value[0]], size }, file => {
this.imgHistoryList.push( this.imgHistoryList.push(
JSON.parse(JSON.stringify(this.imgList)) JSON.parse(JSON.stringify(this.imgList))
); );
...@@ -649,6 +669,7 @@ export default { ...@@ -649,6 +669,7 @@ export default {
:src="item.url" :src="item.url"
:id="item.fileName + '_' + index" :id="item.fileName + '_' + index"
alt="" alt=""
style="width: 100%;height: 100%"
class="sucaitu-img" class="sucaitu-img"
/> />
<i <i
...@@ -893,10 +914,12 @@ img { ...@@ -893,10 +914,12 @@ img {
.sucaitu-img { .sucaitu-img {
position: relative; position: relative;
} }
.no-border-grid{
border-color:transparent !important; .no-border-grid {
*{ border-color: transparent !important;
border-color:transparent !important;
* {
border-color: transparent !important;
} }
} }
</style> </style>
......
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