血透系统PC前端

dialysisTotal.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <div class="cell clearfix">
  8. <label class="title"> <span class="name">日期查询</span> : </label>
  9. <el-date-picker
  10. v-model="listQuery.start_time"
  11. prefix-icon="el-icon-date"
  12. @change="changeTime"
  13. :editable="false"
  14. style="width: 196px;"
  15. type="date"
  16. placeholder="选择日期时间"
  17. align="right"
  18. format="yyyy-MM-dd"
  19. value-format="yyyy-MM-dd"
  20. ></el-date-picker>
  21. <span class>-</span>
  22. <el-date-picker
  23. v-model="listQuery.end_time"
  24. prefix-icon="el-icon-date"
  25. @change="changeEndTime"
  26. :editable="false"
  27. style="width: 196px;"
  28. type="date"
  29. placeholder="选择日期时间"
  30. align="right"
  31. format="yyyy-MM-dd"
  32. value-format="yyyy-MM-dd"
  33. ></el-date-picker>
  34. </div>
  35. <div class="cell clearfix">
  36. <label class="title"> <span class="name">统计方式</span> : </label>
  37. <div class="time">
  38. <ul class>
  39. <li
  40. :class="item.value == statisticalMethod ? 'active' : ''"
  41. @click="selectStatisticalMethod(item.value)"
  42. v-for="item in statisticalMethods"
  43. :key="item.value"
  44. >
  45. {{ item.label }}
  46. </li>
  47. </ul>
  48. </div>
  49. </div>
  50. <div class="cell clearfix">
  51. <label class="title"> <span class="name">转归状态</span> : </label>
  52. <div class="time">
  53. <ul class>
  54. <li
  55. :class="item.lapseto == lapsetoType ? 'active' : ''"
  56. @click="selectLapseTo(item.lapseto)"
  57. v-for="item in lapsetoState"
  58. :key="item.value"
  59. >
  60. {{ item.label }}
  61. </li>
  62. </ul>
  63. </div>
  64. </div>
  65. <div class="cell clearfix">
  66. <label class="title"> <span class="name">透析模式</span> : </label>
  67. <el-select
  68. v-model="listQuery.mode_id"
  69. placeholder="请选择"
  70. @change="changeModel()"
  71. >
  72. <el-option label="全部" value></el-option>
  73. <el-option
  74. v-for="item in modeOptions"
  75. :key="item.id"
  76. :label="item.name"
  77. :value="item.id"
  78. ></el-option>
  79. </el-select>
  80. </div>
  81. <div class="cqd-dataTitle">统计图</div>
  82. <el-row :gutter="32">
  83. <el-col :xs="24" :sm="24" :lg="24">
  84. <div class="chart-wrapper">
  85. <bar-chart
  86. :title="totitle + batotal + '人次'"
  87. :options="modesData"
  88. />
  89. </div>
  90. </el-col>
  91. </el-row>
  92. <div style="height:20px">&nbsp;</div>
  93. <div class="cqd-dataTitle">统计表</div>
  94. <el-table
  95. ref="multipleTable"
  96. :data="tableData"
  97. id="qcddt"
  98. border
  99. fit
  100. highlight-current-row
  101. style="width: 100%;margin-top: 10px;"
  102. :row-style="{ color: '#303133' }"
  103. :header-cell-style="{
  104. backgroundColor: 'rgb(245, 247, 250)',
  105. color: '#606266'
  106. }"
  107. >
  108. <el-table-column
  109. fixed
  110. label="日期"
  111. width="100"
  112. property="date"
  113. align="center"
  114. ></el-table-column>
  115. <el-table-column
  116. :label="modeItem.name"
  117. property="number"
  118. align="center"
  119. min-width="100"
  120. v-for="(modeItem, index) in activeModes"
  121. :key="index"
  122. >
  123. <template slot-scope="scope">
  124. {{
  125. scope.row.data[modeItem.id].number
  126. ? scope.row.data[modeItem.id].number
  127. : ""
  128. }}
  129. </template>
  130. </el-table-column>
  131. <el-table-column
  132. fixed="right"
  133. label="总数"
  134. width="80"
  135. property="total"
  136. align="center"
  137. ></el-table-column>
  138. </el-table>
  139. <!-- <pagi-nation title="分页"></pagi-nation> -->
  140. <el-pagination
  141. align="right"
  142. @size-change="handleSizeChange"
  143. @current-change="handleCurrentChange"
  144. :current-page="listQuery.pate"
  145. :page-sizes="[10, 20, 50, 100]"
  146. :page-size="10"
  147. background
  148. style="margin-top:20px;"
  149. layout="total, sizes, prev, pager, next, jumper"
  150. :total="total"
  151. ></el-pagination>
  152. </div>
  153. </div>
  154. </template>
  155. <script>
  156. import { getdialysistotaldata } from "@/api/qcd";
  157. import BarChart from "./components/BarChart";
  158. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  159. export default {
  160. name: "dialysisTotal",
  161. data() {
  162. return {
  163. crumbs: [
  164. { path: false, name: "科室质控" },
  165. { path: false, name: "透析总量" }
  166. ],
  167. total: 0,
  168. totitle: "全部",
  169. batotal: 0,
  170. modesData: {
  171. xAxis: [],
  172. series: []
  173. },
  174. listQuery: {
  175. start_time: "",
  176. end_time: "",
  177. page: 1,
  178. limit: 10,
  179. lapseto: 0,
  180. statistical_method: 0,
  181. mode_id: ""
  182. },
  183. modeOptions: {},
  184. tableData: [],
  185. statisticalMethod: 0,
  186. statisticalMethods: [
  187. { value: 0, label: "全部" },
  188. { value: 1, label: "开始透析" }
  189. // { value: 2, label: "排班" }
  190. ],
  191. lapsetoType: 0,
  192. lapsetoState: [
  193. { value: 0, label: "全部", source: 0, lapseto: 0 },
  194. { value: 1, label: "转出", source: 0, lapseto: 2 },
  195. { value: 2, label: "留治", source: 0, lapseto: 1 }
  196. ]
  197. };
  198. },
  199. created() {
  200. this.modeOptions = this.$store.getters.treatment_mode;
  201. var nowDate = new Date();
  202. var nowYear = nowDate.getFullYear();
  203. var nowMonth = nowDate.getMonth() + 1;
  204. var nowDay = nowDate.getDate();
  205. this.listQuery.end_time =
  206. nowYear +
  207. "-" +
  208. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  209. "-" +
  210. (nowDay < 10 ? "0" + nowDay : nowDay);
  211. nowDate.setMonth(nowDate.getMonth() - 3);
  212. nowYear = nowDate.getFullYear();
  213. nowMonth = nowDate.getMonth() + 1;
  214. nowDay = nowDate.getDate();
  215. this.listQuery.start_time =
  216. nowYear +
  217. "-" +
  218. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  219. "-" +
  220. (nowDay < 10 ? "0" + nowDay : nowDay);
  221. this.getList();
  222. },
  223. methods: {
  224. getList() {
  225. getdialysistotaldata(this.listQuery).then(response => {
  226. if (response.data.state == 0) {
  227. this.$message.error(response.data.msg);
  228. return false;
  229. } else {
  230. this.tableData = [];
  231. var dtd = response.data.data.dtd;
  232. var dd = {};
  233. for (const index in dtd) {
  234. if (!(dtd[index].date in dd)) {
  235. dd[dtd[index].date] = {};
  236. }
  237. if (
  238. !(dtd[index].mode_id in dd[dtd[index].date]) &&
  239. dtd[index].mode_id != "0"
  240. ) {
  241. dd[dtd[index].date][dtd[index].mode_id] = dtd[index];
  242. }
  243. }
  244. for (const key in dd) {
  245. var total = 0;
  246. for (const mkey in this.modeOptions) {
  247. if (mkey in dd[key]) {
  248. dd[key][mkey].mode = this.modeOptions[mkey].name;
  249. var number = parseInt(dd[key][mkey].number);
  250. if (isNaN(number) || number == 0) {
  251. dd[key][mkey].number = "";
  252. number = 0;
  253. }
  254. total += number;
  255. } else {
  256. dd[key][mkey] = {
  257. mode: this.modeOptions[mkey].name,
  258. mode_id: mkey,
  259. number: 0,
  260. date: key
  261. };
  262. }
  263. }
  264. this.tableData.push({ date: key, data: dd[key], total: total });
  265. }
  266. this.total = response.data.data.total;
  267. this.modesData = {
  268. xAxis: [],
  269. series: []
  270. };
  271. var ttd = response.data.data.ttd;
  272. var modeMap = {};
  273. var batotal = 0;
  274. for (const index in ttd) {
  275. if (ttd[index].mode_id == "0") {
  276. continue;
  277. }
  278. modeMap[ttd[index].mode_id] = ttd[index];
  279. }
  280. for (const key in this.modeOptions) {
  281. this.modesData.xAxis.push(this.modeOptions[key].name);
  282. if (key in modeMap) {
  283. this.modesData.series.push(parseInt(modeMap[key].number));
  284. batotal += parseInt(modeMap[key].number);
  285. } else {
  286. this.modesData.series.push(0);
  287. }
  288. }
  289. this.batotal = batotal;
  290. }
  291. });
  292. },
  293. changeTime() {
  294. this.getList();
  295. },
  296. changeEndTime(val) {
  297. var time =
  298. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  299. if (time < 0) {
  300. this.$message.error("结束时间不能小于开始时间");
  301. this.listQuery.end_time = "";
  302. } else {
  303. this.getList();
  304. }
  305. },
  306. getTimestamp(time) {
  307. // 把时间日期转成时间戳
  308. return new Date(time).getTime() / 1000;
  309. },
  310. selectStatisticalMethod(type) {
  311. this.statisticalMethod = type;
  312. this.listQuery.statistical_method = type;
  313. if (type == 1) {
  314. this.totitle = "总透析";
  315. } else if (type == 2) {
  316. this.totitle = "总排班";
  317. } else {
  318. this.totitle = "全部";
  319. }
  320. this.getList();
  321. },
  322. selectLapseTo(lapseto) {
  323. this.lapsetoType = lapseto;
  324. this.listQuery.lapseto = lapseto;
  325. this.getList();
  326. },
  327. changeModel() {
  328. this.getList();
  329. },
  330. handleSizeChange(val) {
  331. this.listQuery.limit = val;
  332. this.getList();
  333. },
  334. handleCurrentChange(val) {
  335. this.listQuery.page = val;
  336. this.getList();
  337. }
  338. },
  339. computed: {
  340. activeModes: function() {
  341. var modes = [];
  342. for (const key in this.modeOptions) {
  343. if (this.listQuery.mode_id == key || this.listQuery.mode_id == "") {
  344. modes.push(this.modeOptions[key]);
  345. }
  346. }
  347. return modes;
  348. }
  349. },
  350. components: {
  351. BarChart,
  352. BreadCrumb
  353. }
  354. };
  355. </script>
  356. <style>
  357. #qcddt ::-webkit-scrollbar {
  358. height: 15px;
  359. }
  360. </style>
  361. <style rel="stylesheet/scss" lang="scss" scoped>
  362. .app-container {
  363. // margin: 20px;
  364. font-size: 15px;
  365. .filter-container {
  366. padding-bottom: 5px;
  367. }
  368. .cqd-dataTitle {
  369. color: #303133;
  370. font-size: 14px;
  371. border-bottom: 2px #e4e7ed solid;
  372. height: 36px;
  373. line-height: 36px;
  374. margin: 0 0 25px 0;
  375. position: relative;
  376. }
  377. .cqd-dataTitle::before {
  378. position: absolute;
  379. left: 0;
  380. bottom: -2px;
  381. content: "";
  382. width: 42px;
  383. height: 2px;
  384. background: #409eff;
  385. }
  386. .search-component {
  387. width: 500px;
  388. .searchBox {
  389. width: 300px;
  390. height: 36px;
  391. line-height: 36px;
  392. padding-left: 15px;
  393. border: 1px #dcdfe6 solid;
  394. border-right: none;
  395. outline: none;
  396. float: left;
  397. border-radius: 6px 0 0 6px;
  398. font-size: 14px;
  399. color: #333;
  400. background: #fff;
  401. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  402. }
  403. .searchBtn {
  404. background-color: #409eff;
  405. color: #fff;
  406. font-size: 15px;
  407. text-align: center;
  408. height: 36px;
  409. line-height: 36px;
  410. float: left;
  411. outline: none;
  412. width: 70px;
  413. border: none;
  414. border-radius: 0 6px 6px 0;
  415. font-family: "Microsoft Yahei";
  416. cursor: pointer;
  417. }
  418. }
  419. .amount {
  420. font-weight: normal;
  421. padding: 10px 0 0 0;
  422. color: #606266;
  423. font-size: 14px;
  424. span {
  425. color: #ef2525;
  426. font-family: "Arial";
  427. padding: 0 2px;
  428. }
  429. }
  430. }
  431. </style>
  432. <style>
  433. .el-table td,
  434. .el-table th.is-leaf,
  435. .el-table--border,
  436. .el-table--group {
  437. border-color: #d0d3da;
  438. }
  439. .el-table--border::after,
  440. .el-table--group::after,
  441. .el-table::before {
  442. background-color: #d0d3da;
  443. }
  444. </style>