Browse Source

EAM ——> PDA 领用出库

master
gaojs 3 months ago
parent
commit
d9c1f0b5bf
  1. 11
      src/api/eam/location.js
  2. 14
      src/pages.json
  3. 355
      src/pages/eam/outLocation/detail.vue
  4. 190
      src/pages/eam/outLocation/index.vue

11
src/api/eam/location.js

@ -11,3 +11,14 @@ export function getOutLocation(data) {
export function pdaItemAndLocation(number) {
return http.get('/eam/location/pdaItemAndLocation?number='+number)
}
// 获取领用出库主表分页列表
export function getOutLocationPage(params) {
return http.get('/eam/spare-parts-out-location-main/page',{params})
}
// 获取领用出库子表分页列表
export function getOutLocationDetailPage(params) {
return http.get('/eam/spare-parts-out-location-detail/page',{params})
}

14
src/pages.json

@ -2107,6 +2107,20 @@
"navigationBarTitleText": "扫码",
"enablePullDownRefresh": true
}
},
{
"path": "pages/eam/outLocation/index",
"style": {
"navigationBarTitleText": "领用出库",
"enablePullDownRefresh": true
}
},
{
"path": "pages/eam/outLocation/detail",
"style": {
"navigationBarTitleText": "详情",
"enablePullDownRefresh": true
}
}

355
src/pages/eam/outLocation/detail.vue

@ -0,0 +1,355 @@
<template>
<!-- 添加维修工单 -->
<view class="container">
<view class="title">
<span>*</span>申领信息
</view>
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="工单编号" prop="number" required class='disabled'>
<view disabled>{{ form.number}}</view>
</u-form-item>
<u-form-item label="申请编号" prop="applyNumber" required class='disabled'>
<view disabled>{{ form.applyNumber}}</view>
</u-form-item>
<u-form-item label="申请人ID" prop="applyer" required class='disabled'>
<view disabled>{{ form.applyer}}</view>
</u-form-item>
<u-form-item label="申请时间" prop="createTime" required class='disabled'>
<view class="time">{{`${$time.formatDate(form.createTime)}`}}</view>
</u-form-item>
</u-form>
<view class="title">
<span>*</span>备件明细
</view>
<view class="list">
<view class="item " v-for="(item,index) in subList" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
备件名称{{item.sparePartsName}}
</view>
</view>
<u-row gutter="16">
<u-col :span="24">
<view class="dec">
备件编号:{{item.sparePartsCode}}
</view>
</u-col>
<u-col :span="24">
<view class="dec" v-if="item.status==1">
流程状态:未出库
</view>
<view class="dec" v-if="item.status==2">
流程状态:出库中
</view>
<view class="dec" v-if="item.status==3">
流程状态:已出库
</view>
</u-col>
<u-col :span="24">
<view class="dec">
库存数量:{{item.currentQty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
申请数量:{{item.applyQty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
已出库数量:{{item.outedQty}}
</view>
</u-col>
</u-row>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="reset" @click="total">合计</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>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as outLocationApi from "@/api/eam/location"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const status = ref('loadmore') //
const subList = ref([])//
const outedQty = ref('')//
const form = ref({
id:'',
number: '',
applyNumber: '',
applyer: '',
createTime: '',
})
const params = ref({
masterId:'',
pageNo: 1,
pageSize: 10,
})
//
function submit() {
if (outedQty.value.length === 0) {
proxy.$modal.showToast('请先合计')
return;
}
proxy.$modal.confirm('是否添加出库信息').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
outLocationApi.outLocationCreat(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('添加失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reset() {
if(subList.value.length != 0){
subList.value.forEach((item) => {
item.outedQty = ''
})
}
}
//
function total() {
if(subList.value.length != 0){
subList.value.forEach((item) => {
if( parseInt(item.applyQty) > parseInt(item.currentQty) ){
item.outedQty = item.currentQty
}else{
item.outedQty = item.applyQty
}
})
}
}
//
async function getInLocationDetail() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
params.value.masterId = form.value.id
await outLocationApi.getOutLocationDetailPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
subList.value = subList.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
//
onLoad(async (option) => {
let formData = JSON.parse(decodeURIComponent(option.data))
form.value.number = formData.number
form.value.applyNumber = formData.applyNumber
form.value.applyer = formData.applyer
form.value.createTime = formData.createTime
form.value.id = formData.id
await 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>

190
src/pages/eam/outLocation/index.vue

@ -0,0 +1,190 @@
<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.number}}</span>
</view>
<view class="dec">
申请单号:<span>{{item.applyNumber}}</span>
</view>
<view class="dec">
<view>流程状态
<u-tag text="待审核" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#3399FF'
border-color='#3399FF' type="primary" shape='circle' />
<u-tag text="已撤回" v-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#3399FF'
border-color='#3399FF' type="primary" shape='circle' />
<u-tag text="审核中" v-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#3399FF'
border-color='#3399FF' type="primary" shape='circle' />
<u-tag text="已通过" v-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#3399FF'
border-color='#3399FF' type="primary" shape='circle' />
<u-tag text="已驳回" v-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#3399FF'
border-color='#3399FF' type="primary" shape='circle' />
<u-tag text="已完成" v-if="item.status==6" bg-color='rgba(255,255,255,0)' color='#3399FF'
border-color='#3399FF' type="primary" shape='circle' />
</view>
</view>
<view class="dec">
申请人ID:<span>{{item.applyer}}</span>
</view>
<view class="dec">
审核人:<span>{{item.approver}}</span>
</view>
<view class="dec">
审核内容:<span>{{item.approveContent}}</span>
</view>
<view class="dec">
审核时间:<span>{{`${$time.formatDate(item.approveTime)}`}}</span>
</view>
<view class="dec">
申请时间:<span>{{`${$time.formatDate(item.createTime)}`}}</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 setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as outLocationApi from "@/api/eam/location"
import auth from '@/plugins/auth'
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
})
const status = ref('loadmore') //
const list = ref([])
function openDetail(item){
proxy.$tab.navigateTo(`/pages/eam/outLocation/detail?data=${encodeURIComponent(JSON.stringify(item))}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await outLocationApi.getOutLocationPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.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>
Loading…
Cancel
Save