Commit 744cc1fb authored by 刘飞's avatar 刘飞

MES工位机功能添加

parent 652b912c
...@@ -4,7 +4,7 @@ const utils = require('./utils') ...@@ -4,7 +4,7 @@ const utils = require('./utils')
const config = require('../config') const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf') const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) { function resolve(dir) {
return path.join(__dirname, '..', dir) return path.join(__dirname, '..', dir)
} }
...@@ -18,9 +18,8 @@ module.exports = { ...@@ -18,9 +18,8 @@ module.exports = {
output: { output: {
path: config.build.assetsRoot, path: config.build.assetsRoot,
filename: '[name].js', filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production' publicPath: process.env.NODE_ENV === 'production' ?
? config.build.assetsPublicPath config.build.assetsPublicPath : config.dev.assetsPublicPath
: config.dev.assetsPublicPath
}, },
resolve: { resolve: {
extensions: ['.js', '.vue', '.json'], extensions: ['.js', '.vue', '.json'],
...@@ -31,6 +30,10 @@ module.exports = { ...@@ -31,6 +30,10 @@ module.exports = {
}, },
module: { module: {
rules: [ rules: [
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass']
},
{ {
test: /\.vue$/, test: /\.vue$/,
loader: 'vue-loader', loader: 'vue-loader',
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="referrer" content="origin" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" /> <meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!-- <link rel="stylesheet" href="./src/assets/font/iconfont.css"> --> <!-- <link rel="stylesheet" href="./src/assets/font/iconfont.css"> -->
<script src="./static/js/configuration.js"></script>
<title>board</title> <title>board</title>
<style> <style>
.el-progress-bar { .el-progress-bar {
...@@ -18,19 +20,19 @@ ...@@ -18,19 +20,19 @@
margin: 0 !important; margin: 0 !important;
box-sizing: border-box !important; box-sizing: border-box !important;
/* padding:0 0 0 35px !important; */ /* padding:0 0 0 35px !important; */
padding:0 0 0 18px !important; padding: 0 0 0 18px !important;
} }
.el-table .cell, .el-table th div{ .el-table .cell,
.el-table th div {
overflow: hidden !important; overflow: hidden !important;
} }
.el-progress-bar__outer{ .el-progress-bar__outer {
height: 60% !important; height: 60% !important;
} }
.el-progress-bar__inner{ .el-progress-bar__inner {
border-radius: 11px !important; border-radius: 11px !important;
} }
.el-progress-bar__outer{ .el-progress-bar__outer {
border-radius: 11px !important; border-radius: 11px !important;
} }
</style> </style>
...@@ -39,4 +41,14 @@ ...@@ -39,4 +41,14 @@
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
<script>
// function ComReadCardCallBack(data) {
// console.log("ComReadCardCallBack回调方法");
// console.log(data);
// JsControllerObj.CsExecuter("StopReadRFID",null)
// }
// console.log("调用 JsControllerObj 前");
// JsControllerObj.CsExecuter("StartReadRFID", "ComReadCardCallBack");
// console.log("调用 JsControllerObj 后");
</script>
</html> </html>
This diff is collapsed.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"build": "node build/build.js" "build": "node build/build.js"
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.0", "axios": "^0.21.0",
"echarts": "^4.2.1", "echarts": "^4.2.1",
"element-ui": "^2.11.1", "element-ui": "^2.11.1",
"moment": "^2.24.0", "moment": "^2.24.0",
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
"html-webpack-plugin": "^2.30.1", "html-webpack-plugin": "^2.30.1",
"less-loader": "^6.2.0", "less-loader": "^6.2.0",
"node-notifier": "^5.1.2", "node-notifier": "^5.1.2",
"node-sass": "^4.12.0", "node-sass": "^4.14.1",
"optimize-css-assets-webpack-plugin": "^2.0.0", "optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0", "ora": "^1.2.0",
"portfinder": "^1.0.13", "portfinder": "^1.0.13",
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
"postcss-loader": "^2.0.8", "postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1", "postcss-url": "^7.2.1",
"rimraf": "^2.6.0", "rimraf": "^2.6.0",
"sass-loader": "^7.2.0", "sass-loader": "^7.3.1",
"semver": "^5.3.0", "semver": "^5.3.0",
"shelljs": "^0.7.6", "shelljs": "^0.7.6",
"style-loader": "^1.2.1", "style-loader": "^1.2.1",
......
import Vue from 'vue'
import Router from 'vue-router'
import $Router from '@/router/index'
// import store from '@/store'
Vue.use(Router)
import $cookie from './common.js';
// import url from './url.js'
import axios from 'axios'
import {
Message,
MessageBox
} from 'element-ui'
// axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.headers['Content-Type'] = "application/json; charset=UTF-8";
// let state = JSON.parse(localStorage.getItem('$state'))
// console.log($cookie.getCookie('host'));
let http = axios.create({
// baseURL: $cookie.getCookie('host'),
timeout: 20000,
// withCredentials: true
})
// axios拦截,未登录链接到登录
http.interceptors.request.use(
response => {
// console.log(response);
//没有token或者token无效跳到登录页
if ($cookie.getCookie('access_token')) {
// console.log(response);
var timestamp = (new Date()).valueOf().toString()
if (response.data === undefined) {
response.data = {
token: $cookie.getCookie('access_token'),
timestamp: timestamp
}
} else {
if (response.data.data !== undefined && response.data.data != null) {
// 时间+8小时 由于js时间和后台时间 不一致 所以追加8小时
Object.keys(response.data.data).forEach(function (key) {
if (response.data.data[key] instanceof Date) {
response.data.data[key] = new Date(response.data.data[key].setHours(response.data.data[key].getHours() +
8))
// console.log(key, response.data.data[key])
}
})
}
response.data.token = $cookie.getCookie('access_token')
response.data.timestamp = timestamp
}
}
return response;
},
error => {
// console.log(err)
if (error.response) {
// console.log(err)
}
return Promise.reject(error.response.data) // 返回接口返回的错误信息
})
http.interceptors.response.use(
response => {
console.log(response);
//只针对get方式进行序列化
if (response.config.method === 'get') {
const res = response.data
return res
}
if (response.config.url == 'api/Platform/User/Login') {
console.log(789);
return response.data
}
try {
const res = response.data
if (res.success) {
// console.log(res.code)
// Message({
// message: '操作成功',
// type: 'success',
// duration: 5 * 1000
// })
return res
} else {
if (res.message) {
Message({
message: res.message,
type: 'error',
duration: 5 * 1000
})
} else {
switch (res.code) {
case 3:
// to re-login
MessageBox.confirm('您已经长时间未操作,系统已下线,您可以取消以停留在此页面,或再次登录', '登录超时', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$cookie.delCookie('access_token')
$cookie.delCookie('host')
localStorage.removeItem('$state')
$Router.push({path: '/login'})
location.reload()
})
break;
case 4:
// to re-login
MessageBox.confirm('您的登录已经失效请重新登录', '请求失败', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$cookie.delCookie('access_token')
$cookie.delCookie('host')
localStorage.removeItem('$state')
$Router.push({path: '/login'})
location.reload()
}).catch(err=>{
})
break;
case 5:
// msg = "公司不可用";
Message({
message: res.message || '公司不可用',
type: 'error',
duration: 5 * 1000
})
break;
case 6:
// msg = "未知错误";
Message({
message: res.message || '未知错误',
type: 'error',
duration: 5 * 1000
})
break;
case 7:
// msg = "公司不存在";
Message({
message: res.message || '公司不存在',
type: 'error',
duration: 5 * 1000
})
break;
case 8:
// 参数错误
Message({
message: res.message || '请求参数错误',
type: 'error',
duration: 5 * 1000
})
break
case 9:
// Message({
// message: '异地登录,请重新登录!',
// type: 'error',
// duration: 5 * 1000
// })
MessageBox('您的账号在其他地方登录,请重新登录!', '异地登录', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$cookie.delCookie('access_token')
$cookie.delCookie('host')
localStorage.removeItem('$state')
$Router.push({path: '/login'})
location.reload()
}).catch(() => {
// Message({
// type: 'info',
// message: '取消'
// });
});
break
default:
// console.log(res);
Message({
message: res.message || '服务器异常',
type: 'error',
duration: 5 * 1000
})
break
}
}
return res
}
} catch (err) {
// console.log(err.message)
// console.log(err);
// console.log(this);
Message({
message: err.msg,
type: 'error',
duration: 5 * 1000
})
}
},
error => {
// console.log('err::' + error) // for debug
Message({
message: error,
type: 'error',
duration: 5 * 1000
})
return Promise.reject(error)
}
);
export default http;
// import message from './errMessage';
//获取cookie、
function getCookie(cname) {
// var name = cname + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1);
var arr = c.split("=");
if (arr[0] == cname) {
return arr[1];
}
}
return "";
}
//设置cookie,增加到vue实例方便全局调用
let setCookie = (function(){
// let model = window.model;
return function(cname, cvalue, exdays){
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
// console.log(document.domain)
// if (document.domain == "euser.eiisys.com") {
// console.log('model',model)
// if(model == 1){
// document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/" + ";domain=.feteto.com";
// } else {
document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/";
// }
}
})();
//删除cookie
function delCookie(name) {
this.setCookie(name, "", -1);
}
// let accessToken;
// let loginState = false; //false未登录
// //判断token是否存在
// function judgeAccessToken() {
// if (this.$cookie.getCookie('access-token') && this.$cookie.getCookie('loginState')) {
// accessToken = this.$cookie.getCookie('access-token');
// loginState = true;
// console.log(accessToken);
// console.log(loginState);
// } else {
// loginState = false;
// accessToken = '';
// }
// }
// const api = function (that) {
// return new Promise(function (resolve, reject) {
// // 判断短信是否开通,如果已开通直接resolve
// judgeAccessToken();
// resolve(loginState);
// })
// };
export default {
//获取cookie、
getCookie,
//设置cookie,增加到vue实例方便全局调用
setCookie,
//删除cookie
delCookie,
// api
}
// 消息提示
// export const errInfo = function (param = '内容不能为空', time = 5) {
// message.warning({
// content: param,
// duration: time,
// });
// };
// export const errorMessage = message.errorMessage;
\ No newline at end of file
...@@ -4,6 +4,16 @@ import Vue from 'vue' ...@@ -4,6 +4,16 @@ import Vue from 'vue'
import App from './App' import App from './App'
import router from './router' import router from './router'
import './assets/font/iconfont.css' import './assets/font/iconfont.css'
import axios from 'axios'
// axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded';
axios.defaults.headers.post['Content-Type'] = "application/json; charset=UTF-8";
Vue.prototype.axios = axios
import http from './function/axiosMes.js'
Vue.prototype.$http = http;
import cookie from './function/common.js'
Vue.prototype.$cookie = cookie;
//文字滚动https://chenxuan0000.github.io/component-document/index_prod.html#/component/seamless-default //文字滚动https://chenxuan0000.github.io/component-document/index_prod.html#/component/seamless-default
import scroll from 'vue-seamless-scroll' import scroll from 'vue-seamless-scroll'
...@@ -12,7 +22,10 @@ Vue.config.productionTip = false ...@@ -12,7 +22,10 @@ Vue.config.productionTip = false
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css'; import 'element-ui/lib/theme-chalk/index.css';
// import App from './App.vue'; // import App from './App.vue';
Vue.use(ElementUI, { size: 'small', zIndex: 3000 }); Vue.use(ElementUI, {
size: 'small',
zIndex: 3000
});
//通用辅助类 //通用辅助类
import utils from '@/function/utils.js' import utils from '@/function/utils.js'
Vue.prototype.$utils = utils Vue.prototype.$utils = utils
...@@ -23,9 +36,69 @@ import UtilityTools from "@/function/UtilityTools" ...@@ -23,9 +36,69 @@ import UtilityTools from "@/function/UtilityTools"
import echarts from 'echarts' import echarts from 'echarts'
Vue.use(echarts) Vue.use(echarts)
Vue.prototype.echarts = echarts Vue.prototype.echarts = echarts
Vue.prototype.__defaultErrorHandlder = function (code, message) {
let msg = '';
console.log(message);
if (message) {
this.$message({
message: message,
type: "warning"
});
return;
}
console.log(code)
switch (code) {
case 2:
msg = "用户名或者密码错误";
break;
case 3:
break;
case 4:
msg = "未知的服务器错误";
break;
case 5:
msg = "公司不可用";
break;
case 6:
msg = "未知错误";
break;
case 7:
msg = "公司不存在";
break;
case 8:
msg = "请求参数有问题";
break;
case 9:
// msg = "账号在另一地点登陆"
break;
default:
case 0:
msg = "未指定的错误";
break;
}
console.log(msg)
this.$message({
message: msg,
type: "warning"
});
}
Vue.prototype.jsController = function(){
JsControllerObj.CsExecuter("StartReadRFID",'ComReadCardCallBack')
}
function ComReadCardCallBack(data){
console.log(data);
}
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,
components: { App }, components: {
App
},
template: '<App/>' template: '<App/>'
}) })
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import $cookie from '../function/common'
import home from '../views/home/index.vue' import home from '../views/home/index.vue'
import boardlist from '../views/board/boardlist/index.vue' import boardlist from '../views/board/boardlist/index.vue'
import chartList from '../views/board/chartList/index.vue' import chartList from '../views/board/chartList/index.vue'
...@@ -21,6 +21,8 @@ import ViewXY from '../views/board/workShopList/kanbanViewXY.vue' ...@@ -21,6 +21,8 @@ import ViewXY from '../views/board/workShopList/kanbanViewXY.vue'
import Efficiency from '../views/board/workShopList/dynamicEfficiency.vue' import Efficiency from '../views/board/workShopList/dynamicEfficiency.vue'
import DataShow from '../views/board/workShopList/dataShow.vue' import DataShow from '../views/board/workShopList/dataShow.vue'
import SearchSOP from '../views/board/workShopList/searchSOP.vue' import SearchSOP from '../views/board/workShopList/searchSOP.vue'
import login from '../views/machine/login.vue'
import processSheet from '../views/machine/processSheet.vue'
Vue.use(Router) Vue.use(Router)
...@@ -28,13 +30,11 @@ export default new Router({ ...@@ -28,13 +30,11 @@ export default new Router({
// mode: 'history', // mode: 'history',
// base: config.ProjectName,// // base: config.ProjectName,//
linkActiveClass: 'active', linkActiveClass: 'active',
routes: [ routes: [{
{
path: '/', path: '/',
name: '主页', name: '主页',
component: home, component: home,
children: [ children: [{
{
path: '/boardlist', path: '/boardlist',
name: 'boardlist', name: 'boardlist',
meta: { meta: {
...@@ -59,8 +59,8 @@ export default new Router({ ...@@ -59,8 +59,8 @@ export default new Router({
component: chartDemoList, component: chartDemoList,
}, },
{ {
path:'/zcList', path: '/zcList',
name:'zcList', name: 'zcList',
meta: { meta: {
title: '车间配置', title: '车间配置',
}, },
...@@ -132,7 +132,7 @@ export default new Router({ ...@@ -132,7 +132,7 @@ export default new Router({
title: '图表模板', title: '图表模板',
}, },
component: chartDemo, component: chartDemo,
},{ }, {
path: '/chartdemo1', path: '/chartdemo1',
name: 'chartdemo1', name: 'chartdemo1',
meta: { meta: {
...@@ -141,61 +141,97 @@ export default new Router({ ...@@ -141,61 +141,97 @@ export default new Router({
component: chartDemo1, component: chartDemo1,
}, },
{ {
path:'/zcList', path: '/zcList',
name:'zcList', name: 'zcList',
meta: { meta: {
title: '车间选择', title: '车间选择',
}, },
component: ZCList, component: ZCList,
}, },
{ {
path:'/viewZC', path: '/viewZC',
name:'viewZC', name: 'viewZC',
meta: { meta: {
title: '车间展示', title: '车间展示',
}, },
component: ViewZC, component: ViewZC,
}, },
{ {
path:'/viewCX', path: '/viewCX',
name:'viewCX', name: 'viewCX',
meta: { meta: {
title: '车间展示', title: '车间展示',
}, },
component: ViewCX, component: ViewCX,
}, },
{ {
path:'/viewXY', path: '/viewXY',
name:'viewXY', name: 'viewXY',
meta: { meta: {
title: '鑫源看板', title: '鑫源看板',
}, },
component: ViewXY, component: ViewXY,
}, },
{ {
path:'/Efficiency', path: '/Efficiency',
name:'Efficiency', name: 'Efficiency',
meta:{ meta: {
title:'工厂动态效率展示' title: '工厂动态效率展示'
}, },
component:Efficiency component: Efficiency
}, },
{ {
path:'/dataShow', path: '/dataShow',
name:'dataShow', name: 'dataShow',
meta:{ meta: {
title:'样品运行控制中心' title: '样品运行控制中心'
}, },
component:DataShow component: DataShow
}, },
{ {
path:'/searchSOP', path: '/searchSOP',
name:'searchSOP', name: 'searchSOP',
meta:{ meta: {
title:'查询SOP' title: '查询SOP'
}, },
component:SearchSOP component: SearchSOP
},
{
path: '/login',
name: 'login',
meta: {
title: '工位机'
},
component: login
},
{
path: '/processSheet',
name: 'processSheet',
meta: {
title: '工位机'
},
component: processSheet
} }
], ],
}) })
// const router = new VueRouter({
// mode: 'hash',
// base: process.env.BASE_URL,
// routes
// })
// // 路由守卫
// router.beforeEach((to, from, next) => {
// // 无需登录
// if (['processSheet'].some(str => str == to.name)) {
// let token = $cookie.getCookie('access_token');
// console.log('ssss' + token);
// if (token) {
// next()
// } else {
// next(`/login`)
// }
// return;
// }
// })
import Vue from 'vue'
import Vuex from 'vuex'
\ No newline at end of file
...@@ -20,13 +20,13 @@ ...@@ -20,13 +20,13 @@
<td <td
:key="index1" :key="index1"
class="tableclass" class="tableclass"
:style="{width:getwidth(obj)+'%',border:'1px'+' solid '+getfontcolor(item),borderColor:boardstore.BorderColor==null?'red':boardstore.BorderColor}" :style="{width:getwidth(obj)+'%',border:'1px'+' solid '+boardstore.BorderColor==null?'red':boardstore.BorderColor}"
v-if="obj.Key.indexOf('_')>0 && obj.Key.indexOf('_percent')<0" v-if="obj.Key.indexOf('_')>0 && obj.Key.indexOf('_percent')<0"
>{{obj.Value}}</td> >{{obj.Value}}</td>
<td <td
:key="index1" :key="index1"
class="tableclass" class="tableclass"
:style="{width:getwidth(obj)+'%',border:'1px'+' solid '+getfontcolor(item),borderColor:boardstore.BorderColor==null?'red':boardstore.BorderColor}" :style="{width:getwidth(obj)+'%',border:'1px'+' solid '+boardstore.BorderColor==null?'red':boardstore.BorderColor}"
v-if="obj.Key.indexOf('_percent')>0" v-if="obj.Key.indexOf('_percent')>0"
> >
<el-progress :text-inside="true" :style="{color:getfontcolor(item)}" :stroke-width="20" type="line" :color="obj.Key.indexOf('#') ? '#'+obj.Value.split('#')[1] : '#409EFF'" :percentage="obj.Key.indexOf('#') ? parseInt(obj.Value.split('#')[0]) : parseInt(obj.Value)" status="exception"></el-progress> <el-progress :text-inside="true" :style="{color:getfontcolor(item)}" :stroke-width="20" type="line" :color="obj.Key.indexOf('#') ? '#'+obj.Value.split('#')[1] : '#409EFF'" :percentage="obj.Key.indexOf('#') ? parseInt(obj.Value.split('#')[0]) : parseInt(obj.Value)" status="exception"></el-progress>
......
This diff is collapsed.
This diff is collapsed.
window.apiUrl = 'http://jhdsoft.gicp.net:9201/ftt_mes2',
window.companyCode = '8901'
\ No newline at end of file
File added
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