zhang_li
9 months ago
25 changed files with 2190 additions and 348 deletions
@ -0,0 +1,24 @@ |
|||
import request from '@/utils/request' |
|||
// 获取采购订单分页列表
|
|||
export function getInLocationPage(params) { |
|||
return request({ |
|||
url: '/eam/item-order-main/getPdaPage', |
|||
'method': 'GET', |
|||
params |
|||
}) |
|||
} |
|||
// 获取采购订单分页列表
|
|||
export function getInLocationDetail(id) { |
|||
return request({ |
|||
url: '/eam/item-order-main/getPdaDetailsById?id='+id, |
|||
'method': 'GET', |
|||
}) |
|||
} |
|||
// 入库新增
|
|||
export function inLocationCreat(data) { |
|||
return request({ |
|||
url: '/eam/item-order-main/inOperation', |
|||
'method': 'POST', |
|||
data |
|||
}) |
|||
} |
@ -0,0 +1,16 @@ |
|||
import request from '@/utils/request' |
|||
// 获取库位
|
|||
export function getLocation(number) { |
|||
return request({ |
|||
url: '/eam/location/scanCodeByNumber?number='+number, |
|||
'method': 'GET', |
|||
}) |
|||
} |
|||
// 出库获取库位
|
|||
export function getOutLocation(params) { |
|||
return request({ |
|||
url: '/eam/location/outScanCodeByNumber', |
|||
'method': 'GET', |
|||
params |
|||
}) |
|||
} |
@ -0,0 +1,25 @@ |
|||
import request from '@/utils/request' |
|||
// 获取领用出库分页列表
|
|||
export function getOutLocationPage(params) { |
|||
return request({ |
|||
url: '/eam/item-apply-main/getAppOutOperaPage', |
|||
'method': 'GET', |
|||
params |
|||
}) |
|||
} |
|||
// 获取领用出库详情
|
|||
export function getOutLocationDetail(params) { |
|||
return request({ |
|||
url: '/eam/item-apply-main/appGetByNumber', |
|||
'method': 'GET', |
|||
params |
|||
}) |
|||
} |
|||
// 出库新增
|
|||
export function outLocationCreat(data) { |
|||
return request({ |
|||
url: '/eam/item-apply-main/outOperation', |
|||
'method': 'POST', |
|||
data |
|||
}) |
|||
} |
@ -0,0 +1,18 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// 获取备件信息
|
|||
export function getSparePartsInfo(params) { |
|||
return request({ |
|||
url: '/eam/item/inScanCodeByNumber', |
|||
'method': 'GET', |
|||
params |
|||
}) |
|||
} |
|||
// 备件归还获取备件信息
|
|||
export function getSparePartsReturnInfo(params) { |
|||
return request({ |
|||
url: '/eam/item/scanCodeByNumber', |
|||
'method': 'GET', |
|||
params |
|||
}) |
|||
} |
@ -0,0 +1,9 @@ |
|||
import request from '@/utils/request' |
|||
// 归还
|
|||
export function sparePartsReturn(data) { |
|||
return request({ |
|||
url: '/eam/item-apply-main/inOperation', |
|||
'method': 'POST', |
|||
data |
|||
}) |
|||
} |
@ -1,42 +0,0 @@ |
|||
import upload from '@/utils/upload' |
|||
import request from '@/utils/request' |
|||
|
|||
// 用户密码重置
|
|||
export function updateUserPwd(oldPassword, newPassword) { |
|||
const data = { |
|||
oldPassword, |
|||
newPassword |
|||
} |
|||
return request({ |
|||
url: '/system/user/profile/update-password', |
|||
method: 'PUT', |
|||
params: data |
|||
}) |
|||
} |
|||
|
|||
// 查询用户个人信息
|
|||
export function getUserProfile() { |
|||
return request({ |
|||
url: '/system/user/profile/get', |
|||
method: 'GET' |
|||
}) |
|||
} |
|||
|
|||
// 修改用户个人信息
|
|||
export function updateUserProfile(data) { |
|||
return request({ |
|||
url: '/system/user/profile/update', |
|||
method: 'PUT', |
|||
data: data |
|||
}) |
|||
} |
|||
|
|||
// 用户头像上传
|
|||
export function uploadAvatar(data) { |
|||
return upload({ |
|||
url: '/system/user/profile/update-avatar', |
|||
method: 'PUT', |
|||
name: data.name, |
|||
filePath: data.filePath |
|||
}) |
|||
} |
@ -0,0 +1,8 @@ |
|||
import request from '@/utils/request' |
|||
// 归还人员
|
|||
export function getReverterUser(){ |
|||
return request({ |
|||
url: '/system/user/list-all-simple', |
|||
'method': 'GET' |
|||
}) |
|||
} |
@ -0,0 +1,502 @@ |
|||
<template> |
|||
<!-- 添加维修工单 --> |
|||
<view class="add-form-container"> |
|||
<u-form :model="form" ref="form1" label-width="160rpx"> |
|||
<u-form-item label="批次号" prop="number" required> |
|||
<u-input v-model="form.number" placeholder="请输入批次号" /> |
|||
</u-form-item> |
|||
<u-form-item label="供应商" prop="supplierName" required> |
|||
<u-input v-model="form.supplierName" placeholder="请输入供应商" /> |
|||
</u-form-item> |
|||
</u-form> |
|||
<view class="list"> |
|||
<view class="title"> |
|||
<span>*</span>订单信息 |
|||
</view> |
|||
<view class="item " v-for="(item,index) in orderList" :key="index"> |
|||
<view class="item-box"> |
|||
<view class="spare-title"> |
|||
<view class="title-txt"> |
|||
备件名称:{{item.itemName}} |
|||
</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.deliveryQty}} |
|||
</view> |
|||
</u-col> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
采购数量:{{item.qty}} |
|||
</view> |
|||
</u-col> |
|||
</u-row> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<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.itemName}} |
|||
</view> |
|||
</view> |
|||
<u-row gutter="16"> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
入库数量:{{item.qty}} |
|||
</view> |
|||
</u-col> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
采购数量:{{item.applyQty}} |
|||
</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="160rpx"> |
|||
<u-form-item :label="`备件编号`" prop="itemNumber" required> |
|||
<view class="select"> |
|||
<u-input v-model="form1.itemNumber" placeholder="请选择备件" @blur="blur1" /> |
|||
<view class="right-button" @click="chickRightButton1"> |
|||
扫描 |
|||
</view> |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item :label="`备件名称`" prop="itemNumber" required class="disabled"> |
|||
<view class="select"> |
|||
<u-input v-model="form1.itemName" placeholder="请选择备件" disabled /> |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item label="库位" prop="locationNumber" required v-if="isShow"> |
|||
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur" /> |
|||
<view class="right-button" @click="chickRightButton"> |
|||
扫描 |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item label="采购数量" prop="applyQty" required class="disabled"> |
|||
<u-input v-model="form1.applyQty" type="number" disabled placeholder="请输入采购数量" /> |
|||
</u-form-item> |
|||
<u-form-item label="已入库数量" prop="deliveryQty" required class="disabled"> |
|||
<u-input v-model="form1.deliveryQty" type="number" disabled placeholder="请输入已入库数量" /> |
|||
</u-form-item> |
|||
<u-form-item label="入库数量" prop="qty" required> |
|||
<u-input v-model="form1.qty" type="number" placeholder="请输入入库数量" /> |
|||
</u-form-item> |
|||
</u-form> |
|||
</view> |
|||
<view class="popup-footer"> |
|||
<view @click="isPopupShow = false">取消</view> |
|||
<view class="sure" @click="addSpare">确认</view> |
|||
</view> |
|||
</u-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import * as inLocationApi from "@/api/inLocation.js" |
|||
import * as sparePartsApi from "@/api/spareParts.js" |
|||
import * as locationApi from "@/api/location.js" |
|||
|
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
loading: false, |
|||
orderList: [], //订单信息 |
|||
// 备件弹窗 |
|||
isPopupShow: false, |
|||
field: '', |
|||
form: { |
|||
id: '', |
|||
number: '', |
|||
itemNumbers: [] |
|||
}, |
|||
form1: { |
|||
itemNumber: "", |
|||
itemName: '', |
|||
locationNumber: '', |
|||
applyQty: '', |
|||
deliveryQty: '', |
|||
qty: '' |
|||
}, |
|||
isShow: false, |
|||
isInAccount: 'FALSE' |
|||
} |
|||
}, |
|||
methods: { |
|||
// 触发提交表单 |
|||
submit() { |
|||
// 校验 |
|||
// if (!this.form.name) { |
|||
// this.$modal.showToast('请输入主题') |
|||
// return; |
|||
// } |
|||
if (this.form.itemNumbers.length === 0) { |
|||
this.$modal.showToast('请选择备件') |
|||
return; |
|||
} |
|||
this.$modal.confirm('是否添加入库信息').then(() => { |
|||
this.$modal.loading('加载中') |
|||
this.loading = true |
|||
inLocationApi.inLocationCreat(this.form).then((res) => { |
|||
this.$modal.closeLoading() |
|||
if (res.data) { |
|||
this.$modal.showToast('添加成功') |
|||
setTimeout(() => { |
|||
this.$tab.navigateBack() |
|||
this.loading = false |
|||
}, 1500) |
|||
} else { |
|||
this.$modal.showToast('添加失败') |
|||
this.loading = false |
|||
} |
|||
}).catch(() => { |
|||
this.$modal.closeLoading() |
|||
this.loading = false |
|||
}) |
|||
}) |
|||
|
|||
}, |
|||
// 重置 |
|||
reset() { |
|||
if (this.form.id) { |
|||
this.form.classes = ''; |
|||
this.form.faultType = '' |
|||
} else { |
|||
|
|||
this.form = {} |
|||
} |
|||
}, |
|||
|
|||
// 获取订单信息详情 |
|||
async getInLocationDetail() { |
|||
await inLocationApi.getInLocationDetail(this.form.id).then(res => { |
|||
this.orderList = res.data |
|||
}) |
|||
}, |
|||
// 打开弹窗 |
|||
open() { |
|||
this.form1 = { |
|||
itemNumber: "", |
|||
itemName: '', |
|||
locationNumber: '', |
|||
applyQty: '', |
|||
deliveryQty: '', |
|||
qty: '' |
|||
} |
|||
this.isPopupShow = true |
|||
this.isShow= false |
|||
}, |
|||
// 添加备件 |
|||
addSpare() { |
|||
// 校验 |
|||
if (!this.form1.itemNumber) { |
|||
this.$modal.showToast('请选择备件') |
|||
return; |
|||
} |
|||
if (!this.form1.itemName) { |
|||
this.$modal.showToast('找不到该备件') |
|||
return; |
|||
} |
|||
if (!this.form1.locationNumber) { |
|||
this.$modal.showToast('请选择库位') |
|||
return; |
|||
} |
|||
if (this.isInAccount == 'FALSE') { |
|||
this.$modal.showToast('该库位属于帐外库,请选择帐内库') |
|||
return; |
|||
} |
|||
if (this.itemNumber) { |
|||
this.$modal.showToast('该库位已绑定过备件') |
|||
return; |
|||
} |
|||
if (!this.form1.qty) { |
|||
this.$modal.showToast(`请输入数量`) |
|||
return; |
|||
} |
|||
console.log(this.form1) |
|||
if (Number(this.form1.qty) + Number(this.form1.deliveryQty) > Number(this.form1.applyQty)) { |
|||
this.$modal.showToast('已入库数量和入库数量不可大于采购数量') |
|||
return; |
|||
} |
|||
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; |
|||
} |
|||
let arr1 = orderList.filter(item => item.itemNumber == this.form1.itemNumber) |
|||
if (!arr1|| (arr1&&arr1.length == 0)) { |
|||
this.$modal.showToast('订单信息没有该备件') |
|||
return; |
|||
} |
|||
} |
|||
|
|||
this.form.itemNumbers.push(this.form1) |
|||
this.isPopupShow = false |
|||
}, |
|||
// 删除备件 |
|||
delSpareParts(index) { |
|||
this.form.itemNumbers.splice(index, 1) |
|||
}, |
|||
getLocation() { |
|||
locationApi.getLocation(this.form1.locationNumber).then(res => { |
|||
if(!res.data){ |
|||
this.$modal.showToast('找不到该库位') |
|||
return; |
|||
} |
|||
this.form1.areaNumber = res.data.areaNumber; |
|||
this.isInAccount = res.data.isInAccount || '' |
|||
this.itemNumber = res.data.itemNumber || '' |
|||
}) |
|||
}, |
|||
blur() { |
|||
if (this.form1.locationNumber) { |
|||
this.getLocation() |
|||
} |
|||
}, |
|||
// 获取备件信息 |
|||
getSparePartsInfo() { |
|||
sparePartsApi.getSparePartsInfo({ |
|||
number: this.form1.itemNumber, |
|||
id: this.form.id |
|||
}).then(res => { |
|||
if(!res.data){ |
|||
this.$modal.showToast('找不到该备件') |
|||
this.itemNumber = '' |
|||
this.form1.areaNumber = '' |
|||
this.form1.locationNumber = ''; |
|||
this.isInAccount = '' |
|||
this.form1.itemName = '' |
|||
return; |
|||
} |
|||
this.itemNumber = '' |
|||
this.form1.areaNumber = res.data.areaNumber || '' |
|||
this.form1.locationNumber = res.data.locationNumber; |
|||
this.isInAccount = res.data.isInAccount|| '' |
|||
this.form1.itemName = res.data.itemName |
|||
this.form1.deliveryQty = res.data.deliveryQty |
|||
this.form1.applyQty = res.data.applyQty |
|||
if (!this.form1.locationNumber) { |
|||
this.isShow = true |
|||
} |
|||
}) |
|||
}, |
|||
blur1() { |
|||
if (this.form1.itemNumber) { |
|||
this.getSparePartsInfo() |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
async onLoad(option) { |
|||
// if (option.id) this.form.id = option.id; |
|||
// if (option.number) this.form.number = option.number; |
|||
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option |
|||
.data)).id) { |
|||
let form = JSON.parse(decodeURIComponent(option.data)) |
|||
this.form.supplierName =form.supplierName |
|||
this.form.number =form.number |
|||
this.form.id =form.id |
|||
} |
|||
await this.getInLocationDetail() |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.add-form-container { |
|||
min-height: calc(100vh - 140rpx); |
|||
background: white; |
|||
padding: 0px 0rpx 140rpx; |
|||
} |
|||
|
|||
.u-form-item { |
|||
padding: 20rpx 30rpx; |
|||
} |
|||
|
|||
.disabled { |
|||
background: #f5f5f5; |
|||
} |
|||
|
|||
.footer { |
|||
position: fixed; |
|||
bottom: 0px; |
|||
left: 0px; |
|||
width: 100%; |
|||
z-index: 22; |
|||
} |
|||
|
|||
.btns { |
|||
display: flex; |
|||
|
|||
|
|||
button { |
|||
flex: 1; |
|||
} |
|||
|
|||
.sure { |
|||
background: #409eff; |
|||
color: white; |
|||
border-radius: 0px; |
|||
|
|||
&::after { |
|||
border: 1px solid #409eff; |
|||
border-radius: 0px; |
|||
} |
|||
} |
|||
|
|||
.reset { |
|||
background: #F5F5F5; |
|||
border-radius: 0px; |
|||
|
|||
&::after { |
|||
border-radius: 0px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.right-button { |
|||
background: #409eff; |
|||
color: white; |
|||
padding: 0rpx 30rpx; |
|||
border-radius: 16rpx; |
|||
text-align: center; |
|||
font-size: 28rpx; |
|||
} |
|||
|
|||
.select { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 72rpx; |
|||
width: 100%; |
|||
|
|||
.input { |
|||
flex: 1; |
|||
font-size: 28rpx; |
|||
color: #000000; |
|||
} |
|||
|
|||
.placeholder { |
|||
flex: 1; |
|||
font-size: 28rpx; |
|||
color: rgb(192, 196, 204); |
|||
|
|||
} |
|||
} |
|||
|
|||
.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> |
@ -0,0 +1,145 @@ |
|||
<template> |
|||
<!-- 采购入库 --> |
|||
<view class="container"> |
|||
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' |
|||
title="采购入库"> |
|||
</u-navbar> |
|||
<!-- <Search @search='search' @screen='screen' /> --> |
|||
<view class="list"> |
|||
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)"> |
|||
<view class="title"> |
|||
<view class="title-txt"> |
|||
{{item.number}} |
|||
</view> |
|||
<view class="time"> |
|||
{{`${$time.formatDate(item.createTime)}`}} |
|||
</view> |
|||
</view> |
|||
<view class="dec"> |
|||
采购人:<span>{{item.purchaser}}</span> |
|||
</view> |
|||
<view class="dec"> |
|||
采购时间:<span>{{item.date}}</span> |
|||
</view> |
|||
<view class="bottom"> |
|||
<view class="status"> |
|||
<u-tag text="未完成" v-if="item.status=='INCOMPLETE'" bg-color='rgba(255,255,255,0)' color='#e01f54' |
|||
border-color='#e01f54' type="success" shape='circle' /> |
|||
<u-tag text="已完成" v-else-if="item.status=='COMPLETE'" bg-color='rgba(255,255,255,0)' color='#2ba471' |
|||
border-color='#2ba471' type="info" shape='circle' /> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import * as inLocationApi from "@/api/inLocation.js" |
|||
export default { |
|||
data() { |
|||
return { |
|||
params: { |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
}, |
|||
status: 'loadmore', //是否显示没有更多了 |
|||
list: [], |
|||
|
|||
} |
|||
}, |
|||
methods: { |
|||
openDetail(item){ |
|||
this.$tab.navigateTo(`/pages/inLocation/addForm?data=${encodeURIComponent(JSON.stringify(item))}`) |
|||
}, |
|||
// 获取备件领用列表 |
|||
async getList() { |
|||
if (this.status == 'nomore') return; |
|||
this.status = 'loading'; |
|||
this.$modal.loading('加载中') |
|||
await inLocationApi.getInLocationPage(this.params).then((res) => { |
|||
this.$modal.closeLoading() |
|||
if (res.data.list.length > 0) { |
|||
this.list = this.list.concat(res.data.list); |
|||
console.log(this.list ) |
|||
this.params.pageNo++; |
|||
this.status = 'loadmore' |
|||
} else { |
|||
this.status = 'nomore' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
}, |
|||
onLoad(option) { |
|||
if (option.type) this.params.type = option.type; |
|||
}, |
|||
onShow() { |
|||
this.params.pageNo = 1 |
|||
this.list = [] |
|||
this.status = 'loadmore' |
|||
this.getList() |
|||
|
|||
}, |
|||
onReachBottom() { |
|||
this.getList() |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.list { |
|||
background: #f5f5f5; |
|||
margin-top: 20rpx; |
|||
|
|||
.item { |
|||
padding: 30rpx 30rpx 0px 30rpx; |
|||
margin-top: 20rpx; |
|||
background: white; |
|||
position: relative; |
|||
|
|||
.title { |
|||
display: flex; |
|||
align-items: center; |
|||
padding-bottom: 20rpx; |
|||
|
|||
.title-txt { |
|||
color: #409eff; |
|||
font-weight: bold; |
|||
font-size: 36rpx; |
|||
width: 0px; |
|||
flex: 1; |
|||
} |
|||
|
|||
.time { |
|||
color: #919191; |
|||
|
|||
} |
|||
} |
|||
|
|||
.dec { |
|||
padding-bottom: 20rpx; |
|||
|
|||
span { |
|||
color: #999999; |
|||
} |
|||
} |
|||
|
|||
.last { |
|||
padding-bottom: 30rpx; |
|||
} |
|||
|
|||
.bottom { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
border-top: 1px solid #E4E4E4; |
|||
padding: 20rpx 0px; |
|||
height: 90rpx; |
|||
|
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,479 @@ |
|||
<template> |
|||
<!-- 添加维修工单 --> |
|||
<view class="add-form-container"> |
|||
<u-form :model="form" ref="form1" label-width="160rpx"> |
|||
<u-form-item label="申请人" prop="applyName" required class='disabled'> |
|||
<u-input v-model="form.applyName" placeholder="请输入申请人" disabled/> |
|||
</u-form-item> |
|||
<u-form-item label="申请部门" prop="applyDeptName" required class='disabled'> |
|||
<u-input v-model="form.applyDeptName" placeholder="请输入申请部门" disabled/> |
|||
</u-form-item> |
|||
<u-form-item label="审批人" prop="approveName" required class='disabled'> |
|||
<u-input v-model="form.approveName" placeholder="请输入审批人" disabled/> |
|||
</u-form-item> |
|||
</u-form> |
|||
<view class="list"> |
|||
<view class="title"> |
|||
<span>*</span>申领信息 |
|||
</view> |
|||
<view class="item " v-for="(item,index) in form.subList" :key="index"> |
|||
<view class="item-box"> |
|||
<view class="spare-title"> |
|||
<view class="title-txt"> |
|||
备件名称:{{item.itemName}} |
|||
</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.receiveQty}} |
|||
</view> |
|||
</u-col> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
申请数量:{{item.qty}} |
|||
</view> |
|||
</u-col> |
|||
</u-row> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<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.itemName}} |
|||
</view> |
|||
</view> |
|||
<u-row gutter="16"> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
出库数量:{{item.qty}} |
|||
</view> |
|||
</u-col> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
申请数量:{{item.applyQty}} |
|||
</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="160rpx"> |
|||
<u-form-item label="库位" prop="locationNumber" required> |
|||
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur" /> |
|||
<view class="right-button" @click="chickRightButton"> |
|||
扫描 |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item :label="`备件名称`" prop="itemNumber" required class="disabled"> |
|||
<view class="select"> |
|||
<u-input v-model="form1.itemName" placeholder="请选择备件" disabled /> |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item label="申请数量" prop="applyQty" required class="disabled"> |
|||
<u-input v-model="form1.applyQty" type="number" disabled placeholder="请输入申请数量" /> |
|||
</u-form-item> |
|||
<u-form-item label="已出库数量" prop="receiveQty" required class="disabled"> |
|||
<u-input v-model="form1.receiveQty" type="number" disabled placeholder="请输入已出库数量" /> |
|||
</u-form-item> |
|||
<u-form-item label="库存数量" prop="stockQty" required class="disabled"> |
|||
<u-input v-model="form1.stockQty" type="number" disabled placeholder="请输入库存数量" /> |
|||
</u-form-item> |
|||
<u-form-item label="出库数量" prop="qty" required> |
|||
<u-input v-model="form1.qty" type="number" placeholder="请输入出库数量" /> |
|||
</u-form-item> |
|||
</u-form> |
|||
</view> |
|||
<view class="popup-footer"> |
|||
<view @click="isPopupShow = false">取消</view> |
|||
<view class="sure" @click="addSpare">确认</view> |
|||
</view> |
|||
</u-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import * as outLocationApi from "@/api/outLocation.js" |
|||
import * as sparePartsApi from "@/api/spareParts.js" |
|||
import * as locationApi from "@/api/location.js" |
|||
|
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
loading: false, |
|||
orderList: [], //订单信息 |
|||
// 备件弹窗 |
|||
isPopupShow: false, |
|||
field: '', |
|||
form: { |
|||
id: '', |
|||
number: '', |
|||
itemNumbers: [], |
|||
subList:[] |
|||
}, |
|||
form1: { |
|||
itemNumber: "", |
|||
itemName: '', |
|||
locationNumber: '', |
|||
applyQty: '', |
|||
receiveQty: '', |
|||
stockQty: '', |
|||
qty: '' |
|||
}, |
|||
isShow: false, |
|||
isInAccount: 'FALSE' |
|||
} |
|||
}, |
|||
methods: { |
|||
// 触发提交表单 |
|||
submit() { |
|||
// 校验 |
|||
// if (!this.form.name) { |
|||
// this.$modal.showToast('请输入主题') |
|||
// return; |
|||
// } |
|||
if (this.form.itemNumbers.length === 0) { |
|||
this.$modal.showToast('请选择备件') |
|||
return; |
|||
} |
|||
this.$modal.confirm('是否添加出库信息').then(() => { |
|||
this.$modal.loading('加载中') |
|||
this.loading = true |
|||
outLocationApi.outLocationCreat(this.form).then((res) => { |
|||
this.$modal.closeLoading() |
|||
if (res.data) { |
|||
this.$modal.showToast('添加成功') |
|||
setTimeout(() => { |
|||
this.$tab.navigateBack() |
|||
this.loading = false |
|||
}, 1500) |
|||
} else { |
|||
this.$modal.showToast('添加失败') |
|||
this.loading = false |
|||
} |
|||
}).catch(() => { |
|||
this.$modal.closeLoading() |
|||
this.loading = false |
|||
}) |
|||
}) |
|||
|
|||
}, |
|||
// 重置 |
|||
reset() { |
|||
if (this.form.id) { |
|||
this.form.classes = ''; |
|||
this.form.faultType = '' |
|||
} else { |
|||
|
|||
this.form = {} |
|||
} |
|||
}, |
|||
|
|||
// 获取订单信息详情 |
|||
async getInLocationDetail() { |
|||
await outLocationApi.getOutLocationDetail({ |
|||
id:this.form.id, |
|||
number:this.form.number |
|||
}).then(res => { |
|||
this.form.applyName = res.data.applyName |
|||
this.form.approveName = res.data.approveName |
|||
this.form.applyDeptName = res.data.applyDeptName |
|||
this.form.subList = res.data.subList |
|||
}) |
|||
}, |
|||
// 打开弹窗 |
|||
open() { |
|||
this.form1 = { |
|||
itemNumber: "", |
|||
itemName: '', |
|||
locationNumber: '', |
|||
applyQty: '', |
|||
receiveQty: '', |
|||
stockQty: '', |
|||
qty: '' |
|||
} |
|||
this.isPopupShow = true |
|||
this.isShow= false |
|||
}, |
|||
// 添加备件 |
|||
addSpare() { |
|||
// 校验 |
|||
if (!this.form1.locationNumber) { |
|||
this.$modal.showToast('请选择库位') |
|||
return; |
|||
} |
|||
if (!this.form1.itemNumber) { |
|||
this.$modal.showToast('库位没有对应的备件,请重新选择') |
|||
return; |
|||
} |
|||
|
|||
if (!this.form1.qty) { |
|||
this.$modal.showToast(`请输入数量`) |
|||
return; |
|||
} |
|||
console.log(this.form1) |
|||
if (Number(this.form1.qty) + Number(this.form1.receiveQty) > Number(this.form1.applyQty)) { |
|||
this.$modal.showToast('已出库数量和出库数量不可大于申请数量') |
|||
return; |
|||
} |
|||
if (Number(this.form1.qty) > Number(this.form1.stockQty)) { |
|||
this.$modal.showToast('出库数量不可大于库存数量') |
|||
return; |
|||
} |
|||
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; |
|||
} |
|||
let arr1 = this.form.subList.filter(item => item.itemNumber == this.form1.itemNumber) |
|||
if (!arr1|| (arr1&&arr1.length == 0)) { |
|||
this.$modal.showToast('申领信息没有该备件') |
|||
return; |
|||
} |
|||
} |
|||
this.form.itemNumbers.push(this.form1) |
|||
this.isPopupShow = false |
|||
}, |
|||
// 删除备件 |
|||
delSpareParts(index) { |
|||
this.form.itemNumbers.splice(index, 1) |
|||
}, |
|||
getLocation() { |
|||
locationApi.getOutLocation({ |
|||
number:this.form1.locationNumber, |
|||
id:this.form.id, |
|||
}).then(res => { |
|||
if(!res.data){ |
|||
this.$modal.showToast('找不到该库位') |
|||
return; |
|||
} |
|||
this.form1.areaNumber = res.data.areaNumber; |
|||
this.form1.itemName = res.data.itemName; |
|||
this.form1.itemNumber = res.data.itemNumber; |
|||
this.form1.receiveQty = res.data.receiveQty; |
|||
this.form1.applyQty = res.data.applyQty; |
|||
this.form1.stockQty = res.data.qty; |
|||
this.isInAccount = res.data.isInAccount || '' |
|||
// this.itemNumber = res.data.itemNumber || '' |
|||
}) |
|||
}, |
|||
blur() { |
|||
if (this.form1.locationNumber) { |
|||
this.getLocation() |
|||
} |
|||
}, |
|||
|
|||
|
|||
}, |
|||
async onLoad(option) { |
|||
// if (option.id) this.form.id = option.id; |
|||
// if (option.number) this.form.number = option.number; |
|||
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option |
|||
.data)).id) { |
|||
let form = JSON.parse(decodeURIComponent(option.data)) |
|||
console.log(form) |
|||
this.form.supplierName =form.supplierName |
|||
this.form.number =form.number |
|||
this.form.id =form.id |
|||
} |
|||
await this.getInLocationDetail() |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.add-form-container { |
|||
min-height: calc(100vh - 140rpx); |
|||
background: white; |
|||
padding: 0px 0rpx 140rpx; |
|||
} |
|||
|
|||
.u-form-item { |
|||
padding: 20rpx 30rpx; |
|||
} |
|||
|
|||
.disabled { |
|||
background: #f5f5f5; |
|||
} |
|||
|
|||
.footer { |
|||
position: fixed; |
|||
bottom: 0px; |
|||
left: 0px; |
|||
width: 100%; |
|||
z-index: 22; |
|||
} |
|||
|
|||
.btns { |
|||
display: flex; |
|||
|
|||
|
|||
button { |
|||
flex: 1; |
|||
} |
|||
|
|||
.sure { |
|||
background: #409eff; |
|||
color: white; |
|||
border-radius: 0px; |
|||
|
|||
&::after { |
|||
border: 1px solid #409eff; |
|||
border-radius: 0px; |
|||
} |
|||
} |
|||
|
|||
.reset { |
|||
background: #F5F5F5; |
|||
border-radius: 0px; |
|||
|
|||
&::after { |
|||
border-radius: 0px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.right-button { |
|||
background: #409eff; |
|||
color: white; |
|||
padding: 0rpx 30rpx; |
|||
border-radius: 16rpx; |
|||
text-align: center; |
|||
font-size: 28rpx; |
|||
} |
|||
|
|||
.select { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 72rpx; |
|||
width: 100%; |
|||
|
|||
.input { |
|||
flex: 1; |
|||
font-size: 28rpx; |
|||
color: #000000; |
|||
} |
|||
|
|||
.placeholder { |
|||
flex: 1; |
|||
font-size: 28rpx; |
|||
color: rgb(192, 196, 204); |
|||
|
|||
} |
|||
} |
|||
|
|||
.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> |
@ -0,0 +1,161 @@ |
|||
<template> |
|||
<!-- 领用入库 --> |
|||
<view class="container"> |
|||
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff' |
|||
title="领用入库"> |
|||
</u-navbar> |
|||
<!-- <Search @search='search' @screen='screen' /> --> |
|||
<view class="list"> |
|||
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)"> |
|||
<view class="title"> |
|||
<view class="title-txt"> |
|||
{{item.number}} |
|||
</view> |
|||
<!-- <view class="time"> |
|||
{{`${$time.formatDate(item.createTime)}`}} |
|||
</view> --> |
|||
</view> |
|||
<view class="dec"> |
|||
申请人:<span>{{item.applyName}}</span> |
|||
</view> |
|||
<view class="dec"> |
|||
申请时间:<span>{{`${$time.formatDate(item.createTime)}`}}</span> |
|||
</view> |
|||
<view class="dec"> |
|||
申请部门:<span>{{item.applyDeptName}}</span> |
|||
</view> |
|||
<view class="dec"> |
|||
审批人:<span>{{item.approveName}}</span> |
|||
</view> |
|||
<view class="dec"> |
|||
审批时间:<span>{{`${$time.formatDate(item.approveTime)}`}}</span> |
|||
</view> |
|||
<view class="bottom"> |
|||
<view class="status"> |
|||
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463' |
|||
border-color='#fe8463' type="primary" shape='circle' /> |
|||
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9' |
|||
border-color='#2EC7C9' type="info" shape='circle' /> |
|||
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54' |
|||
border-color='#e01f54' type="success" shape='circle' /> |
|||
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa' |
|||
border-color='#005eaa ' type="error" shape='circle' /> |
|||
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471' |
|||
border-color='#2ba471' type="info" shape='circle' /> |
|||
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7' |
|||
border-color='#d7d7d7 ' type="warning" shape='circle' /> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import * as outLocationApi from "@/api/outLocation.js" |
|||
export default { |
|||
data() { |
|||
return { |
|||
params: { |
|||
pageNo: 1, |
|||
pageSize: 10, |
|||
}, |
|||
status: 'loadmore', //是否显示没有更多了 |
|||
list: [], |
|||
|
|||
} |
|||
}, |
|||
methods: { |
|||
openDetail(item){ |
|||
this.$tab.navigateTo(`/pages/outLocation/addForm?data=${encodeURIComponent(JSON.stringify(item))}`) |
|||
}, |
|||
// 获取领用出库列表 |
|||
async getList() { |
|||
if (this.status == 'nomore') return; |
|||
this.status = 'loading'; |
|||
this.$modal.loading('加载中') |
|||
await outLocationApi.getOutLocationPage(this.params).then((res) => { |
|||
this.$modal.closeLoading() |
|||
if (res.data.list.length > 0) { |
|||
this.list = this.list.concat(res.data.list); |
|||
console.log(this.list ) |
|||
this.params.pageNo++; |
|||
this.status = 'loadmore' |
|||
} else { |
|||
this.status = 'nomore' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
}, |
|||
onLoad(option) { |
|||
if (option.type) this.params.type = option.type; |
|||
}, |
|||
onShow() { |
|||
this.params.pageNo = 1 |
|||
this.list = [] |
|||
this.status = 'loadmore' |
|||
this.getList() |
|||
}, |
|||
onReachBottom() { |
|||
this.getList() |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.list { |
|||
background: #f5f5f5; |
|||
margin-top: 20rpx; |
|||
|
|||
.item { |
|||
padding: 30rpx 30rpx 0px 30rpx; |
|||
margin-top: 20rpx; |
|||
background: white; |
|||
position: relative; |
|||
|
|||
.title { |
|||
display: flex; |
|||
align-items: center; |
|||
padding-bottom: 20rpx; |
|||
|
|||
.title-txt { |
|||
color: #409eff; |
|||
font-weight: bold; |
|||
font-size: 36rpx; |
|||
width: 0px; |
|||
flex: 1; |
|||
} |
|||
|
|||
.time { |
|||
color: #919191; |
|||
|
|||
} |
|||
} |
|||
|
|||
.dec { |
|||
padding-bottom: 20rpx; |
|||
|
|||
span { |
|||
color: #999999; |
|||
} |
|||
} |
|||
|
|||
.last { |
|||
padding-bottom: 30rpx; |
|||
} |
|||
|
|||
.bottom { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
border-top: 1px solid #E4E4E4; |
|||
padding: 20rpx 0px; |
|||
height: 90rpx; |
|||
|
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,478 @@ |
|||
<template> |
|||
<!-- 添加维修工单 --> |
|||
<view class="add-form-container"> |
|||
<u-form :model="form" ref="form1" label-width="160rpx"> |
|||
<!-- <u-form-item label="入库原因" prop="res" required> |
|||
<u-input v-model="form.number" placeholder="请输入入库原因" /> |
|||
</u-form-item> --> |
|||
|
|||
<u-form-item label="归还人员" prop="reverterName" required> |
|||
<view class="select" @click="openSingleColumn('reverterId',form.reverterId,reverterUser)"> |
|||
<view class="input" v-if='form.reverterId'> |
|||
{{selectFormat(form.reverterId,reverterUser)}} |
|||
</view> |
|||
<view class="placeholder" v-else> |
|||
{{`请选择归还人员`}} |
|||
</view> |
|||
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|||
</view> |
|||
</u-form-item> |
|||
</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.itemName}} |
|||
</view> |
|||
</view> |
|||
<u-row gutter="16"> |
|||
<u-col :span="24"> |
|||
<view class="dec"> |
|||
数量:{{item.qty}} |
|||
</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="160rpx"> |
|||
<u-form-item :label="`备件编号`" prop="itemNumber" required> |
|||
<view class="select"> |
|||
<u-input v-model="form1.itemNumber" placeholder="请选择备件" @blur="blur1" /> |
|||
<view class="right-button" @click="chickRightButton1"> |
|||
扫描 |
|||
</view> |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item :label="`备件名称`" prop="itemNumber" required class="disabled"> |
|||
<view class="select"> |
|||
<u-input v-model="form1.itemName" placeholder="请选择备件" disabled /> |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item label="库位" prop="locationNumber" required v-if="isShow"> |
|||
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur" /> |
|||
<view class="right-button" @click="chickRightButton"> |
|||
扫描 |
|||
</view> |
|||
</u-form-item> |
|||
<u-form-item label="数量" prop="qty" required> |
|||
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" /> |
|||
</u-form-item> |
|||
</u-form> |
|||
</view> |
|||
<view class="popup-footer"> |
|||
<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' |
|||
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import * as userApi from "@/api/user.js" |
|||
import * as sparePartsReturnApi from "@/api/sparePartsReturn.js" |
|||
import * as sparePartsApi from "@/api/spareParts.js" |
|||
import * as locationApi from "@/api/location.js" |
|||
|
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
loading: false, |
|||
// 备件弹窗 |
|||
isPopupShow: false, |
|||
// 下拉框字段 |
|||
singleColumnShow: false, |
|||
singleColumnDefaultValue: [], |
|||
singleColumnList: [], |
|||
reverterUser:[], |
|||
field: '', |
|||
form: { |
|||
id: '', |
|||
number: '', |
|||
itemNumbers: [] |
|||
}, |
|||
form1: { |
|||
itemNumber: "", |
|||
itemName: '', |
|||
locationNumber: '', |
|||
qty: '' |
|||
}, |
|||
isShow: false, |
|||
isInAccount: 'FALSE' |
|||
} |
|||
}, |
|||
methods: { |
|||
// 触发提交表单 |
|||
submit() { |
|||
// 校验 |
|||
if (!this.form.reverterId) { |
|||
this.$modal.showToast('请选择归还人员') |
|||
return; |
|||
} |
|||
if (this.form.itemNumbers.length === 0) { |
|||
this.$modal.showToast('请选择备件') |
|||
return; |
|||
} |
|||
this.$modal.confirm('是否归还备件').then(() => { |
|||
this.$modal.loading('加载中') |
|||
this.loading = true |
|||
sparePartsReturnApi.sparePartsReturn(this.form).then((res) => { |
|||
this.$modal.closeLoading() |
|||
if (res.data) { |
|||
this.$modal.showToast('归还成功') |
|||
setTimeout(() => { |
|||
this.$tab.navigateBack() |
|||
this.loading = false |
|||
}, 1500) |
|||
} else { |
|||
this.$modal.showToast('归还失败') |
|||
this.loading = false |
|||
} |
|||
}).catch(() => { |
|||
this.$modal.closeLoading() |
|||
this.loading = false |
|||
}) |
|||
}) |
|||
|
|||
}, |
|||
// 重置 |
|||
reset() { |
|||
if (this.form.id) { |
|||
this.form.classes = ''; |
|||
this.form.faultType = '' |
|||
} else { |
|||
|
|||
this.form = {} |
|||
} |
|||
}, |
|||
|
|||
selectFormat(val, array) { |
|||
let str = array.filter(item => item.value == val)[0].label |
|||
return str |
|||
}, |
|||
// 单列模式 |
|||
openSingleColumn(field, val, list) { |
|||
this.singleColumnList = list |
|||
this.field = field |
|||
if (val) { |
|||
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)] |
|||
} else { |
|||
this.singleColumnDefaultValue = [] |
|||
} |
|||
this.singleColumnShow = true |
|||
}, |
|||
// 单列模式点击确定之后 |
|||
chooseSingleColumn(e) { |
|||
this.form[this.field] = e[0].value |
|||
if(this.field == 'reverterId'){ |
|||
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.id == e[0].value) |
|||
this.form.reverterName = this.choosesingleColumnItem[0].name |
|||
} |
|||
this.getApplyDeviceList() |
|||
this.singleColumnShow = false |
|||
this.$forceUpdate() |
|||
}, |
|||
// 获取归还人员列表 |
|||
async getReverterUser() { |
|||
await userApi.getReverterUser().then(res => { |
|||
res.data.map(item => { |
|||
item.value = item.id |
|||
item.label = item.nickname |
|||
}) |
|||
this.reverterUser = res.data |
|||
}) |
|||
}, |
|||
// 打开弹窗 |
|||
open() { |
|||
this.form1 = { |
|||
itemNumber: "", |
|||
itemName: '', |
|||
locationNumber: '', |
|||
qty: '' |
|||
} |
|||
this.isPopupShow = true |
|||
this.isShow= false |
|||
}, |
|||
// 添加备件 |
|||
addSpare() { |
|||
// 校验 |
|||
if (!this.form1.itemNumber) { |
|||
this.$modal.showToast('请选择备件') |
|||
return; |
|||
} |
|||
if (!this.form1.itemName) { |
|||
this.$modal.showToast('找不到该备件') |
|||
return; |
|||
} |
|||
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.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) |
|||
}, |
|||
getLocation() { |
|||
locationApi.getLocation(this.form1.locationNumber).then(res => { |
|||
if(!res.data){ |
|||
this.$modal.showToast('找不到该库位') |
|||
return; |
|||
} |
|||
this.form1.areaNumber = res.data.areaNumber; |
|||
this.isInAccount = res.data.isInAccount || '' |
|||
this.itemNumber = res.data.itemNumber || '' |
|||
}) |
|||
}, |
|||
blur() { |
|||
if (this.form1.locationNumber) { |
|||
this.getLocation() |
|||
} |
|||
}, |
|||
// 获取备件信息 |
|||
getSparePartsInfo() { |
|||
sparePartsApi.getSparePartsReturnInfo({ |
|||
number: this.form1.itemNumber, |
|||
}).then(res => { |
|||
if(!res.data){ |
|||
this.$modal.showToast('找不到该备件') |
|||
this.itemNumber = '' |
|||
this.form1.areaNumber = '' |
|||
this.form1.locationNumber = ''; |
|||
this.isInAccount = '' |
|||
this.form1.itemName = '' |
|||
return; |
|||
} |
|||
this.itemNumber = '' |
|||
this.form1.areaNumber = res.data.areaNumber || '' |
|||
this.form1.locationNumber = res.data.locationNumber; |
|||
this.isInAccount = res.data.isInAccount|| '' |
|||
this.form1.itemName = res.data.itemName |
|||
if (!this.form1.locationNumber) { |
|||
this.isShow = true |
|||
} |
|||
}) |
|||
}, |
|||
blur1() { |
|||
if (this.form1.itemNumber) { |
|||
this.getSparePartsInfo() |
|||
} |
|||
}, |
|||
|
|||
}, |
|||
async onLoad(option) { |
|||
this.getReverterUser() |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.add-form-container { |
|||
min-height: calc(100vh - 140rpx); |
|||
background: white; |
|||
padding: 0px 0rpx 140rpx; |
|||
} |
|||
|
|||
.u-form-item { |
|||
padding: 20rpx 30rpx; |
|||
} |
|||
|
|||
.disabled { |
|||
background: #f5f5f5; |
|||
} |
|||
|
|||
.footer { |
|||
position: fixed; |
|||
bottom: 0px; |
|||
left: 0px; |
|||
width: 100%; |
|||
z-index: 22; |
|||
} |
|||
|
|||
.btns { |
|||
display: flex; |
|||
|
|||
|
|||
button { |
|||
flex: 1; |
|||
} |
|||
|
|||
.sure { |
|||
background: #409eff; |
|||
color: white; |
|||
border-radius: 0px; |
|||
|
|||
&::after { |
|||
border: 1px solid #409eff; |
|||
border-radius: 0px; |
|||
} |
|||
} |
|||
|
|||
.reset { |
|||
background: #F5F5F5; |
|||
border-radius: 0px; |
|||
|
|||
&::after { |
|||
border-radius: 0px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.right-button { |
|||
background: #409eff; |
|||
color: white; |
|||
padding: 0rpx 30rpx; |
|||
border-radius: 16rpx; |
|||
text-align: center; |
|||
font-size: 28rpx; |
|||
} |
|||
|
|||
.select { |
|||
display: flex; |
|||
align-items: center; |
|||
height: 72rpx; |
|||
width: 100%; |
|||
|
|||
.input { |
|||
flex: 1; |
|||
font-size: 28rpx; |
|||
color: #000000; |
|||
} |
|||
|
|||
.placeholder { |
|||
flex: 1; |
|||
font-size: 28rpx; |
|||
color: rgb(192, 196, 204); |
|||
|
|||
} |
|||
} |
|||
|
|||
.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> |
@ -0,0 +1,19 @@ |
|||
export default { |
|||
formatDate(timestamp){ |
|||
// 获取当前时间戳(单位:毫秒)
|
|||
// var timestamp = Date.now(); // 或者传入特定的时间戳值
|
|||
timestamp = timestamp ? timestamp :Date.now() |
|||
// 创建Date对象并设置时间戳
|
|||
var dateObj = new Date(timestamp); |
|||
|
|||
// 提取年份、月份、日期等信息
|
|||
var year = dateObj.getFullYear(); |
|||
var month = (dateObj.getMonth() + 1).toString().padStart(2, '0'); // 注意月份从0开始计数,所以需要加1
|
|||
var day = dateObj.getDate().toString().padStart(2, '0'); |
|||
var hour = dateObj.getHours().toString().padStart(2, '0'); |
|||
var minutes = dateObj.getMinutes().toString().padStart(2, '0'); |
|||
var seconds = dateObj.getSeconds().toString().padStart(2, '0'); |
|||
|
|||
return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}` |
|||
} |
|||
} |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
Loading…
Reference in new issue