血透系统PC前端

FastPatientsSidebar.vue 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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="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. <el-tree
  33. :data="treeData"
  34. accordion
  35. node-key="name"
  36. :key="treeKey"
  37. :current-node-key="treeKey"
  38. :default-expanded-keys="[defaultActive]"
  39. @node-click="handleNodeClick"
  40. >
  41. </el-tree>
  42. <!-- </div> -->
  43. </div>
  44. </template>
  45. <script>
  46. import { fetchAllList, PostSearch } from "@/api/patient";
  47. import { jsGetAge, uParseTime } from "@/utils/tools";
  48. export default {
  49. name: "FastPatientsSidebar",
  50. props: {
  51. id: 0,
  52. defaultActive: {
  53. type: String,
  54. default: "1-1"
  55. }
  56. },
  57. data() {
  58. return {
  59. value: "",
  60. searchArray: [],
  61. patientsList: null,
  62. thedefaultActive: 1,
  63. currentPatient: {},
  64. selectID: 0,
  65. keyword: "",
  66. treeKey: "",
  67. treeData: [
  68. {
  69. name: "1",
  70. label: "质控数据",
  71. children: [
  72. {
  73. name: "1-1",
  74. label: "基本信息"
  75. },
  76. {
  77. name: "1-2",
  78. label: "检验检查"
  79. }
  80. ]
  81. }
  82. ]
  83. };
  84. },
  85. methods: {
  86. handleNodeClick(data) {
  87. var name = data.name;
  88. if (name == "1-1") {
  89. this.$emit("patient",this.selectID);
  90. } else if (name == "1-2") {
  91. this.$emit("inspection",this.selectID);
  92. }
  93. },
  94. getList() {
  95. fetchAllList().then(response => {
  96. if (response.data.state == 1) {
  97. this.patientsList = response.data.data.patients;
  98. var len = this.patientsList.length;
  99. if (len > 0) {
  100. for (let index = 0; index < len; index++) {
  101. if (this.patientsList[index].id == this.id) {
  102. this.currentPatient = this.patientsList[index];
  103. this.selectID = this.patientsList[index].id;
  104. this.$emit("tran-patient", this.currentPatient);
  105. break;
  106. }
  107. }
  108. }
  109. }
  110. });
  111. },
  112. changePatient(value) {
  113. this.$router.push("/upload/fast?id=" + value);
  114. },
  115. tranAge(birthday) {
  116. var birth = uParseTime(birthday, "{y}-{m}-{d}");
  117. return jsGetAge(birth, "-");
  118. },
  119. tranSex(gender) {
  120. var sex = "未知";
  121. switch (gender) {
  122. case 1:
  123. sex = "男";
  124. break;
  125. case 2:
  126. sex = "女";
  127. break;
  128. default:
  129. break;
  130. }
  131. return sex;
  132. },
  133. querySearchAsync(keyword, cb) {
  134. let key = "";
  135. if (keyword != undefined) {
  136. key = keyword;
  137. }
  138. let searchArray = [];
  139. PostSearch(key).then(response => {
  140. if (response.data.state == 1) {
  141. searchArray = response.data.data.patient;
  142. cb(searchArray);
  143. } else {
  144. this.$message.error(response.data.msg);
  145. cb([]);
  146. }
  147. });
  148. },
  149. handleSelect(val) {
  150. this.$router.push("/upload/fast?id=" + val.id);
  151. }
  152. },
  153. created() {
  154. this.getList();
  155. }
  156. };
  157. </script>
  158. <style>
  159. .patient-menu {
  160. float: left;
  161. width: 14%;
  162. }
  163. .patient-menu .el-tree-node__content {
  164. font-size: 14px;
  165. height: 40px;
  166. font-weight: 400;
  167. }
  168. .patient-menu .el-tree-node__label:hover {
  169. color: #409eff;
  170. }
  171. .patient-menu .el-tree-node:focus > .el-tree-node__content {
  172. color: #409eff;
  173. }
  174. .patient-menu .el-tree-node .el-tree-node.is-current > .el-tree-node__content {
  175. color: #409eff;
  176. }
  177. .patient-menu .el-tree {
  178. background: #f6f8f9;
  179. }
  180. /* .patient-menu {
  181. -webkit-transition: width 0.28s;
  182. transition: width 0.28s;
  183. width: 180px !important;
  184. height: 100%;
  185. position: relative;
  186. font-size: 0px;
  187. top: 0;
  188. float: left;
  189. bottom: 0;
  190. left: 0;
  191. overflow: hidden;
  192. } */
  193. .patient-center-menu .el-icon-arrow-down:before {
  194. content: "";
  195. }
  196. </style>