血透系统PC前端

FastInspectionSidebar.vue 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <!-- <div> -->
  3. <div class="patient-menu">
  4. <el-autocomplete
  5. style="margin:16px 5px"
  6. popper-class="my-autocomplete"
  7. v-model.trim="value"
  8. :fetch-suggestions="querySearchAsync"
  9. :trigger-on-focus="false"
  10. placeholder="病人名字或者透析号"
  11. @select="handleSelect"
  12. >
  13. <i class="el-icon-search el-input__icon" slot="suffix"> </i>
  14. <template slot-scope="{ item }">
  15. <div class="name">{{ item.name }}</div>
  16. </template>
  17. </el-autocomplete>
  18. <el-select
  19. v-model="selectID"
  20. style="margin:0 5px 0px 5px;text-align: center;"
  21. @change="changePatient"
  22. placeholder="请选择"
  23. >
  24. <el-option
  25. v-for="item in patientsList"
  26. :key="item.id"
  27. :label="item.name"
  28. :value="item.id"
  29. >
  30. </el-option>
  31. </el-select>
  32. </div>
  33. <!-- </div> -->
  34. </template>
  35. <script>
  36. import { fetchAllList, PostSearch } from "@/api/patient";
  37. import { jsGetAge, uParseTime } from "@/utils/tools";
  38. export default {
  39. name: "FastInspectionSidebar",
  40. props: {
  41. id: 0,
  42. defaultActive: {
  43. type: String,
  44. default: "1-1"
  45. }
  46. },
  47. data() {
  48. return {
  49. value: "",
  50. searchArray: [],
  51. patientsList: null,
  52. thedefaultActive: 1,
  53. currentPatient: {},
  54. selectID: 0,
  55. keyword: "",
  56. treeKey: ""
  57. };
  58. },
  59. methods: {
  60. getList() {
  61. fetchAllList().then(response => {
  62. if (response.data.state == 1) {
  63. this.patientsList = response.data.data.patients;
  64. var len = this.patientsList.length;
  65. if (len > 0) {
  66. for (let index = 0; index < len; index++) {
  67. if (this.patientsList[index].id == this.id) {
  68. this.currentPatient = this.patientsList[index];
  69. this.selectID = this.patientsList[index].id;
  70. this.$emit("tran-patient", this.currentPatient);
  71. break;
  72. }
  73. }
  74. }
  75. }
  76. });
  77. },
  78. changePatient(value) {
  79. this.$router.push("/upload/fast?id=" + value);
  80. },
  81. tranAge(birthday) {
  82. var birth = uParseTime(birthday, "{y}-{m}-{d}");
  83. return jsGetAge(birth, "-");
  84. },
  85. tranSex(gender) {
  86. var sex = "未知";
  87. switch (gender) {
  88. case 1:
  89. sex = "男";
  90. break;
  91. case 2:
  92. sex = "女";
  93. break;
  94. default:
  95. break;
  96. }
  97. return sex;
  98. },
  99. querySearchAsync(keyword, cb) {
  100. let key = "";
  101. if (keyword != undefined) {
  102. key = keyword;
  103. }
  104. let searchArray = [];
  105. PostSearch(key).then(response => {
  106. if (response.data.state == 1) {
  107. searchArray = response.data.data.patient;
  108. cb(searchArray);
  109. } else {
  110. this.$message.error(response.data.msg);
  111. cb([]);
  112. }
  113. });
  114. },
  115. handleSelect(val) {
  116. this.$router.push("/upload/fast?id=" + val.id);
  117. }
  118. },
  119. created() {
  120. this.getList();
  121. }
  122. };
  123. </script>
  124. <style>
  125. .patient-menu .el-tree-node__content {
  126. font-size: 14px;
  127. height: 40px;
  128. font-weight: 400;
  129. }
  130. .patient-menu .el-tree-node__label:hover {
  131. color: #409eff;
  132. }
  133. .patient-menu .el-tree-node:focus > .el-tree-node__content {
  134. color: #409eff;
  135. }
  136. .patient-menu .el-tree-node .el-tree-node.is-current > .el-tree-node__content {
  137. color: #409eff;
  138. }
  139. .patient-menu .el-tree {
  140. background: #f6f8f9;
  141. }
  142. .patient-menu {
  143. -webkit-transition: width 0.28s;
  144. transition: width 0.28s;
  145. width: 180px !important;
  146. height: 100%;
  147. position: relative;
  148. font-size: 0px;
  149. top: 0;
  150. float: left;
  151. bottom: 0;
  152. left: 0;
  153. /* z-index: 99; */
  154. overflow: hidden;
  155. }
  156. .patient-center-menu .el-icon-arrow-down:before {
  157. content: "";
  158. }
  159. </style>