|
@ -1,11 +1,68 @@ |
|
|
<template> |
|
|
<template> |
|
|
<!-- 添加维修工单 --> |
|
|
<!-- 添加维修工单 --> |
|
|
<view class="add-form-container"> |
|
|
<view class="add-form-container"> |
|
|
<u-form :model="form" ref="form1" label-width="160rpx"> |
|
|
<!-- <u-form :model="form" ref="form1" label-width="160rpx"> |
|
|
<u-form-item :label="`备件`" prop="itemNumber" required> |
|
|
<u-form-item label="申请主题" prop="name" required> |
|
|
<view class="select" @click="openSingleColumn('itemNumber',form.itemNumber,sparePartsList)"> |
|
|
<u-input v-model="form.name" placeholder="请输入申请主题" /> |
|
|
<view class="input" v-if='form.itemNumber'> |
|
|
</u-form-item> |
|
|
{{selectFormat(form.itemNumber,sparePartsList)}} |
|
|
</u-form> --> |
|
|
|
|
|
<view class="list"> |
|
|
|
|
|
<view class="title"> |
|
|
|
|
|
<span>*</span>申请备件 |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index"> |
|
|
|
|
|
<view class="item-box"> |
|
|
|
|
|
<view class="spare-title"> |
|
|
|
|
|
<view class="title-txt"> |
|
|
|
|
|
{{item.name}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<u-row gutter="16"> |
|
|
|
|
|
<u-col :span="24"> |
|
|
|
|
|
<view class="dec"> |
|
|
|
|
|
库位:{{item.locationNumber}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</u-col> |
|
|
|
|
|
<u-col :span="24"> |
|
|
|
|
|
<view class="dec"> |
|
|
|
|
|
数量:{{item.qty}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</u-col> |
|
|
|
|
|
<u-col :span="24"> |
|
|
|
|
|
<view class="dec"> |
|
|
|
|
|
维修结果:{{item.result == 'YES'?'完成':'未完成'}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</u-col> |
|
|
|
|
|
<u-col :span="24"> |
|
|
|
|
|
<view class="dec"> |
|
|
|
|
|
维修原因:{{item.reasons}} |
|
|
|
|
|
</view> |
|
|
|
|
|
</u-col> |
|
|
|
|
|
</u-row> |
|
|
|
|
|
</view> |
|
|
|
|
|
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="add-btn"> |
|
|
|
|
|
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff" |
|
|
|
|
|
size="36"></u-icon>添加备件</u-button> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="footer"> |
|
|
|
|
|
<view class="btns"> |
|
|
|
|
|
<button class="reset" @click="reset">重置</button> |
|
|
|
|
|
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<!-- 添加备件 --> |
|
|
|
|
|
<u-popup v-model="isPopupShow" mode="center" border-radius="14"> |
|
|
|
|
|
<view class="popup-title">添加备件</view> |
|
|
|
|
|
<view class="popup"> |
|
|
|
|
|
<u-form :model="form1" ref="form1" label-width="200rpx"> |
|
|
|
|
|
<u-form-item :label="`备件`" prop="itemNumber" required> |
|
|
|
|
|
<view class="select" @click="openSingleColumn('itemNumber',form1.itemNumber,sparePartsList)"> |
|
|
|
|
|
<view class="input" v-if='form1.itemNumber'> |
|
|
|
|
|
{{selectFormat(form1.itemNumber,sparePartsList)}} |
|
|
</view> |
|
|
</view> |
|
|
<view class="placeholder" v-else> |
|
|
<view class="placeholder" v-else> |
|
|
请选择备件 |
|
|
请选择备件 |
|
@ -14,30 +71,29 @@ |
|
|
</view> |
|
|
</view> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="库位" prop="locationNumber" required v-if="isShow"> |
|
|
<u-form-item label="库位" prop="locationNumber" required v-if="isShow"> |
|
|
<u-input v-model="form.locationNumber" placeholder="请选择库位" @blur="blur"/> |
|
|
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur"/> |
|
|
<view class="right-button" @click="chickRightButton"> |
|
|
<view class="right-button" @click="chickRightButton"> |
|
|
扫描 |
|
|
扫描 |
|
|
</view> |
|
|
</view> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="数量" prop="qty" required> |
|
|
<u-form-item label="数量" prop="qty" required> |
|
|
<u-input v-model="form.qty" type="number" placeholder="请输入数量" /> |
|
|
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" /> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="维修结果" prop="reasons" required> |
|
|
<u-form-item label="维修结果" prop="reasons" required> |
|
|
<u-radio-group v-model="form.result"> |
|
|
<u-radio-group v-model="form1.result"> |
|
|
<u-radio :name="item.value" v-for="(item,index) in result" :key="index">{{item.label}}</u-radio> |
|
|
<u-radio :name="item.value" v-for="(item,index) in result" :key="index">{{item.label}}</u-radio> |
|
|
</u-radio-group> |
|
|
</u-radio-group> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
<u-form-item label="维修原因" prop="reasons" required> |
|
|
<u-form-item label="维修原因" prop="reasons" required> |
|
|
<u-input v-model="form.reasons" placeholder="请输入维修原因" /> |
|
|
<u-input v-model="form1.reasons" placeholder="请输入维修原因" /> |
|
|
</u-form-item> |
|
|
</u-form-item> |
|
|
</u-form> |
|
|
</u-form> |
|
|
<view class="footer"> |
|
|
|
|
|
<view class="btns"> |
|
|
|
|
|
<button class="reset" @click="reset">重置</button> |
|
|
|
|
|
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button> |
|
|
|
|
|
</view> |
|
|
</view> |
|
|
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view> |
|
|
<view class="popup-footer"> |
|
|
</view> |
|
|
<view @click="isPopupShow = false">取消</view> |
|
|
|
|
|
<view class="sure" @click="addSpare">确认</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</u-popup> |
|
|
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' |
|
|
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' |
|
|
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select> |
|
|
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select> |
|
|
</view> |
|
|
</view> |
|
@ -48,14 +104,25 @@ |
|
|
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js" |
|
|
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js" |
|
|
import * as dictApi from "@/api/dict.js" |
|
|
import * as dictApi from "@/api/dict.js" |
|
|
import * as locationApi from "@/api/location.js" |
|
|
import * as locationApi from "@/api/location.js" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
loading: false, |
|
|
loading: false, |
|
|
type: "", |
|
|
type: "", |
|
|
|
|
|
// 备件弹窗 |
|
|
|
|
|
isPopupShow: false, |
|
|
|
|
|
sparePartsList: [], |
|
|
|
|
|
// 下拉框字段 |
|
|
|
|
|
singleColumnShow: false, |
|
|
|
|
|
singleColumnDefaultValue: [], |
|
|
|
|
|
singleColumnList: [], |
|
|
|
|
|
field: '', |
|
|
form: { |
|
|
form: { |
|
|
|
|
|
itemNumbers:[] |
|
|
|
|
|
}, |
|
|
|
|
|
form1: { |
|
|
itemNumber: "", |
|
|
itemNumber: "", |
|
|
qty: '', |
|
|
qty: '', |
|
|
result: 'YES', |
|
|
result: 'YES', |
|
@ -63,11 +130,6 @@ |
|
|
locationNumber:'', |
|
|
locationNumber:'', |
|
|
areaNumber:'' |
|
|
areaNumber:'' |
|
|
}, |
|
|
}, |
|
|
sparePartsList: [], |
|
|
|
|
|
singleColumnShow: false, |
|
|
|
|
|
singleColumnDefaultValue: [], |
|
|
|
|
|
singleColumnList: [], |
|
|
|
|
|
field: '', |
|
|
|
|
|
result: [], |
|
|
result: [], |
|
|
isShow:false |
|
|
isShow:false |
|
|
} |
|
|
} |
|
@ -76,30 +138,10 @@ |
|
|
// 触发提交表单 |
|
|
// 触发提交表单 |
|
|
submit() { |
|
|
submit() { |
|
|
// 校验 |
|
|
// 校验 |
|
|
if (!this.form.itemNumber) { |
|
|
if (this.form.itemNumbers == 0) { |
|
|
this.$modal.showToast('请选择备件') |
|
|
this.$modal.showToast('请选择备件') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (this.isInAccount == 'TRUE') { |
|
|
|
|
|
this.$modal.showToast('该库位属于帐内库,请选择帐外库') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.itemNumber) { |
|
|
|
|
|
this.$modal.showToast('该库位已绑定过备件') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form.qty) { |
|
|
|
|
|
this.$modal.showToast(`请输入数量`) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form.result) { |
|
|
|
|
|
this.$modal.showToast('请选择维修结果') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form.reasons) { |
|
|
|
|
|
this.$modal.showToast('请输入维修原因') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
this.$modal.confirm('是否添加备件维修工单').then(() => { |
|
|
this.$modal.confirm('是否添加备件维修工单').then(() => { |
|
|
this.$modal.loading('加载中') |
|
|
this.$modal.loading('加载中') |
|
|
this.loading = true |
|
|
this.loading = true |
|
@ -124,12 +166,8 @@ |
|
|
}, |
|
|
}, |
|
|
// 重置 |
|
|
// 重置 |
|
|
reset() { |
|
|
reset() { |
|
|
if (this.form.id) { |
|
|
this.form = { |
|
|
this.form.classes = ''; |
|
|
itemNumbers:[] |
|
|
this.form.faultType = '' |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
this.form = {} |
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
// |
|
|
// |
|
@ -155,14 +193,16 @@ |
|
|
}, |
|
|
}, |
|
|
// 单列模式点击确定之后 |
|
|
// 单列模式点击确定之后 |
|
|
chooseSingleColumn(e) { |
|
|
chooseSingleColumn(e) { |
|
|
console.log(this.field) |
|
|
this.form1[this.field] = e[0].value |
|
|
this.form[this.field] = e[0].value |
|
|
|
|
|
if (this.field == 'itemNumber') { |
|
|
if (this.field == 'itemNumber') { |
|
|
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value) |
|
|
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value) |
|
|
this.form.locationNumber = this.choosesingleColumnItem[0].locationNumber |
|
|
console.log( this.choosesingleColumnItem[0]) |
|
|
this.form.areaNumber = this.choosesingleColumnItem[0].areaNumber |
|
|
this.form1.locationNumber = this.choosesingleColumnItem[0].locationNumber |
|
|
|
|
|
this.form1.areaNumber = this.choosesingleColumnItem[0].areaNumber |
|
|
if(!this.choosesingleColumnItem[0].locationNumber){ |
|
|
if(!this.choosesingleColumnItem[0].locationNumber){ |
|
|
this.isShow = true |
|
|
this.isShow = true |
|
|
|
|
|
}else{ |
|
|
|
|
|
this.isShow = false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
this.singleColumnShow = false |
|
|
this.singleColumnShow = false |
|
@ -194,16 +234,77 @@ |
|
|
this.$modal.showToast('找不到该库位') |
|
|
this.$modal.showToast('找不到该库位') |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
this.form.areaNumber = res.data.areaNumber; |
|
|
this.form1.areaNumber = res.data.areaNumber; |
|
|
this.isInAccount = res.data.isInAccount |
|
|
this.isInAccount = res.data.isInAccount |
|
|
this.itemNumber = res.data.itemNumber |
|
|
this.itemNumber = res.data.itemNumber |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
blur() { |
|
|
blur() { |
|
|
if (this.form.locationNumber) { |
|
|
if (this.form1.locationNumber) { |
|
|
this.getLocation() |
|
|
this.getLocation() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
// 打开弹窗 |
|
|
|
|
|
open() { |
|
|
|
|
|
this.form1 = { |
|
|
|
|
|
itemNumber: "", |
|
|
|
|
|
qty: '', |
|
|
|
|
|
result: 'YES', |
|
|
|
|
|
reasons: '', |
|
|
|
|
|
locationNumber:'', |
|
|
|
|
|
areaNumber:'' |
|
|
|
|
|
} |
|
|
|
|
|
this.isPopupShow = true |
|
|
|
|
|
}, |
|
|
|
|
|
// 添加配件 |
|
|
|
|
|
addSpare() { |
|
|
|
|
|
// 校验 |
|
|
|
|
|
if (!this.form1.itemNumber) { |
|
|
|
|
|
this.$modal.showToast('请选择备件') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
console.log(this.form1) |
|
|
|
|
|
if (!this.form1.locationNumber) { |
|
|
|
|
|
this.$modal.showToast('请扫描库位') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.isInAccount == 'TRUE') { |
|
|
|
|
|
this.$modal.showToast('该库位属于帐内库,请选择帐外库') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.itemNumber) { |
|
|
|
|
|
this.$modal.showToast('该库位已绑定过备件') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form1.qty) { |
|
|
|
|
|
this.$modal.showToast(`请输入数量`) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form1.result) { |
|
|
|
|
|
this.$modal.showToast('请选择维修结果') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (!this.form1.reasons) { |
|
|
|
|
|
this.$modal.showToast('请输入维修原因') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
this.form1.name = this.selectFormat(this.form1.itemNumber, this.sparePartsList) |
|
|
|
|
|
if (this.form.itemNumbers && this.form.itemNumbers.length > 0) { |
|
|
|
|
|
let arr = this.form.itemNumbers.filter(item => item.itemNumber == this.form1.itemNumber) |
|
|
|
|
|
if (arr && arr.length > 0) { |
|
|
|
|
|
this.$modal.showToast('该备件已添加') |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.form.itemNumbers.push(this.form1) |
|
|
|
|
|
this.isPopupShow = false |
|
|
|
|
|
}, |
|
|
|
|
|
// 删除备件 |
|
|
|
|
|
delSpareParts(index) { |
|
|
|
|
|
this.form.itemNumbers.splice(index, 1) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
async onLoad(option) { |
|
|
async onLoad(option) { |
|
|
if (option.type) this.type = option.type; |
|
|
if (option.type) this.type = option.type; |
|
@ -217,42 +318,15 @@ |
|
|
.add-form-container { |
|
|
.add-form-container { |
|
|
min-height: calc(100vh - 140rpx); |
|
|
min-height: calc(100vh - 140rpx); |
|
|
background: white; |
|
|
background: white; |
|
|
padding: 0px 30rpx 140rpx; |
|
|
padding: 0px 0rpx 140rpx; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.list { |
|
|
.u-form-item { |
|
|
padding-bottom: 20rpx; |
|
|
padding: 20rpx 30rpx; |
|
|
|
|
|
} |
|
|
.item { |
|
|
|
|
|
margin-top: 20rpx; |
|
|
|
|
|
background: white; |
|
|
|
|
|
padding: 30rpx; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
|
|
|
|
image { |
|
|
|
|
|
width: 160rpx; |
|
|
|
|
|
height: 160rpx; |
|
|
|
|
|
margin-right: 20rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.title { |
|
|
|
|
|
font-size: 32rpx; |
|
|
|
|
|
font-weight: bold; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.dec1 { |
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
margin-top: 16rpx; |
|
|
|
|
|
color: #acacac; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.dec2 { |
|
|
.disabled { |
|
|
font-size: 28rpx; |
|
|
background: #f5f5f5; |
|
|
margin-top: 6rpx; |
|
|
|
|
|
color: #acacac; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.footer { |
|
|
.footer { |
|
@ -260,6 +334,7 @@ |
|
|
bottom: 0px; |
|
|
bottom: 0px; |
|
|
left: 0px; |
|
|
left: 0px; |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
|
|
|
z-index: 22; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.btns { |
|
|
.btns { |
|
@ -319,4 +394,87 @@ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.title { |
|
|
|
|
|
padding: 32rpx 0rpx; |
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
|
|
|
|
span { |
|
|
|
|
|
position: absolute; |
|
|
|
|
|
left: -16rpx; |
|
|
|
|
|
color: #fa3534; |
|
|
|
|
|
top: 19px; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.list { |
|
|
|
|
|
padding: 0rpx 30rpx; |
|
|
|
|
|
.item { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
|
|
|
|
|
|
|
.item-box { |
|
|
|
|
|
background: #F5F5F5; |
|
|
|
|
|
border-radius: 12rpx; |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
width: 0rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.spare-title { |
|
|
|
|
|
padding: 20rpx 30rpx; |
|
|
|
|
|
border-bottom: 1px solid #e4e4e4; |
|
|
|
|
|
|
|
|
|
|
|
.title-txt { |
|
|
|
|
|
color: #409eff; |
|
|
|
|
|
font-size: 30rpx; |
|
|
|
|
|
font-weight: bold; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.dec { |
|
|
|
|
|
color: #9c9c9c; |
|
|
|
|
|
padding: 20rpx 30rpx 20rpx; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.add-btn { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
justify-content: flex-start; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.popup-title { |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
font-size: 32rpx; |
|
|
|
|
|
font-weight: bold; |
|
|
|
|
|
color: #409eff; |
|
|
|
|
|
padding: 30rpx 30rpx 0px |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.popup { |
|
|
|
|
|
width: 600rpx; |
|
|
|
|
|
padding: 30rpx 0rpx 30rpx; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.popup-footer { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
border-top: 1px solid #e4e4e4; |
|
|
|
|
|
|
|
|
|
|
|
view { |
|
|
|
|
|
line-height: 100rpx; |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
|
|
|
|
&.sure { |
|
|
|
|
|
color: #409eff; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
::v-deep .u-checkbox-group { |
|
|
|
|
|
display: grid !important; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |