材料站-优化

This commit is contained in:
bb_pan 2025-07-10 18:02:22 +08:00
parent 286f4ddacd
commit 62c4993570
5 changed files with 82 additions and 55 deletions

View File

@ -18,6 +18,18 @@
<div class="content">
<uni-section title="任务信息" type="line"></uni-section>
<uni-forms ref="form" :rules="rules" :model="formData" label-width="80px">
<uni-forms-item label="工程名称" required name="projectId">
<uni-data-select
v-if="!opts.isEdit"
v-model="formData.projectId"
:localdata="prodRange"
:clear="false"
filterable
:disabled="opts.isEdit"
@change="changeProd"
></uni-data-select>
<uni-easyinput v-else v-model="formData.proName" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="退料班组" required name="teamId">
<uni-data-select
v-if="!opts.isEdit"
@ -30,18 +42,6 @@
></uni-data-select>
<uni-easyinput v-else v-model="formData.teamName" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="工程名称" required name="projectId">
<uni-data-select
v-if="!opts.isEdit"
v-model="formData.projectId"
:localdata="prodRange"
:clear="false"
filterable
:disabled="opts.isEdit || !formData.teamId"
@change="changeProd"
></uni-data-select>
<uni-easyinput v-else v-model="formData.proName" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="退料人员" required name="backPerson">
<uni-easyinput
v-model="formData.backPerson"
@ -134,7 +134,7 @@ import { onLoad, onShow, onBackPress } from '@dcloudio/uni-app'
import { ref, reactive } from 'vue'
import eselect from '@/components/tree-select/eselect.vue'
import {
getBmTeamList,
getTeamListApi,
getProjectList,
backTask,
editBackTask,
@ -198,7 +198,7 @@ const getDetailsById = async () => {
//
const getTeamList = async () => {
try {
const res = await getBmTeamList({ isAll: 0 })
const res = await getTeamListApi({ isAll: 0, proId: formData.projectId })
// teamRange.value = res.data
if (res.data.length > 0) {
teamRange.value = res.data.map((item) => {
@ -208,7 +208,7 @@ const getTeamList = async () => {
text: item.teamName,
}
})
getProjectListApi()
// getProjectListApi()
}
} catch (error) {
console.log('🚀 ~ getTeamList ~ error:', error)
@ -324,18 +324,20 @@ const changeTeamd = (e) => {
console.log('🚀 ~ changeTeamd ~ e:', e)
const team = teamRange.value.find((item) => item.id === e)
console.log('🚀 ~ changeTeamd ~ team:', team)
formData.projectId = null
// formData.projectId = null
formData.teamName = team ? team.teamName : ''
formData.backPerson = team ? team.relName : ''
formData.phone = team ? team.relPhone : ''
formData.relName = team ? team.relName : ''
formData.teamId = e
getProjectListApi()
// getProjectListApi()
getAgreement()
}
//
const changeProd = (e) => {
console.log('🚀 ~ changeProd ~ e:', e)
formData.projectId = e
getAgreement()
getTeamList()
}
//
const changeEquipment = (e) => {
@ -501,7 +503,8 @@ onLoad((opt) => {
if (opts.value.isEdit) {
getDetailsById()
} else {
getTeamList()
// getTeamList()
getProjectListApi()
}
})
onShow(() => {

View File

@ -18,6 +18,18 @@
<div class="content">
<uni-section title="任务信息" type="line"></uni-section>
<uni-forms ref="form" :rules="rules" :model="formData" label-width="90px">
<uni-forms-item label="领用工程" required name="projectId">
<uni-data-select
v-if="!opts.isEdit"
v-model="formData.projectId"
: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"
@ -30,18 +42,6 @@
></uni-data-select>
<uni-easyinput v-else v-model="formData.teamName" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="领用工程" required name="projectId">
<uni-data-select
v-if="!opts.isEdit"
v-model="formData.projectId"
:localdata="prodRange"
:clear="false"
filterable
:disabled="opts.isEdit || !formData.teamId"
@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="leasePerson">
<uni-easyinput
v-model="formData.leasePerson"
@ -49,9 +49,9 @@
disabled
></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="联系电话" name="phone">
<uni-forms-item label="联系电话" name="relPhone">
<uni-easyinput
v-model="formData.phone"
v-model="formData.relPhone"
placeholder="请输入内容"
maxlength="11"
@blur="checkPhone"
@ -198,10 +198,11 @@ const formData = reactive({
teamId: undefined,
projectId: undefined,
leasePerson: '',
phone: '',
relPhone: '',
isOut: 1,
remark: '',
fitNum: 1,
proId: undefined,
})
const lastFitNum = ref(formData.fitNum)
const equipmentId = ref()
@ -218,7 +219,7 @@ const rules = ref({
leasePerson: {
rules: [{ required: true, errorMessage: '请填写领用人' }],
},
// phone: {
// relPhone: {
// rules: [{ required: true, errorMessage: '' }],
// },
})
@ -252,6 +253,7 @@ const getDetailsById = async () => {
console.log('🚀 ~ getDetailsById ~ res:', res)
tableData.value = res.data.leaseApplyDetailsList
Object.assign(formData, res.data.leaseApplyInfo)
formData.projectId = res.data.leaseApplyInfo.proId
getAgreementInfoById()
} catch (error) {
console.log('🚀 ~ getDetailsById ~ error:', error)
@ -262,10 +264,12 @@ const getTeamList = async () => {
try {
const params = {
isAll: 0,
projectId: formData.projectId,
idCard: uni.getStorageSync('idCard')
}
if (!opts.value.isOut) {
params.idCard = uni.getStorageSync('idCard')
}
// if (!opts.value.isOut) {
// params.idCard = uni.getStorageSync('idCard')
// }
console.log('🚀 ~ getTeamList ~ params:', params)
const res = await getBmTeamList(params)
// teamRange.value = res.data
@ -285,14 +289,18 @@ const getTeamList = async () => {
formData.teamId = team.id
formData.teamName = team.teamName
formData.leasePerson = team.relName
formData.phone = team.relPhone || ''
formData.relPhone = team.relPhone || ''
formData.relName = team.relName
formData.teamLeaderIdCard = team.teamLeaderIdCard
} else {
formData.teamId = res.data[0].id
formData.teamName = res.data[0].teamName
formData.leasePerson = res.data[0].relName
formData.phone = res.data[0].relPhone || ''
formData.relPhone = res.data[0].relPhone || ''
formData.relName = res.data[0].relName
formData.teamLeaderIdCard = res.data[0].teamLeaderIdCard
}
getProjectListApi()
// getProjectListApi()
}
} catch (error) {
console.log('🚀 ~ getTeamList ~ error:', error)
@ -307,7 +315,7 @@ const getProjectListApi = async () => {
prodRange.value = res.data.map((item) => {
return {
...item,
value: item.proId,
value: item.projectId,
text: item.proName,
}
})
@ -321,7 +329,8 @@ const getAgreementInfoById = async () => {
try {
const params = {
teamId: formData.teamId,
projectId: formData.projectId,
proId: formData.proId,
// projectId: formData.projectId,
}
const res = await getAgreementInfoByIdApi(params)
console.log('🚀 ~ getAgreementInfoById ~ res:', res)
@ -339,7 +348,7 @@ const getAgreementInfoById = async () => {
const getEquipmentList = async (params) => {
console.log('🚀 ~ getEquipmentList ~ params:', params)
try {
const res = await getTypeTreeList({ agreementIdList: params, proId: formData.projectId, teamId: formData.teamId })
const res = await getTypeTreeList({ agreementIdList: params, proId: formData.proId, teamName: formData.teamName })
if (res.data.length > 0) {
equipmentList.value = formatEquipmentTree(res.data)
console.log('🚀 ~ getEquipmentList ~ machineList.value:', equipmentList.value)
@ -363,13 +372,13 @@ function formatEquipmentTree(list) {
}
//
const checkPhone = (rule, value, callback) => {
if (!/^1[3-9][0-9]{9}$/.test(formData.phone)) {
if (!/^1[3-9][0-9]{9}$/.test(formData.relPhone)) {
uni.showToast({
icon: 'none',
title: '请输入正确的电话号码',
})
//
formData.phone = ''
formData.relPhone = ''
return false
}
return true
@ -405,20 +414,25 @@ const changeTeamd = (e) => {
console.log('🚀 ~ changeTeamd ~ e:', e)
const team = teamRange.value.find((item) => item.id === e)
console.log('🚀 ~ changeTeamd ~ team:', team)
formData.projectId = null
// formData.projectId = null
formData.teamName = team ? team.teamName : ''
formData.leasePerson = team ? team.relName : ''
formData.relPhone = team ? team.relPhone : ''
formData.relName = team ? team.relName : ''
formData.phone = team ? team.relPhone : ''
formData.teamLeaderIdCard = team ? team.teamLeaderIdCard : ''
equipmentList.value = []
getProjectListApi()
// getProjectListApi()
getAgreementInfoById()
}
//
const changeProd = (e) => {
console.log('🚀 ~ changeProd ~ e:', e)
formData.projectId = e
formData.proId = prodRange.value.find(item => item.projectId === e)?.proId
equipmentList.value = []
getAgreementInfoById()
// getAgreementInfoById()
getTeamList()
}
//
const changeEquipment = (e) => {
@ -479,7 +493,7 @@ const getCode = (item) => {
uni.navigateTo({
url:
'/pages/materialsStation/toolsLease/codeOut?params=' +
JSON.stringify({ ...item, proId: formData.projectId, teamId: formData.teamId }),
JSON.stringify({ ...item, proId: formData.proId, teamId: formData.teamId }),
})
}
@ -601,7 +615,8 @@ onLoad((opt) => {
if (opts.value.isEdit) {
getDetailsById()
} else {
getTeamList()
// getTeamList()
getProjectListApi()
}
})
onShow(() => {

View File

@ -29,7 +29,7 @@ export const getBackInfo = (id,keyWord) => {
export const getProjectList = (data) => {
return http({
method: 'POST',
url: '/material/select/getProjectList',
url: '/material/select/getProjectInfo',
data:data,
})
}

View File

@ -1,7 +1,7 @@
import { http } from '@/utils/http'
/**
* 登录接口
* 登录方法 - 调试使用 - 产线环境需注释
*/
export const appLoginAPI = (data) => {
return http({

View File

@ -54,6 +54,15 @@ export const getBmTeamList = (data) => {
})
}
//班组-下拉-退料
export const getTeamListApi = (data) => {
return http({
method: 'GET',
url: '/material/bmTeam/getTeamList',
data,
})
}
// 领料出库-列表
export const getPickingOutboundListAPI = (data) => {
return http({
@ -76,7 +85,7 @@ export const deleteLeaseApplyApi = (id) => {
export const getProjectList = (data = {}) => {
return http({
method: 'POST',
url: '/material/select/getProjectList',
url: '/material/select/getProjectInfo',
data,
})
}