广丰卷烟厂数采质量分析系统
zhuguifei
2026-03-20 3471290659516cf21db3211a9053daff5f283e03
ruoyi-plus-soybean/src/views/qm/checkitem/modules/checkitem-operate-drawer.vue
@@ -6,6 +6,7 @@
  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';
@@ -76,6 +77,7 @@
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 = {};
@@ -96,6 +98,26 @@
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);
}
@@ -139,6 +161,8 @@
  // Fetch options for rid
  await fetchRidOptions();
  // Fetch options for instrument
  await fetchInstrumentOptions();
  if (props.operateType === 'add' && props.stdCode) {
    model.value.stdCode = props.stdCode;
@@ -202,7 +226,17 @@
        <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>