You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

652 lines
18 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!-- 扫描rfid,选择缓存区根据选择的缓存区查询库位勾选是否取走托盘提交托盘变更信息 -->
<template>
<view class="page-product-receipt">
<view class="header" :style="{ backgroundColor: `rgba(250, 53, 52, ${scrollTop / 100})` }">
<view class="left">
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack({})" />
</view>
<view class="title">保养详情</view>
<view class="right"></view>
</view>
<!-- <u-tabs name="cate_name" count="cate_count" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs> -->
<view class="list">
<div class="item-name">
<div class="quest">工单号: {{ detailsinfolist.orderCode }}</div>
<div class="details">
<div>设备编码: {{ detailsinfolist.equipmentCode }}</div>
<div style="margin-left: 42px">设备名称: {{ detailsinfolist.equipmentName }}</div>
</div>
<div class="details">
<!-- <div>车间: {{ detailsinfocontent.planWorkshop }}</div> -->
<div>工作中心: {{ detailsinfolist.planWorkshop }}</div>
</div>
</div>
<view class="single-left">
<!-- <view>扫描设备码:</view> -->
<u-search style="border: 1px solid #a19d9d" placeholder="请扫描" @search="search(orderNo)" :focus="shouciFocus" v-model="orderNo" :show-action="false"></u-search>
<!-- <uni-icons type="scan" size="35" @click="scanCodeOne" style="color: #0b9eff; margin: auto; padding: 22rpx"></uni-icons> -->
</view>
<!-- <view class="item" v-show="isaccord" v-for="(item, index) in detailsinfolist.detailList" :key="index">
<div class="item1">检查项: {{ item.itemName }}</div>
<div class="item1">检查方法: {{ item.itemMethod }}</div>
<div v-for="(item1, index1) in item.standardList" :key="index1">
<div class="item1 item2" v-if="item1.standardType == 'qualitative'">
<div >检查标准: {{ item1.standardName }}</div>
<div class="select">
<u-radio-group v-model="item1.detailReach" @change="radioGroupChange(item1, item1.detailReach, index, index1)">
<u-radio @change="radioChange" v-for="(n, indexn) in listselect" :key="indexn" :name="n.type" :disabled="n.disabled">
{{ n.name }}
</u-radio>
</u-radio-group>
</div>
</div>
<div class="item1 item2" v-if="item1.standardType == 'quantify'">
<div >检查标准: {{ item1.standardName }}</div>
<div class="input-box" id="input-box1">
实际值:
<input class="input" v-model="item1.detailReach" @blur="blur(item1, item1.detailReach, index, index1)" @change="changeinput(item1)" @input="input(item1)" type="text" name="" id="" />
单位:mm
</div>
</div>
</div>
</view> -->
</view>
<u-modal v-model="isshow" class="modal" :show-cancel-button="true" title="" :show-title="true" @cancel="cancel" @confirm="confirm(detailsinfolist)">
<div class="form">
<div class="formlable">是否停机保养</div>
<u-radio-group v-model="radio" @change="radioGroupChange1(radio)">
<u-radio v-for="(item, index) in radioList" :key="index" :name="item.type" :disabled="item.disabled">
{{ item.name }}
</u-radio>
</u-radio-group>
</div>
</u-modal>
<u-toast ref="uToast" />
</view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import model from './model';
import chooseOne from '@/components/choose-one/choose-one.vue';
import jPicker from '@/components/J-Picker/jPicker.vue';
import { session } from '@/store/modules/session';
// import moment from 'moment';
//import store from '@/store';
@Component({
components: {
chooseOne,
jPicker,
},
})
export default class ChangePalletNew extends BasePage {
model = model;
list: any = [
{
cate_name: '',
},
{
cate_name: '',
},
];
current: any = 0;
shouciFocus = true;
//
detailsinfo: any = {};
detailsinfolist: any = {};
detailsinfocontent: any = {};
//
isshow = false;
inputmodal = false;
isvalue = false;
ischecked = false;
radiomodal = false;
//
isaccord = false;
//
equipmentdata: any = [];
listselect: any = [
{
type: 0,
name: '',
radiovalue: null,
},
{
type: 1,
name: '',
radiovalue: null,
},
];
// index equipment
equipmentindex: any = [];
orderNo: any = '';
location: any = '';
locationStatus: any = 1;
form: any = {};
//
action: any = 'http://www.example.com/upload';
fileList: any = [];
filesArr: any = [];
imgList: any = [];
deleteimgUrlList: any = [];
deleteimgUrlListcope: any = [];
orderNoItemList: any = {};
picturePath: any = 'https://cdn.uviewui.com/uview/swiper/1.jpg,https://cdn.uviewui.com/uview/swiper/2.jpg';
radioList: any = [
{
name: '',
disabled: false,
type: 1,
},
{
name: '',
disabled: false,
type: 0,
},
];
radio: any = null;
async onReady() {
//await this.model.getpalletLocation();
//this.remove = this.model.WlList[0];
}
//
blur(item, value, index, index1) {
console.log(item, value, index, index1);
this.radiomodal = false;
this.inputmodal = false;
if (value == null) {
this.isvalue == true;
}
if (value > item.detailUpLimit || value < item.detailDownLimit) {
this.equipmentindex = [];
this.equipmentindex.push(index);
this.equipmentindex.push(index1);
if (item.picturePath != null) {
this.imgList = JSON.parse(JSON.stringify(item.picturePath));
this.imgList = this.imgList.split(',');
} else {
this.imgList = [];
}
this.inputmodal = true;
this.isshow = true;
this.form = item;
}
}
changeinput(e) {
console.log(e);
}
input(e) {
console.log(e);
}
//单选
radioChange(e) {
console.log(e, '11111');
}
// 选中任一radio时由radio-group触发
radioGroupChange(item, value, index, index1) {
console.log(item, value, index, index1);
this.equipmentindex = [];
this.radiomodal = false;
this.inputmodal = false;
this.equipmentindex.push(index);
this.equipmentindex.push(index1);
if (item.picturePath != null) {
this.imgList = JSON.parse(JSON.stringify(item.picturePath));
this.imgList = this.imgList.split(',');
} else {
this.imgList = [];
}
if (value == 1) {
this.isshow = true;
this.radiomodal = true;
this.form = item;
}
}
radioGroupChange1(value) {
console.log(value);
}
async onLoad(options) {
let str = decodeURIComponent(options.listitem);
let orderNo = decodeURIComponent(options.equipmentCode);
if (str) {
this.detailsinfo = JSON.parse(str);
let query = {
orderCode: this.detailsinfo.orderCode,
};
await this.model.getInspectionOrderInfo(query);
this.detailsinfolist = this.model.OrderInfList;
if (orderNo != 'null') {
this.orderNo = orderNo;
console.log(orderNo, 'qqqqq');
this.search(this.orderNo);
}
}
}
created() {
this.onLoad;
}
change(index) {
this.current = index;
}
//模态框图片上传
confirm(item) {
this.linkrepairing(item);
}
async linkrepairing(item) {
console.log(item);
console.log(this.radio);
if (this.radio == null) {
(this.$refs.uToast as any).show({
title: '请选择是否停机保养',
type: 'default',
});
this.isshow = true;
return;
}
let query = {
workId: item.workId,
orderCode: item.orderCode,
shutDown: this.radio,
// workStartTime: moment().format('YYYY-MM-DD HH:mm:ss'),
};
console.log(query);
await this.model.startMaintenanceTask(query);
if (this.model.SubmitCode.code == 200) {
// (this.$refs.uToast as any).show({
// title: '成功',
// type: 'success',
// });
uni.navigateTo({
url: `/pages/equipment/Upkeep/repairing?listitem=` + encodeURIComponent(JSON.stringify(item)),
});
this.isshow = false;
} else {
(this.$refs.uToast as any).show({
title: '失败',
type: 'error',
});
}
}
cancel() {
this.isshow = false;
// if (this.detailsinfolist.detailList[this.equipmentindex[0]].standardList[this.equipmentindex[1]].picturePath == null) {
// this.imgList = [];
// } else {
// this.imgList = this.detailsinfolist.detailList[this.equipmentindex[0]].standardList[this.equipmentindex[1]].picturePath;
// this.imgList = this.imgList.split(',');
// }
}
scrollLeft() {
return 222 * (this.imgList.length + 1);
}
showScreenImg(i) {
let list = this.imgList;
uni.previewImage({
current: i,
urls: list,
// loop: true
});
}
chooseImg() {
uni.chooseImage({
count: 9, //默认9
// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'],
success: (res) => {
// uni.showLoading();
//console.log('/////',res);
let tempFilePaths: any = res.tempFilePaths;
// (this.$refs.uToast as any).show({
// title: '成功',
// type: 'success',
// });
// uni.navigateBack({});
// } else {
// (this.$refs.uToast as any).show({
// title: '失败',
// type: 'error',
// });
tempFilePaths.map((item) => {
uni.uploadFile({
url: 'http://192.168.202.20:9000/prod-api/file/upload',
// url: '/dev-api/file/upload',
fileType: 'image',
filePath: item,
header: {
Authorization: 'Bearer ' + session.user?.access_token,
// 'cosmo-env-sitecode': this.$store.state.siteCode
},
name: 'file',
// formData: {
// materialCode: this.materialObj.materialCode,
// },
success: (res) => {
uni.hideLoading();
if (!res.data) {
// this.$refs.toastRef.show({
// type:"error",
// text:res.msg
// })
return;
}
let data = JSON.parse(res.data);
this.imgList = [...this.imgList, data.data.url];
//this.imgListName = [...this.imgListName,data.fileName];
//this.picUrls = this.imgList.join(",");
//this.picNames = this.imgListName.join(",");
uni.hideLoading();
},
fail: (err) => {
console.log(err);
// this.$refs.toastRef.show({
// type:"error",
// text:"上传失败!"
// })
uni.hideLoading();
},
});
});
},
});
}
deleteImg(index) {
this.imgList = JSON.parse(JSON.stringify(this.detailsinfolist.detailList[this.equipmentindex[0]].standardList[this.equipmentindex[1]].picturePath));
this.imgList = this.imgList.split(',');
this.imgList.splice(index, 1);
}
scanCodeOne() {
uni.scanCode({
scanType: ['barCode'],
success: (res) => {
this.orderNo = res.result;
},
fail(result) {
this.customToast(result);
},
});
}
async onSubmit() {
if (this.orderNo == '' || this.orderNo.length == 0) {
this.customToast('请扫码设备编码');
return;
}
if (this.isvalue) {
this.customToast('检查标准不能为空');
return;
}
// this.detailsinfocontent.equ = this.detailsinfolist;
// let query = this.detailsinfocontent;
// await this.model.updateInspectionRecord(query);
// if (this.model.SubmitCode == '200') {
// (this.$refs.uToast as any).show({
// title: '成功',
// type: 'success',
// });
// uni.navigateBack({});
// } else {
// (this.$refs.uToast as any).show({
// title: '失败',
// type: 'error',
// });
// }
}
search(value) {
console.log(value);
if (value == this.detailsinfolist.equipmentCode) {
this.isshow = true;
} else {
(this.$refs.uToast as any).show({
title: '失败请扫码正确条码',
type: 'default',
});
}
}
}
</script>
<style lang="scss" scoped>
.page-product-receipt {
background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #f8262c 51%, #d9001b 100%) no-repeat;
background-size: 100% 600rpx;
padding: 118rpx 30rpx 162rpx;
min-height: 100%;
.header {
position: fixed;
top: 0rpx;
left: 0;
right: 0;
z-index: 99;
display: flex;
height: 120rpx;
line-height: 88rpx;
color: #fff;
font-size: 34rpx;
font-weight: 500;
text-align: center;
padding: 45rpx 0rpx 0rpx;
.title {
flex: 3;
}
.left,
.right {
flex: 1;
}
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 88rpx;
height: 88rpx;
}
}
.list {
margin-top: 15px;
width: 367px;
border-radius: 5px;
border: rgba(121, 121, 121, 1) solid 1px;
background-color: #ffffff;
padding: 7px 8px 7px 12px;
box-sizing: border-box;
.item-name {
.quest {
// width: 367px;
// border-radius: 5px;
// border: rgba(121, 121, 121, 1) solid 1px;
// background-color: #ffffff;
padding: 7px 8px 7px 12px;
box-sizing: border-box;
text-align: center;
font-size: 18px;
font-weight: 600;
color: black;
}
.details {
display: flex;
font-size: 16px;
font-weight: 600;
// justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
}
.single-left {
display: flex;
// align-items: center;
// justify-content: space-around;
text-align: center;
margin-top: 12px;
margin-bottom: 20px;
border: 1px solid #eee;
}
.item {
margin-top: 15px;
width: 344px;
border-radius: 5px;
border: rgba(121, 121, 121, 1) solid 1px;
background-color: #ffffff;
padding: 7px 8px 7px 8px;
box-sizing: border-box;
.item1 {
margin-bottom: 3px;
white-space: 1px;
font-size: 15px;
font-weight: 600;
}
.item2 {
display: flex;
align-content: center;
justify-content: space-between;
.select {
font-size: 15px;
font-weight: 400;
display: flex;
// margin-left: 19px;
}
.input-box {
font-size: 13px;
font-weight: 400;
display: flex;
align-content: center;
margin-top: 2px;
.input {
font-size: 12px;
width: 65px;
padding: 1px 8px;
height: 20px;
box-sizing: border-box;
border: 1px solid #b6b6b6;
margin-left: 6px;
display: inline-block;
margin-right: 6px;
border-radius: 4px;
position: relative;
}
}
}
}
}
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 99;
background: #ffffff;
box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
padding: 20rpx;
}
.modal {
.upload-name {
padding: 10px 20px;
.name {
font-size: 17px;
font-weight: 600;
}
}
.photoList {
display: flex;
padding-top: 12rpx;
.chooseBtn {
width: 202rpx;
height: 202rpx;
background: #fafafa;
border-radius: 12rpx;
border: 2rpx dashed #e2e2e2;
display: flex;
justify-content: center;
align-items: center;
.inner {
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.desc {
font-size: 28rpx;
font-weight: 400;
color: #24252a;
line-height: 40rpx;
}
.img {
width: 50rpx;
height: 50rpx;
margin-bottom: 6rpx;
}
}
.photoBox {
width: 202rpx;
height: 202rpx;
background: #fafafa;
border-radius: 12rpx;
position: relative;
.closeBtn {
position: absolute;
top: -12rpx;
right: -12rpx;
z-index: 2;
width: 36rpx;
height: 36rpx;
.img {
width: 36rpx;
height: 36rpx;
}
}
.img {
width: 202rpx;
height: 202rpx;
border-radius: 12rpx;
}
}
.itemBox {
flex: 0 0 202rpx;
margin-right: 20rpx;
&:last-child {
margin-right: 0;
}
}
}
}
::v-deep .yjy-switch-container .yjy-switch-item {
width: 100%;
}
::v-deep .yjy-switch-container {
width: 50%;
}
::v-deep .u-radio__label {
font-size: 13px;
}
::v-deep #input-box1 .u-input__input {
width: 50px;
max-height: 15px;
font-size: 13px;
}
.form {
margin-top: 10px;
margin-bottom: 10px;
font-weight: 600;
display: flex;
align-items: center;
justify-content: space-around;
}
}
</style>