From 2b31fa203f3435a582be51f45899d99164c9917a Mon Sep 17 00:00:00 2001
From: zhuguifei <312353457@qq.com>
Date: 星期四, 09 四月 2026 13:34:59 +0800
Subject: [PATCH] Merge branch 'master' of http://lanpucloud.cn:1111/r/SC/gfzl
---
ruoyi-plus-soybean/src/views/qm/checkitem/modules/checkitem-operate-drawer.vue | 136 +++++++++++++++++++++++++++++++++++----------
1 files changed, 106 insertions(+), 30 deletions(-)
diff --git a/ruoyi-plus-soybean/src/views/qm/checkitem/modules/checkitem-operate-drawer.vue b/ruoyi-plus-soybean/src/views/qm/checkitem/modules/checkitem-operate-drawer.vue
index 4037161..529aa4e 100755
--- a/ruoyi-plus-soybean/src/views/qm/checkitem/modules/checkitem-operate-drawer.vue
+++ b/ruoyi-plus-soybean/src/views/qm/checkitem/modules/checkitem-operate-drawer.vue
@@ -1,11 +1,8 @@
<script setup lang="ts">
import { computed, ref, watch } from 'vue';
import { jsonClone } from '@sa/utils';
-import {
- fetchCreateCheckitem,
- fetchGetRid,
- fetchUpdateCheckitem
-} from '@/service/api/qm/checkitem';
+import { fetchCreateCheckitem, 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 +73,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 = {};
@@ -98,35 +96,51 @@
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);
+}
function createDefaultModel(): Model {
return {
- id: '',
- itemCode: '',
- itemName: '',
- unit: '',
- enable: 1,
- del: 0,
- itemDes: '',
- stdCode: '',
- instrumentDes: '',
- location: '',
- checkLevel: '',
- ismix: null,
- rid: null,
- category: null,
- instrumentCode: '',
- score: null
+ id: '',
+ itemCode: '',
+ itemName: '',
+ unit: '',
+ enable: 1,
+ del: 0,
+ itemDes: '',
+ stdCode: '',
+ instrumentDes: '',
+ location: '',
+ checkLevel: '',
+ ismix: null,
+ rid: null,
+ category: null,
+ instrumentCode: '',
+ score: null
};
}
-type RuleKey = Extract<
- keyof Model,
- | 'id'
->;
+type RuleKey = Extract<keyof Model, 'id'>;
const rules: Record<RuleKey, App.Global.FormRule> = {
- id: createRequiredRule('缂栫爜涓嶈兘涓虹┖'),
+ id: createRequiredRule('缂栫爜涓嶈兘涓虹┖')
};
async function handleUpdateModelWhenEdit() {
@@ -139,6 +153,8 @@
// Fetch options for rid
await fetchRidOptions();
+ // Fetch options for instrument
+ await fetchInstrumentOptions();
if (props.operateType === 'add' && props.stdCode) {
model.value.stdCode = props.stdCode;
@@ -152,17 +168,67 @@
async function handleSubmit() {
await validate();
- const { id, itemCode, itemName, unit, enable, del, itemDes, stdCode, instrumentDes, location, checkLevel, ismix, rid, category, instrumentCode, score } = model.value;
+ const {
+ id,
+ itemCode,
+ itemName,
+ unit,
+ enable,
+ del,
+ itemDes,
+ stdCode,
+ instrumentDes,
+ location,
+ checkLevel,
+ ismix,
+ rid,
+ category,
+ instrumentCode,
+ score
+ } = model.value;
// request
if (props.operateType === 'add') {
- const payload = { itemCode, itemName, unit, enable, del, itemDes, stdCode, instrumentDes, location, checkLevel, ismix, rid, category, instrumentCode, score };
+ const payload = {
+ itemCode,
+ itemName,
+ unit,
+ enable,
+ del,
+ itemDes,
+ stdCode,
+ instrumentDes,
+ location,
+ checkLevel,
+ ismix,
+ rid,
+ category,
+ instrumentCode,
+ score
+ };
const { error } = await fetchCreateCheckitem(payload);
if (error) return;
}
if (props.operateType === 'edit') {
- const payload = { id, itemCode, itemName, unit, enable, del, itemDes, stdCode, instrumentDes, location, checkLevel, ismix, rid, category, instrumentCode, score };
+ const payload = {
+ id,
+ itemCode,
+ itemName,
+ unit,
+ enable,
+ del,
+ itemDes,
+ stdCode,
+ instrumentDes,
+ location,
+ checkLevel,
+ ismix,
+ rid,
+ category,
+ instrumentCode,
+ score
+ };
const { error } = await fetchUpdateCheckitem(payload);
if (error) return;
}
@@ -202,7 +268,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>
--
Gitblit v1.9.3