Commit 495695bd by zhuzhequan

转为工厂端

parent a7b73f94
{
"apiApiHost":"https://factory.jomalls.com/api",
"fileApiUrl":"https://factory.jomalls.com/upload/factory",
"visionUrl":"https://console.jomalls.com"
}
......@@ -77,8 +77,9 @@ async function createWindow() {
});
win.on("closed", () => {
win.removeAllListeners();
win && win.removeAllListeners();
win = null;
newWindow && newWindow.close()
newWindow = null;
});
......
import { downloadImage, toSend, writeProfileXml } from "@/server/utils";
import axios from "axios";
import { returnLogFilePath } from "../utils/log";
var request = require("request");
const compressing = require("compressing");
const uuid = require("uuid");
const path = require("path");
const fs = require("fs");
const os = require("os");
import axios from "axios";
import { returnLogFilePath } from "../utils/log";
const { app } = require("electron");
let fileEnv, env, visionUrl;
axios.defaults.timeout = 12600000;
const multiparty = require("multiparty");
function readEnv() {
let exePath,configPath
if(process.env.NODE_ENV === "development") {
configPath = path.join(__dirname, "../config/env.json");
}else{
exePath = path.dirname(app.getPath("exe")).replace(/\\/g, "/");
configPath = `${exePath}/config/env.json`;
}
console.log(configPath,__dirname);
fs.readFile(configPath, "utf-8", (err, data) => {
if (err) {
console.error("读取配置文件失败:", err);
return;
}
const config = JSON.parse(data);
fileEnv = config.fileApiUrl;
env = config.apiApiHost;
visionUrl = config.visionUrl;
});
}
readEnv()
export default {
writePrintLog: async (req, res) => {
try {
......@@ -33,32 +56,24 @@ export default {
res.json({ code: 500, msg: e });
}
},
getPodProductionInfo: async (req, res) => {
downloadBySubOrderNumber: async (req, res) => {
const token = req.headers["jwt-token"];
const company = req.headers["company"];
const productionNo = req.body.productionNo;
try {
let { data } = await axios.post(
`https://${company}/api/podDesignCenter/getPodImageByProduction`,
{ productionNo },
{ headers: { "jwt-token": token } }
let {
data
} = await axios.get(
`${env}/factory/podJomallOrder/downloadBySubOrderNumber`,
{ params: req.body, headers: { "jwt-token": token } }
);
console.log(data);
if (data.code === 200 && data.data && data.data.length > 0) {
let f = data.data.find(el => !el.productionFile);
if (f) {
return res.json({ code: 500, msg: "存在地址错误的素材图" });
}
data.data.forEach(el => {
if (!el.productionFile.includes("http")) {
el.productionFile = el.productionFile.replace(
"/data/upload/erp/",
""
);
el.productionFile = `https://${company}/upload/erp${el.productionFile}`;
}
let files = [];
if (data.code === 200 && data.message) {
files = [data.message];
files = files.map(el => {
return { url: `${fileEnv}${el}` };
});
downloadImage(data.data)
console.log(files);
downloadImage(files)
.then(data => {
res.json({ code: 200, data });
})
......@@ -75,11 +90,10 @@ export default {
},
findByPodProductionNo: async (req, res) => {
const token = req.headers["jwt-token"];
const company = req.headers["company"];
const q = req.body;
try {
let { data } = await axios.get(
`https://${company}/api/pod/podProductionInfo/findByPodProductionNo`,
`${env}/factory/podJomallOrderProduct/getSubOrderBySubOrderNumber`,
{
params: q,
headers: { "jwt-token": token }
......@@ -101,34 +115,20 @@ export default {
res.json({ code: 500, msg: err });
}
},
commitApply: async (req, res) => {
const company = req.headers["company"];
const q = req.body;
try {
let { data } = await axios.post(
`https://${company}/api/sysDeviceInfo/commitApply`,
q
);
res.send(data);
} catch (err) {
console.log(err);
res.json({ code: 500, msg: err });
}
},
commitApply: async (req, res) => {},
completeDelivery: async (req, res) => {
const token = req.headers["jwt-token"];
const company = req.headers["company"];
const q = req.body;
try {
let { data } = await axios.post(
`https://${company}/api/pod/podProductionInfo/completeDelivery`,
q,
{
headers: { "jwt-token": token }
}
let {
data
} = await axios.post(
`${env}/factory/podJomallOrderProduct/completeDelivery`,
req.body,
{ headers: { "jwt-token": token } }
);
res.json(data);
res.send(data);
} catch (err) {
console.log(err);
res.json({ code: 500, msg: err });
}
},
......@@ -232,14 +232,9 @@ export default {
}
},
login: async (req, res) => {
const { loginName, company, password, deviceId } = req.body;
try {
let { data } = await axios.post(`https://${company}/api/sysLogin/login`, {
loginName,
password,
deviceId
});
console.log(`${env}/factory/login`);
let { data } = await axios.post(`${env}/factory/login`, req.body);
res.send(data);
} catch (err) {
console.log(err);
......@@ -282,8 +277,7 @@ export default {
let from = path.join(process.cwd(), "./resources/app/css.zip");
let dirName = path.join(process.cwd(), "./resources/app/");
let stream = fs.createWriteStream(from);
const company = req.headers["company"];
req.body.url = "https://" + company + req.body.url;
req.body.url = visionUrl + req.body.url;
console.log(req.body.url, "下载zip地址");
request(req.body.url)
.pipe(stream)
......
......@@ -23,7 +23,7 @@ router.post("/commitApply", fn.commitApply);
// 下载素材到本地
router.post("/downloadByDesignId", fn.downloadByDesignId);
// 获取 生产单号返回素材地址
router.post("/getPodProductionInfo", fn.getPodProductionInfo);
router.post("/downloadBySubOrderNumber", fn.downloadBySubOrderNumber);
// 提交生产完成
router.post("/completeDelivery", fn.completeDelivery);
// 根据生产单号查询详情
......
......@@ -27,6 +27,7 @@ function zip(from, to) {
fs.renameSync(file_path, path.join(to, fileName));
arr.push({
fileName: fileName,
designId: data[i].split(".")[0],
productionFile: path.join(to, fileName)
});
}
......@@ -53,7 +54,7 @@ export const downloadImage = list => {
}
let count = 0;
for (let i = 0; i < list.length; i++) {
if (list[i].productionFile && list[i].productionFile.includes("http")) {
if (list[i].url && list[i].url.includes("http")) {
let fileName = "";
let type = 2;
let flag =
......@@ -66,30 +67,24 @@ export const downloadImage = list => {
".7z",
".gz",
".bz2"
].filter(el => list[i].productionFile.toLowerCase().includes(el))
].filter(el => list[i].url.toLowerCase().includes(el))
.length > 0;
if (flag) {
fileName = list[i].productionFile.split("/")[
list[i].productionFile.split("/").length - 1
fileName = list[i].url.split("/")[
list[i].url.split("/").length - 1
];
type = 1;
} else {
fileName = uuid.v4() + ".png";
type = 2;
}
list[i].fileName = fileName;
list[i].type = type;
let p = path.join(process.cwd(), "./print/Input/" + fileName);
let stream = fs.createWriteStream(p);
request(list[i].productionFile)
request(list[i].url)
.pipe(stream)
.on("close", async function() {
if (type === 1) {
let res_data = await zip(p, dirPath);
res_data.forEach(item => {
item.designId = list[i].designId;
});
list[i].list = res_data;
list[i].list = await zip(p, dirPath);
if (count === list.length - 1) {
resolve(list);
}
......
......@@ -43,7 +43,6 @@ const addFormatLog = function(req, res, data) {
const resTime = now - req._startTime;
const token = req.headers["jwt-token"];
const company = req.headers["company"];
const {
ip,
headers,
......@@ -60,7 +59,6 @@ const addFormatLog = function(req, res, data) {
method,
url,
token,
company,
body,
httpVersion,
statusCode,
......@@ -70,21 +68,16 @@ const addFormatLog = function(req, res, data) {
};
// ${JSON.stringify(logInfo)}
logger("log").info(`
时间:${moment(new Date()).format("YYYY-MM-DD HH:mm:ss")}
ip : ${logInfo.ip}
host : ${logInfo.host}
响应时间 : ${logInfo.resTime / 1000} s
method :${logInfo.method}
url :${logInfo.url}
客户 :${logInfo.company || ""}
token :${logInfo.token || ""}
body :${JSON.stringify(logInfo.body)}
状态码 :${logInfo.statusCode}
data :${JSON.stringify(logInfo.data)}
`
);
......
......@@ -28,10 +28,8 @@ service.interceptors.request.use(
config => {
console.log(Vue.prototype.$dataStore);
const user = Vue.prototype.$dataStore.get("user");
const company = Vue.prototype.$dataStore.get("company");
if (user) {
config.headers["jwt-token"] = user.token;
config.headers["company"] = company.domain;
}
startLoading();
return config;
......
<script>
import {ipcRenderer} from "electron";
import { ipcRenderer } from "electron";
export default {
mounted() {
let that = this;
ipcRenderer.on('getProductionNoInfo', (event, data) => {
console.log(data, 99622)
that.trackcodeInput(data)
})
},
watch: {
ipcRenderer.on("getProductionNoInfo", (event, data) => {
console.log(data, 99622);
that.trackcodeInput(data);
});
},
watch: {},
data() {
return {
shipForm: {shipmentType: '1'},
shipForm: { shipmentType: "1" },
logistics: [],
placeholderText: '',
placeholderText: "",
sendNum: 0,
type: 1,
isDownloadImage: false,
isAutoSure: false,
currentStatus: 'IN_PRODUCTION',
currentStatus: "IN_PRODUCTION",
detail: {
imgList: []
},
......@@ -34,129 +32,128 @@ export default {
weight_search_success: require(`../../../assets/audio/weight_search_success.mp3`)
},
productInfo: {},
TrackingNumber: ''
}
TrackingNumber: ""
};
},
methods: {
changeStatus() {
if (!this.detail || Object.keys(this.detail).length <= 1) {
return this.$message.warning('请扫码生产单号')
return this.$message.warning("请扫码生产单号");
}
this.$confirm(
`确定${this.type === 1 ? '生产完成' : '确定发货'}?`,
'提示',
`确定${this.type === 1 ? "生产完成" : "确定发货"}?`,
"提示",
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.setData()
})
this.setData();
});
},
async setData() {
if (this.detail && this.detail.id) {
let url =
this.currentStatus == 'IN_PRODUCTION'
? 'pod/podProductionInfo/completeDelivery'
: 'pod/podProductionInfo/completeShipment'
this.currentStatus == "IN_PRODUCTION"
? "pod/podProductionInfo/completeDelivery"
: "pod/podProductionInfo/completeShipment";
try {
let data =
this.currentStatus == 'IN_PRODUCTION'
this.currentStatus == "IN_PRODUCTION"
? {
id: this.detail.id
}
: {
list: [this.detail],
...this.shipForm
}
};
if (data.list) {
data.list[0].note =
data.list[0].note && typeof data.list[0].note === 'object'
data.list[0].note && typeof data.list[0].note === "object"
? JSON.stringify(data.list[0].note)
: null
: null;
}
await post(url, data)
await post(url, data);
if (this.type === 2) {
this.sendNum = this.sendNum + 1
this.sendNum = this.sendNum + 1;
}
this.playAudio('weight_success')
this.detail = {imgList: []}
this.playAudio("weight_success");
this.detail = { imgList: [] };
} catch (e) {
console.error(e)
this.detail = {imgList: []}
this.playAudio('weight_search_error')
console.error(e);
this.detail = { imgList: [] };
this.playAudio("weight_search_error");
}
}
},
downloadAllWe(data, designId) {
if (!this.detail || Object.keys(this.detail).length <= 1) {
return this.$message.warning('请扫码生产单号')
return this.$message.warning("请扫码生产单号");
}
let params = {
productionNo: this.detail.podProductionNo,
method: 'POST'
}
method: "POST"
};
if (data === 1) {
params = {
...params,
...{
designId
}
}
};
} else if (data === 2) {
params = {
...params,
...{
negativeDesignId: designId
}
}
};
}
downloadFile('podDesignCenter/downloadByDesignId', params)
.then((res) => {
const {data, fileName} = res
let url = window.URL.createObjectURL(data)
downloadFile("podDesignCenter/downloadByDesignId", params)
.then(res => {
const { data, fileName } = res;
let url = window.URL.createObjectURL(data);
// 生成一个a标签
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
// 生成时间戳
link.download = fileName
link.click()
window.URL.revokeObjectURL(url)
})
.catch((err) => {
console.log(err)
link.download = fileName;
link.click();
window.URL.revokeObjectURL(url);
})
.catch(err => {
console.log(err);
});
},
playAudio(key, message) {
let text = ''
let text = "";
switch (key) {
case 'weight_search_success':
text = ''
break
case 'weight_search_error':
text = '请录入生产单号'
break
case 'weight_success':
text = ''
break
case 'weight_repeat':
text = '称重复录入'
break
case "weight_search_success":
text = "";
break;
case "weight_search_error":
text = "请录入生产单号";
break;
case "weight_success":
text = "";
break;
case "weight_repeat":
text = "称重复录入";
break;
default:
text = '请录入跟踪号或重量'
break
}
if (message || text) this.$message.warning(message || text)
let audio = document.createElement('audio')
console.log(key)
audio.src = this.audios[key]
audio.play()
text = "请录入跟踪号或重量";
break;
}
if (message || text) this.$message.warning(message || text);
let audio = document.createElement("audio");
console.log(key);
audio.src = this.audios[key];
audio.play();
},
async trackcodeInput(data) {
// if (this.type === 1) {
// if (this.isAutoSure) {
// await this.setData()
......@@ -166,81 +163,78 @@ export default {
// }
try {
let d = JSON.parse(JSON.stringify(data))
let d = JSON.parse(JSON.stringify(data));
if (d.note) {
d.note = JSON.parse(d.note)
d.note = JSON.parse(d.note);
} else {
d.note = []
d.note = [];
}
let arr = []
let arr = [];
if (!d.imageAry) {
arr = [
{url: d.variantImage, title: '正面', id: d.designId},
{url: d.negativeImage, title: '反面', id: d.negativeDesignId}
].filter((el) => el.url)
{ url: d.variantImage, title: "正面", id: d.designId },
{ url: d.negativeImage, title: "反面", id: d.negativeDesignId }
].filter(el => el.url);
} else {
arr =
typeof d.imageAry == 'string' ? JSON.parse(d.imageAry) : d.imageAry
typeof d.imageAry == "string" ? JSON.parse(d.imageAry) : d.imageAry;
arr = arr.concat([
{url: d.negativeImage, title: '反面', id: d.negativeDesignId}
])
{ url: d.negativeImage, title: "反面", id: d.negativeDesignId }
]);
}
const result = []
console.log(arr)
arr = arr.filter((el) => el.url)
arr = arr.map((el) => {
const result = [];
console.log(arr);
arr = arr.filter(el => el.url);
arr = arr.map(el => {
return {
...el,
...{
url: el.url.includes('http')
url: el.url.includes("http")
? el.url
: window.location.origin + '/upload/erp' + el.url
: window.location.origin + "/upload/erp" + el.url
}
}
})
};
});
for (let i = 0; i < arr.length; i += 2) {
result.push(arr.slice(i, i + 2))
result.push(arr.slice(i, i + 2));
}
d.imgList = result
console.log(d.imgList, 'this.detail.imgList ')
this.detail = d
d.imgList = result;
console.log(d.imgList, "this.detail.imgList ");
this.detail = d;
// 自动下载素材
// if (this.isDownloadImage) {
// this.downloadAllWe()
// }
this.playAudio('weight_search_success')
this.playAudio("weight_search_success");
// this.$nextTick(() => {
// if (this.$refs.trackingNumberRef) {
// this.$refs.trackingNumberRef.focus()
// }
// })
} catch (e) {
console.error(e)
this.productInfo = {}
this.playAudio('weight_search_error')
console.error(e);
this.productInfo = {};
this.playAudio("weight_search_error");
this.$nextTick(() => {
if (this.$refs.trackingNumberRef) {
this.$refs.trackingNumberRef.focus()
this.$refs.trackingNumberRef.focus();
}
})
});
}
}
}
}
};
</script>
<template>
<div class="page">
<div class="sure-btn" v-if="type=== 2">
<div class="sure-btn" v-if="type === 2">
<el-button @click="changeStatus" size="small" type="success">
{{ type === 1 ? '生产完成' : '确定发货' }}
{{ type === 1 ? "生产完成" : "确定发货" }}
</el-button>
</div>
<div class="detail-div">
<div class="detail-content">
......@@ -250,17 +244,20 @@ export default {
v-if="detail.imgList.length > 0"
style="height: 100%"
:autoplay="false"
indicator-position="none">
indicator-position="none"
>
<el-carousel-item
style="height: 100%"
:key="index"
v-for="(item, index) in detail.imgList">
v-for="(item, index) in detail.imgList"
>
<el-row :gutter="10" style="width: 100%; height: 100%">
<el-col
style="height: 100%"
v-for="(it, i) in item"
:key="i"
:span="12">
:span="12"
>
<div class="left-image">
<b v-show="it.title && it.url">
{{ it.title }}
......@@ -276,11 +273,12 @@ export default {
it.id
)
"
v-if="it.id">
v-if="it.id"
>
(DID:{{ it.id }}
</span>
</b>
<img :src="it.url" alt=""/>
<img :src="it.url" alt="" />
</div>
</el-col>
</el-row>
......@@ -304,24 +302,46 @@ export default {
<!-- 查询-->
<!-- </el-button>-->
<!-- </div>-->
<div class="div-text">
<div class="div-content">
<div :title="String(detail?.userMark)" class="div-item">
<span style="font-size: 18px">客户</span>
<p style="color: red; font-size: 30px">
{{ detail?.userMark }}
</p>
</div>
<div
:title="String(detail?.factoryOrderNumber)"
class="div-item"
>
<span style="font-size: 18px">订单号</span>
<p style="color: red; font-size: 22px">
{{ detail?.factoryOrderNumber }}
</p>
</div>
</div>
</div>
<div class="div-text">
<b>生产单信息</b>
<div class="div-content">
<div :title="detail.podProductionNo" class="div-item">
<span>生产单号</span>
<p>{{ detail.podProductionNo }}</p>
<p>{{ detail.factorySubOrderNumber }}</p>
<p
style="margin-left: 5px"
v-if="detail.podProductionNo"
:style="{
color: detail.customizedQuantity > 1 ? 'red' : '#67C23A'
}">
{{ detail.customizedQuantity > 1 ? '多' : '单' }}
}"
>
{{ detail.customizedQuantity > 1 ? "多" : "单" }}
</p>
</div>
<div :title="detail.podProcessName" class="div-item">
<div :title="detail.process" class="div-item">
<span>生产工艺</span>
<p>{{ detail.podProcessName }}</p>
<p>{{ detail.process }}</p>
</div>
<div :title="detail.baseSku" class="div-item">
<span>基版</span>
......@@ -335,162 +355,97 @@ export default {
<span>变体SKU</span>
<p>{{ detail.variantSku }}</p>
</div>
<div :title="detail.categoryName" class="div-item">
<span>类别</span>
<p>{{ detail.categoryName }}</p>
<div :title="detail.num" class="div-item">
<span>数量</span>
<p>{{ detail.num }}</p>
</div>
<div :title="detail.color" class="div-item">
<span>颜色</span>
<p>{{ detail.color }}</p>
<p>{{ detail.baseSku?detail.baseSku.split("_")[1]:null }}</p>
</div>
<div :title="detail.size" class="div-item">
<span>尺寸</span>
<p>{{ detail.size }}</p>
</div>
<div :title="detail.material" class="div-item">
<span>材质</span>
<p>{{ detail.material }}</p>
</div>
<div :title="detail.batchNo" class="div-item">
<span>批次号</span>
<p>{{ detail.batchNo }}</p>
</div>
<div
:title="detail.supplyMerchantCode"
v-if="currentStatus !== 'TO_BE_ASSIGN'"
class="div-item">
<span>供应商编号</span>
<p>{{ detail.supplyMerchantCode }}</p>
</div>
<div :title="detail.shopNumber" class="div-item">
<span>店铺单号</span>
<p>{{ detail.shopNumber }}</p>
</div>
<div :title="detail.shopShortName" class="div-item">
<span>店铺简称</span>
<p>{{ detail.shopShortName }}</p>
</div>
<div :title="detail.expectDeliveryTime" class="div-item">
<span>期望交货时间</span>
<p>{{ detail.expectDeliveryTime }}</p>
</div>
<div :title="detail.purchaseUserName" class="div-item">
<span>采购员</span>
<p>{{ detail.purchaseUserName }}</p>
</div>
<div :title="detail.productionConfirmTime" class="div-item">
<span>生产确认时间</span>
<p>{{ detail.productionConfirmTime }}</p>
</div>
<div :title="detail.followerName" class="div-item">
<span>跟单员</span>
<p>{{ detail.followerName }}</p>
</div>
<div :title="detail.actualDeliveryTime" class="div-item">
<span>实际交货时间</span>
<p>{{ detail.actualDeliveryTime }}</p>
</div>
<div :title="detail.storedName" class="div-item">
<span>入库人</span>
<p>{{ detail.storedName }}</p>
</div>
<div :title="detail.storedTime" class="div-item">
<span>入库时间</span>
<p>{{ detail.storedTime }}</p>
</div>
<div :title="detail.replenishmentNumber" class="div-item">
<span>补胚数量</span>
<p>{{ detail.replenishmentNumber }}</p>
</div>
<div
:title="detail.shipmentType == 1 ? '送货上门' : '快递'"
class="div-item">
<span>发货方式</span>
<p v-if="detail.shipmentType">
{{ detail.shipmentType == 1 ? '送货上门' : '快递' }}
</p>
<p>{{ detail.startStockingTime }}</p>
</div>
</div>
</div>
<div
class="form"
style="margin: 15px 0; background: #4168ff; border-radius: 5px"
v-if="type === 2">
v-if="type === 2"
>
<el-form
:model="shipForm"
ref="form"
label-width="80px"
:inline="false"
size="small">
size="small"
>
<el-form-item style="margin-top: 10px" label="发货方式">
<el-select
style="width: 384px"
v-model="shipForm.shipmentType"
value-key=""
placeholder="请选择">
placeholder="请选择"
>
<el-option label="送货上门" value="1"></el-option>
<el-option label="快递" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item
label="物流方式"
v-if="shipForm.shipmentType == '2'">
v-if="shipForm.shipmentType == '2'"
>
<el-select
v-model="shipForm.shipmentWay"
style="width: 384px"
placeholder="请选择">
placeholder="请选择"
>
<el-option
v-for="(item, index) in logistics"
:key="index"
:label="item.name"
:value="item.name"></el-option>
:value="item.name"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="物流单号"
v-if="shipForm.shipmentType == '2'">
v-if="shipForm.shipmentType == '2'"
>
<el-input
style="width: 384px"
v-model="shipForm.shipmentNumber"
placeholder="请输入"></el-input>
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item
label="物流费用"
v-if="shipForm.shipmentType == '2'">
v-if="shipForm.shipmentType == '2'"
>
<el-input
style="width: 384px"
v-model="shipForm.shipmentFreight"
placeholder="请输入"></el-input>
placeholder="请输入"
></el-input>
</el-form-item>
</el-form>
</div>
<!-- <div-->
<!-- class="btn"-->
<!-- v-if="type !== 2">-->
<!-- <div class="btn-sure">-->
<!-- <el-button style="width: 100%; height: 100%; font-size: 18px" size="large" @click="changeStatus"-->
<!-- type="success">-->
<!-- {{ type === 1 ? '生产完成' : '确定发货' }}-->
<!-- </el-button>-->
<!-- &lt;!&ndash; <div class="check">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-checkbox v-if="type===1" v-model="isAutoSure">自动完成上一单</el-checkbox>&ndash;&gt;-->
<!-- &lt;!&ndash; </div>&ndash;&gt;-->
<!-- </div>-->
<!-- &lt;!&ndash; <div class="btn-down">&ndash;&gt;-->
<!-- &lt;!&ndash; <div class="check">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-checkbox size="large" v-model="isDownloadImage">扫码下载素材</el-checkbox>&ndash;&gt;-->
<!-- &lt;!&ndash; </div>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; size="medium"&ndash;&gt;-->
<!-- &lt;!&ndash; @click="downloadAllWe"&ndash;&gt;-->
<!-- &lt;!&ndash; style="width: 100%; height: 100%; font-size: 18px"&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary">&ndash;&gt;-->
<!-- &lt;!&ndash; 下载素材&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; </div>&ndash;&gt;-->
<!-- </div>-->
<div
v-if="type !== 2"
class="div-text"
......@@ -500,13 +455,15 @@ export default {
flex-shrink: 0;
display: flex;
flex-direction: column;
">
"
>
<div style="height: 100%" class="div-content" v-if="detail.note">
<b style="position: absolute; top: -12px">客户留言信息</b>
<div
v-for="(item, index) in detail.note"
:key="index"
class="div-item">
class="div-item"
>
<span>{{ item.prop }}:</span>
<p>
{{ item.value }}
......@@ -522,7 +479,8 @@ export default {
flex-shrink: 0;
display: flex;
flex-direction: column;
">
"
>
<div style="height: 100%" class="div-content">
<b style="position: absolute; top: -12px">本次发货数量</b>
<div
......@@ -534,40 +492,17 @@ export default {
height: 100%;
font-size: 40px;
justify-content: center;
">
"
>
<h2 style="color: red; font-weight: bold">{{ sendNum }}</h2>
</div>
</div>
</div>
</div>
</div>
<div
class="detail-images"
v-if="detail && Object.keys(detail).length > 1">
<div class="scroll-list">
<div class="img-title">
<b>商品信息</b>
<div class="id">
<img src="@/assets/id.png" alt=""/>
<span>{{ detail.variantSku.split('_')[0] }}</span>
</div>
</div>
<div class="scroll-content">
<div
class="scroll-item"
v-for="(it, i) in detail.colorImageList"
:key="i">
<el-image
style="width: 100%; height: 100%"
:src="it"
:preview-src-list="[it]"></el-image>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="less" scoped>
......@@ -706,7 +641,7 @@ export default {
text-align: right;
width: 100px;
&::after {
content: ':';
content: ":";
margin: 0 3px;
}
}
......@@ -766,11 +701,13 @@ export default {
}
}
}
.detail-div .right .btn .btn-sure, .detail-div .right .btn .btn-down {
.detail-div .right .btn .btn-sure,
.detail-div .right .btn .btn-down {
width: 100%;
position: relative;
}
.detail-div .right .btn .btn-sure .check, .detail-div .right .btn .btn-down .check {
.detail-div .right .btn .btn-sure .check,
.detail-div .right .btn .btn-down .check {
position: absolute;
width: 144px;
height: 100%;
......@@ -809,6 +746,4 @@ export default {
p {
margin: 0;
}
</style>
......@@ -12,13 +12,10 @@ export default {
props: {
user: {
default: {
avatar: ""
avatar: "",
factory: {}
},
type: Object
},
company: {
default: {},
type: Object
}
},
data() {
......@@ -32,16 +29,12 @@ export default {
{
label: "登录记录",
value: "userList"
},{
label: "公司信息",
value: "company"
}, {
},
{
label: "打印预设",
value: "print-setting"
}, {
label: "系统授权信息",
value: "deviceId"
}, {
},
{
label: "系统设置",
value: "setting"
}
......@@ -84,22 +77,6 @@ export default {
};
},
computed: {
avatar() {
if (this.user && this.user.avatar && this.company.domain) {
console.log(this.user, 9);
console.log(this.company, 8);
let host = this.company.domain;
if (host.includes("console")) {
host = host.replace(".jomalls.com", ".joshine.cn");
}
let avatar = this.user.avatar.includes("http")
? this.user.avatar
: `https://${host}/erpimg/${this.user.avatar}`;
console.log(avatar);
return avatar;
}
return "";
},
actionList() {
return this.$store.getters.getActionList;
}
......@@ -149,23 +126,9 @@ export default {
this.$dataStore.delete("user");
this.$router.push("/");
})
.catch(() => {
});
break;
case "company":
this.$confirm("是否切换系统?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$dataStore.delete("company");
this.$dataStore.delete("user");
this.$router.push("/");
})
.catch(() => {
});
.catch(() => {});
break;
case "cache":
this.checkList = [];
this.cacheVisible = true;
......@@ -174,9 +137,8 @@ export default {
},
async setData(data) {
if (!data) return this.$message.warning("请扫描生产单号");
await this.$api.post("/completeDelivery", { id: data.id }).then(() => {
});
this.$message.success("成功生产完成");
await this.$api.post("/completeDelivery", { id: data.id }).then(() => {});
this.$message.success("操作成功");
},
async sureData() {
if (!this.detail || Object.keys(this.detail).length <= 1) {
......@@ -202,13 +164,15 @@ export default {
.then(() => {
for (let k of this.checkList) {
if (k === "print-setting" || k === "deviceId") {
let list = Object.keys(this.$dataStore.store).filter(el => el.includes(k));
let list = Object.keys(this.$dataStore.store).filter(el =>
el.includes(k)
);
list.forEach(el => {
this.$dataStore.delete(el);
});
}else if (k === "token" ) {
this.$dataStore.delete('token');
this.$dataStore.delete('user');
} else if (k === "token") {
this.$dataStore.delete("token");
this.$dataStore.delete("user");
} else {
if (this.$dataStore.get(k)) {
this.$dataStore.delete(k);
......@@ -217,14 +181,13 @@ export default {
}
window.location.reload();
})
.catch(() => {
});
.catch(() => {});
},
async downloadImage() {
if (!this.detail || Object.keys(this.detail).length === 0)
return this.$message.warning("请扫描生产单号");
let params = {
productionNo: this.detail.podProductionNo,
productionNo: this.detail.factorySubOrderNumber,
imgList: this.imgList
};
......@@ -246,30 +209,28 @@ export default {
const findByPodProductionNo = await this.$api.post(
"/findByPodProductionNo",
{
podProductionNo: this.productionNo,
status: "IN_PRODUCTION"
factorySubOrderNumber: this.productionNo
}
);
this.detail = findByPodProductionNo.data;
console.log(findByPodProductionNo.data, "findByPodProductionNo.data");
ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
let res = await this.$api.post("/getPodProductionInfo", {
productionNo: this.productionNo
let res = await this.$api.post("/downloadBySubOrderNumber", {
subOrderNumber: this.productionNo
});
this.imgList = [];
res.data.forEach(el => {
this.imgList = this.imgList.concat(el.list || []);
});
this.$dataStore.set('production_no',this.productionNo)
this.$dataStore.set("production_no", this.productionNo);
if (res.data.length === 0)
return this.$message.warning("未找到素材图!");
let arr = [];
res.data.forEach(el => {
arr.push(el);
if (el.list) {
el.list.forEach(it => {
arr.push({
...it,
...{
designId: el.designId
}
});
arr.push(it);
});
}
});
......@@ -367,9 +328,8 @@ export default {
<!-- </el-tooltip>-->
<el-dropdown trigger="click" @command="command" :hide-on-click="false">
<el-button style="height: 100%;margin-right: 0px" size="small">{{
grid[selectGridIndex].label
}}
<el-button style="height: 100%;margin-right: 0px" size="small"
>{{ grid[selectGridIndex].label }}
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="i" v-for="(it, i) in grid" :key="i">
......@@ -492,7 +452,12 @@ export default {
</el-form-item>
<el-form-item prop="language" label="版本号">
<b>{{ pkg.version || "" }}</b>
<el-button @click="checkUpdate" style="margin-left: 15px" type="text">检查更新</el-button>
<el-button
@click="checkUpdate"
style="margin-left: 15px"
type="text"
>检查更新</el-button
>
</el-form-item>
<!-- <el-form-item label="自动打印模式">-->
......@@ -510,7 +475,7 @@ export default {
<el-tooltip slot="reference" content="设置">
<el-button style="margin-right: 8px" size="small">
<img
style="width: 15px;height: 15px"
style="width: 18px;height: 18px"
src="@/static/icon/shezhi.png"
alt=""
/>
......@@ -539,8 +504,7 @@ export default {
style="margin-left: 10px"
type="primary"
>查询
</el-button
>
</el-button>
<div class="sure-btn">
<el-button
@click="sureData"
......@@ -562,13 +526,14 @@ export default {
</el-button>
</div>
<div class="right-user">
<p>{{ company.companyName }}</p>
<el-avatar :src="avatar"></el-avatar>
<p v-if="user && user.factory">{{ user.factory.title }}</p>
<el-dropdown @command="dropdownCommand">
<b style="cursor:pointer;">{{ user.employeeName }}</b>
<div style="margin-right: 20px">
<b style="cursor:pointer;">{{ user.account }}</b>
<i class="el-icon-arrow-down"></i>
</div>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item command="clear">清除缓存</el-dropdown-item>-->
<el-dropdown-item command="company">切换系统</el-dropdown-item>
<el-dropdown-item command="logout">退出登录</el-dropdown-item>
<el-dropdown-item command="cache">清除缓存</el-dropdown-item>
</el-dropdown-menu>
......@@ -577,12 +542,20 @@ export default {
</div>
<update-dialog ref="updateDialog" />
<el-dialog :visible.sync="cacheVisible" title="清除缓存" width="700px">
<el-checkbox-group style="display: flex;flex-direction: column" v-model="checkList">
<el-checkbox style="margin-bottom: 10px" :label="item.value" v-for="(item,i) in cacheList"
:key="i">{{item.label}}</el-checkbox>
<el-checkbox-group
style="display: flex;flex-direction: column"
v-model="checkList"
>
<el-checkbox
style="margin-bottom: 10px"
:label="item.value"
v-for="(item, i) in cacheList"
:key="i"
>{{ item.label }}</el-checkbox
>
</el-checkbox-group>
<template #footer>
<el-button @click="cacheVisible =false">取消</el-button>
<el-button @click="cacheVisible = false">取消</el-button>
<el-button @click="clearCache" type="primary">清除</el-button>
</template>
</el-dialog>
......@@ -595,7 +568,7 @@ export default {
align-items: center;
b {
margin: 0 10px;
margin: 0 3px;
display: inline-block;
color: black;
font-size: 15px;
......@@ -675,4 +648,12 @@ export default {
z-index: 2;
color: white;
}
::v-deep .el-color-picker__trigger{
background: white;
width: 41px;
}
::v-deep .el-color-picker__color{
border: none !important;
}
</style>
......@@ -903,7 +903,7 @@ export default {
<el-button
@click="getPrintCmd"
type="primary"
style="width: 100%;height: 50px"
style="width: 98%;height: 50px"
>打印
</el-button>
</div>
......@@ -929,10 +929,10 @@ export default {
}
.el-form {
height: 84%;
height: 87%;
display: flex;
flex-direction: column;
padding-top: 15px;
padding-top: 0;
border-top: 1px solid #ececec;
}
......@@ -952,8 +952,7 @@ export default {
font-size: 20px;
color: #409eff;
position: relative;
margin-bottom: 30px;
margin-top: 30px;
margin :15px 0;
display: inline-block;
left: -15px;
}
......@@ -969,6 +968,7 @@ export default {
.setting-left {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 15px 30px;
background-color: white;
......@@ -981,8 +981,8 @@ export default {
}
.bottom-info {
padding: 15px 0;
margin-top: 20px;
padding: 5px 0;
margin-top: 10px;
font-size: 14px;
justify-content: space-between;
border-top: 1px solid #ececec;
......@@ -1080,6 +1080,9 @@ export default {
justify-content: center;
}
}
::v-deep .el-form-item{
margin-bottom: 9px;
}
</style>
<style>
.my-popper {
......
......@@ -9,12 +9,10 @@ export default {
data() {
return {
user: {},
company: {}
};
},
mounted() {
this.user = this.$dataStore.get("user");
this.company = this.$dataStore.get("company");
this.$refs.updateDialog.checkUpdate().then(data => {
if (data) {
// 有新版本更新
......@@ -27,7 +25,7 @@ export default {
<template>
<div class="page">
<p-head :company="company" :user="user" />
<p-head :user="user" />
<p-main />
<update-dialog ref="updateDialog" />
</div>
......
......@@ -41,7 +41,6 @@ export default {
item: {
handler() {
if (this.item) {
let setting = this.$dataStore.get("setting");
this.item.y = (this.item.y - this.item.h / 2);
this.item.x = (this.item.x - this.item.w / 2);
......@@ -139,7 +138,7 @@ export default {
</script>
<template>
<div class="drawer" :style="{animation:`ltr-drawer-in .3s 1ms`}" v-show="visible">
<div class="drawer" :style="{animation:`ltr-drawer-in .3s 1ms`}">
<div class="title">
图片编辑
</div>
......@@ -246,6 +245,7 @@ export default {
</el-row>
</el-form>
</div>
<slot></slot>
</div>
</template>
......@@ -299,6 +299,8 @@ export default {
position: fixed;
border-right: 1px solid #ececec;
height: calc(100vh - 50px);
display: flex;
flex-direction: column;
//animation: ltr-drawer-in .3s 1ms;
.title {
padding-bottom: 10px;
......
......@@ -82,7 +82,7 @@ export default {
selectImgList: [],
bus: 0,
grid,
showImgSetting: false,
showImgSetting: true,
printDialogShow: true,
parentHeight: 0,
width: 0,
......@@ -259,6 +259,8 @@ export default {
},
selectImg(it, i) {
// this.selectImgIndexList.push(i)
let item = this.imgList.find(img=>img.fileName===it.fileName)
if(item) return
// this.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this.getBackFile([it], file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
......@@ -635,17 +637,6 @@ export default {
<div class="page-main">
<div @click="outsideClick" class="main-bg">
<div class="container">
<div class="select-img" v-if="selectImgList.length > 1">
<div
@click="selectImg(it, i)"
v-for="(it, i) in selectImgList"
:key="i"
class="img-item"
>
<img style="width: 100px;height: auto;" :src="it.productionFile" />
<span>{{ it.designId }}</span>
</div>
</div>
<div :style="{ height: imgHeight }" id="img">
<div id="line">
<div
......@@ -738,8 +729,19 @@ export default {
@change="formChange"
:item="returnItem"
@close="close"
:visible="showImgSetting"
>
<div class="select-img" v-if="selectImgList.length">
<div
@click="selectImg(it, i)"
v-for="(it, i) in selectImgList"
:key="i"
class="img-item"
>
<img style="width: 140px;height: auto;" :src="it.productionFile" />
<span>{{ it.designId }}</span>
</div>
</div>
</img-setting>
</div>
</template>
......@@ -870,18 +872,12 @@ export default {
}
.select-img {
border-color: #409eff;
width: 120px;
z-index: 5;
border: 1px solid #ececec;
width: 100%;
overflow: auto;
background-color: gray;
height: calc(100% - 72px);
height: calc(100% - 251px);
padding: 10px;
position: fixed;
box-sizing: border-box;
left: 0;
bottom: 0;
border-right: 1px solid #ececec;
}
img {
......@@ -910,8 +906,9 @@ img {
justify-content: center;
span {
font-size: 14px;
margin: 5px 0;
color: white;
color: black;
}
}
......
......@@ -91,7 +91,7 @@ export default {
console.log("开始下载");
if (this.item.fullUpdate) {
// 全量更新
const domain = "https://" + this.$dataStore.get("company").domain;
const domain = "https://console.jomalls.com";
this.item.url =
domain + this.item.fileList[0].versionPath.replace("/data", "");
console.log(this.item.url);
......
......@@ -3,43 +3,26 @@ export default {
data() {
return {
rules: {
company: [
{ validator:this.validatePass, message: "请检查客户名称", required: true, trigger: "blur" },
factoryCode: [
{ message: "请输入工厂编码", required: true, trigger: "blur" }
],
loginName: [
{ message: "请输入用户名", required: true, trigger: "blur" },
],
password: [{ message: "请输入密码", required: true, trigger: "blur" }],
account: [{ message: "请输入账号", required: true, trigger: "blur" }],
password: [{ message: "请输入密码", required: true, trigger: "blur" }]
},
companyList: [],
userList: [],
company: null,
authorityVisible: false,
remember: true,
authorityForm: {},
form: {
loginName: "",
user: "",
company: "",
password: "",
},
factoryCode: "",
account: "",
password: ""
}
};
},
created() {
// this.len = Object.keys(this.$dataStore.store).length
console.log(this.$dataStore, "this.$dataStore");
// this.$dataStore.set('console_deviceId_Zhe Wang','920d79c4748c2a3c4111fb878ffe44a2')
this.company = this.$dataStore.get("company");
this.userList = this.$dataStore.get("userList") || [];
if (this.company) {
this.form.company = this.company.domain.replace('.jomalls.com','');
}
// if (user) {
// return this.$router.push('/design')
// }
this.getCompanyList();
this.userList = this.$dataStore.get('userList') || []
},
mounted() {
document.addEventListener("keyup", this.keyUp);
......@@ -49,100 +32,26 @@ export default {
},
methods: {
keyUp(e) {
console.log(e);
if (e.keyCode === 13) {
this.login();
}
},
submitAuthority() {
this.$refs.authorityForm.validate((v) => {
if (v) {
this.$api
.post(
"/commitApply",
{
...this.authorityForm,
...this.form,
},
{
headers: {
company: this.form.company +'.jomalls.com',
},
}
)
.then((res) => {
if (res.code === 200) {
this.authorityVisible = false;
this.$message.success("申请提交成功");
this.$dataStore.set(
this.form.company + "_deviceId_" + this.form.loginName,
res.data.id
);
}
});
}
});
},
validatePass(rule, value, callback) {
if (!value || value === "") {
return callback(new Error("请输入客户(例如demo)"));
}
let item = this.companyList.find(
(item) => item.domain.replace(".jomalls.com", "") === value
);
if (item) {
return callback();
} else {
return callback(new Error("未查找到该客户"));
}
},
async login() {
// if (this.form.auth) {
// this.$dataStore.set(this.form.auth.split(",")[0], this.form.auth.split(",")[1]);
// console.log("存储成功");
// console.log(this.$dataStore.store);
//
// }
this.$refs.formRef.validate(async (valid) => {
this.$refs.formRef.validate(async valid => {
if (valid) {
let f = JSON.parse(JSON.stringify(this.form));
if (!f.deviceId) {
f.deviceId = this.$dataStore.get(
f.company + "_deviceId_" + this.form.loginName
);
}
if(f.company){
f.company = f.company.includes('.jomalls.com')?f.company:f.company+'.jomalls.com'
}
if (!f.deviceId) delete f.deviceId;
let { data, code, message } = await this.$api.post("/login", f);
if (code === 411) {
this.authorityVisible = true;
this.authorityForm = {};
return this.$message.error(message);
}
data = {
...data.sysUser,
...{
token: data.token,
},
};
delete data.sysMenus;
delete data.sysUser;
let item = this.companyList.find((item) => item.domain === f.company);
console.log(item, 111222);
this.$dataStore.set("user", data);
this.$dataStore.set("company", item);
console.log( this.$dataStore);
let { data } = await this.$api.post("/login", f);
this.$dataStore.set("user", { ...data.sysUser,...{token:data.token} });
console.log(this.$dataStore);
if (this.remember) {
let userList = this.$dataStore.get("userList");
if (userList) {
if (
!userList.find(
(el) =>
el.loginName === f.loginName && el.company === f.company
el =>
el.account === f.account && el.factoryCode === f.factoryCode
)
) {
userList.push(f);
......@@ -158,21 +67,11 @@ export default {
});
},
userChange(v) {
if (v === "") {
this.form.deviceId = "";
return;
}
console.log(this.userList, v);
this.form.company = this.userList[v].company.replace('.jomalls.com','');
this.form.loginName = this.userList[v].loginName;
this.form.account = this.userList[v].account;
this.form.factoryCode = this.userList[v].factoryCode;
this.form.password = this.userList[v].password;
this.form.deviceId = this.userList[v].deviceId;
},
async getCompanyList() {
let { data } = await this.$api.get("/getCompanyList");
this.companyList = data.records;
},
},
}
}
};
</script>
......@@ -195,45 +94,24 @@ export default {
<el-option
v-for="(it, i) in userList"
:key="i"
:label="`${it.loginName}(${it.company.split('.')[0]})`"
:label="`${it.account}(${it.factoryCode})`"
:value="i"
></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="!company" prop="company">
<!-- <el-select prefix-icon="el-icon-monitor" v-model="form.company">-->
<!-- <el-option v-for="(it,i) in companyList" :key="i" :label="it.companyName" :value="it.domain.replace('.jomalls.com','')"></el-option>-->
<!-- </el-select>-->
<el-input placeholder="客户(例如demo)" prefix-icon="el-icon-monitor" v-model="form.company"
clearable>
<template #append>
.jomalls.com
</template>
</el-input>
<!-- <el-select-->
<!-- filterable-->
<!-- style="width: 100%"-->
<!-- placeholder="系统"-->
<!-- v-model="form.company"-->
<!-- clearable-->
<!-- >-->
<!-- <template slot="prefix">-->
<!-- <i class="el-icon-monitor"></i>-->
<!-- </template>-->
<!-- <el-option-->
<!-- v-for="(it, i) in companyList"-->
<!-- :key="i"-->
<!-- :label="it.companyName"-->
<!-- :value="it.domain"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<el-form-item prop="factoryCode">
<el-input
placeholder="工厂编码"
prefix-icon="el-icon-s-shop"
v-model="form.factoryCode"
clearable
></el-input>
</el-form-item>
<el-form-item prop="loginName">
<el-form-item prop="account">
<el-input
placeholder="用户名"
placeholder="账号"
prefix-icon="el-icon-user"
v-model="form.loginName"
v-model="form.account"
clearable
></el-input>
</el-form-item>
......@@ -247,10 +125,6 @@ export default {
clearable
></el-input>
</el-form-item>
<!-- <el-form-item v-if="len===0" prop="授权信息">-->
<!-- <el-input placeholder="授权信息" prefix-icon="el-icon-lock" v-model="form.auth"-->
<!-- clearable></el-input>-->
<!-- </el-form-item>-->
<div class="check">
<el-checkbox v-model="remember">记住账号</el-checkbox>
</div>
......@@ -267,41 +141,6 @@ export default {
</el-form-item>
</el-form>
</div>
<el-dialog
:close-on-click-modal="false"
title="权限申请"
:visible.sync="authorityVisible"
top="15%"
width="400px"
>
<el-form
:model="authorityForm"
size="mini"
ref="authorityForm"
label-width="80px"
>
<el-form-item label="设备名称" prop="deviceName" required>
<el-input v-model="authorityForm.deviceName"></el-input>
</el-form-item>
<el-form-item label="授权类型" prop="authType" required>
<el-radio v-model="authorityForm.authType" label="1">
一次授权
</el-radio>
<el-radio v-model="authorityForm.authType" label="2">
永久授权
</el-radio>
</el-form-item>
</el-form>
<span slot="footer">
<el-button size="mini" @click="authorityVisible = false">
取 消
</el-button>
<el-button size="mini" type="primary" @click="submitAuthority">
提交
</el-button>
</span>
</el-dialog>
</div>
</template>
......
......@@ -106,6 +106,10 @@ module.exports = {
{
from: "./logs/",
to: "../logs"
},
{
from: "./config/",
to: "../config"
}
]
}
......
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