修改生产界面

master
夜笙歌 9 months ago
parent 825295fc08
commit df92698251

@ -1,26 +1,10 @@
import request from '@/utils/request'
export function getMaterialBoms(query) {
export function getProductPlans(query) {
return request({
url: '/mes/api/getMaterialBoms',
url: '/mes/api/getProductPlans',
method: 'get',
params: query
})
}
export function getWarehouses(query) {
return request({
url: '/wms/api/getWarehouses',
method: 'get',
params: query
})
}
export function applyRawOutstock(query) {
return request({
url: '/wms/api/applyRawOutstock',
method: 'post',
data: query
})
}

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 登录方法
export function login(username, password, code, uuid) {
export function login(username, password, code, uuid, stationId) {
return request({
url: '/auth/login',
headers: {
@ -9,7 +9,7 @@ export function login(username, password, code, uuid) {
repeatSubmit: false
},
method: 'post',
data: { username, password, code, uuid }
data: {username, password, code, uuid, stationId}
})
}
@ -59,4 +59,15 @@ export function getCodeImg() {
method: 'get',
timeout: 20000
})
}
}
// 获取验证码
export function getStations() {
return request({
headers: {
isToken: false
},
url: '/auth/getStations',
method: 'get',
})
}

@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
const whiteList = ['/login', '/register']
const whiteList = ['/login', '/login2', '/register']
router.beforeEach((to, from, next) => {
NProgress.start()

@ -46,6 +46,11 @@ export const constantRoutes = [
component: () => import('@/views/login'),
hidden: true
},
{
path: '/login2',
component: () => import('@/views/login2'),
hidden: true
},
{
path: '/register',
component: () => import('@/views/register'),

@ -72,7 +72,6 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
}
}
if(route.name === 'Board'){
console.log(route)
route.component = Layout2
}
if (route.children != null && route.children && route.children.length) {

@ -42,8 +42,9 @@ const user = {
const password = userInfo.password
const code = userInfo.code
const uuid = userInfo.uuid
const stationId = userInfo.stationId || ''
return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => {
login(username, password, code, uuid,stationId).then(res => {
let data = res.data
setToken(data.access_token)
commit('SET_TOKEN', data.access_token)

@ -20,18 +20,24 @@
>
</el-table-column>
<el-table-column
prop="workOrderNumber"
prop="dispatchCode"
label="工单编号"
>
</el-table-column>
<el-table-column
prop="plan"
prop="materialName"
label="物料名称"
width="100"
>
</el-table-column>
<el-table-column
prop="planAmount"
label="计划"
width="100"
>
</el-table-column>
<el-table-column
prop="practical"
prop="completeAmount"
label="实际"
width="100"
>
@ -41,9 +47,12 @@
label="差异"
width="100"
>
<template slot-scope="scope">
{{scope.row.planAmount -scope.row.completeAmount }}
</template>
</el-table-column>
<el-table-column
prop="deliveryTime"
prop="planDeliveryDate"
label="交付时间"
width="150"
>
@ -261,7 +270,7 @@
<script>
import Chart from '@/components/board/Chart'
import * as echarts from 'echarts'
import {getMaterialBoms,getWarehouses,applyRawOutstock} from'@/api/board/firstFloor'
import { getProductPlans} from '@/api/board/firstFloor'
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
export default {
@ -333,6 +342,10 @@ export default {
}
},
mounted() {
getProductPlans().then(e=>{
console.log(e)
this.tableData = e.data
})
this.$refs.chart2.setData({
tooltip: {
trigger: 'axis',

@ -1,29 +1,35 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">京源环保管理系统</h3>
<h3 class="title">京源环保办公系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
type="text"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="user"/>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
type="password"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="password"/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-form-item v-if="isStationId" prop="stationId">
<el-select v-model="loginForm.stationId" placeholder="请选择工位" style="width: 100%">
<el-option v-for="item in options" :key="item.stationId" :label="item.stationName"
:value="item.stationId"></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="captchaEnabled" prop="code">
<el-input
v-model="loginForm.code"
auto-complete="off"
@ -31,10 +37,10 @@
style="width: 63%"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="validCode"/>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
<img :src="codeUrl" class="login-code-img" @click="getCode"/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;"></el-checkbox>
@ -42,29 +48,29 @@
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
type="primary"
@click.native.prevent="handleLogin"
>
<span v-if="!loading"> </span>
<span v-else> ...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
<div v-if="register" style="float: right;">
<router-link :to="'/register'" class="link-type">立即注册</router-link>
</div>
</el-form-item>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
</div>
<!-- <div class="el-login-footer">-->
<!-- <span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>-->
<!-- </div>-->
</div>
</template>
<script>
import { getCodeImg } from "@/api/login";
import {getCodeImg, getStations} from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import {encrypt, decrypt} from '@/utils/jsencrypt'
export default {
name: "Login",
@ -75,29 +81,40 @@ export default {
username: "admin",
password: "admin123",
rememberMe: false,
stationId: '',
code: "",
uuid: ""
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
{required: true, trigger: "blur", message: "请输入您的账号"}
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }
{required: true, trigger: "blur", message: "请输入您的密码"}
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
code: [{required: true, trigger: "change", message: "请输入验证码"}]
},
loading: false,
//
captchaEnabled: true,
//
register: false,
redirect: undefined
redirect: undefined,
isStationId: false,
options: [],
floorData: [
{
floor: 1,
processId: 1,
route: '/board/firstFloor'
}
]
};
},
watch: {
$route: {
handler: function(route) {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
@ -106,6 +123,15 @@ export default {
created() {
this.getCode();
this.getCookie();
// this.loginForm.stationId = this.$route?.query?.station || '';
if (this.$route?.query?.isStationId === 'true') {
this.isStationId = true
}
},
mounted() {
getStations().then(e => {
this.options = e.data
})
},
methods: {
getCode() {
@ -132,16 +158,20 @@ export default {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
Cookies.set("username", this.loginForm.username, {expires: 30});
Cookies.set("password", encrypt(this.loginForm.password), {expires: 30});
Cookies.set('rememberMe', this.loginForm.rememberMe, {expires: 30});
} else {
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
let data = this.options.find(v=>v.stationId === this.loginForm.stationId) || {}
let routeData = this.floorData.find(v=>v.floor === data.floor && v.processId === data.processId)
console.log(routeData)
this.$router.push({path: routeData.route || this.redirect || "/"}).catch(() => {
});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
@ -155,7 +185,7 @@ export default {
};
</script>
<style rel="stylesheet/scss" lang="scss">
<style lang="scss" rel="stylesheet/scss">
.login {
display: flex;
justify-content: center;
@ -164,6 +194,7 @@ export default {
background-image: url("../assets/images/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
@ -175,32 +206,39 @@ export default {
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
@ -213,6 +251,7 @@ export default {
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}

@ -0,0 +1,219 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">京源环保管理系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
>
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input
v-model="loginForm.code"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;"></el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="medium"
type="primary"
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading"> </span>
<span v-else> ...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
</div>
</div>
</template>
<script>
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
name: "Login",
data() {
return {
codeUrl: "",
loginForm: {
username: "admin",
password: "admin123",
rememberMe: false,
code: "",
uuid: ""
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
},
loading: false,
//
captchaEnabled: true,
//
register: false,
redirect: undefined
};
},
watch: {
$route: {
handler: function(route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true
}
},
created() {
this.getCode();
this.getCookie();
},
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
});
},
getCookie() {
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
};
},
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
} else {
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.getCode();
}
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url("../assets/images/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}
</style>
Loading…
Cancel
Save