Ver código fonte

静态信息改为接口获取

wyq 3 anos atrás
pai
commit
4042514484
1 arquivos alterados com 49 adições e 28 exclusões
  1. 49 28
      src/components/icss/MedicineInfoPg.vue

+ 49 - 28
src/components/icss/MedicineInfoPg.vue

@@ -46,6 +46,7 @@ import 'quill/dist/quill.snow.css';
 import 'quill/dist/quill.bubble.css';
 import { quillEditor, Quill } from 'vue-quill-editor';
 import config from '@api/config';
+import api from '@api/knowledgeLib.js';
 import { container, ImageExtend, QuillWatch } from 'quill-image-extend-module';
 Quill.register('modules/ImageExtend', ImageExtend);
 export default {
@@ -128,7 +129,7 @@ export default {
     this.editorOption.modules.toolbar.container = this.toolbars[
       this.toolbarMode
     ];
-    this.renderPositions();
+    this.zskgetDict();
     if (this.isEdit) {
       setTimeout(() => {
         this.rules = {
@@ -164,6 +165,20 @@ export default {
   },
   mounted() {},
   methods: {
+    zskgetDict() {
+      api
+        .zskgetDict()
+        .then(res => {
+          if (res.data.code == '0') {
+            const data = res.data.data;
+            this.positions = data['50'];
+            this.renderPositions(data['50'], data['51']);
+          }
+        })
+        .catch(error => {
+          console.log(error);
+        });
+    },
     reOrder(i) {
       this.$emit('reOrder', i, this.index);
     },
@@ -185,36 +200,42 @@ export default {
       this.data.position = arr;
     },
     // 渲染内容类型
-    renderPositions() {
+    renderPositions(data1,data2) {
       //显示位置枚举列表
-      const pos = localStorage.getItem('knowledgeEnumsData');
-      console.log('this.showType,', this.showType);
-      let positions = config.contentTypes;
-      if (this.showType == 1) {
-        // 诊断
-        this.positions = positions.filter(item => item.key !== 2);
-      } else if (
-        this.showType == 3 ||
-        this.showType == 4 ||
-        this.showType == 5 ||
-        this.showType == 6
-      ) {
-        // 检验/检查
-        this.positions = positions.filter(item => {
-          return item.key <= 2;
+      if (this.showType>0) {
+        data2 = data2.filter(item => item.name == this.showType);
+        let val = data2[0].val.split(',');
+        this.positions = data1.filter(it => {
+          let arr = val.map(v => v);
+          return arr.includes(it.val);
         });
-      } else if (
-        this.showType == 2 ||
-        this.showType == 7 ||
-        this.showType == 8 ||
-        this.showType == 9 ||
-        this.showType == 10
-      ) {
-        // 药品/手术
-        this.positions = positions.filter(item => item.key === 1);
-      } else {
-        this.positions = positions;
       }
+      // let positions = config.contentTypes;
+      // if (this.showType == 1) {
+      //   // 诊断
+      //   this.positions = positions.filter(item => item.key !== 2);
+      // } else if (
+      //   this.showType == 3 ||
+      //   this.showType == 4 ||
+      //   this.showType == 5 ||
+      //   this.showType == 6
+      // ) {
+      //   // 检验/检查
+      //   this.positions = positions.filter(item => {
+      //     return item.key <= 2;
+      //   });
+      // } else if (
+      //   this.showType == 2 ||
+      //   this.showType == 7 ||
+      //   this.showType == 8 ||
+      //   this.showType == 9 ||
+      //   this.showType == 10
+      // ) {
+      //   // 药品/手术
+      //   this.positions = positions.filter(item => item.key === 1);
+      // } else {
+      //   this.positions = positions;
+      // }
     }
 
     /*emitVal(){