Commit 9d42e007 by linjinhong

fix:惠立彩添加操作日志

parent 4c37f10e
......@@ -270,14 +270,6 @@ async function createWindow() {
);
}
});
await dialog.showMessageBox({
// 移除第一个参数 mainWindow,解除与主窗口的模态关联
type: "info",
title: "设置成功",
message: "工厂域名已更新",
detail: "新域名:" + newDomain,
buttons: ["确定"],
});
} else {
console.log("用户取消了域名设置");
}
......
......@@ -32,6 +32,11 @@ module.exports = {
store.set("desktoVersion", version);
},
getVersion: () => store.get("desktoVersion") || "print",
//存储当前打印驱动版本
setNowDate: (version) => {
store.set("nowDate", version);
},
getNowDate: () => store.get("nowDate") || "",
//跳过更新和储存更新
setSkip: (value) => {
......@@ -70,7 +75,7 @@ module.exports = {
setDesktopDevice: (version) => {
store.set("desktopDevice", version);
},
getDesktopDevice: () => store.get("desktopDevice") || "1",
getDesktopDevice: () => store.get("desktopDevice") || 1,
// ===== 基于缓存 Map 优化的 orderInfo 方法 =====
getOrderInfo: () => store.get("orderInfo") || [],
......
......@@ -4,6 +4,7 @@ import bus from "@/bus";
// import { getProductCnByFactorySubOrderNumberApi } from "../../../api/index.js";
import { ipcRenderer } from "electron";
import { copySingleImage } from "@/server/utils/index.js";
const moment = require("moment");
import pkg from "../../../../package.json";
import UpdateDialog from "@/views/design/updateDialog.vue";
......@@ -26,6 +27,8 @@ const {
removeFromOrderInfo,
setOrderInfo,
getLocation,
setNowDate,
getNowDate,
} = require("@/server/utils/store");
export default {
......@@ -152,6 +155,8 @@ export default {
deep: true,
},
desktopDevice(val) {
console.log("desktopDevice", val);
this.checked = false;
},
imgList: {
......@@ -181,7 +186,7 @@ export default {
// imgPath: item.productionFile,
// targetPath: getLocation("downloadLocation2"),
// });
this.$message.success("图片已发送目标文件夹下");
// this.$message.success("图片已发送目标文件夹下");
} catch (error) {
this.$message.error("发送失败");
......@@ -242,13 +247,19 @@ export default {
}
//如果为惠立彩则判断当前saveImgList字段中的power是否全是true 是则生产完成
const canCallApi =
this.desktoVersion !== 3 ||
this.desktopDevice != 3 ||
(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) {
console.log("生产完成");
removeFromOrderInfo(data.newId);
bus.$emit("busEmit", { value: data.newId, type: "completeMessage" });
console.log("本地数据removeFromOrderInfo:", getOrderInfo());
//生产完成后在本地删除
return;
......@@ -550,11 +561,19 @@ export default {
if (this.productionNo === "")
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("请注意自动完成上一单未勾选", "提示", {
confirmButtonText: "确定",
confirmButtonText: "跳过提示",
type: "warning",
}).then((res) => {
if (res == "confirm") {
setNowDate(today);
}
});
}
if (this.productionNo.includes("_")) {
const parts = this.productionNo.split("_");
......@@ -1053,13 +1072,13 @@ export default {
</div>
</div>
<div class="center-input">
<el-button
<!-- <el-button
@click="clearArray"
size="medium"
style="margin-right: 10px"
type="primary"
>清空本地数据
</el-button>
</el-button> -->
<el-input
@keyup.enter.native="getDataInfo"
style="width: 40%;"
......
......@@ -17,6 +17,8 @@ const {
getDesktopDevice,
setLocation,
getLocation,
getOrderInfo,
setOrderInfo,
} = require("@/server/utils/store");
export default {
......@@ -208,6 +210,9 @@ export default {
newDesktopDevice: getDesktopDevice(),
downloadLocation1: getLocation("downloadLocation1"),
downloadLocation2: getLocation("downloadLocation2"),
logList: [],
activeName: "1",
localeData: getOrderInfo(),
};
},
watch: {
......@@ -320,6 +325,10 @@ export default {
productDetail(newValue) {
this.detail = { ...newValue };
console.log(325, this.detail);
if (this.newDesktopDevice == 3) {
this.logList.unshift(`订单:${this.detail.newId}已查询`);
}
try {
if (typeof this.detail.imageAry == "string") {
this.detail.imageAry = JSON.parse(this.detail.imageAry);
......@@ -1215,6 +1224,20 @@ export default {
};
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() {
this.imgHeight = window.screen.height + "px";
......@@ -1224,6 +1247,10 @@ export default {
let { type, value, size } = v;
switch (type) {
case "completeMessage":
this.logList.unshift(`订单:${value}生产完成`);
this.localeData = getOrderInfo();
break;
case "grid":
this.row = value.row;
this.col = value.col;
......@@ -1278,6 +1305,7 @@ export default {
);
}
}
this.localeData = getOrderInfo();
break;
default:
break;
......@@ -1753,7 +1781,7 @@ export default {
:style="{ 'z-index': isView ? '0' : '-1' }"
/>
</div>
<div v-show="newDesktopDevice != 3">
<div v-if="newDesktopDevice != 3">
<print-dialog
:isDisabled="isView"
:visible="printDialogShow"
......@@ -1768,6 +1796,56 @@ export default {
></i>
</print-dialog>
</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>
</template>
......@@ -2182,7 +2260,7 @@ img {
.left-bg-color {
position: absolute;
left: -57px;
left: -45px;
}
}
......@@ -2218,4 +2296,57 @@ img {
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>
......@@ -128,6 +128,10 @@ module.exports = {
to: "../html",
},
{
from: "./huiLiCaiImg/",
to: "../huiLiCaiImg",
},
{
from: "scripts", // 本地脚本目录
to: "scripts", // 输出到 resources/scripts
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