Commit 97a0ed43 authored by 李驰骋's avatar 李驰骋

登录改为选择作业单元

parent d0ca3384
......@@ -26,6 +26,8 @@ const install = (Vue, vm) => {
params),
getWorkstationList: (params = {}) => vm.$u.get(config.adminPath +
'/mobile/md/workstation/getWorkstationList', params),
getWorkUnitList: (params = {}) => vm.$u.get(config.adminPath +
'/md/workunit/getListByUser', params),
/**
* 生产管理相关API
**/
......
......@@ -18,21 +18,16 @@
</view>
<u-modal width="90%" v-model="showWorkstationFlag" :showConfirmButton="false" :showCancelButton="true"
title="请选择工作站" content="操作内容">
<!-- <u-tabs :list="processList" :is-scroll="true" :current="currentFlag" name="processName"
@change="getWorkstationList">
</u-tabs> -->
<uv-tabs :list="processList" :current="currentFlag" keyName="processName" @change="getWorkstationList"
v-if="showWorkstationFlag"></uv-tabs>
<view class="station_list">
<u-empty text="暂无工作站" mode="list" v-if="workstationList.length==0"
<u-empty text="暂无工作单元" mode="list" v-if="workUnitList.length==0"
style="margin: 0 auto;display: block;height: 360rpx;padding: 100rpx 0;"></u-empty>
<template v-else>
<u-card class="station_card" :show-foot="false" :title="'工作站'+card.workstationCode" :key="index"
v-for="(card,index) in workstationList">
<u-card class="station_card" :show-foot="false" :title="'工作单元'+card.workunitCode"
v-for="(card,index) in workUnitList">
<view class="station_card_text" slot="body">
{{ '工作站名称:' + card.workstationName }}
<u-button type="primary" @click="setWorkstation(card)"
{{ '工作单元名称:' + card.workunitName }}
<u-button type="primary" @click="setWorkUnit(card)"
style="margin-top: 30rpx;">选择
</u-button>
</view>
......@@ -45,7 +40,7 @@
title="请选择操作">
<view class="logoutmenu">
<u-button shape="circle" class="menu_button" @click="" type="primary">更改密码</u-button>
<u-button shape="circle" class="menu_button" @click="handleCommand('workstation')" type="warning">切换工作站
<u-button shape="circle" class="menu_button" @click="handleCommand('workunit')" type="warning">切换工作站
</u-button>
<u-button shape="circle" class="menu_button" @click="handleCommand('exit')" type="error">退出登录</u-button>
</view>
......@@ -54,151 +49,162 @@
</template>
<script>
import TabHeader from "./TabHeader.vue"
import ProContent from "../mes/pro/index.vue"
import GxContent from "../mes/gx/index.vue"
import QcContent from "../mes/qc/index.vue"
import ProdReport from "../mes/prodReport/index.vue"
import DictData from '@/components/DictData'
import TabHeader from "./TabHeader.vue"
import ProContent from "../mes/pro/index.vue"
import GxContent from "../mes/gx/index.vue"
import QcContent from "../mes/qc/index.vue"
import ProdReport from "../mes/prodReport/index.vue"
import DictData from '@/components/DictData'
export default {
name: 'HomePage',
components: {
TabHeader,
ProContent,
GxContent,
QcContent,
ProdReport
},
data() {
return {
tabIndex: "PRO",
showWorkstationFlag: false,
showLogoutMenu: false,
activeProcess: null,
userInfo: {
nickName: '张三',
avatar: require("@/static/images/head.png"),
},
processList: [], //工序清单
workstationList: [], //工作站清单
currentFlag: 0
}
},
created() {
uni.$on('switchTab', (indexCode) => {
this.tabIndex = indexCode;
})
uni.$on('changeWorkstation', (indexCode) => {
this.handleCommand('workstation');
})
this.checkWorkstation();
this.getProcessList();
},
destroyed() {
uni.$off('switchTab');
uni.$off('changeWorkstation');
},
methods: {
//用户部分点击
handleUserTaped() {
console.log("TAPED")
// this.$refs.menu_dialog.open();
this.showLogoutMenu = true;
export default {
name: 'HomePage',
components: {
TabHeader,
ProContent,
GxContent,
QcContent,
ProdReport
},
//检查工作站设置情况
checkWorkstation() {
if (this.vuex_workstation == null) {
this.showWorkstationFlag = true;
this.$u.toast("请设置当前触控屏的工作站!");
data() {
return {
tabIndex: "PRO",
showWorkstationFlag: false,
showLogoutMenu: false,
activeProcess: null,
userInfo: {
nickName: '张三',
avatar: require("@/static/images/head.png"),
},
processList: [], //工序清单
workstationList: [], //工作站清单
workUnitList:[],//工作站清单
currentFlag: 0
}
},
//获取工序清单
getProcessList() {
this.$u.api.getProcessList({}).then(res => {
if (res.code === 200) {
this.processList = res.data;
this.activeProcess = res.data[0].processCode;
this.getWorkstationList({index: 0});
} else {
this.$u.toast("获取工序清单异常" + res.msg);
}
created() {
uni.$on('switchTab', (indexCode) => {
this.tabIndex = indexCode;
})
uni.$on('changeWorkunit', (indexCode) => {
this.handleCommand('workunit');
})
});
this.checkWorkstation();
this.getWorkUnitList();
},
//获取工作站清单
getWorkstationList(item) {
this.currentFlag = item.index;
this.activeProcess = this.processList[item.index].processCode;
this.$u.api.getWorkstationList({
processCode: this.activeProcess
}).then(res => {
if (res.code === 200) {
this.workstationList = res.data;
} else {
this.$u.toast("获取工作站清单异常" + res.msg);
}
});
},
//设置当前触控屏的工作站
setWorkstation(station) {
this.$u.vuex('vuex_workstation', station);
this.showWorkstationFlag = false;
uni.$emit('switchWorkstation', station);
destroyed() {
uni.$off('switchTab');
uni.$off('changeWorkunit');
},
handleCommand(command) {
if (command === 'exit') {
this.loading = true;
this.$u.api.logout().then(res => {
this.loading = false;
if (res.msg) {
this.$u.toast(res.msg);
methods: {
//用户部分点击
handleUserTaped() {
console.log("TAPED")
// this.$refs.menu_dialog.open();
this.showLogoutMenu = true;
},
//检查工作站设置情况
checkWorkstation() {
if (this.vuex_workunit == null) {
this.showWorkstationFlag = true;
this.$u.toast("请设置当前触控屏的工作单元!");
}
},
//获取工序清单
getProcessList() {
this.$u.api.getProcessList({}).then(res => {
if (res.code === 200) {
this.processList = res.data;
this.activeProcess = res.data[0].processCode;
this.getWorkstationList({index: 0});
} else {
this.$u.toast("获取工序清单异常" + res.msg);
}
});
},
//获取工作站清单
getWorkstationList(item) {
this.currentFlag = item.index;
this.activeProcess = this.processList[item.index].processCode;
this.$u.api.getWorkstationList({
processCode: this.activeProcess
}).then(res => {
if (res.code === 200) {
setTimeout(() => {
DictData.logout();
uni.reLaunch({
url: '/pages/sys/login/login'
});
}, 500);
this.workstationList = res.data;
} else {
this.$u.toast("获取工作站清单异常" + res.msg);
}
})
} else if (command == 'workstation') {
this.showLogoutMenu = false;
this.showWorkstationFlag = true;
});
},
getWorkUnitList(item) {
this.$u.api.getWorkUnitList({
}).then(res => {
if (res.code === 200) {
this.workUnitList = res.rows;
} else {
this.$u.toast("获取工作单元清单异常" + res.msg);
}
});
},
//设置当前触控屏的工作站
setWorkUnit(station) {
this.$u.vuex('vuex_workunit', station);
this.showWorkstationFlag = false;
uni.$emit('switchWorkunit', station);
},
handleCommand(command) {
if (command === 'exit') {
this.loading = true;
this.$u.api.logout().then(res => {
this.loading = false;
if (res.msg) {
this.$u.toast(res.msg);
}
if (res.code === 200) {
setTimeout(() => {
DictData.logout();
uni.reLaunch({
url: '/pages/sys/login/login'
});
}, 500);
}
})
} else if (command == 'workunit') {
this.showLogoutMenu = false;
this.showWorkstationFlag = true;
}
}
}
}
}
</script>
<style>
.common-container {
width: 100vw;
height: 100vh;
display: flex;
}
.common-container {
width: 100vw;
height: 100vh;
display: flex;
}
.common-head {
height: 40px;
background-color: rgb(3, 26, 60);
display: flex;
align-items: center;
padding: 0 15px;
box-sizing: border-box;
}
.common-head {
height: 40px;
background-color: rgb(3, 26, 60);
display: flex;
align-items: center;
padding: 0 15px;
box-sizing: border-box;
}
.header {
width: 120px;
background-color: #132138;
color: aliceblue;
font-size: 25px;
font-family: 华文楷体;
line-height: 80rpx;
height: inherit;
.header {
width: 120px;
background-color: #132138;
color: aliceblue;
font-size: 25px;
font-family: 华文楷体;
line-height: 80rpx;
height: inherit;
.header-logo {
width: 200rpx;
......@@ -206,83 +212,83 @@ export default {
margin: 40rpx auto;
display: block;
}
}
}
.header .divItem {
height: 100%;
align-items: center;
}
.header .divItem {
height: 100%;
align-items: center;
}
.header .workstation {
text-align: center;
flex-grow: 1;
}
.header .workstation {
text-align: center;
flex-grow: 1;
}
.header .user {
width: 30%;
}
.header .user {
width: 30%;
}
.header .user .user-icon {
float: right;
}
.header .user .user-icon {
float: right;
}
img {
width: 40px;
height: 40px;
border-radius: 20px;
margin-left: 10px;
}
img {
width: 40px;
height: 40px;
border-radius: 20px;
margin-left: 10px;
}
.header .user .user-text {
float: right;
}
.header .user .user-text {
float: right;
}
.logoutmenu {
width: 100%;
display: flex;
justify-content: center;
}
.logoutmenu {
width: 100%;
display: flex;
justify-content: center;
}
.menu_button {
width: 100px;
margin: 10px;
}
.menu_button {
width: 100px;
margin: 10px;
}
.station_modal {
}
.station_modal {
}
.station_list {
display: flex;
flex-wrap: wrap;
}
.station_list {
display: flex;
flex-wrap: wrap;
}
.station_card {
width: 250px;
height: 150px;
}
.station_card {
width: 250px;
height: 150px;
}
.common-main {
flex: 1;
height: 100%;
padding: 6px 6px 6px 0;
margin: 0;
width: 100%;
overflow: auto;
background-image: linear-gradient(to top right, rgb(19 26 56), rgb(33 64 128));
}
.common-main {
flex: 1;
height: 100%;
padding: 6px 6px 6px 0;
margin: 0;
width: 100%;
overflow: auto;
background-image: linear-gradient(to top right, rgb(19 26 56), rgb(33 64 128));
}
.setting-body {
position: absolute;
bottom: 20rpx;
width: 200rpx;
margin: 0 auto;
font-size: 36rpx;
font-weight: initial;
text-align: center;
.setting-body {
position: absolute;
bottom: 20rpx;
width: 200rpx;
margin: 0 auto;
font-size: 36rpx;
font-weight: initial;
text-align: center;
.setting-icon {
margin: 10rpx 10rpx;
}
}
}
</style>
......@@ -63,9 +63,9 @@
</view>
<view class="prod-body-right">
<view style="text-align: center;line-height: 80rpx;font-size: 28rpx;font-weight: 600;">
{{ this.vuex_workstation == null ? '请选择工作站' : this.vuex_workstation.workstationName }}
{{ this.vuex_workunit == null ? '请选择工作单元' : this.vuex_workunit.workunitName }}
</view>
<u-button type="primary" @click="changeWorkstation">切换工作</u-button>
<u-button type="primary" @click="changeWorkstation">切换工作单元</u-button>
<br/>
<u-button type="warning" @click="commonClick('KnifeTemp')">刀模版上下机</u-button>
<u-button type="primary" @click="commonClick('Refresh')">刷新</u-button>
......@@ -716,7 +716,7 @@ export default {
}
},
mounted() { //监听工作站切换事件
uni.$on('switchWorkstation', (station) => {
uni.$on('switchWorkunit', (station) => {
this.getTaskList();
})
},
......@@ -728,7 +728,7 @@ export default {
}
})
//监听工作站切换事件
uni.$on('switchWorkstation', (station) => {
uni.$on('switchWorkunit', (station) => {
// this.reset();
this.getTaskList();
})
......@@ -737,7 +737,7 @@ export default {
this.getTaskList(); //刷新任务状态
})
if (this.vuex_workstation != null) {
if (this.vuex_workunit != null) {
this.getTaskList();
}
// if (this.vuex_task != null) {
......@@ -745,7 +745,7 @@ export default {
// }
},
destroyed() {
uni.$off('switchWorkstation');
uni.$off('switchWorkunit');
uni.$off('taskStatusChanged');
},
methods: {
......@@ -759,7 +759,7 @@ export default {
console.log('99999999', arg)
},
changeWorkstation() {
uni.$emit('changeWorkstation');
uni.$emit('changeWorkunit');
},
commonClick(oper) {
if (['Refresh', 'MaterialUsageRecord'].indexOf(oper) === -1 && this.tableSelectData.length === 0) {
......@@ -929,8 +929,9 @@ export default {
},
getTaskList() {
this.form = {}
const t = this;
this.$u.api.getTaskList({
workstationId: this.vuex_workstation.workstationId,
workunitId: t.vuex_workunit.workunitId,
}).then(res => {
if (res.code === 200) {
this.tableData = res.rows;
......
......@@ -12,7 +12,7 @@ try{
// 尝试获取本地是否存在lifeData变量,第一次启动APP时是不存在的
lifeData = uni.getStorageSync('lifeData');
}catch(e){
}
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
......@@ -41,14 +41,15 @@ const store = new Vuex.Store({
vuex_remember: lifeData.vuex_remember ? lifeData.vuex_remember : '',
vuex_locale: lifeData.vuex_locale ? lifeData.vuex_locale : '',
vuex_isAgent: lifeData.vuex_isAgent ? lifeData.vuex_isAgent : '',
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_config: config,
//当前设备绑定的工作站
vuex_workstation: null,
vuex_workunit: null,
//当前工作站正在进行的生产任务
vuex_task: null,
// 自定义tabbar数据
// vuex_tabbar: [{
// iconPath: "/static/uview/example/component.png",
......
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