领料出库-优化
This commit is contained in:
parent
828f45aa60
commit
2315b5d869
|
|
@ -30,7 +30,7 @@
|
|||
</view>
|
||||
|
||||
<view class="table-list-item">
|
||||
<uni-row :gutter="24" style="display: flex;align-items: center">
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center">
|
||||
<uni-col :span="6">出库方式:</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="coding-btn" @tap="onCodeIdentify">编码识别</view>
|
||||
|
|
@ -78,8 +78,8 @@
|
|||
>
|
||||
<view class="table-list-item" v-for="item in codeDeviceList" :key="item.maId">
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">物资类型:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<uni-col :span="8">物资类型:</uni-col>
|
||||
<uni-col :span="12">
|
||||
<view class="cont">{{ item.materialName }}</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4">
|
||||
|
|
@ -90,7 +90,10 @@
|
|||
borderColor="#409eff"
|
||||
activeBorderColor="#409eff"
|
||||
:checked="item.checked"
|
||||
:disabled="maxNum === isSelectNum && !item.checked"
|
||||
:disabled="
|
||||
(maxNum === isSelectNum && !item.checked) ||
|
||||
isWithinOneMonth(item.nextCheckTime)
|
||||
"
|
||||
style="transform: scale(0.7)"
|
||||
/>
|
||||
</label>
|
||||
|
|
@ -98,29 +101,47 @@
|
|||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">规格型号:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<uni-col :span="8">规格型号:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<view class="cont">{{ item.materialModel }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">设备编码:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<uni-col :span="8">设备编码:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<view class="cont">{{ item.maCode }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">设备状态:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<uni-col :span="8">设备状态:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<view class="cont">{{ item.statusName }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">设备数量:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<uni-col :span="8">设备数量:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<view class="cont">1</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="8">本次检验时间:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<view class="cont">{{ item.thisCheckTime }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
<uni-col :span="8">下次检验时间:</uni-col>
|
||||
<uni-col :span="14">
|
||||
<view
|
||||
class="cont"
|
||||
:style="{
|
||||
color: isWithinOneMonth(item.nextCheckTime) ? 'red' : '',
|
||||
}"
|
||||
>{{ item.nextCheckTime }}</view
|
||||
>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</view>
|
||||
|
||||
<view class="loading-text">
|
||||
|
|
@ -157,6 +178,7 @@ const maxNum = ref(0)
|
|||
const total = ref(0)
|
||||
const boxCode = ref('')
|
||||
const boxInfo = ref({})
|
||||
const checkedIds = ref([])
|
||||
// 编码设备列表查询参数
|
||||
const queryCodeParams = ref({
|
||||
pageNum: 1,
|
||||
|
|
@ -186,6 +208,20 @@ onShow(() => {
|
|||
console.log(queryParams.value)
|
||||
getCodeDetailData(queryParams.value.id, queryParams.value.publishTask, queryParams.value.typeId) //获取详情
|
||||
})
|
||||
|
||||
const isWithinOneMonth = (dateStr) => {
|
||||
if (!dateStr) {
|
||||
return false
|
||||
}
|
||||
const inputDate = new Date(dateStr)
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0) // 清除时分秒
|
||||
const futureLimit = new Date(today)
|
||||
futureLimit.setDate(today.getDate() + 30)
|
||||
|
||||
return inputDate >= today && inputDate <= futureLimit
|
||||
}
|
||||
|
||||
// 获取编码列表
|
||||
const getCodeDetailData = async (id, publishTask, typeId) => {
|
||||
console.log('yyyyyyyyyy', id, publishTask, typeId)
|
||||
|
|
@ -203,16 +239,27 @@ const getCodeDetailData = async (id, publishTask, typeId) => {
|
|||
|
||||
// 获取编码列表
|
||||
const getCodeDeviceListData = async () => {
|
||||
// 记录已勾选的设备ID
|
||||
const checkedIds = codeDeviceList.value.filter(e => e.checked).map(e => e.maId)
|
||||
const checkedIdSet = new Set(checkedIds.value)
|
||||
const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
||||
// 合并新数据,并保持已勾选项的 checked 状态
|
||||
const newRows = res.rows.map(e => ({
|
||||
...e,
|
||||
checked: checkedIds.includes(e.maId)
|
||||
}))
|
||||
codeDeviceList.value.push(...newRows)
|
||||
total.value = res.total
|
||||
const newRows = res.rows || []
|
||||
const map = new Map()
|
||||
|
||||
// 先放入旧数据(可保留滚动加载场景)
|
||||
codeDeviceList.value.forEach((item) => {
|
||||
map.set(item.maId, item)
|
||||
})
|
||||
|
||||
// 再放入新数据,设置 checked 状态
|
||||
newRows.forEach((item) => {
|
||||
map.set(item.maId, {
|
||||
...item,
|
||||
checked: checkedIdSet.has(item.maId),
|
||||
})
|
||||
})
|
||||
|
||||
// 更新最终列表
|
||||
codeDeviceList.value = Array.from(map.values())
|
||||
total.value = res.total || 0
|
||||
}
|
||||
|
||||
// 编码搜索按钮
|
||||
|
|
@ -239,6 +286,11 @@ const finish = computed(() => {
|
|||
// 复选框事件
|
||||
const onChangeChecked = (item) => {
|
||||
item.checked = !item.checked
|
||||
if (item.checked) {
|
||||
checkedIds.value.push(item.maId)
|
||||
} else {
|
||||
checkedIds.value = checkedIds.value.filter((maId) => maId !== item.maId)
|
||||
}
|
||||
}
|
||||
|
||||
// 计算已选择数量
|
||||
|
|
@ -430,7 +482,7 @@ const boxOutBound = async () => {
|
|||
outNum: 1,
|
||||
parentId,
|
||||
typeId,
|
||||
publishTask
|
||||
publishTask,
|
||||
})
|
||||
})
|
||||
console.log(paramsList)
|
||||
|
|
@ -525,8 +577,6 @@ const handleScanError = (error) => {
|
|||
uni.showToast({ title: error.message, icon: 'none' })
|
||||
}
|
||||
|
||||
|
||||
|
||||
//查看是否是该规格型号
|
||||
const getMaInfoScan = async () => {
|
||||
let param = {
|
||||
|
|
@ -574,7 +624,7 @@ const confirmCodeOutBound = async () => {
|
|||
typeId,
|
||||
typeName: codeData.value.typeName,
|
||||
typeModelName: codeData.value.typeModelName,
|
||||
publishTask
|
||||
publishTask,
|
||||
})
|
||||
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
|
||||
console.log('333333333333', res)
|
||||
|
|
|
|||
Loading…
Reference in New Issue