| | |
| | | fetchGetRid, |
| | | fetchUpdateCheckitem |
| | | } from '@/service/api/qm/checkitem'; |
| | | import { fetchGetInstrumentList } from '@/service/api/md/instrument'; |
| | | import { useFormRules, useNaiveForm } from '@/hooks/common/form'; |
| | | import { $t } from '@/locales'; |
| | | |
| | |
| | | |
| | | const model = ref<Model>(createDefaultModel()); |
| | | const ridOptions = ref<{ label: string; value: string | number }[]>([]); |
| | | const instrumentOptions = ref<{ label: string; value: string | number }[]>([]); |
| | | |
| | | async function fetchRidOptions(searchText?: string) { |
| | | const params: any = {}; |
| | |
| | | |
| | | function handleRidSelectSearch(query: string) { |
| | | fetchRidOptions(query); |
| | | } |
| | | |
| | | async function fetchInstrumentOptions(searchText?: string) { |
| | | const params: any = {}; |
| | | if (searchText) { |
| | | params.instrumentName = searchText; |
| | | } |
| | | const { data } = await fetchGetInstrumentList(params); |
| | | if (data && data.rows) { |
| | | instrumentOptions.value = data.rows.map(item => ({ |
| | | label: item.instrumentName, |
| | | value: item.instrumentCode |
| | | })); |
| | | } else { |
| | | instrumentOptions.value = []; |
| | | } |
| | | } |
| | | |
| | | function handleInstrumentSelectSearch(query: string) { |
| | | fetchInstrumentOptions(query); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // Fetch options for rid |
| | | await fetchRidOptions(); |
| | | // Fetch options for instrument |
| | | await fetchInstrumentOptions(); |
| | | |
| | | if (props.operateType === 'add' && props.stdCode) { |
| | | model.value.stdCode = props.stdCode; |
| | |
| | | <NFormItem label="检验项描述" path="itemDes"> |
| | | <NInput v-model:value="model.itemDes" placeholder="请输入检验项描述" /> |
| | | </NFormItem> |
| | | |
| | | <NFormItem label="检测仪器" path="instrumentCode"> |
| | | <NSelect |
| | | v-model:value="model.instrumentCode" |
| | | :options="instrumentOptions" |
| | | placeholder="请选择检测仪器" |
| | | clearable |
| | | filterable |
| | | @search="handleInstrumentSelectSearch" |
| | | @focus="() => fetchInstrumentOptions()" |
| | | /> |
| | | </NFormItem> |
| | | <NFormItem label="仪器描述" path="instrumentDes"> |
| | | <NInput v-model:value="model.instrumentDes" placeholder="请输入仪器描述" /> |
| | | </NFormItem> |