提交
This commit is contained in:
1 parent
427bcb1551
commit
31b04575e2
247 files changed
+39284
-20367
No files matched your search
@@ -470,7 +470,17 @@
|
||||
<el-input v-model="formData.standardUsage" placeholder="请输入标准用量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位">
|
||||
<el-select v-model="formData.unit" placeholder="请选择单位" clearable filterable>
|
||||
<el-select
|
||||
v-model="formData.unit"
|
||||
placeholder="输入单位检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:loading="unitOptionsLoading"
|
||||
:remote-method="remoteSearchUnits"
|
||||
@visible-change="onUnitSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in unitOptions"
|
||||
:key="item.value"
|
||||
@@ -1263,6 +1273,7 @@
|
||||
|
||||
const activeTab = ref('list')
|
||||
const unitOptions = ref<{ label: string; value: string }[]>([])
|
||||
const unitOptionsLoading = ref(false)
|
||||
|
||||
const searchForm = reactive<{ keyword: string; status: string }>({ keyword: '', status: '' })
|
||||
const tableRef = ref()
|
||||
@@ -1532,6 +1543,37 @@
|
||||
loadData()
|
||||
}
|
||||
|
||||
function ensureUnitInOptions(unitName: string) {
|
||||
const n = (unitName || '').trim()
|
||||
if (!n || unitOptions.value.some((o) => o.value === n)) return
|
||||
unitOptions.value = [{ label: n, value: n }, ...unitOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchUnits(query: string) {
|
||||
unitOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchItemUnitList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
unitOptions.value = (res.list || []).map((u: any) => ({
|
||||
label: u.unitName,
|
||||
value: u.unitName
|
||||
}))
|
||||
ensureUnitInOptions(formData.unit)
|
||||
} catch {
|
||||
unitOptions.value = []
|
||||
ensureUnitInOptions(formData.unit)
|
||||
} finally {
|
||||
unitOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onUnitSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.reagentCode = ''
|
||||
formData.reagentName = ''
|
||||
@@ -1551,6 +1593,7 @@
|
||||
resetForm()
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
function handleEdit(row: any) {
|
||||
@@ -1568,6 +1611,7 @@
|
||||
formData.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -2041,10 +2085,8 @@
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
const res = await fetchItemUnitList({ page: 1, pageSize: 100 })
|
||||
unitOptions.value = (res.list || []).map((u: any) => ({ label: u.unitName, value: u.unitName }))
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user