提交
This commit is contained in:
1 parent
c6c3a37fa7
commit
e6b4b9a8d7
28 files changed
+5812
-4687
No files matched your search
@@ -18,6 +18,33 @@
|
||||
<el-form-item label="关键词">
|
||||
<el-input v-model="searchForm.keyword" placeholder="样本编码/备注" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="编码类型">
|
||||
<el-select
|
||||
v-model="searchForm.sampleCodeType"
|
||||
placeholder="全部"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="造血编码 (ZKZX)" value="zxbm" />
|
||||
<el-option label="脐带编码 (ZKQD)" value="qdbm" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="下发对象">
|
||||
<el-select
|
||||
v-model="searchForm.issuedUserId"
|
||||
placeholder="全部"
|
||||
filterable
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in userOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">模糊查询。</span>
|
||||
@@ -39,6 +66,7 @@
|
||||
新增样本编码
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" @click="openBatchGenerate">
|
||||
<el-icon><DocumentAdd /></el-icon>
|
||||
批量生成
|
||||
</el-button>
|
||||
<el-button
|
||||
@@ -46,6 +74,7 @@
|
||||
:disabled="selectedRows.length === 0"
|
||||
@click="openBatchIssue"
|
||||
>
|
||||
<el-icon><Promotion /></el-icon>
|
||||
批量下发
|
||||
</el-button>
|
||||
<el-button
|
||||
@@ -53,6 +82,7 @@
|
||||
:disabled="selectedRows.length === 0"
|
||||
@click="handleBatchRevoke"
|
||||
>
|
||||
<el-icon><RefreshRight /></el-icon>
|
||||
批量收回
|
||||
</el-button>
|
||||
<el-button
|
||||
@@ -130,6 +160,16 @@
|
||||
>
|
||||
<template #default="{ row }">{{ row.issuedTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ row.remark || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
label="创建时间"
|
||||
@@ -316,7 +356,17 @@
|
||||
maxlength="32"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isEdit" label="编码类型">
|
||||
<el-form-item v-if="!isEdit" label="编码类型" prop="sampleCodeType">
|
||||
<el-select
|
||||
v-model="formData.sampleCodeType"
|
||||
placeholder="请选择"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="造血编码 (ZKZX)" value="zxbm" />
|
||||
<el-option label="脐带编码 (ZKQD)" value="qdbm" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="编码类型">
|
||||
<span class="text-sm text-gray-500">{{ sampleCodeTypeLabel(formData.sampleCodeType) }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否下发">
|
||||
@@ -329,7 +379,7 @@
|
||||
inactive-text="否"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formData.issued === 1" label="下发用户">
|
||||
<el-form-item v-if="formData.issued === 1" label="下发用户" prop="issuedUserId">
|
||||
<el-select
|
||||
v-model="formData.issuedUserId"
|
||||
placeholder="请选择用户"
|
||||
@@ -378,7 +428,18 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Plus, Close, Check, View, Ticket, RefreshLeft, Search } from '@element-plus/icons-vue'
|
||||
import {
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
View,
|
||||
Ticket,
|
||||
RefreshLeft,
|
||||
Search,
|
||||
DocumentAdd,
|
||||
Promotion,
|
||||
RefreshRight
|
||||
} from '@element-plus/icons-vue'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
|
||||
import {
|
||||
@@ -395,7 +456,11 @@
|
||||
|
||||
defineOptions({ name: 'BizSampleCode' })
|
||||
|
||||
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
|
||||
const searchForm = reactive<{ keyword: string; sampleCodeType: string; issuedUserId: string }>({
|
||||
keyword: '',
|
||||
sampleCodeType: '',
|
||||
issuedUserId: ''
|
||||
})
|
||||
const tableData = ref<Api.BizSampleCode.SampleCodeItem[]>([])
|
||||
const selectedRows = ref<Api.BizSampleCode.SampleCodeItem[]>([])
|
||||
const loading = ref(false)
|
||||
@@ -489,7 +554,20 @@
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
sampleCode: [{ required: true, message: '请输入样本编码', trigger: 'blur' }]
|
||||
sampleCode: [{ required: true, message: '请输入样本编码', trigger: 'blur' }],
|
||||
sampleCodeType: [{ required: true, message: '请选择编码类型', trigger: 'change' }],
|
||||
issuedUserId: [
|
||||
{
|
||||
validator: (_rule: unknown, value: string, callback: (err?: Error) => void) => {
|
||||
if (formData.issued === 1 && !(value || '').trim()) {
|
||||
callback(new Error('请选择下发用户'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
},
|
||||
trigger: 'change'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const handleSelectionChange = (rows: Api.BizSampleCode.SampleCodeItem[]) => {
|
||||
@@ -502,7 +580,9 @@
|
||||
const res = await fetchSampleCodeList({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
keyword: searchForm.keyword || undefined
|
||||
keyword: searchForm.keyword || undefined,
|
||||
sampleCodeType: searchForm.sampleCodeType || undefined,
|
||||
issuedUserId: searchForm.issuedUserId || undefined
|
||||
})
|
||||
tableData.value = res.list || []
|
||||
pagination.total = res.total ?? 0
|
||||
@@ -518,13 +598,15 @@
|
||||
|
||||
function handleReset() {
|
||||
searchForm.keyword = ''
|
||||
searchForm.sampleCodeType = ''
|
||||
searchForm.issuedUserId = ''
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.sampleCode = ''
|
||||
formData.sampleCodeType = ''
|
||||
formData.sampleCodeType = 'zxbm'
|
||||
formData.issued = 0
|
||||
formData.issuedUserId = ''
|
||||
formData.issuedUserName = ''
|
||||
@@ -534,12 +616,22 @@
|
||||
editingId.value = null
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
async function loadUserOptions() {
|
||||
if (userOptions.value.length) return
|
||||
try {
|
||||
userOptions.value = await fetchUserOptions()
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAdd() {
|
||||
isEdit.value = false
|
||||
dialogTitle.value = '新增样本编码'
|
||||
resetForm()
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
await loadUserOptions()
|
||||
}
|
||||
|
||||
async function handleEdit(row: Api.BizSampleCode.SampleCodeItem) {
|
||||
@@ -556,22 +648,26 @@
|
||||
formData.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
if (!userOptions.value.length) {
|
||||
try {
|
||||
userOptions.value = await fetchUserOptions()
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
await loadUserOptions()
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
await formRef.value?.validate?.()
|
||||
submitLoading.value = true
|
||||
try {
|
||||
const issueUserOpt =
|
||||
formData.issued === 1
|
||||
? userOptions.value.find((u) => u.value === formData.issuedUserId)
|
||||
: undefined
|
||||
const payload = {
|
||||
sampleCode: formData.sampleCode.trim(),
|
||||
sampleCodeType: !isEdit.value ? formData.sampleCodeType || undefined : undefined,
|
||||
issued: formData.issued,
|
||||
issuedUserId: formData.issued === 1 ? formData.issuedUserId || undefined : null,
|
||||
issuedUserName: formData.issued === 1 ? formData.issuedUserName || undefined : null,
|
||||
issuedUserName:
|
||||
formData.issued === 1
|
||||
? (formData.issuedUserName || issueUserOpt?.label || '').trim() || undefined
|
||||
: null,
|
||||
issuedTime: formData.issuedTime || undefined,
|
||||
orderNum: formData.orderNum,
|
||||
remark: formData.remark?.trim() || undefined
|
||||
@@ -664,11 +760,7 @@
|
||||
if (!selectedRows.value.length) return
|
||||
batchIssueForm.issuedUserId = ''
|
||||
batchIssueVisible.value = true
|
||||
if (!userOptions.value.length) {
|
||||
try {
|
||||
userOptions.value = await fetchUserOptions()
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
await loadUserOptions()
|
||||
}
|
||||
|
||||
async function handleBatchIssue() {
|
||||
@@ -690,7 +782,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
await loadUserOptions()
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user