多语言

This commit is contained in:
2024-07-31 09:00:33 +08:00
commit 77d4f16156
123 changed files with 18292 additions and 0 deletions

View File

@@ -0,0 +1,283 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 filter_label">任务起点1</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="sCode1" @input="matchData(1)">
<view v-if="filterNo ===1 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="sCode1 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row border-bottom">
<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 filter_label">任务终点1</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="nCode1" @input="matchData(2)">
<view v-if="filterNo ===2 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="nCode1 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row border-bottom">
<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 filter_label">任务起点2</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="sCode2" @input="matchData(3)">
<view v-if="filterNo ===3 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="sCode2 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row">
<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 filter_label">任务终点2</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="nCode2" @input="matchData(4)">
<view v-if="filterNo ===4 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="nCode2 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
</view>
<view class="zd_wrapper">
<view class="allwidth" v-for="e in areaArr" :key="e.region_code">
<view class="zd-row" @click="getPonit(e)">
<view class="title_locate">{{e.region_name}}</view>
<uni-icons :type="pkId === e.region_code ? 'up' : 'down'" size="16"></uni-icons>
</view>
<view v-if="pkId === e.region_code" class="zd-row flexstart flexwrap">
<view class="zd-col-12 site_item" v-for="(el, index) in pointArr" :key="index">
<view class="site_item_box":class="{'isChecked': el.device_code === sCode1 || el.device_code === nCode1 || el.device_code === sCode2 || el.device_code === nCode2}" :id="'site_item_box_'+ index" @click="setcode(el,index)">
<view class="point_title_1">{{el.device_name}}</view>
<view class="point_title_2">{{el.device_code}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-4 button-default" @click="cancle">清空</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !((sCode1 !== '' && nCode1 !== '') || (sCode2 !== '' && nCode2 !== ''))}" :disabled="disabled" @tap="_agvcallTask('1')">生箔换轴</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !((sCode1 !== '' && nCode1 !== '') || (sCode2 !== '' && nCode2 !== ''))}" :disabled="disabled" @tap="_agvcallTask('2')">分切换轴</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !((sCode1 !== '' && nCode1 !== '') || (sCode2 !== '' && nCode2 !== ''))}" :disabled="disabled" @tap="_agvcallTask('3')">搬运任务</button>
</view>
<view class="pop_point_wrap" :style="{top: distanceToTop + 'px',left: distanceToLeft + 'px'}">
<view class="zd-row jccenter">
<uni-icons type="map-pin-ellipse" size="18" color="#fff"></uni-icons>
</view>
<view class="pop_point_content" :class="{'pop_point_content_up': this.popup}">
<view class="zd-row mgb20">
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(1)">任务起点1</view>
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(2)">任务终点1</view>
</view>
<view class="zd-row">
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(3)">任务起点2</view>
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(4)">任务终点2</view>
</view>
</view>
</view>
<view v-if="show" class="msg_mask" @tap="colsePop"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
// import {agvqueryArea, queryPointByArea} from '@/utils/mork2.js'
import {agvqueryArea, queryPointByArea, agvcallTask} from '@/utils/getData2.js'
export default {
components: {
NavBar
},
data() {
return {
title: '',
areaArr: [],
pointArr: [],
pkId: '',
disabled: false,
code: '',
sCode1: '',
nCode1: '',
sCode2: '',
nCode2: '',
show: false,
distanceToTop: -300,
distanceToLeft: -300,
windowHeight: '',
popHeight: '',
filteredData: [],
filterNo: '',
popup: false
};
},
onLoad (options) {
this.title = options.title
uni.getSystemInfo({
success: (info) => {
this.windowHeight = info.windowHeight
}
})
},
onReady () {
const query = uni.createSelectorQuery().in(this)
query
.select('.pop_point_content')
.boundingClientRect(data => {
this.popHeight = data.height
}).exec()
},
created () {
this.initArea()
},
methods: {
matchData (no) {
this.filterNo = no
let query = ''
switch (no) {
case 1:
query = this.sCode1.toLowerCase()
break
case 2:
query = this.nCode1.toLowerCase()
break
case 3:
query = this.sCode2.toLowerCase()
break
case 4:
query = this.nCode2.toLowerCase()
break
default:
break
}
if (!query) {
this.filteredData = []
return
}
this.filteredData = this.pointArr.filter(item => {
return item.device_code.toLowerCase().includes(query)
})
},
async initArea () {
let res = await agvqueryArea()
this.areaArr = [...res.data]
if (this.areaArr.length > 0) {
this.pkId = this.areaArr[0].region_code
this.initPonit()
}
},
getPonit (e) {
this.pkId = this.pkId === e.region_code ? '' : e.region_code
if (this.pkId) {
this.initPonit()
}
},
async initPonit () {
let res = await queryPointByArea(this.pkId)
this.pointArr = [...res.data]
},
setcode (el,index) {
const query = uni.createSelectorQuery().in(this)
query
.select(`#site_item_box_${index}`)
.boundingClientRect(data => {
if (data) {
this.distanceToTop = data.top + (data.height / 2) - 9
this.distanceToLeft = data.left
if ((this.windowHeight - this.distanceToTop) < (this.popHeight + 20)) {
this.popup = true
} else {
this.popup = false
}
}
}).exec()
this.show = true
this.code = el.device_code
},
colsePop () {
this.show = !this.show
this.distanceToTop = -300
this.distanceToLeft = -300
},
popCode (code) {
switch (code) {
case 1:
this.sCode1 = this.code
break
case 2:
this.nCode1 = this.code
break
case 3:
this.sCode2 = this.code
break
case 4:
this.nCode2 = this.code
break
default:
break
}
this.colsePop()
},
/** 清空点位选择 */
cancle () {
this.sCode1 = ''
this.nCode1 = ''
this.sCode2 = ''
this.nCode2 = ''
this.disabled = false
},
async _agvcallTask (type) {
this.disabled = true
if (!((this.sCode1 !== '' && this.nCode1 !== '') || (this.sCode2 !== '' && this.nCode2 !== ''))) {
this.disabled = false
return
}
if (this.sCode1 !=='' && this.sCode1 === this.nCode1) {
uni.showToast({
title: '任务起点终点不能相同',
icon: 'none'
})
this.disabled = false
return
}
if (this.sCode2 !=='' && this.sCode2 === this.nCode2) {
uni.showToast({
title: '任务起点终点不能相同',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await agvcallTask(this.sCode1, this.nCode1, this.sCode2, this.nCode2, type)
this.cancle()
clearInterval(this.timer)
this.timer = null
setTimeout(() => {
this.refresh()
this.cancle()
}, 2000)
uni.showToast({
title: res.desc,
icon: 'none'
})
} catch (err) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.item-font-6
color #fff
.filter_label
padding-left 0
</style>

View File

@@ -0,0 +1,243 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<!-- <view class="zd-row jcflexstart state-wrap">
<view class="zd-col-4 zd-row jcflexstart" v-for="e in state">
<view class="state-color" :class="e.color"></view>
<view class="state-name">{{e.name}}</view>
</view>
</view> -->
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row mgb20 border-bottom">
<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 filter_label">任务起点</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="sCode" @input="matchData(1)">
<view v-if="filterNo ===1 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="sCode = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row">
<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 filter_label">任务终点</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="nCode" @input="matchData(2)">
<view v-if="filterNo ===2 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="nCode = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
</view>
<view class="zd_wrapper">
<view class="allwidth" v-for="e in areaArr" :key="e.region_code">
<view class="zd-row" @click="getPonit(e)">
<view class="title_locate">{{e.region_name}}</view>
<uni-icons :type="pkId === e.region_code ? 'up' : 'down'" size="16"></uni-icons>
</view>
<view v-if="pkId === e.region_code" class="zd-row flexstart flexwrap">
<view class="zd-col-12 site_item" v-for="(el, index) in pointArr" :key="index">
<view class="site_item_box" :class="{'isChecked': el.device_code === sCode || el.device_code === nCode}" :id="'site_item_box_'+ index" @click="setcode(el,index)">
<view class="point_title_1">{{el.device_name}}</view>
<view class="point_title_2">{{el.device_code}}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-4 button-default" @click="cancle">清空</button>
<button class="zd-col-6 button-primary" :class="{'button-info': sCode === '' || nCode === ''}" :disabled="disabled" @tap="_callTask('1')">生箔换轴</button>
<button class="zd-col-6 button-primary" :class="{'button-info': sCode === '' || nCode === ''}" :disabled="disabled" @tap="_callTask('2')">分切换轴</button>
<button class="zd-col-6 button-primary" :class="{'button-info': sCode === '' || nCode === ''}" :disabled="disabled" @tap="_callTask('3')">搬运任务</button>
</view>
<view class="pop_point_wrap" :style="{top: distanceToTop + 'px',left: distanceToLeft + 'px'}">
<view class="zd-row jccenter">
<uni-icons type="map-pin-ellipse" size="18" color="#fff"></uni-icons>
</view>
<view class="zd-row pop_point_content" :class="{'pop_point_content_up': this.popup}">
<view class="zd-col-11 item-font-6 bggreen" @tap="popCode(1)">任务起点</view>
<view class="zd-col-11 item-font-6 bgblue" @tap="popCode(2)">任务终点</view>
</view>
</view>
<view v-if="show" class="msg_mask" @tap="colsePop"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryArea, queryPointByArea, callTask} from '@/utils/getData2.js'
export default {
components: {
NavBar
},
data() {
return {
title: '',
areaArr: [],
pointArr: [],
pkId: '',
disabled: false,
code: '',
sCode: '',
nCode: '',
show: false,
distanceToTop: -300,
distanceToLeft: -300,
windowHeight: '',
popHeight: '',
filteredData: [],
filterNo: '',
popup: false
};
},
onLoad (options) {
this.title = options.title
uni.getSystemInfo({
success: (info) => {
this.windowHeight = info.windowHeight
}
})
},
onReady () {
const query = uni.createSelectorQuery().in(this)
query
.select('.pop_point_content')
.boundingClientRect(data => {
this.popHeight = data.height
}).exec()
},
created () {
this.initArea()
},
methods: {
matchData (no) {
this.filterNo = no
let query = ''
switch (no) {
case 1:
query = this.sCode.toLowerCase()
break
case 2:
query = this.nCode.toLowerCase()
break
default:
break
}
if (!query) {
this.filteredData = []
return
}
this.filteredData = this.pointArr.filter(item => {
return item.device_code.toLowerCase().includes(query)
})
},
async initArea () {
let res = await queryArea()
this.areaArr = [...res.data]
if (this.areaArr.length > 0) {
this.pkId = this.areaArr[0].region_code
this.initPonit()
}
},
getPonit (e) {
this.pkId = this.pkId === e.region_code ? '' : e.region_code
if (this.pkId) {
this.initPonit()
}
},
async initPonit () {
let res = await queryPointByArea(this.pkId)
this.pointArr = [...res.data]
},
setcode (el,index) {
const query = uni.createSelectorQuery().in(this)
query
.select(`#site_item_box_${index}`)
.boundingClientRect(data => {
if (data) {
this.distanceToTop = data.top + (data.height / 2) - 9
this.distanceToLeft = data.left
console.log(this.popHeight)
if ((this.windowHeight - this.distanceToTop) < (this.popHeight + 20)) {
this.popup = true
} else {
this.popup = false
}
}
}).exec()
this.show = true
this.code = el.device_code
},
colsePop () {
this.show = !this.show
if (!this.show) {
this.distanceToTop = -300
this.distanceToLeft = -300
}
},
popCode (code) {
switch (code) {
case 1:
this.sCode = this.code
break
case 2:
this.nCode = this.code
break
default:
break
}
this.colsePop()
},
/** 清空点位选择 */
cancle () {
this.sCode = ''
this.nCode = ''
this.disabled = false
},
async _callTask (type) {
this.disabled = true
if (this.sCode === '' || this.nCode === '') {
this.disabled = false
return
}
if (this.sCode === this.nCode) {
uni.showToast({
title: '任务起点终点不能相同',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await callTask(this.sCode, this.nCode, type)
this.cancle()
clearInterval(this.timer)
this.timer = null
setTimeout(() => {
this.refresh()
this.cancle()
}, 2000)
uni.showToast({
title: res.desc,
icon: 'none'
})
} catch (err) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.item-font-6
color #fff
.filter_label
padding-left 0
.pop_point_content_up
top -200rpx
</style>

View File

@@ -0,0 +1,189 @@
<template>
<view class="zd_container">
<nav-bar :title="title" :searchActive="true" @toSearch="toSearch"></nav-bar>
<view class="zd_content pdt0">
<view class="filter_wrapper">
<view class="zd-row">
<view class="zd-col-8 font-style-1" v-for="e in state" :key="e.id" @tap="changeTab(e)">
<view class="font-style-1" :class="{'font-style-2': e.id === tab}">{{e.text}}</view>
<view class="tab-line" :class="{'tab-line_active': e.id === tab}"></view>
</view>
</view>
</view>
<view class="item-wrapper">
<view class="item-wrap" v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{isChecked: pkId === e.inst_uuid}">
<view class="zd-row">
<view class="zd-col-10 item-font-1">{{e.task_no}}&nbsp;&#124;&nbsp;{{['就绪', '执行中', '完成','取消'][Number(e.inst_status)]}}</view>
<view class="zd-col-10 item-font-2" style="text-align:right">{{e.create_time}}</view>
</view>
<view class="zd-row">
<view class="zd-col-16">
<view class="zd-row">
<view class="zd-col-6 item-font-3">指令号</view>
<view class="zd-col-18 item-font-4">{{e.instruction_code}}</view>
</view>
<view class="zd-row">
<view class="zd-col-10 item-font-3">指令执行步骤</view>
<view class="zd-col-14 item-font-4">{{e.inst_step}}</view>
</view>
<view class="zd-row">
<view class="zd-col-6 item-font-3">载具号</view>
<view class="zd-col-18 item-font-4">{{e.carrier}}</view>
</view>
<view class="zd-row">
<view class="zd-col-6 item-font-3">车号</view>
<view class="zd-col-18 item-font-4">{{e.carno}}</view>
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
<view class="item-font-7">优先级</view>
</view>
</view>
<view class="zd-row">
<view class="zd-col-10 item-font-6">起始设备{{e.start_devicecode}}</view>
<view class="zd-col-2 item-font-7">&ndash;&ndash;</view>
<view class="zd-col-10 item-font-6">目标设备{{e.next_devicecode}}</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handInst('1')">指令撤销</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handInst('2')">重新下发</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handInst('3')">强制完成</button>
</view>
<view class="zd_content msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_content">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="val1">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起始设备</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">目标设备</span>
</view>
<view class="zd-col-19 filter_select">
<search-box
v-model="val3"
/>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap.stop="show = false">取消</button>
<button class="zd-col-7 button-default" @tap.stop="clearUp">清空</button>
<button class="zd-col-7 button-primary" @tap="_handInsts">查询</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {handInsts, handInst} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
show: false,
state: [{id:'-1', text: '全部'}, {id:'0', text: '就绪'}, {id:'1', text: '执行中'}, {id:'2', text: '完成'}, {id:'3', text: '取消'}],
tab: '-1',
title: '',
val1: '',
val2: '',
val3: '',
data: [],
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._handInsts()
},
methods: {
toSearch () {
this.show = true
this.tab = '-1'
},
async _handInsts () {
this.show = false
try {
let res = await handInsts(this.val1, this.val2, this.val3)
this.data = [...res.data]
this.dataList = [...this.data]
} catch (e) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
},
changeTab (e) {
this.tab = e.id
if (e.id !== '-1') {
let arr = this.data.filter(el => {return el.inst_status === e.id})
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
async _handInst (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handInst(type, this.pkId)
this.disabled = false
this.tab = '-1'
this._handInsts()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.pkId = ''
this.disabled = false
},
toCheck (e) {
this.pkId = this.pkId === e.inst_uuid ? '' : e.inst_uuid
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,78 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="zd-row flexstart flexwrap">
<view class="zd-col-12 site_item" v-for="(e, i) in pointArr" :key="i" @tap="toCheck(e)">
<view class="site_item_box" :class="{'isChecked': pkId === e.device_code}">
<view class="point_title_1">{{e.device_name}}</view>
<view class="point_title_2">{{e.device_code}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-primary button-primary1" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_updateDeviceStatus('0')">禁止进入</button>
<button class="zd-col-7 button-primary button-primary2" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_updateDeviceStatus('1')">允许进入</button>
<button class="zd-col-7 button-primary button-primary3" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_updateDeviceStatus('2')">允许离开</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
// import {queryDevices} from '@/utils/mork2.js'
import {queryDevices, updateDeviceStatus} from '@/utils/getData2.js'
export default {
components: {
NavBar
},
data() {
return {
title: '',
pointArr: [],
disabled: false,
pkId: ''
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._queryDevices()
},
methods: {
async _queryDevices () {
let res = await queryDevices()
this.pointArr = [...res.data]
},
toCheck (e) {
this.pkId = this.pkId === e.device_code ? '' : e.device_code
},
async _updateDeviceStatus (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await updateDeviceStatus(this.pkId, type)
this.pkId = ''
this._queryDevices()
uni.showToast({
title: res.desc,
icon: 'none'
})
} catch (err) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
</style>

View File

@@ -0,0 +1,180 @@
<template>
<view class="zd_container">
<nav-bar :title="title" :searchActive="true" @toSearch="toSearch"></nav-bar>
<view class="zd_content pdt0">
<view class="filter_wrapper">
<view class="zd-row">
<view class="zd-col-8 font-style-1" v-for="e in state" :key="e.id" @tap="changeTab(e)">
<view class="font-style-1" :class="{'font-style-2': e.id === tab}">{{e.text}}</view>
<view class="tab-line" :class="{'tab-line_active': e.id === tab}"></view>
</view>
</view>
</view>
<view class="item-wrapper">
<view class="item-wrap" v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{isChecked: pkId === e.task_uuid}">
<view class="zd-row">
<view class="zd-col-10 item-font-1">{{e.task_no}}</view>
<view class="zd-col-10 item-font-2" style="text-align:right">{{e.create_time}}</view>
</view>
<view class="zd-row">
<view class="zd-col-16">
<view class="zd-row">
<view class="zd-col-7 item-font-3">任务状态</view>
<view class="zd-col-17 item-font-4">{{['就绪', '执行中', '完成'][Number(e.task_status)]}}</view>
</view>
<view class="zd-row">
<view class="zd-col-7 item-font-3">载具号</view>
<view class="zd-col-17 item-font-4">{{e.carrier}}</view>
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
<view class="item-font-7">优先级</view>
</view>
</view>
<view class="zd-row">
<view class="zd-col-10 item-font-6">起始设备{{e.start_devicecode}}</view>
<view class="zd-col-2 item-font-7">&ndash;&ndash;</view>
<view class="zd-col-10 item-font-6">目标设备{{e.next_devicecode}}</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handTaskoperation('1')">重新生成</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handTaskoperation('2')">强制完成</button>
</view>
<view class="zd_content msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_content">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="val1">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起始设备</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">目标设备</span>
</view>
<view class="zd-col-19 filter_select">
<search-box
v-model="val3"
/>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap.stop="show = false">取消</button>
<button class="zd-col-7 button-default" @tap.stop="clearUp">清空</button>
<button class="zd-col-7 button-primary" @tap="_handTasks">查询</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {handTasks, handTaskoperation} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
show: false,
state: [{id:'-1', text: '全部'}, {id:'0', text: '就绪'}, {id:'1', text: '执行中'}, {id:'2', text: '完成'}],
tab: '-1',
title: '',
val1: '',
val2: '',
val3: '',
data: [],
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._handTasks()
},
methods: {
toSearch () {
this.show = true
this.tab = '-1'
},
async _handTasks () {
this.show = false
try {
let res = await handTasks(this.val1, this.val2, this.val3)
this.data = [...res.data]
this.dataList = [...this.data]
} catch (e) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
},
changeTab (e) {
this.tab = e.id
if (e.id !== '-1') {
let arr = this.data.filter(el => {return el.task_status === e.id})
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
async _handTaskoperation (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handTaskoperation(type, this.pkId)
this.disabled = false
this.tab = '-1'
this._handTasks()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.pkId = ''
this.disabled = false
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
}
}
}
</script>
<style lang="stylus">
</style>