This commit is contained in:
bb_pan 2025-05-29 21:09:11 +08:00
parent 2b4480c100
commit 5b3bce0741
4 changed files with 80 additions and 41 deletions

View File

@ -51,12 +51,12 @@
}
},
// -
// {
// "path": "pages/toolsLease/toolsLeaseOut",
// "style": {
// "navigationStyle": "custom"
// }
// },
{
"path": "pages/toolsLease/toolsLeaseOut",
"style": {
"navigationStyle": "custom"
}
},
// 退
{
"path": "pages/toolsBack/toolsBack",

View File

@ -258,18 +258,16 @@ const onHandleOutbound = async () => {
//
const paramsList = []
codeDeviceList.value.map((e) => {
if (e.checked) {
paramsList.push({
leaseType: 0,
maId: e.maId,
maCode: e.maCode,
manageType: 0,
outNum: 1,
parentId,
typeId,
publishTask,
})
}
paramsList.push({
leaseType: 0,
maId: e.maId,
maCode: e.maCode,
manageType: 0,
outNum: 1,
parentId,
typeId,
publishTask,
})
})
console.log('mmmmmmmmmmmmmmmm', paramsList)
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
@ -278,7 +276,7 @@ const onHandleOutbound = async () => {
title: '出库成功!',
icon: 'none',
})
getCodeDetailData(queryParams.value.id, queryParams.value.publishTask, queryParams.value.typeId) //
back()
}
}
@ -410,15 +408,9 @@ const onCodeIdentify = () => {
//
const scanStart = () => {
// if (scanQrCodeRef.value) {
// scanQrCodeRef.value.scanQrCode()
// }
//
uni.scanCodde({
success: (res) => {
console.log('🚀 ~ scanStart ~ res:', res)
},
})
if (scanQrCodeRef.value) {
scanQrCodeRef.value.scanQrCode()
}
}
//

View File

@ -38,10 +38,10 @@
></eselect>
<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" v-if="opts.isNew != 0">
<uni-easyinput v-model="formData.leasePerson" placeholder="请输入内容"></uni-easyinput>
</uni-forms-item>
<uni-forms-item label="联系电话" required name="phone">
<uni-forms-item label="联系电话" required name="phone" v-if="opts.isNew != 0">
<uni-easyinput
v-model="formData.phone"
placeholder="请输入内容"
@ -65,7 +65,9 @@
<uni-th width="180" align="center">类型名称</uni-th>
<uni-th width="180" align="center">规格型号</uni-th>
<uni-th align="center">在库数</uni-th>
<uni-th width="204" align="center">领用数</uni-th>
<uni-th width="204" align="center">{{
opts.value.isNew != 0 ? '领用数' : '出库数'
}}</uni-th>
<uni-th width="120" align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
@ -103,7 +105,7 @@
</uni-table>
<button style="width: 100%; margin: 50px 0" size="mini" type="primary" @click="submit">
确定
{{ opts.isNew == 0 ? '出 库' : ' ' }}
</button>
</div>
</template>
@ -119,6 +121,7 @@ import {
addLeaseTask,
editLeaseTask,
detailsLeaseTask,
leaseOutApi,
} from '@/services/back.js'
const title = ref('工器具领料申请')
@ -134,7 +137,7 @@ const equipmentId = ref()
const teamRange = ref([]) //
const prodRange = ref([]) //
const equipmentList = ref([]) //
const rules = {
const rules = ref({
teamId: {
rules: [{ required: true, errorMessage: '请选择班组' }],
},
@ -147,7 +150,7 @@ const rules = {
phone: {
rules: [{ required: true, errorMessage: '请填写联系电话' }],
},
}
})
const tableData = ref([])
//
@ -189,9 +192,10 @@ const getProjectListApi = async () => {
}
}
//
const getEquipmentList = async () => {
const getEquipmentList = async (params) => {
console.log('🚀 ~ getEquipmentList ~ params:', params)
try {
const res = await getTypeTreeList()
const res = await getTypeTreeList(params)
// machineList.value = res.data
if (res.data.length > 0) {
equipmentList.value = formatEquipmentTree(res.data)
@ -257,6 +261,14 @@ const changeProd = (e) => {
//
const changeEquipment = (e) => {
console.log('🚀 ~ changeEquipment ~ e:', e)
if (e.manageType != 1 && opts.value.isNew == 0) {
//
uni.showToast({
icon: 'none',
title: '请选择数量设备',
})
return
}
// equipmentList.value id typeName
const equipment = findEquipmentById(equipmentList.value, e.parentId)
tableData.value.push({
@ -316,13 +328,22 @@ const submit = () => {
}
console.log('🚀 ~ .then ~ params:', params)
try {
if (!opts.value.isEdit) {
if (!opts.value.isEdit && opts.value.isNew != 0) {
const res = await addLeaseTask(params)
console.log('🚀 ~ .then ~ res:', res)
back()
} else {
} else if (opts.value.isEdit && opts.value.isNew != 0) {
const res = await editLeaseTask(params)
back()
} else {
tableData.value.forEach((item) => {
item.isApp = '0'
item.isNew = '0'
item.parentId = opts.value.parentId
item.outNum = item.preNum
})
await leaseOutApi({ leaseOutDetailsList: tableData.value })
back()
}
//
uni.showToast({
@ -346,11 +367,19 @@ const back = () => {
onLoad((opt) => {
console.log('onLoad', opt)
opts.value = opt.params ? JSON.parse(opt.params) : {}
title.value = opts.value.isEdit ? '编辑工器具领料' : '新增工器具领料'
title.value = opts.value.isEdit && opts.value.isNew != 0 ? '编辑工器具领料' : '新增工器具领料'
if (opts.value.isNew == 0) {
console.log('🚀 ~ onLoad ~ opts.value.isNew:', opts.value.isNew)
formData.teamId = opts.value.teamId
formData.teamName = opts.value.teamName
formData.projectId = opts.value.projectId
formData.projectName = opts.value.projectName
rules.value = {}
}
getTeamList()
getProjectListApi()
getEquipmentList()
if (opts.value.isEdit) {
if (opts.value.isEdit && opts.value.isNew != 0) {
getDetailsById()
}
})

View File

@ -22,7 +22,7 @@
</button>
</div>
<div class="df-btn">
<button class="btn" size="mini" type="primary" @click="">新增数量出库</button>
<button class="btn" size="mini" type="primary" @click="addLeaseNum">新增数量出库</button>
<button class="btn" size="mini" type="primary" @click="">新增编码出库</button>
</div>
<div
@ -98,6 +98,24 @@ const handleItem = (item) => {
})
}
}
//
const addLeaseNum = () => {
const params = {
manageType: 1,
isApp: 0,
isNew: 0,
teamId: opts.value.teamId,
teamName: opts.value.teamName,
projectId: opts.value.projectId,
projectName: opts.value.projectName,
parentId: tableList.value[0].parentId,
isEdit: true,
}
uni.navigateTo({
url: '/pages/toolsLease/toolsLeaseAdd?params=' + JSON.stringify(params),
})
}
const back = () => {
uni.navigateBack({
delta: 1,