项目部出库

This commit is contained in:
bb_pan 2025-09-27 16:04:37 +08:00
parent 962b75b125
commit fa3614f185
2 changed files with 114 additions and 26 deletions

View File

@ -9,7 +9,11 @@
</view> </view>
</template> </template>
<template v-slot:right v-if="opts.isOut"> <template v-slot:right v-if="opts.isOut">
<view style="font-size: 18px; display: flex; align-items: center" @click="submit(0)"> <view
v-if="formData.pickType == 0 || !formData.pickType"
@click="submit(0)"
style="font-size: 18px; display: flex; align-items: center"
>
<!-- 文本 --> <!-- 文本 -->
<text>暂存</text> <text>暂存</text>
</view> </view>
@ -18,6 +22,15 @@
<div class="content"> <div class="content">
<uni-section title="任务信息" type="line"></uni-section> <uni-section title="任务信息" type="line"></uni-section>
<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="pickType" v-if="opts.isOut && !opts.isEdit">
<uni-data-select
v-model="formData.pickType"
:localdata="pickTypeList"
:clear="false"
filterable
@change="changePickType"
></uni-data-select>
</uni-forms-item>
<uni-forms-item label="领用工程" required name="proId"> <uni-forms-item label="领用工程" required name="proId">
<uni-data-select <uni-data-select
v-model="formData.proId" v-model="formData.proId"
@ -27,7 +40,21 @@
@change="changeProd" @change="changeProd"
></uni-data-select> ></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="领料班组" required name="teamId"> <uni-forms-item label="领用项目部" required name="departId" v-if="formData.pickType == 1">
<uni-data-select
v-model="formData.departId"
:localdata="proDeptList"
:clear="false"
filterable
@change="changeDept"
></uni-data-select>
</uni-forms-item>
<uni-forms-item
label="领料班组"
required
name="teamId"
v-if="formData.pickType == 0 || !formData.pickType"
>
<uni-data-select <uni-data-select
v-model="formData.teamId" v-model="formData.teamId"
:localdata="teamRange" :localdata="teamRange"
@ -36,7 +63,12 @@
@change="changeTeamd" @change="changeTeamd"
></uni-data-select> ></uni-data-select>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="班组长" required name="leasePerson"> <uni-forms-item
label="班组长"
required
name="leasePerson"
v-if="formData.pickType == 0 || !formData.pickType"
>
<uni-easyinput <uni-easyinput
v-model="formData.leasePerson" v-model="formData.leasePerson"
placeholder="请输入内容" placeholder="请输入内容"
@ -126,7 +158,6 @@
v-if="opts.isOut" v-if="opts.isOut"
v-model="item.remark" v-model="item.remark"
placeholder="请输入备注" placeholder="请输入备注"
></uni-easyinput> ></uni-easyinput>
</uni-td> </uni-td>
<uni-td align="center"> <uni-td align="center">
@ -196,6 +227,7 @@ import {
editLeaseTask, editLeaseTask,
detailsLeaseTask, detailsLeaseTask,
getAgreementInfoByIdApi, getAgreementInfoByIdApi,
getPickDepartListApi,
} from '@/services/materialsStation' } from '@/services/materialsStation'
import { useMemberStore } from '@/stores' import { useMemberStore } from '@/stores'
const memberStore = useMemberStore() const memberStore = useMemberStore()
@ -214,6 +246,9 @@ const formData = reactive({
remark: '', remark: '',
fitNum: 1, fitNum: 1,
proId: undefined, proId: undefined,
pickType: 0,
departId: undefined,
departName: '',
}) })
const lastFitNum = ref(formData.fitNum) const lastFitNum = ref(formData.fitNum)
const equipmentId = ref() const equipmentId = ref()
@ -237,6 +272,11 @@ const rules = ref({
const tableData = ref([]) const tableData = ref([])
const popup = ref() const popup = ref()
const popupRow = ref({}) const popupRow = ref({})
const proDeptList = ref([])
const pickTypeList = ref([
{ text: '班组', value: 0 },
{ text: '项目部', value: 1 },
])
// //
const fitNumChange = () => { const fitNumChange = () => {
@ -272,7 +312,9 @@ const getDetailsById = async () => {
}) })
Object.assign(formData, res.data.leaseApplyInfo) Object.assign(formData, res.data.leaseApplyInfo)
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.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 || ''
await getTeamList() await getTeamList()
await getAgreementInfoById() await getAgreementInfoById()
@ -282,13 +324,29 @@ const getDetailsById = async () => {
uni.hideLoading() uni.hideLoading()
} }
} }
//
const getProDeptList = async () => {
try {
const res = await getPickDepartListApi({ proId: formData.projectId })
if (!res.data || res.data.length == 0) return
proDeptList.value = res.data.map((item) => {
return {
...item,
value: item.departId,
text: item.departName,
}
})
} catch (error) {
console.log('🚀 ~ getProDeptList ~ error:', error)
}
}
// //
const getTeamList = async () => { const getTeamList = async () => {
try { try {
const params = { const params = {
isAll: 0, isAll: 0,
projectId: formData.projectId, projectId: formData.projectId,
idCard: uni.getStorageSync('idCard') idCard: uni.getStorageSync('idCard'),
} }
// if (!opts.value.isOut) { // if (!opts.value.isOut) {
// params.idCard = uni.getStorageSync('idCard') // params.idCard = uni.getStorageSync('idCard')
@ -308,7 +366,7 @@ const getTeamList = async () => {
// teamRange.value idCard userInfo.userName teamId // teamRange.value idCard userInfo.userName teamId
if (opts.value.isEdit) { if (opts.value.isEdit) {
const team = res.data.find((item) => item.teamName == formData.teamName) const team = res.data.find((item) => item.teamName == formData.teamName)
console.log("xxxxxxxxx",team) console.log('xxxxxxxxx', team)
formData.teamId = team.id formData.teamId = team.id
formData.teamName = team.teamName formData.teamName = team.teamName
formData.leasePerson = team.relName formData.leasePerson = team.relName
@ -373,9 +431,8 @@ const getAgreementInfoById = async () => {
if (agreementId.length > 0) { if (agreementId.length > 0) {
getEquipmentList(agreementId) getEquipmentList(agreementId)
} else { } else {
console.log("工程和班组没有协议") console.log('工程和班组没有协议')
} }
} catch (error) { } catch (error) {
console.log('🚀 ~ getAgreementInfoById ~ error:', error) console.log('🚀 ~ getAgreementInfoById ~ error:', error)
} }
@ -388,7 +445,11 @@ const getEquipmentList = async (params) => {
mask: true, // mask: true, //
}) })
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) { 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)
@ -455,7 +516,14 @@ const checkPerNum = (item) => {
} }
} }
} }
const changeDept = (e) => {
console.log('🚀 ~ changeDept ~ e:', e)
const dept = proDeptList.value.find((item) => item.departId === e)
console.log('🚀 ~ changeDept ~ dept:', dept)
formData.teamId = dept.departId
formData.teamName = dept.departName
getAgreementInfoById()
}
// //
const changeTeamd = (e) => { const changeTeamd = (e) => {
console.log('🚀 ~ changeTeamd ~ e:', e) console.log('🚀 ~ changeTeamd ~ e:', e)
@ -468,19 +536,32 @@ const changeTeamd = (e) => {
formData.relName = team ? team.relName : '' formData.relName = team ? team.relName : ''
formData.phone = team ? team.relPhone : '' formData.phone = team ? team.relPhone : ''
formData.teamLeaderIdCard = team ? team.teamLeaderIdCard : '' formData.teamLeaderIdCard = team ? team.teamLeaderIdCard : ''
formData.subUnitName = team? team.subUnitName : '' formData.subUnitName = team ? team.subUnitName : ''
equipmentList.value = [] equipmentList.value = []
// getProjectListApi() // getProjectListApi()
getAgreementInfoById() getAgreementInfoById()
} }
const changePickType = (e) => {
tableData.value = []
formData.teamId = null
if (e == 0) {
getTeamList()
} else {
getProDeptList()
}
}
// //
const changeProd = async (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)
tableData.value = [] tableData.value = []
await getTeamList() if (formData.pickType == 0) {
await getTeamList()
} else {
await getProDeptList()
}
await getAgreementInfoById() await getAgreementInfoById()
} }
// //
@ -636,7 +717,7 @@ const submit = (isOut) => {
} }
const back = () => { const back = () => {
if (tableData.value.length > 0) { if (tableData.value.length > 0 && formData.pickType != 1) {
uni uni
.showModal({ .showModal({
title: '提示', title: '提示',
@ -668,7 +749,6 @@ onLoad((opt) => {
getProjectListApi().then(() => { getProjectListApi().then(() => {
getDetailsById() getDetailsById()
}) })
} else { } else {
// getTeamList() // getTeamList()
getProjectListApi() getProjectListApi()
@ -694,7 +774,7 @@ onBackPress((opt) => {
if (tableData.value.length > 0) { if (tableData.value.length > 0) {
// //
uni.showToast({ uni.showToast({
title: '当前有未提交数据, 请暂存或提交', title: `当前有未提交数据, 请先${formData.pickType != 1 ? '提交' : '暂存或提交'}`,
icon: 'none', icon: 'none',
duration: 1000, duration: 1000,
}) })

View File

@ -27,7 +27,6 @@ export function getUserInfoByIdCardApi(data) {
}) })
} }
// 预警统计 // 预警统计
export function getToolsLedgerDetailsListApi(data) { export function getToolsLedgerDetailsListApi(data) {
return http({ return http({
@ -284,29 +283,29 @@ export const getRetainedEquipmentListApi = (data) => {
} }
//分公司下拉 //分公司下拉
export const getImpUnitListApi= (data) => { export const getImpUnitListApi = (data) => {
return http({ return http({
url: '/material/material_maMachine/getImpUnitNameList', url: '/material/material_maMachine/getImpUnitNameList',
method: 'GET', method: 'GET',
data data,
}) })
} }
//项目部下拉 //项目部下拉
export const getDepartListByImpUnitApi= (data) => { export const getDepartListByImpUnitApi = (data) => {
return http({ return http({
url: '/material/material_maMachine/getDepartNameList', url: '/material/material_maMachine/getDepartNameList',
method: 'GET', method: 'GET',
data data,
}) })
} }
//工程下拉 //工程下拉
export const getProListByDepartApi= (data) => { export const getProListByDepartApi = (data) => {
return http({ return http({
url: '/material/material_maMachine/getProjectList', url: '/material/material_maMachine/getProjectList',
method: 'GET', method: 'GET',
data data,
}) })
} }
@ -434,4 +433,13 @@ export const updateSignByIdApi = (data) => {
url: '/material/material_back_apply_info/updateSignById', url: '/material/material_back_apply_info/updateSignById',
data, data,
}) })
} }
// 项目部列表
export const getPickDepartListApi = (data) => {
return http({
method: 'GET',
url: '/material/material_maMachine/getPickDepartList',
data,
})
}