8 changed files with 605 additions and 37 deletions
			
			
		- 
					7src/components/doctorCheck/ButtonList.vue
 - 
					6src/components/doctorCheck/PatientRegisterBase.vue
 - 
					5src/components/doctorCheck/PatientRegisterList.vue
 - 
					345src/components/sumDoctorCheck/ButtonList.vue
 - 
					23src/components/sumDoctorCheck/SumPREdit.vue
 - 
					236src/components/sumDoctorCheck/SumSug.vue
 - 
					8src/store/index.js
 - 
					6src/views/doctorCheck/sumDoctorCheck.vue
 
@ -0,0 +1,236 @@ | 
				
			|||
<template> | 
				
			|||
  <div style="display: flex;"> | 
				
			|||
    <div style="width:50%;"> | 
				
			|||
      <el-table id="tableSummary" row-key="id" :data="sumDoctorCheck.summaryList" width="100%" height="650" border > | 
				
			|||
        <el-table-column prop="summaryTitle" label="综述" > | 
				
			|||
          <template slot-scope="scope"> | 
				
			|||
            <div> | 
				
			|||
              <el-input v-model="scope.row.summaryTitle" placeholder="请输入综述" disabled></el-input> | 
				
			|||
              <el-table :id="scope.row.id" row-key="summaryContent" style="margin-left: 30px;" | 
				
			|||
                :data="scope.row.details" border @row-click="rowClick" :show-header="false"> | 
				
			|||
                <el-table-column prop="summaryContent" label="综述" /> | 
				
			|||
              </el-table> | 
				
			|||
            </div> | 
				
			|||
          </template> | 
				
			|||
        </el-table-column>       | 
				
			|||
      </el-table> | 
				
			|||
    </div> | 
				
			|||
    <div style="width:50%;"> | 
				
			|||
      <el-table id="tableSuggestion" row-key="id" :data="sumDoctorCheck.suggestionList" width="100%" height="650" border> | 
				
			|||
        <el-table-column prop="suggestionTitle" label="建议" > | 
				
			|||
          <template slot-scope="scope"> | 
				
			|||
            <div> | 
				
			|||
              <el-input v-model="scope.row.suggestionTitle"  placeholder="请输入建议" | 
				
			|||
                :disabled="sumDoctorCheck.sumPREdit.completeFlag=='3' || sumDoctorCheck.sumPREdit.isAudit=='Y'" | 
				
			|||
                > | 
				
			|||
                <el-button slot="append" icon="el-icon-plus" @click="addSug" placeholder="请输入建议" | 
				
			|||
                :disabled="sumDoctorCheck.sumPREdit.completeFlag=='3' || sumDoctorCheck.sumPREdit.isAudit=='Y'"></el-button> | 
				
			|||
              </el-input> | 
				
			|||
              <el-table :id="scope.row.id" row-key="suggestionContent" style="margin-left: 30px;" | 
				
			|||
                :data="scope.row.details" border @row-click="rowClickSug" :show-header="false"> | 
				
			|||
                <el-table-column prop="suggestionContent" label="建议" /> | 
				
			|||
              </el-table> | 
				
			|||
            </div> | 
				
			|||
          </template> | 
				
			|||
        </el-table-column>        | 
				
			|||
      </el-table> | 
				
			|||
    </div> | 
				
			|||
  </div> | 
				
			|||
</template> | 
				
			|||
<script lang="ts"> | 
				
			|||
import { mapState } from 'vuex'; | 
				
			|||
import Sortable from "sortablejs"; | 
				
			|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; | 
				
			|||
import { arrayExistObj } from '@/utlis/proFunc'; | 
				
			|||
export default { | 
				
			|||
  components: {}, | 
				
			|||
  data() { | 
				
			|||
    return { | 
				
			|||
      sumDetails:[], | 
				
			|||
      sugDetails:[], | 
				
			|||
    }; | 
				
			|||
  }, | 
				
			|||
 | 
				
			|||
  created() { }, | 
				
			|||
 | 
				
			|||
  //挂载完成 | 
				
			|||
  mounted() {  | 
				
			|||
    this.rowDrop(); | 
				
			|||
    this.rowDropSuggestion() | 
				
			|||
  }, | 
				
			|||
 | 
				
			|||
  computed: { | 
				
			|||
    ...mapState(['dict', 'sumDoctorCheck']), | 
				
			|||
  }, | 
				
			|||
 | 
				
			|||
  methods: { | 
				
			|||
    //获取综述 | 
				
			|||
    summaryList(RegisterId) { | 
				
			|||
      // [ | 
				
			|||
      //   { | 
				
			|||
      //     "id": "3a0c5bbb-dfea-eec1-ed37-78203086987c", | 
				
			|||
      //     "patientRegisterId": "3a0c5b73-0b3a-fe97-88b7-b47b18424136", | 
				
			|||
      //     "summaryTitle": "血常规", | 
				
			|||
      //     "summaryFlag": null, | 
				
			|||
      //     "displayOrder": 0, | 
				
			|||
      //     "details": [ | 
				
			|||
      //        { | 
				
			|||
      //          "sumSummaryHeaderId": "3a0c6589-9b6f-bbb1-bb8b-d6876ea5e4e6", | 
				
			|||
      //          "summaryContent": "重度肥胖", | 
				
			|||
      //          "displayOrder": 1 | 
				
			|||
      //        } | 
				
			|||
      //      ] | 
				
			|||
      //   }, | 
				
			|||
      // ] | 
				
			|||
      console.log(`/api/app/sumsummaryheader/getsumsummarylist?PatientRegisterId=${RegisterId}`) | 
				
			|||
      getapi(`/api/app/sumsummaryheader/getsumsummarylist?PatientRegisterId=${RegisterId}`) | 
				
			|||
        .then((res) => { | 
				
			|||
          console.log("summaryList", res.data); | 
				
			|||
          if (res.code != -1) { | 
				
			|||
            this.sumDoctorCheck.summaryList = res.data; | 
				
			|||
          } | 
				
			|||
        }) | 
				
			|||
        .catch((err) => { | 
				
			|||
          this.$message({ type: "error", message: `操作失败,原因:${err}` }); | 
				
			|||
        }); | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //获取建议 | 
				
			|||
    suggestionList(RegisterId) { | 
				
			|||
      // [ | 
				
			|||
      //   { | 
				
			|||
      //     "id": "3a0c6589-9b6f-bbb1-bb8b-d6876ea5e4e6", | 
				
			|||
      //     "patientRegisterId": "3a0c6589-99bb-5518-a196-4cf094b44e9a", | 
				
			|||
      //     "suggestionTitle": "身高体重", | 
				
			|||
      //     "suggestionFlag": null, | 
				
			|||
      //     "displayOrder": 0, | 
				
			|||
      //     "details": [ | 
				
			|||
      //       { | 
				
			|||
      //         "sumSuggestionHeaderId": "3a0c6589-9b6f-bbb1-bb8b-d6876ea5e4e6", | 
				
			|||
      //         "suggestionContent": "控制饮食,少盐少油少糖少脂;\n加强锻炼。", | 
				
			|||
      //         "displayOrder": 1 | 
				
			|||
      //       } | 
				
			|||
      //     ] | 
				
			|||
      //   }, | 
				
			|||
      // ] | 
				
			|||
      console.log(`/api/app/sumsuggestionheader/getsumsuggestionlist?PatientRegisterId=${RegisterId}`) | 
				
			|||
      getapi(`/api/app/sumsuggestionheader/getsumsuggestionlist?PatientRegisterId=${RegisterId}`) | 
				
			|||
        .then((res) => { | 
				
			|||
          console.log("suggestionList", res.data); | 
				
			|||
          if (res.code != -1) { | 
				
			|||
            this.sumDoctorCheck.suggestionList = res.data; | 
				
			|||
          } | 
				
			|||
        }) | 
				
			|||
        .catch((err) => { | 
				
			|||
          this.$message({ type: "error", message: `操作失败,原因:${err}` }); | 
				
			|||
        }); | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //增加建议明细 | 
				
			|||
    addSug(){ | 
				
			|||
      console.log('addSug') | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //选择组合项目 | 
				
			|||
    rowClick(row) { | 
				
			|||
      console.log('rowClick row',row) | 
				
			|||
      let lfind = arrayExistObj(this.sumDoctorCheck.summaryList,'id',row.sumSummaryHeaderId) | 
				
			|||
      if(lfind > -1) { | 
				
			|||
        this.sumDetails = this.sumDoctorCheck.summaryList[lfind].details | 
				
			|||
        this.rowDropSumDetail(row.sumSummaryHeaderId) | 
				
			|||
      } | 
				
			|||
      console.log('this.sumDetails',this.sumDetails) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //综述明细拖拽 | 
				
			|||
    rowDropSumDetail(id) { | 
				
			|||
      this.$nextTick(() => { | 
				
			|||
        const fEl = document.getElementById(id)  // document.querySelector(`#${id} tbody`) querySelector为静态方法不支持动态传参; | 
				
			|||
        console.log('rowDropSumDetail tbody',fEl,fEl.children) //el.childNodes,el.children | 
				
			|||
        const el = this.findEl(fEl,'TBODY') | 
				
			|||
        console.log('rowDropSumDetail tbody',el) //el.childNodes,el.children | 
				
			|||
        const that = this; | 
				
			|||
        Sortable.create(el, { | 
				
			|||
          animation: 150, // ms, number 单位:ms,定义排序动画的时间 | 
				
			|||
          //拖拽结束 | 
				
			|||
          onEnd({ newIndex, oldIndex }) {             | 
				
			|||
            that.isshow = false; | 
				
			|||
            const currRow = that.sumDetails.splice(oldIndex, 1)[0]; | 
				
			|||
            that.sumDetails.splice(newIndex, 0, currRow);            | 
				
			|||
          }, | 
				
			|||
        }); | 
				
			|||
      }); | 
				
			|||
    },  | 
				
			|||
 | 
				
			|||
    findEl(fEl,nodeName){ | 
				
			|||
      let el = null | 
				
			|||
      for(let i=0;i<fEl.children.length;i++){ | 
				
			|||
        console.log(fEl.children[i].nodeName) | 
				
			|||
        if(fEl.children[i].nodeName == nodeName){ | 
				
			|||
          el = fEl.children[i] | 
				
			|||
          break | 
				
			|||
        }else{ | 
				
			|||
          el = this.findEl(fEl.children[i],nodeName) | 
				
			|||
        } | 
				
			|||
        if(el) break | 
				
			|||
      } | 
				
			|||
      return el | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    rowClickSug(row){ | 
				
			|||
      console.log('rowClickSug',row) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //拖拽 | 
				
			|||
    rowDrop() { | 
				
			|||
      this.$nextTick(() => { | 
				
			|||
        const el = document.querySelector("#tableSummary tbody"); | 
				
			|||
        console.log('tbody',el) | 
				
			|||
        const that = this; | 
				
			|||
        Sortable.create(el, { | 
				
			|||
          animation: 150, // ms, number 单位:ms,定义排序动画的时间 | 
				
			|||
          //拖拽结束 | 
				
			|||
          onEnd({ newIndex, oldIndex }) {             | 
				
			|||
            that.isshow = false; | 
				
			|||
            const currRow = that.sumDoctorCheck.summaryList.splice(oldIndex, 1)[0]; | 
				
			|||
            that.sumDoctorCheck.summaryList.splice(newIndex, 0, currRow);            | 
				
			|||
          }, | 
				
			|||
        }); | 
				
			|||
      }); | 
				
			|||
    },  | 
				
			|||
     | 
				
			|||
    //拖拽 | 
				
			|||
    rowDropSuggestion() { | 
				
			|||
      this.$nextTick(() => { | 
				
			|||
        const el = document.querySelector("#tableSuggestion tbody"); | 
				
			|||
        console.log('tbody',el) | 
				
			|||
        const that = this; | 
				
			|||
        Sortable.create(el, { | 
				
			|||
          animation: 150, // ms, number 单位:ms,定义排序动画的时间 | 
				
			|||
          //拖拽结束 | 
				
			|||
          onEnd({ newIndex, oldIndex }) {             | 
				
			|||
            that.isshow = false; | 
				
			|||
            const currRow = that.sumDoctorCheck.suggestionList.splice(oldIndex, 1)[0]; | 
				
			|||
            that.sumDoctorCheck.suggestionList.splice(newIndex, 0, currRow);            | 
				
			|||
          }, | 
				
			|||
        }); | 
				
			|||
      }); | 
				
			|||
    },  | 
				
			|||
 | 
				
			|||
  }, | 
				
			|||
 | 
				
			|||
  //监听事件 | 
				
			|||
  watch: { | 
				
			|||
    //检查项目切换 | 
				
			|||
    "sumDoctorCheck.sumPREdit.id"(newVal, oldVal) { | 
				
			|||
      console.log("watch sumDoctorCheck.sumPREdit.id newVal:", newVal, " oldVal:", oldVal); | 
				
			|||
      if (newVal != oldVal && newVal != '') { | 
				
			|||
        this.summaryList(newVal) | 
				
			|||
        this.suggestionList(newVal) | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
  }, | 
				
			|||
}; | 
				
			|||
</script> | 
				
			|||
<style></style> | 
				
			|||
   | 
				
			|||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue