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() { ...@@ -77,8 +77,9 @@ async function createWindow() {
}); });
win.on("closed", () => { win.on("closed", () => {
win.removeAllListeners(); win && win.removeAllListeners();
win = null; win = null;
newWindow && newWindow.close()
newWindow = null; newWindow = null;
}); });
......
import { downloadImage, toSend, writeProfileXml } from "@/server/utils"; import { downloadImage, toSend, writeProfileXml } from "@/server/utils";
import axios from "axios";
import { returnLogFilePath } from "../utils/log";
var request = require("request"); var request = require("request");
const compressing = require("compressing"); const compressing = require("compressing");
const uuid = require("uuid"); const uuid = require("uuid");
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const os = require("os"); const os = require("os");
import axios from "axios"; const { app } = require("electron");
import { returnLogFilePath } from "../utils/log"; let fileEnv, env, visionUrl;
axios.defaults.timeout = 12600000; axios.defaults.timeout = 12600000;
const multiparty = require("multiparty"); 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 { export default {
writePrintLog: async (req, res) => { writePrintLog: async (req, res) => {
try { try {
...@@ -33,32 +56,24 @@ export default { ...@@ -33,32 +56,24 @@ export default {
res.json({ code: 500, msg: e }); res.json({ code: 500, msg: e });
} }
}, },
getPodProductionInfo: async (req, res) => { downloadBySubOrderNumber: async (req, res) => {
const token = req.headers["jwt-token"]; const token = req.headers["jwt-token"];
const company = req.headers["company"];
const productionNo = req.body.productionNo;
try { try {
let { data } = await axios.post( let {
`https://${company}/api/podDesignCenter/getPodImageByProduction`, data
{ productionNo }, } = await axios.get(
{ headers: { "jwt-token": token } } `${env}/factory/podJomallOrder/downloadBySubOrderNumber`,
{ params: req.body, headers: { "jwt-token": token } }
); );
console.log(data); console.log(data);
if (data.code === 200 && data.data && data.data.length > 0) { let files = [];
let f = data.data.find(el => !el.productionFile); if (data.code === 200 && data.message) {
if (f) { files = [data.message];
return res.json({ code: 500, msg: "存在地址错误的素材图" }); files = files.map(el => {
} return { url: `${fileEnv}${el}` };
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}`;
}
}); });
downloadImage(data.data) console.log(files);
downloadImage(files)
.then(data => { .then(data => {
res.json({ code: 200, data }); res.json({ code: 200, data });
}) })
...@@ -75,11 +90,10 @@ export default { ...@@ -75,11 +90,10 @@ export default {
}, },
findByPodProductionNo: async (req, res) => { findByPodProductionNo: async (req, res) => {
const token = req.headers["jwt-token"]; const token = req.headers["jwt-token"];
const company = req.headers["company"];
const q = req.body; const q = req.body;
try { try {
let { data } = await axios.get( let { data } = await axios.get(
`https://${company}/api/pod/podProductionInfo/findByPodProductionNo`, `${env}/factory/podJomallOrderProduct/getSubOrderBySubOrderNumber`,
{ {
params: q, params: q,
headers: { "jwt-token": token } headers: { "jwt-token": token }
...@@ -101,34 +115,20 @@ export default { ...@@ -101,34 +115,20 @@ export default {
res.json({ code: 500, msg: err }); res.json({ code: 500, msg: err });
} }
}, },
commitApply: async (req, res) => { 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 });
}
},
completeDelivery: async (req, res) => { completeDelivery: async (req, res) => {
const token = req.headers["jwt-token"]; const token = req.headers["jwt-token"];
const company = req.headers["company"];
const q = req.body;
try { try {
let { data } = await axios.post( let {
`https://${company}/api/pod/podProductionInfo/completeDelivery`, data
q, } = await axios.post(
{ `${env}/factory/podJomallOrderProduct/completeDelivery`,
headers: { "jwt-token": token } req.body,
} { headers: { "jwt-token": token } }
); );
res.json(data); res.send(data);
} catch (err) { } catch (err) {
console.log(err);
res.json({ code: 500, msg: err }); res.json({ code: 500, msg: err });
} }
}, },
...@@ -232,14 +232,9 @@ export default { ...@@ -232,14 +232,9 @@ export default {
} }
}, },
login: async (req, res) => { login: async (req, res) => {
const { loginName, company, password, deviceId } = req.body;
try { try {
let { data } = await axios.post(`https://${company}/api/sysLogin/login`, { console.log(`${env}/factory/login`);
loginName, let { data } = await axios.post(`${env}/factory/login`, req.body);
password,
deviceId
});
res.send(data); res.send(data);
} catch (err) { } catch (err) {
console.log(err); console.log(err);
...@@ -282,8 +277,7 @@ export default { ...@@ -282,8 +277,7 @@ export default {
let from = path.join(process.cwd(), "./resources/app/css.zip"); let from = path.join(process.cwd(), "./resources/app/css.zip");
let dirName = path.join(process.cwd(), "./resources/app/"); let dirName = path.join(process.cwd(), "./resources/app/");
let stream = fs.createWriteStream(from); let stream = fs.createWriteStream(from);
const company = req.headers["company"]; req.body.url = visionUrl + req.body.url;
req.body.url = "https://" + company + req.body.url;
console.log(req.body.url, "下载zip地址"); console.log(req.body.url, "下载zip地址");
request(req.body.url) request(req.body.url)
.pipe(stream) .pipe(stream)
......
...@@ -23,7 +23,7 @@ router.post("/commitApply", fn.commitApply); ...@@ -23,7 +23,7 @@ router.post("/commitApply", fn.commitApply);
// 下载素材到本地 // 下载素材到本地
router.post("/downloadByDesignId", fn.downloadByDesignId); router.post("/downloadByDesignId", fn.downloadByDesignId);
// 获取 生产单号返回素材地址 // 获取 生产单号返回素材地址
router.post("/getPodProductionInfo", fn.getPodProductionInfo); router.post("/downloadBySubOrderNumber", fn.downloadBySubOrderNumber);
// 提交生产完成 // 提交生产完成
router.post("/completeDelivery", fn.completeDelivery); router.post("/completeDelivery", fn.completeDelivery);
// 根据生产单号查询详情 // 根据生产单号查询详情
......
...@@ -27,6 +27,7 @@ function zip(from, to) { ...@@ -27,6 +27,7 @@ function zip(from, to) {
fs.renameSync(file_path, path.join(to, fileName)); fs.renameSync(file_path, path.join(to, fileName));
arr.push({ arr.push({
fileName: fileName, fileName: fileName,
designId: data[i].split(".")[0],
productionFile: path.join(to, fileName) productionFile: path.join(to, fileName)
}); });
} }
...@@ -53,7 +54,7 @@ export const downloadImage = list => { ...@@ -53,7 +54,7 @@ export const downloadImage = list => {
} }
let count = 0; let count = 0;
for (let i = 0; i < list.length; i++) { 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 fileName = "";
let type = 2; let type = 2;
let flag = let flag =
...@@ -66,30 +67,24 @@ export const downloadImage = list => { ...@@ -66,30 +67,24 @@ export const downloadImage = list => {
".7z", ".7z",
".gz", ".gz",
".bz2" ".bz2"
].filter(el => list[i].productionFile.toLowerCase().includes(el)) ].filter(el => list[i].url.toLowerCase().includes(el))
.length > 0; .length > 0;
if (flag) { if (flag) {
fileName = list[i].productionFile.split("/")[ fileName = list[i].url.split("/")[
list[i].productionFile.split("/").length - 1 list[i].url.split("/").length - 1
]; ];
type = 1; type = 1;
} else { } else {
fileName = uuid.v4() + ".png"; fileName = uuid.v4() + ".png";
type = 2; type = 2;
} }
list[i].fileName = fileName;
list[i].type = type;
let p = path.join(process.cwd(), "./print/Input/" + fileName); let p = path.join(process.cwd(), "./print/Input/" + fileName);
let stream = fs.createWriteStream(p); let stream = fs.createWriteStream(p);
request(list[i].productionFile) request(list[i].url)
.pipe(stream) .pipe(stream)
.on("close", async function() { .on("close", async function() {
if (type === 1) { if (type === 1) {
let res_data = await zip(p, dirPath); list[i].list = await zip(p, dirPath);
res_data.forEach(item => {
item.designId = list[i].designId;
});
list[i].list = res_data;
if (count === list.length - 1) { if (count === list.length - 1) {
resolve(list); resolve(list);
} }
......
...@@ -43,7 +43,6 @@ const addFormatLog = function(req, res, data) { ...@@ -43,7 +43,6 @@ const addFormatLog = function(req, res, data) {
const resTime = now - req._startTime; const resTime = now - req._startTime;
const token = req.headers["jwt-token"]; const token = req.headers["jwt-token"];
const company = req.headers["company"];
const { const {
ip, ip,
headers, headers,
...@@ -60,7 +59,6 @@ const addFormatLog = function(req, res, data) { ...@@ -60,7 +59,6 @@ const addFormatLog = function(req, res, data) {
method, method,
url, url,
token, token,
company,
body, body,
httpVersion, httpVersion,
statusCode, statusCode,
...@@ -70,21 +68,16 @@ const addFormatLog = function(req, res, data) { ...@@ -70,21 +68,16 @@ const addFormatLog = function(req, res, data) {
}; };
// ${JSON.stringify(logInfo)} // ${JSON.stringify(logInfo)}
logger("log").info(` logger("log").info(`
时间:${moment(new Date()).format("YYYY-MM-DD HH:mm:ss")} 时间:${moment(new Date()).format("YYYY-MM-DD HH:mm:ss")}
ip : ${logInfo.ip} ip : ${logInfo.ip}
host : ${logInfo.host} host : ${logInfo.host}
响应时间 : ${logInfo.resTime / 1000} s 响应时间 : ${logInfo.resTime / 1000} s
method :${logInfo.method} method :${logInfo.method}
url :${logInfo.url} url :${logInfo.url}
客户 :${logInfo.company || ""}
token :${logInfo.token || ""} token :${logInfo.token || ""}
body :${JSON.stringify(logInfo.body)} body :${JSON.stringify(logInfo.body)}
状态码 :${logInfo.statusCode} 状态码 :${logInfo.statusCode}
data :${JSON.stringify(logInfo.data)} data :${JSON.stringify(logInfo.data)}
` `
); );
......
...@@ -28,10 +28,8 @@ service.interceptors.request.use( ...@@ -28,10 +28,8 @@ 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");
const company = Vue.prototype.$dataStore.get("company");
if (user) { if (user) {
config.headers["jwt-token"] = user.token; config.headers["jwt-token"] = user.token;
config.headers["company"] = company.domain;
} }
startLoading(); startLoading();
return config; return config;
......
...@@ -12,13 +12,10 @@ export default { ...@@ -12,13 +12,10 @@ export default {
props: { props: {
user: { user: {
default: { default: {
avatar: "" avatar: "",
factory: {}
}, },
type: Object type: Object
},
company: {
default: {},
type: Object
} }
}, },
data() { data() {
...@@ -32,16 +29,12 @@ export default { ...@@ -32,16 +29,12 @@ export default {
{ {
label: "登录记录", label: "登录记录",
value: "userList" value: "userList"
},{ },
label: "公司信息", {
value: "company"
}, {
label: "打印预设", label: "打印预设",
value: "print-setting" value: "print-setting"
}, { },
label: "系统授权信息", {
value: "deviceId"
}, {
label: "系统设置", label: "系统设置",
value: "setting" value: "setting"
} }
...@@ -84,22 +77,6 @@ export default { ...@@ -84,22 +77,6 @@ export default {
}; };
}, },
computed: { 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() { actionList() {
return this.$store.getters.getActionList; return this.$store.getters.getActionList;
} }
...@@ -149,23 +126,9 @@ export default { ...@@ -149,23 +126,9 @@ export default {
this.$dataStore.delete("user"); this.$dataStore.delete("user");
this.$router.push("/"); this.$router.push("/");
}) })
.catch(() => { .catch(() => {});
});
break;
case "company":
this.$confirm("是否切换系统?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
this.$dataStore.delete("company");
this.$dataStore.delete("user");
this.$router.push("/");
})
.catch(() => {
});
break; break;
case "cache": case "cache":
this.checkList = []; this.checkList = [];
this.cacheVisible = true; this.cacheVisible = true;
...@@ -174,9 +137,8 @@ export default { ...@@ -174,9 +137,8 @@ export default {
}, },
async setData(data) { async setData(data) {
if (!data) return this.$message.warning("请扫描生产单号"); if (!data) return this.$message.warning("请扫描生产单号");
await this.$api.post("/completeDelivery", { id: data.id }).then(() => { await this.$api.post("/completeDelivery", { id: data.id }).then(() => {});
}); this.$message.success("操作成功");
this.$message.success("成功生产完成");
}, },
async sureData() { async sureData() {
if (!this.detail || Object.keys(this.detail).length <= 1) { if (!this.detail || Object.keys(this.detail).length <= 1) {
...@@ -202,13 +164,15 @@ export default { ...@@ -202,13 +164,15 @@ export default {
.then(() => { .then(() => {
for (let k of this.checkList) { for (let k of this.checkList) {
if (k === "print-setting" || k === "deviceId") { 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 => { list.forEach(el => {
this.$dataStore.delete(el); this.$dataStore.delete(el);
}); });
}else if (k === "token" ) { } else if (k === "token") {
this.$dataStore.delete('token'); this.$dataStore.delete("token");
this.$dataStore.delete('user'); this.$dataStore.delete("user");
} else { } else {
if (this.$dataStore.get(k)) { if (this.$dataStore.get(k)) {
this.$dataStore.delete(k); this.$dataStore.delete(k);
...@@ -217,14 +181,13 @@ export default { ...@@ -217,14 +181,13 @@ export default {
} }
window.location.reload(); window.location.reload();
}) })
.catch(() => { .catch(() => {});
});
}, },
async downloadImage() { async downloadImage() {
if (!this.detail || Object.keys(this.detail).length === 0) if (!this.detail || Object.keys(this.detail).length === 0)
return this.$message.warning("请扫描生产单号"); return this.$message.warning("请扫描生产单号");
let params = { let params = {
productionNo: this.detail.podProductionNo, productionNo: this.detail.factorySubOrderNumber,
imgList: this.imgList imgList: this.imgList
}; };
...@@ -246,30 +209,28 @@ export default { ...@@ -246,30 +209,28 @@ export default {
const findByPodProductionNo = await this.$api.post( const findByPodProductionNo = await this.$api.post(
"/findByPodProductionNo", "/findByPodProductionNo",
{ {
podProductionNo: this.productionNo, factorySubOrderNumber: this.productionNo
status: "IN_PRODUCTION"
} }
); );
this.detail = findByPodProductionNo.data; this.detail = findByPodProductionNo.data;
console.log(findByPodProductionNo.data, "findByPodProductionNo.data");
ipcRenderer.send("win-subScreen", findByPodProductionNo.data); ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示 // 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
let res = await this.$api.post("/getPodProductionInfo", { let res = await this.$api.post("/downloadBySubOrderNumber", {
productionNo: this.productionNo 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) if (res.data.length === 0)
return this.$message.warning("未找到素材图!"); return this.$message.warning("未找到素材图!");
let arr = []; let arr = [];
res.data.forEach(el => { res.data.forEach(el => {
arr.push(el);
if (el.list) { if (el.list) {
el.list.forEach(it => { el.list.forEach(it => {
arr.push({ arr.push(it);
...it,
...{
designId: el.designId
}
});
}); });
} }
}); });
...@@ -367,9 +328,8 @@ export default { ...@@ -367,9 +328,8 @@ export default {
<!-- </el-tooltip>--> <!-- </el-tooltip>-->
<el-dropdown trigger="click" @command="command" :hide-on-click="false"> <el-dropdown trigger="click" @command="command" :hide-on-click="false">
<el-button style="height: 100%;margin-right: 0px" size="small">{{ <el-button style="height: 100%;margin-right: 0px" size="small"
grid[selectGridIndex].label >{{ grid[selectGridIndex].label }}
}}
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="i" v-for="(it, i) in grid" :key="i"> <el-dropdown-item :command="i" v-for="(it, i) in grid" :key="i">
...@@ -492,7 +452,12 @@ export default { ...@@ -492,7 +452,12 @@ export default {
</el-form-item> </el-form-item>
<el-form-item prop="language" label="版本号"> <el-form-item prop="language" label="版本号">
<b>{{ pkg.version || "" }}</b> <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>
<!-- <el-form-item label="自动打印模式">--> <!-- <el-form-item label="自动打印模式">-->
...@@ -510,7 +475,7 @@ export default { ...@@ -510,7 +475,7 @@ export default {
<el-tooltip slot="reference" content="设置"> <el-tooltip slot="reference" content="设置">
<el-button style="margin-right: 8px" size="small"> <el-button style="margin-right: 8px" size="small">
<img <img
style="width: 15px;height: 15px" style="width: 18px;height: 18px"
src="@/static/icon/shezhi.png" src="@/static/icon/shezhi.png"
alt="" alt=""
/> />
...@@ -539,8 +504,7 @@ export default { ...@@ -539,8 +504,7 @@ export default {
style="margin-left: 10px" style="margin-left: 10px"
type="primary" type="primary"
>查询 >查询
</el-button </el-button>
>
<div class="sure-btn"> <div class="sure-btn">
<el-button <el-button
@click="sureData" @click="sureData"
...@@ -562,13 +526,14 @@ export default { ...@@ -562,13 +526,14 @@ export default {
</el-button> </el-button>
</div> </div>
<div class="right-user"> <div class="right-user">
<p>{{ company.companyName }}</p> <p v-if="user && user.factory">{{ user.factory.title }}</p>
<el-avatar :src="avatar"></el-avatar>
<el-dropdown @command="dropdownCommand"> <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-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="logout">退出登录</el-dropdown-item>
<el-dropdown-item command="cache">清除缓存</el-dropdown-item> <el-dropdown-item command="cache">清除缓存</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
...@@ -577,12 +542,20 @@ export default { ...@@ -577,12 +542,20 @@ export default {
</div> </div>
<update-dialog ref="updateDialog" /> <update-dialog ref="updateDialog" />
<el-dialog :visible.sync="cacheVisible" title="清除缓存" width="700px"> <el-dialog :visible.sync="cacheVisible" title="清除缓存" width="700px">
<el-checkbox-group style="display: flex;flex-direction: column" v-model="checkList"> <el-checkbox-group
<el-checkbox style="margin-bottom: 10px" :label="item.value" v-for="(item,i) in cacheList" style="display: flex;flex-direction: column"
:key="i">{{item.label}}</el-checkbox> 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> </el-checkbox-group>
<template #footer> <template #footer>
<el-button @click="cacheVisible =false">取消</el-button> <el-button @click="cacheVisible = false">取消</el-button>
<el-button @click="clearCache" type="primary">清除</el-button> <el-button @click="clearCache" type="primary">清除</el-button>
</template> </template>
</el-dialog> </el-dialog>
...@@ -595,7 +568,7 @@ export default { ...@@ -595,7 +568,7 @@ export default {
align-items: center; align-items: center;
b { b {
margin: 0 10px; margin: 0 3px;
display: inline-block; display: inline-block;
color: black; color: black;
font-size: 15px; font-size: 15px;
...@@ -675,4 +648,12 @@ export default { ...@@ -675,4 +648,12 @@ export default {
z-index: 2; z-index: 2;
color: white; color: white;
} }
::v-deep .el-color-picker__trigger{
background: white;
width: 41px;
}
::v-deep .el-color-picker__color{
border: none !important;
}
</style> </style>
...@@ -903,7 +903,7 @@ export default { ...@@ -903,7 +903,7 @@ export default {
<el-button <el-button
@click="getPrintCmd" @click="getPrintCmd"
type="primary" type="primary"
style="width: 100%;height: 50px" style="width: 98%;height: 50px"
>打印 >打印
</el-button> </el-button>
</div> </div>
...@@ -929,10 +929,10 @@ export default { ...@@ -929,10 +929,10 @@ export default {
} }
.el-form { .el-form {
height: 84%; height: 87%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-top: 15px; padding-top: 0;
border-top: 1px solid #ececec; border-top: 1px solid #ececec;
} }
...@@ -952,8 +952,7 @@ export default { ...@@ -952,8 +952,7 @@ export default {
font-size: 20px; font-size: 20px;
color: #409eff; color: #409eff;
position: relative; position: relative;
margin-bottom: 30px; margin :15px 0;
margin-top: 30px;
display: inline-block; display: inline-block;
left: -15px; left: -15px;
} }
...@@ -969,6 +968,7 @@ export default { ...@@ -969,6 +968,7 @@ export default {
.setting-left { .setting-left {
width: 100%; width: 100%;
height: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 15px 30px; padding: 15px 30px;
background-color: white; background-color: white;
...@@ -981,8 +981,8 @@ export default { ...@@ -981,8 +981,8 @@ export default {
} }
.bottom-info { .bottom-info {
padding: 15px 0; padding: 5px 0;
margin-top: 20px; margin-top: 10px;
font-size: 14px; font-size: 14px;
justify-content: space-between; justify-content: space-between;
border-top: 1px solid #ececec; border-top: 1px solid #ececec;
...@@ -1080,6 +1080,9 @@ export default { ...@@ -1080,6 +1080,9 @@ export default {
justify-content: center; justify-content: center;
} }
} }
::v-deep .el-form-item{
margin-bottom: 9px;
}
</style> </style>
<style> <style>
.my-popper { .my-popper {
......
...@@ -9,12 +9,10 @@ export default { ...@@ -9,12 +9,10 @@ export default {
data() { data() {
return { return {
user: {}, user: {},
company: {}
}; };
}, },
mounted() { mounted() {
this.user = this.$dataStore.get("user"); this.user = this.$dataStore.get("user");
this.company = this.$dataStore.get("company");
this.$refs.updateDialog.checkUpdate().then(data => { this.$refs.updateDialog.checkUpdate().then(data => {
if (data) { if (data) {
// 有新版本更新 // 有新版本更新
...@@ -27,7 +25,7 @@ export default { ...@@ -27,7 +25,7 @@ export default {
<template> <template>
<div class="page"> <div class="page">
<p-head :company="company" :user="user" /> <p-head :user="user" />
<p-main /> <p-main />
<update-dialog ref="updateDialog" /> <update-dialog ref="updateDialog" />
</div> </div>
......
...@@ -41,7 +41,6 @@ export default { ...@@ -41,7 +41,6 @@ export default {
item: { item: {
handler() { handler() {
if (this.item) { if (this.item) {
let setting = this.$dataStore.get("setting"); let setting = this.$dataStore.get("setting");
this.item.y = (this.item.y - this.item.h / 2); this.item.y = (this.item.y - this.item.h / 2);
this.item.x = (this.item.x - this.item.w / 2); this.item.x = (this.item.x - this.item.w / 2);
...@@ -139,7 +138,7 @@ export default { ...@@ -139,7 +138,7 @@ export default {
</script> </script>
<template> <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 class="title">
图片编辑 图片编辑
</div> </div>
...@@ -246,6 +245,7 @@ export default { ...@@ -246,6 +245,7 @@ export default {
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
<slot></slot>
</div> </div>
</template> </template>
...@@ -299,6 +299,8 @@ export default { ...@@ -299,6 +299,8 @@ export default {
position: fixed; position: fixed;
border-right: 1px solid #ececec; border-right: 1px solid #ececec;
height: calc(100vh - 50px); height: calc(100vh - 50px);
display: flex;
flex-direction: column;
//animation: ltr-drawer-in .3s 1ms; //animation: ltr-drawer-in .3s 1ms;
.title { .title {
padding-bottom: 10px; padding-bottom: 10px;
......
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
selectImgList: [], selectImgList: [],
bus: 0, bus: 0,
grid, grid,
showImgSetting: false, showImgSetting: true,
printDialogShow: true, printDialogShow: true,
parentHeight: 0, parentHeight: 0,
width: 0, width: 0,
...@@ -259,6 +259,8 @@ export default { ...@@ -259,6 +259,8 @@ export default {
}, },
selectImg(it, i) { selectImg(it, i) {
// this.selectImgIndexList.push(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.selectImgIndexList = Array.from(new Set(this.selectImgIndexList))
this.getBackFile([it], file => { this.getBackFile([it], file => {
this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList))); this.imgHistoryList.push(JSON.parse(JSON.stringify(this.imgList)));
...@@ -635,17 +637,6 @@ export default { ...@@ -635,17 +637,6 @@ export default {
<div class="page-main"> <div class="page-main">
<div @click="outsideClick" class="main-bg"> <div @click="outsideClick" class="main-bg">
<div class="container"> <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 :style="{ height: imgHeight }" id="img">
<div id="line"> <div id="line">
<div <div
...@@ -738,8 +729,19 @@ export default { ...@@ -738,8 +729,19 @@ export default {
@change="formChange" @change="formChange"
:item="returnItem" :item="returnItem"
@close="close" @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> </img-setting>
</div> </div>
</template> </template>
...@@ -870,18 +872,12 @@ export default { ...@@ -870,18 +872,12 @@ export default {
} }
.select-img { .select-img {
border-color: #409eff; border: 1px solid #ececec;
width: 120px; width: 100%;
z-index: 5;
overflow: auto; overflow: auto;
background-color: gray; height: calc(100% - 251px);
height: calc(100% - 72px);
padding: 10px; padding: 10px;
position: fixed;
box-sizing: border-box; box-sizing: border-box;
left: 0;
bottom: 0;
border-right: 1px solid #ececec;
} }
img { img {
...@@ -910,8 +906,9 @@ img { ...@@ -910,8 +906,9 @@ img {
justify-content: center; justify-content: center;
span { span {
font-size: 14px;
margin: 5px 0; margin: 5px 0;
color: white; color: black;
} }
} }
......
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
console.log("开始下载"); console.log("开始下载");
if (this.item.fullUpdate) { if (this.item.fullUpdate) {
// 全量更新 // 全量更新
const domain = "https://" + this.$dataStore.get("company").domain; const domain = "https://console.jomalls.com";
this.item.url = this.item.url =
domain + this.item.fileList[0].versionPath.replace("/data", ""); domain + this.item.fileList[0].versionPath.replace("/data", "");
console.log(this.item.url); console.log(this.item.url);
......
...@@ -3,43 +3,26 @@ export default { ...@@ -3,43 +3,26 @@ export default {
data() { data() {
return { return {
rules: { rules: {
company: [ factoryCode: [
{ validator:this.validatePass, message: "请检查客户名称", required: true, trigger: "blur" }, { message: "请输入工厂编码", required: true, trigger: "blur" }
], ],
loginName: [ account: [{ message: "请输入账号", required: true, trigger: "blur" }],
{ message: "请输入用户名", required: true, trigger: "blur" }, password: [{ message: "请输入密码", required: true, trigger: "blur" }]
],
password: [{ message: "请输入密码", required: true, trigger: "blur" }],
}, },
companyList: [],
userList: [], userList: [],
company: null,
authorityVisible: false, authorityVisible: false,
remember: true, remember: true,
authorityForm: {}, authorityForm: {},
form: { form: {
loginName: "", factoryCode: "",
user: "", account: "",
company: "", password: ""
password: "", }
},
}; };
}, },
created() { created() {
// this.len = Object.keys(this.$dataStore.store).length this.userList = this.$dataStore.get('userList') || []
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();
}, },
mounted() { mounted() {
document.addEventListener("keyup", this.keyUp); document.addEventListener("keyup", this.keyUp);
...@@ -49,100 +32,26 @@ export default { ...@@ -49,100 +32,26 @@ export default {
}, },
methods: { methods: {
keyUp(e) { keyUp(e) {
console.log(e);
if (e.keyCode === 13) { if (e.keyCode === 13) {
this.login(); 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() { async login() {
// if (this.form.auth) { this.$refs.formRef.validate(async valid => {
// 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) => {
if (valid) { if (valid) {
let f = JSON.parse(JSON.stringify(this.form)); let f = JSON.parse(JSON.stringify(this.form));
let { data } = await this.$api.post("/login", f);
if (!f.deviceId) { this.$dataStore.set("user", { ...data.sysUser,...{token:data.token} });
f.deviceId = this.$dataStore.get( console.log(this.$dataStore);
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);
if (this.remember) { if (this.remember) {
let userList = this.$dataStore.get("userList"); let userList = this.$dataStore.get("userList");
if (userList) { if (userList) {
if ( if (
!userList.find( !userList.find(
(el) => el =>
el.loginName === f.loginName && el.company === f.company el.account === f.account && el.factoryCode === f.factoryCode
) )
) { ) {
userList.push(f); userList.push(f);
...@@ -158,21 +67,11 @@ export default { ...@@ -158,21 +67,11 @@ export default {
}); });
}, },
userChange(v) { userChange(v) {
if (v === "") { this.form.account = this.userList[v].account;
this.form.deviceId = ""; this.form.factoryCode = this.userList[v].factoryCode;
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.password = this.userList[v].password; 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> </script>
...@@ -195,45 +94,24 @@ export default { ...@@ -195,45 +94,24 @@ export default {
<el-option <el-option
v-for="(it, i) in userList" v-for="(it, i) in userList"
:key="i" :key="i"
:label="`${it.loginName}(${it.company.split('.')[0]})`" :label="`${it.account}(${it.factoryCode})`"
:value="i" :value="i"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="!company" prop="company"> <el-form-item prop="factoryCode">
<!-- <el-select prefix-icon="el-icon-monitor" v-model="form.company">--> <el-input
<!-- <el-option v-for="(it,i) in companyList" :key="i" :label="it.companyName" :value="it.domain.replace('.jomalls.com','')"></el-option>--> placeholder="工厂编码"
<!-- </el-select>--> prefix-icon="el-icon-s-shop"
<el-input placeholder="客户(例如demo)" prefix-icon="el-icon-monitor" v-model="form.company" v-model="form.factoryCode"
clearable> clearable
<template #append> ></el-input>
.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> </el-form-item>
<el-form-item prop="account">
<el-form-item prop="loginName">
<el-input <el-input
placeholder="用户名" placeholder="账号"
prefix-icon="el-icon-user" prefix-icon="el-icon-user"
v-model="form.loginName" v-model="form.account"
clearable clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -247,10 +125,6 @@ export default { ...@@ -247,10 +125,6 @@ export default {
clearable clearable
></el-input> ></el-input>
</el-form-item> </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"> <div class="check">
<el-checkbox v-model="remember">记住账号</el-checkbox> <el-checkbox v-model="remember">记住账号</el-checkbox>
</div> </div>
...@@ -267,41 +141,6 @@ export default { ...@@ -267,41 +141,6 @@ export default {
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </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> </div>
</template> </template>
......
...@@ -106,6 +106,10 @@ module.exports = { ...@@ -106,6 +106,10 @@ module.exports = {
{ {
from: "./logs/", from: "./logs/",
to: "../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