项目部出库

This commit is contained in:
bb_pan 2025-09-27 15:05:59 +08:00
parent f1881049e5
commit ad900d3256
2 changed files with 138 additions and 50 deletions

View File

@ -810,6 +810,15 @@ export function getDepartListByImpUnitApi(query) {
})
}
// 项目部下拉-工程联动
export function getPickDepartListApi(query) {
return request({
url: '/material/material_maMachine/getPickDepartList',
method: 'get',
params: query
})
}
//工程下拉
export function getProListByDepartApi(query) {
return request({

View File

@ -1,6 +1,18 @@
<template>
<div>
<el-form :model="maForm" ref="maForm" size="small" :rules="rules" :inline="true" label-width="120px">
<el-form-item label="领用类型" prop="pickType" v-if="isView">
<el-select
v-model="maForm.pickType"
placeholder="请选择租赁工程"
filterable
style="width: 240px"
@change="changePickType"
>
<el-option label="班组" :value="0" />
<el-option label="项目部" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="租赁工程" prop="proId">
<el-select
v-model="maForm.proId"
@ -12,7 +24,24 @@
<el-option v-for="(item, index) in projectList" :key="index" :label="item.proName" :value="item.proId" />
</el-select>
</el-form-item>
<el-form-item label="领用班组" prop="teamId">
<el-form-item label="领用项目部" prop="departId" v-if="maForm.pickType == 1">
<el-select
v-model="maForm.departId"
placeholder="请选择项目部"
filterable
style="width: 240px"
@change="changePeoDept"
>
<el-option
v-for="(item, index) in proDeptList"
:key="index"
:label="item.departName"
:value="item.departId"
:data-key="item.departId"
/>
</el-select>
</el-form-item>
<el-form-item label="领用班组" prop="teamId" v-if="maForm.pickType == 0">
<el-select
v-model="maForm.teamId"
placeholder="请选择班组"
@ -26,11 +55,10 @@
:label="item.teamName"
:value="item.id"
:data-key="item.id"
@change="changeTeam"
/>
</el-select>
</el-form-item>
<el-form-item label="班组长" prop="leasePerson">
<el-form-item label="班组长" prop="leasePerson" v-if="maForm.pickType == 0">
<el-input
v-model="maForm.leasePerson"
placeholder="请输入班组长"
@ -67,7 +95,7 @@
/>
</el-form-item>
<el-form-item label="所属分包" prop="subUnitName">
<el-form-item label="所属分包" prop="subUnitName" v-if="maForm.pickType == 0">
<el-input
v-model="maForm.subUnitName"
:placeholder="maForm.subUnitName ? '请输入所属分包' : '暂无分包'"
@ -78,12 +106,7 @@
</el-form-item>
<el-form-item label="领料单号" prop="code">
<el-input
v-model="code"
placeholder="请输入领料单号"
clearable
style="width: 240px"
/>
<el-input v-model="code" placeholder="请输入领料单号" clearable style="width: 240px" />
</el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询单号</el-button>
@ -143,7 +166,7 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-truck" size="mini" @click="handleSave(1)"> </el-button>
</el-col>
<el-col :span="1.5">
<el-col :span="1.5" v-if="maForm.pickType == 0">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleSave(0)"> </el-button>
</el-col>
</el-row>
@ -164,7 +187,7 @@
controls-position="right"
style="width: 100%"
:min="0"
:precision="3"
:precision="scope.row.unitValue == 1 ? 3 : 0"
@change="
v =>
scope.row.unitValue == 1
@ -218,7 +241,9 @@ import {
getAgreement,
getBmTeamApi,
getListsByConfigId,
getStandardConfigList, getLeaseDataByCode
getStandardConfigList,
getLeaseDataByCode,
getPickDepartListApi
} from '@/api/materialsStation'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -272,6 +297,7 @@ export default {
},
//
uniteList: [],
proDeptList: [],
//
projectList: [],
//
@ -291,8 +317,11 @@ export default {
productionTime: ''
},
maForm: {
pickType: 0,
teamId: undefined,
teamName: '',
proDept: '',
proDeptName: '',
projectId: undefined,
projectName: '',
arrivalTime: '',
@ -304,7 +333,7 @@ export default {
proId: undefined,
relPhone: ''
},
code:'',
code: '',
standardConfigList: [],
//
form: {},
@ -321,6 +350,13 @@ export default {
trigger: 'blur'
}
],
departId: [
{
required: true,
message: '请选择项目部',
trigger: 'blur'
}
],
proId: [
{
required: true,
@ -389,7 +425,7 @@ export default {
this.projectInfoList().then(() => {
this.getTaskInfo()
})
} else if(this.isEdit && this.isView){
} else if (this.isEdit && this.isView) {
this.projectInfoList()
}
},
@ -447,9 +483,7 @@ export default {
// return
// }
const isProIdValid = this.projectList.some(item =>
String(item.proId) === String(leaseApplyInfo.proId)
)
const isProIdValid = this.projectList.some(item => String(item.proId) === String(leaseApplyInfo.proId))
if (!isProIdValid) {
this.$message.warning('该领料单号不属于您负责的工程')
@ -501,7 +535,7 @@ export default {
const mapped = []
leaseApplyDetailsList.forEach(detail => {
const detailTypeId = detail.typeId
console.log("detailTypeId:", detailTypeId)
console.log('detailTypeId:', detailTypeId)
// flattenTypeOptions
if (!this.flattenTypeOptions || this.flattenTypeOptions.length === 0) {
console.warn('flattenTypeOptions 为空,无法查找 typeId')
@ -523,7 +557,13 @@ export default {
// maCodeVoList / maCodeList / maCode
maCodeList: detail.maCodeList || detail.maCodeVoList || detail.maCode || [],
// menageType manageType manageType '0' / '1'
manageType: String(detail.menageType != null ? detail.menageType : (detail.manageType != null ? detail.manageType : typeData.manageType || '1')),
manageType: String(
detail.menageType != null
? detail.menageType
: detail.manageType != null
? detail.manageType
: typeData.manageType || '1'
),
remark: detail.remark || '',
// 便使
_rawDetail: detail
@ -539,10 +579,12 @@ export default {
unitName: detail.unitName || '',
storageNum: detail.storageNum || 0,
preNum: detail.preNum || 0,
outNum: detail.outNum != null ? detail.outNum : (detail.preNum != null ? detail.preNum : 0),
outNum: detail.outNum != null ? detail.outNum : detail.preNum != null ? detail.preNum : 0,
parentId: detail.parentId || this.parentId || undefined,
maCodeList: detail.maCodeList || detail.maCodeVoList || [],
manageType: String(detail.menageType != null ? detail.menageType : (detail.manageType != null ? detail.manageType : '1')),
manageType: String(
detail.menageType != null ? detail.menageType : detail.manageType != null ? detail.manageType : '1'
),
remark: detail.remark || '',
_rawDetail: detail
}
@ -567,20 +609,24 @@ export default {
getAgreement({
teamId: this.maForm.teamId,
proId: this.maForm.proId
}).then(res => {
console.log('🚀 ~ getAgreementId ~ res:', res)
if (!res.data || !Array.isArray(res.data)) {
this.agreementId = []
this.equipmentTypeList = []
resolve([])
return
}
this.agreementId = res.data
// equipmentType
this.equipmentType().then(() => {
resolve(res.data)
}).catch(reject)
}).catch(reject)
})
.then(res => {
console.log('🚀 ~ getAgreementId ~ res:', res)
if (!res.data || !Array.isArray(res.data)) {
this.agreementId = []
this.equipmentTypeList = []
resolve([])
return
}
this.agreementId = res.data
// equipmentType
this.equipmentType()
.then(() => {
resolve(res.data)
})
.catch(reject)
})
.catch(reject)
})
},
/** 转换菜单数据结构 */
@ -601,8 +647,8 @@ export default {
const res = await getBmTeamApi({ isAll: 0, idCard, projectId: this.maForm.projectId })
if (!res.data || res.data.length === 0) return
this.uniteList = res.data
console.log("xxxxxxxxxxxxxxxxxxxxxx",this.maForm.projectId)
console.log("yyyyyyyyyyyyyyyyyyyyyy",this.isEdit,this.isView)
console.log('xxxxxxxxxxxxxxxxxxxxxx', this.maForm.projectId)
console.log('yyyyyyyyyyyyyyyyyyyyyy', this.isEdit, this.isView)
if (this.isEdit && this.isView == false) {
const team = this.uniteList.find(item => item.teamName == this.maForm.teamName)
this.maForm.teamId = team.id
@ -626,18 +672,46 @@ export default {
console.log('🚀 ~ getBmTeam ~ error:', error)
}
},
//
async getProDeptList() {
try {
const res = await getPickDepartListApi({ proId: this.maForm.projectId })
this.proDeptList = res.data
} catch (error) {
console.log('🚀 ~ getProDeptList ~ error:', error)
}
},
changePickType() {
this.equipmentList = []
this.filteredOptions = []
if (this.maForm.proId && this.maForm.pickType == 0) {
this.maForm.departId = ''
this.getBmTeam()
} else if (this.maForm.proId && this.maForm.pickType == 1) {
this.maForm.teamId = ''
this.getProDeptList()
}
},
async changePro(e) {
console.log('🚀 ~ changePro ~ e:', e)
this.maForm.proId = e
this.maForm.projectId = this.projectList.find(item => item.proId === e)?.projectId
await this.getBmTeam()
if(this.maForm.proId){
console.log("xxxxxxxyyyyyyyyyyy", this.maForm.proId)
this.equipmentList = []
await this.getAgreementId()
this.equipmentList = []
if (this.maForm.pickType == 0) {
await this.getBmTeam()
} else if (this.maForm.pickType == 1) {
this.getProDeptList()
}
},
changePeoDept(e) {
console.log('🚀 ~ changePeoDept ~ e:', e)
//
const dept = this.proDeptList.find(item => item.departId === e)
this.maForm.teamId = dept.departId
console.log('🚀 ~ changePeoDept ~ this.maForm.teamId:', this.maForm.teamId)
this.maForm.teamName = dept.departName
console.log('🚀 ~ changePeoDept ~ this.maForm.teamName:', this.maForm.teamName)
},
changeTeam(e) {
console.log('🚀 ~ changeTeam ~ e:', e)
// teamName
@ -792,10 +866,13 @@ export default {
this.$message.warning(response.msg)
}
Object.assign(this.maForm, response.data.leaseApplyInfo)
this.maForm.pickType = 0
this.maForm.proId = response.data.leaseApplyInfo.proId
this.maForm.projectId = this.projectList.find(item => item.proId === response.data.leaseApplyInfo.proId)?.projectId
this.maForm.projectId = this.projectList.find(
item => item.proId === response.data.leaseApplyInfo.proId
)?.projectId
this.maForm.relPhone = response.data.leaseApplyInfo.phone || response.data.leaseApplyInfo.relPhone || ''
this.getBmTeam()
this.getBmTeam()
this.equipmentList = response.data.leaseApplyDetailsList || []
if (this.equipmentList.length > 0) {
this.equipmentList.forEach(item => {
@ -806,7 +883,7 @@ export default {
this.parentId = this.equipmentList[0].parentId
console.log('🚀 ~ awaitgetApplyInfo ~ this.parentId:', this.parentId)
}
this.getAgreementId()
this.getAgreementId()
// bmFileInfos
if (this.maForm.bmFileInfos.length > 0) {
this.isFileFbs = true
@ -895,14 +972,15 @@ export default {
.then(response => {
if (response.code == 200) {
this.$modal.msgSuccess('操作成功')
this.$emit('addToolsSuccess')
// this.$emit('addToolsSuccess')
this.$tab.refreshPage({ path: this.$route.path })
}
this.loading = false
})
.catch(() => {
this.loading = false
})
} else if (this.isEdit && this.isView ) {
} else if (this.isEdit && this.isView) {
console.log('新增')
addApplyInfo({
leaseApplyDetailsList: this.equipmentList,
@ -911,7 +989,8 @@ export default {
.then(response => {
if (response.code == 200) {
this.$modal.msgSuccess('操作成功')
this.$emit('addToolsSuccess')
// this.$emit('addToolsSuccess')
this.$tab.refreshPage({ path: this.$route.path })
}
this.loading = false
})