Commit 9d42e007 by linjinhong

fix:惠立彩添加操作日志

parent 4c37f10e
...@@ -270,14 +270,6 @@ async function createWindow() { ...@@ -270,14 +270,6 @@ async function createWindow() {
); );
} }
}); });
await dialog.showMessageBox({
// 移除第一个参数 mainWindow,解除与主窗口的模态关联
type: "info",
title: "设置成功",
message: "工厂域名已更新",
detail: "新域名:" + newDomain,
buttons: ["确定"],
});
} else { } else {
console.log("用户取消了域名设置"); console.log("用户取消了域名设置");
} }
......
...@@ -32,6 +32,11 @@ module.exports = { ...@@ -32,6 +32,11 @@ module.exports = {
store.set("desktoVersion", version); store.set("desktoVersion", version);
}, },
getVersion: () => store.get("desktoVersion") || "print", getVersion: () => store.get("desktoVersion") || "print",
//存储当前打印驱动版本
setNowDate: (version) => {
store.set("nowDate", version);
},
getNowDate: () => store.get("nowDate") || "",
//跳过更新和储存更新 //跳过更新和储存更新
setSkip: (value) => { setSkip: (value) => {
...@@ -70,7 +75,7 @@ module.exports = { ...@@ -70,7 +75,7 @@ module.exports = {
setDesktopDevice: (version) => { setDesktopDevice: (version) => {
store.set("desktopDevice", version); store.set("desktopDevice", version);
}, },
getDesktopDevice: () => store.get("desktopDevice") || "1", getDesktopDevice: () => store.get("desktopDevice") || 1,
// ===== 基于缓存 Map 优化的 orderInfo 方法 ===== // ===== 基于缓存 Map 优化的 orderInfo 方法 =====
getOrderInfo: () => store.get("orderInfo") || [], getOrderInfo: () => store.get("orderInfo") || [],
......
...@@ -4,6 +4,7 @@ import bus from "@/bus"; ...@@ -4,6 +4,7 @@ import bus from "@/bus";
// import { getProductCnByFactorySubOrderNumberApi } from "../../../api/index.js"; // import { getProductCnByFactorySubOrderNumberApi } from "../../../api/index.js";
import { ipcRenderer } from "electron"; import { ipcRenderer } from "electron";
import { copySingleImage } from "@/server/utils/index.js"; import { copySingleImage } from "@/server/utils/index.js";
const moment = require("moment");
import pkg from "../../../../package.json"; import pkg from "../../../../package.json";
import UpdateDialog from "@/views/design/updateDialog.vue"; import UpdateDialog from "@/views/design/updateDialog.vue";
...@@ -26,6 +27,8 @@ const { ...@@ -26,6 +27,8 @@ const {
removeFromOrderInfo, removeFromOrderInfo,
setOrderInfo, setOrderInfo,
getLocation, getLocation,
setNowDate,
getNowDate,
} = require("@/server/utils/store"); } = require("@/server/utils/store");
export default { export default {
...@@ -152,6 +155,8 @@ export default { ...@@ -152,6 +155,8 @@ export default {
deep: true, deep: true,
}, },
desktopDevice(val) { desktopDevice(val) {
console.log("desktopDevice", val);
this.checked = false; this.checked = false;
}, },
imgList: { imgList: {
...@@ -181,7 +186,7 @@ export default { ...@@ -181,7 +186,7 @@ export default {
// imgPath: item.productionFile, // imgPath: item.productionFile,
// targetPath: getLocation("downloadLocation2"), // targetPath: getLocation("downloadLocation2"),
// }); // });
this.$message.success("图片已发送目标文件夹下"); // this.$message.success("图片已发送目标文件夹下");
} catch (error) { } catch (error) {
this.$message.error("发送失败"); this.$message.error("发送失败");
...@@ -242,13 +247,19 @@ export default { ...@@ -242,13 +247,19 @@ export default {
} }
//如果为惠立彩则判断当前saveImgList字段中的power是否全是true 是则生产完成 //如果为惠立彩则判断当前saveImgList字段中的power是否全是true 是则生产完成
const canCallApi = const canCallApi =
this.desktoVersion !== 3 || this.desktopDevice != 3 ||
(data.saveImgList?.every((el) => el.power) ?? false); (data.saveImgList?.every((el) => el.power) ?? false);
console.log(
"data",
data.saveImgList?.every((el) => el.power),
);
console.log("canCallApi", canCallApi);
console.log("desktopDevice", this.desktopDevice);
if (canCallApi) { if (canCallApi) {
console.log("生产完成"); console.log("生产完成");
removeFromOrderInfo(data.newId); removeFromOrderInfo(data.newId);
bus.$emit("busEmit", { value: data.newId, type: "completeMessage" });
console.log("本地数据removeFromOrderInfo:", getOrderInfo()); console.log("本地数据removeFromOrderInfo:", getOrderInfo());
//生产完成后在本地删除 //生产完成后在本地删除
return; return;
...@@ -550,11 +561,19 @@ export default { ...@@ -550,11 +561,19 @@ export default {
if (this.productionNo === "") if (this.productionNo === "")
return this.$message.warning("请录入生产单号"); return this.$message.warning("请录入生产单号");
if (!this.isAutoFinish && !this.isFirst) const today = moment(new Date()).format("YYYY-MM-DD");
console.log("today", today);
if (!this.isAutoFinish && today != getNowDate()) {
this.$confirm("请注意自动完成上一单未勾选", "提示", { this.$confirm("请注意自动完成上一单未勾选", "提示", {
confirmButtonText: "确定", confirmButtonText: "跳过提示",
type: "warning", type: "warning",
}).then((res) => {
if (res == "confirm") {
setNowDate(today);
}
}); });
}
if (this.productionNo.includes("_")) { if (this.productionNo.includes("_")) {
const parts = this.productionNo.split("_"); const parts = this.productionNo.split("_");
...@@ -1053,13 +1072,13 @@ export default { ...@@ -1053,13 +1072,13 @@ export default {
</div> </div>
</div> </div>
<div class="center-input"> <div class="center-input">
<el-button <!-- <el-button
@click="clearArray" @click="clearArray"
size="medium" size="medium"
style="margin-right: 10px" style="margin-right: 10px"
type="primary" type="primary"
>清空本地数据 >清空本地数据
</el-button> </el-button> -->
<el-input <el-input
@keyup.enter.native="getDataInfo" @keyup.enter.native="getDataInfo"
style="width: 40%;" style="width: 40%;"
......
...@@ -17,6 +17,8 @@ const { ...@@ -17,6 +17,8 @@ const {
getDesktopDevice, getDesktopDevice,
setLocation, setLocation,
getLocation, getLocation,
getOrderInfo,
setOrderInfo,
} = require("@/server/utils/store"); } = require("@/server/utils/store");
export default { export default {
...@@ -208,6 +210,9 @@ export default { ...@@ -208,6 +210,9 @@ export default {
newDesktopDevice: getDesktopDevice(), newDesktopDevice: getDesktopDevice(),
downloadLocation1: getLocation("downloadLocation1"), downloadLocation1: getLocation("downloadLocation1"),
downloadLocation2: getLocation("downloadLocation2"), downloadLocation2: getLocation("downloadLocation2"),
logList: [],
activeName: "1",
localeData: getOrderInfo(),
}; };
}, },
watch: { watch: {
...@@ -320,6 +325,10 @@ export default { ...@@ -320,6 +325,10 @@ export default {
productDetail(newValue) { productDetail(newValue) {
this.detail = { ...newValue }; this.detail = { ...newValue };
console.log(325, this.detail);
if (this.newDesktopDevice == 3) {
this.logList.unshift(`订单:${this.detail.newId}已查询`);
}
try { try {
if (typeof this.detail.imageAry == "string") { if (typeof this.detail.imageAry == "string") {
this.detail.imageAry = JSON.parse(this.detail.imageAry); this.detail.imageAry = JSON.parse(this.detail.imageAry);
...@@ -1215,6 +1224,20 @@ export default { ...@@ -1215,6 +1224,20 @@ export default {
}; };
ipcRenderer.on("select-folder-result", handleFolderResult); ipcRenderer.on("select-folder-result", handleFolderResult);
}, },
tabHandleClick() {},
formatLog(text) {
// 这里假设文本格式是固定的
return text
.replace(
`订单:${this.detail.newId}`,
`<strong>订单:${this.detail.newId}</strong>`,
)
.replace(/生产完成/, '<span style="color:#85ce61">生产完成</span>');
},
clearLocalFn() {
setOrderInfo([]);
this.localeData = [];
},
}, },
mounted() { mounted() {
this.imgHeight = window.screen.height + "px"; this.imgHeight = window.screen.height + "px";
...@@ -1224,6 +1247,10 @@ export default { ...@@ -1224,6 +1247,10 @@ export default {
let { type, value, size } = v; let { type, value, size } = v;
switch (type) { switch (type) {
case "completeMessage":
this.logList.unshift(`订单:${value}生产完成`);
this.localeData = getOrderInfo();
break;
case "grid": case "grid":
this.row = value.row; this.row = value.row;
this.col = value.col; this.col = value.col;
...@@ -1278,6 +1305,7 @@ export default { ...@@ -1278,6 +1305,7 @@ export default {
); );
} }
} }
this.localeData = getOrderInfo();
break; break;
default: default:
break; break;
...@@ -1753,7 +1781,7 @@ export default { ...@@ -1753,7 +1781,7 @@ export default {
:style="{ 'z-index': isView ? '0' : '-1' }" :style="{ 'z-index': isView ? '0' : '-1' }"
/> />
</div> </div>
<div v-show="newDesktopDevice != 3"> <div v-if="newDesktopDevice != 3">
<print-dialog <print-dialog
:isDisabled="isView" :isDisabled="isView"
:visible="printDialogShow" :visible="printDialogShow"
...@@ -1768,6 +1796,56 @@ export default { ...@@ -1768,6 +1796,56 @@ export default {
></i> ></i>
</print-dialog> </print-dialog>
</div> </div>
<div v-else>
<div class="box">
<div class="logBox">
<el-tabs
v-model="activeName"
type="card"
@tab-click="tabHandleClick"
>
<el-tab-pane label="操作日志" name="1" class="tabBox">
<div
v-for="(value, index) in logList"
:key="index"
v-html="formatLog(value)"
></div>
</el-tab-pane>
<el-tab-pane label="本地数据" name="2" class="tabBox"
><div
v-for="(value, index) in localeData"
:key="index"
class="localItem"
>
<pre class="json-pre">{{
JSON.stringify(value, null, 2)
}}</pre>
</div></el-tab-pane
>
</el-tabs>
</div>
<div
v-if="activeName == 1"
style="padding: 10px; border-top: 1px solid #ececec"
>
<el-button
type="primary"
size="small"
@click="
() => {
logList = [];
}
"
>清空日志</el-button
>
</div>
<div v-else style="padding: 10px; border-top: 1px solid #ececec">
<el-button type="primary" size="small" @click="clearLocalFn"
>清空本地数据</el-button
>
</div>
</div>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -2182,7 +2260,7 @@ img { ...@@ -2182,7 +2260,7 @@ img {
.left-bg-color { .left-bg-color {
position: absolute; position: absolute;
left: -57px; left: -45px;
} }
} }
...@@ -2218,4 +2296,57 @@ img { ...@@ -2218,4 +2296,57 @@ img {
width: 100px !important; width: 100px !important;
} }
} }
.box {
position: relative;
width: 400px;
height: 100%;
background-color: #fff;
display: flex;
justify-content: space-between;
flex-direction: column;
// padding-bottom: 10px;
box-sizing: border-box;
z-index: 99;
.el-tabs {
height: 100%;
::v-deep .el-tabs__content {
height: calc(100% - 60px);
overflow-y: auto;
}
}
.logBox {
flex: 1;
height: 100%;
.tabBox {
padding: 0 10px;
font-size: 12px;
height: 100%;
.localItem {
margin-bottom: 10px;
}
.json-pre {
white-space: pre-wrap; /* 关键:允许换行 */
word-break: break-word; /* 允许在单词内换行 */
word-wrap: break-word; /* 旧版属性,为了兼容性 */
overflow-wrap: break-word; /* 现代标准 */
font-family: "Courier New", Courier, monospace;
font-size: 12px;
line-height: 1.4;
margin: 0;
// max-height: 300px; /* 限制最大高度 */
// overflow-y: auto; /* 超过最大高度时垂直滚动 */
padding: 8px;
background: #f5f5f5;
border-radius: 3px;
border: 1px solid #e8e8e8;
}
}
}
}
.status-complete {
color: #85ce61;
}
</style> </style>
...@@ -128,6 +128,10 @@ module.exports = { ...@@ -128,6 +128,10 @@ module.exports = {
to: "../html", to: "../html",
}, },
{ {
from: "./huiLiCaiImg/",
to: "../huiLiCaiImg",
},
{
from: "scripts", // 本地脚本目录 from: "scripts", // 本地脚本目录
to: "scripts", // 输出到 resources/scripts to: "scripts", // 输出到 resources/scripts
filter: ["**/*"], // 包含所有文件 filter: ["**/*"], // 包含所有文件
......
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