Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

time.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  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. <el-tabs v-model="activeName" @tab-click="handleClick">
  8. <el-tab-pane label="按时间分组" name="first"></el-tab-pane>
  9. <el-tab-pane label="按项目分组" name="second"></el-tab-pane>
  10. </el-tabs>
  11. <div class="cell clearfix">
  12. <el-select v-model="lapseto" placeholder="请选择" style="width:120px;margin-right:20px" @change="changeLapseto">
  13. <el-option
  14. v-for="item in options"
  15. :key="item.value"
  16. :label="item.label"
  17. :value="item.value"
  18. ></el-option>
  19. </el-select>
  20. <el-select v-model="type" placeholder="请选择" @change="chooseType" style="margin-right:20px">
  21. <el-option
  22. v-for="item in options1"
  23. :key="item.value"
  24. :label="item.label"
  25. :value="item.value"
  26. ></el-option>
  27. </el-select>
  28. <div v-if="type == '自定义'">
  29. <label class="title">
  30. <span class="name">日期查询</span> :
  31. </label>
  32. <el-date-picker
  33. v-model="listQuery.start_time"
  34. prefix-icon="el-icon-date"
  35. @change="changeTime"
  36. :editable="false"
  37. style="width: 196px;"
  38. type="date"
  39. placeholder="选择日期时间"
  40. align="right"
  41. format="yyyy-MM-dd"
  42. value-format="yyyy-MM-dd"
  43. :picker-options="pickerOptions"
  44. ></el-date-picker>
  45. <span class>-</span>
  46. <el-date-picker
  47. v-model="listQuery.end_time"
  48. prefix-icon="el-icon-date"
  49. @change="changeEndTime"
  50. :editable="false"
  51. style="width: 196px;"
  52. type="date"
  53. placeholder="选择日期时间"
  54. align="right"
  55. format="yyyy-MM-dd"
  56. value-format="yyyy-MM-dd"
  57. :picker-options="pickerOptions"
  58. ></el-date-picker>
  59. </div>
  60. </div>
  61. <div class="cell clearfix">
  62. <div class="time newLi" v-if="type == '按季度统计对比'">
  63. <ul class>
  64. <li
  65. :class="item.state == quarterType ? 'active' : ''"
  66. @click="chooseQuarter(item.state)"
  67. v-for="item in quarter"
  68. :key="item.value"
  69. >{{ item.label }}</li>
  70. </ul>
  71. </div>
  72. <div class="time newLi" v-if="type == '按月份统计对比'">
  73. <ul class>
  74. <li
  75. :class="item.state == monthType ? 'active' : ''"
  76. @click="chooseMonth(item.state)"
  77. v-for="item in month"
  78. :key="item.value"
  79. >{{ item.label }}</li>
  80. </ul>
  81. </div>
  82. </div>
  83. <div class="cell clearfix">
  84. <p class="chartTitle">统计图</p>
  85. </div>
  86. <div>
  87. <line-chart :options="chart"></line-chart>
  88. </div>
  89. <div class="cell clearfix">
  90. <p class="point"></p>
  91. <p class="pointTitle">指标正常范围值</p>
  92. </div>
  93. <div class="cell clearfix newDisplay">
  94. <span v-for="(item,index) in normData" :key="index" class="index">
  95. {{item.item_name}}
  96. <span v-if="item.range_type == 1">({{item.min_range}}-{{item.large_range}})</span>
  97. <span v-if="item.range_type == 2">({{item.range_value}})</span>
  98. </span>
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. const moment = require('moment')
  105. import echarts from "echarts";
  106. import { GetOICData } from "@/api/qcd";
  107. import LineChart from "../../qcd/components/LineChart";
  108. import { uParseTime } from "@/utils/tools";
  109. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  110. import {getNormData,getFirstQuarter}from "@/api/common/common"
  111. export default {
  112. components: {
  113. LineChart,
  114. BreadCrumb
  115. },
  116. data() {
  117. return {
  118. pickerOptions: {
  119. disabledDate(time) {
  120. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  121. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  122. }
  123. },
  124. modetype:0,
  125. startime:"",
  126. endtime:"",
  127. activeName: "first",
  128. modesData: {
  129. xAxis: [],
  130. series: []
  131. },
  132. crumbs: [
  133. { path: false, name: "质控管理" },
  134. { path: false, name: "科室质控达标统计" },
  135. { path: false, name: "按时间分组" }
  136. ],
  137. normData:[],
  138. listQuery: {
  139. start_time: "",
  140. end_time: "",
  141. page: 1,
  142. limit: 10
  143. },
  144. lapseto:0,
  145. options: [
  146. {
  147. value: 0,
  148. label: "全部"
  149. },
  150. {
  151. value: 1,
  152. label: "留治"
  153. },
  154. {
  155. value: 2,
  156. label: "转出"
  157. },
  158. ],
  159. value: "请选项",
  160. options1: [
  161. {
  162. value: "按季度统计对比",
  163. label: "按季度统计对比"
  164. },
  165. {
  166. value: "按月份统计对比",
  167. label: "按月份统计对比"
  168. },
  169. {
  170. value: "自定义",
  171. label: "自定义"
  172. }
  173. ],
  174. type: "按季度统计对比",
  175. quarter: [
  176. { value: 0, label: "第一季度", state: 0 },
  177. { value: 1, label: "第二季度", state: 1 },
  178. { value: 2, label: "第三季度", state: 2 },
  179. { value: 3, label: "第四季度", state: 3 }
  180. ],
  181. quarterType: 0,
  182. month: [
  183. { value: 0, label: "一月", state: 0 },
  184. { value: 1, label: "二月", state: 1 },
  185. { value: 2, label: "三月", state: 2 },
  186. { value: 3, label: "四月", state: 3 },
  187. { value: 4, label: "五月", state: 4 },
  188. { value: 5, label: "六月", state: 5 },
  189. { value: 6, label: "七月", state: 6 },
  190. { value: 7, label: "八月", state: 7 },
  191. { value: 8, label: "九月", state: 8 },
  192. { value: 9, label: "十月", state: 9 },
  193. { value: 10, label: "十一月", state: 10 },
  194. { value: 11, label: "十二月", state: 11 }
  195. ],
  196. monthType: 0,
  197. chart: {
  198. title: {
  199. text: "ECharts 入门示例"
  200. },
  201. tooltip: {},
  202. legend: {
  203. data: ["次数"],
  204. left: 0
  205. },
  206. xAxis: {
  207. data: []
  208. },
  209. yAxis: {
  210. axisLabel: {
  211. formatter: "{value}%"
  212. },
  213. show: false
  214. },
  215. series: [
  216. {
  217. name: "次数",
  218. type: "bar",
  219. data: [],
  220. barWidth: 30,
  221. label: {
  222. normal: {
  223. show: true,
  224. position: "top",
  225. formatter: "{c}%"
  226. }
  227. },
  228. //配置样式
  229. itemStyle: {
  230. //通常情况下:
  231. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  232. normal: {
  233. color: function(params) {
  234. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  235. var colorList = [
  236. ["#A9E0F3", "#9FBDFC"],
  237. ["#A9E0F3", "#9FBDFC"],
  238. ["#A9E0F3", "#9FBDFC"],
  239. ["#FFD7C0", "#FF9994"],
  240. ["#FFD7C0", "#FF9994"],
  241. ["#FFD7C0", "#FF9994"],
  242. ["#D7C3FD", "#B3A8F7"],
  243. ["#D7C3FD", "#B3A8F7"],
  244. ["#D7C3FD", "#B3A8F7"]
  245. ];
  246. var index = params.dataIndex;
  247. if (params.dataIndex >= colorList.length) {
  248. index = params.dataIndex % colorList.length;
  249. }
  250. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  251. { offset: 0, color: colorList[index][0] },
  252. // { offset: 0.5, color: colorList[index][1] },
  253. { offset: 1, color: colorList[index][1] }
  254. ]);
  255. },
  256. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  257. },
  258. //鼠标悬停时:
  259. emphasis: {
  260. shadowBlur: 10,
  261. shadowOffsetX: 0,
  262. shadowColor: "rgba(0, 0, 0, 0.5)"
  263. }
  264. }
  265. }
  266. ],
  267. dataZoom: [
  268. {
  269. // Y轴固定,让内容滚动
  270. type: 'slider',
  271. show: false,
  272. xAxisIndex: [0],
  273. start: 1,
  274. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  275. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  276. },
  277. {
  278. type: 'inside',
  279. xAxisIndex: [0],
  280. start: 1,
  281. end: 20,
  282. zoomLock: true // 锁定区域禁止缩放
  283. }
  284. ]
  285. }
  286. };
  287. },
  288. methods: {
  289. handleClick() {
  290. if (this.activeName == "second") {
  291. this.$router.push({ path: "/qcd/officesControlAnalysis/project" });
  292. }
  293. },
  294. changeTime(val) {
  295. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time);
  296. if (time > 0) {
  297. this.$message.error("结束时间不能小于开始时间");
  298. this.listQuery.start_time = "";
  299. } else {
  300. this.getlist()
  301. }
  302. },
  303. changeLapseto(val){
  304. if(val == 0){
  305. this.lapseto = 0
  306. this.getlist()
  307. }
  308. if(val == 1){
  309. this.lapseto =1
  310. this.getlist()
  311. }
  312. if(val == 2){
  313. this.lapseto = 2
  314. this.getlist()
  315. }
  316. },
  317. changeEndTime(val) {
  318. var time =
  319. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  320. if (time < 0) {
  321. this.$message.error("结束时间不能小于开始时间");
  322. this.listQuery.end_time = "";
  323. } else {
  324. this.getlist()
  325. }
  326. },
  327. getTimestamp(time) {
  328. // 把时间日期转成时间戳
  329. return new Date(time).getTime() / 1000;
  330. },
  331. selectLapseTo(state) {
  332. this.stateType = state;
  333. this.listQuery.state = state;
  334. },
  335. chooseType(val) {
  336. this.type = val;
  337. if(val == "按月份统计对比"){
  338. this.modetype = 0
  339. }
  340. if(val == "按季度统计对比"){
  341. this.modetype = 1
  342. }
  343. if(val == "自定义"){
  344. this.modetype = 2
  345. }
  346. },
  347. chooseQuarter(quarter) {
  348. this.quarterType = quarter;
  349. //第一季度
  350. if(quarter === 0){
  351. this.modetype = 0
  352. this.getlist()
  353. return false
  354. }
  355. //第二季度
  356. if(quarter === 1){
  357. this.modetype = 0
  358. this.getlist()
  359. return false
  360. }
  361. //第三季度
  362. if(quarter === 2){
  363. this.modetype = 0
  364. this.getlist()
  365. return false
  366. }
  367. //第四季度
  368. if(quarter === 3){
  369. this.modetype = 0
  370. this.getlist()
  371. return false
  372. }
  373. },
  374. chooseMonth(month) {
  375. //1月
  376. if(month == 0){
  377. this.modetype = 1
  378. this.monthType = month;
  379. this.getlist()
  380. return false
  381. }
  382. //2月
  383. if(month == 1){
  384. this.modetype = 1
  385. this.monthType = month;
  386. this.getlist()
  387. return false
  388. }
  389. //
  390. //3月
  391. if(month == 2){
  392. this.modetype = 1
  393. this.monthType = month;
  394. this.getlist()
  395. return false
  396. }
  397. //4月
  398. if(month == 3){
  399. this.modetype = 1
  400. this.monthType = month;
  401. this.getlist()
  402. return false
  403. }
  404. //5月
  405. if(month == 4){
  406. this.modetype = 1
  407. this.monthType = month;
  408. this.getlist()
  409. return false
  410. }
  411. //6月
  412. if(month == 5){
  413. this.modetype = 1
  414. this.monthType = month;
  415. this.getlist()
  416. return false
  417. }
  418. //7月
  419. if(month == 6){
  420. this.monthType = month;
  421. this.modetype = 1
  422. this.getlist()
  423. return false
  424. }
  425. //8月
  426. if(month == 7){
  427. this.monthType = month;
  428. this.modetype = 1
  429. this.getlist()
  430. return false
  431. }
  432. //9月
  433. if(month == 8){
  434. this.monthType = month;
  435. this.modetype = 1
  436. this.getlist()
  437. return false
  438. }
  439. //10月
  440. if(month == 9){
  441. this.monthType = month;
  442. this.modetype = 1
  443. this.getlist()
  444. return false
  445. }
  446. //11月
  447. if(month == 10){
  448. this.monthType = month;
  449. this.modetype = 1
  450. this.getlist()
  451. return false
  452. }
  453. //12月
  454. if(month == 11){
  455. this.monthType = month;
  456. this.modetype = 1
  457. this.getlist()
  458. return false
  459. }
  460. },
  461. getNormData(){
  462. getNormData().then(response=>{
  463. if(response.data.state === 1){
  464. var normdata = response.data.data.normdata
  465. console.log("指标正常范围",normdata)
  466. this.normData = normdata
  467. this.getlist()
  468. }
  469. })
  470. },
  471. //第一季度
  472. getlist(){
  473. this.modesData.series = []
  474. this.modesData.xAxis = []
  475. //本月的开始时间
  476. //第一季度
  477. if(this.modetype == 0 && this.quarterType == 0){
  478. this.startime = moment().startOf('year').format('YYYY-MM-DD')
  479. this.endtime = moment().month(2).endOf('month').format("YYYY-MM-DD")
  480. }
  481. //第二季度
  482. if(this.modetype ==0 && this.quarterType == 1){
  483. this.startime = moment().month(3).startOf('month').format("YYYY-MM-DD")
  484. this.endtime = moment().month(5).endOf('month').format("YYYY-MM-DD")
  485. }
  486. //第三季度
  487. if( this.modetype ==0 && this.quarterType == 2){
  488. this.startime = moment().month(6).startOf('month').format("YYYY-MM-DD")
  489. this.endtime = moment().month(8).endOf('month').format("YYYY-MM-DD")
  490. }
  491. //第四季度
  492. if( this.modetype ==0 && this.quarterType == 3){
  493. this.startime = moment().month(8).startOf('month').format("YYYY-MM-DD")
  494. this.endtime = moment().month(11).endOf('month').format("YYYY-MM-DD")
  495. }
  496. //1月
  497. if(this.modetype == 1 && this.monthType == 0){
  498. this.startime = moment().month(0).startOf('month').format("YYYY-MM-DD")
  499. this.endtime = moment().month(0).endOf('month').format("YYYY-MM-DD")
  500. }
  501. //2 月
  502. if( this.modetype == 1 && this.monthType == 1){
  503. this.startime = moment().month(1).startOf('month').format("YYYY-MM-DD")
  504. this.endtime = moment().month(1).endOf('month').format("YYYY-MM-DD")
  505. }
  506. //3 月
  507. if(this.modetype == 1 && this.monthType == 2){
  508. this.startime = moment().month(2).startOf('month').format("YYYY-MM-DD")
  509. this.endtime = moment().month(2).endOf('month').format("YYYY-MM-DD")
  510. }
  511. //4月
  512. if(this.modetype == 1 && this.monthType == 3){
  513. this.startime = moment().month(3).startOf('month').format("YYYY-MM-DD")
  514. this.endtime = moment().month(3).endOf('month').format("YYYY-MM-DD")
  515. }
  516. //5月
  517. if(this.modetype == 1 && this.monthType == 4){
  518. this.startime = moment().month(4).startOf('month').format("YYYY-MM-DD")
  519. this.endtime= moment().month(4).endOf('month').format("YYYY-MM-DD")
  520. }
  521. //6月
  522. if(this.modetype == 1 && this.monthType == 5){
  523. this.startime = moment().month(5).startOf('month').format("YYYY-MM-DD")
  524. this.endtime = moment().month(5).endOf('month').format("YYYY-MM-DD")
  525. }
  526. //7月
  527. if(this.modetype == 1 && this.monthType == 6){
  528. this.startime = moment().month(6).startOf('month').format("YYYY-MM-DD")
  529. this.endtime = moment().month(6).endOf('month').format("YYYY-MM-DD")
  530. }
  531. //8月
  532. if(this.modetype==1 && this.monthType == 7){
  533. this.startime = moment().month(7).startOf('month').format("YYYY-MM-DD")
  534. this.endtime = moment().month(7).endOf('month').format("YYYY-MM-DD")
  535. }
  536. //9月
  537. if(this.modetype == 1 && this.monthType == 8){
  538. this.startime = moment().month(8).startOf('month').format("YYYY-MM-DD")
  539. this.endtime = moment().month(8).endOf('month').format("YYYY-MM-DD")
  540. }
  541. //10月
  542. if(this.modetype == 1 && this.monthType == 9){
  543. this.startime = moment().month(9).startOf('month').format("YYYY-MM-DD")
  544. this.endtime = moment().month(9).endOf('month').format("YYYY-MM-DD")
  545. }
  546. //11月
  547. if(this.modetype == 1 && this.monthType == 10){
  548. this.startime = moment().month(10).startOf('month').format("YYYY-MM-DD")
  549. this.endtime = moment().month(10).endOf('month').format("YYYY-MM-DD")
  550. }
  551. //12月
  552. if(this.modetype == 1 && this.monthType == 11){
  553. this.startime = moment().month(11).startOf('month').format("YYYY-MM-DD")
  554. this.endtime = moment().month(11).endOf('month').format("YYYY-MM-DD")
  555. }
  556. if(this.modetype == 2){
  557. this.startime = this.listQuery.start_time
  558. this.endtime = this.listQuery.end_time
  559. }
  560. const params = {
  561. lapseto:this.lapseto,
  562. startime:this.startime,
  563. endtime:this.endtime
  564. }
  565. getFirstQuarter(params).then(response=>{
  566. if(response.data.state === 1){
  567. var count = response.data.data.count
  568. console.log("count",count)
  569. var countwo = response.data.data.countwo
  570. console.log("countwo",countwo)
  571. countwo.map(item=>{
  572. count.push(item)
  573. })
  574. // console.log("count",count)
  575. //获取已经配置的数据
  576. var arr=[]
  577. for(let i=0;i<count.length;i++){
  578. for(let j=0;j<this.normData.length;j++){
  579. if(count[i].item_id == this.normData[j].inspection_minor){
  580. arr.push(count[i])
  581. }
  582. }
  583. }
  584. console.log("arr",arr )
  585. var arrtwo = this.arrayDate(count,this.normData)
  586. for(let i=0;i<arrtwo.length;i++){
  587. this.$set(arrtwo[i], 'Count', 0)
  588. }
  589. for(let i=0;i<arrtwo.length;i++){
  590. this.$set(arrtwo[i], 'Total', 1)
  591. }
  592. arrtwo.map(item => {
  593. arr.push(item)
  594. })
  595. console.log("arr",arr)
  596. arr.sort(this.compare('sort'))
  597. // arr.sort((a,b)=>{
  598. // return projectArr.indexOf(a.ProjectName)-projectArr.indexOf(b.ProjectName);
  599. // });
  600. // console.log("arr",arr)
  601. for(const key in this.normData ){
  602. this.modesData.xAxis.push(this.normData[key].item_name);
  603. if(key in arr){
  604. this.modesData.series.push(((parseInt(arr[key].Count)/parseInt(arr[key].Total))*100).toFixed(1));
  605. } else {
  606. this.modesData.series.push(0);
  607. }
  608. }
  609. this.chart.series[0].data = this.modesData.series
  610. this.chart.xAxis.data = this.modesData.xAxis
  611. this.getArrLength(this.chart.xAxis.data)
  612. // console.log('====',this.modesData)
  613. }
  614. })
  615. },
  616. compare(property){
  617. return function(a,b){
  618. var value1 = a[property];
  619. var value2 = b[property];
  620. return value1 - value2;
  621. }
  622. },
  623. arrayDate(array1,array2){
  624. var array1 = array1;
  625. var array2 = this.normData;
  626. var result = [];
  627. for(var i = 0; i < array2.length; i++){
  628. var obj = array2[i];
  629. var num = obj.inspection_minor; //staff_id 就是要对比的key
  630. var isExist = false;
  631. for(var j = 0; j < array1.length; j++){
  632. var aj = array1[j];
  633. var n = aj.item_id;
  634. if(n == num){
  635. isExist = true;
  636. break;
  637. }
  638. }
  639. if(!isExist){
  640. result.push(obj);
  641. }
  642. }
  643. return result;
  644. },
  645. getArrLength(result){
  646. if(result.length > 10){
  647. var dataZoom_end = (10/result.length)*100;
  648. this.chart.dataZoom[0].end = dataZoom_end
  649. }else{
  650. var dataZoom_end = 100;
  651. this.chart.dataZoom[0].end = dataZoom_end
  652. }
  653. }
  654. },
  655. created(){
  656. //获取指标正常范围值
  657. this.getNormData()
  658. // this.getFirstQuarter(this.lapseto,firstQuarterStart,firstQuarterEnd)
  659. }
  660. };
  661. </script>
  662. <style lang="scss" scoped>
  663. .newLi {
  664. li {
  665. background: #f5f5f6;
  666. }
  667. }
  668. .chartTitle {
  669. font-size: 16px;
  670. font-weight: bold;
  671. color: #000000;
  672. }
  673. .point {
  674. width: 13px;
  675. height: 13px;
  676. background: linear-gradient(
  677. 0deg,
  678. rgba(169, 224, 243, 1),
  679. rgba(159, 189, 252, 1)
  680. );
  681. border-radius: 7px;
  682. margin-right: 8px;
  683. }
  684. .pointTitle {
  685. font-size: 13px;
  686. }
  687. .index {
  688. color: #a09ba3;
  689. font-size: 13px;
  690. margin-right: 36px;
  691. margin-bottom: 20px;
  692. }
  693. .newDisplay {
  694. flex-wrap: wrap;
  695. }
  696. </style>