This commit is contained in:
bb_pan 2025-05-29 18:52:57 +08:00
parent 24393f28af
commit f98cb0d953
8 changed files with 1110 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name" : "material-app",
"appid" : "__UNI__2AF69B2",
"appid" : "__UNI__AEEB2B7",
"description" : "",
"versionName" : "1.0.1",
"versionCode" : 101,
@ -27,6 +27,9 @@
"Barcode" : {},
"Record" : {}
},
"android" : {
"minSdkVersion" : "21"
},
/* */
"distribute" : {
/* android */

View File

@ -57,6 +57,20 @@
"navigationStyle": "custom"
}
},
// --
{
"path": "pages/toolsLease/numOut",
"style": {
"navigationStyle": "custom"
}
},
// --
{
"path": "pages/toolsLease/codeOut",
"style": {
"navigationStyle": "custom"
}
},
/* */
//
{

View File

@ -0,0 +1,764 @@
<template>
<!-- 编码出库-->
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
title="编码出库"
@clickLeft="back"
/>
<view class="page-container">
<!-- 表单信息区域 -->
<scroll-view scroll-y style="height: 100vh">
<view class="form-section">
<view class="section-header" @tap="toggleForm">
<text class="title">任务信息</text>
<text class="toggle-icon" :class="{ 'is-expanded': isExpanded }"></text>
</view>
<view class="form-content" :class="{ 'is-expanded': isExpanded }">
<uni-forms :model="formData" label-width="100" :border="true">
<uni-forms-item label="领料班组:" name="teamName" class="flex">
<span class="form-view">{{ queryParams.teamName }}</span>
</uni-forms-item>
<uni-forms-item label="领料工程:" name="projectName" class="flex">
<span class="form-view">{{ queryParams.projectName }}</span>
</uni-forms-item>
<uni-forms-item label="物资类型:" name="maTypeName" class="flex">
<span class="form-view">{{ queryParams.maTypeName }}</span>
</uni-forms-item>
<uni-forms-item label="规格型号:" name="typeName" class="flex">
<span class="form-view">{{ queryParams.typeName }}</span>
</uni-forms-item>
<uni-forms-item label="待出库数量:" name="outNum" class="flex">
<span class="form-view">{{ queryParams.outNum }}</span>
</uni-forms-item>
</uni-forms>
</view>
</view>
<view class="table-list-item">
<uni-row :gutter="24" class="flex">
<uni-col :span="6">出库方式</uni-col>
<!--
<uni-col :span="6">
<view class="coding-btn" @tap="onCodeIdentify">编码识别</view>
</uni-col>
-->
<uni-col :span="6">
<button style="width: 100px" size="mini" type="primary" @click="scanStart">
二维码出库
</button>
</uni-col>
</uni-row>
</view>
<ScanQrCode
ref="scanQrCodeRef"
@scanSuccess="handleScanSuccess"
@scanError="handleScanError"
/>
<view class="table-list-item">
<uni-row :gutter="24" style="display: flex; align-items: center">
<uni-col :span="6">
<view> 设备编码 </view>
</uni-col>
<uni-col :span="12">
<view>
<uni-easyinput v-model="queryCodeParams.maCode" placeholder="请输入内容" />
</view>
</uni-col>
<uni-col :span="6">
<view class="coding-btn search-btn" @tap="onCodeSearch">编码检索</view>
</uni-col>
</uni-row>
</view>
<scroll-view scroll-y style="padding-bottom: 90rpx; height: 70vh">
<view class="table-list-item" v-for="(item, index) in codeDeviceList" :key="item.maId">
<uni-row :gutter="24">
<uni-col :span="6">物资类型</uni-col>
<uni-col :span="14">
<view class="cont">{{ item.materialName }}</view>
</uni-col>
<uni-col :span="4">
<div class="btn-del" @click="() => codeDeviceList.splice(index, 1)">删除</div>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">规格型号</uni-col>
<uni-col :span="16">
<view class="cont">{{ item.materialModel }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">设备编码</uni-col>
<uni-col :span="16">
<view class="cont">{{ item.maCode }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">设备状态</uni-col>
<uni-col :span="16">
<view class="cont">{{ item.statusName }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24">
<uni-col :span="6">设备数量</uni-col>
<uni-col :span="16">
<view class="cont">1</view>
</uni-col>
</uni-row>
</view>
<view class="loading-text">
{{ '没有更多数据了~' }}
</view>
</scroll-view>
</scroll-view>
<view class="outbound-btn" @tap="onHandleOutbound"> 出库 </view>
</view>
</template>
<script setup>
import { ref, computed, onUnmounted } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import {
getCodeDetailAPI,
getCodeDeviceListAPI,
setOutboundNumAPI,
getCodeScanAPI,
} from '@/services/picking/outbound.js'
import { getBoxBindByCode } from '@/services/standard.js'
import { debounce } from 'lodash-es'
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
// const query = defineProps() //
// const queryParams = JSON.parse(query.queryParams)
const scanQrCodeRef = ref(null)
const queryParams = ref({})
const formData = ref({})
const codeDeviceList = ref([])
const maxNum = ref(0)
const total = ref(0)
const boxCode = ref('')
const boxInfo = ref({})
//
const queryCodeParams = ref({
pageNum: 1,
pageSize: 10,
typeId: '',
maStatus: 1,
maCode: '',
})
const qrCodeScan = ref('')
const codeData = ref({})
//
const isExpanded = ref(true)
//
const toggleForm = () => {
isExpanded.value = !isExpanded.value
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
//
onLoad((opt) => {
queryParams.value = opt.params ? JSON.parse(opt.params) : {}
console.log('🚀 ~ onLoad ~ queryParams.value:', queryParams.value)
})
onShow(() => {
console.log(queryParams.value)
// getCodeDetailData(queryParams.value.id, queryParams.value.publishTask, queryParams.value.typeId) //
})
//
const getCodeDetailData = async (id, publishTask, typeId) => {
console.log('yyyyyyyyyy', id, publishTask, typeId)
const res = await getCodeDetailAPI({ id: id, publishTask: publishTask, typeId: typeId })
console.log('zzzzzzzzz', res)
formData.value = res.data
console.log('xxxxxxxxxxxxxx', formData.value, maxNum.value)
// maxNum.value = formData.value.preNum - formData.value.alNum
queryCodeParams.value.typeId = queryParams.value.typeId
queryCodeParams.value.pageNum = 1
codeDeviceList.value = []
getCodeDeviceListData() //
}
//
const getCodeDeviceListData = async () => {
const res = await getCodeDeviceListAPI(queryCodeParams.value)
console.log('🚀 ~ getCodeDeviceListData ~ res:', res)
codeDeviceList.value.push(...res.data)
if (codeDeviceList.value.length > 0) {
codeDeviceList.value = codeDeviceList.value.map((e) => {
return { ...e, checked: false }
})
}
total.value = res.total
}
//
const onCodeSearch = () => {
queryCodeParams.value.pageNum = 1
codeDeviceList.value = []
getCodeDeviceListData()
}
//
const onScrollTolower = debounce(() => {
// console.log('--')
if (total.value > codeDeviceList.value.length) {
queryCodeParams.value.pageSize += 10
getCodeDeviceListData()
}
}, 500)
// <EFBFBD><EFBFBD>
const finish = computed(() => {
if (total.value === codeDeviceList.value.length) return true
})
//
const onChangeChecked = (item) => {
item.checked = !item.checked
}
//
// const isSelectNum = computed(() => {
// const isSelectList = codeDeviceList.value.filter((e) => e.checked === true)
// if (maxNum.value === isSelectList.length) {
// uni.showToast({
// title: '',
// icon: 'none',
// })
// }
// return isSelectList.length
// })
//
const onHandleOutbound = async () => {
// const isSelect = codeDeviceList.value.some((e) => e.checked === true)
// if (!isSelect) {
// uni.showToast({
// title: '',
// icon: 'none',
// })
// return
// }
//
const { typeId, parentId, publishTask } = queryParams.value
//
const paramsList = []
codeDeviceList.value.map((e) => {
if (e.checked) {
paramsList.push({
leaseType: 0,
maId: e.maId,
maCode: e.maCode,
manageType: 0,
outNum: 1,
parentId,
typeId,
publishTask,
})
}
})
console.log('mmmmmmmmmmmmmmmm', paramsList)
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
if (res.code === 200) {
uni.showToast({
title: '出库成功!',
icon: 'none',
})
getCodeDetailData(queryParams.value.id, queryParams.value.publishTask, queryParams.value.typeId) //
}
}
//
const boxScan = async () => {
if (maxNum.value == 0) {
uni.showToast({
title: '待出库数量已为0',
icon: 'none',
})
} else {
boxCode.value = ''
var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
mpaasScanModule.mpaasScan(
{
// qrCodebarCode
scanType: ['qrCode', 'barCode'],
// false
hideAlbum: false,
//ios zh-Hansen
language: 'en',
//(ios)
failedMsg: '未识别到二维码,请重试',
//Android
screenType: 'full',
},
(ret) => {
if (ret.resp_code == 10) {
uni.showToast({ title: '用户取消', icon: 'none' })
}
if (ret.resp_code == 11) {
uni.showToast({ title: '扫码失败', icon: 'none' })
}
if (ret.resp_code == 1000) {
boxCode.value = ret.resp_result
if (boxCode.value == '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
boxOut()
}
}
},
)
}
}
//
const boxOut = async () => {
console.log(queryParams)
if (boxCode.value == '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
let param = {
boxCode: boxCode.value,
maTypeId: queryParams.value.typeId,
}
console.log(param)
const res = await getBoxBindByCode(param)
console.log(res)
if (res.code == 200) {
boxInfo.value = res.data
if (boxInfo.value.recordList && boxInfo.value.recordList.length > 0) {
if (boxInfo.value.recordList.length > maxNum.value) {
uni.showToast({ title: '标准箱绑定设备数量多于待出库数量!', icon: 'none' })
} else {
uni.showModal({
title: '提示',
content: boxInfo.value.msg,
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (res.confirm) {
boxOutBound()
}
},
})
}
} else {
uni.showToast({ title: '标准箱未绑定设备!', icon: 'none' })
}
} else {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
}
}
}
//
const boxOutBound = async () => {
//
const { typeId, parentId } = queryParams.value
//
const paramsList = []
boxInfo.value.recordList.map((e) => {
paramsList.push({
leaseType: 0,
boxId: e.boxId,
maId: e.maId,
maCode: e.maCode,
manageType: 0,
outType: 3, // 0123
outNum: 1,
parentId,
typeId,
})
})
console.log(paramsList)
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
if (res.code === 200) {
uni.showToast({
title: '出库成功!',
icon: 'none',
})
getCodeDetailData(queryParams.value.id, queryParams.value.publishTask, queryParams.value.typeId) //
}
}
//
const onCodeIdentify = () => {
console.log('编码识别--')
if (maxNum.value == 0) {
uni.showToast({
title: '待出库数量已为0',
icon: 'none',
})
} else {
uni.navigateTo({
url: `/pages/picking/outbound/codeOutScan?queryParams=${JSON.stringify(queryParams.value)}`,
})
}
}
//
const scanStart = () => {
// if (scanQrCodeRef.value) {
// scanQrCodeRef.value.scanQrCode()
// }
//
uni.scanCodde({
success: (res) => {
console.log('🚀 ~ scanStart ~ res:', res)
},
})
}
//
const handleScanSuccess = (result) => {
qrCodeScan.value = result
if (qrCodeScan.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
getMaInfoScan()
}
}
//
const handleScanError = (error) => {
console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' })
}
//
const getMaInfoScan = async () => {
let param = {
qrCode: qrCodeScan.value,
}
const res = await getCodeScanAPI(param)
console.log(res)
if (res.code == 200) {
if (res.data && res.data.recordList.length > 0) {
codeData.value = res.data.recordList[0]
confirmCodeOutBound()
// uni.showModal({
// title: '',
// content: `${qrCodeScan.value}${res.data.recordList[0].maCode}?`,
// confirmText: '',
// cancelText: '',
// success: async (res) => {
// if (res.confirm) {
// confirmCodeOutBound()
// }
// }
// })
} else {
uni.showToast({ title: res.data.msg, icon: 'none' })
}
} else {
uni.showToast({ title: res.data.msg, icon: 'none' })
}
}
//
const confirmCodeOutBound = async () => {
//
const { typeId, parentId } = queryParams.value
//
const paramsList = []
paramsList.push({
leaseType: 0,
maId: codeData.value.maId,
maCode: codeData.value.maCode,
manageType: 0,
// 0123
outType: 2,
outNum: 1,
parentId,
typeId,
typeName: codeData.value.typeName,
typeModelName: codeData.value.typeModelName,
})
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
console.log('333333333333', res)
if (res.code === 200) {
uni.showToast({
title: '出库成功!',
icon: 'none',
})
getCodeDetailData(queryParams.value.id, queryParams.value.publishTask, queryParams.value.typeId) //
setTimeout(() => {
scanStart()
}, 800)
}
}
</script>
<style lang="scss" scoped>
.flex {
display: flex;
align-items: center;
}
.btn-del {
background: red;
color: #fff;
text-align: center;
border-radius: 5px;
line-height: 1.8;
}
.page-container {
display: flex;
height: 100%;
flex-direction: column;
background-color: #f7f8fa;
padding: 24rpx;
.table-list-item {
background: #fff;
padding: 32rpx;
border-radius: 20rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
margin-bottom: 24rpx;
//
:deep(.uni-forms) {
.uni-forms-item {
margin-bottom: 24rpx;
padding: 0;
&:last-child {
margin-bottom: 0;
}
.uni-forms-item__label {
color: #8c8c8c;
font-size: 28rpx;
font-weight: 500;
padding: 0;
line-height: 1.8;
}
.uni-forms-item__content {
display: flex;
align-items: center;
min-height: unset;
}
}
}
//
.coding-btn {
padding: 16rpx 0;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
border-radius: 12rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: scale(0.98);
opacity: 0.9;
}
//
&.search-btn {
padding: 12rpx 0;
background: #fff;
color: #ff9800;
border: 2rpx solid rgba(255, 152, 0, 0.5);
background: linear-gradient(to bottom, rgba(255, 152, 0, 0.05), rgba(255, 152, 0, 0.1));
box-shadow: none;
font-weight: 600;
letter-spacing: 1rpx;
&:active {
background: rgba(255, 152, 0, 0.15);
border-color: rgba(255, 152, 0, 0.6);
transform: translateY(1rpx);
}
}
}
//
:deep(.uni-row) {
margin-bottom: 20rpx;
&:last-child {
margin-bottom: 0;
}
.uni-col-6 {
color: #8c8c8c;
font-size: 28rpx;
font-weight: 500;
}
.cont {
color: #262626;
font-size: 28rpx;
font-weight: 500;
line-height: 1.8;
}
}
//
:deep(.uni-easyinput__content) {
background-color: #f7f8fa;
border: 2rpx solid #e8e8e8;
border-radius: 12rpx;
height: 80rpx;
transition: all 0.3s ease;
&:focus-within {
border-color: #3784fb;
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
}
.uni-easyinput__content-input {
font-size: 28rpx;
color: #262626;
}
}
//
:deep(checkbox) {
.wx-checkbox-input {
width: 36rpx;
height: 36rpx;
border-radius: 8rpx;
border: 2rpx solid #e8e8e8;
background: transparent;
&.wx-checkbox-input-checked {
background: #3784fb;
border-color: #3784fb;
&::before {
font-size: 28rpx;
color: #fff;
}
}
&.wx-checkbox-input-disabled {
background: #f5f5f5;
border-color: #e8e8e8;
}
}
}
}
//
.outbound-btn {
position: fixed;
bottom: 40rpx;
left: 50%;
transform: translateX(-50%);
width: 90%;
height: 88rpx;
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
text-align: center;
line-height: 88rpx;
color: #fff;
border-radius: 12rpx;
font-size: 32rpx;
font-weight: 600;
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
transition: all 0.3s ease;
&:active {
transform: translateX(-50%) scale(0.98);
opacity: 0.9;
}
}
}
//
.loading-text {
text-align: center;
font-size: 26rpx;
color: #8c8c8c;
padding: 32rpx 0;
letter-spacing: 1rpx;
}
.form-section {
background: #fff;
border-radius: 20rpx;
margin-bottom: 24rpx;
overflow: hidden;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
//
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 32rpx;
background: #fff;
cursor: pointer;
transition: all 0.3s ease;
&:active {
background: #f7f8fa;
}
.title {
font-size: 32rpx;
font-weight: 600;
color: #262626;
}
.toggle-icon {
font-size: 40rpx;
color: #8c8c8c;
transform: rotate(90deg);
transition: transform 0.3s ease;
display: inline-block;
&.is-expanded {
transform: rotate(-90deg);
}
}
}
//
.form-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
&.is-expanded {
max-height: 1000rpx; //
}
:deep(.uni-forms) {
padding: 0 32rpx 32rpx;
}
:deep(.uni-forms-item) {
margin-bottom: 24rpx;
&:last-child {
margin-bottom: 0;
}
.uni-forms-item__label {
color: #8c8c8c;
}
.form-view {
color: #262626;
font-size: 28rpx;
}
}
}
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
title="数量出库"
@clickLeft="back"
/>
<div class="content">
<div class="card">
<div class="item">
领料班组
<span>{{ opts.teamName }}</span>
</div>
<div class="item">
领料工程
<span>{{ opts.projectName }}</span>
</div>
<div class="item">
物资类型
<span>{{ opts.maTypeName }}</span>
</div>
<div class="item">
规格型号
<span>{{ opts.typeName }}</span>
</div>
<div class="item">
单位
<span>{{ opts.unitName }}</span>
</div>
<div class="item">
库存数量
<span>{{ opts.projectName }}</span>
</div>
<div class="item">
已领数量
<span>{{ opts.outNum }}</span>
</div>
<div class="item" style="display: flex; align-items: center">
出库数量
<uni-easyinput
v-model="outNum"
type="number"
placeholder="请输入"
:clearable="false"
style="margin-right: 5px"
@blur="handleOutNum"
/>
</div>
<button
style="
width: 80%;
margin: 50px auto;
display: flex;
justify-content: center;
background: #67c23a;
"
size="mini"
type="primary"
@click="submit"
>
</button>
</div>
</div>
</template>
<script setup>
import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue'
import { leaseOutApi } from '@/services/back.js'
const opts = ref({})
const outNum = ref(1)
//
const handleOutNum = () => {
// 1
if (!/^[1-9]\d*$/.test(outNum.value)) {
uni.showToast({
icon: 'none',
title: '请输入正确的数量',
})
// 1
outNum.value = 1
}
}
const submit = () => {
//
uni.showModal({
title: '提示',
content: '确定要执行此操作吗?',
success: async (res) => {
try {
const params = {
leaseOutDetailsList: [{ ...opts.value, outNum: outNum.value, isApp: 0 }],
}
console.log('🚀 ~ submit ~ params:', params)
await leaseOutApi(params)
//
uni.showToast({
icon: 'none',
title: '出库成功',
})
back()
} catch (error) {
console.log('🚀 ~ submit ~ error:', error)
}
},
})
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((opt) => {
console.log('🚀 ~ onLoad ~ 出库:', opt)
opts.value = opt.params ? JSON.parse(opt.params) : {}
})
</script>
<style lang="scss" scoped>
.content {
padding: 10px;
.card {
padding: 8px;
background: #fafafa;
border-radius: 6px;
.item {
line-height: 1.9;
}
}
}
</style>

View File

@ -196,9 +196,23 @@ const onClickSwipe = (e, item) => {
//
const leaseOut = (item) => {
console.log('🚀 ~ leaseOut ~ item:', item)
// uni.navigateTo({
// url: `/pages/toolsLease/toolsLeaseOut?params=${JSON.stringify(item)}`,
// })
if (opts.value.isOut && item.taskStatus == 1) {
const params = JSON.stringify({
id: item.id,
projectId: item.projectId,
projectName: item.projectName,
teamId: item.teamId,
teamName: item.teamName,
})
uni.navigateTo({
url: `/pages/toolsLease/toolsLeaseOut?params=${params}`,
})
} else {
uni.showToast({
title: '已完成出库',
icon: 'none',
})
}
}
//

View File

@ -23,6 +23,7 @@
</uni-forms-item>
<uni-forms-item label="领用工程" required name="projectId">
<eselect
v-if="!opts.isEdit"
style="width: 100%; height: 90rpx"
v-model="formData.projectId"
ref="treeSelect"
@ -35,6 +36,7 @@
}
"
></eselect>
<uni-easyinput v-else v-model="formData.projectName" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="领料人" required name="leasePerson">
<uni-easyinput v-model="formData.leasePerson" placeholder="请输入内容"></uni-easyinput>
@ -116,7 +118,7 @@ import {
getTypeTreeList,
addLeaseTask,
editLeaseTask,
detailsLeaseTask
detailsLeaseTask,
} from '@/services/back.js'
const title = ref('工器具领料申请')
@ -124,7 +126,7 @@ const opts = ref({})
const form = ref()
const formData = reactive({
teamId: undefined,
projectId: '',
projectId: undefined,
leasePerson: '',
phone: '',
})
@ -157,7 +159,6 @@ const getDetailsById = async () => {
Object.assign(formData, res.data.leaseApplyInfo)
} catch (error) {
console.log('🚀 ~ getDetailsById ~ error:', error)
}
}
//
@ -323,9 +324,13 @@ const submit = () => {
const res = await editLeaseTask(params)
back()
}
//
uni.showToast({
icon: 'none',
title: '操作成功',
})
} catch (error) {
console.log('🚀 ~ .then ~ error:', error)
}
})
.catch((err) => {

View File

@ -0,0 +1,143 @@
<template>
<uni-nav-bar
dark
:fixed="true"
shadow
background-color="#4AA4EA"
status-bar
left-icon="left"
left-text="返回"
title="工器具出库"
@clickLeft="back"
/>
<div class="content">
<div class="df">
<uni-easyinput
v-model="queryParams.keyword"
placeholder="请输入内容"
style="margin-right: 5px"
/>
<button size="mini" style="background-color: #f0a037; color: #fff" @click="getDetailsById">
查询
</button>
</div>
<div class="df-btn">
<button class="btn" size="mini" type="primary" @click="">新增数量出库</button>
<button class="btn" size="mini" type="primary" @click="">新增编码出库</button>
</div>
<div
class="table-box"
v-for="(item, index) in tableList"
:key="index"
@click="handleItem(item)"
>
<div style="margin-right: 6px">{{ index + 1 }}.</div>
<div>
<div>
工器具名称<span style="color: red">{{ item.maTypeName }}</span>
</div>
<div>规格型号{{ item.typeName }}</div>
<div>预领数量{{ item.preNum }}</div>
<div>已领数量{{ item.alNum }}</div>
<div>
待领数量<span style="color: red">{{ item.outNum }}</span>
</div>
<div>单位{{ item.unitName }}</div>
<div>管理模式{{ item.manageType == 0 ? '编码' : '数量' }}</div>
<div>
状态<span v-if="item.status == 0" style="color: red">未完成</span>
<span v-else style="color: #67c23a">已完成</span>
</div>
</div>
</div>
<div style="display: flex; justify-content: center; align-items: center; height: 50px">
{{ '没有更多数据了~' }}
</div>
</div>
</template>
<script setup>
import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue'
import { getOutNum } from '@/services/back.js'
const opts = ref({})
const queryParams = reactive({
id: '',
keyword: '',
})
const tableList = ref([])
//
const getDetailsById = async () => {
try {
const res = await getOutNum(queryParams)
tableList.value = res.data
console.log('🚀 ~ getDetailsById ~ tableList.value:', tableList.value)
} catch (error) {
console.log('🚀 ~ getDetailsById ~ error:', error)
}
}
//
const handleItem = (item) => {
console.log('🚀 ~ handleItem ~ item:', item.manageType)
if (item.status != '0') {
uni.showToast({
title: '已完成出库',
icon: 'none',
})
return
}
item = Object.assign(opts.value, item)
if (item.manageType == 1) {
uni.navigateTo({
url: '/pages/toolsLease/numOut?params=' + JSON.stringify(item),
})
} else {
uni.navigateTo({
url: '/pages/toolsLease/codeOut?params=' + JSON.stringify(item),
})
}
}
const back = () => {
uni.navigateBack({
delta: 1,
})
}
onLoad((opt) => {
console.log('🚀 ~ onLoad ~ 出库:', opt)
opts.value = opt.params ? JSON.parse(opt.params) : {}
console.log('🚀 ~ onLoad ~ opts.value:', opts.value)
queryParams.id = opts.value.id
})
onShow(() => {
setTimeout(() => {
getDetailsById()
}, 300)
})
</script>
<style lang="scss" scoped>
.content {
padding: 10px;
}
.df {
display: flex;
align-items: center;
}
.df-btn {
display: flex;
align-items: center;
justify-content: space-between;
.btn {
width: 40%;
margin: 10px 0;
}
}
.table-box {
padding: 8px;
display: flex;
background-color: #fafafa;
margin-bottom: 10px;
border-radius: 6px;
}
</style>

View File

@ -296,4 +296,22 @@ export const getTypeTreeList = (data) => {
url: '/material/ma_type/equipmentType',
data,
})
}
// 工机具出库详情-列表
export const getOutNum = (data) => {
return http({
method: 'GET',
url: '/material/lease_apply_info/getOutNum',
data,
})
}
// 工具出库-编码/数量
export const leaseOutApi = (data) => {
return http({
method: 'POST',
url: '/material/lease_apply_info/leaseOut',
data,
})
}