Commit f197473e by linjinhong

更改兄弟打印机编辑模式和预览模式 并取消第二窗口 将生产单信息添加至左边栏

parent 11276510
...@@ -25,7 +25,7 @@ yarn-error.log* ...@@ -25,7 +25,7 @@ yarn-error.log*
/dist_electron /dist_electron
# 排除 print/Input 目录下的 .bat 文件 # 排除 print/Input 目录下的 .bat 文件
!/print/Input/*.bat /print/Input/*.png
print/Profile/* print/Profile/*
/logs /logs
\ No newline at end of file
...@@ -36,22 +36,22 @@ async function createWindow() { ...@@ -36,22 +36,22 @@ async function createWindow() {
nodeIntegration: true, nodeIntegration: true,
}, },
}); });
let newWindow = new BrowserWindow({ // let newWindow = new BrowserWindow({
fullscreen: false, // fullscreen: false,
width: 1000, // width: 1000,
height: 1000, // height: 1000,
webPreferences: { // webPreferences: {
nodeIntegration: true, // nodeIntegration: true,
//配置预加载脚本文件(preload),此处起名为preloadOther // //配置预加载脚本文件(preload),此处起名为preloadOther
//p.s.路径为绝对路径 // //p.s.路径为绝对路径
// preload: path.join(__dirname, "./preloadOther.js") // // preload: path.join(__dirname, "./preloadOther.js")
}, // },
}); // });
console.log(winURL + "#" + `/design-detail`); console.log(winURL + "#" + `/design-detail`);
//指定副屏幕打开的网页 // //指定副屏幕打开的网页
await newWindow.loadURL(winURL + "#" + `/design-detail`); // await newWindow.loadURL(winURL + "#" + `/design-detail`);
newWindow.reload(); // newWindow.reload();
// win.on("closed", () => { // win.on("closed", () => {
// //这一段放外面的话,如果你电脑没双屏会报错。 // //这一段放外面的话,如果你电脑没双屏会报错。
// win = null; // win = null;
...@@ -90,11 +90,11 @@ async function createWindow() { ...@@ -90,11 +90,11 @@ async function createWindow() {
win.removeAllListeners(); win.removeAllListeners();
win = null; win = null;
} }
// 确保 newWindow 还未销毁,才执行关闭操作 // // 确保 newWindow 还未销毁,才执行关闭操作
if (newWindow && !newWindow.isDestroyed()) { // if (newWindow && !newWindow.isDestroyed()) {
newWindow.close(); // newWindow.close();
newWindow = null; // newWindow = null;
} // }
}); });
// 自动更新逻辑开始 // 自动更新逻辑开始
...@@ -166,6 +166,15 @@ async function createWindow() { ...@@ -166,6 +166,15 @@ async function createWindow() {
}); });
}); });
}); });
win.on("resize", () => {
const { width, height } = win.getBounds();
win.webContents.send("window-size", { width, height });
});
// 监听窗口的 reload 事件
win.webContents.on("did-finish-load", () => {
const { width, height } = win.getBounds();
win.webContents.send("window-size", { width, height });
});
} }
app.on("activate", async () => { app.on("activate", async () => {
...@@ -176,6 +185,8 @@ app.on("activate", async () => { ...@@ -176,6 +185,8 @@ app.on("activate", async () => {
app.on("ready", async () => { app.on("ready", async () => {
await createWindow(); await createWindow();
// 获取当前窗口的尺寸
globalShortcut.register("F5", () => { globalShortcut.register("F5", () => {
return false; return false;
}); });
......
...@@ -13,7 +13,10 @@ export default new Vuex.Store({ ...@@ -13,7 +13,10 @@ export default new Vuex.Store({
state: { state: {
actionList: [], actionList: [],
imgList: [], imgList: [],
productDetail: {},
desktopDevice: 1, //1是兄弟,2是其他 desktopDevice: 1, //1是兄弟,2是其他
WHproportion: 1, //宽高比例
isPreView: false, //宽高比例
actionIndex: -1, actionIndex: -1,
systemSetting: { systemSetting: {
gridShow: 1, gridShow: 1,
...@@ -43,6 +46,15 @@ export default new Vuex.Store({ ...@@ -43,6 +46,15 @@ export default new Vuex.Store({
changeDesktopDevice(state, value) { changeDesktopDevice(state, value) {
state.desktopDevice = value; state.desktopDevice = value;
}, },
setProductDetail(state, value) {
state.productDetail = value;
},
setWHproportion(state, value) {
state.WHproportion = value;
},
setIsPreView(state, value) {
state.isPreView = value;
},
}, },
getters: { getters: {
systemSetting(state) { systemSetting(state) {
......
...@@ -6,7 +6,7 @@ import { Loading } from "element-ui"; ...@@ -6,7 +6,7 @@ import { Loading } from "element-ui";
const service = axios.create({ const service = axios.create({
baseURL: "http://localhost:3000", // url = base url + request url baseURL: "http://localhost:3000", // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests // withCredentials: true, // send cookies when cross-domain requests
timeout: 50000000 // request timeout timeout: 50000000, // request timeout
}); });
let loading; let loading;
...@@ -15,7 +15,7 @@ function startLoading() { ...@@ -15,7 +15,7 @@ function startLoading() {
lock: true, lock: true,
text: "拼命加载中...", text: "拼命加载中...",
spinner: "el-icon-loading", spinner: "el-icon-loading",
background: "rgba(0,0,0,.7)" background: "rgba(0,0,0,.7)",
}); });
} }
...@@ -25,7 +25,7 @@ function endLoading() { ...@@ -25,7 +25,7 @@ function endLoading() {
// Add a request interceptor // Add a request interceptor
service.interceptors.request.use( service.interceptors.request.use(
config => { (config) => {
console.log(Vue.prototype.$dataStore); console.log(Vue.prototype.$dataStore);
const user = Vue.prototype.$dataStore.get("user"); const user = Vue.prototype.$dataStore.get("user");
if (user) { if (user) {
...@@ -34,7 +34,7 @@ service.interceptors.request.use( ...@@ -34,7 +34,7 @@ service.interceptors.request.use(
startLoading(); startLoading();
return config; return config;
}, },
error => { (error) => {
endLoading(); endLoading();
// do something with request error // do something with request error
return Promise.reject(error); return Promise.reject(error);
...@@ -53,7 +53,7 @@ service.interceptors.response.use( ...@@ -53,7 +53,7 @@ service.interceptors.response.use(
* Here is just an example * Here is just an example
* You can also judge the status by HTTP Status Code * You can also judge the status by HTTP Status Code
*/ */
async response => { async (response) => {
// do something with response data // do something with response data
const res = response.data; const res = response.data;
endLoading(); endLoading();
...@@ -66,7 +66,7 @@ service.interceptors.response.use( ...@@ -66,7 +66,7 @@ service.interceptors.response.use(
Vue.prototype.$dataStore.delete("user"); Vue.prototype.$dataStore.delete("user");
Vue.prototype.$message.error({ Vue.prototype.$message.error({
showClose: true, showClose: true,
message: res.msg || res.message || "Error" message: res.msg || res.message || "Error",
}); });
setTimeout(() => { setTimeout(() => {
location.reload(); location.reload();
...@@ -81,7 +81,7 @@ service.interceptors.response.use( ...@@ -81,7 +81,7 @@ service.interceptors.response.use(
} }
Vue.prototype.$message.error({ Vue.prototype.$message.error({
showClose: true, showClose: true,
message: res.msg || res.message || "Error" message: res.msg || res.message || "Error",
}); });
// reject // reject
return Promise.reject(new Error(res.msg || res.message || "Error")); return Promise.reject(new Error(res.msg || res.message || "Error"));
...@@ -91,7 +91,7 @@ service.interceptors.response.use( ...@@ -91,7 +91,7 @@ service.interceptors.response.use(
} }
return Promise.resolve(res); return Promise.resolve(res);
}, },
error => { (error) => {
endLoading(); endLoading();
// do something with response error // do something with response error
return Promise.reject(error); return Promise.reject(error);
...@@ -99,3 +99,4 @@ service.interceptors.response.use( ...@@ -99,3 +99,4 @@ service.interceptors.response.use(
); );
export default service; export default service;
export { startLoading, endLoading };
...@@ -22,13 +22,15 @@ export const grid = [ ...@@ -22,13 +22,15 @@ export const grid = [
value: 1, value: 1,
row: 16, row: 16,
col: 18, col: 18,
h: 542, // h: 540,
w: 482 // w: 480,
} h: 0,
w: 0,
},
// { // {
// label: '16×21', // label: '16×21',#77797a
// value: 0, // value: 0,
// col: 16, // col: 16,
// row: 21 // row: 21
// } // }
]; ];
\ No newline at end of file
...@@ -216,6 +216,9 @@ export default { ...@@ -216,6 +216,9 @@ export default {
} }
); );
this.detail = findByPodProductionNo.data; this.detail = findByPodProductionNo.data;
console.log(219, this.detail);
this.$store.commit("setProductDetail", findByPodProductionNo.data);
ipcRenderer.send("win-subScreen", findByPodProductionNo.data); ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示 // 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
...@@ -223,7 +226,6 @@ export default { ...@@ -223,7 +226,6 @@ export default {
this.detail.id, this.detail.id,
this.$store.state.desktopDevice, this.$store.state.desktopDevice,
]); ]);
console.log("res111", res);
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 || []);
...@@ -240,7 +242,6 @@ export default { ...@@ -240,7 +242,6 @@ export default {
}); });
} }
}); });
console.log(arr, "arr");
res.data = arr.filter((el) => el.type !== 1); res.data = arr.filter((el) => el.type !== 1);
// 延迟后强制激活窗口 // 延迟后强制激活窗口
......
...@@ -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";
import { mapState } from "vuex";
export default { export default {
data() { data() {
...@@ -123,6 +124,7 @@ export default { ...@@ -123,6 +124,7 @@ export default {
return "1.5"; return "1.5";
} }
}, },
...mapState(["WHproportion"]),
}, },
watch: { watch: {
printSetting: { printSetting: {
...@@ -300,11 +302,11 @@ export default { ...@@ -300,11 +302,11 @@ export default {
const relativeY = imageRect.top - lineRect.top; const relativeY = imageRect.top - lineRect.top;
console.log(dom_id); console.log(dom_id);
// 获取图片的宽高 // 获取图片的宽高
let w = image.clientWidth; // 图片宽 let w = image.clientWidth / this.WHproportion; // 图片宽
let h = image.clientHeight; // 图片高 let h = image.clientHeight / this.WHproportion; // 图片高
console.log(w, h, "w,h"); console.log(w, h, "w,h");
const x = relativeX; const x = relativeX / this.WHproportion;
const y = relativeY; const y = relativeY / this.WHproportion;
const r = this.imgList[0].r; const r = this.imgList[0].r;
console.log(w, h); console.log(w, h);
const x_mm = this.pxToUnit(x, "mm"); const x_mm = this.pxToUnit(x, "mm");
...@@ -372,16 +374,11 @@ export default { ...@@ -372,16 +374,11 @@ export default {
h = this.numberToStr4(h); h = this.numberToStr4(h);
console.log("print", w, h); console.log("print", w, h);
if (w > 4100 || h > 4500) { if (w > 4200 || h > 4700) {
return this.$message.warning( return this.$message.warning(
"打印图片素材宽度不能超过410mm,长度不能超过450mm" "打印图片素材宽度不能超过410mm,长度不能超过450mm"
); );
} }
// console.log(x, "x");
// console.log(y, "y");
// console.log(w, "w");
// console.log(h, "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 = ""; // 位置
......
<script> <script>
import { pxToUnit, unitToPx } from "@/utils"; import { pxToUnit, unitToPx } from "@/utils";
import { mapState } from "vuex";
export default { export default {
data() { data() {
...@@ -20,7 +21,9 @@ export default { ...@@ -20,7 +21,9 @@ export default {
}, },
}; };
}, },
computed: {
...mapState(["isPreView"]),
},
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
...@@ -130,21 +133,21 @@ export default { ...@@ -130,21 +133,21 @@ export default {
</script> </script>
<template> <template>
<div class="drawer" :style="{ animation: `ltr-drawer-in .3s 1ms` }"> <div class="drawer">
<div class="title">
图片编辑(单位:{{ $dataStore.get("setting").unit }}
</div>
<div class="img-form"> <div class="img-form">
<div class="title">
图片编辑(单位:{{ $dataStore.get("setting").unit }}
</div>
<el-form <el-form
size="small" size="small"
:disabled="!item" :disabled="!(item && !isPreView)"
style="" style=""
:model="form" :model="form"
label-position="left" label-position="left"
label-width="30px" label-width="30px"
> >
<el-row :gutter="20"> <el-row :gutter="10">
<el-col :span="12"> <el-col :span="8">
<el-form-item label="x:" prop="x"> <el-form-item label="x:" prop="x">
<div class="form-content"> <div class="form-content">
<el-input @blur="formChange" v-model="form.x"></el-input> <el-input @blur="formChange" v-model="form.x"></el-input>
...@@ -155,7 +158,7 @@ export default { ...@@ -155,7 +158,7 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="8">
<el-form-item label="y:"> <el-form-item label="y:">
<div class="form-content"> <div class="form-content">
<el-input @blur="formChange" v-model="form.y"></el-input> <el-input @blur="formChange" v-model="form.y"></el-input>
...@@ -166,7 +169,19 @@ export default { ...@@ -166,7 +169,19 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="8">
<el-form-item label="r:">
<div class="form-content">
<el-input maxlength="3" @blur="formChange" v-model="form.r">
</el-input>
<div class="set-value">
<i @click="addValue('r')" class="el-icon-arrow-up"></i>
<i @click="reduceValue('r')" class="el-icon-arrow-down"></i>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="w:"> <el-form-item label="w:">
<div class="form-content"> <div class="form-content">
<el-input @blur="formChange('w')" v-model="form.w"></el-input> <el-input @blur="formChange('w')" v-model="form.w"></el-input>
...@@ -177,7 +192,7 @@ export default { ...@@ -177,7 +192,7 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="8">
<el-form-item label="h:"> <el-form-item label="h:">
<div class="form-content"> <div class="form-content">
<el-input @blur="formChange('h')" v-model="form.h"></el-input> <el-input @blur="formChange('h')" v-model="form.h"></el-input>
...@@ -188,19 +203,8 @@ export default { ...@@ -188,19 +203,8 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="r:"> <el-col :span="8">
<div class="form-content">
<el-input maxlength="3" @blur="formChange" v-model="form.r">
</el-input>
<div class="set-value">
<i @click="addValue('r')" class="el-icon-arrow-up"></i>
<i @click="reduceValue('r')" class="el-icon-arrow-down"></i>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="z:"> <el-form-item label="z:">
<div class="form-content"> <div class="form-content">
<el-input @blur="formChange" v-model="form.zIndex"> </el-input> <el-input @blur="formChange" v-model="form.zIndex"> </el-input>
...@@ -214,9 +218,12 @@ export default { ...@@ -214,9 +218,12 @@ export default {
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col
:span="24"
style="display: flex;justify-content: space-between;padding:0 30px;"
>
<el-tooltip content="居中"> <el-tooltip content="居中">
<el-button @click="$emit('ev', 'center')" size="mini"> <el-button @click="$emit('ev', 'center')" class="btn">
<img <img
style="width: 13px;height: 13px" style="width: 13px;height: 13px"
src="@/static/icon/juzhong-01.png" src="@/static/icon/juzhong-01.png"
...@@ -225,7 +232,7 @@ export default { ...@@ -225,7 +232,7 @@ export default {
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="垂直居中"> <el-tooltip content="垂直居中">
<el-button @click="$emit('ev', 'y_center')" size="mini"> <el-button @click="$emit('ev', 'y_center')" class="btn">
<img <img
style="width: 13px;height: 13px" style="width: 13px;height: 13px"
src="@/static/icon/vertical.png" src="@/static/icon/vertical.png"
...@@ -234,7 +241,7 @@ export default { ...@@ -234,7 +241,7 @@ export default {
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="水平居中"> <el-tooltip content="水平居中">
<el-button @click="$emit('ev', 'x_center')" size="mini"> <el-button @click="$emit('ev', 'x_center')" class="btn">
<img <img
style="width: 13px;height: 13px" style="width: 13px;height: 13px"
src="@/static/icon/shuipingjuzhong.png" src="@/static/icon/shuipingjuzhong.png"
...@@ -243,7 +250,7 @@ export default { ...@@ -243,7 +250,7 @@ export default {
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="上移一层"> <el-tooltip content="上移一层">
<el-button @click="$emit('ev', 'add_index')" size="mini"> <el-button @click="$emit('ev', 'add_index')" class="btn">
<img <img
style="width: 13px;height: 13px" style="width: 13px;height: 13px"
src="@/static/icon/shangyi.png" src="@/static/icon/shangyi.png"
...@@ -252,7 +259,7 @@ export default { ...@@ -252,7 +259,7 @@ export default {
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="下移一层"> <el-tooltip content="下移一层">
<el-button @click="$emit('ev', 'reduce_index')" size="mini"> <el-button @click="$emit('ev', 'reduce_index')" class="btn">
<img <img
style="width: 13px;height: 13px" style="width: 13px;height: 13px"
src="@/static/icon/xiayi.png" src="@/static/icon/xiayi.png"
...@@ -264,13 +271,14 @@ export default { ...@@ -264,13 +271,14 @@ export default {
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<slot></slot> <slot name="content"></slot>
</div> </div>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.img-form { .img-form {
padding: 10px; padding: 10px;
border: 1px solid #ececec;
} }
::v-deep { ::v-deep {
...@@ -288,7 +296,7 @@ export default { ...@@ -288,7 +296,7 @@ export default {
.set-value { .set-value {
height: 100%; height: 100%;
margin-left: 6px; // margin-left: 6px;
i { i {
width: 20px; width: 20px;
...@@ -306,26 +314,36 @@ export default { ...@@ -306,26 +314,36 @@ export default {
} }
.drawer { .drawer {
width: 300px; width: 400px;
bottom: 0; // bottom: 0;
top: 50px; // top: 50px;
padding: 10px; padding: 10px;
z-index: 99; // z-index: 99;
background: white; background: white;
box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2), box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2),
0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12); 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12);
left: 0; // left: 0;
position: fixed; // position: fixed;
border-right: 1px solid #ececec; border-right: 1px solid #ececec;
height: calc(100vh - 50px); height: calc(100vh - 50px);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
//animation: ltr-drawer-in .3s 1ms; //animation: ltr-drawer-in .3s 1ms;
position: relative;
z-index: 1;
.title { .title {
padding-bottom: 10px; padding-bottom: 10px;
border-bottom: 1px solid #ececec; // font-weight: 600;
font-size: 18px;
margin-bottom: 8px;
// border-bottom: 1px solid #ececec;
} }
} }
.btn {
height: 40px;
width: 60px;
border-color: #c0c4cc;
}
@keyframes ltr-drawer-in { @keyframes ltr-drawer-in {
0% { 0% {
......
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