|
@@ -53,12 +53,26 @@ export default {
|
|
|
this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
- // 质控项目
|
|
|
- getObjectData() {
|
|
|
- get_select_object().then(res => {
|
|
|
+ /**
|
|
|
+ * 获取质控项目数据
|
|
|
+ * @param {number|string} type - 规则类型,可选参数
|
|
|
+ */
|
|
|
+ getObjectData(type) {
|
|
|
+ // 构建请求参数对象
|
|
|
+ const params = {}
|
|
|
+
|
|
|
+ // 如果传入了type参数,添加到请求中
|
|
|
+ if (type !== undefined) {
|
|
|
+ params.rule_type = type
|
|
|
+ }
|
|
|
+
|
|
|
+ // 发起API请求获取对象数据
|
|
|
+ get_select_object(params).then(res => {
|
|
|
const { p } = res
|
|
|
this.objects = Array.isArray(p) ? p : []
|
|
|
- console.log(this.objects)
|
|
|
+ console.log('获取到质控项目数据:', this.objects)
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('获取质控项目数据失败:', error)
|
|
|
})
|
|
|
},
|
|
|
// 质控科室
|
|
@@ -70,8 +84,17 @@ export default {
|
|
|
},
|
|
|
handleRefresh(data) {
|
|
|
if (data && data.rule_type !== undefined) {
|
|
|
+ // 如果规则类型变化,更新ruleType并重新获取对象数据
|
|
|
+ const oldRuleType = this.ruleType
|
|
|
this.ruleType = data.rule_type
|
|
|
+
|
|
|
+ // 如果规则类型发生变化,重新获取对象数据
|
|
|
+ if (oldRuleType !== this.ruleType) {
|
|
|
+ this.getObjectData(this.ruleType)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ // 获取列表数据
|
|
|
this.getList()
|
|
|
},
|
|
|
async getList() {
|
|
@@ -114,6 +137,15 @@ export default {
|
|
|
error_level: '',
|
|
|
status: ''
|
|
|
}
|
|
|
+ },
|
|
|
+ // 手动切换规则类型的方法(如果需要)
|
|
|
+ changeRuleType(newType) {
|
|
|
+ if (this.ruleType !== newType) {
|
|
|
+ this.ruleType = newType
|
|
|
+ // 切换规则类型后重新获取对象数据和列表
|
|
|
+ this.getObjectData(this.ruleType)
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|