Przeglądaj źródła

增加商品分类检验,调整布局,优化多余代码。

Guos 1 tydzień temu
rodzic
commit
f8156aa1c6
2 zmienionych plików z 168 dodań i 3 usunięć
  1. 10 0
      src/api/store/storeProduct.js
  2. 158 3
      src/views/store/storeProduct/index.vue

+ 10 - 0
src/api/store/storeProduct.js

@@ -232,3 +232,13 @@ export function selectForbiddenKeywords(keywords) {
 }
 
 
+// 获取器免列表
+export function getExemptSecondMedicalDeviceList() {
+  return request({
+    url: '/store/exemptSecondMedicalDevice/getList',
+    method: 'get'
+  })
+}
+
+
+

+ 158 - 3
src/views/store/storeProduct/index.vue

@@ -486,6 +486,16 @@
           </el-select>
         </el-form-item>
 
+        <!-- 器械编码和显示器免按钮 -->
+        <el-form-item label="器械编码" prop="medicalDeviceCode" v-if="showMedicalDeviceCode">
+          <el-input v-model="form.medicalDeviceCode" @blur="handleMedicalDeviceCodeBlur" placeholder="请输入器械编码" style="width: calc(100% - 120px);"/>
+          <el-button type="primary" @click="showExemptDeviceDialog" style="margin-left: 10px;" v-if="showExemptDeviceButton">显示器免</el-button>
+        </el-form-item>
+
+
+
+        
+
         <el-row>
           <el-col :span="12">
             <el-form-item label="关键字" prop="keyword">
@@ -1076,6 +1086,34 @@
     <el-button type="primary" @click="authVisible = false">关 闭</el-button>
   </span>
     </el-dialog>
+
+<!-- 免于经营备案的第二类医疗器械产品弹窗 -->
+<el-dialog title="免于经营备案的第二类医疗器械产品" :visible.sync="exemptDeviceDialogVisible" width="80%" append-to-body :modal-append-to-body="false" z-index="9999" top="5vh" custom-class="exempt-device-dialog">
+  <el-form :model="exemptDeviceQueryParams" ref="exemptDeviceQueryForm" :inline="true" label-width="80px">
+    <el-form-item label="产品名称">
+      <el-input v-model="exemptDeviceQueryParams.productName" placeholder="请输入产品名称" clearable size="small" @keyup.enter.native="handleExemptDeviceQuery" />
+    </el-form-item>
+    <el-form-item>
+      <el-button type="primary" icon="el-icon-search" size="mini" @click="handleExemptDeviceQuery">搜索</el-button>
+      <el-button icon="el-icon-refresh" size="mini" @click="resetExemptDeviceQuery">重置</el-button>
+    </el-form-item>
+  </el-form>
+
+  <el-table v-loading="exemptDeviceLoading" :data="exemptDeviceList" border>
+    <el-table-column label="产品序号" align="center" prop="serialNumber" />
+    <el-table-column label="产品名称" align="center" prop="productName" />
+    <el-table-column label="目录名称" align="center" prop="directoryName" />
+    <el-table-column label="产品描述" align="center" prop="productDescription" />
+    <el-table-column label="产品用途" align="center" prop="usageStr" />
+    <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
+    <el-table-column label="更新时间" align="center" prop="updateTime" width="180" />
+  </el-table>
+
+  <div slot="footer" class="dialog-footer">
+    <el-button @click="exemptDeviceDialogVisible = false">关 闭</el-button>
+  </div>
+</el-dialog>
+
   </div>
 </template>
 
@@ -1106,7 +1144,7 @@ import singleImg from '@/components/Material/single'
 import {getCompanyList} from "@/api/company/company";
 import {listStore} from '@/api/store/store'
 import {getConfigByKey} from '@/api/system/config'
-import {qualifications, checkStoreDrugLicense, selectForbiddenKeywords} from "@/api/store/storeProduct";
+import {qualifications, checkStoreDrugLicense, selectForbiddenKeywords,getExemptSecondMedicalDeviceList} from "@/api/store/storeProduct";
 
 export default {
   name: "HisStoreProduct",
@@ -1249,9 +1287,13 @@ export default {
         }else {
           this.displayDemo=false;
         }
-        // 调用药品许可证检查接口
+        // 调用医疗器械许可证检查接口(仅当是II类或III类器械时)
         if (newVal) {
-          this.checkStoreDrugLicense(newVal);
+          const isMedicalDevice = cateName !== undefined && (cateName.includes('III类器械') || cateName.includes('II类器械'));
+          // 只有当是II类或III类器械时才检查,具体调用会在器械编码失去焦点时进行
+          if (!isMedicalDevice) {
+            this.checkStoreDrugLicense(newVal);
+          }
         }
         // 清除验证状态
         this.$nextTick(() => {
@@ -1270,6 +1312,19 @@ export default {
       immediate: true
     }
   },
+  computed: {
+    // 是否显示器械编码输入框(II类或III类器械)
+    showMedicalDeviceCode() {
+      const cateName = this.cateIdToNameMap[this.form.cateId];
+      return cateName !== undefined && (cateName.includes('III类器械') || cateName.includes('II类器械'));
+    },
+    // 是否显示"显示器免"按钮(仅II类器械)
+    showExemptDeviceButton() {
+      const cateName = this.cateIdToNameMap[this.form.cateId];
+      // 确保只在II类器械时显示,不包括III类器械
+      return cateName !== undefined && cateName.includes('II类器械') && !cateName.includes('III类器械');
+    }
+  },
   data() {
     return {
       isIngredientValid: true, // 成分是否有效
@@ -1373,6 +1428,15 @@ export default {
       // 企业列表
       companyOptions: [],
       storeOptions: [],
+      // 免于经营备案的第二类医疗器械产品相关变量
+      exemptDeviceDialogVisible: false,
+      exemptDeviceList: [],
+      allExemptDeviceList: [], // 保存所有数据用于本地搜索
+      exemptDeviceLoading: false,
+      exemptDeviceTotal: 0,
+      exemptDeviceQueryParams: {
+        productName: null
+      },
       // 遮罩层
       loading: true,
       // 选中数组
@@ -1440,9 +1504,13 @@ export default {
         isCertificatePermanent:null,
         isLicensePermanent:null,
         isBusinessPermanent:null,
+        medicalDeviceCode: null, // 器械编码
       },
       // 表单校验
       rules: {
+        medicalDeviceCode: [
+          { required: true, message: "器械编码不能为空", trigger: "blur" }
+        ],
         ingredient: [
           { required: true, message: "成分不能为空", trigger: "blur" }
         ],
@@ -1590,6 +1658,7 @@ export default {
       });
     },
     // 检查店铺药品许可证
+    // 检查店铺药品许可证
     checkStoreDrugLicense(cateId) {
       checkStoreDrugLicense({ cateId: cateId }).then(response => {
         if (response.data.flag === false) {
@@ -1604,6 +1673,41 @@ export default {
         this.isLicenseValid = false;
       });
     },
+    // 检查医疗器械许可证(仅当分类为II类或III类器械且器械编码不为空时)
+    checkMedicalDeviceLicense(cateId, medicalDeviceCode) {
+      // 检查是否为II类或III类器械
+      const cateName = this.cateIdToNameMap[cateId];
+      const isMedicalDevice = cateName !== undefined && (cateName.includes('III类器械') || cateName.includes('II类器械'));
+      
+      // 只有当是II类或III类器械且器械编码不为空时才调用接口
+      if (isMedicalDevice && medicalDeviceCode) {
+        checkStoreDrugLicense({ cateId: cateId, medicalDeviceCode: medicalDeviceCode }).then(response => {
+          if (response.data.flag === false) {
+            this.$message.error(response.data.message || '医疗器械许可证检查失败');
+            this.isLicenseValid = false;
+          } else {
+            this.isLicenseValid = true;
+          }
+        }).catch(error => {
+          this.$message.error('医疗器械许可证检查异常');
+          this.isLicenseValid = false;
+        });
+      }
+    },
+    // 处理器械编码失去焦点事件
+    handleMedicalDeviceCodeBlur() {
+      // 检查是否为II类或III类器械
+      const cateName = this.cateIdToNameMap[this.form.cateId];
+      const isMedicalDevice = cateName !== undefined && (cateName.includes('III类器械') || cateName.includes('II类器械'));
+      
+      // 只有当是II类或III类器械时才处理
+      if (isMedicalDevice) {
+        // 如果器械编码不为空,则调用检查接口
+        if (this.form.medicalDeviceCode) {
+          this.checkMedicalDeviceLicense(this.form.cateId, this.form.medicalDeviceCode);
+        }
+      }
+    },
     handleNoticeInfo() {
       qualifications()
         .then(response => {
@@ -2326,6 +2430,57 @@ export default {
         })
         .catch(_ => {});
     },
+    /**
+     * 重置免于经营备案的第二类医疗器械产品搜索条件
+     */
+    resetExemptDeviceQuery() {
+      this.exemptDeviceQueryParams = {
+        productName: null
+      };
+      this.handleExemptDeviceQuery();
+    },
+    /**
+     * 搜索免于经营备案的第二类医疗器械产品
+     */
+    handleExemptDeviceQuery() {
+      this.exemptDeviceQueryParams.pageNum = 1;
+      this.getExemptDeviceList();
+    },
+    /**
+     * 获取免于经营备案的第二类医疗器械产品列表
+     */
+    getExemptDeviceList() {
+      this.exemptDeviceLoading = true;
+  // 调用实际的API接口来获取数据
+      getExemptSecondMedicalDeviceList(this.exemptDeviceQueryParams).then(response => {
+        this.allExemptDeviceList = response.rows || response.data || [];
+        // 根据搜索条件过滤数据
+        if (this.exemptDeviceQueryParams.productName) {
+          const searchTerm = this.exemptDeviceQueryParams.productName.toLowerCase();
+          this.exemptDeviceList = this.allExemptDeviceList.filter(item =>
+            item.productName && item.productName.toLowerCase().includes(searchTerm)
+          );
+        } else {
+          this.exemptDeviceList = this.allExemptDeviceList;
+        }
+        this.exemptDeviceTotal = this.exemptDeviceList.length;
+        this.exemptDeviceLoading = false;
+      }).catch(error => {
+        console.error('获取免于经营备案的第二类医疗器械产品列表失败:', error);
+        this.$message.error('获取免于经营备案的第二类医疗器械产品列表失败');
+        this.exemptDeviceLoading = false;
+        this.exemptDeviceList = [];
+        this.allExemptDeviceList = [];
+        this.exemptDeviceTotal = 0;
+      });
+    },
+    /**
+     * 显示免于经营备案的第二类医疗器械产品弹窗
+     */
+    showExemptDeviceDialog() {
+      this.exemptDeviceDialogVisible = true;
+      this.getExemptDeviceList();
+    },
     /**
      * 复制商品
      * **/