Commit b6aa61fb by zhuzhequan

添加日志功能

parent c3ac02c5
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
data = fs.readFileSync(p, { encoding: "utf-8" }); data = fs.readFileSync(p, { encoding: "utf-8" });
data = JSON.parse(data); data = JSON.parse(data);
} }
data.push(body); data.unshift(body);
fs.writeFileSync(p, JSON.stringify(data)); fs.writeFileSync(p, JSON.stringify(data));
res.json({ code: 200 }); res.json({ code: 200 });
} catch (e) { } catch (e) {
......
...@@ -356,8 +356,8 @@ export default { ...@@ -356,8 +356,8 @@ export default {
}, },
async toWritePrintLog(send_api_data) { async toWritePrintLog(send_api_data) {
let head_setting = this.$dataStore.get("setting"); let head_setting = this.$dataStore.get("setting");
let position_before_px = this.$dataStore.get("position-before-px"); // 图片的位置信息 px let position_before_px = this.$dataStore.get("position_before_px"); // 图片的位置信息 px
let position_after_px = this.$dataStore.get("position-after-px");// 图片根据单位转换后的px let position_after_px = this.$dataStore.get("position_after_px");// 图片根据单位转换后的px
let position_unit = this.$dataStore.get("position_unit"); // 图片根据单位转换后的px let position_unit = this.$dataStore.get("position_unit"); // 图片根据单位转换后的px
let print_time = moment(new Date()).format("YYYY-MM-DD HH:mm:ss"); // 打印的时间 let print_time = moment(new Date()).format("YYYY-MM-DD HH:mm:ss"); // 打印的时间
let production_no = this.$dataStore.get("production_no"); // 打印的单号 let production_no = this.$dataStore.get("production_no"); // 打印的单号
......
...@@ -41,16 +41,15 @@ export default { ...@@ -41,16 +41,15 @@ export default {
item: { item: {
handler() { handler() {
if (this.item) { if (this.item) {
let setting = this.$dataStore.get("setting"); let setting = this.$dataStore.get("setting");
this.$dataStore.set("position-before-px", JSON.parse(JSON.stringify(this.item))); this.item.y = (this.item.y - this.item.h / 2);
this.item.x = (this.item.x - this.item.w / 2);
this.$dataStore.set("position_before_px", JSON.parse(JSON.stringify(this.item)));
console.log( console.log(
"setting", "setting",
setting setting
); )
this.item.y = (this.item.y - this.item.h / 2);
this.item.x = (this.item.x - this.item.w / 2);
console.log(this.item.x, this.item.y, this.item.h);
let x_mm, w_mm, h_mm, y_mm; let x_mm, w_mm, h_mm, y_mm;
if (setting.unit === "mm") { if (setting.unit === "mm") {
x_mm = Number((this.item.x * 0.84183).toFixed(2)); x_mm = Number((this.item.x * 0.84183).toFixed(2));
...@@ -58,13 +57,11 @@ export default { ...@@ -58,13 +57,11 @@ export default {
h_mm = Number((this.item.h * 0.84183).toFixed(2)); h_mm = Number((this.item.h * 0.84183).toFixed(2));
y_mm = Number((this.item.y * 0.84183).toFixed(2)); y_mm = Number((this.item.y * 0.84183).toFixed(2));
} else if (setting.unit === "inch") { } else if (setting.unit === "inch") {
x_mm = (Number((this.item.x * 0.84183) / 25.4).toFixed(2)); x_mm = Number((this.item.x * 0.84183) / 25.4).toFixed(2);
w_mm = (Number((this.item.w * 0.84183) / 25.4).toFixed(2)); w_mm = Number((this.item.w * 0.84183) / 25.4).toFixed(2);
h_mm = (Number((this.item.h * 0.84183) / 25.4).toFixed(2)); h_mm = Number((this.item.h * 0.84183) / 25.4).toFixed(2);
y_mm = (Number((this.item.y * 0.84183) / 25.4).toFixed(2)); y_mm = Number((this.item.y * 0.84183) / 25.4).toFixed(2);
} }
// return // return
this.form.x = x_mm; this.form.x = x_mm;
this.form.rate = this.item.rate; this.form.rate = this.item.rate;
...@@ -72,12 +69,8 @@ export default { ...@@ -72,12 +69,8 @@ export default {
this.form.w = w_mm; this.form.w = w_mm;
this.form.h = h_mm; this.form.h = h_mm;
this.form.zIndex = this.item.zIndex; this.form.zIndex = this.item.zIndex;
// this.form.sx = x_mm
// this.form.sy = y_mm
// this.form.sh = h_mm
// this.form.sw = w_mm
this.form.r = this.item.r; this.form.r = this.item.r;
this.$dataStore.set(`position-after-px`, JSON.parse(JSON.stringify(this.form))); this.$dataStore.set(`position_after_px`, JSON.parse(JSON.stringify(this.form)));
} }
}, },
immediate: true, immediate: true,
...@@ -114,7 +107,7 @@ export default { ...@@ -114,7 +107,7 @@ export default {
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)));
}, },
addValue(f) { addValue(f) {
......
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