feat:样品库管理
This commit is contained in:
131
pages/sampleWarehouse/sampleDispatchExternal/detail.vue
Normal file
131
pages/sampleWarehouse/sampleDispatchExternal/detail.vue
Normal file
@@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<navbar-back title="样品调拨"></navbar-back>
|
||||
<view class="pl8 pr8">
|
||||
<view class="border-b p6 x-f"
|
||||
><view class="pr16">申请人:</view><text>{{ applyData.applyUser }}</text></view
|
||||
>
|
||||
<view class="border-b p6"
|
||||
><text>申请时间:</text><text>{{ nx.$dayjs(applyData.applyTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view
|
||||
>
|
||||
<view class="border-b p6"
|
||||
><text>申请事由:</text><text>{{ applyData.applyContent }}</text></view
|
||||
>
|
||||
<up-input
|
||||
style="padding-top: 20px"
|
||||
border="bottom"
|
||||
v-model="sampleCode"
|
||||
placeholder="请扫描样品编号来确认样品"
|
||||
prefixIcon="scan"
|
||||
fontSize="16"
|
||||
prefixIconStyle="font-size: 30px;"
|
||||
>
|
||||
</up-input>
|
||||
|
||||
<uni-section type="line" title="申请调拨样品明细" titleFontSize="15px">
|
||||
<scroll-view style="height: 49vh" scroll-y scroll-with-animation>
|
||||
<up-checkbox-group v-model="checkedSampleCodes" placement="column">
|
||||
<uni-card margin="5px" v-for="item in sampleList" class="sample-item">
|
||||
<view
|
||||
>样品名称:<text class="black">{{ item.sampleName }}</text></view
|
||||
>
|
||||
<view class="mt4"
|
||||
>归库编码:<text class="black">{{ item.sampleReturnCode }}</text></view
|
||||
>
|
||||
<view class="mt4"
|
||||
>样品库名称:<text class="black">{{ item.warehouseName }}</text></view
|
||||
>
|
||||
<view class="mt4"
|
||||
>库位码:<text class="black">{{ item.warehouseLocationCode }}</text></view
|
||||
>
|
||||
<up-checkbox class="item-checkbox" :name="item.sampleReturnCode"> </up-checkbox>
|
||||
</uni-card>
|
||||
</up-checkbox-group>
|
||||
</scroll-view>
|
||||
<up-button
|
||||
type="primary"
|
||||
:disabled="checkedSampleCodes.length !== sampleList.length"
|
||||
style="width: 50%"
|
||||
text="提交"
|
||||
@click="handleSubmit"
|
||||
></up-button>
|
||||
</uni-section>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, toRefs, watch } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
|
||||
let sampleCode = ref('')
|
||||
let applyData = ref({ applyUser: '张三', applyTime: '2021-01-01 10:10:10', applyContent: '测试' })
|
||||
let sampleList = ref([])
|
||||
async function getDetailList() {
|
||||
const { list } = await nx.$api.sampleWarehouse.querySampleDispatchApplyDetail({
|
||||
parentId: applyData.value.id,
|
||||
pageSize: 999
|
||||
})
|
||||
sampleList.value = list
|
||||
}
|
||||
let checkedSampleCodes = ref([])
|
||||
|
||||
const { flagInfo, scanQRInfo } = toRefs(nx.$store('biz'))
|
||||
onLoad(async options => {
|
||||
applyData.value = flagInfo
|
||||
getDetailList()
|
||||
})
|
||||
watch(scanQRInfo, newVal => {
|
||||
if (!newVal) return
|
||||
scanQRInfo.value = ''
|
||||
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleDispatchExternal/detail') return
|
||||
try {
|
||||
sampleCode.value = newVal
|
||||
if (
|
||||
sampleCode.value === sampleList.value.find(item => item.sampleReturnCode === sampleCode.value)?.sampleReturnCode
|
||||
) {
|
||||
if (!checkedSampleCodes.value.includes(sampleCode.value)) {
|
||||
checkedSampleCodes.value.push(sampleCode.value)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请勿重复扫描',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '该样品不在申请范围内',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '请扫描正确的样品编码',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
scanQRInfo.value = ''
|
||||
})
|
||||
|
||||
async function handleSubmit() {
|
||||
await nx.$api.sampleWarehouse.execSampleDispatch({ id: applyData.value.id })
|
||||
uni.showToast({
|
||||
title: '调拨成功',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.navigateBack()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sample-item {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
.item-checkbox {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
80
pages/sampleWarehouse/sampleDispatchExternal/index.vue
Normal file
80
pages/sampleWarehouse/sampleDispatchExternal/index.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<navbar-back title="样品调拨"></navbar-back>
|
||||
<view class="p8">
|
||||
<up-subsection
|
||||
activeColor="#0055A2"
|
||||
mode="subsection"
|
||||
:list="list"
|
||||
:current="current"
|
||||
@change="changeTab"
|
||||
></up-subsection>
|
||||
<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
|
||||
>
|
||||
<view
|
||||
>申请时间:<text>{{ nx.$dayjs(item.applyTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view
|
||||
>
|
||||
<view
|
||||
>申请事由:<text>{{ item.applyContent }}</text></view
|
||||
>
|
||||
</view>
|
||||
<up-loadmore v-if="listData.length > 0" :status="loadStatus" />
|
||||
<up-empty v-else mode="data" text="暂无数据" marginTop="50"> </up-empty>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { useListData } from '@/nx/hooks/usePageListData'
|
||||
import nx from '@/nx'
|
||||
|
||||
const list = ref(['待处理', '已处理'])
|
||||
|
||||
let dataList = ref([])
|
||||
const current = ref(0)
|
||||
|
||||
function changeTab(index) {
|
||||
current.value = index
|
||||
getInitData()
|
||||
}
|
||||
const searchParams = computed(() => {
|
||||
if (current.value === 0) {
|
||||
return {
|
||||
finishStatus: 'pending'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
finishStatus: 'completed'
|
||||
}
|
||||
}
|
||||
})
|
||||
const { listData, scrollToLower, loadStatus, getInitData } = useListData({
|
||||
searchParams,
|
||||
api: nx.$api.sampleWarehouse.querySampleDispatchApply,
|
||||
needInitListData: true
|
||||
})
|
||||
|
||||
function handleScrolltolower() {
|
||||
scrollToLower()
|
||||
}
|
||||
function handleDetail(item) {
|
||||
nx.$store('biz').flagInfo = item
|
||||
uni.navigateTo({
|
||||
url: '/pages/sampleWarehouse/sampleDispatchExternal/detail'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.data-item {
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid #eee;
|
||||
color: #909399;
|
||||
text {
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user