mes 平板端

This commit is contained in:
helloDy
2024-01-10 17:58:43 +08:00
parent 51cd918ec6
commit d25abf3b18
29 changed files with 1979 additions and 226 deletions

View File

@@ -1,18 +1,82 @@
<!--
* @Author: Do not edit
* @Date: 2023-12-27 16:41:40
* @LastEditTime: 2024-01-09 14:00:12
* @LastEditors: DY
* @Description: 首页
-->
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<div class="centerDiv">
<div class="img1" @click="toQuality">
<p class="title">质量收集器</p>
</div>
<div class="img" @click="toScrap">
<p class="title">报废管理</p>
</div>
</div>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'HomeView',
components: {
HelloWorld
data () {
return {
}
},
methods: {
toQuality () {
this.$router.push({
path: 'quality'
})
},
toScrap () {
this.$router.push({
path: 'scrap'
})
}
}
}
</script>
<style scoped>
.title {
/* width: 175px;
height: 45px; */
font-size: 32px;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 45px;
letter-spacing: 3px;
margin-top: 395px;
}
.img {
width: 428px;
height: 607px;
background-image: url('./../assets/scrap.png');
background-size: cover;
}
.img1 {
width: 428px;
height: 607px;
background-image: url('./../assets/quality.png');
background-size: cover;
}
.centerDiv {
display: flex;
justify-content: center;
flex-direction: row;
align-items: center;
height: 100vh;
gap: 18px;
}
.home {
background-image: url('./../assets/home_bg.png');
height: 100vh;
width: 100vw;
background-size: cover;
}
</style>

182
src/views/Login.vue Normal file
View File

@@ -0,0 +1,182 @@
<!--
* @Author: Do not edit
* @Date: 2023-12-28 11:21:53
* @LastEditTime: 2024-01-10 16:58:49
* @LastEditors: DY
* @Description: 登陆
-->
<template>
<div class="login">
<van-row type="flex" justify="space-around">
<van-col span="12">
<div class="left">
<div class="title">
<span>Wel</span>
<span style="color: white">come</span>
<p
style="
margin: 0;
font-size: 16px;
letter-spacing: 1px;
color: #26b9de;
opacity: 75%;
">
<span
style="
display: inline-block;
height: 12px;
width: 12px;
margin-left: 8px;
margin-right: 2px;
border-radius: 100%;
background: #26b9de;
"></span>
向世界先进水平挑战为人类社会文明做贡献
</p>
</div>
<div>
<img class="modalImg" src="./../assets/modal.png" alt="">
</div>
</div>
</van-col>
<van-col span="12">
<div class="right">
<div>
<img class="xcacImg" src="./../assets/xcac.png" alt="">
<p class="xc">许昌安彩新能源科技有限公司</p>
</div>
<div class="form">
<van-form @submit="onSubmit">
<van-field
v-model="username"
name="username"
placeholder="用户名 / 手机号"
style="margin-bottom: 16px"
:rules="[{ required: true, message: '请填写用户名' }]"
/>
<van-field
v-model="password"
type="password"
name="password"
placeholder="密码"
:rules="[{ required: true, message: '请填写密码' }]"
/>
<div style="margin-top: 36px; border-radius: 3px">
<van-button block type="info" native-type="submit">提交</van-button>
</div>
</van-form>
</div>
</div>
</van-col>
</van-row>
<div class="mountain">
<p style="margin-top: 80px; color: #3196E7">{{'版权所有:中建材智能自动化有限公司版本' + '\u3000' +'版本1.0'}}</p>
</div>
</div>
</template>
<script>
import { loginUser, getTenantIdByName } from '@/api/login'
import { setTenantId, setToken } from '@/utils/auth'
export default {
name: 'Login',
data () {
return {
username: 'admin',
password: 'admin123',
tenantName: '技术中心'
}
},
created () {
// 租户
getTenantIdByName(this.tenantName).then((res) => {
// 设置租户
const tenantId = res.data.data
if (tenantId && tenantId >= 0) {
setTenantId(tenantId)
}
})
},
methods: {
onSubmit (values) {
loginUser(values).then(res => {
console.log(res.data)
if (res.data.code === 0) {
setToken(res.data.data)
this.$router.push({
path: 'home'
})
}
})
}
}
}
</script>
<style scoped>
.form {
width: 332px;
margin: 45px auto;
}
.xc {
/* width: 342px;
height: 32px; */
font-size: 24px;
font-family: PingFangSC, PingFang SC;
font-weight: 500;
color: #FFFFFF;
line-height: 32px;
letter-spacing: 1px;
margin: 0;
text-align: center;
}
.xcacImg {
height: 46px;
width: 130px;
margin: 80px 148px 0;
}
.right {
background-image: url('./../assets/transparent.png');
height: 534px;
width: 458px;
margin-top: 121px;
margin-left: 40px;
}
.modalImg {
margin-top: 55px;
margin-left: 55px;
text-align: left;
}
.title {
/* width: 297px; */
/* height: 59px; */
padding-top: 122px;
padding-left: 115px;
text-align: left;
font-size: 66px;
font-family: PingFangSC, PingFang SC;
font-weight: 600;
color: #1BD1FF;
line-height: 58px;
}
.left {
margin: 0;
}
.mountain {
background-image: url('./../assets/mountain.png');
height: 131px;
width: 100vw;
background-size: 100%;
position: absolute;
bottom: 0;
text-align: center;
}
.login {
background-image: url('./../assets/login-bg.png');
height: 100vh;
background-size: 100%;
position: relative;
text-align: left;
}
</style>

222
src/views/Quality.vue Normal file
View File

@@ -0,0 +1,222 @@
<!--
* @Author: Do not edit
* @Date: 2024-01-09 13:48:42
* @LastEditTime: 2024-01-10 17:56:00
* @LastEditors: DY
* @Description:
-->
<template>
<div class="quality">
<van-row type="flex" justify="space-between">
<van-col span="5" style="text-align: left">
<h2>质量管理器</h2>
</van-col>
<van-col span="4" style="text-align: right">
<img class="homeIcon" @click="toHome" src="./../assets/home.png" alt="">
</van-col>
</van-row>
<van-row gutter="20" style="margin-top: -20px;">
<van-col span="12">
<van-dropdown-menu >
<van-dropdown-item v-model="listQuery.productionLineId" :options="lineArray" @change="getSection()" />
</van-dropdown-menu>
</van-col>
<van-col span="12">
<van-dropdown-menu>
<van-dropdown-item v-model="listQuery.sectionId" :options="sectionArray" @change="getQuality()" />
</van-dropdown-menu>
</van-col>
</van-row>
<div class="count">
本班次合计数量{{ count }}
</div>
<div class="content" v-for="(item, index) in typeList" :key="index">
<van-row type="flex" align="center" style="margin-left: -20px">
<van-col span="1">
<img style="width: 20px; height: 20px;" src="./../assets/icon.png" alt="">
</van-col>
<van-col span="8">
<p style="text-align: left; color: #276BFF">{{ item[0].typeName }}</p>
</van-col>
</van-row>
<van-row type="flex">
<van-col span="6" v-for="it in item" :key="it.id">
<div :class=" it.active ? 'flexActive' : 'flexItem'">
<!-- <div> -->
<div class="contain">
<div class="leftDiv">{{ it.count }}</div>
</div>
<!-- </div> -->
<!-- <div> -->
<div class="rightDiv" @click="addRecord(it)">{{ it.detContent }}</div>
<!-- </div> -->
</div>
</van-col>
</van-row>
</div>
</div>
</template>
<script>
import { lineList, workshopSectionListByLine, qualityManage, createInspection } from '@/api/quality'
export default {
name: 'Quality',
data () {
return {
lineArray: [],
sectionArray: [],
listQuery: {
productionLineId: '',
sectionId: ''
},
count: 0,
typeList: []
}
},
mounted () {
this.getLine()
},
methods: {
addRecord (value) {
const now = new Date() // 创建一个表示当前时间的Date对象
const formattedTime = `${now.getFullYear()}-${(now.getMonth() + 1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')} ${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`
// console.log(formattedTime)
createInspection({
...this.listQuery,
inspectionDetId: value.detId,
checkTime: formattedTime
}).then(res => {
if (res.data.code === 0) {
this.$set(value, 'active', true)
value.count++
this.count++
}
})
},
toHome () {
this.$router.push({
path: 'home'
})
},
getQuality () {
qualityManage(this.listQuery).then(res => {
if (JSON.stringify(res.data.data) !== '{}') {
this.typeList = Object.values(res.data.data)
this.count = this.typeList[0][0].sunCount
} else {
this.typeList = []
this.count = 0
}
})
},
getLine () {
lineList().then(res => {
this.lineArray = res.data.data.map(item => {
return {
text: item.name,
value: item.id
}
})
})
},
getSection () {
workshopSectionListByLine({ id: this.listQuery.productionLineId }).then(res => {
this.sectionArray = res.data.data.map(item => {
return {
text: item.name,
value: item.id
}
})
})
}
}
}
</script>
<style scoped>
.flexItem {
display: flex;
margin-right: 20px;
width: 226px;
line-height: 72px;
box-shadow: 5px 6px 8px 0px rgba(206,212,226,0.72), inset 6px 0px 6px 0px #FFFFFF;
background-color: #FFFFFF;
}
.flexActive {
display: flex;
margin-right: 20px;
width: 226px;
line-height: 72px;
box-shadow: 5px 6px 8px 0px rgba(206,212,226,0.72), inset 6px 0px 6px 0px #FFFFFF;
background-color: #276BFF;
}
.rightDiv {
border-radius: 7px;
height: 72px;
line-height: 72px;
width: 140px;
/* background-color: #276BFF; */
}
.contain {
border-radius: 7px 36px 36px 7px;
height: 72px;
width: 80px;
line-height: 72px;
background-color: #FFFFFF;
/* margin: 5px 0 5px 0; */
}
.leftDiv {
border-radius: 7px 36px 36px 7px;
background-color: #276BFF;
height: 72px;
width: 77px;
line-height: 72px;
/* margin: 5px 0 5px 0; */
}
.content {
width: 100%;
/* height: 40px; */
/* display: flex; */
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
background: #FFFFFF;
border-radius: 8px;
opacity: 0.7;
backdrop-filter: blur(50px);
line-height: 40px;
font-size: 18px;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
color: #000000;
margin-top: 7px;
padding: 0 20px 20px 20px;
box-sizing: border-box;
}
.count {
width: 100%;
height: 40px;
background: #FFFFFF;
border-radius: 8px;
opacity: 0.7;
backdrop-filter: blur(50px);
line-height: 40px;
font-size: 18px;
font-family: PingFangSC, PingFang SC;
font-weight: 600;
color: #000000;
margin-top: 7px;
}
.homeIcon {
width: 84px;
height: 84px;
}
.quality {
background-image: url('./../assets/quality-bg.png');
height: 100vh;
width: 100vw;
padding: 20px 20px;
box-sizing: border-box;
}
</style>

134
src/views/Scrap.vue Normal file
View File

@@ -0,0 +1,134 @@
<!--
* @Author: Do not edit
* @Date: 2024-01-09 13:49:03
* @LastEditTime: 2024-01-09 20:39:57
* @LastEditors: DY
* @Description:
-->
<template>
<div class="scrap">
<div style="float: right" type="primary" size="small" plain @click="goback()">
<img class="homeIcon" src="./../assets/home.png" alt="">
</div>
<h2>报废管理</h2>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="工单" prop="workOrderId">
<el-select v-model="ruleForm.workOrderId" filterable clearable placeholder="请选择工单" style="width: 100%; display: block">
<el-option v-for="(item, index) in workOrderList" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="报废数量" prop="num">
<el-input-Number v-model="ruleForm.num" style="width: 100%; display: block"></el-input-Number>
</el-form-item>
<el-form-item label="报废原因" prop="detName">
<el-checkbox-group v-model="ruleForm.detName" style="width: 100%; display: block; text-align: left">
<el-checkbox v-for="(item, index) in scrapList" :key="index" :label="item.content" :name="item.id"></el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="产线" prop="lineId">
<el-select v-model="ruleForm.lineId" filterable clearable placeholder="请选择产线" style="width: 100%; display: block">
<el-option v-for="(item, index) in lineArray" :key="index" :label="item.name" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间" prop="logTime">
<el-date-picker type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" v-model="ruleForm.logTime" style="width: 100%;"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button @click="resetForm('ruleForm')">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { workOrderList, scrapDetList, lineList, createScrap } from '@/api/quality'
export default {
data () {
return {
ruleForm: {
workOrderId: '',
num: 0,
detId: '',
detName: [],
lineId: undefined,
logTime: new Date()
},
workOrderList: [],
lineArray: [],
scrapList: [],
rules: {
workOrderId: [
{ required: true, message: '请选择工单', trigger: 'change' }
],
num: [
{ required: true, message: '请输入报废数量', trigger: 'blur' }
],
detName: [
{ required: true, message: '请选择报废原因', trigger: 'blur' }
]
}
}
},
mounted () {
this.getDict()
this.ruleForm = {
workOrderId: '',
num: 0,
detId: '',
detName: [],
lineId: undefined,
logTime: new Date()
}
},
methods: {
goback () {
this.$router.go(-1)
},
async getDict () {
const workRes = await workOrderList()
this.workOrderList = workRes.data.data
await lineList().then(res => {
this.lineArray = res.data.data.map(item => {
return {
name: item.name,
id: item.id
}
})
})
const scrapRes = await scrapDetList()
this.scrapList = scrapRes.data.data
},
submitForm (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.ruleForm.detId = this.ruleForm.detName.join(',')
createScrap(this.ruleForm).then(res => {
console.log(res.data)
if (res.data.code === 0) {
this.$message({
message: '提交成功!',
type: 'success'
})
}
})
} else {
console.log('error submit!!')
return false
}
})
},
resetForm (formName) {
this.$refs[formName].resetFields()
}
}
}
</script>
<style scoped>
.scrap {
padding: 30px;
/* font-size: 20px; */
}
</style>

View File

@@ -0,0 +1,53 @@
<!--
* @Author: Do not edit
* @Date: 2023-12-29 10:01:55
* @LastEditTime: 2024-01-07 22:26:39
* @LastEditors: DY
* @Description: 首页
-->
<template>
<div>
首页
</div>
</template>
<script>
export default {
name: 'HomePage',
data () {
return {
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.workDiv {
background-color: #F2F2F2;
font-size: 12px;
width: 90%;
padding: 5px 0 10px 10px;
}
.swipeDiv {
padding: 10px;
margin-bottom:20px;
text-align: left;
background-color: white;
border-radius: 10px;
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
}
.my-swipe .van-swipe-item {
// color: #fff;
// font-size: 20px;
// line-height: 150px;
margin: 0 10px;
text-align: left;
// background-color: #39a9ed;
}
.hello {
background-color: #F7F7F7;
height: 100%;
padding: 20px;
}
</style>