<template>
|
<view class="mould_index">
|
<u-navbar title="模具匹配" bgColor="#1977FF" :autoBack="true" :placeholder="true" leftIconColor="#FFFFFF">
|
<view slot="right" hover-class="hovers">
|
<u-icon name="scan" color="#D5E6FF" label="扫描模具" labelColor="#D5E6FF" size="18px" top="1"
|
@click="scanMoulds()"></u-icon>
|
</view>
|
</u-navbar>
|
<view class="mould_index_content">
|
<u-row justify="space-between" gutter="6" customStyle="width: calc(100% - 20px);">
|
<u-col span="5">
|
<view @click="value = '';matchStatus = '';showState = true">
|
<u-input v-model="value" border="surround" disabled disabledColor="#FFFFFF"
|
placeholder="请选择匹配状态"></u-input>
|
</view>
|
</u-col>
|
<u-col span="5">
|
<u-input v-model="mouldNum" border="surround" placeholder="请输入模具编号"></u-input>
|
</u-col>
|
<u-col span="2">
|
<u-button type="primary" size="small" text="查询" color="#1977FF" @click="searchData()"></u-button>
|
</u-col>
|
</u-row>
|
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" scroll-y="true" refresher-background="#EAEAEA"
|
class="content_scroll" @scrolltolower="scrolltoLower" :refresher-triggered="triggered"
|
@refresherrefresh="refresherrefresh">
|
<view v-for="(item, index) in mouldCheckList" :key="item.modId" class="scroll_item">
|
<view class="scroll_item_header">
|
<view :class="{
|
'item_header_state': item.matchStatus == 2,
|
'item_header_success': item.matchStatus != 2
|
}">
|
{{item.matchStatus === 1 ? '未匹配' : item.matchStatus === 2 ? '匹配成功入模' : '匹配失败无法入模'}}
|
</view>
|
<text class="delete" @click="deleteMouldCheckInfo(item)">删除</text>
|
</view>
|
<view class="scroll_item_content">
|
<view class="item_content_info">
|
<view class="info_title">
|
模具信息
|
</view>
|
<view class="info_content">
|
<view class="info_content_item">
|
<text class="label">模具编号:</text>
|
<text>{{item.mouldNum}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">模具型号:</text>
|
<text>{{item.mouldCode}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">尺寸:</text>
|
<text>{{item.mouldSizeName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">块号:</text>
|
<text>{{item.mouldBlockName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">转向:</text>
|
<text>{{item.mouldTurnName}}</text>
|
</view>
|
</view>
|
</view>
|
<view class="item_content_info" v-if="item.matchStatus !== 1">
|
<view class="info_title">
|
钢筋笼信息
|
</view>
|
<view class="info_content">
|
<view class="info_content_item">
|
<text class="label">项目名称:</text>
|
<text>{{item.proName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">钢筋笼编号:</text>
|
<text>{{item.produceNumber}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">尺寸:</text>
|
<text>{{item.steelSizeName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">块号:</text>
|
<text>{{item.steelBlockName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">配筋:</text>
|
<text>{{item.steelReinforcementName}}</text>
|
</view>
|
</view>
|
</view>
|
<view class="item_content_info" style="padding: 20px 0 10px;" v-else>
|
<u-button type="primary" iconColor="#C7DEFE" icon="scan" text="扫描钢筋笼二维码"
|
@click="scanReinforc(item)"></u-button>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
<u-picker :show="showState" :columns="columnData" keyName="label" closeOnClickOverlay
|
@cancel="showState = false" @confirm="confirmPicker" @close="showState = false"></u-picker>
|
<u-popup :show="showDelete" mode="center" closeable round="10" closeOnClickOverlay @close="showDelete = false">
|
<view class="prop_delete">
|
<u-image src="../../static/logo.png" shape="circle" width="40px" height="40px"></u-image>
|
<text style="margin-top: 15px;">入模信息已删除!</text>
|
</view>
|
</u-popup>
|
<u-modal :show="showAffirm" content="该操作将删除该模具信息,是否继续?" @cancel="cancelMould" @confirm="confirmMould"
|
showCancelButton ref="uModal" :asyncClose="true">
|
</u-modal>
|
</view>
|
</template>
|
|
<script>
|
import {
|
throttle
|
} from '../../plugins/public';
|
export default {
|
data() {
|
return {
|
value: '',
|
mouldNum: '',
|
matchStatus: '',
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
iconType: 'flower',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
showState: false,
|
columnData: [
|
[{
|
label: '未匹配',
|
id: 1
|
}, {
|
label: '匹配成功入模',
|
id: 2
|
}, {
|
label: '匹配失败无法入模',
|
id: 3
|
}]
|
],
|
showDelete: false,
|
mouldCheckList: [],
|
pageNum: 1,
|
pageSize: 10,
|
loadPage: '',
|
showAffirm: false,
|
modCheckId: ''
|
}
|
},
|
onLoad() {
|
this.searchData();
|
},
|
onUnload() {
|
// 移除监听事件
|
uni.$off('scancodedate');
|
},
|
methods: {
|
// 查询模具质检列表
|
async searchMouldCheckData() {
|
const {
|
data
|
} = await this.$api.mould.searchMouldCheckData({
|
matchStatus: this.matchStatus,
|
mouldNum: this.mouldNum,
|
pageNum: this.pageNum,
|
pageSize: this.pageSize
|
})
|
return data;
|
},
|
// 查询
|
searchData() {
|
this.triggered = true;
|
this.mouldCheckList = [];
|
this.searchMouldCheckData().then(data => {
|
this.mouldCheckList = data.list;
|
this.loadPage = data.pages;
|
this.triggered = false;
|
this.status = 'nomore';
|
}).catch(() => {
|
this.triggered = false;
|
this.status = 'nomore';
|
uni.$u.toast('没有更数据了');
|
})
|
},
|
//自定义下拉刷新
|
refresherrefresh: throttle(function() {
|
this.status = 'loading';
|
this.pageNum = 1;
|
this.searchData();
|
uni.$u.toast('刷新成功');
|
}, 500),
|
//触底刷新
|
scrolltoLower: throttle(function() {
|
this.status = 'loading';
|
if (this.pageNum >= this.loadPage) {
|
setTimeout(() => {
|
this.status = 'nomore'
|
uni.$u.toast('没有更多数据了');
|
}, 1000)
|
return
|
} else {
|
this.pageNum += 1;
|
this.searchMouldCheckData().then((data) => {
|
this.loadPage = data.pages;
|
this.mouldCheckList.push(...data.list);
|
this.status = 'nomore';
|
})
|
}
|
}, 3000),
|
// 删除入模质检信息
|
deleteMouldCheckInfo(item) {
|
this.showAffirm = true;
|
this.modCheckId = item.modCheckId;
|
},
|
// 关闭确认框
|
cancelMould() {
|
this.showAffirm = false;
|
uni.$u.toast('您已取消');
|
},
|
// 确认删除
|
confirmMould() {
|
this.$api.mould.deleteMouldCheckInfo({
|
modCheckId: this.modCheckId
|
}).then((res) => {
|
if (res.success) {
|
this.modCheckId = '';
|
this.showAffirm = false;
|
uni.$u.toast('删除成功');
|
this.searchData();
|
} else {
|
uni.$u.toast(res.statusMsg);
|
}
|
})
|
},
|
// 选择匹配状态
|
confirmPicker(data) {
|
this.value = data.value[0].label;
|
this.matchStatus = data.value[0].id;
|
this.showState = false;
|
},
|
// 扫描模具
|
scanMoulds() {
|
const that = this;
|
uni.$off('scancodedate');
|
uni.$on('scancodedate', function(data) {
|
const list = data.code ? data.code.split('mouldId=') : [];
|
const codeStr = list.length > 0 ? list[list.length - 1] : '';
|
console.log(codeStr, 'codeStrcodeStrcodeStrcodeStr');
|
that.$api.mould.scanCheckMould({
|
mouldNum: codeStr
|
}).then((res) => {
|
if (res.success) {
|
uni.$u.toast('扫描完成!');
|
that.searchData();
|
} else {
|
uni.$u.toast(res.statusMsg);
|
}
|
})
|
uni.$off('scancodedate');
|
})
|
},
|
// 扫描钢筋笼二维码
|
scanReinforc(item) {
|
const that = this;
|
uni.$off('scancodedate');
|
uni.$on('scancodedate', function(data) {
|
console.log(data);
|
console.log(data.code.slice(-17));
|
that.$api.mould.scanMouldMatchStee({
|
produceNumber: data.code.slice(-17),
|
modCheckId: item.modCheckId
|
}).then((res) => {
|
if (res.success) {
|
uni.$u.toast('匹配完成!');
|
that.searchData();
|
} else {
|
uni.$u.toast(res.statusMsg);
|
}
|
})
|
uni.$off('scancodedate');
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.mould_index {
|
position: relative;
|
width: 100vw;
|
height: 100vh;
|
background: #F6F6F6;
|
|
.mould_index_content {
|
padding: 10px 10px 0;
|
|
.content_scroll {
|
padding: 20px 0 0;
|
height: 80vh;
|
|
.scroll_item {
|
margin: 10px 0;
|
background: #FFFFFF;
|
border-radius: 5px;
|
|
&:first-child {
|
margin-top: 0;
|
}
|
|
.scroll_item_header {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
padding-right: 10px;
|
|
.item_header_state {
|
padding: 5px 20px 5px 10px;
|
color: #FFFFFF;
|
background: #24D87D;
|
border-radius: 5px 0 30px 0;
|
}
|
|
.item_header_success {
|
padding: 5px 20px 5px 10px;
|
color: #FFFFFF;
|
background: #F42829;
|
border-radius: 5px 0 30px 0;
|
}
|
|
.delete {
|
color: #F42829;
|
}
|
}
|
|
.scroll_item_content {
|
padding: 10px;
|
|
.item_content_info {
|
|
.info_title {
|
position: relative;
|
padding: 5px 0 5px 8px;
|
font-size: 18px;
|
|
&::before {
|
content: '';
|
position: absolute;
|
top: 50%;
|
left: 0;
|
transform: translateY(-50%);
|
width: 2px;
|
height: 50%;
|
background: #1976FF;
|
}
|
}
|
|
.info_content {
|
padding: 10px;
|
background: #F6F9FE;
|
|
.info_content_item {
|
display: flex;
|
align-items: center;
|
// justify-content: space-between;
|
padding: 2px;
|
|
.label {
|
color: #AFB0B1;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
.hovers {
|
opacity: .7;
|
}
|
|
.prop_delete {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
padding: 35px 30px 20px;
|
height: 100px;
|
}
|
|
::v-deep .u-navbar__content__title {
|
color: #FFFFFF;
|
}
|
|
::v-deep .u-button--small {
|
height: 36px;
|
}
|
|
::v-deep .u-input {
|
background: #FFFFFF;
|
}
|
</style>
|