Commit d4e47cf3 by zhuzhequan

bug修复

parent 0d8de4c6
{ {
"apiApiHost":"http://10.168.31.142:8060/api", "apiApiHost":"https://factory.jomalls.com/api",
"fileApiUrl":"http://10.168.31.142:80/upload/factory", "fileApiUrl":"https://factory.jomalls.com/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.4", "version": "1.0.5",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
......
...@@ -61,14 +61,14 @@ export default { ...@@ -61,14 +61,14 @@ export default {
try { try {
let { let {
data data
} = await axios.get( } = await axios.post(
`${env}/factory/podJomallOrder/downloadBySubOrderNumber`, `${env}/factory/podJomallOrder/downloadByProduction`,req.body,
{ params: req.body, headers: { "jwt-token": token } } { headers: { "jwt-token": token } }
); );
console.log(data); console.log(data);
let files = []; let files = [];
if (data.code === 200 && data.message) { if (data.code === 200) {
files = [data.message]; files = data.data;
files = files.map(el => { files = files.map(el => {
return { url: `${fileEnv}${el}` }; return { url: `${fileEnv}${el}` };
}); });
......
...@@ -27,7 +27,7 @@ function zip(from, to) { ...@@ -27,7 +27,7 @@ function zip(from, to) {
fs.renameSync(file_path, path.join(to, fileName)); fs.renameSync(file_path, path.join(to, fileName));
arr.push({ arr.push({
fileName: fileName, fileName: fileName,
designId: data[i].split(".")[0], designId: data[i].split("_GCPS")[0],
productionFile: path.join(to, fileName) productionFile: path.join(to, fileName)
}); });
} }
...@@ -67,8 +67,7 @@ export const downloadImage = list => { ...@@ -67,8 +67,7 @@ export const downloadImage = list => {
".7z", ".7z",
".gz", ".gz",
".bz2" ".bz2"
].filter(el => list[i].url.toLowerCase().includes(el)) ].filter(el => list[i].url.toLowerCase().includes(el)).length > 0;
.length > 0;
if (flag) { if (flag) {
fileName = list[i].url.split("/")[ fileName = list[i].url.split("/")[
list[i].url.split("/").length - 1 list[i].url.split("/").length - 1
...@@ -88,6 +87,16 @@ export const downloadImage = list => { ...@@ -88,6 +87,16 @@ export const downloadImage = list => {
if (count === list.length - 1) { if (count === list.length - 1) {
resolve(list); resolve(list);
} }
} else {
if (!list[i].list) list[i].list = [];
const filename = list[i].url.split("/")[
list[i].url.split("/").length - 1
]
list[i].list.push({
fileName: filename,
productionFile: p,
designId: filename.split("_GCPS")[0]
});
} }
if (count === list.length - 1) { if (count === list.length - 1) {
console.log(list); console.log(list);
......
export function pxToUnit(px){ export function pxToUnit(px, unit) {
const setting = this.$dataStore.get("setting"); const setting = this.$dataStore.get("setting");
let unit = "mm"; if (!unit) {
if (setting) { if (setting) {
unit = setting.unit; unit = setting.unit;
}
} }
if (unit === "mm") { if (unit === "mm") {
px = Number((px * 0.84183).toFixed(1)); px = Number((px * 0.84183).toFixed(1));
...@@ -12,7 +13,7 @@ export function pxToUnit(px){ ...@@ -12,7 +13,7 @@ export function pxToUnit(px){
return px; return px;
} }
export function unitToPx(px){ export function unitToPx(px) {
const setting = this.$dataStore.get("setting"); const setting = this.$dataStore.get("setting");
let unit = "mm"; let unit = "mm";
if (setting) { if (setting) {
...@@ -21,7 +22,7 @@ export function unitToPx(px){ ...@@ -21,7 +22,7 @@ export function unitToPx(px){
if (unit === "mm") { if (unit === "mm") {
px = Number((px / 0.84183).toFixed(1)); px = Number((px / 0.84183).toFixed(1));
} else if (unit === "inch") { } else if (unit === "inch") {
px = (Number((px / 0.84183) * 25.4).toFixed(1)); px = Number((px / 0.84183) * 25.4).toFixed(1);
} }
return px; return px;
} }
...@@ -216,9 +216,7 @@ export default { ...@@ -216,9 +216,7 @@ 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", { let res = await this.$api.post("/downloadBySubOrderNumber", [this.detail.id]);
subOrderNumber: this.detail.factorySubOrderNumber
});
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 || []);
...@@ -328,7 +326,7 @@ export default { ...@@ -328,7 +326,7 @@ export default {
<!-- </el-tooltip>--> <!-- </el-tooltip>-->
<el-dropdown trigger="click" @command="command" :hide-on-click="false"> <el-dropdown trigger="click" @command="command" :hide-on-click="false">
<el-button style="height: 100%;margin-right: 0px" size="small" <el-button style="height: 100%;margin-right: 0" size="small"
>{{ grid[selectGridIndex].label }} >{{ grid[selectGridIndex].label }}
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
......
...@@ -300,25 +300,33 @@ export default { ...@@ -300,25 +300,33 @@ export default {
const x = relativeX; const x = relativeX;
const y = relativeY; const y = relativeY;
const r = this.imgList[0].r; const r = this.imgList[0].r;
const x_mm = this.pxToUnit(x); console.log(w, h);
const y_mm = this.pxToUnit(y); const x_mm = this.pxToUnit(x, "mm");
const w_mm = this.pxToUnit(w); const y_mm = this.pxToUnit(y, "mm");
const h_mm = this.pxToUnit(h); const w_mm = this.pxToUnit(w, "mm");
console.log({ const h_mm = this.pxToUnit(h, "mm");
x: Number((x_mm - 0.8).toFixed(1)), // console.log({
y: Number((y_mm - 0.9).toFixed(1)), // x: Number((x_mm - 0.8).toFixed(1)),
w: Number((w_mm - 0.3).toFixed(1)), // y: Number((y_mm - 0.9).toFixed(1)),
h: Number((h_mm - 0.3).toFixed(1)), // w: Number((w_mm - 0.3).toFixed(1)),
r // h: Number((h_mm - 0.3).toFixed(1)),
}); // r
// 返回计算结果 // });
return { return {
x: Number((x_mm - 0.8).toFixed(1)), x: x_mm,
y: Number((y_mm - 0.9).toFixed(1)), y: y_mm,
w: Number((w_mm - 0.3).toFixed(1)), w: w_mm,
h: Number((h_mm - 0.3).toFixed(1)), h: h_mm,
r r
} };
// 返回计算结果
// return {
// 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
// }
}, },
async getPrintCmd() { async getPrintCmd() {
...@@ -337,22 +345,31 @@ export default { ...@@ -337,22 +345,31 @@ 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(".");
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);
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); console.log(x, y);
if (Number(x) < 0 || Number(y) < 0) { if (Number(x) < 0 || Number(y) < 0) {
position = `"${this.singleStr(Number(x).toFixed(1))},${this.singleStr( position = `"${this.singleStr(Number(x))},${this.singleStr(
Number(y).toFixed(1) Number(y)
)}"`; )}"`;
} else { } else {
position = `${this.singleStr(x.toFixed(1))}${this.singleStr( position = `${this.singleStr(x)}${this.singleStr(
y.toFixed(1) y
)}`; )}`;
} }
size = `${this.singleStr(Number(w).toFixed(1))}${this.singleStr( size = `${this.singleStr(Number(w))}${this.singleStr(
Number(h).toFixed(1) Number(h)
)}`; )}`;
await this.sendCmd(imgFileName, size, position, r); await this.sendCmd(imgFileName, size, position, r);
}, },
......
...@@ -33,7 +33,8 @@ export default { ...@@ -33,7 +33,8 @@ export default {
}; };
}, },
gridSpacing() { gridSpacing() {
if (!this.systemSetting) return { w: 0, h: 0 }; if (!this.systemSetting || !Object.keys(this.systemSetting).length)
return { w: 0, h: 0 };
if (this.systemSetting.unit === "mm") { if (this.systemSetting.unit === "mm") {
return { return {
w: this.systemSetting.gridSpacing + "px", w: this.systemSetting.gridSpacing + "px",
...@@ -58,9 +59,9 @@ export default { ...@@ -58,9 +59,9 @@ export default {
}, },
returnItem() { returnItem() {
if (this.selectIndex < 0) { if (this.selectIndex < 0 && this.imgList.length) {
this.showImgSetting = false; // this.showImgSetting = false;
return null; this.selectIndex = 0;
} }
let item = this.imgList[this.selectIndex]; let item = this.imgList[this.selectIndex];
if (item) { if (item) {
...@@ -267,7 +268,9 @@ export default { ...@@ -267,7 +268,9 @@ export default {
}); });
}, },
ev(type) { ev(type) {
if (this.selectIndex < 0) return; if (this.selectIndex < 0 && this.imgList.length) {
this.selectIndex = 0;
}
// if (this.selectIndex === -1) this.selectIndex = 0 // if (this.selectIndex === -1) this.selectIndex = 0
if (!this.imgList[this.selectIndex]) return; if (!this.imgList[this.selectIndex]) return;
...@@ -333,33 +336,17 @@ export default { ...@@ -333,33 +336,17 @@ export default {
close() { close() {
this.showImgSetting = false; this.showImgSetting = false;
}, },
onDragDebounce(left, top, item, index) {},
dragStop(data, item) { dragStop(data, item) {
this.$set(item, "y", data.y); this.$set(item, "y", data.y);
this.$set(item, "x", data.x); this.$set(item, "x", data.x);
// console.log(left, top)
// if (!this.imgList[this.selectIndex]) return
// this.$set(this.imgList[this.selectIndex], 'x', left)
// this.$set(this.imgList[this.selectIndex], 'y', top)
// this.selectIndex = -1
// this.actionList.unshift({
// t: 'drag',
// x: left,
// y: top
// })
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
// this.$store.commit('changeActionList', this.actionList)
}, },
resizeStop(data, item) { resizeStop(data, item) {
// if (this.selectIndex === -1) this.selectIndex = 0 if (this.selectIndex < 0 && this.imgList.length) this.selectIndex = 0;
if (this.selectIndex < 0) return;
this.$set(item, "y", data.y); this.$set(item, "y", data.y);
this.$set(item, "w", data.w); this.$set(item, "w", data.w);
this.$set(item, "h", data.h); this.$set(item, "h", data.h);
this.$set(item, "x", data.x); this.$set(item, "x", data.x);
console.log("resizeStop", data);
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
}, },
resizing(index) {}, resizing(index) {},
...@@ -426,7 +413,6 @@ export default { ...@@ -426,7 +413,6 @@ export default {
}); });
}, },
getBackFile(files, callback) { getBackFile(files, callback) {
console.log(files);
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++) {
...@@ -435,6 +421,7 @@ export default { ...@@ -435,6 +421,7 @@ export default {
that.getImageSize(files[i].url).then(data => { 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 rate = data.height / data.width;
that.imgList = [];
that.imgList.push({ that.imgList.push({
url: files[i].url, url: files[i].url,
fileName: files[i].fileName, fileName: files[i].fileName,
...@@ -444,7 +431,7 @@ export default { ...@@ -444,7 +431,7 @@ export default {
x: w, x: w,
y: (bw * (2 / 3) * rate) / 2, y: (bw * (2 / 3) * rate) / 2,
h: bw * (2 / 3) * rate, h: bw * (2 / 3) * rate,
r: 0, r: 0
}); });
that.selectIndex = that.imgList.length - 1; that.selectIndex = that.imgList.length - 1;
that.showImgSetting = true; that.showImgSetting = true;
...@@ -459,11 +446,11 @@ export default { ...@@ -459,11 +446,11 @@ export default {
let that = this; let that = this;
let bw = document.getElementById("line").clientWidth; let bw = document.getElementById("line").clientWidth;
let bh = document.getElementById("line").clientHeight; let bh = document.getElementById("line").clientHeight;
console.log(bw, bh);
that.$nextTick(() => { that.$nextTick(() => {
that.getImageSize(file.url).then(data => { that.getImageSize(file.url).then(data => {
let w = document.getElementById("line").clientWidth / 2; let w = document.getElementById("line").clientWidth / 2;
let rate = data.height / data.width; let rate = data.height / data.width;
that.imgList = [];
that.imgList.push({ that.imgList.push({
url: file.url, url: file.url,
w: bw * (2 / 3), w: bw * (2 / 3),
...@@ -589,10 +576,8 @@ export default { ...@@ -589,10 +576,8 @@ export default {
this.systemSetting = this.$dataStore.get("setting"); this.systemSetting = this.$dataStore.get("setting");
break; break;
case "uploadImage": case "uploadImage":
this.addFile(value, file => { this.addFile(value, () => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
// this.selectImgList.push(file)
// this.selectImgIndex = this.selectImgList.length - 1
}); });
break; break;
case "sendFile": case "sendFile":
...@@ -662,7 +647,7 @@ export default { ...@@ -662,7 +647,7 @@ export default {
<img <img
crossOrigin="anonymous" crossOrigin="anonymous"
:src="item.url" :src="item.url"
:id="item.fileName+'_'+index" :id="item.fileName + '_' + index"
alt="" alt=""
class="sucaitu-img" class="sucaitu-img"
/> />
...@@ -679,8 +664,11 @@ export default { ...@@ -679,8 +664,11 @@ export default {
</vue-drag-resize-rotate> </vue-drag-resize-rotate>
</div> </div>
<div <div
v-if="systemSetting.gridShow === 1" :class="{'no-border-grid':systemSetting.gridShow !== 1}"
:style="{ width: gridWH.w + 'px', height: gridWH.h + 'px' }" :style="{
width: gridWH.w + 'px',
height: gridWH.h + 'px'
}"
class="grid" class="grid"
> >
<div <div
...@@ -905,6 +893,12 @@ img { ...@@ -905,6 +893,12 @@ img {
.sucaitu-img { .sucaitu-img {
position: relative; position: relative;
} }
.no-border-grid{
border-color:transparent !important;
*{
border-color:transparent !important;
}
}
</style> </style>
<style> <style>
.el-upload { .el-upload {
......
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