项目部出库

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) { export function getProListByDepartApi(query) {
return request({ return request({

View File

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