Commit d6018825 by linjinhong

添加600驱动

parent 41b0277a
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.20",
"version": "1.0.21",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
......
......@@ -8,40 +8,40 @@ const routes = [
path: "/",
name: "login",
meta: {
title: "登录"
title: "登录",
},
component: resolve => require(["../views/login/index.vue"], resolve)
component: (resolve) => require(["../views/login/index.vue"], resolve),
},
{
path: "/design",
name: "design",
meta: {
title: "设计页面"
title: "设计页面",
},
component: resolve => require(["../views/design/index.vue"], resolve)
component: (resolve) => require(["../views/design/index.vue"], resolve),
},
{
path: "/design-detail",
name: "design",
meta: {
title: "设计详情页面"
title: "设计详情页面",
},
component: resolve => require(["../views/design/detail/index.vue"], resolve)
component: (resolve) =>
require(["../views/design/detail/index.vue"], resolve),
},
{
path: "*",
redirect: "/"
}
redirect: "/",
},
];
const router = new VueRouter({
mode: "hash",
base: process.env.BASE_URL,
routes
routes,
});
router.beforeEach((to, from, next) => {
console.log(to, from);
let user = Vue.prototype.$dataStore.get("user");
if (to.path.includes("design-detail")) {
return next();
......
......@@ -116,11 +116,15 @@ export default {
const token = req.headers["jwt-token"];
console.log(72, params);
const urlArr = {
CN: "factory/podJomallOrderProductCn/downloadDesignImages",
US: "factory/podJomallOrderProductUs/downloadDesignImages",
GC: "factory/podJomallOrder/downloadByProduction",
};
let url = urlArr[params.orderType];
console.log(126, url);
let url =
params.type === "CN"
? "factory/podJomallOrder/downloadByProduction"
: "factory/podJomallOrderProductUs/downloadDesignImages";
try {
let { data } = await axios.post(`${env}/${url}`, [...params.ids], {
headers: { "jwt-token": token },
......@@ -166,13 +170,29 @@ export default {
findByPodProductionNo: async (req, res) => {
const token = req.headers["jwt-token"];
const params = req.body;
let url =
params.type === "CN"
? "factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber"
: "factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber";
let paramsField =
params.type === "CN" ? "thirdSubOrderNumber" : "factorySubOrderNumber";
try {
const urlArr = {
CN: {
field: "factorySubOrderNumber",
url:
"factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber",
},
US: {
field: "factorySubOrderNumber",
url:
"factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber",
},
GC: {
field: "thirdSubOrderNumber",
url: "factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber",
},
};
let url = urlArr[params.orderType].url;
let paramsField = urlArr[params.orderType].field;
console.log("url", url);
console.log("paramsField", paramsField);
console.log("thirdSubOrderNumber", params.thirdSubOrderNumber);
let { data } = await axios.get(`${env}/${url}`, {
params: {
[paramsField]: params.thirdSubOrderNumber,
......@@ -199,15 +219,32 @@ export default {
completeDelivery: async (req, res) => {
const token = req.headers["jwt-token"];
const params = req.body;
let url =
params.type === "CN"
? "factory/podJomallOrderProduct/completeDelivery"
: "factory/podJomallOrderProductUs/completeDelivery";
const urlArr = {
CN: {
data: {
id: params.id,
podJomallOrderCnId: params.podJomallOrderCnId || "",
},
url: "factory/podJomallOrderProductCn/completeDelivery",
},
US: {
data: {
id: params.id,
podJomallOrderUsId: params.podJomallOrderUsId || "",
},
url: "factory/podJomallOrderProductUs/completeDelivery",
},
GC: {
data: { id: params.id },
url: "factory/podJomallOrderProduct/completeDelivery",
},
};
let url = urlArr[params.orderType].url;
let postData = urlArr[params.orderType].data;
console.log("postData", postData);
console.log("240url", url);
let postData =
params.type === "CN"
? { id: params.id }
: { id: params.id, podJomallOrderUsId: params.podJomallOrderUsId };
try {
let { data } = await axios.post(`${env}/${url}`, postData, {
headers: { "jwt-token": token },
......
......@@ -59,6 +59,8 @@ export const downloadImage = (list) => {
try {
// console.log("Formatted Folder Name:", folderName); // 检查替换结果
let dirPath = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
console.log(62, dirPath);
console.log("list", list);
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
......
const Store = require("electron-store");
const store = new Store();
const store = new Store({ watch: false });
module.exports = {
setVersion: (version) => {
store.set("desktoVersion", version);
console.log("store", store.get("desktoVersion"));
},
getVersion: () => store.get("desktoVersion") || "print",
setBoard: (version) => {
......
import Vue from "vue";
import Vuex from "vuex";
const { getVersion } = require("@/server/utils/store");
Vue.use(Vuex);
const defaultSetting = {
gridShow: 1,
......@@ -17,11 +17,13 @@ export default new Vuex.Store({
productDetail: {},
windowWH: { width: 0, height: 0 },
desktopDevice: 1, //1是兄弟,2是其他
desktoVersion: "print", //print2.0是2.0,print4.0是4.0
desktoVersion: getVersion() || "print", //print2.0是2.0,print4.0是4.0 print600是600
orderType: "GC", //GC是POD,CN是PODCN US是PODUS
WHproportion: 1, //宽高比例
defaultProportion: 1,
isPreView: false,
actionIndex: -1,
systemSetting: {
gridShow: 1,
gridValue: 0,
......@@ -30,23 +32,23 @@ export default new Vuex.Store({
autoPrint: false,
gridSpacing: 10,
},
grid: [
// {
// label: "18×22(仅GTX600支持)",
// value: 6,
// row: 18,
// col: 22,
// h: 0,
// w: 0,
// },
// {
// label: "24×24(仅GTX600支持)",
// value: 5,
// row: 24,
// col: 24,
// h: 0,
// w: 0,
// },
defaultGrid: [
{
label: "16×18",
value: 1,
row: 16,
col: 18,
h: 0,
w: 0,
},
{
label: "16×21",
value: 0,
row: 16,
col: 21,
h: 0,
w: 0,
},
{
label: "7×8",
value: 4,
......@@ -71,23 +73,8 @@ export default new Vuex.Store({
h: 0,
w: 0,
},
{
label: "16×18",
value: 1,
row: 16,
col: 18,
h: 0,
w: 0,
},
{
label: "16×21",
value: 0,
row: 16,
col: 21,
h: 0,
w: 0,
},
],
grid: [],
},
mutations: {
setDefaultSetting(state) {
......@@ -123,16 +110,12 @@ export default new Vuex.Store({
setIsPreView(state, value) {
state.isPreView = value;
},
setOrderType(state, value) {
state.orderType = value;
},
setGrid(state) {
// state.grid[0].h = h;
// state.grid[0].w = w;
console.log(state.WHproportion);
state.grid.forEach((el) => {
if (el.value == 0) {
console.log("16*21", state.WHproportion);
console.log("16*21..", state.defaultProportion);
let proportion = state.WHproportion;
if (state.defaultProportion == 1.5) {
proportion = 1.4;
......@@ -142,20 +125,23 @@ export default new Vuex.Store({
el.h = 630 * proportion;
el.w = 480 * proportion;
} else if (el.value == 1) {
console.log("16*18", state.WHproportion);
console.log("16*18..", state.defaultProportion);
el.h = 540 * state.WHproportion;
el.w = 480 * state.WHproportion;
} else if (el.value == 2) {
el.h = 480 * state.WHproportion;
el.w = 420 * state.WHproportion;
} else if (el.value == 3) {
el.h = 360 * (state.WHproportion + 1);
el.w = 300 * (state.WHproportion + 1);
el.h = 360 * (state.WHproportion + 0.8);
el.w = 300 * (state.WHproportion + 0.8);
} else if (el.value == 4) {
el.h = 240 * (state.WHproportion + 1.8);
el.w = 210 * (state.WHproportion + 1.8);
} else if (el.value == 5) {
el.h = 720 * 1.2;
el.w = 720 * 1.2;
} else if (el.value == 6) {
el.h = 660 * 1.4;
el.w = 540 * 1.4;
}
});
},
......@@ -165,6 +151,32 @@ export default new Vuex.Store({
setCountry(state, data) {
state.countryList = data;
},
getNewGrid(state) {
if (state.desktoVersion == "print600") {
state.grid = [
...state.defaultGrid.slice(0, 1),
...state.defaultGrid.slice(2),
{
label: "18×22",
value: 6,
row: 18,
col: 22,
h: 0,
w: 0,
},
{
label: "24×24",
value: 5,
row: 24,
col: 24,
h: 0,
w: 0,
},
];
} else {
state.grid = [...state.defaultGrid];
}
},
},
getters: {
systemSetting(state) {
......
......@@ -26,7 +26,6 @@ function endLoading() {
// Add a request interceptor
service.interceptors.request.use(
(config) => {
console.log(Vue.prototype.$dataStore);
const user = Vue.prototype.$dataStore.get("user");
if (user) {
config.headers["jwt-token"] = user.token;
......
......@@ -68,6 +68,7 @@ export default {
},
imgList: [],
detail: null,
selectBgColor: "#ececec",
predefineColors: [
"#ff4500",
......@@ -92,7 +93,7 @@ export default {
return this.$store.getters.getActionList;
},
...mapState(["grid", "defaultProportion", "countryList"]),
...mapState(["defaultProportion", "countryList", "orderType", "grid"]),
},
mounted() {
// console.log(pkg, "pkg");
......@@ -114,7 +115,6 @@ export default {
setting: {
handler(val) {
this.$dataStore.set("setting", val);
console.log(val, "val");
bus.$emit("busEmit", { type: "updateSystemSetting" });
},
......@@ -155,13 +155,17 @@ export default {
},
async setData(data) {
if (!data) return this.$message.warning("请扫描生产单号");
await this.$api
.post("/completeDelivery", {
id: data.id,
type: this.factoryType,
podJomallOrderUsId: data.podJomallOrderUsId,
})
.then(() => {});
const params = {
id: data.id,
orderType: this.orderType,
};
if (this.orderType === "CN") {
params.podJomallOrderCnId = data.podJomallOrderCnId;
} else if (this.orderType === "US") {
params.podJomallOrderUsId = data.podJomallOrderUsId;
}
await this.$api.post("/completeDelivery", params).then(() => {});
this.$message.success("操作成功");
},
async sureData() {
......@@ -343,11 +347,13 @@ export default {
}
}
if (!imageResList.length) {
console.log(347, this.orderType);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
let res = await this.$api.post("/downloadBySubOrderNumber", {
ids: [this.detail.id],
device: this.$store.state.desktopDevice,
type: this.factoryType,
orderType: this.orderType,
});
if (!res.data.length) return this.$message.warning("未找到素材图!");
res.data.forEach((el) => {
......@@ -452,16 +458,28 @@ export default {
console.error("清理目录时发生错误:", error.msg);
}
if (this.factoryType !== "US") {
const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头
if (regex.test(this.productionNo)) {
this.productionNo =
this.productionNo.split("_")[0] +
"-" +
this.productionNo.split("_")[
this.productionNo.split("_").length - 1
];
if (this.productionNo.includes("_")) {
let code;
let processed;
const parts = this.productionNo.split("_");
const prefix = parts[0];
// 查找第一个包含"PSC"的片段
const pscPart = parts.find((part) => part.includes("PSC"));
if (pscPart) {
processed = `${prefix}-${pscPart}`;
if (pscPart.includes("JMPSC")) {
this.productionNo = processed;
}
code = processed;
}
this.$store.commit("setOrderType", this.classifyField(code));
} else {
const str = this.productionNo.split("PSC")[0];
this.$store.commit("setOrderType", str);
}
console.log(423, this.productionNo);
......@@ -472,7 +490,7 @@ export default {
"/findByPodProductionNo",
{
thirdSubOrderNumber: this.productionNo,
type: this.factoryType,
orderType: this.orderType,
}
);
this.detail = findByPodProductionNo.data;
......@@ -511,6 +529,20 @@ export default {
console.error("路径不存在:", path);
}
},
classifyField(field) {
// 第一类:以"AAAF-CNPSC"开头
if (field.startsWith("AAAF-CNPSC")) {
return "CN";
}
// 第二类:以"AAAF-USPSC"开头
if (field.startsWith("AAAF-USPSC")) {
return "US";
}
// 第三类:所有其他情况
return "GC";
},
changeActionIndex(t) {
let index = this.actionIndex;
if (t === "+") {
......@@ -588,9 +620,11 @@ export default {
},
changeDesktoVersionFn(value) {
console.log(553, value);
this.selectGridIndex = 0;
this.$store.commit("changeDesktoVersion", value);
ipcRenderer.send("update-version", value);
this.$store.commit("getNewGrid");
this.command(0);
},
async cutImgFn(arr) {
if (!arr.length) return arr;
......@@ -733,13 +767,13 @@ export default {
>
<el-option label="2.0" value="print"></el-option>
<el-option label="4.0" value="print4.0"></el-option>
<!-- <el-option label="600" value="print600"></el-option> -->
<el-option label="600" value="print600"></el-option>
</el-select>
</div>
<el-dropdown trigger="click" @command="command" :hide-on-click="false">
<el-button style="height: 100%;margin-right: 0" size="small"
>{{ grid[selectGridIndex].label }}
>{{ grid[selectGridIndex]?.label }}
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="i" v-for="(it, i) in grid" :key="i">
......
......@@ -154,9 +154,13 @@ export default {
if (this.grid[gridValue].col == 8) {
return data + 1.8;
} else if (this.grid[gridValue].col == 12) {
return data + 1;
return data + 0.8;
} else if (this.grid[gridValue].col == 21) {
return 1.4;
} else if (this.grid[gridValue].col == 22) {
return 1.4;
} else if (this.grid[gridValue].col == 24) {
return 1.2;
} else {
return data;
}
......@@ -306,7 +310,6 @@ export default {
});
},
return_data() {
this.getWHproportion();
// let dom_id = `${this.imgList[0].fileName}_0`;
// const image = document.getElementById(dom_id);
const image = document.getElementById("imgBox");
......
......@@ -32,6 +32,7 @@ export default {
document.removeEventListener("drop", this.drop);
},
created() {
this.$store.commit("getNewGrid");
ipcRenderer.on("window-size", (event, size) => {
const { width, height } = size;
console.log(`接收到窗口尺寸:${width}x${height}`);
......@@ -144,6 +145,7 @@ export default {
"windowWH",
"countryList",
"desktoVersion",
"orderType",
]),
},
data() {
......@@ -271,6 +273,8 @@ export default {
16: { left: "26%", top: "49%" },
18: { left: "22%", top: "52%" },
21: { left: "22%", top: "56%" },
22: { left: "19%", top: "60%" },
24: { left: "12%", top: "56%" },
};
// 查找对应的位置设置
......@@ -940,7 +944,7 @@ export default {
let res = await this.$api.post("/downloadBySubOrderNumber", {
ids: [this.detail.id],
device: this.$store.state.desktopDevice,
type: this.factoryType,
orderType: this.orderType,
});
if (res.data.length === 0) return this.$message.warning("未找到素材图!");
let imgList = [];
......@@ -1077,9 +1081,13 @@ export default {
if (this.gridWH.col == 8) {
return data + 1.8;
} else if (this.gridWH.col == 12) {
return data + 1;
return data + 0.8;
} else if (this.gridWH.col == 21) {
return 1.4;
} else if (this.gridWH.col == 22) {
return 1.4;
} else if (this.gridWH.col == 24) {
return 1.2;
} else {
return data;
}
......@@ -1183,7 +1191,9 @@ export default {
style="width: 50%;"
>
<img :src="img.url" />
<div v-if="img.title" class="imgTitle">{{ img.title }}</div>
<div v-if="img.title && img.title.length < 2" class="imgTitle">
{{ img.title }}
</div>
</div>
</div>
<el-empty v-else description="效果图为空"></el-empty>
......@@ -1225,8 +1235,10 @@ export default {
style="width: 50%;"
@click.stop.prevent="selectImg(img, i)"
>
<img :src="img.productionFile" />
<div v-if="img.title" class="imgTitle">{{ img.title }}</div>
<img v-if="img.productionFile" :src="img.productionFile" />
<div v-if="img.title && img.title.length < 2" class="imgTitle">
{{ img.title }}
</div>
</div>
</div>
<el-empty v-else description="素材图为空"></el-empty>
......@@ -1897,6 +1909,7 @@ img {
cursor: pointer;
box-sizing: border-box;
text-align: center;
line-height: 1;
&:first-child {
margin-right: 5px;
}
......@@ -1904,7 +1917,7 @@ img {
width: auto;
height: auto;
max-height: 210px;
max-height: 190px;
}
.imgTitle {
......@@ -1919,6 +1932,7 @@ img {
text-align: center;
border-radius: 50%;
background-color: #409eff;
line-height: 25px;
}
}
}
......
......@@ -30,6 +30,7 @@ export default {
...mapState(["grid"]),
},
created() {
this.$store.commit("getNewGrid");
this.userList = this.$dataStore.get("userList") || [];
ipcRenderer.on("window-size", (event, size) => {
const { width, height } = size;
......
......@@ -108,6 +108,10 @@ module.exports = {
to: "../print4.0",
},
{
from: "./print600/",
to: "../print600",
},
{
from: "./logs/",
to: "../logs",
},
......
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