Prechádzať zdrojové kódy

fix:修复科室、病区下拉框下一层为空的问题及一些报错问题

sk 1 mesiac pred
rodič
commit
8b2992e3cd
1 zmenil súbory, kde vykonal 95 pridanie a 44 odobranie
  1. 95 44
      src/views/allcase/index.vue

+ 95 - 44
src/views/allcase/index.vue

@@ -2,7 +2,7 @@
   <div class="pages">
     <div class="bg-card" style="margin-bottom: 16px;">
       <el-form :model="formData" label-width="80px">
-        <el-row >
+        <el-row>
 
           <el-col :span="6">
             <el-form-item label="病案编号">
@@ -39,6 +39,8 @@
             </el-form-item>
           </el-col>
 
+        </el-row>
+        <el-row>
           <el-col :span="6">
             <el-form-item label="出院时间">
               <el-date-picker style="width: 94%;" v-model="formData.startTime" type="date" placeholder="出院开始日期"
@@ -625,25 +627,47 @@ export default {
       this.formData.KS_CODE = [];
       this.formData.BQ_CODE = [];
       this.$axios.post('CaseHistory/Terminal/getKsOptions', { 'YQ_CODE': this.formData.YQ_CODE }).then(res => {
-        this.searchOptions.ksArray = res.data.ksArray;//科室
-        this.searchOptions.bqArray = res.data.bqArray;//病区
+        this.searchOptions.ksArray = this.cancelChildren(res.data.ksArray);//科室
+        this.searchOptions.bqArray = this.cancelChildren(res.data.bqArray);//病区
       })
     },
     //科室change事件
     ksChange() {
       this.formData.BQ_CODE = [];
       this.$axios.post('CaseHistory/Terminal/getBqOptions', { 'KS_CODE': this.formData.KS_CODE }).then(res => {
-        this.searchOptions.bqArray = res.data.bqArray;//病区
+        this.searchOptions.bqArray = this.cancelChildren(res.data.bqArray);//病区
       })
     },
     //获取头部搜索options
     getSearchOptions() {
       this.$axios.post('CaseHistory/Terminal/getSearchOptions', {}).then(res => {
         this.searchOptions.yqArray = res.data.yqArray;//院区
-        this.searchOptions.ksArray = res.data.ksArray;//科室
-        this.searchOptions.bqArray = res.data.bqArray;//病区
+        this.searchOptions.ksArray = this.cancelChildren(res.data.ksArray);//科室
+        this.searchOptions.bqArray = this.cancelChildren(res.data.bqArray);//病区
+      })
+    },
+    //  将下拉框为空的children属性设置为undefined
+    cancelChildren(arr) {
+      if (!arr) {
+        return [];
+      }
+      return arr.map(item => {
+        if (item.children.length == 0) {
+          item.children = undefined;
+        } else {
+          item.children.map(childreItem => {
+            if (childreItem.children.length == 0) {
+              childreItem.children = undefined;
+            }
+            return childreItem
+          })
+        }
+        return item
       })
     },
+
+
+
     //头部默认出院日期
     getAAC01Date() {
       this.formData.startTime = moment().format('YYYY0101');
@@ -863,48 +887,53 @@ export default {
     getSummaryData() {
       let params = Object.assign({}, this.formData);
       this.$axios.post('/CaseHistory/Terminal/getTotalList', params).then(res => {
-        this.summaryData = res.data;
-      });
-   
-
-      const colors = ['#2e8241ff', '#ed8b1aff', '#f02b3fff', '#ff7f50', '#da70d6', '#32cd32', '#6495ed']
-      const option = {
-        xAxis: {},
-        grid: { // 让图表占满容器
-          top: "0px",
-          bottom: "0px"
-        },
-        yAxis: { data: this.summaryData.case_calibre.map(item => item.score_lv) },
-        series: [
-          {
-            type: 'bar',
-            data: this.summaryData.case_calibre.map(item => item.num),
-            itemStyle: {
-              color: function (params) {
-                //通过返回值的下标一一对应将颜色赋给柱子上
-                return colors[params.dataIndex];
-              }
+
+        if (res.code == 200) {
+          this.summaryData = res.data;
+          const colors = ['#2e8241ff', '#ed8b1aff', '#f02b3fff']
+          const option = {
+            xAxis: {},
+            grid: { // 让图表占满容器
+              top: "0px",
+              bottom: "0px"
             },
-            label: {
-              show: true, //开启显示
-              position: 'right', //在上方显示
-              textStyle: { //数值样式
-                color: 'black',//字体颜色
-                fontSize: 16//字体大小
+            yAxis: { data: this.summaryData.case_calibre.map(item => item.score_lv) },
+            series: [
+              {
+                type: 'bar',
+                data: this.summaryData.case_calibre.map(item => item.num),
+                itemStyle: {
+                  color: function (params) {
+                    //通过返回值的下标一一对应将颜色赋给柱子上
+                    return colors[params.dataIndex];
+                  }
+                },
+                label: {
+                  show: true, //开启显示
+                  position: 'right', //在上方显示
+                  textStyle: { //数值样式
+                    color: 'black',//字体颜色
+                    fontSize: 16//字体大小
+                  }
+                }
               }
-            }
-          }
-        ]
-      };
-      const chartDom = document.getElementById('quality-chart');
-      chartDom.style.height = '120px';
-      echarts.init(chartDom).dispose();
-      const myChart1 = echarts.init(chartDom);
+            ]
+          };
+          const chartDom = document.getElementById('quality-chart');
+          chartDom.style.height = '120px';
+          echarts.init(chartDom).dispose();
+          const myChart1 = echarts.init(chartDom);
+
+          myChart1.setOption(option, true);
+          window.addEventListener('resize', function () {
+            myChart1.resize();
+          });
+        }
 
-      myChart1.setOption(option, true);
-      window.addEventListener('resize', function () {
-        myChart1.resize();
       });
+
+
+
     },
 
 
@@ -1397,6 +1426,28 @@ export default {
     background: #fff;
     border-radius: 5px;
     overflow-x: hidden;
+
+    .el-form-item__label {
+      position: relative;
+      /* 设置相对定位作为星号的定位基准 */
+      text-align: justify;
+      text-align-last: justify;
+      /* 确保最后一行也两端对齐 */
+      padding-left: 10px;
+      /* 为星号预留空间 */
+    }
+
+    .el-form-item__label:before {
+      content: '*';
+      color: red;
+      position: absolute;
+      left: 0;
+      /* 星号定位到标签最左侧 */
+      top: 0;
+      /* 调整垂直位置以适应行高 */
+    }
+
+
   }
 
   .mb20 {