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

优化益寿缘医生端增加常用药品\常用诊断页面

cgp пре 1 недеља
родитељ
комит
3e39aa824f
2 измењених фајлова са 12 додато и 20 уклоњено
  1. 10 18
      src/views/components/collection/collectionDetail.vue
  2. 2 2
      src/views/his/prescribe/index.vue

+ 10 - 18
src/views/components/collection/collectionDetail.vue

@@ -1,6 +1,5 @@
 <template>
   <div class="app-container">
-    <!-- 可选:添加 loading 提示 -->
     <el-form ref="form" :model="form" label-width="140px" v-loading="loading">
       <div v-for="(answer, index) in form.answers" :key="index">
         <div style="margin-bottom: 20px; margin-top: 20px;">
@@ -9,14 +8,13 @@
           </span>
         </div>
         <div style="margin-left: 31px;">
-          <!-- flag 控制是否可编辑 -->
+          <!-- 只显示 value 在 answer.value 中的选项 -->
           <el-checkbox-group
-            :disabled="answer.flag || false"
             v-model="form.answers[index].value"
             size="mini"
           >
             <el-checkbox
-              v-for="dict in answer.options"
+              v-for="dict in filteredOptions(answer)"
               :key="dict.value"
               :label="dict.value"
             >
@@ -26,7 +24,6 @@
         </div>
       </div>
 
-      <!-- 如果没有数据 -->
       <div v-if="!form.answers || form.answers.length === 0" style="text-align: center; color: #999; padding: 20px;">
         暂无采集信息
       </div>
@@ -71,6 +68,14 @@ export default {
     }
   },
   methods: {
+    // 过滤出 answer.options 中 value 在 answer.value 数组里的选项
+    filteredOptions(answer) {
+      if (!Array.isArray(answer.value) || !Array.isArray(answer.options)) {
+        return [];
+      }
+      const selectedValues = new Set(answer.value); // 提升性能,避免多次遍历
+      return answer.options.filter(option => selectedValues.has(option.value));
+    },
     fetchCollectionInfo(userId) {
       this.loading = true;
       console.log("传入的用户信息:", userId)
@@ -95,16 +100,3 @@ export default {
   }
 };
 </script>
-
-<style scoped>
-::v-deep .el-checkbox__input.is-disabled + span.el-checkbox__label {
-    color: #1890ff;
-}
-::v-deep .el-checkbox-button.is-disabled.is-checked .el-checkbox-button__inner {
-    color: #1890ff;
-}
-::v-deep .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after {
-    border-color: #1890ff;
-}
-/* 可添加一些样式优化 */
-</style>

+ 2 - 2
src/views/his/prescribe/index.vue

@@ -958,11 +958,11 @@ export default {
       })
     },
     confirmPrescribe(){
+      //确认处方的同时保存处方
+      this.submitForm();
       confirmPrescribe(this.form).then(response => {
         if(response.code === 200) {
           this.$message.success("确认成功!");
-          //确认处方的同时保存处方
-          this.submitForm();
           this.open = false;
         } else {
           this.$message.error(response.message);