材料站领料退料
This commit is contained in:
parent
42448a64fe
commit
68dcfd5116
|
|
@ -71,14 +71,14 @@ const isUsingList = ref([
|
|||
{ path: 'toolsLease', name: '班组预领申请', src: 'lease', isShow: true },
|
||||
{ path: 'toolsOut', name: '材料站出库', src: 'outStore', 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: 'teamBackRecord', name: '班组退料记录', src: 'teamBack', isShow: true },
|
||||
{ path: 'teamStore', name: '班组库存', src: 'teamStore', isShow: true },
|
||||
{ path: 'teamWarning', name: '班组预警', src: 'teamWarning', isShow: true },
|
||||
{ path: 'authorizeSignature', name: '项目部授权', src: 'authorizeSignature', isShow: true },
|
||||
{ path: 'materialClerkConfirms', name: '领料确认', src: 'outStore', isShow: true },
|
||||
{ path: 'equipmentRecord', name: '站内库存台账', src: 'ledger', isShow: true },
|
||||
])
|
||||
|
||||
const userAgent = navigator.userAgent.toLowerCase()
|
||||
|
|
|
|||
|
|
@ -151,12 +151,12 @@ const formData = reactive({
|
|||
projectId: '',
|
||||
backPerson: '',
|
||||
phone: '',
|
||||
agreementId: undefined,
|
||||
agreementIds:[],
|
||||
remark: undefined,
|
||||
isBack: 1,
|
||||
remark: '',
|
||||
})
|
||||
const agreementId = ref('')
|
||||
const agreementIds = ref('')
|
||||
const equipmentId = ref()
|
||||
const teamRange = ref([]) // 班组
|
||||
const prodRange = ref([]) // 工程
|
||||
|
|
@ -242,17 +242,17 @@ const getAgreement = () => {
|
|||
getAgreementInfoByIdBackApi(obj)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
agreementId.value = res.data.agreementId
|
||||
formData.agreementId = res.data.agreementId
|
||||
if (res.code == 200 && res.data && res.data.length>0) {
|
||||
agreementIds.value = res.data.map(item => item.agreementId)
|
||||
formData.agreementIds = res.data.map(item => item.agreementId)
|
||||
getEquipmentList()
|
||||
} else {
|
||||
agreementId.value = ''
|
||||
formData.agreementId = ''
|
||||
agreementIds.value = ''
|
||||
formData.agreementIds = ''
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
formData.agreementId = ''
|
||||
formData.agreementIds = ''
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ const getAgreement = () => {
|
|||
const getEquipmentList = async () => {
|
||||
try {
|
||||
let obj = {
|
||||
agreementId: agreementId.value,
|
||||
agreementIds: agreementIds.value,
|
||||
}
|
||||
const res = await getUseTypeTree(obj)
|
||||
// machineList.value = res.data
|
||||
|
|
@ -366,6 +366,7 @@ const changeEquipment = (e) => {
|
|||
setTimeout(() => {
|
||||
equipmentId.value = ''
|
||||
}, 300)
|
||||
console.log('xxxxxxxxxxxxxxxxx:', tableData.value)
|
||||
}
|
||||
// 递归查找指定 id 的节点
|
||||
function findEquipmentById(list, id) {
|
||||
|
|
@ -417,14 +418,20 @@ const submit = (isBack) => {
|
|||
}
|
||||
// tableData.value 循环 preNum 不能小于 0, 小于0的提示到具体行
|
||||
for (let i = 0; i < tableData.value.length; i++) {
|
||||
console.log('🚀 ~ .then ~ tableData.value[i].preNum:', tableData.value[i].preNum)
|
||||
if (tableData.value[i].preNum < 1) {
|
||||
console.log('🚀yyyyyyyyyyyyyyyyyyy:', tableData.value[i].unitValue)
|
||||
if (tableData.value[i].preNum < 1 && tableData.value[i].unitValue == 0 ) {
|
||||
await uni.showToast({
|
||||
title: `第${i + 1}行退料数量不能为0`,
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
})
|
||||
return
|
||||
}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({
|
||||
title: `第${i + 1}行退料数量不能大于在用数量`,
|
||||
|
|
@ -450,7 +457,7 @@ const submit = (isBack) => {
|
|||
backApplyDetailsList: tableData.value,
|
||||
backApplyInfo: formData,
|
||||
}
|
||||
console.log('🚀 ~ .then ~ params:', params)
|
||||
console.log('🚀 yyyyyyyyyyy:', params)
|
||||
uni.showLoading({
|
||||
title: '提交中...',
|
||||
})
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import { getPickingOutboundListAPI, deleteLeaseApplyApi } from '@/services/materialsStation'
|
||||
import { getPickingOutboundListAPI, deleteLeaseApplyApiTwo } from '@/services/materialsStation'
|
||||
|
||||
const title = ref('工器具领料')
|
||||
const opts = ref()
|
||||
|
|
@ -123,6 +123,7 @@ const back = () => {
|
|||
const add = () => {
|
||||
const params = JSON.stringify({
|
||||
isOut: opts.value.isOut,
|
||||
isEdit: false,
|
||||
title: opts.value.isOut ? '工器具出库' : '工器具领料',
|
||||
})
|
||||
uni.navigateTo({
|
||||
|
|
@ -249,7 +250,7 @@ const deleteItem = (item) => {
|
|||
content: '确定删除吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
deleteLeaseApplyApi([item.id])
|
||||
deleteLeaseApplyApiTwo({id: item.id})
|
||||
.then((res) => {
|
||||
console.log('🚀 ~ .then ~ res:', res)
|
||||
if (res.code == 200) {
|
||||
|
|
|
|||
|
|
@ -20,27 +20,21 @@
|
|||
<uni-forms ref="form" :rules="rules" :model="formData" label-width="90px">
|
||||
<uni-forms-item label="领用工程" required name="proId">
|
||||
<uni-data-select
|
||||
v-if="!opts.isEdit"
|
||||
v-model="formData.proId"
|
||||
:localdata="prodRange"
|
||||
:clear="false"
|
||||
filterable
|
||||
:disabled="opts.isEdit"
|
||||
@change="changeProd"
|
||||
></uni-data-select>
|
||||
<uni-easyinput v-else v-model="formData.projectName" disabled></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料班组" required name="teamId">
|
||||
<uni-data-select
|
||||
v-if="!opts.isEdit"
|
||||
v-model="formData.teamId"
|
||||
:localdata="teamRange"
|
||||
filterable
|
||||
:clear="false"
|
||||
:disabled="opts.isEdit"
|
||||
@change="changeTeamd"
|
||||
></uni-data-select>
|
||||
<uni-easyinput v-else v-model="formData.teamName" disabled></uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="班组长" required name="leasePerson">
|
||||
<uni-easyinput
|
||||
|
|
@ -277,10 +271,11 @@ const getDetailsById = async () => {
|
|||
item.maCodeList = item.maCodeVoList || item.maCodeList || []
|
||||
})
|
||||
Object.assign(formData, res.data.leaseApplyInfo)
|
||||
formData.projectId = 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 || ''
|
||||
getAgreementInfoById()
|
||||
await getTeamList()
|
||||
await getAgreementInfoById()
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getDetailsById ~ error:', error)
|
||||
} finally {
|
||||
|
|
@ -331,7 +326,7 @@ const getTeamList = async () => {
|
|||
formData.subUnitName = res.data[0].subUnitName || ''
|
||||
}
|
||||
// getProjectListApi()
|
||||
getAgreementInfoById()
|
||||
// getAgreementInfoById()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getTeamList ~ error:', error)
|
||||
|
|
@ -365,8 +360,8 @@ const getAgreementInfoById = async () => {
|
|||
}
|
||||
const res = await getAgreementInfoByIdApi(params)
|
||||
console.log('🚀 ~ getAgreementInfoById ~ res:', res)
|
||||
if (!res.data || !Array.isArray(res.data)) {
|
||||
equipmentList = []
|
||||
if (!res.data) {
|
||||
equipmentList.value = []
|
||||
return
|
||||
}
|
||||
const agreementId = res.data
|
||||
|
|
@ -384,7 +379,7 @@ const getEquipmentList = async (params) => {
|
|||
})
|
||||
try {
|
||||
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)
|
||||
console.log('🚀 ~ getEquipmentList ~ machineList.value:', equipmentList.value)
|
||||
}
|
||||
|
|
@ -468,14 +463,14 @@ const changeTeamd = (e) => {
|
|||
getAgreementInfoById()
|
||||
}
|
||||
// 选择工程
|
||||
const changeProd = (e) => {
|
||||
const changeProd = async (e) => {
|
||||
console.log('🚀 ~ changeProd ~ e:', 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)
|
||||
equipmentList.value = []
|
||||
// getAgreementInfoById()
|
||||
getTeamList()
|
||||
tableData.value = []
|
||||
await getTeamList()
|
||||
await getAgreementInfoById()
|
||||
}
|
||||
// 选择工器具
|
||||
const changeEquipment = (e) => {
|
||||
|
|
@ -659,7 +654,10 @@ onLoad((opt) => {
|
|||
opts.value = opt.params ? JSON.parse(opt.params) : {}
|
||||
title.value = opts.value.title
|
||||
if (opts.value.isEdit) {
|
||||
getProjectListApi().then(() => {
|
||||
getDetailsById()
|
||||
})
|
||||
|
||||
} else {
|
||||
// getTeamList()
|
||||
getProjectListApi()
|
||||
|
|
|
|||
|
|
@ -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 = {}) => {
|
||||
return http({
|
||||
|
|
|
|||
Loading…
Reference in New Issue