<template>
|
<view class="example">
|
<u-tabs :list="list" :is-Scroll="false" :current="current2"></u-tabs>
|
<view v-show="current2===0">
|
<u-button text="月落"></u-button>
|
<uni-section title="一楼库存查看" type="line" padding style="height: calc(100vh - 100px);">
|
<uni-list>
|
<!-- to 属性携带参数跳转详情页面,当前只为参考 -->
|
<uni-list-item direction="column" v-for="(item,index) in listData" :key="index"
|
@click="handleClick(item.orderNo,item.productCode,item.number)" link>
|
<!-- 通过header插槽定义列表的标题 -->
|
<template v-slot:header>
|
<view class="uni-title">工单:{{item.orderNo}}
|
<!-- <uni-icons type="trash" size="22" style="position: absolute;right: 5%;"
|
@click="deleteList(item.container_barcode)">
|
</uni-icons> -->
|
</view>
|
</template>
|
<!-- 通过body插槽定义列表内容显示 -->
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">型号:{{item.productCode}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">可叫任务数量:{{item.number}}</view>
|
<!-- <view class="uni-note">
|
承接车号:{{item.agv_code}}
|
|
任务状态:{{item.agv_taskstate}}
|
</view> -->
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
<uni-load-more iconType="circle" :status="status" @clickLoadMore="clickLoadMore" />
|
<!-- <u-button type="success" size="default" shape="circle" :ripple="true" ripple-bg-color="#909399"
|
@click="submit">
|
状态查询
|
</u-button> -->
|
</uni-section>
|
</view>
|
<view>
|
<uni-popup ref="alertDialog" type="dialog">
|
<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="同意" :title="提示" :content="content"
|
@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
|
</uni-popup>
|
</view>
|
</view>
|
</template>
|
<script>
|
export default {
|
data() {
|
return {
|
listData: [],
|
list: [{
|
name: '库存查看'
|
}],
|
current2: 0,
|
current: 1,
|
size: 10,
|
status: 'more',
|
Modalshow: false,
|
title: "提示",
|
content: '欢迎使用 uni-popup!',
|
msgType: 'success',
|
}
|
},
|
onLoad() {
|
this.submit()
|
},
|
methods: {
|
onClickItem(e) {
|
if (this.current != e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
submit(cb) {
|
this.$t.message.loading()
|
let formDataParam = {
|
current: this.current,
|
size: this.size
|
}
|
this.$u.post('/api/PDA/AGVPage', null).then(res => {
|
console.log(res);
|
this.$t.message.closeLoading()
|
cb && cb()
|
if (cb != null) this.listData = []
|
this.listData = [...this.listData, ...res.data]
|
console.log(this.listData);
|
|
}).catch((err) => {
|
this.$t.message.toast(err.message)
|
})
|
},
|
clickLoadMore(e) {
|
this.status = 'loading',
|
this.current += 1;
|
this.size += 10;
|
this.submit();
|
},
|
handleClick(orderNo, productCode, number) {
|
console.log(this.$refs)
|
this.$refs.alertDialog.open()
|
// this.content = '工单:' + orderNo + \n'型号:' + productCode + \n'请确认是否叫任务'
|
this.content = `工单:${orderNo}\n型号:${productCode}\n可叫数量:${number}\n请确认是否叫任务(默认4个)`;
|
},
|
dialogConfirm() {
|
this.$t.message.loading()
|
// 提取工单编号
|
const orderNo = this.content.match(/工单:(.*)\n/)[1];
|
|
// 提取型号
|
const productCode = this.content.match(/型号:(.*)\n/)[1];
|
|
// 提取可叫数量
|
const availableQuantity = this.content.match(/可叫数量:(.*)\n/)[1];
|
let formDataParam = {
|
DTaskId: this.generateUUID(),
|
ProductCode: productCode,
|
OrderNo: orderNo,
|
Number: availableQuantity > 4 ? 4 : availableQuantity,
|
}
|
console.log(formDataParam)
|
this.$u.post('/api/PDA/insertTask', formDataParam).then(res => {
|
// if (res.code === 200) {
|
if (res.status) {
|
this.$u.post('/api/PDA/AddCZTask', formDataParam).then(res => {
|
this.$t.message.closeLoading()
|
if (res.status) {
|
this.$t.message.toast(呼叫成功)
|
this.$refs.alertDialog.close()
|
this.submit()
|
} else
|
this.$t.message.toast(res.msg)
|
|
}) ;
|
this.submit()
|
} else
|
this.$t.message.toast(res.msg)
|
}).catch((err) => {
|
this.$t.message.toast(err.message)
|
})
|
},
|
dialogClose() {
|
console.log('点击关闭')
|
},
|
generateUUID() {
|
var d = new Date().getTime();
|
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
var r = (d + Math.random() * 16) % 16 | 0;
|
d = Math.floor(d / 16);
|
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
});
|
return uuid;
|
},
|
},
|
onPullDownRefresh() {
|
this.current = 1;
|
this.size = 10;
|
this.submit(() => uni.stopPullDownRefresh())
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import '@/common/uni-ui.scss';
|
|
.example {
|
padding: 15px;
|
background-color: #fff;
|
}
|
|
page {
|
display: flex;
|
flex-direction: column;
|
box-sizing: border-box;
|
background-color: #efeff4;
|
min-height: 100%;
|
height: auto;
|
}
|
|
.tips {
|
color: #67c23a;
|
font-size: 14px;
|
line-height: 40px;
|
text-align: center;
|
background-color: #f0f9eb;
|
height: 0;
|
opacity: 0;
|
transform: translateY(-100%);
|
transition: all 0.3s;
|
}
|
|
.tips-ani {
|
transform: translateY(0);
|
height: 40px;
|
opacity: 1;
|
}
|
|
.content {
|
width: 100%;
|
display: flex;
|
}
|
|
.list-picture {
|
width: 100%;
|
height: 145px;
|
}
|
|
.thumb-image {
|
width: 100%;
|
height: 100%;
|
}
|
|
.ellipsis {
|
display: flex;
|
overflow: hidden;
|
}
|
|
.uni-ellipsis-1 {
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
}
|
|
.uni-ellipsis-2 {
|
overflow: hidden;
|
text-overflow: ellipsis;
|
display: -webkit-box;
|
-webkit-line-clamp: 2;
|
-webkit-box-orient: vertical;
|
}
|
</style>
|