血透系统pad前端

InspectionItemTable.vue 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div>
  3. <div class="blueBorder"></div>
  4. <van-list
  5. v-model="loading"
  6. :finished="finished"
  7. finished-text="没有更多了"
  8. @load="onLoad"
  9. >
  10. <table class="table">
  11. <tr>
  12. <th width="20%">检查项目</th>
  13. <th width="10%">结果</th>
  14. <th width="10%">参考值</th>
  15. <th width="10%">单位</th>
  16. </tr>
  17. </table>
  18. <table class="table" v-for="(items,indexs) in inspections_item" :key="indexs">
  19. <tr>
  20. <td width="20%">{{items.date}}</td>
  21. <td width="10%"></td>
  22. <td width="10%"></td>
  23. <td width="10%"></td>
  24. </tr>
  25. <tr class="table" v-for="(item,index) in items.inspection_show_item" :key="index">
  26. <td width="20%">{{item.item_name}}</td>
  27. <td width="10%">{{item.value}}</td>
  28. <td width="10%" v-if="item.range_type ==1">{{item.range_min}} ~ {{item.range_max}}</td>
  29. <td width="10%" v-else>{{item.range_value}}</td>
  30. <td width="10%">{{item.unit}}</td>
  31. </tr>
  32. <tr v-if="items.isExpand" class="table" v-for="(item,index) in items.inspection_hide_item" :key="index">
  33. <td width="20%">{{item.item_name}}</td>
  34. <td width="10%">{{item.value}}</td>
  35. <td width="10%">{{item.range_min}} ~ {{item.range_max}}</td>
  36. <td width="10%">{{item.unit}}</td>
  37. </tr>
  38. <tr>
  39. <td width="20%"></td>
  40. <td width="10%" @click="expandTable(indexs)" v-model="isExpand">{{items.expandName}}</td>
  41. <td width="10%"></td>
  42. <td width="10%"></td>
  43. </tr>
  44. </table>
  45. <div class="NoData" v-show="inspections_item.length == 0"><img style="margin-top: 50px; margin-bottom: 50px" src="@/assets/login/data.jpg" alt=""></div>
  46. </van-list>
  47. </div>
  48. </template>
  49. <script>
  50. import { parseTime } from "@/utils";
  51. import { GetInspectionItemValue } from "@/api/check";
  52. export default {
  53. name: "InspectionItemTable",
  54. created() {},
  55. data() {
  56. return {
  57. items: [],
  58. inspections: [],
  59. inspectionsMap: {},
  60. inspections_item: [],
  61. showItem: [],
  62. hideItem: [],
  63. expandNum: 5,
  64. loading: true,
  65. finished: false,
  66. isShow: 1,
  67. key: 0,
  68. project: null,
  69. isExpand: false,
  70. queryParams: {
  71. project_id: 0,
  72. page: 0,
  73. patient_id: 0
  74. }
  75. };
  76. },
  77. methods: {
  78. onLoad() {
  79. this.queryParams.page = this.queryParams.page + 1;
  80. GetInspectionItemValue(this.queryParams).then(response => {
  81. if (response.data.state == 0) {
  82. this.finished = true;
  83. this.loading = false;
  84. return false;
  85. } else {
  86. this.items = [];
  87. var inspections = response.data.data.inspections;
  88. this.inspections = response.data.data.inspections;
  89. if (inspections == null) {
  90. this.inspections = [];
  91. this.finished = true;
  92. this.loading = false;
  93. return false;
  94. }
  95. var inspections_item_map = {};
  96. inspections_item_map["date"] = response.data.data.date;
  97. var inspectionsMap = {};
  98. this.inspectionsMap = {};
  99. for (var index in inspections) {
  100. inspectionsMap[inspections[index].item_id] = inspections[index];
  101. this.inspectionsMap[inspections[index].item_id] =
  102. inspections[index];
  103. }
  104. var items = this.project.inspection_reference;
  105. for (var index in items) {
  106. if (items[index].id in inspectionsMap) {
  107. var item = {};
  108. for (var key in items[index]) {
  109. item[key] = items[index][key];
  110. }
  111. item.value = inspectionsMap[items[index].id].inspect_value;
  112. item.value_direction = "";
  113. if (item.range_type == 1) {
  114. var value = parseFloat(item.value);
  115. var range_min = parseFloat(item.range_min);
  116. var range_max = parseFloat(item.range_max);
  117. if (value < range_min) {
  118. item.value_direction = "↓";
  119. } else if (value > range_max) {
  120. item.value_direction = "↑";
  121. }
  122. }
  123. this.items.push(item);
  124. }
  125. }
  126. this.showItem = [];
  127. this.hideItem = [];
  128. for (let i = 0; i < this.items.length; i++) {
  129. if (i < this.expandNum) {
  130. this.showItem.push(this.items[i]);
  131. } else {
  132. this.hideItem.push(this.items[i]);
  133. }
  134. }
  135. inspections_item_map["isExpand"] = false;
  136. inspections_item_map["inspection_show_item"] = this.showItem;
  137. inspections_item_map["expandName"] = "展开";
  138. inspections_item_map["inspection_hide_item"] = this.hideItem;
  139. this.inspections_item.push(inspections_item_map);
  140. this.loading = false;
  141. }
  142. });
  143. },
  144. GetList(project_id, project) {
  145. this.finished = false;
  146. this.loading = true;
  147. this.project = project;
  148. this.queryParams.patient_id = this.$route.query.patient_id;
  149. this.queryParams.project_id = project_id;
  150. this.inspections_item = [];
  151. this.queryParams.page = 0;
  152. this.onLoad();
  153. },
  154. expandTable: function(index) {
  155. if (!this.isExpand) {
  156. this.isExpand = true;
  157. for (let i = 0; i < this.inspections_item.length; i++) {
  158. if (i == index) {
  159. this.inspections_item[i].isExpand = true;
  160. this.inspections_item[i].expandName = "收起";
  161. }
  162. }
  163. } else {
  164. this.isExpand = false;
  165. for (let i = 0; i < this.inspections_item.length; i++) {
  166. if (i == index) {
  167. this.inspections_item[i].isExpand = false;
  168. this.inspections_item[i].expandName = "展开";
  169. }
  170. }
  171. }
  172. }
  173. }
  174. };
  175. </script>
  176. <style style="stylesheet/scss" lang="scss" scoped>
  177. .top {
  178. padding: 0.28rem 0.3rem;
  179. // @include display-flex;
  180. // @include align-items-center;
  181. @include text-align;
  182. // @include justify-content-between;
  183. font-size: 0.3rem;
  184. border-bottom: 1px #e5e5e5 solid;
  185. position: relative;
  186. .title {
  187. font-size: 0.3rem;
  188. font-weight: bold;
  189. color: $pgh-color;
  190. }
  191. .iconfont {
  192. font-size: 0.24rem;
  193. color: #a8b3ba;
  194. }
  195. }
  196. .search {
  197. background: #ebf1f7;
  198. border-radius: 30px;
  199. padding: 0.01rem 0.2rem;
  200. color: #a8b3ba;
  201. position: absolute;
  202. top: 0.15rem;
  203. right: 0.4rem;
  204. .iconfont {
  205. color: #a8b3ba;
  206. font-size: 0.32rem;
  207. }
  208. .searchInput {
  209. font-size: 0.28rem;
  210. border: none;
  211. outline: none;
  212. background: #ebf1f7;
  213. height: 0.6rem;
  214. line-height: 0.6rem;
  215. width: 80%;
  216. }
  217. }
  218. .choice {
  219. border-bottom: 1px #e5e5e5 solid;
  220. ul {
  221. @include display-flex;
  222. @include align-items-center;
  223. @include text-align;
  224. @include justify-content-between;
  225. width: 30%;
  226. margin: 0 auto;
  227. font-size: 0.28rem;
  228. color: #7b8a97;
  229. padding: 0.16rem 0;
  230. li {
  231. @include display-flex;
  232. @include align-items-center;
  233. @include text-align;
  234. @include justify-content-between;
  235. .iconfont {
  236. margin: 0 0.1rem;
  237. }
  238. .line {
  239. background: #a8b3ba;
  240. width: 0.2rem;
  241. height: 1px;
  242. margin: 0 0.2rem;
  243. display: inline-block;
  244. }
  245. }
  246. }
  247. }
  248. .table {
  249. width: 100%;
  250. overflow: hidden;
  251. font-size: 0.3rem;
  252. text-align: center;
  253. border: $border-color;
  254. tr {
  255. padding: 0;
  256. margin: 0;
  257. padding: 0.1rem 0;
  258. th {
  259. background: $main-color;
  260. border: none;
  261. color: #fff;
  262. padding: 0;
  263. margin: 0;
  264. height: 0.88rem;
  265. line-height: 0.88rem;
  266. font-weight: normal;
  267. }
  268. td {
  269. background: #fafafa;
  270. border: none;
  271. span {
  272. background: #ff7979;
  273. color: #fff;
  274. font-size: 0.28rem;
  275. height: 0.5rem;
  276. line-height: 0.5rem;
  277. display: inline-block;
  278. border-radius: 6px;
  279. width: 1.75rem;
  280. margin: 0 0.1rem;
  281. }
  282. }
  283. }
  284. }
  285. </style>