Commit 9de22220 by zhuzhequan

bug修复

parent d4e47cf3
{
"apiApiHost":"https://factory.jomalls.com/api",
"fileApiUrl":"https://factory.jomalls.com/upload/factory",
"visionUrl":"https://console.jomalls.com"
"apiApiHost":"http://10.168.31.142:8060/api",
"fileApiUrl":"http://10.168.31.142:80/upload/factory",
"visionUrl":"https://console.jomalls.com"
}
{
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.5",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "nodemon --watch src/server --exec vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./src/assets/logo.jpg --output=build --flatten"
},
"main": "background.js",
"dependencies": {
"@minogin/vue-drag-resize-rotate": "^1.0.5",
"@vue/composition-api": "^0.3.4",
"axios": "^0.19.2",
"compressing": "^1.10.1",
"core-js": "^3.6.4",
"electron": "^6.1.1",
"electron-builder": "^24.13.3",
"electron-icon-builder": "^2.0.1",
"electron-log": "^5.1.7",
"electron-store": "^4.0.0",
"electron-updater": "^6.2.1",
"element-ui": "^2.13.0",
"express": "^4.17.1",
"html2canvas": "^1.4.1",
"lodash-id": "^0.14.0",
"log4js": "^6.9.1",
"moment": "^2.30.1",
"morgan": "^1.10.0",
"multiparty": "^4.2.3",
"nodemon": "^3.1.4",
"normalize.css": "^8.0.1",
"vue": "^2.6.11",
"vue-draggable-resizable": "^3.0.0",
"vue-i18n": "^8.16.0",
"vue-moveable": "^2.0.0-beta.75",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-router": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.1.2",
"less": "^3.5.0",
"less-loader": "^7.3.0",
"prettier": "^1.19.1",
"pug": "^2.0.4",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"vue-cli-plugin-electron-builder": "^1.4.6",
"vue-template-compiler": "^2.6.11"
}
}
{
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.6",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "nodemon --watch src/server --exec vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"electron:generate-icons": "electron-icon-builder --input=./src/assets/logo.jpg --output=build --flatten"
},
"main": "background.js",
"dependencies": {
"@minogin/vue-drag-resize-rotate": "^1.0.5",
"@vue/composition-api": "^0.3.4",
"axios": "^0.19.2",
"bignumber.js": "^9.2.1",
"compressing": "^1.10.1",
"core-js": "^3.6.4",
"electron": "^6.1.1",
"electron-builder": "^24.13.3",
"electron-icon-builder": "^2.0.1",
"electron-log": "^5.1.7",
"electron-store": "^4.0.0",
"electron-updater": "^6.2.1",
"element-ui": "^2.13.0",
"express": "^4.17.1",
"html2canvas": "^1.4.1",
"lodash-id": "^0.14.0",
"log4js": "^6.9.1",
"moment": "^2.30.1",
"morgan": "^1.10.0",
"multiparty": "^4.2.3",
"nodemon": "^3.1.4",
"normalize.css": "^8.0.1",
"vue": "^2.6.11",
"vue-draggable-resizable": "^3.0.0",
"vue-i18n": "^8.16.0",
"vue-moveable": "^2.0.0-beta.75",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-router": "^4.2.0",
"@vue/cli-plugin-vuex": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.1.2",
"less": "^3.5.0",
"less-loader": "^7.3.0",
"prettier": "^1.19.1",
"pug": "^2.0.4",
"pug-html-loader": "^1.1.5",
"pug-plain-loader": "^1.0.0",
"vue-cli-plugin-electron-builder": "^1.4.6",
"vue-template-compiler": "^2.6.11"
}
}
......@@ -90,10 +90,10 @@ export const downloadImage = list => {
} else {
if (!list[i].list) list[i].list = [];
const filename = list[i].url.split("/")[
list[i].url.split("/").length - 1
]
list[i].url.split("/").length - 1
];
list[i].list.push({
fileName: filename,
fileName,
productionFile: p,
designId: filename.split("_GCPS")[0]
});
......
export function pxToUnit(px, unit) {
const setting = this.$dataStore.get("setting");
if (!unit) {
......@@ -12,11 +13,13 @@ export function pxToUnit(px, unit) {
}
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");
let unit = "mm";
if (setting) {
if(!unit){
unit = setting.unit;
}
if (unit === "mm") {
......
......@@ -216,7 +216,9 @@ export default {
console.log(findByPodProductionNo.data, "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 = [];
res.data.forEach(el => {
this.imgList = this.imgList.concat(el.list || []);
......@@ -234,7 +236,11 @@ export default {
});
console.log(arr, "arr");
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 = "";
......@@ -646,12 +652,11 @@ export default {
z-index: 2;
color: white;
}
::v-deep .el-color-picker__trigger{
::v-deep .el-color-picker__trigger {
background: white;
width: 41px;
}
::v-deep .el-color-picker__color{
border: none !important;
::v-deep .el-color-picker__color {
border: none !important;
}
</style>
......@@ -6,6 +6,7 @@ import html2canvas from "html2canvas";
import moment from "moment";
import pkg from "../../../../package.json";
import { pxToUnit } from "../../../utils/index";
export default {
data() {
return {
......@@ -294,9 +295,11 @@ export default {
// 计算image相对于line的坐标位置
const relativeX = imageRect.left - lineRect.left;
const relativeY = imageRect.top - lineRect.top;
console.log(dom_id);
// 获取图片的宽高
let w = image.clientWidth; // 图片宽
let h = image.clientHeight; // 图片高
console.log(w,h,'w,h');
const x = relativeX;
const y = relativeY;
const r = this.imgList[0].r;
......@@ -328,7 +331,22 @@ export default {
// 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() {
if (this.imgList.length === 0)
return this.$message.warning("素材不能为空");
......@@ -345,32 +363,21 @@ export default {
return;
}
let { x, y, w, h, r } = this.return_data();
let x_sp = String(x).split(".");
let y_sp = String(y).split(".");
let w_sp = String(w).split(".");
let h_sp = String(h).split(".");
x = x_sp[0].length >= 4 ? x_sp[0].slice(0, 4) : x.toFixed(1);
y = y_sp[0].length >= 4 ? y_sp[0].slice(0, 4) : y.toFixed(1);
w = w_sp[0].length >= 4 ? w_sp[0].slice(0, 4) : w.toFixed(1);
h = h_sp[0].length >= 4 ? h_sp[0].slice(0, 4) : h.toFixed(1);
console.log(x, y, w, h);
x = this.numberToStr4(x);
y = this.numberToStr4(y);
w = this.numberToStr4(w);
h = this.numberToStr4(h);
console.log(x, "x");
console.log(y, "y");
console.log(w, "w");
console.log(h, "h");
r = Number(r).toFixed(0);
const imgFileName = this.imgList[0].fileName;
let position = ""; // 位置
let size = ""; // 图像大小
console.log(x, y);
if (Number(x) < 0 || Number(y) < 0) {
position = `"${this.singleStr(Number(x))},${this.singleStr(
Number(y)
)}"`;
} else {
position = `${this.singleStr(x)}${this.singleStr(
y
)}`;
}
size = `${this.singleStr(Number(w))}${this.singleStr(
Number(h)
)}`;
position = `${x},${y}`;
size = `${w}${h}`;
console.log(position, size);
await this.sendCmd(imgFileName, size, position, r);
},
async sendCmd(imgFileName, size, position, r) {
......
......@@ -80,10 +80,13 @@ export default {
formChange(t) {
if (t && t === "w") {
this.form.h = this.form.w * this.form.rate;
}
if (t && t === "h") {
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));
f.y = Number(f.y) + Number(f.h) / 2;
f.x = Number(f.x) + Number(f.w) / 2;
......@@ -95,6 +98,7 @@ export default {
for (let k in f) {
f[k] = Number(f[k]);
}
this.$emit("change", f);
this.$dataStore.set("position_unit", JSON.parse(JSON.stringify(f)));
},
......@@ -134,6 +138,7 @@ export default {
<div class="img-form">
<el-form
size="small"
:disabled="!item"
style=""
:model="form"
label-position="left"
......
......@@ -4,6 +4,8 @@ import { grid } from "../data";
import ImgSetting from "./imgSetting.vue";
import bus from "@/bus";
import PrintDialog from "@/views/design/head/printDialog.vue";
import { mmToPx } from "@/utils";
import { raw } from "express";
const img = require("../../../assets/bg_tshirt_shadow.png");
export default {
......@@ -263,7 +265,7 @@ export default {
let item = this.imgList.find(img => img.fileName === it.fileName);
if (item) return;
// 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)));
});
},
......@@ -277,8 +279,11 @@ export default {
let w = document.getElementById("line").clientWidth / 2;
let h = document.getElementById("line").clientHeight / 2;
let dom = document.getElementsByClassName("drr")[this.selectIndex];
let z_index =
dom.style.zIndex === "" || !dom.style.zIndex ? 0 : dom.style.zIndex;
let z_index
if(dom){
z_index = dom.style.zIndex === "" || !dom.style.zIndex ? 0 : dom.style.zIndex;
}
switch (type) {
case "center":
this.$set(this.imgList[this.selectIndex], "x", Number(w));
......@@ -349,7 +354,8 @@ export default {
this.$set(item, "x", data.x);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
},
resizing(index) {},
resizing(index) {
},
rotating(data, item) {
console.log(data);
this.$set(item, "r", data.angle.toFixed(2));
......@@ -412,33 +418,47 @@ export default {
};
});
},
getBackFile(files, callback) {
getBackFile({ files, size }, callback) {
let that = this;
let bw = document.getElementById("line").clientWidth;
for (let i = 0; i < files.length; i++) {
files[i].url = files[i].productionFile;
that.$nextTick(() => {
that.getImageSize(files[i].url).then(data => {
let w = document.getElementById("line").clientWidth / 2;
let rate = data.height / data.width;
that.imgList = [];
that.imgList.push({
url: files[i].url,
fileName: files[i].fileName,
rate,
w: bw * (2 / 3),
zIndex: that.imgList.length,
x: w,
y: (bw * (2 / 3) * rate) / 2,
h: bw * (2 / 3) * rate,
r: 0
});
that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true;
if (i === files.length - 1) {
callback && callback();
}
that.$nextTick(async () => {
let w = document.getElementById("line").clientWidth / 2;
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.push({
url: files[i].url,
fileName: files[i].fileName,
rate,
w: width_px,
zIndex: that.imgList.length,
x: w,
y: height_px/ 2,
h: height_px,
r: 0
});
that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true;
that.$nextTick(() => {
that.ev('center')
})
if (i === files.length - 1) {
callback && callback();
}
});
}
},
......@@ -557,7 +577,7 @@ export default {
this.imgHeight = window.screen.height + "px";
this.systemSetting = this.$dataStore.get("setting");
bus.$on("busEmit", v => {
let { type, value } = v;
let { type, value, size } = v;
switch (type) {
case "grid":
this.row = value.row;
......@@ -587,7 +607,7 @@ export default {
console.log(value);
this.selectImgList = value;
this.selectImgIndex = 0;
this.getBackFile([value[0]], file => {
this.getBackFile({ files: [value[0]], size }, file => {
this.imgHistoryList.push(
JSON.parse(JSON.stringify(this.imgList))
);
......@@ -649,6 +669,7 @@ export default {
:src="item.url"
:id="item.fileName + '_' + index"
alt=""
style="width: 100%;height: 100%"
class="sucaitu-img"
/>
<i
......@@ -893,10 +914,12 @@ img {
.sucaitu-img {
position: relative;
}
.no-border-grid{
border-color:transparent !important;
*{
border-color:transparent !important;
.no-border-grid {
border-color: transparent !important;
* {
border-color: transparent !important;
}
}
</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