血透系统PC前端

schedualPatient.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <el-input style="width: 400px;" v-model="search_input" class="filter-item"/>
  5. <el-button class="filter-item" type="primary" icon="el-icon-search" @click="searchAction">搜索</el-button>
  6. </div>
  7. <div class="cell">
  8. <label class="title"><span class="name">日期查询</span> : </label>
  9. <el-date-picker v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange" :editable="false" :clearable="false" style="width: 196px;" type="date" placeholder="选择日期时间" align="right" :picker-options="date_picker_options" format="yyyy-MM-dd"></el-date-picker>
  10. </div>
  11. <div class="cell clearfix">
  12. <label class="title"><span class="name">排班班次</span> : </label>
  13. <div class="time ">
  14. <ul class="">
  15. <li v-for="option in schedule_type_options" :key="option.value" @click="handletimeType(option.value)" :class="schedule_type_selected == option.value ? 'active' : ''" >
  16. {{option.text}}
  17. </li>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="cell clearfix">
  22. <label class="title"><span class="name">分区</span> : </label>
  23. <div class="time ">
  24. <ul class="">
  25. <li v-for="option in zone_options" :key="option.id" :class="option.id == zone_selected ? 'active' : ''" @click='handleZoneChange(option.id)'>{{ option.text }}
  26. </li>
  27. </ul>
  28. </div>
  29. </div>
  30. <div class="PatientArea">
  31. <div v-for="zone_schedule in filtedSchedules" :key="zone_schedule.zone_id" class="list clearfix">
  32. <h3 class="title">{{zone_schedule.zone_name}}</h3>
  33. <patient-box :schedules="zone_schedule.schedules"></patient-box>
  34. </div>
  35. <div class="NoData" v-show="filtedSchedules.length == 0">
  36. <img src="@/assets/img/data.jpg" alt="">
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import PatientBox from './PatientBox';
  43. import { getDialysisRecordInitData, getDialysisSchedules } from "@/api/dialysis_record"
  44. import { parseTime } from "@/utils"
  45. export default {
  46. name: "Patient",
  47. components: {
  48. PatientBox
  49. },
  50. data() {
  51. return {
  52. selected_date: new Date(), // this.$store.getters.app.dialysis_area.schedule_date,
  53. schedule_type_selected: 0, //this.$store.getters.app.dialysis_area.schedule_type_select_index,
  54. schedule_type_options: [
  55. { value: 0, text: "全部班" },
  56. { value: 1, text: "上午" },
  57. { value: 2, text: "下午" },
  58. { value: 3, text: "晚上" },
  59. ],
  60. zone_selected: 0,// this.$store.getters.app.dialysis_area.zone_select_index,
  61. zone_options:[
  62. { id: 0, text: "全部分区" }
  63. ],
  64. zone_schedules:[],
  65. date_picker_options: {
  66. shortcuts: [
  67. {
  68. text: "今天",
  69. onClick(picker) {
  70. picker.$emit("pick", new Date());
  71. }
  72. },
  73. {
  74. text: "昨天",
  75. onClick(picker) {
  76. const date = new Date();
  77. date.setTime(date.getTime() - 3600 * 1000 * 24);
  78. picker.$emit("pick", date);
  79. }
  80. },
  81. {
  82. text: "一周前",
  83. onClick(picker) {
  84. const date = new Date();
  85. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  86. picker.$emit("pick", date);
  87. }
  88. },
  89. ]
  90. },
  91. // search_input 和 search_keyword,使输入关键字时不会经常刷新 filtedSchedules
  92. search_keyword: "", // 确定用于搜索的关键字
  93. search_input: "", // 输入中的关键字
  94. }
  95. },
  96. computed: {
  97. filtedSchedules: function() {
  98. var search_keyword = this.search_keyword
  99. if (search_keyword.length > 0) {
  100. var schedules = []
  101. for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
  102. const scheduleInfo = this.zone_schedules[o_i];
  103. var originSchedules = scheduleInfo.schedules
  104. if (originSchedules.length == 0) {
  105. continue
  106. }
  107. var filtedSchedules = []
  108. for (let s_i = 0; s_i < originSchedules.length; s_i++) {
  109. const schedule = originSchedules[s_i];
  110. if (schedule.patient.name.indexOf(search_keyword) != -1) {
  111. filtedSchedules.push(schedule)
  112. break
  113. }
  114. }
  115. if (filtedSchedules.length > 0) {
  116. schedules.push({zone_id:scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules})
  117. }
  118. }
  119. return schedules
  120. }
  121. var zone_selected = this.zone_selected
  122. var timetype_selected = this.schedule_type_selected
  123. if ((zone_selected == 0 && timetype_selected == 0) || this.zone_options.length <= 1) {
  124. var schedules = []
  125. for (let index = 0; index < this.zone_schedules.length; index++) {
  126. const scheduleInfo = this.zone_schedules[index];
  127. if (scheduleInfo.schedules.length != 0) {
  128. schedules.push(scheduleInfo)
  129. }
  130. }
  131. return schedules
  132. }
  133. var schedules = []
  134. for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
  135. const scheduleInfo = this.zone_schedules[o_i];
  136. if (zone_selected == scheduleInfo.zone_id && timetype_selected == 0) {
  137. if (scheduleInfo.schedules.length == 0) {
  138. return []
  139. } else {
  140. return [scheduleInfo]
  141. }
  142. }
  143. var originSchedules = scheduleInfo.schedules
  144. if (originSchedules.length == 0) {
  145. continue
  146. }
  147. var filtedSchedules = []
  148. for (let s_i = 0; s_i < originSchedules.length; s_i++) {
  149. const schedule = originSchedules[s_i];
  150. if (zone_selected != 0) {
  151. if (zone_selected == schedule.device_number.zone.id) {
  152. if (timetype_selected == 0 || schedule.schedule_type == timetype_selected) {
  153. filtedSchedules.push(schedule)
  154. }
  155. }
  156. } else {
  157. if (timetype_selected == 0 || schedule.schedule_type == timetype_selected) {
  158. filtedSchedules.push(schedule)
  159. }
  160. }
  161. }
  162. if (filtedSchedules.length > 0) {
  163. schedules.push({zone_id:scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules})
  164. }
  165. }
  166. return schedules
  167. }
  168. },
  169. created() {
  170. this.getInitData()
  171. },
  172. methods: {
  173. handletimeType: function(index) {
  174. this.schedule_type_selected = index;
  175. this.search_keyword = this.search_input = ""
  176. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  177. // zone: this.zone_selected,
  178. // schedule_type: this.schedule_type_selected,
  179. // schedule_date: this.selected_date,
  180. // })
  181. },
  182. handleZoneChange:function(index) {
  183. this.zone_selected = index;
  184. this.search_keyword = this.search_input = ""
  185. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  186. // zone: this.zone_selected,
  187. // schedule_type: this.schedule_type_selected,
  188. // schedule_date: this.selected_date,
  189. // })
  190. },
  191. handleScheduleDateChange: function() {
  192. this.zone_selected = 0
  193. this.schedule_type_selected = 0
  194. this.search_keyword = this.search_input = ""
  195. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  196. // zone: this.zone_selected,
  197. // schedule_type: this.schedule_type_selected,
  198. // schedule_date: this.selected_date,
  199. // })
  200. this.requestDialysisSchedules()
  201. },
  202. searchAction: function() {
  203. this.search_keyword = this.search_input
  204. this.schedule_type_selected = 0
  205. this.zone_selected = 0
  206. },
  207. getInitData: function() {
  208. getDialysisRecordInitData().then(rs => {
  209. var resp = rs.data
  210. if (resp.state == 1) {
  211. var zones = resp.data.zones
  212. var schedules = resp.data.schedules
  213. var zone_options = [{ id: 0, text: "全部分区" }]
  214. for (let z_i = 0; z_i < zones.length; z_i++) {
  215. const zone = zones[z_i];
  216. zone_options.push({ id: zone.id, text: zone.name, })
  217. }
  218. this.zone_options = zone_options
  219. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  220. } else {
  221. this.$message.error(resp.msg)
  222. }
  223. })
  224. },
  225. requestDialysisSchedules: function() {
  226. var ymd = parseTime(this.selected_date, "{y}-{m}-{d}")
  227. getDialysisSchedules(ymd).then(rs => {
  228. var resp = rs.data
  229. if (resp.state == 1) {
  230. var schedules = resp.data.schedules
  231. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  232. } else {
  233. this.$message.error(resp.msg)
  234. }
  235. })
  236. },
  237. processedDialysisSchedules: function(schedules, zone_options) {
  238. var zoneMap = {}
  239. var scheduleMap = {}
  240. for (let z_i = 0; z_i < zone_options.length; z_i++) {
  241. const zone = zone_options[z_i];
  242. if (zone.id == 0) {
  243. continue
  244. }
  245. scheduleMap[zone.id] = []
  246. }
  247. for (let index = 0; index < schedules.length; index++) {
  248. const schedule = schedules[index]
  249. scheduleMap[schedule.device_number.zone.id].push(schedule)
  250. }
  251. var zone_schedules = []
  252. for (let index = 0; index < zone_options.length; index++) {
  253. const zone = zone_options[index]
  254. if (zone.id == 0) {
  255. continue
  256. }
  257. var schedules = scheduleMap[zone.id]
  258. zone_schedules.push({zone_id: zone.id, zone_name: zone.text, schedules: schedules})
  259. }
  260. return zone_schedules
  261. },
  262. },
  263. }
  264. </script>
  265. <style rel="stylesheet/scss" lang="scss" scoped>
  266. .app-container {
  267. // margin: 20px;
  268. font-size: 15px;
  269. .filter-container {
  270. padding-bottom: 5px;
  271. }
  272. .search-component {
  273. width: 500px;
  274. .searchBox {
  275. width: 300px;
  276. height: 36px;
  277. line-height: 36px;
  278. padding-left: 15px;
  279. border: 1px #dcdfe6 solid;
  280. border-right: none;
  281. outline: none;
  282. float: left;
  283. border-radius: 6px 0 0 6px;
  284. font-size: 14px;
  285. color: #333;
  286. background: #fff;
  287. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  288. }
  289. .searchBtn {
  290. background-color: #409eff;
  291. color: #fff;
  292. font-size: 15px;
  293. text-align: center;
  294. height: 36px;
  295. line-height: 36px;
  296. float: left;
  297. outline: none;
  298. width: 70px;
  299. border: none;
  300. border-radius: 0 6px 6px 0;
  301. font-family: "Microsoft Yahei";
  302. cursor: pointer;
  303. }
  304. }
  305. .cell {
  306. margin: 0px 0 15px 0;
  307. -moz-box-sizing: border-box;
  308. -webkit-box-sizing: border-box;
  309. -o-box-sizing: border-box;
  310. -ms-box-sizing: border-box;
  311. box-sizing: border-box;
  312. display: -webkit-box;
  313. display: -ms-flexbox;
  314. // display: flex;
  315. -webkit-box-align: flex-start;
  316. -ms-flex-align: flex-start;
  317. align-items: flex-start;
  318. text-align: left;
  319. justify-content: flex-start;
  320. color: #333;
  321. .title {
  322. width: 80px;
  323. display: inline-block;
  324. font-weight: normal;
  325. color: #909399;
  326. padding: 6px 0;
  327. font-weight: 700;
  328. .name {
  329. width: 60px;
  330. text-align: justify;
  331. text-justify: distribute-all-lines;
  332. text-align-last: justify;
  333. -moz-text-align-last: justify;
  334. -webkit-text-align-last: justify;
  335. display: inline-block;
  336. }
  337. }
  338. .time {
  339. -webkit-box-flex: 1;
  340. -ms-flex: 1;
  341. flex: 1;
  342. ul {
  343. padding: 0;
  344. margin: 0;
  345. li {
  346. float: left;
  347. list-style: none;
  348. cursor: pointer;
  349. padding: 3px 0;
  350. width: 70px;
  351. color: #606266;
  352. border-radius: 4px;
  353. margin: 0 10px 10px 0;
  354. color: #409eff;
  355. border: 1px #409eff solid;
  356. text-align: center;
  357. &:hover {
  358. background: #409eff;
  359. color: #fff;
  360. }
  361. }
  362. .active {
  363. background: #409eff;
  364. color: #fff;
  365. }
  366. }
  367. }
  368. }
  369. .amount {
  370. font-weight: normal;
  371. padding: 10px 0 0 0;
  372. color: #606266;
  373. font-size: 14px;
  374. span {
  375. color: #ef2525;
  376. font-family: "Arial";
  377. padding: 0 2px;
  378. }
  379. }
  380. }
  381. .PatientArea{
  382. .list{
  383. .title{
  384. font-size: 16px;
  385. color: #34495e;
  386. height:50px ;
  387. line-height: 50px;
  388. font-weight: bold;
  389. }
  390. }
  391. }
  392. .NoData {
  393. text-align: center;
  394. }
  395. </style>