From 9862248787934f4242ac9636e0c4d5b8ee0870b8 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期二, 20 十月 2026 16:45:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/CNAS/process/ensureResults/ensureResultsValidity/components/detailFormDialog.vue | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/src/views/CNAS/process/ensureResults/ensureResultsValidity/components/detailFormDialog.vue b/src/views/CNAS/process/ensureResults/ensureResultsValidity/components/detailFormDialog.vue
index 6341f59..88318c1 100644
--- a/src/views/CNAS/process/ensureResults/ensureResultsValidity/components/detailFormDialog.vue
+++ b/src/views/CNAS/process/ensureResults/ensureResultsValidity/components/detailFormDialog.vue
@@ -52,9 +52,16 @@
</el-select>
</el-form-item></el-col>
<el-col :span="12"><el-form-item label="鍘熷璁板綍妯℃澘" prop="templateIds">
- <el-select v-model="form.templateIds" multiple collapse-tags filterable style="width: 100%" placeholder="鍙�夋嫨澶氫釜妯℃澘">
+ <el-select v-model="form.templateIds" multiple collapse-tags filterable style="width: 100%"
+ :loading="templateBindingLoading" :disabled="!form.standardMethodId"
+ :placeholder="form.standardMethodId ? '璇烽�夋嫨鍘熷璁板綍妯℃澘' : '璇峰厛閫夋嫨妫�娴嬫爣鍑�'"
+ :no-data-text="form.standardMethodId ? '璇ユ娴嬫爣鍑嗘殏鏈粦瀹氬師濮嬭褰曟ā鏉�' : '璇峰厛閫夋嫨妫�娴嬫爣鍑�'">
<el-option v-for="item in templateOptions" :key="item.id" :value="item.id" :label="item.name" />
</el-select>
+ <div v-if="form.standardMethodId && !templateBindingLoading && templateOptions.length === 0"
+ style="font-size: 12px; line-height: 18px; color: var(--el-color-warning); margin-top: 4px;">
+ 璇ユ娴嬫爣鍑嗗湪鏍囧噯搴撲腑灏氭湭缁戝畾鍘熷璁板綍妯℃澘锛岃鍏堝湪鏍囧噯搴撲腑瀹屾垚缁戝畾銆�
+ </div>
</el-form-item></el-col>
<el-col :span="12"><el-form-item label="鏍峰搧鍚嶇О"><el-input v-model="form.sampleName" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="鏍峰搧瑙勬牸"><el-input v-model="form.sampleSpec" /></el-form-item></el-col>
@@ -84,6 +91,7 @@
} from "@/api/cnas/process/ensureResults/qualityMonitor";
import { selectStandardMethodList } from '@/api/cnas/process/method/standardMethod';
import { selectStandardTemplatePageList } from '@/api/standard/model';
+import { selectTemplateBindingsByStandardMethod } from '@/api/standard/standardLibrary';
import { selectUserCondition } from '@/api/performance/class';
export default {
@@ -119,7 +127,9 @@
dueDate: null,
},
standardOptions: [],
+ allTemplateOptions: [],
templateOptions: [],
+ templateBindingLoading: false,
userOptions: [],
rules: {
monitorProject: [{ required: true, message: '璇疯緭鍏ヨ川鎺ч」鐩�', trigger: 'blur' }],
@@ -137,12 +147,18 @@
methods: {
openDia(type, row) {
this.formDia = true
- selectStandardMethodList({ current: 1, size: 1000 }).then(res => { this.standardOptions = res.data?.records || res.data || [] })
- selectStandardTemplatePageList({ current: 1, size: 1000 }).then(res => { this.templateOptions = res.data?.records || res.data || [] })
- selectUserCondition({ type: 1 }).then(res => { this.userOptions = res.data || [] })
this.operationType = type
+ this.templateOptions = []
+ this.allTemplateOptions = []
+ this.templateBindingLoading = false
+ selectStandardMethodList({ current: 1, size: 1000 }).then(res => { this.standardOptions = res.data?.records || res.data || [] })
+ selectStandardTemplatePageList({ current: 1, size: 1000 }).then(res => { this.allTemplateOptions = res.data?.records || res.data || [] })
+ selectUserCondition({ type: 1 }).then(res => { this.userOptions = res.data || [] })
if (type === 'edit') {
this.searchInfo(row)
+ if (row.itemKind === 'INSPECTION' && row.standardMethodId) {
+ this.loadBoundTemplates(row.standardMethodId, this.form.templateIds)
+ }
}
},
searchInfo (row) {
@@ -156,6 +172,37 @@
if (standard) this.form.technicalStandardText = `${standard.code || ''} ${standard.name || ''}`.trim()
this.form.templateIds = []
this.form.templateId = null
+ // 鍜屽鎵樹笅鍗曚繚鎸佷竴鑷达細閫夋嫨妫�娴嬫爣鍑嗗悗锛屽彧灞曠ず璇ユ爣鍑嗗湪鏍囧噯搴撲腑宸茬粦瀹氱殑鍘熷璁板綍妯℃澘
+ this.loadBoundTemplates(id)
+ },
+ loadBoundTemplates(standardMethodId, selectedIds = null) {
+ const currentIds = Array.isArray(selectedIds) ? selectedIds.map(Number) : null
+ this.templateOptions = []
+ if (currentIds === null) this.form.templateIds = []
+ if (!standardMethodId) return
+ this.templateBindingLoading = true
+ selectTemplateBindingsByStandardMethod({ standardMethodId }).then(res => {
+ const bound = (res.data || []).map(item => ({ id: Number(item.templateId), name: item.name }))
+ this.templateOptions = bound
+ if (currentIds === null) {
+ // 鏂板鎴栧垏鎹㈡娴嬫爣鍑嗘椂锛岄粯璁ら�変腑璇ユ爣鍑嗗凡缁戝畾鐨勫叏閮ㄦā鏉�
+ this.form.templateIds = bound.map(item => item.id)
+ return
+ }
+ // 缂栬緫鏃朵繚鐣欏師閫夋嫨锛涜嫢妯℃澘鍚庢潵琚В缁戯紝琛ュ厖鍚嶇О閬垮厤涓嬫媺妗嗗彧鏄剧ず ID
+ const boundIds = new Set(bound.map(item => item.id))
+ currentIds.forEach(id => {
+ if (!boundIds.has(id)) {
+ const template = this.allTemplateOptions.find(item => Number(item.id) === id)
+ if (template) this.templateOptions.push({ id: Number(template.id), name: template.name })
+ }
+ })
+ this.form.templateIds = currentIds
+ }).catch(() => {
+ this.templateOptions = []
+ }).finally(() => {
+ this.templateBindingLoading = false
+ })
},
buildEntity () {
const entity = this.HaveJson(this.form)
--
Gitblit v1.9.3