材料站-优化

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import { http } from '@/utils/http' import { http } from '@/utils/http'
/** /**
* 登录接口 * 登录方法 - 调试使用 - 产线环境需注释
*/ */
export const appLoginAPI = (data) => { export const appLoginAPI = (data) => {
return http({ 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) => { export const getPickingOutboundListAPI = (data) => {
return http({ return http({
@ -76,7 +85,7 @@ export const deleteLeaseApplyApi = (id) => {
export const getProjectList = (data = {}) => { export const getProjectList = (data = {}) => {
return http({ return http({
method: 'POST', method: 'POST',
url: '/material/select/getProjectList', url: '/material/select/getProjectInfo',
data, data,
}) })
} }