Commit d4e47cf3 by zhuzhequan

bug修复

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