材料站领料退料

This commit is contained in:
hongchao 2025-09-22 20:04:53 +08:00
parent 42448a64fe
commit 68dcfd5116
5 changed files with 50 additions and 35 deletions

View File

@ -71,14 +71,14 @@ const isUsingList = ref([
{ path: 'toolsLease', name: '班组预领申请', src: 'lease', isShow: true }, { path: 'toolsLease', name: '班组预领申请', src: 'lease', isShow: true },
{ path: 'toolsOut', name: '材料站出库', src: 'outStore', isShow: true }, { path: 'toolsOut', name: '材料站出库', src: 'outStore', isShow: true },
{ path: 'toolsBack', name: '退料', src: 'back', isShow: true }, { path: 'toolsBack', name: '退料', src: 'back', isShow: true },
{ path: 'toolsLedger', name: '台账', src: 'ledger', isShow: true }, { path: 'equipmentRecord', name: '站内库存台账', src: 'ledger', isShow: true },
// { path: 'toolsLedger', name: '', src: 'ledger', isShow: true },
{ path: 'teamLeaseRecord', name: '班组领料记录', src: 'teamLease', isShow: true }, { path: 'teamLeaseRecord', name: '班组领料记录', src: 'teamLease', isShow: true },
{ path: 'teamBackRecord', name: '班组退料记录', src: 'teamBack', isShow: true }, { path: 'teamBackRecord', name: '班组退料记录', src: 'teamBack', isShow: true },
{ path: 'teamStore', name: '班组库存', src: 'teamStore', isShow: true }, { path: 'teamStore', name: '班组库存', src: 'teamStore', isShow: true },
{ path: 'teamWarning', name: '班组预警', src: 'teamWarning', isShow: true }, { path: 'teamWarning', name: '班组预警', src: 'teamWarning', isShow: true },
{ path: 'authorizeSignature', name: '项目部授权', src: 'authorizeSignature', isShow: true }, { path: 'authorizeSignature', name: '项目部授权', src: 'authorizeSignature', isShow: true },
{ path: 'materialClerkConfirms', name: '领料确认', src: 'outStore', isShow: true }, { path: 'materialClerkConfirms', name: '领料确认', src: 'outStore', isShow: true },
{ path: 'equipmentRecord', name: '站内库存台账', src: 'ledger', isShow: true },
]) ])
const userAgent = navigator.userAgent.toLowerCase() const userAgent = navigator.userAgent.toLowerCase()

View File

@ -151,12 +151,12 @@ const formData = reactive({
projectId: '', projectId: '',
backPerson: '', backPerson: '',
phone: '', phone: '',
agreementId: undefined, agreementIds:[],
remark: undefined, remark: undefined,
isBack: 1, isBack: 1,
remark: '', remark: '',
}) })
const agreementId = ref('') const agreementIds = ref('')
const equipmentId = ref() const equipmentId = ref()
const teamRange = ref([]) // const teamRange = ref([]) //
const prodRange = ref([]) // const prodRange = ref([]) //
@ -242,17 +242,17 @@ const getAgreement = () => {
getAgreementInfoByIdBackApi(obj) getAgreementInfoByIdBackApi(obj)
.then((res) => { .then((res) => {
console.log(res) console.log(res)
if (res.code == 200) { if (res.code == 200 && res.data && res.data.length>0) {
agreementId.value = res.data.agreementId agreementIds.value = res.data.map(item => item.agreementId)
formData.agreementId = res.data.agreementId formData.agreementIds = res.data.map(item => item.agreementId)
getEquipmentList() getEquipmentList()
} else { } else {
agreementId.value = '' agreementIds.value = ''
formData.agreementId = '' formData.agreementIds = ''
} }
}) })
.catch((error) => { .catch((error) => {
formData.agreementId = '' formData.agreementIds = ''
console.log(error) console.log(error)
}) })
} }
@ -260,7 +260,7 @@ const getAgreement = () => {
const getEquipmentList = async () => { const getEquipmentList = async () => {
try { try {
let obj = { let obj = {
agreementId: agreementId.value, agreementIds: agreementIds.value,
} }
const res = await getUseTypeTree(obj) const res = await getUseTypeTree(obj)
// machineList.value = res.data // machineList.value = res.data
@ -366,6 +366,7 @@ const changeEquipment = (e) => {
setTimeout(() => { setTimeout(() => {
equipmentId.value = '' equipmentId.value = ''
}, 300) }, 300)
console.log('xxxxxxxxxxxxxxxxx:', tableData.value)
} }
// id // id
function findEquipmentById(list, id) { function findEquipmentById(list, id) {
@ -417,15 +418,21 @@ const submit = (isBack) => {
} }
// tableData.value preNum 0, 0 // tableData.value preNum 0, 0
for (let i = 0; i < tableData.value.length; i++) { for (let i = 0; i < tableData.value.length; i++) {
console.log('🚀 ~ .then ~ tableData.value[i].preNum:', tableData.value[i].preNum) console.log('🚀yyyyyyyyyyyyyyyyyyy:', tableData.value[i].unitValue)
if (tableData.value[i].preNum < 1) { if (tableData.value[i].preNum < 1 && tableData.value[i].unitValue == 0 ) {
await uni.showToast({ await uni.showToast({
title: `${i + 1}行退料数量不能为0`, title: `${i + 1}行退料数量不能为0`,
icon: 'none', icon: 'none',
duration: 1000, duration: 1000,
}) })
return return
} else if (tableData.value[i].preNum > tableData.value[i].num) { }else if(tableData.value[i].preNum <= 0 && tableData.value[i].unitValue == 1){
await uni.showToast({
title: `${i + 1}行退料数量不能为0`,
icon: 'none',
duration: 1000,
})
}else if (tableData.value[i].preNum > tableData.value[i].num) {
await uni.showToast({ await uni.showToast({
title: `${i + 1}行退料数量不能大于在用数量`, title: `${i + 1}行退料数量不能大于在用数量`,
icon: 'none', icon: 'none',
@ -450,7 +457,7 @@ const submit = (isBack) => {
backApplyDetailsList: tableData.value, backApplyDetailsList: tableData.value,
backApplyInfo: formData, backApplyInfo: formData,
} }
console.log('🚀 ~ .then ~ params:', params) console.log('🚀 yyyyyyyyyyy:', params)
uni.showLoading({ uni.showLoading({
title: '提交中...', title: '提交中...',
}) })

View File

@ -95,7 +95,7 @@
<script setup> <script setup>
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { ref, reactive, computed } from 'vue' import { ref, reactive, computed } from 'vue'
import { getPickingOutboundListAPI, deleteLeaseApplyApi } from '@/services/materialsStation' import { getPickingOutboundListAPI, deleteLeaseApplyApiTwo } from '@/services/materialsStation'
const title = ref('工器具领料') const title = ref('工器具领料')
const opts = ref() const opts = ref()
@ -123,6 +123,7 @@ const back = () => {
const add = () => { const add = () => {
const params = JSON.stringify({ const params = JSON.stringify({
isOut: opts.value.isOut, isOut: opts.value.isOut,
isEdit: false,
title: opts.value.isOut ? '工器具出库' : '工器具领料', title: opts.value.isOut ? '工器具出库' : '工器具领料',
}) })
uni.navigateTo({ uni.navigateTo({
@ -249,7 +250,7 @@ const deleteItem = (item) => {
content: '确定删除吗?', content: '确定删除吗?',
success: (res) => { success: (res) => {
if (res.confirm) { if (res.confirm) {
deleteLeaseApplyApi([item.id]) deleteLeaseApplyApiTwo({id: item.id})
.then((res) => { .then((res) => {
console.log('🚀 ~ .then ~ res:', res) console.log('🚀 ~ .then ~ res:', res)
if (res.code == 200) { if (res.code == 200) {

View File

@ -20,27 +20,21 @@
<uni-forms ref="form" :rules="rules" :model="formData" label-width="90px"> <uni-forms ref="form" :rules="rules" :model="formData" label-width="90px">
<uni-forms-item label="领用工程" required name="proId"> <uni-forms-item label="领用工程" required name="proId">
<uni-data-select <uni-data-select
v-if="!opts.isEdit"
v-model="formData.proId" v-model="formData.proId"
:localdata="prodRange" :localdata="prodRange"
:clear="false" :clear="false"
filterable filterable
:disabled="opts.isEdit"
@change="changeProd" @change="changeProd"
></uni-data-select> ></uni-data-select>
<uni-easyinput v-else v-model="formData.projectName" disabled></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="领料班组" required name="teamId"> <uni-forms-item label="领料班组" required name="teamId">
<uni-data-select <uni-data-select
v-if="!opts.isEdit"
v-model="formData.teamId" v-model="formData.teamId"
:localdata="teamRange" :localdata="teamRange"
filterable filterable
:clear="false" :clear="false"
:disabled="opts.isEdit"
@change="changeTeamd" @change="changeTeamd"
></uni-data-select> ></uni-data-select>
<uni-easyinput v-else v-model="formData.teamName" disabled></uni-easyinput>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="班组长" required name="leasePerson"> <uni-forms-item label="班组长" required name="leasePerson">
<uni-easyinput <uni-easyinput
@ -277,10 +271,11 @@ const getDetailsById = async () => {
item.maCodeList = item.maCodeVoList || item.maCodeList || [] item.maCodeList = item.maCodeVoList || item.maCodeList || []
}) })
Object.assign(formData, res.data.leaseApplyInfo) Object.assign(formData, res.data.leaseApplyInfo)
formData.projectId = res.data.leaseApplyInfo.proId
formData.proId = res.data.leaseApplyInfo.proId formData.proId = res.data.leaseApplyInfo.proId
formData.projectId = prodRange.value.find(item => item.proId == res.data.leaseApplyInfo.proId)?.projectId
formData.relPhone = res.data.leaseApplyInfo.phone || res.data.leaseApplyInfo.relPhone || '' formData.relPhone = res.data.leaseApplyInfo.phone || res.data.leaseApplyInfo.relPhone || ''
getAgreementInfoById() await getTeamList()
await getAgreementInfoById()
} catch (error) { } catch (error) {
console.log('🚀 ~ getDetailsById ~ error:', error) console.log('🚀 ~ getDetailsById ~ error:', error)
} finally { } finally {
@ -331,7 +326,7 @@ const getTeamList = async () => {
formData.subUnitName = res.data[0].subUnitName || '' formData.subUnitName = res.data[0].subUnitName || ''
} }
// getProjectListApi() // getProjectListApi()
getAgreementInfoById() // getAgreementInfoById()
} }
} catch (error) { } catch (error) {
console.log('🚀 ~ getTeamList ~ error:', error) console.log('🚀 ~ getTeamList ~ error:', error)
@ -365,8 +360,8 @@ const getAgreementInfoById = async () => {
} }
const res = await getAgreementInfoByIdApi(params) const res = await getAgreementInfoByIdApi(params)
console.log('🚀 ~ getAgreementInfoById ~ res:', res) console.log('🚀 ~ getAgreementInfoById ~ res:', res)
if (!res.data || !Array.isArray(res.data)) { if (!res.data) {
equipmentList = [] equipmentList.value = []
return return
} }
const agreementId = res.data const agreementId = res.data
@ -384,7 +379,7 @@ const getEquipmentList = async (params) => {
}) })
try { try {
const res = await getTypeTreeList({ agreementIdList: params, proId: formData.proId, teamName: formData.teamName }) const res = await getTypeTreeList({ agreementIdList: params, proId: formData.proId, teamName: formData.teamName })
if (res.data.length > 0) { if (res.data) {
equipmentList.value = formatEquipmentTree(res.data) equipmentList.value = formatEquipmentTree(res.data)
console.log('🚀 ~ getEquipmentList ~ machineList.value:', equipmentList.value) console.log('🚀 ~ getEquipmentList ~ machineList.value:', equipmentList.value)
} }
@ -468,14 +463,14 @@ const changeTeamd = (e) => {
getAgreementInfoById() getAgreementInfoById()
} }
// //
const changeProd = (e) => { const changeProd = async (e) => {
console.log('🚀 ~ changeProd ~ e:', e) console.log('🚀 ~ changeProd ~ e:', e)
formData.proId = e formData.proId = e
formData.projectId = prodRange.value.find(item => item.proId === e)?.projectId formData.projectId = prodRange.value.find(item => item.proId == e)?.projectId
console.log("xxxxxxxxxxxxxxxxxxxxxx",formData.projectId) console.log("xxxxxxxxxxxxxxxxxxxxxx",formData.projectId)
equipmentList.value = [] tableData.value = []
// getAgreementInfoById() await getTeamList()
getTeamList() await getAgreementInfoById()
} }
// //
const changeEquipment = (e) => { const changeEquipment = (e) => {
@ -659,7 +654,10 @@ onLoad((opt) => {
opts.value = opt.params ? JSON.parse(opt.params) : {} opts.value = opt.params ? JSON.parse(opt.params) : {}
title.value = opts.value.title title.value = opts.value.title
if (opts.value.isEdit) { if (opts.value.isEdit) {
getDetailsById() getProjectListApi().then(() => {
getDetailsById()
})
} else { } else {
// getTeamList() // getTeamList()
getProjectListApi() getProjectListApi()

View File

@ -73,6 +73,15 @@ export const deleteLeaseApplyApi = (id) => {
}) })
} }
// 删除
export const deleteLeaseApplyApiTwo = (data = {}) => {
return http({
method: 'POST',
url: '/material/material_lease_apply_info/delete',
data,
})
}
// 工程下拉选 // 工程下拉选
export const getProjectList = (data = {}) => { export const getProjectList = (data = {}) => {
return http({ return http({