<template>
|
<view class="reinforc_index">
|
<view class="reinforc_header"></view>
|
<view class="reinforc_content">
|
<view class="reinforc_content_search">
|
<view class="search_left">
|
<view @click="value = '';isQualified = '';show = true">
|
<u-input
|
v-model="value"
|
border="surround"
|
disabled
|
disabledColor="#FFFFFF"
|
placeholder="请选择质检结果"
|
></u-input>
|
</view>
|
<u-input
|
v-model="produceNumber"
|
border="surround"
|
placeholder="请输入钢筋笼编号"
|
></u-input>
|
</view>
|
<view class="search_right">
|
<u-button type="primary" size="small" text="查询" color="#1977FF" @click="searchData()"></u-button>
|
</view>
|
</view>
|
<scroll-view :scroll-top="scrollTop" refresher-enabled="true" scroll-y="true" class="reinforc_content_scroll"
|
refresher-background="#EAEAEA" @scrolltolower="scrolltoLower" :refresher-triggered="triggered"
|
@refresherrefresh="refresherrefresh">
|
<view
|
class="scroll_item"
|
v-for="(item, index) in reinforcCheckList"
|
:key="item.produceNumber">
|
<view
|
class="scroll_item_header"
|
:class="{
|
'state_success': item.isQualified === 1,
|
'state_error': item.isQualified !== 1,
|
}">
|
<text class="item_header_state">
|
{{item.isQualified === 1 ? '合格' : item.isQualified === 2 ? '不合格'
|
: item.isQualified === 3 ? '报废' : '未质检'}}
|
</text>
|
<text v-show="item.isQualified != 3" class="item_header_button" @click="changeResult(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.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.sizeName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">配筋:</text>
|
<text>{{item.reinforcementName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">块号:</text>
|
<text>{{item.blockNumName}}</text>
|
</view>
|
</view>
|
</view>
|
<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.groupName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">操作人:</text>
|
<text>{{item.opUserName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">质检人:</text>
|
<text>{{item.qualityUserName}}</text>
|
</view>
|
<view class="info_content_item">
|
<text class="label">质检时间:</text>
|
<text>{{item.qualityTime}}</text>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
</scroll-view>
|
</view>
|
<u-picker
|
:show="show"
|
:columns="columnData"
|
keyName="label"
|
closeOnClickOverlay
|
@cancel="show = false"
|
@confirm="confirmPicker"
|
@close="show = false"
|
></u-picker>
|
<u-popup :show="showPopup" mode="bottom" round="10">
|
<view class="popup_content">
|
<view class="popup_content_title">
|
请选择质检结果
|
</view>
|
<view class="popup_content_radio">
|
<u-radio-group
|
v-model="checkResult"
|
placement="column"
|
iconPlacement="right">
|
<u-radio
|
v-if="isQualified != 1"
|
:customStyle="{marginBottom: '20px'}"
|
label="合格"
|
name="1">
|
</u-radio>
|
<u-radio
|
v-if="isQualified != 2"
|
:customStyle="{marginBottom: '20px'}"
|
label="存在问题"
|
name="2">
|
</u-radio>
|
<u-radio
|
v-if="isQualified != 3"
|
:customStyle="{marginBottom: '8px'}"
|
label="报废"
|
name="3">
|
</u-radio>
|
</u-radio-group>
|
</view>
|
<view class="popup_content_button">
|
<u-button text="取消" @click="showPopup = false"></u-button>
|
<view style="width: 20px;"></view>
|
<u-button v-if="checkResult != 1" type="primary" text="下一步" @click="propIssue()"></u-button>
|
<u-button v-else type="primary" text="提交" @click="submitQualifiedData()"></u-button>
|
</view>
|
</view>
|
</u-popup>
|
<u-popup :show="showIssue" mode="bottom" round="10">
|
<view class="popup_content">
|
<view class="popup_content_title">
|
请选择存在的问题
|
</view>
|
<view class="popup_content_radio">
|
<u-checkbox-group
|
v-model="checkFaildReason"
|
placement="column">
|
<view class=""
|
v-for="item in issueData"
|
:key="item.id">
|
<view class="radio_title" :key="item.id">
|
{{item.reasonKind}}
|
</view>
|
<u-checkbox
|
:customStyle="{marginBottom: '10px'}"
|
v-for="(checkbox, index) in item.asreasoNames"
|
:key="checkbox.id"
|
:label="checkbox.name"
|
:name="checkbox.id">
|
</u-checkbox>
|
</view>
|
</u-checkbox-group>
|
<view class="radio_title">
|
其他
|
</view>
|
<u-textarea
|
v-model="remark"
|
placeholder="请输入备注"
|
border="surround">
|
</u-textarea>
|
</view>
|
<view class="popup_content_button">
|
<u-button text="取消" @click="showIssue = false"></u-button>
|
<view style="width: 20px;"></view>
|
<u-button type="primary" text="确定" @click="submitIssusData()"></u-button>
|
</view>
|
</view>
|
</u-popup>
|
<u-popup :show="showScrap" mode="bottom" round="10">
|
<view class="popup_content">
|
<view class="popup_content_title">
|
报废
|
</view>
|
<view class="popup_content_radio">
|
<view class="radio_title">
|
报废
|
</view>
|
<u-textarea
|
v-model="remarks"
|
placeholder="请输入备注"
|
border="surround">
|
</u-textarea>
|
<view style="margin-top: 20px;">
|
<u-upload
|
:fileList="fileList"
|
name="1"
|
accept="image"
|
uploadIcon="plus"
|
@afterRead="afterRead"
|
@delete="deleteImage"
|
></u-upload>
|
</view>
|
</view>
|
<view class="popup_content_button">
|
<u-button text="取消" @click="showScrap = false"></u-button>
|
<view style="width: 20px;"></view>
|
<u-button type="primary" text="确定" @click="submitScrapData()"></u-button>
|
</view>
|
</view>
|
</u-popup>
|
</view>
|
</template>
|
|
<script>
|
import { basrUrl } from '../../api/http';
|
import { throttle } from '../../plugins/public';
|
export default {
|
data() {
|
return {
|
value: '',
|
produceNumber: '',
|
scrollTop: 0,
|
triggered: true,
|
status: 'loading',
|
iconType: 'flower',
|
loadText: {
|
loading: '努力加载中',
|
nomore: '没有更多数据了'
|
},
|
show: false,
|
columnData: [[{
|
label: '合格',
|
id: 1
|
},{
|
label: '不合格',
|
id: 2
|
},{
|
label: '报废',
|
id: 3
|
}]],
|
showPopup: false, // 质检结果
|
isQualified: '', // 要修改的钢筋笼状态
|
checkResult: '',
|
showIssue: false, // 存在问题
|
showScrap: false, // 报废
|
checkFaildReason: [],
|
issueData: [],
|
remark: '',
|
pageNum: 1,
|
pageSize: 10,
|
reinforcCheckList: [],
|
loadPage: '',
|
fileList: [], // 文件列表
|
steelProduceNum: '', // 钢筋编码
|
remarks: '',
|
}
|
},
|
onReady() {
|
const that = this;
|
uni.$off('scancodedate');
|
uni.$on('scancodedate', function(data) {
|
console.log(data);
|
console.log(data.code.slice(-17));
|
that.$api.reinforc.scanCheckReinforc({
|
produceNumber: data.code.slice(-17)
|
}).then((res) => {
|
if(res.success) {
|
uni.$u.toast('扫描完成!');
|
that.searchData();
|
} else {
|
uni.$u.toast(res.statusMsg);
|
}
|
})
|
})
|
},
|
onLoad() {
|
this.searchData();
|
},
|
onUnload() {
|
// 移除监听事件
|
uni.$off('scancodedate');
|
},
|
methods: {
|
// 获取存在问题信息
|
async getReinforcDisqualification() {
|
const { data } = await this.$api.reinforc.getReinforcDisqualification();
|
this.issueData = data.map((item, index) => {
|
const list = JSON.parse(item.asreasoNames);
|
const listKey = list.map(listItem => {
|
const keys = Object.keys(listItem);
|
return {
|
id: keys[0],
|
name: listItem[keys[0]]
|
}
|
});
|
return {
|
asreasoNames: listKey,
|
reasonKind: item.reasonKind
|
}
|
});
|
},
|
// 查询钢筋笼质检信息
|
async searchReinforcCheckData() {
|
console.log(this.isQualified,'===');
|
const {data } = await this.$api.reinforc.searchReinforcCheckData ({
|
isQualified: this.isQualified,
|
produceNumber: this.produceNumber,
|
pageNum: this.pageNum,
|
pageSize: this.pageSize
|
})
|
return data;
|
},
|
// 查询
|
searchData() {
|
this.triggered = true;
|
this.reinforcCheckList = [];
|
this.searchReinforcCheckData().then((data) => {
|
this.$nextTick(() => {
|
this.reinforcCheckList = 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.searchReinforcCheckData().then((data) => {
|
this.loadPage = data.pages;
|
this.reinforcCheckList.push(...data.list);
|
this.status = 'nomore';
|
console.log(this.reinforcCheckList);
|
})
|
}
|
}, 3000),
|
// 修改质检结果
|
changeResult(item) {
|
this.showPopup = true;
|
this.steelProduceNum = item.produceNumber;
|
this.isQualified = item.isQualified;
|
},
|
// 选择质检结果
|
confirmPicker(data) {
|
if(data) {
|
this.value = data.value[0].label;
|
this.isQualified = data.value[0].id;
|
this.show = false;
|
}
|
},
|
// 打开问题原因选择
|
propIssue() {
|
this.showPopup = false;
|
if(this.checkResult == 2) {
|
this.getReinforcDisqualification();
|
this.showIssue = true;
|
} else if(this.checkResult == 3) {
|
this.showScrap = true;
|
}
|
},
|
// 提交合格
|
submitQualifiedData: throttle(function() {
|
this.$api.reinforc.submitCheckResultPass({
|
steelProduceNum: this.steelProduceNum
|
}).then((res) => {
|
this.isQualified = '';
|
uni.$u.toast('修改成功!');
|
this.showPopup = false;
|
this.searchData();
|
})
|
}, 3000),
|
// 提交不合格
|
submitIssusData: throttle(function() {
|
this.$api.reinforc.submitCheckResult({
|
checkResult: 2,
|
checkFaildReason: this.checkFaildReason.join(','),
|
remark: this.remark,
|
steelProduceNum: this.steelProduceNum
|
}).then((res) => {
|
this.isQualified = '';
|
uni.$u.toast('修改成功!');
|
this.showIssue = false;
|
this.searchData();
|
})
|
}, 3000),
|
// 提交报废
|
submitScrapData: throttle(function() {
|
this.$api.reinforc.submitCheckResult({
|
checkResult: 3,
|
checkFiles: this.fileList.map(item => {
|
return {
|
checkFile: item.data
|
}
|
}),
|
remark: this.remarks,
|
steelProduceNum: this.steelProduceNum
|
}).then((res) => {
|
this.isQualified = '';
|
uni.$u.toast('修改成功!');
|
this.showScrap = false;
|
this.searchData();
|
})
|
}, 3000),
|
// 读取图片后
|
afterRead(event) {
|
console.log(event);
|
this.fileList.push({
|
status: 'loading',
|
message: '上传中',
|
})
|
uni.uploadFile({
|
url: `${basrUrl}/file/file/upload`,
|
fileType: 'image',
|
filePath: event.file.url,
|
name: 'file',
|
success: (res) => {
|
const data = JSON.parse(res.data);
|
this.$set(this.fileList, this.fileList.length - 1, {
|
id: this.fileList.length + 1,
|
status: 'success',
|
message: '',
|
data: data.data,
|
url: `https://szpipe.thhy-tj.com/${data.data}`
|
})
|
},
|
fail: (error) => {
|
uni.$u.toast('上传失败!');
|
}
|
})
|
},
|
// 删除图片
|
deleteImage(event) {
|
this.fileList.splice(event.index, 1);
|
},
|
},
|
watch: {
|
showPopup(bol) {
|
if(!bol) {
|
this.isQualified = '';
|
this.checkResult = '';
|
}
|
},
|
showIssue(bol) {
|
if(!bol) {
|
this.isQualified = '';
|
this.checkResult = '';
|
this.steelProduceNum = '';
|
this.checkFaildReason = [];
|
this.remark = '';
|
}
|
},
|
showScrap(bol) {
|
if(!bol) {
|
this.isQualified = '';
|
this.steelProduceNum = '';
|
this.fileList = [];
|
this.remarks = '';
|
}
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.reinforc_index {
|
position: relative;
|
width: 100vw;
|
height: 100vh;
|
background: #F6F6F6;
|
|
.reinforc_header {
|
height: 16%;
|
background: #1976FF;
|
border-radius: 0 0 30% 30%;
|
}
|
|
.reinforc_content {
|
position: absolute;
|
top: 5%;
|
left: 50%;
|
transform: translateX(-50%);
|
width: 92%;
|
height: 94%;
|
// background: #FFFFFF;
|
|
.reinforc_content_search {
|
display: flex;
|
align-items: flex-end;
|
padding: 10px;
|
width: calc(100% - 20px);
|
background: #FFFFFF;
|
border-radius: 5px;
|
|
.search_left {
|
width: 80%;
|
}
|
|
.search_right {
|
margin-left: 10px;
|
width: 20%;
|
}
|
}
|
|
.reinforc_content_scroll {
|
padding: 10px 0;
|
height: calc(100% - 120px);
|
|
.scroll_item {
|
padding: 0 10px 10px 0;
|
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: 5px 0;
|
padding-left: 30px;
|
|
.item_header_state {
|
color: #FFFFFF;
|
z-index: 2;
|
}
|
|
.item_header_button {
|
color: #1976FF;
|
|
&:active {
|
opacity: .8;
|
}
|
}
|
}
|
|
.state_success {
|
position: relative;
|
|
&::before {
|
content: "";
|
position: absolute;
|
left: 0;
|
width: 35%;
|
height: 100%;
|
background: #24D87D;
|
border-radius: 5px 0 30px 0;
|
z-index: 1;
|
}
|
}
|
|
.state_error {
|
position: relative;
|
|
&::before {
|
content: "";
|
position: absolute;
|
left: 0;
|
width: 35%;
|
height: 100%;
|
background: #F42829;
|
border-radius: 5px 0 30px 0;
|
z-index: 1;
|
}
|
}
|
|
.scroll_item_content {
|
padding: 10px 0 10px 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;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
.popup_content {
|
padding: 15px;
|
|
.popup_content_title {
|
position: relative;
|
padding-left: 10px;
|
font-size: 18px;
|
|
&::before {
|
content: "";
|
position: absolute;
|
top: 50%;
|
left: 0;
|
transform: translateY(-50%);
|
width: 2px;
|
height: 60%;
|
background: #1976FF;
|
}
|
}
|
|
.popup_content_radio {
|
padding: 20px 0;
|
max-height: 450px;
|
overflow-y: auto;
|
|
.radio_title {
|
padding: 10px 0;
|
}
|
}
|
|
.popup_content_button {
|
display: flex;
|
}
|
}
|
|
::v-deep .u-input {
|
&:first-child {
|
margin-bottom: 10px;
|
}
|
}
|
|
::v-deep .u-button--small {
|
height: 36px;
|
}
|
</style>
|