feat:样品库管理
This commit is contained in:
@@ -5,13 +5,13 @@
|
||||
<u-col span="2" class="text-center" style="position: relative">
|
||||
<slot name="tag" v-if="$slots.tag" :task="task"></slot>
|
||||
<template v-else>
|
||||
<u-icon :color="taskStyle(task)" name="tags-fill" size="40"></u-icon>
|
||||
<u-icon :color="taskStyle(task)" name="tags-fill" size="50"></u-icon>
|
||||
<text class="seq">{{ seq }}</text>
|
||||
</template>
|
||||
</u-col>
|
||||
<u-col span="10">
|
||||
<view class="fs18">{{ task.taskNo }}</view>
|
||||
<view class="mt3 mb3">{{ task.taskName }}{{ task.assayOper }}</view>
|
||||
<view class="fs20">{{ task.taskNo }}</view>
|
||||
<view class="mt8 mb8">{{ task.taskName }}{{ task.assayOper }}</view>
|
||||
<view class="x-f">
|
||||
<u-icon name="clock"></u-icon>
|
||||
<text class="ml5">{{ taskOperatorTime }}</text>
|
||||
@@ -75,8 +75,8 @@ const taskStyle = task => {
|
||||
}
|
||||
.seq {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
left: 12px;
|
||||
top: 20px;
|
||||
left: 20px;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
<scroll-view
|
||||
style="height: 75vh"
|
||||
style="height: 82vh"
|
||||
scroll-y
|
||||
scroll-with-animation
|
||||
class="content-main-left"
|
||||
@@ -37,7 +37,7 @@
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
<view>
|
||||
<scroll-view scroll-y scroll-with-animation style="height: calc(75vh - 60px)">
|
||||
<scroll-view scroll-y scroll-with-animation style="height: calc(82vh - 60px)">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view class="sample-item">
|
||||
<u-row @click="showSampleDetail(sample.businessAssayTaskDataId, index)">
|
||||
@@ -50,7 +50,7 @@
|
||||
<view>
|
||||
<text class="pl5">{{ sample.sampleAssayCode }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<view class="mt10">
|
||||
<text class="pl5">
|
||||
{{ sample.sampleName }}
|
||||
</text>
|
||||
@@ -58,7 +58,7 @@
|
||||
</u-col>
|
||||
<u-col span="4">
|
||||
<view>
|
||||
<text style="padding-left: 10px" v-html="sample.assayProject"></text>
|
||||
<rich-text :nodes="sample.assayProject"> </rich-text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
@@ -171,10 +171,9 @@ onBackPress(() => {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-title-name {
|
||||
height: 50px;
|
||||
height: 60px;
|
||||
box-sizing: border-box;
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
</navbar-back>
|
||||
|
||||
<u-row gutter="8">
|
||||
<u-col span="3">
|
||||
<u-col span="3" style="height: 60px">
|
||||
<up-tabs
|
||||
class="content-tabs"
|
||||
:current="activeAssayTypeIndex"
|
||||
:list="assayGroups"
|
||||
lineColor="#5ac725"
|
||||
@@ -24,15 +25,15 @@
|
||||
></up-tabs>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<u-col span="6" style="height: 60px">
|
||||
<view class="content-title-name">
|
||||
<view class="current-sample-code">{{ currentSampleData.sampleCode }}</view>
|
||||
<view>数据采集或录入</view>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
</u-col>
|
||||
<u-col span="3">
|
||||
<u-dropdown style="height: 35px">
|
||||
<u-col span="3" style="height: 60px">
|
||||
<u-dropdown>
|
||||
<u-dropdown-item
|
||||
v-model="curParameterKey"
|
||||
:title="curParameterTitle"
|
||||
@@ -63,7 +64,7 @@
|
||||
<view>
|
||||
{{ sample.sampleCode }}
|
||||
</view>
|
||||
<view> {{ sample.sampleName }} </view>
|
||||
<view class="mt10"> {{ sample.sampleName }} </view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -149,8 +150,8 @@
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="3">
|
||||
<view>
|
||||
<scroll-view class="content-right-scroll" scroll-y scroll-with-animation>
|
||||
<view class="pt10">
|
||||
<scroll-view class="content-right-scroll" scroll-y scroll-with-animation :scroll-top="scrollFieldTop">
|
||||
<view>
|
||||
<!-- <template v-for="(fields, groupIndex) in fieldGroup" :key="'group_' + groupIndex"> -->
|
||||
<!-- <view> -->
|
||||
@@ -168,7 +169,7 @@
|
||||
<template v-for="(fields, groupIndex) in currentGroup">
|
||||
<up-collapse-item v-if="fields.label !== '全部'">
|
||||
<template #title>
|
||||
<text class="font-bold">{{ fields.label }}</text>
|
||||
<text class="font-bold fs18">{{ fields.label }}</text>
|
||||
</template>
|
||||
<template v-for="(field, fieldIndex) in fields.fields" :key="groupIndex + '-' + fieldIndex">
|
||||
<view
|
||||
@@ -281,6 +282,7 @@ const taskIngredientsStatus = ref('') //配料状态
|
||||
const configReportTemplateKey = ref('')
|
||||
const elId = nx.$helper.uuid()
|
||||
const scrollTop = ref(0) //tab标题的滚动条位置
|
||||
const scrollFieldTop = ref(0)
|
||||
const menuHeight = ref(0) // 左边菜单的高度
|
||||
const menuItemHeight = ref(0) // 左边菜单item的高度
|
||||
const weightDataIsToZero = ref(false) //重量数据是否归零
|
||||
@@ -879,6 +881,7 @@ watch(
|
||||
const collapseRef = ref()
|
||||
const activeCollapses = ref([])
|
||||
function handleAssayTypeChange({ index, value }) {
|
||||
scrollFieldTop.value = 0
|
||||
activeAssayTypeKey.value = value
|
||||
activeAssayTypeIndex.value = index
|
||||
currentSampleIndex.value = 0
|
||||
@@ -1217,25 +1220,37 @@ onBackPress(() => {
|
||||
color: #fff;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.content-title-name {
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
padding: 4px 0;
|
||||
font-size: 22px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
.content-tabs {
|
||||
height: 100%;
|
||||
:deep(.u-tabs__wrapper) {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.current-sample-code {
|
||||
font-weight: bold;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
:deep(.u-dropdown) {
|
||||
height: 100%;
|
||||
.u-dropdown__menu {
|
||||
height: 60px !important;
|
||||
.u-dropdown__menu__item__text {
|
||||
font-size: 18px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.form-item-my {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 35px;
|
||||
font-size: 13px;
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #dcdcdc;
|
||||
}
|
||||
.selected-field {
|
||||
@@ -1285,10 +1300,10 @@ onBackPress(() => {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
.content-left-scroll {
|
||||
height: 68vh;
|
||||
height: 75vh;
|
||||
}
|
||||
.content-right-scroll {
|
||||
height: 68vh;
|
||||
height: 74vh;
|
||||
}
|
||||
.valid-warning {
|
||||
color: orange;
|
||||
@@ -1302,7 +1317,7 @@ onBackPress(() => {
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
color: #444;
|
||||
padding: 4px 8px;
|
||||
padding: 8px 16px;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 2px dotted #444;
|
||||
}
|
||||
@@ -1335,8 +1350,9 @@ onBackPress(() => {
|
||||
position: relative;
|
||||
.code {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 55px;
|
||||
font-style: 18px;
|
||||
top: 25px;
|
||||
left: 70px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1405,7 +1421,7 @@ onBackPress(() => {
|
||||
|
||||
.field-name {
|
||||
font-size: 26px;
|
||||
padding: 8px;
|
||||
padding: 16px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<up-badge v-if="taskList.length > 0" class="ml5" :value="taskList.length" type="warning"></up-badge>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
<scroll-view style="height: 75vh" scroll-y scroll-with-animation class="content-main-left">
|
||||
<scroll-view style="height: 82vh" scroll-y scroll-with-animation class="content-main-left">
|
||||
<template v-if="taskList.length > 0">
|
||||
<TaskItem
|
||||
v-for="(task, index) in taskList"
|
||||
@@ -29,7 +29,7 @@
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
<view>
|
||||
<scroll-view scroll-y scroll-with-animation style="height: calc(75vh - 60px)">
|
||||
<scroll-view scroll-y scroll-with-animation style="height: calc(82vh - 60px)">
|
||||
<u-checkbox-group placement="column" v-model="checkedSampleCodes">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view v-if="currentTask.reviewCount === sample.reviewCount" class="sample-item">
|
||||
@@ -52,13 +52,13 @@
|
||||
<view>
|
||||
{{ sample.sampleAssayCode }}
|
||||
</view>
|
||||
<view>
|
||||
<view class="mt10">
|
||||
{{ sample.sampleName }}
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view>
|
||||
<text class="pl10" v-html="sample.assayProject"> </text>
|
||||
<rich-text :nodes="sample.assayProject"> </rich-text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
@@ -263,10 +263,9 @@ onBackPress(() => {
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content-title-name {
|
||||
height: 50px;
|
||||
height: 60px;
|
||||
box-sizing: border-box;
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
font-size: 22px;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
|
||||
@@ -13,7 +13,7 @@ import { reactive, ref, computed, onMounted } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import { useGridCol } from '@/nx/hooks/useGridCol'
|
||||
let list = reactive([
|
||||
{ url: '/pages/lims/index/index', name: '设备管理', icon: '设备管理' },
|
||||
// { url: '/pages/lims/index/index', name: '设备管理', icon: '设备管理' },
|
||||
{ url: '/pages/analysis/index/index', name: '分析管理', icon: '分析管理' },
|
||||
{ url: '/pages/sampleWarehouse/index/index', name: '样品库管理', icon: '样品库管理' }
|
||||
])
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<view class="header">
|
||||
<image src="/static/images/login/logo.png"></image>
|
||||
</view>
|
||||
|
||||
<view class="text-center pt10 fs22 font-bold"> 实验室管理系统 </view>
|
||||
<view class="list">
|
||||
<view class="list-call">
|
||||
<u-icon name="account" color="#0055a2" size="30"></u-icon>
|
||||
@@ -20,11 +20,16 @@
|
||||
<input
|
||||
class="sl-input"
|
||||
v-model="loginInfo.password"
|
||||
type="text"
|
||||
:type="passwordFieldType"
|
||||
maxlength="32"
|
||||
placeholder="请输入密码"
|
||||
password="true"
|
||||
/>
|
||||
<u-icon
|
||||
:name="passwordVisible ? 'eye-fill' : 'eye-off'"
|
||||
color="#0055a2"
|
||||
size="30"
|
||||
@click="togglePasswordVisibility"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="login-btn">
|
||||
@@ -56,6 +61,14 @@ let loginInfo = reactive({
|
||||
password: 'P@ssword25',
|
||||
captchaVerification: ''
|
||||
})
|
||||
|
||||
const passwordVisible = ref(false)
|
||||
const passwordFieldType = ref('password')
|
||||
|
||||
function togglePasswordVisibility() {
|
||||
passwordVisible.value = !passwordVisible.value
|
||||
passwordFieldType.value = passwordVisible.value ? 'text' : 'password'
|
||||
}
|
||||
onShow(() => {
|
||||
//检查APP更新
|
||||
// #ifdef APP-PLUS
|
||||
@@ -186,6 +199,6 @@ function onCaptchaError(error) {
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
margin-top: 20px;
|
||||
margin-top: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,159 @@
|
||||
<template>
|
||||
<view> </view>
|
||||
<navbar-back title="调拨归还"></navbar-back>
|
||||
<view class="pl8 pr8 pt8">
|
||||
<view class="x-f">
|
||||
<text class="pl6">归还人:</text>
|
||||
<uni-data-select v-model="givebackUserId" :localdata="range" placeholder="请选择样品归还人"></uni-data-select>
|
||||
</view>
|
||||
<view class="border-b p6 x-f"
|
||||
><view class="pr16">库管员:</view><text>{{ userInfo.nickname }}</text></view
|
||||
>
|
||||
<up-input
|
||||
style="padding-top: 20px"
|
||||
border="bottom"
|
||||
v-model="sampleCode"
|
||||
placeholder="请扫描需要归还的样品编号"
|
||||
prefixIcon="scan"
|
||||
fontSize="16"
|
||||
prefixIconStyle="font-size: 30px;"
|
||||
@confirm="getSampleList"
|
||||
>
|
||||
</up-input>
|
||||
|
||||
<uni-section v-if="sampleList.length > 0" type="line" title="归还样品明细" titleFontSize="15px">
|
||||
<template #right> <up-text type="error" size="18" bold :text="sampleList.length"></up-text></template>
|
||||
<scroll-view style="height: 49vh" scroll-y scroll-with-animation>
|
||||
<uni-card margin="5px" v-for="item in sampleList" class="sample-item">
|
||||
<view class="x-bc">
|
||||
<view
|
||||
>样品名称:<text class="black">{{ item.sampleName }}</text></view
|
||||
>
|
||||
<view>调拨人:<text class="black">{{}}</text></view>
|
||||
</view>
|
||||
<view class="x-bc">
|
||||
<view
|
||||
>样品编号:<text class="black">{{ item.sampleReturnCode }}</text></view
|
||||
>
|
||||
<view>调拨时间:<text class="black">{{}}</text></view>
|
||||
</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
|
||||
>
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
<up-button type="primary" :loading="btnLoading" style="width: 50%" text="提交" @click="handleSubmit"></up-button>
|
||||
</uni-section>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup></script>
|
||||
<script setup>
|
||||
import { computed, ref, toRefs, watch, onMounted } from 'vue'
|
||||
import { debounce } from 'lodash'
|
||||
import nx from '@/nx'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
const btnLoading = ref(false)
|
||||
let sampleCode = ref('')
|
||||
let sampleList = ref([])
|
||||
const range = ref([])
|
||||
const userInfo = computed(() => nx.$store('user').userInfo)
|
||||
const givebackUserId = ref('')
|
||||
const { scanQRInfo } = toRefs(nx.$store('biz'))
|
||||
watch(scanQRInfo, newVal => {
|
||||
debouncedHandleScan(newVal)
|
||||
})
|
||||
const debouncedHandleScan = debounce(val => {
|
||||
if (!val) return
|
||||
scanQRInfo.value = ''
|
||||
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/dispatchGiveBack/index') return
|
||||
try {
|
||||
sampleCode.value = val
|
||||
getSampleList()
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '请扫描正确的样品编码',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}, 300)
|
||||
onShow(() => {
|
||||
scanQRInfo.value = ''
|
||||
})
|
||||
|
||||
async function getSampleList() {
|
||||
if (sampleCode.value === '') return
|
||||
let params = {
|
||||
pageSize: 999,
|
||||
pageNo: 1,
|
||||
returnStatus: 'completed',
|
||||
dispatchStatus: '1',
|
||||
sampleReturnCode: sampleCode.value
|
||||
}
|
||||
|
||||
const { list } = await nx.$api.sampleWarehouse.queryReturnToStockSample(params)
|
||||
if (list.length === 0) {
|
||||
return uni.showToast({ title: '未查询到该样品信息', icon: 'none' })
|
||||
}
|
||||
const existingCodes = new Set(sampleList.value.map(item => item.id)) // 假设唯一标识是 `code`
|
||||
const newItems = list.filter(item => !existingCodes.has(item.id))
|
||||
|
||||
if (newItems.length === 0) {
|
||||
return uni.showToast({ title: '该样品已存在,无需重复添加', icon: 'none' })
|
||||
}
|
||||
|
||||
sampleList.value.push(...newItems)
|
||||
}
|
||||
async function handleSubmit() {
|
||||
if (givebackUserId.value === '') {
|
||||
return uni.showToast({
|
||||
title: '请选择样品归还人',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
btnLoading.value = true
|
||||
const givebackUser = range.value.find(item => item.value === givebackUserId.value)?.nickname
|
||||
await nx.$api.sampleWarehouse
|
||||
.execSampleDispatch({
|
||||
detailIds: sampleList.value.map(item => item.id),
|
||||
givebackUserId: givebackUserId.value,
|
||||
givebackUser
|
||||
})
|
||||
.finally(() => {
|
||||
btnLoading.value = false
|
||||
})
|
||||
uni.showToast({
|
||||
title: '归还成功',
|
||||
icon: 'none'
|
||||
})
|
||||
handleReset()
|
||||
}
|
||||
function handleReset() {
|
||||
sampleCode.value = ''
|
||||
sampleList.value = []
|
||||
}
|
||||
onMounted(async () => {
|
||||
const data = await nx.$api.user.getAssignUserList()
|
||||
range.value = data.map(item => ({ text: item.nickname, value: item.id }))
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sample-item {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
.item-checkbox {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
top: 5px;
|
||||
}
|
||||
}
|
||||
:deep(.uni-select__input-placeholder) {
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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') {
|
||||
// 按样品变更:首扫应为纯字符串(样品编号)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<navbar-back title="样品调拨"></navbar-back>
|
||||
<view class="pl8 pr8">
|
||||
<view class="pl8 pr8 pt8">
|
||||
<view class="x-f">
|
||||
<text class="pl6">领取人:</text>
|
||||
<uni-data-select v-model="receiverId" :localdata="range" placeholder="请选择样品领取人"></uni-data-select>
|
||||
</view>
|
||||
<view class="border-b p6 x-f"
|
||||
><view class="pr16">库管员:</view><text>{{ userInfo.nickname }}</text></view
|
||||
>
|
||||
@@ -12,6 +16,7 @@
|
||||
prefixIcon="scan"
|
||||
fontSize="16"
|
||||
prefixIconStyle="font-size: 30px;"
|
||||
@confirm="getScanSample"
|
||||
>
|
||||
</up-input>
|
||||
|
||||
@@ -33,48 +38,96 @@
|
||||
>
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
<up-button :disabled="!receiver" type="primary" style="width: 50%" text="提交" @click="handleSubmit"></up-button>
|
||||
<up-button type="primary" :loading="btnLoading" style="width: 50%" text="提交" @click="handleSubmit"></up-button>
|
||||
</uni-section>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, toRefs, watch } from 'vue'
|
||||
import { computed, ref, toRefs, watch, onMounted } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
|
||||
const btnLoading = ref(false)
|
||||
let sampleCode = ref('')
|
||||
let sampleList = ref([])
|
||||
let receiver = ref('')
|
||||
|
||||
const range = ref([])
|
||||
const userInfo = computed(() => nx.$store('user').userInfo)
|
||||
|
||||
const receiverId = ref('')
|
||||
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/sampleDispatchExternal/detail') return
|
||||
if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleDispatchInternal/index') return
|
||||
try {
|
||||
sampleCode.value = newVal
|
||||
sampleCode.value = val
|
||||
getScanSample()
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '请扫描正确的样品编码',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}, 300)
|
||||
onShow(() => {
|
||||
scanQRInfo.value = ''
|
||||
})
|
||||
|
||||
let dispatchTempId = ref('')
|
||||
// 创建临时数据
|
||||
async function createDispatchTempData() {
|
||||
const data = await nx.$api.sampleWarehouse.createDispatchTempData()
|
||||
dispatchTempId.value = data.id
|
||||
}
|
||||
async function getScanSample() {
|
||||
if (sampleCode.value === '') return
|
||||
await nx.$api.sampleWarehouse.addDispatchSample({ id: dispatchTempId.value, sampleReturnCode: sampleCode.value })
|
||||
getSampleList()
|
||||
}
|
||||
async function getSampleList() {
|
||||
const { list } = await nx.$api.sampleWarehouse.querySampleDispatchApplyDetail({
|
||||
pageSize: 999,
|
||||
pageNo: 1,
|
||||
parentId: dispatchTempId.value
|
||||
})
|
||||
sampleList.value = list
|
||||
}
|
||||
async function handleSubmit() {
|
||||
await nx.$api.sampleWarehouse.execSampleDispatch({})
|
||||
if (receiverId.value === '') {
|
||||
return uni.showToast({
|
||||
title: '请选择样品领取人',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
btnLoading.value = true
|
||||
const receiver = range.value.find(item => item.value === receiverId.value)?.nickname
|
||||
await nx.$api.sampleWarehouse
|
||||
.execSampleDispatch({
|
||||
id: dispatchTempId.value,
|
||||
applyUserId: receiverId.value,
|
||||
applyUser: receiver
|
||||
})
|
||||
.finally(() => {
|
||||
btnLoading.value = false
|
||||
})
|
||||
uni.showToast({
|
||||
title: '调拨成功',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.navigateBack()
|
||||
}
|
||||
function handleReset() {
|
||||
sampleCode.value = ''
|
||||
sampleList.value = []
|
||||
createDispatchTempData()
|
||||
}
|
||||
onMounted(async () => {
|
||||
const data = await nx.$api.user.getAssignUserList()
|
||||
range.value = data.map(item => ({ text: item.nickname, value: item.id }))
|
||||
handleReset()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -87,4 +140,7 @@ async function handleSubmit() {
|
||||
top: 5px;
|
||||
}
|
||||
}
|
||||
:deep(.uni-select__input-placeholder) {
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -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 = ''
|
||||
})
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user