feat:样品库管理

This commit is contained in:
houjunxiang
2025-11-21 17:56:33 +08:00
parent 7ee3df9ab9
commit 753766893b
24 changed files with 818 additions and 218 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -69,6 +69,7 @@
<script setup>
import { ref, reactive, computed, onMounted, toRefs, watch } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
import nx from '@/nx'
const changeType = ref('sample')
@@ -134,24 +135,23 @@ function handleChangeType(e) {
let isFirstInput = ref(true)
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (!newVal) return
debouncedHandleScan(newVal)
})
const debouncedHandleScan = debounce(val => {
if (!val) return
scanQRInfo.value = ''
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/execChangeLocation/index') return
try {
console.log(newVal)
const isJson = nx.$helper.isJsonString(newVal)
console.log(isJson)
const isJson = nx.$helper.isJsonString(val)
if (isFirstInput.value) {
handleFirstScan(newVal, isJson)
handleFirstScan(val, isJson)
} else {
handleSecondScan(newVal, isJson)
handleSecondScan(val, isJson)
}
} catch (error) {
uni.showToast({ title: '扫码内容解析失败', icon: 'none' })
}
})
}, 300)
function handleFirstScan(rawValue, isJson) {
if (changeType.value === 'sample') {
// 按样品变更:首扫应为纯字符串(样品编号)

View File

@@ -12,7 +12,7 @@
<up-grid :col="gridCol" :border="false">
<up-grid-item class="mb20 mt20" v-for="item in menuItemList" :key="item.url" @click="goTo(item.url)">
<u-icon :name="item.otherConf.icon" color="#0055A2" size="80" />
<u-icon :name="item.otherConf.icon" color="#0055A2" size="60" />
<view class="grid-text">{{ item.name }}</view>
</up-grid-item>
</up-grid>
@@ -104,6 +104,6 @@ const { gridCol } = useGridCol([400], [2, 3])
<style scoped lang="scss">
.grid-text {
font-size: 24px;
font-size: 18px;
}
</style>

View File

@@ -29,16 +29,26 @@
<script setup>
import { ref, reactive, computed, onMounted, toRefs, watch } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
import nx from '@/nx'
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (!newVal) return
debouncedHandleScan(newVal)
})
const debouncedHandleScan = debounce(val => {
if (!val) return
scanQRInfo.value = ''
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/returnToStock/index') return
try {
if (nx.$helper.isJsonString(newVal)) {
const codeObj = JSON.parse(newVal)
if (nx.$helper.isJsonString(val)) {
const codeObj = JSON.parse(val)
if (codeObj.code === locationCode.value) {
return uni.showToast({
title: '请勿重复扫描',
icon: 'none'
})
}
locationCode.value = codeObj.code
} else {
if (!locationCode.value) {
@@ -48,7 +58,7 @@ watch(scanQRInfo, newVal => {
})
return
} else {
sampleCode.value = newVal
sampleCode.value = val
// 执行归库
handleReturnToStock()
}
@@ -56,7 +66,7 @@ watch(scanQRInfo, newVal => {
} catch (error) {
uni.showToast({ title: '扫码内容解析失败', icon: 'none' })
}
})
}, 300)
onShow(() => {
scanQRInfo.value = ''
})
@@ -69,11 +79,11 @@ function handleReturnToStock() {
nx.$api.sampleWarehouse
.execReturnToStock({
warehouseLocationCode: locationCode.value,
sampleCode: sampleCode.value
sampleReturnCode: sampleCode.value
})
.then(res => {
successCount.value++
if (res.print) {
if (res.isPrint) {
uni.showToast({
title: `归库成功,归库码为【${res.code}`,
duration: 3000,

View File

@@ -11,6 +11,7 @@
><text>申请事由</text><text>{{ applyData.applyContent }}</text></view
>
<up-input
v-if="showAction"
style="padding-top: 20px"
border="bottom"
v-model="sampleCode"
@@ -37,12 +38,14 @@
<view class="mt4"
>库位码<text class="black">{{ item.warehouseLocationCode }}</text></view
>
<up-checkbox class="item-checkbox" :name="item.sampleReturnCode"> </up-checkbox>
<up-checkbox v-if="showAction" class="item-checkbox" :name="item.sampleReturnCode"> </up-checkbox>
</uni-card>
</up-checkbox-group>
</scroll-view>
<up-button
v-if="showAction"
type="primary"
:loading="btnLoading"
:disabled="checkedSampleCodes.length !== sampleList.length"
style="width: 50%"
text="提交"
@@ -56,10 +59,16 @@
import { computed, ref, toRefs, watch } from 'vue'
import nx from '@/nx'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
let btnLoading = ref(false)
let sampleCode = ref('')
let applyData = ref({ applyUser: '张三', applyTime: '2021-01-01 10:10:10', applyContent: '测试' })
let applyData = ref({})
let sampleList = ref([])
const showAction = computed(() => {
return applyData.value.finishStatus === 'pending'
})
async function getDetailList() {
const { list } = await nx.$api.sampleWarehouse.querySampleDispatchApplyDetail({
parentId: applyData.value.id,
@@ -71,15 +80,18 @@ let checkedSampleCodes = ref([])
const { flagInfo, scanQRInfo } = toRefs(nx.$store('biz'))
onLoad(async options => {
applyData.value = flagInfo
applyData.value = flagInfo.value
getDetailList()
})
watch(scanQRInfo, newVal => {
if (!newVal) return
debouncedHandleScan(newVal)
})
const debouncedHandleScan = debounce(val => {
if (!val) return
scanQRInfo.value = ''
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleDispatchExternal/detail') return
try {
sampleCode.value = newVal
sampleCode.value = val
if (
sampleCode.value === sampleList.value.find(item => item.sampleReturnCode === sampleCode.value)?.sampleReturnCode
) {
@@ -103,13 +115,16 @@ watch(scanQRInfo, newVal => {
icon: 'none'
})
}
})
}, 300)
onShow(() => {
scanQRInfo.value = ''
})
async function handleSubmit() {
await nx.$api.sampleWarehouse.execSampleDispatch({ id: applyData.value.id })
btnLoading.value = true
await nx.$api.sampleWarehouse.execSampleDispatch({ id: applyData.value.id }).finally(() => {
btnLoading.value = false
})
uni.showToast({
title: '调拨成功',
icon: 'none'

View File

@@ -11,7 +11,7 @@
<scroll-view style="height: 82vh" scroll-y scroll-with-animation @scrolltolower="handleScrolltolower">
<view class="data-item" v-for="(item, index) in listData" @click="handleDetail(item)">
<view
>申请人<text>{{ item.applyUser }}</text></view
>申请人<text class="pl20">{{ item.applyUser }}</text></view
>
<view
>申请时间<text>{{ nx.$dayjs(item.applyTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view

File diff suppressed because it is too large Load Diff

View File

@@ -58,15 +58,19 @@
<script setup>
import { ref, computed, onMounted, toRefs, watch } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
import nx from '@/nx'
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (!newVal) return
debouncedHandleScan(newVal)
})
const debouncedHandleScan = debounce(val => {
if (!val) return
scanQRInfo.value = ''
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleSearch/index') return
try {
sampleCode.value = newVal
sampleCode.value = val
handleSearch()
} catch (error) {
uni.showToast({
@@ -74,7 +78,7 @@ watch(scanQRInfo, newVal => {
icon: 'none'
})
}
})
}, 300)
onShow(() => {
scanQRInfo.value = ''
})

View File

@@ -52,6 +52,7 @@
import { computed, ref, toRefs, watch, reactive } from 'vue'
import nx from '@/nx'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash'
const takeOffType = ref('sample')
const takeOffTypeOptions = reactive([
@@ -75,11 +76,14 @@ const userInfo = computed(() => nx.$store('user').userInfo)
const { scanQRInfo } = toRefs(nx.$store('biz'))
watch(scanQRInfo, newVal => {
if (!newVal) return
debouncedHandleScan(newVal)
})
const debouncedHandleScan = debounce(val => {
if (!val) return
scanQRInfo.value = ''
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleTakeOff/index') return
try {
const isJson = nx.$helper.isJsonString(newVal)
const isJson = nx.$helper.isJsonString(val)
const isSample = takeOffType.value === 'sample'
if (isJson) {
if (isSample) {
@@ -88,11 +92,11 @@ watch(scanQRInfo, newVal => {
icon: 'none'
})
}
const codeObj = JSON.parse(newVal)
const codeObj = JSON.parse(val)
targetCode.value = codeObj.code
} else {
if (isSample) {
targetCode.value = newVal
targetCode.value = val
} else {
return uni.showToast({
title: '请扫描正确库位码',
@@ -107,7 +111,7 @@ watch(scanQRInfo, newVal => {
icon: 'none'
})
}
})
}, 300)
onShow(() => {
scanQRInfo.value = ''
})
@@ -138,7 +142,7 @@ async function handleSubmit() {
if (takeOffType.value === 'warehouseLocation') {
params.locationCode = targetCode.value
} else {
params.sampleCode = targetCode.value
params.sampleReturnCodes = sampleList.value.map(item => item.sampleReturnCode)
}
btnLoading.value = true
await nx.$api.sampleWarehouse.execTakeOff(params).finally(() => {