This commit is contained in:
2022-10-10 10:19:18 +08:00
commit b6c903fd4d
191 changed files with 51152 additions and 0 deletions

91
pages/home/home.vue Normal file
View File

@@ -0,0 +1,91 @@
<template>
<view class="content">
<view class="header">首页</view>
<view class="userInfo-wrap">
<view class="userInfo">
<text class="p1">{{$store.getters.userName}}</text>
<text class="p2">欢迎进入扬州晶澳手持系统</text>
</view>
<view class="exit" @tap="Quit">
<view class="icon-exit"></view>
<view class="exit-text">退出</view>
</view>
</view>
<view class="menu-wrap">
<view class="menu-item" v-for="(e, i) in menu" :key="i" @tap="toPage(e.url)">{{e.name}}</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
menu: [{url: '/pages/task/painttask', name: '任务生成'}, {url: '/pages/task/sitemanage', name: '站点管理'}, {url: '/pages/task/pointrelease', name: '点位取放货确认'}, {url: '/pages/task/taskmanage', name: '任务管理'}, {url: '/pages/task/zlmanage', name: '指令管理'}]
};
},
methods: {
toPage (url) {
this.$router.push(url)
uni.redirectTo({
url: url
})
},
Quit () {
this.$store.dispatch('setSignOut')
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.header
height 86rpx
_font(36rpx,86rpx,#333,,center)
.userInfo-wrap
_fj()
_wh(100%,160rpx)
padding 0 30rpx
background-color $red
_bis('../../static/image/info_bg.png',auto,100%,right,bottom)
border-radius: 4px
.userInfo
_fj(,flex-start,column)
.p1
_font(34rpx,1,#fff)
padding-bottom 18rpx
.p2
_font(26rpx,1,#fff)
.exit
_fj()
height 47rpx
padding 0 15rpx
border 1px solid #FF967C
border-radius 20rpx
.icon-exit
_wh(22rpx, 22rpx)
_bis('../../static/image/exit.png',22rpx)
.exit-text
_font(24rpx,47rpx,#fff,,right)
padding-left 10rpx
.menu-wrap
_wh(100%, calc(100% - 246rpx))
overflow-y scroll
padding-top 60rpx
_fj(flex-start,flex-start,,wrap)
align-content: flex-start
.menu-item
_fj(center)
_wh(30%, 120rpx)
margin-bottom 40rpx
border 1px solid #e74f1a
border-radius 5px
_font(26rpx, 60rpx,#e74f1a,,center)
&:nth-child(3n+2)
margin-left 5%
margin-right 5%
</style>

143
pages/login/login.vue Normal file
View File

@@ -0,0 +1,143 @@
<template>
<view class="content bg">
<view class="p1">欢迎来到</view>
<view class="p2">扬州晶澳手持系统</view>
<view class="input-box">
<input class="large-input" type="text" placeholder="请输入用户名" v-model="user">
</view>
<div class="input-box">
<input class="large-input" :password="!showPassword" placeholder="请输入密码" v-model="password">
<text class="uni-icon" :class="[showPassword ? 'uni-eye-active' : '']" @click="changePassword">&#xe568;</text>
</div>
<view class="radio-box">
<view class="radio-wrap">
<view class="iconfont icon-check" :class="{'icon-checked': saveUser}" @click="toSaveUser"></view>
<text class="radio-label">记住用户名</text>
</view>
<text class="setup-text" @click="setup">设置</text>
</view>
<button class="login-btn" :disabled="disabled" @click="toLogin">确认登录</button>
</view>
</template>
<script>
import { RSAencrypt } from '@/utils/jsencrypt.js'
import {handLogin} from '@/utils/api.js'
export default {
data() {
return {
user: this.$store.getters.loginName ? this.$store.getters.loginName : '',
password: '',
showPassword: false,
saveUser: this.$store.getters.loginName ? true : false,
disabled: false
}
},
methods: {
toSaveUser() {
this.saveUser = !this.saveUser
},
changePassword() {
this.showPassword = !this.showPassword
},
setup () {
uni.redirectTo({
url: '/pages/login/setup'
})
},
async toLogin() {
this.disabled = true
if (this.user === '') {
uni.showToast({
title: '用户名不能为空',
icon: 'none'
})
this.disabled = false
return
}
if (this.password === '') {
uni.showToast({
title: '密码不能为空',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await handLogin(this.user, RSAencrypt(this.password))
if(res.code === '1') {
if (this.saveUser) {
this.$store.dispatch('saveLoginName', this.user)
} else {
this.$store.dispatch('delLoginName', '')
}
this.$store.dispatch('saveUserInfo', JSON.stringify(res.result))
uni.redirectTo({
url: '/pages/home/home'
})
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.p1
_font(60rpx,75rpx,#444)
padding-top: 90rpx
.p2
_font(50rpx,1,#444)
padding: 40rpx 0 25rpx
.input-box
_fj()
margin-top 68rpx
height 75rpx
border-bottom 1rpx solid #e2e2e2
.large-input
_wh(calc(100% - 40rpx), 74rpx)
_font(32rpx,74rpx,#999)
padding-left 10rpx
.uni-icon
_wh(37rpx,37rpx)
font-family uniicons
_font(37rpx,37rpx, #999)
.uni-eye-active {
color: #007AFF;
}
.radio-box
_fj()
margin: 25rpx 0 70rpx 0
height: 34rpx
.radio-wrap
_fj()
height: 34rpx
.icon-check
_wh(30rpx,30rpx)
background-color: #ffffff
border: 1px solid #d7592f
border-radius: 50%
.icon-checked
background-color: #d7592f
.radio-label
_font(28rpx, 28rpx,#333)
padding-left: 20rpx
.setup-text
_font(28rpx, 28rpx,$blue,,right)
.bg
_bis('../../static/image/login_bg.png', 100%,,bottom)
.login-btn
width 100%
border-radius 46rpx
_font(36rpx,92rpx,#fff,,center)
background-color $red
</style>

65
pages/login/setup.vue Normal file
View File

@@ -0,0 +1,65 @@
<template>
<view class="content">
<view class="input-wrap">
<view class="input-label">服务器地址</view>
<input type="text" class="setup-input" v-model="addrip">
</view>
<view class="input-wrap">
<view class="input-label">刷新时间(s)</view>
<input type="text" class="setup-input" v-model="setTime">
</view>
<view class="submit-bar">
<button class="submit-button" @click="_submit">确认</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
addrip: this.$store.getters.baseUrl,
setTime: this.$store.getters.setTime / 1000
};
},
methods: {
_submit () {
if (this.addrip === '') {
uni.showToast({
title: '服务器地址',
icon: 'none'
})
return
}
if (this.setTime === '') {
uni.showToast({
title: '请填写刷新时间',
icon: 'none'
})
return
}
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, setTime: this.setTime * 1000})
uni.redirectTo({
url: '/pages/login/login'
})
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.input-wrap
_wh(100%, 126rpx)
padding-top 40rpx
_fj()
.input-label
wh(200rpx, 86rpx)
_font(28rpx,86rpx,#464646)
.setup-input
_wh(calc(100% - 200rpx), 86rpx)
background #fff
_font(28rpx,86rpx,#323232)
text-indent: 16rpx;
</style>

261
pages/task/painttask.vue Normal file
View File

@@ -0,0 +1,261 @@
<template>
<view class="content">
<view class="main-content">
<view class="state-wrap">
<view class="state-item-wrap" v-for="e in state">
<view class="state-color" :class="e.color"></view>
<view class="state-name">{{e.name}}</view>
</view>
</view>
<view class="locate_block" v-for="e in areaArr" :key="e.region_id">
<view class="locate_name_wrap" @click="getPonit(e)">
<view class="locate_name">{{e.region_name}}</view>
<view class="iconfont open_icon" :class="{'is_reverse': e.checked === true}"></view>
</view>
<view v-show="e.checked === true" class="site_block">
<view class="site_item" v-for="(el, i) in e.pointArr" :key="i" :class="['bggray', 'bgblue', 'bggreen', 'bgyellow', 'bgred'][Number(el.status)]" @click="setInfo(el)">
<view class="site_item_box">
<text class="site_item_t1">站点</text>
<text class="site_item_t2">{{el.device_name}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="submit-bar">
<view class="dot_item">
<text class="p1">起始点</text>
<text class="p2">设备号{{scodeObj.device_name}}</text>
</view>
<view class="dot_item">
<text class="p1">目标点</text>
<text class="p2">设备号{{ncodeObj.device_name}}</text>
</view>
<view class="btn_block">
<button class="btn btn1" @click="cancle">清空</button>
<button class="btn btn1" :class="{'btn-disabled': JSON.stringify(scodeObj) === '{}' || JSON.stringify(ncodeObj) === '{}'}" :disabled="disabled1" @click="toSure">确认</button>
</view>
</view>
</view>
</template>
<script>
import {handArea,handPoint,handTask} from 'utils/api.js'
export default {
data() {
return {
interTime: this.$store.getters.setTime,
timer: null,
state: [{color: 'bggray', name: '空'}, {color: 'bgblue', name: '空载具'}, {color: 'bggreen', name: '有货有载具'}, {color: 'bgyellow', name: '有任务'}, {color: 'bgred', name: '需人工解锁'}],
areaArr: [],
regobj: {},
scodeObj: {},
ncodeObj: {},
disabled1: false
};
},
mounted () {
this.initArea()
},
beforeDestroy () {
clearInterval(this.timer)
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
refresh (e) {
this.timer = setInterval(() => {
this.initPonit(e)
}, this.interTime)
},
/** 查询区域信息 */
async initArea () {
let res = await handArea('2')
if (res.code === '1') {
this.areaArr = [...res.result]
this.areaArr.map(el => {
this.$set(el, 'checked', false)
this.$set(el, 'pointArr', [])
})
if (this.areaArr.length > 0) {
this.getPonit(this.areaArr[0])
}
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 根据区域查询设备编号及状态 */
async initPonit (e) {
let res = await handPoint(e.region_id)
if (res.code === '1') {
this.regobj = e
this.areaArr.map(el => {
if (el.region_id === e.region_id) {
this.$set(el, 'pointArr', [...res.result])
}
})
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
getPonit (e) {
clearInterval(this.timer)
this.areaArr.map(el => {
if (el.region_id !== e.region_id) {
el.checked = false
}
if (el.region_id === e.region_id) {
e.checked = !e.checked
}
})
if (e.checked) {
this.initPonit(e)
this.refresh(e)
}
},
setInfo (e) {
if (JSON.stringify(this.scodeObj) === '{}') {
this.scodeObj = e
} else if (JSON.stringify(this.ncodeObj) === '{}') {
this.ncodeObj = e
}
this.disabled1 = !(JSON.stringify(this.scodeObj) !== '{}' && JSON.stringify(this.ncodeObj) !== '{}')
},
cancle () {
this.scodeObj = {}
this.ncodeObj = {}
this.disabled1 = true
},
toSure () {
this.disabled1 = true
this.sureTask(this.scodeObj.device_code, this.ncodeObj.device_code, this.scodeObj.material_type, this.scodeObj.batch)
},
async sureTask (scode, ncode, type, batch) {
try {
let res = await handTask(scode, ncode, type, batch)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
clearInterval(this.timer)
var that = this
setTimeout(() => {
that.initPonit(this.regobj)
this.refresh(this.regobj)
this.scodeObj = {}
this.ncodeObj = {}
}, 2000)
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
this.disabled1 = false
}
} catch (err) {
this.disabled1 = false
}
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.main-content
_wh(100%, calc(100% - 160rpx))
.state-wrap
_wh(100%, 60rpx)
margin-bottom 10rpx
_fj()
.state-item-wrap
height 60rpx
_fj()
.state-color
_wh(30rpx, 30rpx)
border-radius 50%
margin-right 10rpx
.state-name
_font(28rpx, 60rpx, #333)
.locate_block
width 100%
background-color #fff
border-radius 5px
padding 10rpx
margin-bottom 12rpx
.locate_name_wrap
_wh(100%,60rpx)
_fj()
.locate_name
_font(32rpx,60rpx,#000,500)
.open_icon
_wh(48rpx,48rpx)
_font(40rpx,48rpx,$red,,right)
transition all .3s
transform rotateZ(180deg)
.is_reverse
transform rotateZ(0)
.site_block
_wh(100%,auto)
transition height .3s
_fj()
.site_item
_wh(32%,100rpx)
padding 10rpx
margin-top 12rpx
background-color #e5e5e5
border-radius 5px
&:nth-child(3n+2)
margin-left 2%
margin-right 2%
.site_item_box
_wh(100%, 100%)
_fj()
.site_item_t1
width 36rpx
_font(28rpx,40rpx,#000,500)
.site_item_t2
_wh(calc(100% - 36rpx), 100%)
_font(28rpx,40rpx,#999)
_fj(center)
background-color #fff
border-radius 3px
padding 0 5rpx
word-break break-word
overflow hidden
.submit-bar
height 160rpx
padding 10rpx
_fj()
background-color #fff
.dot_item
width 35%
background-color #e5e5e5
.p1
display block
height 60rpx
_font(15rpx,60rpx,,,center)
border-bottom 1rpx solid #fff
overflow hidden
.p2
display block
height 80rpx
padding 0 5rpx
_font(15rpx,80rpx,,,center)
overflow hidden
.btn_block
_wh(20%, 140rpx)
_fj(,,column)
.btn1
width 100%
</style>

363
pages/task/pointrelease.vue Normal file
View File

@@ -0,0 +1,363 @@
<template>
<view class="content">
<view class="main-content">
<view class="state-wrap">
<view class="state-item-wrap" v-for="e in state">
<view class="state-color" :class="e.color"></view>
<view class="state-name">{{e.name}}</view>
</view>
</view>
<view class="locate_block" v-for="e in areaArr" :key="e.region_id">
<view class="locate_name_wrap" @click="getPonit(e)">
<view class="locate_name">{{e.region_name}}</view>
<view class="iconfont open_icon" :class="{'is_reverse': e.checked === true}"></view>
</view>
<view v-show="e.checked === true" class="site_block">
<view class="site_item" v-for="(el, i) in e.pointArr" :key="i" :class="['bggray', 'bgblue', 'bggreen', 'bgyellow', 'bgred'][Number(el.status)]" @click="setInfo(el)">
<view class="site_item_box">
<text class="site_item_t1">站点</text>
<text class="site_item_t2">{{el.device_name}}</text>
</view>
</view>
</view>
</view>
</view>
<view v-if="obj.status === '0' || obj.status === '1' || obj.status === '2' || obj.status === '3'" class="msg_wrapper">
<view class="msg_box">
<view class="msg_item">
<view class="label_item">当前设备</view>
<view class="from_item">
{{obj.device_name}}
</view>
</view>
<view class="msg_item">
<view class="label_item">当前物料</view>
<view class="from_item">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="msg_item">
<view class="label_item">批次</view>
<view class="from_item">
<input type="text" class="input_item" v-model="batch">
</view>
</view>
<view class="msg_btns">
<button class="msg_btn" :disabled="disabled1" @click="cleanUp">清空</button>
<button class="msg_btn" :disabled="disabled2" @click="msgSure">确认</button>
<button class="msg_btn" @click="msgCancle">取消</button>
</view>
</view>
</view>
<view v-if="obj.status === '4'" class="msg_wrapper">
<view class="msg_box">
<view class="msg_item">
<text class="msg_txt">请确认是否放货完成</text>
</view>
<view class="msg_btns">
<button class="msg_btn" :disabled="disabled" @click="toSure">确认</button>
<button class="msg_btn" @click="cancle">取消</button>
</view>
</view>
</view>
<view v-if="active" class="mask"></view>
</view>
</template>
<script>
import {handArea,handPoint,handMatrial,handDeviceStatus, handpointPut} from 'utils/api.js'
export default {
data() {
return {
interTime: this.$store.getters.setTime,
timer: null,
state: [{color: 'bggray', name: '空'}, {color: 'bgblue', name: '空载具'}, {color: 'bggreen', name: '有货有载具'}, {color: 'bgyellow', name: '有任务'}, {color: 'bgred', name: '需人工解锁'}],
areaArr: [],
regobj: {},
active: false,
disabled1: false,
disabled2: false,
obj: {},
batch: '',
options: [],
index: 0,
disabled: false
};
},
mounted () {
this.initArea()
this.initHandMatrial()
},
beforeDestroy () {
clearInterval(this.timer)
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
refresh (e) {
this.timer = setInterval(() => {
this.initPonit(e)
}, this.interTime)
},
/** 查询区域信息 */
async initArea () {
let res = await handArea('2')
if (res.code === '1') {
this.areaArr = [...res.result]
this.areaArr.map(el => {
this.$set(el, 'checked', false)
this.$set(el, 'pointArr', [])
})
if (this.areaArr.length > 0) {
this.getPonit(this.areaArr[0])
}
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 根据区域查询设备编号及状态 */
async initPonit (e) {
let res = await handPoint(e.region_id)
if (res.code === '1') {
this.regobj = e
this.areaArr.map(el => {
if (el.region_id === e.region_id) {
this.$set(el, 'pointArr', [...res.result])
}
})
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 查询物料下拉框 */
async initHandMatrial () {
let res = await handMatrial()
if (res.code === '1') {
res.result.map(e => {
this.options.push({text: e.label, value: e.value})
})
this.options = [...res.result]
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 查找区域站点内容 */
getPonit (e) {
clearInterval(this.timer)
this.areaArr.map(el => {
if (el.region_id !== e.region_id) {
el.checked = false
}
if (el.region_id === e.region_id) {
e.checked = !e.checked
}
})
if (e.checked) {
this.initPonit(e)
this.refresh(e)
}
},
/** 点击站点 */
setInfo (e) {
this.active = true
this.obj = e
this.options.map((e, i) => {
if (e.value === material_type) {
this.index = i
}
})
this.batch = e.batch
},
/** 选择器 */
selectChange(e) {
this.index = e
},
cleanUp () {
this.disabled1 = true
this.handStatus(this.obj.device_code, '', '2', this.obj.status, '')
this.active = false
},
msgSure () {
this.disabled2 = true
this.handStatus(this.obj.device_code, this.options[this.index].value, '1', this.obj.status, this.batch)
this.active = false
},
msgCancle () {
this.active = false
this.obj = {}
this.index = 0
this.batch = ''
},
async handStatus (code, mtype, type, no, batch) {
try {
let res = await handDeviceStatus(code, mtype, type, no, batch)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
clearInterval(this.timer)
var that = this
setTimeout(() => {
that.initPonit(this.regobj)
this.refresh(this.regobj)
this.index = 0
this.batch = ''
this.disabled1 = false
this.disabled2 = false
}, 2000)
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
this.index = 0
this.batch = ''
this.disabled1 = false
this.disabled2 = false
}
} catch (err) {
this.index = 0
this.batch = ''
this.disabled1 = false
this.disabled2 = false
}
},
cancle () {
this.active = false
this.obj = {}
this.index = 0
this.batch = ''
},
async toSure () {
this.disabled = true
try {
let res = await handpointPut(this.obj.device_code, '2')
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
clearInterval(this.timer)
setTimeout(() => {
this.initPonit(this.regobj)
this.refresh(this.regobj)
}, 200)
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
this.cancle()
this.disabled = false
} catch (e) {
this.active = false
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.main-content
_wh(100%, calc(100% - 160rpx))
.state-wrap
_wh(100%, 60rpx)
margin-bottom 10rpx
_fj()
.state-item-wrap
height 60rpx
_fj()
.state-color
_wh(30rpx, 30rpx)
border-radius 50%
margin-right 10rpx
.state-name
_font(28rpx, 60rpx, #333)
.locate_block
width 100%
background-color #fff
border-radius 5px
padding 10rpx
margin-bottom 12rpx
.locate_name_wrap
_wh(100%,60rpx)
_fj()
.locate_name
_font(32rpx,60rpx,#000,500)
.open_icon
_wh(48rpx,48rpx)
_font(40rpx,48rpx,$red,,right)
transition all .3s
transform rotateZ(180deg)
.is_reverse
transform rotateZ(0)
.site_block
_wh(100%,auto)
transition height .3s
_fj()
.site_item
_wh(32%,100rpx)
padding 10rpx
margin-top 12rpx
background-color #e5e5e5
border-radius 5px
&:nth-child(3n+2)
margin-left 2%
margin-right 2%
.site_item_box
_wh(100%, 100%)
_fj()
.site_item_t1
width 36rpx
_font(28rpx,40rpx,#000,500)
.site_item_t2
_wh(calc(100% - 36rpx), 100%)
_font(28rpx,40rpx,#999)
_fj(center)
background-color #fff
border-radius 3px
padding 0 5rpx
word-break break-word
overflow hidden
.submit-bar
height 160rpx
padding 10rpx
_fj()
background-color #fff
.dot_item
width 35%
background-color #e5e5e5
.p1
display block
height 60rpx
_font(15rpx,60rpx,,,center)
border-bottom 1rpx solid #fff
overflow hidden
.p2
display block
height 80rpx
padding 0 5rpx
_font(15rpx,80rpx,,,center)
overflow hidden
.btn_block
_wh(20%, 140rpx)
_fj(,,column)
.btn1
width 100%
</style>

318
pages/task/sitemanage.vue Normal file
View File

@@ -0,0 +1,318 @@
<template>
<view class="content">
<view class="main-content">
<view class="state-wrap">
<view class="state-item-wrap" v-for="e in state">
<view class="state-color" :class="e.color"></view>
<view class="state-name">{{e.name}}</view>
</view>
</view>
<view class="locate_block" v-for="e in areaArr" :key="e.region_id">
<view class="locate_name_wrap" @click="getPonit(e)">
<view class="locate_name">{{e.region_name}}</view>
<view class="iconfont open_icon" :class="{'is_reverse': e.checked === true}"></view>
</view>
<view v-show="e.checked === true" class="site_block">
<view class="site_item" v-for="(el, i) in e.pointArr" :key="i" :class="['bggray', 'bgblue', 'bggreen', 'bgyellow', 'bgred'][Number(el.status)]" @click="setInfo(el)">
<view class="site_item_box">
<text class="site_item_t1">站点</text>
<text class="site_item_t2">{{el.device_name}}</text>
</view>
</view>
</view>
</view>
</view>
<view v-if="active" class="msg_wrapper">
<view class="msg_box">
<view class="msg_item">
<view class="label_item">当前设备</view>
<view class="from_item">
{{obj.device_name}}
</view>
</view>
<view class="msg_item">
<view class="label_item">当前物料</view>
<view class="from_item">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="msg_item">
<view class="label_item">批次</view>
<view class="from_item">
<input type="text" class="input_item" v-model="batch">
</view>
</view>
<view class="msg_btns">
<button class="msg_btn" :disabled="disabled1" @click="cleanUp">清空</button>
<button class="msg_btn" :disabled="disabled2" @click="msgSure">确认</button>
<button class="msg_btn" @click="msgCancle">取消</button>
</view>
</view>
</view>
<view v-if="active" class="mask"></view>
</view>
</template>
<script>
import {handArea,handPoint,handMatrial,handDeviceStatus} from 'utils/api.js'
export default {
data() {
return {
interTime: this.$store.getters.setTime,
timer: null,
state: [{color: 'bggray', name: '空'}, {color: 'bgblue', name: '空载具'}, {color: 'bggreen', name: '有货有载具'}, {color: 'bgyellow', name: '有任务'}, {color: 'bgred', name: '需人工解锁'}],
areaArr: [],
regobj: {},
active: false,
disabled1: false,
disabled2: false,
obj: {},
batch: '',
options: [],
index: 0
};
},
mounted () {
this.initArea()
this.initHandMatrial()
},
beforeDestroy () {
clearInterval(this.timer)
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
refresh (e) {
this.timer = setInterval(() => {
this.initPonit(e)
}, this.interTime)
},
/** 查询区域信息 */
async initArea () {
let res = await handArea('2')
if (res.code === '1') {
this.areaArr = [...res.result]
this.areaArr.map(el => {
this.$set(el, 'checked', false)
this.$set(el, 'pointArr', [])
})
if (this.areaArr.length > 0) {
this.getPonit(this.areaArr[0])
}
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 根据区域查询设备编号及状态 */
async initPonit (e) {
let res = await handPoint(e.region_id)
if (res.code === '1') {
this.regobj = e
this.areaArr.map(el => {
if (el.region_id === e.region_id) {
this.$set(el, 'pointArr', [...res.result])
}
})
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 查询物料下拉框 */
async initHandMatrial () {
let res = await handMatrial()
if (res.code === '1') {
res.result.map(e => {
this.options.push({text: e.label, value: e.value})
})
this.options = [...res.result]
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
/** 查找区域站点内容 */
getPonit (e) {
clearInterval(this.timer)
this.areaArr.map(el => {
if (el.region_id !== e.region_id) {
el.checked = false
}
if (el.region_id === e.region_id) {
e.checked = !e.checked
}
})
if (e.checked) {
this.initPonit(e)
this.refresh(e)
}
},
/** 点击站点 */
setInfo (e) {
this.active = true
this.obj = e
this.options.map((e, i) => {
if (e.value === material_type) {
this.index = i
}
})
this.batch = e.batch
},
/** 选择器 */
selectChange(e) {
this.index = e
},
cleanUp () {
this.disabled1 = true
this.handStatus(this.obj.device_code, '', '2', this.obj.status, '')
this.active = false
},
msgSure () {
this.disabled2 = true
this.handStatus(this.obj.device_code, this.options[this.index].value, '1', this.obj.status, this.batch)
this.active = false
},
msgCancle () {
this.active = false
this.obj = {}
this.index = 0
this.batch = ''
},
async handStatus (code, mtype, type, no, batch) {
try {
let res = await handDeviceStatus(code, mtype, type, no, batch)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
clearInterval(this.timer)
var that = this
setTimeout(() => {
that.initPonit(this.regobj)
this.refresh(this.regobj)
this.index = 0
this.batch = ''
this.disabled1 = false
this.disabled2 = false
}, 2000)
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
this.index = 0
this.batch = ''
this.disabled1 = false
this.disabled2 = false
}
} catch (err) {
this.index = 0
this.batch = ''
this.disabled1 = false
this.disabled2 = false
}
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
.main-content
_wh(100%, calc(100% - 160rpx))
.state-wrap
_wh(100%, 60rpx)
margin-bottom 10rpx
_fj()
.state-item-wrap
height 60rpx
_fj()
.state-color
_wh(30rpx, 30rpx)
border-radius 50%
margin-right 10rpx
.state-name
_font(28rpx, 60rpx, #333)
.locate_block
width 100%
background-color #fff
border-radius 5px
padding 10rpx
margin-bottom 12rpx
.locate_name_wrap
_wh(100%,60rpx)
_fj()
.locate_name
_font(32rpx,60rpx,#000,500)
.open_icon
_wh(48rpx,48rpx)
_font(40rpx,48rpx,$red,,right)
transition all .3s
transform rotateZ(180deg)
.is_reverse
transform rotateZ(0)
.site_block
_wh(100%,auto)
transition height .3s
_fj()
.site_item
_wh(32%,100rpx)
padding 10rpx
margin-top 12rpx
background-color #e5e5e5
border-radius 5px
&:nth-child(3n+2)
margin-left 2%
margin-right 2%
.site_item_box
_wh(100%, 100%)
_fj()
.site_item_t1
width 36rpx
_font(28rpx,40rpx,#000,500)
.site_item_t2
_wh(calc(100% - 36rpx), 100%)
_font(28rpx,40rpx,#999)
_fj(center)
background-color #fff
border-radius 3px
padding 0 5rpx
word-break break-word
overflow hidden
.submit-bar
height 160rpx
padding 10rpx
_fj()
background-color #fff
.dot_item
width 35%
background-color #e5e5e5
.p1
display block
height 60rpx
_font(15rpx,60rpx,,,center)
border-bottom 1rpx solid #fff
overflow hidden
.p2
display block
height 80rpx
padding 0 5rpx
_font(15rpx,80rpx,,,center)
overflow hidden
.btn_block
_wh(20%, 140rpx)
_fj(,,column)
.btn1
width 100%
</style>

109
pages/task/taskmanage.vue Normal file
View File

@@ -0,0 +1,109 @@
<template>
<view class="content">
<view class="container">
<view class="grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>任务号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>物料类型</th>
<th>优先级</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.task_status_name}}</td>
<td>{{e.material_type_name}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('1')">重新生成</button>
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('2')">强制完成</button>
</view>
</view>
</template>
<script>
import {queryTask, taskOperation} from 'utils/api.js'
export default {
data() {
return {
dataList: [],
pkId: '',
disabled: false
};
},
mounted () {
this.queryTask()
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
async queryTask () {
let res = await queryTask()
if (res.code === '1') {
this.dataList = [...res.result]
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
async taskOperation (type) {
try {
let res = await taskOperation(this.pkId, type)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
this.pkId = ''
this.dataList = []
this.queryTask()
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
this.disabled = false
} catch (err) {
this.disabled = false
}
},
toSure (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
this.taskOperation(type)
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
}
}
}
</script>
<style lang="stylus">
</style>

114
pages/task/zlmanage.vue Normal file
View File

@@ -0,0 +1,114 @@
<template>
<view class="content">
<view class="container">
<view class="grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>任务号</th>
<th>指令号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>agv车号</th>
<th>物料类型</th>
<th>优先级</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': inst_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.inst_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.inst_status_name}}</td>
<td>{{e.carno}}</td>
<td>{{e.material_type_name}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('1')">指令撤销</button>
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('2')">重新下发</button>
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('3')">强制完成</button>
</view>
</view>
</template>
<script>
import {queryInstraction, instOperation} from 'utils/api.js'
export default {
data() {
return {
dataList: [],
pkId: '',
disabled: false
};
},
mounted () {
this._queryInstraction()
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
async _queryInstraction () {
let res = await queryInstraction()
if (res.code === '1') {
this.dataList = [...res.result]
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
async _instOperation (type) {
try {
let res = await instOperation(this.pkId, type)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
this.pkId = ''
this.dataList = []
this._queryInstraction()
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
this.disabled = false
} catch (err) {
this.disabled = false
}
},
toSure (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
this._instOperation(type)
},
toCheck (e) {
this.pkId = this.pkId === inst_uuid ? '' : e.inst_uuid
}
}
}
</script>
<style lang="stylus">
</style>