入库单

This commit is contained in:
许允枞 2024-10-28 11:34:04 +08:00
parent 86105db7df
commit b7c91de3aa
3 changed files with 335 additions and 25 deletions

301
components/inWareCard.vue Normal file
View File

@ -0,0 +1,301 @@
<template>
<view class="orderCard">
<view class="order-top">
<view class="orderNo">
入库单号{{ order.id }}
</view>
<!-- <view :style="{ color: getFlagColor(order.flag) }" class="flag">-->
<!-- {{ order.flagStr }}-->
<!-- </view>-->
</view>
<view class="order-body">
<view class="project">
<view class="project-left">
<view class="title">
<image class="titleIcon" mode="aspectFit" src="/static/icons/order-icon1.png"></image>
配件信息
</view>
<view style="margin-bottom: 20rpx" v-for="(item, index) in goodsList">
<view class="desc">
配件名称{{ item.repairWares.name }}
</view>
<view class="desc">
入库数量{{ item.inCount }}
</view>
</view>
</view>
</view>
<view class="baseInfo">
<view>
入库时间{{ soTime }}
</view>
<view>
入库人{{ order.userName }}
</view>
</view>
<!-- <view class="footer">-->
<!-- <view @click="gotoInWare" class="btn pg" style="margin-right: 40rpx">-->
<!-- &lt;!&ndash; 在什么都不能操作的情况下可以查看详情&ndash;&gt;-->
<!-- 查看入库单-->
<!-- </view>-->
<!-- <view @click="gotoDetail" class="btn pg">-->
<!-- &lt;!&ndash; 在什么都不能操作的情况下可以查看详情&ndash;&gt;-->
<!-- 入库-->
<!-- </view>-->
<!-- </view>-->
</view>
</view>
</template>
<script>
import {
getUserInfo,
getStrData
} from '@/utils/auth';
import request from '@/utils/request';
import {formatTimestamp, getDictTextByCodeAndValue} from "@/utils/utils";
export default {
name: "repairSoCard",
props: {
order: {
type: Object,
default: () => {
return {}
}
}
},
computed: {
projectName() {
if (this.order && this.order.projectList && this.order.projectList.length > 0) {
return this.order.projectList.map(m => m.name).join(',')
}
return ''
}
},
data() {
return {
soStatusText:'',
soiIds:[],
goodsNames:'',
soTime:'',
soiCount:'',
goodsList:[]
}
},
mounted() {
// this.getDictTextByCodeAndValue(this.order.soStatus); //
this.getSoiDetail()
},
onLoad() {
},
methods: {
getDictTextByCodeAndValue(soStatus) {
getDictTextByCodeAndValue('repair_so_status', soStatus)
.then(value => {
this.soStatusText = value; // data
})
.catch(error => {
this.soStatusText = "未知";
console.error(error);
});
},
/**
* 查看详情
*/
gotoDetail() {
uni.navigateTo({
url: '/pages-warehouse/inOutWarehouse/part?soId=' + this.order.id
})
},
gotoInWare(){
uni.navigateTo({
url: '/pages-order/inWare/inWare?soId=' + this.order.id
})
},
getSoiDetail(){
request({
url: '/admin-api/repair/so/get',
method: 'get',
params: {
id: this.order.id
}
}).then(res => {
console.log('这是子表',res)
console.log(res)
res.data.goodsList.forEach(item => {
this.soiIds.push(item.id)
})
this.soTime = formatTimestamp(res.data.updateTime)
if (this.soiIds.length > 0) {
console.log('返回', res.data)
request({
url: '/admin-api/repair/soi/get',
method: 'get',
params: {
ids: this.soiIds.join(',')
}
}).then((res) => { //
console.log('配件信息', res.data)
// const names = []
const names = res.data.map(item => item.repairWares.name);
this.goodsNames = names.join(', ');
this.soiCount = res.data.reduce((sum, item) => sum + (item.inCount || 0), 0);
this.goodsList = res.data
})
}
})
},
/**
* 项目派工
*/
projectDis() {
uni.navigateTo({
url: '/pages-order/choosePeople/choosePeople?id=' + this.order.id
})
}
},
getStatus() {
}
}
</script>
<style lang="less" scoped>
.orderCard {
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
border-left: 4rpx solid #FFB323;
padding: 0 30rpx;
margin: 15rpx 0;
}
.order-top {
padding: 20rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #F3F5F7;
.orderNo {
font-weight: 500;
font-size: 24rpx;
color: #858BA0;
}
.flag {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
}
}
.order-body {
.carNum {
margin: 20rpx 0;
}
.carModel {
margin: 20rpx 0;
font-weight: 500;
font-size: 28rpx;
color: #858BA0;
}
.project {
padding: 20rpx 10rpx;
background: #F2F2F7;
border-radius: 4rpx 4rpx 4rpx 4rpx;
display: flex;
align-items: center;
.project-left {
flex: 1;
width: 0;
}
.project-right {
padding: 0 16rpx;
display: flex;
flex-direction: column;
align-items: center;
border-left: 1rpx solid #DDDDDD;
.rightIcon {
width: 40rpx;
height: 40rpx;
}
.rightText {
font-weight: 500;
font-size: 24rpx;
color: #17DBB1;
}
}
.title {
font-weight: 500;
font-size: 24rpx;
color: #0174F6;
display: flex;
align-items: center;
column-gap: 8rpx;
}
.titleIcon {
width: 24rpx;
height: 24rpx;
}
.desc {
font-weight: 500;
font-size: 24rpx;
color: #333333;
margin-top: 10rpx;
}
}
.baseInfo {
font-weight: 500;
font-size: 28rpx;
color: #858BA0;
padding-bottom: 10rpx;
& > view {
margin: 30rpx 0;
}
}
.footer {
display: flex;
align-items: center;
justify-content: flex-end;
column-gap: 10rpx;
padding-bottom: 30rpx;
.btn {
width: 172rpx;
height: 60rpx;
border-radius: 30rpx 30rpx 30rpx 30rpx;
border: 2rpx solid #0174F6;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
font-size: 28rpx;
color: #0174F6;
&.qc {
background: #0174F6;
color: #fff;
}
}
}
}
</style>

View File

@ -9,22 +9,22 @@
<!-- <view v-if="activeKey === item.id" class="activeLine"></view>-->
<!-- </view>-->
<!-- </view>-->
<view class="orderList" v-if="!isRepairWarehouse">
<!-- <view class="orderList" v-if="!isRepairWarehouse">-->
<!-- <scroll-view scroll-y="true" style="height: 100%" class="itemContent" @scrolltolower="onReachBottomCus"-->
<!-- refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">-->
<!-- <order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"-->
<!-- @startWork="startWork"></order-card>-->
<!-- <view style="text-align: center" v-if="orderList.length==0">-->
<!-- <image class="" src="@/static/images/nothing.png"></image>-->
<!-- </view>-->
<!-- </scroll-view>-->
<!-- </view>-->
<view class="orderList">
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"
@startWork="startWork"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
</view>
<view class="orderList" v-else>
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<repair-so-card v-for="(item, index) in repairSoList" :key="index" :order="item"
@childEvent="onRefresherrefresh" @startWork="startWork"></repair-so-card>
<view style="text-align: center" v-if="repairSoList.length==0">
<in-ware-card v-for="(item, index) in inWareList" :key="index" :order="item"
@childEvent="onRefresherrefresh" @startWork="startWork"></in-ware-card>
<view style="text-align: center" v-if="inWareList.length==0">
<image class="" src="@/static/images/nothing.png"></image>
</view>
</scroll-view>
@ -47,13 +47,14 @@ import {
getTenantId
} from '@/utils/auth'
import RepairSoCard from "@/components/repairSoCard.vue";
import InWareCard from "@/components/inWareCard.vue";
export default {
components: {
OrderCard,
tabBarVue,
VNavigationBar,
RepairSoCard
InWareCard,
},
data() {
return {
@ -69,7 +70,7 @@ export default {
imageUrl: '',
soId: "",
orderList: [],
repairSoList: [],
inWareList: [],
}
},
onShow() {
@ -136,14 +137,14 @@ export default {
}
},
/**
* 获取采购
* 获取入库
*/
getRepairSoList() {
console.log('soId', this.soId)
const paramsObj = {
pageNo: this.pageNo,
pageSize: this.pageSize,
// userId: this.userInfo.id,
userId: this.userInfo.id,
mainId: this.soId,
// soType: "01"
}
@ -152,13 +153,13 @@ export default {
method: 'get',
params: paramsObj
}).then((res) => {
console.log('获取的数据', res.data)
console.log('获取的数据', res.data.records)
// concat n
if (this.pageNo != 1) {
this.repairSoList = this.repairSoList.concat(res.data.records)
this.inWareList = this.inWareList.concat(res.data.records)
} else {
this.repairSoList = res.data.records
this.inWareList = res.data.records
}
//
this.total = res.data.total

View File

@ -251,10 +251,18 @@ export default {
*/
inWare(){
console.log('partList',this.partList)
this.partList.forEach(item => {
item.inCount = item.count
item.id = this.soiIds[0]
})
// this.partList.forEach(item => {
// item.inCount = item.count
// item.goodsId = item.id
// // item.id = this.soiIds[0]
// })
const copiedPartList = JSON.parse(JSON.stringify(this.partList));
for (let i = 0; i < this.partList.length; i++) {
this.partList[i].inCount = this.partList[i].count
this.partList[i].goodsId = copiedPartList[i].id
this.partList[i].id = this.soiIds[i]
}
console.log('partList',this.partList)
request({
url: '/admin-api/repair/so/inWare',
method: 'post',