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.

597 lines
16 KiB
Vue

<!-- 扫描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-form class="form" ref="form" label-width="180rpx">
<!-- 单号 -->
<view class="single">
<view class="single-left">
<view style="width: 42px">条码:</view>
<u-search placeholder="请扫描" :focus="shouciFocus" v-model="orderNo" :show-action="false" @search="query"></u-search>
</view>
<view class="single-right">
<u-button type="primary" @click="query"></u-button>
</view>
<view class="single-right">
<u-button type="primary" @click="selscteq()"></u-button>
</view>
</view>
</u-form>
<view class="list listbottom" v-show="isaccord">
<div class="item-name">
<!-- <div class="quest">工单号: </div> -->
<div class="details">
<div>设备编码:{{ formdata.equipmentCode }}</div>
</div>
<div class="details">
<div>设备名称:{{ formdata.equipmentName }}</div>
</div>
<div class="details">
<div>位置:{{ formdata.equipmentLocation }}</div>
<!-- <div style="margin-left: 42px">工作中心: </div> -->
</div>
<u-form class="form listform" ref="form" label-width="140rpx">
<!-- 机台 -->
<!-- <u-form-item label="联系方式:">
2 years ago
<u-input v-model="formdata.orderConnection" placeholder="" type="text" />
</u-form-item> -->
<u-form-item label="故障描述:">
<jPicker sureColor="#ff0000" :moren="moren" @bindpicker="selectProductlocCode" showKey="label" valKey="value" :val="orderDesc.value" :options="model.locList" />
</u-form-item>
<!-- 机台 -->
<u-form-item class="listbottom1" label="故障时间:">
<u-input @click="blur()" type="select" v-model="orderBreakdownTime" />
<u-picker mode="time" :default-time="defaulttime" :params="params" v-model="showtime" @confirm="timeConfirm" :timeEnd="endTime"></u-picker>
</u-form-item>
<u-form-item label="上传图片:">
<scroll-view class="scroll-view_H" scroll-x="true" :scroll-left="scrollLeft()">
<view class="photoList photoList1">
<view class="itemBox photoBox" v-for="(img, index) in imgList" :key="index">
<view class="closeBtn" @click="deleteImg(index)">
<image class="img" src="../../../static/images/iconCloseGray.svg" mode="scaleToFill"></image>
</view>
<image class="img" :src="img" mode="aspectFit" @click="showScreenImg(index)"></image>
</view>
<view class="itemBox chooseBtn" @click="chooseImg">
<view class="inner">
<image class="img" src="../../../static/images/upload-pic-icon.svg" mode="scaleToFill"></image>
<text class="desc">添加照片</text>
</view>
</view>
</view>
</scroll-view>
</u-form-item>
</u-form>
</div>
</view>
<view class="bottom-bar">
<u-row class="button-bar">
<!-- 确定 -->
<u-col :span="6">
<u-button @click="onsubmit" type="primary">提交</u-button>
</u-col>
<!-- 返回 -->
<u-col :span="6">
<u-button type="error" @click="uni.navigateBack({})"></u-button>
</u-col>
</u-row>
</view>
<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 {
params: any = { year: true, month: true, day: true, hour: true, minute: true, second: true };
endTime: any = {};
model = model;
moren = '选择故障描述';
shouciFocus = true;
zaiciFocus = false;
switchListText = [
{
title: '是',
value: 0,
},
{
title: '否',
value: 1,
},
];
orderNoItemList: any = {};
productCodeList: any = {};
productCodelocList: any = {};
// remove: any = {};
// selectItem(e: any) {
// this.remove = e.pickerName;
// }
orderNo: any = '';
location: any = '';
locationStatus: any = 1;
// 照片
action: any = 'http://www.example.com/upload';
fileList: any = [];
filesArr: any = [];
imgList: any = [];
imgUrlList: any = [];
deleteimgUrlList: any = [];
deleteimgUrlListcope: any = [];
picturePath: any = 'https://cdn.uviewui.com/uview/swiper/1.jpg,https://cdn.uviewui.com/uview/swiper/2.jpg';
formdata: any = {
equipmentCode: '',
equipmentName: '',
equipmentLocation: '',
orderDesc: '',
orderBreakdownTime: '',
fileList: '',
2 years ago
orderRepairman: '',
};
orderBreakdownTime: any = '';
isaccord = false;
showtime = false;
defaulttime: any = '';
orderDesc: any = {};
async onReady() {
this.defaulttime = moment().format('YYYY-MM-DD HH:mm:ss');
console.log(this.defaulttime);
// await this.model.getDictList();
await this.model.getFaultDescriptionList();
//this.remove = this.model.WlList[0];
}
onShow() {
if (this.model.rowdata.length == 0) {
this.model.rowdatanull();
} else {
this.orderNo = '';
this.orderNo = this.model.rowdata[0].equipmentCode;
}
}
async query() {
this.formdata = {};
this.imgList = [];
this.orderDesc = {};
if (this.orderNo == '' || this.orderNo.length == 0) {
(this.$refs.uToast as any).show({
title: '请扫码条码',
type: 'default',
});
return;
}
await this.model.queryOrderNo(this.orderNo);
//console.log('???',model.orderNoItemList)
if (model.orderNoItemList == undefined) {
this.isaccord = false;
(this.$refs.uToast as any).show({
title: '该条码未查到数据,请使用正确的条码!',
type: 'default',
});
} else {
if (this.orderNoItemList.productCode == 'EmptyPallet') {
this.isaccord = false;
(this.$refs.uToast as any).show({
title: '该条码未查到数据,请使用正确的条码!',
type: 'default',
});
return;
} else {
this.orderNoItemList = model.orderNoItemList;
this.formdata = this.orderNoItemList;
this.isaccord = true;
}
}
//console.log('this.orderNoItemList', this.orderNoItemList);
}
selscteq() {
uni.navigateTo({
url: `/pages/equipment/equipmentlist?listitem=`,
});
}
generateGUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (Math.random() * 16) | 0,
v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
async selectProductlocCode(e: any) {
this.orderDesc = e.pickerName;
// await this.model.getpalletDestination(params);
}
timeConfirm(e) {
this.orderBreakdownTime = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + e.month;
this.formdata.orderBreakdownTime = this.orderBreakdownTime;
console.log(e, this.formdata.orderBreakdownTime);
}
async onsubmit() {
if (this.orderNo == '' || this.orderNo.length == 0) {
(this.$refs.uToast as any).show({
title: '请扫码设备条码',
type: 'default',
});
return;
}
if (this.formdata.orderBreakdownTime == '' || this.formdata.orderBreakdownTime == undefined) {
(this.$refs.uToast as any).show({
title: '请输入故障时间',
type: 'default',
});
return;
}
if (this.orderDesc.value == '' || this.orderDesc.value == undefined) {
(this.$refs.uToast as any).show({
title: '故障描述不能为空',
type: 'default',
});
return;
}
// 获取年份、月份、日期、小时、分钟和秒
let fileList = this.imgList.join(',');
let params = {
equipmentCode: this.formdata.equipmentCode,
equipmentName: this.formdata.equipmentName,
equipmentLocation: this.formdata.equipmentLocation,
orderDesc: this.orderDesc.value,
orderBreakdownTime: this.formdata.orderBreakdownTime,
fileList: fileList,
orderSource: '手持PDA',
2 years ago
orderRepairman: '',
//productionState: this.productCodeList.value,
};
console.log(params, this.formdata, this.imgUrlList);
await this.model.addRepairRecord(params);
if (model.SubmitCode.code == 200) {
(this.$refs.uToast as any).show({
title: model.SubmitCode.msg, //错误信息展示
type: 'default',
});
// this.model.getDictList();
this.isaccord = false;
this.Clear(); //清除数据
} else {
(this.$refs.uToast as any).show({
title: model.SubmitCode.msg, //错误信息展示
type: 'default',
});
}
}
blur() {
console.log(1);
this.showtime = true;
}
focus() {
console.log(2);
this.showtime = true;
}
Clear() {
this.orderNo = '';
this.formdata = {};
this.imgList = [];
this.orderDesc = {};
// this.shouciFocus = false;
this.model.empty();
// this.$nextTick(() => {
// this.shouciFocus = true;
// });
}
switchChangeFun(e) {
//console.log(e);
this.locationStatus = e.swithcSelectItem.value;
}
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;
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) => {
console.log(res);
uni.hideLoading();
if (!res.data) {
// this.$refs.toastRef.show({
// type:"error",
// text:"上传失败!"
// })
return;
}
let data = JSON.parse(res.data);
console.log('123dddd', data);
this.imgList = [...this.imgList, data.data.url];
//this.imgListName = [...this.imgListName,data.fileName];
// this.imgUrlList = [...this.imgUrlList, imgUrlList[index]];
//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.imgUrlList.splice(index, 1);
}
}
</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;
}
}
.form {
background-color: #fff;
padding: 40rpx;
padding-right: 10px;
border-radius: 15px 15px 15px 15px;
.u-form-item {
padding: 30rpx 0;
line-height: 35rpx;
}
.single {
width: 100%;
height: 100rpx;
display: flex;
.single-left {
width: 80%;
height: 100%;
display: flex;
view {
width: 142rpx;
height: 100%;
line-height: 100rpx;
}
}
.single-right {
button {
margin-top: 15rpx;
width: 25px;
height: 70rpx;
background-color: #fa3534;
font-size: 12px;
}
button:first-child {
margin-left: 3px;
}
}
}
.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;
}
}
}
}
.listform {
padding: 0px;
}
.list {
background-color: #ffffff;
padding: 21px;
box-sizing: border-box;
margin-top: 10px;
border-radius: 15px 15px 15px 15px;
border: rgba(121, 121, 121, 1) solid 1px;
.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;
}
}
}
.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;
}
::v-deep .yjy-switch-container .yjy-switch-item {
width: 100%;
}
::v-deep .yjy-switch-container {
width: 50%;
}
.listbottom ::v-deep .uni-input-input {
width: 94%;
padding: 5px;
}
.listbottom1 ::v-deep .uni-input-input {
border: 1px solid black;
width: 94%;
padding: 5px;
}
::v-deep .u-form-item {
padding: 6px 0;
}
::v-deep .uni-textarea-textarea {
border: 1px solid black;
width: 94%;
padding: 5px;
}
.photoList1 {
width: 220px;
overflow-y: scroll;
border: 1px solid black;
}
}
</style>