Преглед изворни кода

优化三类无器免按钮,优化定时提交器械编号,改为失去焦点提交,避免多次调用

Guos пре 1 недеља
родитељ
комит
7f783abf75
1 измењених фајлова са 17 додато и 17 уклоњено
  1. 17 17
      src/views/hisStore/storeProduct/index.vue

+ 17 - 17
src/views/hisStore/storeProduct/index.vue

@@ -515,8 +515,8 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="器械编码" prop="medicalDeviceCode" v-if="showMedicalDeviceCode">
-              <el-input v-model="form.medicalDeviceCode" placeholder="请输入器械编码" @blur="onCategoryOrStoreChange" @input="onMedicalDeviceCodeInput" style="width: calc(100% - 120px);"/>
-              <el-button type="primary" @click="showExemptDeviceDialog" style="margin-left: 10px;">显示器免</el-button>
+              <el-input v-model="form.medicalDeviceCode" placeholder="请输入器械编码" @blur="onCategoryOrStoreChange" style="width: calc(100% - 120px);"/>
+              <el-button type="primary" @click="showExemptDeviceDialog" style="margin-left: 10px;" v-if="shouldShowExemptDeviceButton">显示器免</el-button>
             </el-form-item>
           </el-col>
         </el-row>
@@ -1224,6 +1224,16 @@ export default {
     this.getTreeselect();
     this.getList();
   },
+  computed: {
+    // 计算属性:是否显示显示器免按钮
+    shouldShowExemptDeviceButton() {
+      // 只有在显示器械编码输入框且不是III类器械时才显示按钮
+      return this.showMedicalDeviceCode && 
+             this.form.cateId && 
+             this.cateIdToNameMap[this.form.cateId] && 
+             !this.cateIdToNameMap[this.form.cateId].includes('III类器械');
+    }
+  },
   watch: {
     licenseArr(val) {
       this.form.license = val.join(',');
@@ -1293,8 +1303,11 @@ export default {
         // 判断是否为II类器械或III类器械,如果是则显示器械编码输入框
         if (cateName !== undefined && (cateName.includes('II类器械') || cateName.includes('III类器械'))) {
           this.showMedicalDeviceCode = true;
+          // 只有当商品分类为II类器械时才显示显示器免按钮
+          this.showExemptDeviceButton = cateName.includes('II类器械');
         } else {
           this.showMedicalDeviceCode = false;
+          this.showExemptDeviceButton = false;
         }
 
         // 判断是否包含"处方药"
@@ -1396,6 +1409,7 @@ export default {
       displayDemo: false,
       cateIdToNameMap: {},
       showMedicalDeviceCode: false, // 是否显示器械编码输入框
+      showExemptDeviceButton: false, // 是否显示显示器免按钮
       businessArr: [],
       licenseArr: [],
       certificateArr: [],
@@ -1493,7 +1507,6 @@ export default {
       storeOptions: [],
       // 防抖定时器
       categoryOrStoreChangeTimer: null,
-      medicalDeviceCodeInputTimer: null,
       // 免于经营备案的第二类医疗器械产品相关变量
       exemptDeviceDialogVisible: false,
       exemptDeviceList: [],
@@ -1842,17 +1855,7 @@ export default {
         this.checkStoreLicensePermission();
       }, 500);
     },
-    // 器械编码输入事件
-    onMedicalDeviceCodeInput() {
-      // 使用防抖机制,避免频繁调用
-      clearTimeout(this.medicalDeviceCodeInputTimer);
-      this.medicalDeviceCodeInputTimer = setTimeout(() => {
-        // 只有当分类和店铺都已选择时才检查
-        if (this.form.cateId && this.form.storeId) {
-          this.checkStoreLicensePermission();
-        }
-      }, 500);
-    },
+
     // 显示免于经营备案的第二类医疗器械产品弹窗
     showExemptDeviceDialog() {
       this.exemptDeviceDialogVisible = true;
@@ -2747,9 +2750,6 @@ export default {
       if (this.categoryOrStoreChangeTimer) {
         clearTimeout(this.categoryOrStoreChangeTimer);
       }
-      if (this.medicalDeviceCodeInputTimer) {
-        clearTimeout(this.medicalDeviceCodeInputTimer);
-      }
     }
   }
 };