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

project.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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="changeOptions">
  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. <el-select v-model="mode_type" placeholder="请选择" style="width:120px;margin-right:20px" @change="handleModeType">
  29. <el-option
  30. v-for="item in normdata"
  31. :key="item.inspection_minor"
  32. :label="item.item_name"
  33. :value="item.inspection_minor"
  34. ></el-option>
  35. </el-select>
  36. </div>
  37. <div class="cell clearfix">
  38. <p class="chartTitle">统计图</p>
  39. </div>
  40. <div>
  41. <line-chart :options="chart"></line-chart>
  42. </div>
  43. <div class="cell clearfix">
  44. <p class="point"></p>
  45. <p class="pointTitle">指标正常范围值</p>
  46. </div>
  47. <div class="cell clearfix newDisplay">
  48. <span class="index" v-for="(item,index) in normdata" :key="index ">{{item.item_name}}({{item.min_range}}-{{item.large_range}})</span>
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. const moment = require('moment')
  55. import echarts from "echarts";
  56. import { GetOICData } from "@/api/qcd";
  57. import LineChart from "../../qcd/components/LineChart";
  58. import { uParseTime } from "@/utils/tools";
  59. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  60. import {getNormData,getProjectList,getMonthProjectList } from "@/api/common/common"
  61. export default {
  62. components: {
  63. LineChart,
  64. BreadCrumb
  65. },
  66. data() {
  67. return {
  68. activeName: "second",
  69. normdata:[],
  70. modesData: {
  71. xAxis: [],
  72. series: []
  73. },
  74. crumbs: [
  75. { path: false, name: "科室质控" },
  76. { path: false, name: "科室质控达标统计" },
  77. { path: false, name: "按项目分组" }
  78. ],
  79. options: [
  80. {
  81. value:0,
  82. label:"全部",
  83. },
  84. {
  85. value: 1,
  86. label: "留治",
  87. },
  88. {
  89. value:2,
  90. label: "转归"
  91. },
  92. ],
  93. options1: [
  94. {
  95. value: 1,
  96. label: "按季度对比统计"
  97. },
  98. {
  99. value: 2,
  100. label: "按月份对比统计"
  101. },
  102. ],
  103. value: "请选项",
  104. lapseto:0,
  105. type:1,
  106. mode_type:"",
  107. chart: {
  108. title: {
  109. text: "ECharts 入门示例"
  110. },
  111. tooltip: {},
  112. legend: {
  113. data: ["次数"],
  114. left: 0
  115. },
  116. xAxis: {
  117. data: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
  118. },
  119. yAxis: {
  120. axisLabel: {
  121. formatter: "{value} %"
  122. },
  123. show: false
  124. },
  125. series: [
  126. {
  127. name: "次数",
  128. type: "bar",
  129. data: [
  130. "78.57",
  131. "50",
  132. "80",
  133. "93.33",
  134. "92.86",
  135. "100",
  136. "12",
  137. "77",
  138. "37"
  139. ],
  140. barWidth: 30,
  141. label: {
  142. normal: {
  143. show: true,
  144. position: "top",
  145. formatter: "{c}%"
  146. }
  147. },
  148. //配置样式
  149. itemStyle: {
  150. //通常情况下:
  151. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  152. normal: {
  153. color: function(params) {
  154. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  155. var colorList = [
  156. ["#A9E0F3", "#9FBDFC"],
  157. ["#A9E0F3", "#9FBDFC"],
  158. ["#A9E0F3", "#9FBDFC"],
  159. ["#FFD7C0", "#FF9994"],
  160. ["#FFD7C0", "#FF9994"],
  161. ["#FFD7C0", "#FF9994"],
  162. ["#D7C3FD", "#B3A8F7"],
  163. ["#D7C3FD", "#B3A8F7"],
  164. ["#D7C3FD", "#B3A8F7"]
  165. ];
  166. var index = params.dataIndex;
  167. if (params.dataIndex >= colorList.length) {
  168. index = params.dataIndex % colorList.length;
  169. }
  170. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  171. { offset: 0, color: colorList[index][0] },
  172. // { offset: 0.5, color: colorList[index][1] },
  173. { offset: 1, color: colorList[index][1] }
  174. ]);
  175. },
  176. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  177. },
  178. //鼠标悬停时:
  179. emphasis: {
  180. shadowBlur: 10,
  181. shadowOffsetX: 0,
  182. shadowColor: "rgba(0, 0, 0, 0.5)"
  183. }
  184. }
  185. }
  186. ]
  187. }
  188. };
  189. },
  190. methods: {
  191. handleClick() {
  192. if (this.activeName == "first") {
  193. this.$router.push({ path: "/qcd/officesControlAnalysis/time" });
  194. }
  195. },
  196. chooseType(val) {
  197. this.type = val;
  198. console.log("val",val)
  199. //按季度
  200. if(val == 1){
  201. this.getlist()
  202. }
  203. //按月份
  204. if(val == 2){
  205. this.getMonthList()
  206. }
  207. },
  208. changeOptions(val){
  209. this.lapseto = val
  210. this.getlist()
  211. },
  212. getNormData(){
  213. getNormData().then(response=>{
  214. var normdata = response.data.data.normdata
  215. console.log("normdata",normdata)
  216. for(let i=0;i<normdata.length;i++){
  217. this.mode_type = normdata[0].inspection_minor
  218. }
  219. this.normdata = normdata
  220. this.getlist()
  221. this.getMonthList()
  222. })
  223. },
  224. handleModeType(val){
  225. this.mode_type = val
  226. this.getlist()
  227. },
  228. //季度
  229. getlist(){
  230. this.modesData.series = []
  231. this.modesData.xAxis = []
  232. const firstQuarterStart = moment().startOf('year').format('YYYY-MM-DD')
  233. // console.log("本月开始时间",firstQuarterStart)
  234. const firstQuarterEnd = moment().month(11).endOf('month').format("YYYY-MM-DD")
  235. // console.log("本月结束时间",firstQuarterEnd)
  236. //第一季度
  237. const first_quarter_start = moment().startOf('year').format('YYYY-MM-DD')
  238. // console.log("第一季度",first_quarter_start)
  239. const first_qurter_end = moment().month(2).endOf('month').format("YYYY-MM-DD")
  240. // console.log("第一季度",first_qurter_end)
  241. //第二季度
  242. const second_qurter_start = moment().month(3).startOf('month').format("YYYY-MM-DD")
  243. // console.log("第二季度",second_qurter_start)
  244. const second_qurter_end = moment().month(5).endOf('month').format("YYYY-MM-DD")
  245. // console.log("第二季度",second_qurter_end)
  246. //第三季度
  247. const three_qurter_start = moment().month(6).startOf('month').format("YYYY-MM-DD")
  248. // console.log("第三季度",three_qurter_start)
  249. const three_qurter_end = moment().month(8).endOf('month').format("YYYY-MM-DD")
  250. // console.log("第三季度",three_qurter_end)
  251. //第四季度
  252. const four_qurter_start = moment().month(9).startOf('month').format("YYYY-MM-DD")
  253. // console.log("第四季度",four_qurter_start)
  254. const four_qurter_end = moment().month(11).endOf('month').format("YYYY-MM-DD")
  255. // console.log("第四季度",four_qurter_end)
  256. const params = {
  257. lapseto:this.lapseto,
  258. itemtype:this.type,
  259. modetype:this.mode_type,
  260. startime:firstQuarterStart,
  261. endtime:firstQuarterEnd,
  262. first_quarter_start:first_quarter_start,
  263. first_qurter_end:first_qurter_end,
  264. second_qurter_start:second_qurter_start,
  265. second_qurter_end:second_qurter_end,
  266. three_qurter_start:three_qurter_start,
  267. three_qurter_end:three_qurter_end,
  268. four_qurter_start:four_qurter_start,
  269. four_qurter_end:four_qurter_end,
  270. }
  271. console.log("params",params)
  272. getProjectList(params).then(response=>{
  273. if(response.data.state === 1){
  274. var list = response.data.data.list
  275. // console.log("数据源",list)
  276. var standList = response.data.data.standList
  277. // console.log("standList",standList)
  278. var newArr = [
  279. {Total:"第一季度",Count:1,NoCount: 0},
  280. {Total:"第二季度",Count:1,NoCount: 0},
  281. {Total:"第三季度",Count:1,NoCount: 0},
  282. {Total:"第四季度",Count:1,NoCount: 0},
  283. ]
  284. //获取2个数组不同的部分
  285. var arrTwo = this.arrayDate(list,newArr)
  286. arrTwo.map(item => {
  287. list.push(item)
  288. })
  289. // console.log("list",list)
  290. for(let i=0;i<list.length;i++){
  291. if(list[i].Total == "第一季度"){
  292. list[i].Total = 1
  293. }
  294. if(list[i].Total == "第二季度"){
  295. list[i].Total = 2
  296. }
  297. if(list[i].Total == "第三季度"){
  298. list[i].Total = 3
  299. }
  300. if(list[i].Total == "第四季度"){
  301. list[i].Total = 4
  302. }
  303. }
  304. //排序
  305. list.sort(this.compare('Total'))
  306. for(let i=0;i<list.length;i++){
  307. if(list[i].Total == 1){
  308. list[i].Total = "第一季度"
  309. }
  310. if(list[i].Total == 2){
  311. list[i].Total = "第二季度"
  312. }
  313. if(list[i].Total == 3){
  314. list[i].Total = "第三季度"
  315. }
  316. if(list[i].Total == 4){
  317. list[i].Total = "第四季度"
  318. }
  319. }
  320. var newArrThree = [
  321. {Total:"第一季度",Count:0},
  322. {Total:"第二季度",Count:0},
  323. {Total:"第三季度",Count:0},
  324. {Total:"第四季度",Count:0},
  325. ]
  326. //获取2个数组不同的部分
  327. var standArr = this.arrayDateTwo(standList,newArrThree)
  328. standArr.map(item=>{
  329. standList.push(item)
  330. })
  331. // console.log("standList",standList)
  332. // console.log("list-----",list)
  333. var arrFive = []
  334. for(let i=0;i<list.length;i++){
  335. for(let j=0;j<standList.length;j++){
  336. if(list[i].Total == standList[j].Total){
  337. list[i].NoCount = standList[j].Count
  338. arrFive.push(list[i])
  339. }
  340. }
  341. }
  342. // console.log("arrFive",arrFive)
  343. for(const key in arrFive){
  344. this.modesData.xAxis.push(arrFive[key].Total);
  345. this.modesData.series.push(((arrFive[key].NoCount/arrFive[key].Count)*100).toFixed(1));
  346. }
  347. this.chart.series[0].data = this.modesData.series
  348. this.chart.xAxis.data = this.modesData.xAxis
  349. // console.log("222000",this.modesData)
  350. }
  351. })
  352. },
  353. arrayDate(array1,array2){
  354. // console.log("array1",array1)
  355. // console.log("array2",array2)
  356. var array1 = array1;
  357. var array2 = array2;
  358. var result = [];
  359. for(var i = 0; i < array2.length; i++){
  360. var obj = array2[i];
  361. var num = obj.Total; //staff_id 就是要对比的key
  362. var isExist = false;
  363. for(var j = 0; j < array1.length; j++){
  364. var aj = array1[j];
  365. var n = aj.Total;
  366. if(n == num){
  367. isExist = true;
  368. break;
  369. }
  370. }
  371. if(!isExist){
  372. result.push(obj);
  373. }
  374. }
  375. // console.log("result",result)
  376. return result;
  377. },
  378. arrayDateTwo(array1,array2){
  379. // console.log("array1",array1)
  380. // console.log("array2",array2)
  381. var array1 = array1;
  382. var array2 = array2;
  383. var result = [];
  384. for(var i = 0; i < array2.length; i++){
  385. var obj = array2[i];
  386. var num = obj.Total; //staff_id 就是要对比的key
  387. var isExist = false;
  388. for(var j = 0; j < array1.length; j++){
  389. var aj = array1[j];
  390. var n = aj.Total;
  391. if(n == num){
  392. isExist = true;
  393. break;
  394. }
  395. }
  396. if(!isExist){
  397. result.push(obj);
  398. }
  399. }
  400. // console.log("resultTwo",result)
  401. return result;
  402. },
  403. compare(property){
  404. return function(a,b){
  405. var value1 = a[property];
  406. var value2 = b[property];
  407. return value1 - value2;
  408. }
  409. },
  410. //按月份统计
  411. getMonthList(){
  412. const januaryStart = moment().month(0).startOf('month').format("YYYY-MM-DD")
  413. console.log("一月始",januaryStart)
  414. const januaryEnd = moment().month(0).endOf('month').format("YYYY-MM-DD")
  415. console.log("一月末",januaryEnd)
  416. const febStart = moment().month(1).startOf('month').format("YYYY-MM-DD")
  417. console.log("二月始",febStart)
  418. const febEnd = moment().month(1).endOf('month').format("YYYY-MM-DD")
  419. console.log("二月末",febEnd)
  420. const marchStart = moment().month(2).startOf('month').format("YYYY-MM-DD")
  421. console.log("三月始",marchStart)
  422. const marchEnd = moment().month(2).endOf('month').format("YYYY-MM-DD")
  423. console.log("三月末",marchEnd)
  424. const aprStart = moment().month(3).startOf('month').format("YYYY-MM-DD")
  425. console.log("四月始",aprStart)
  426. const aprEnd = moment().month(3).endOf('month').format("YYYY-MM-DD")
  427. console.log("四月末",aprEnd)
  428. const mayStart = moment().month(4).startOf('month').format("YYYY-MM-DD")
  429. console.log("五月始",mayStart)
  430. const mayEnd = moment().month(4).endOf('month').format("YYYY-MM-DD")
  431. console.log("五月末",mayEnd)
  432. const junStart = moment().month(5).startOf('month').format("YYYY-MM-DD")
  433. console.log("六月始",junStart)
  434. const junEnd = moment().month(5).endOf('month').format("YYYY-MM-DD")
  435. console.log("六月末",junEnd)
  436. const julStart = moment().month(6).startOf('month').format("YYYY-MM-DD")
  437. console.log("7月始",julStart)
  438. const julEnd = moment().month(6).endOf('month').format("YYYY-MM-DD")
  439. console.log("7月末",julEnd)
  440. const augStart = moment().month(7).startOf('month').format("YYYY-MM-DD")
  441. console.log("8月始",augStart)
  442. const augEnd = moment().month(7).endOf('month').format("YYYY-MM-DD")
  443. console.log("8月末",augEnd)
  444. const sepStart = moment().month(8).startOf('month').format("YYYY-MM-DD")
  445. console.log("9月始",sepStart)
  446. const sepEnd = moment().month(8).endOf('month').format("YYYY-MM-DD")
  447. console.log("9月末",sepEnd)
  448. const octStart = moment().month(9).startOf('month').format("YYYY-MM-DD")
  449. console.log("10月始",octStart)
  450. const octEnd = moment().month(9).endOf('month').format("YYYY-MM-DD")
  451. console.log("10月末",octEnd)
  452. const novStart = moment().month(10).startOf('month').format("YYYY-MM-DD")
  453. console.log("11月始",novStart)
  454. const novEnd = moment().month(10).endOf('month').format("YYYY-MM-DD")
  455. console.log("11月末",novEnd)
  456. const decStart = moment().month(11).startOf('month').format("YYYY-MM-DD")
  457. console.log("12月始",decStart)
  458. const decEnd = moment().month(11).endOf('month').format("YYYY-MM-DD")
  459. console.log("12月末",decEnd)
  460. const params = {
  461. lapseto:this.lapseto,
  462. itemtype:this.type,
  463. modetype:this.mode_type,
  464. januaryStart:januaryStart,
  465. januaryEnd:januaryEnd,
  466. febStart:febStart,
  467. febEnd:febEnd,
  468. marchStart:marchStart,
  469. marchEnd:marchEnd,
  470. aprStart:aprStart,
  471. aprEnd:aprEnd,
  472. mayStart:mayStart,
  473. mayEnd:mayEnd,
  474. junStart:junStart,
  475. junEnd:junEnd,
  476. julStart:julStart,
  477. julEnd:julEnd,
  478. augStart:augStart,
  479. augEnd:augEnd,
  480. sepStart:sepStart,
  481. sepEnd:sepEnd,
  482. octStart:octStart,
  483. octEnd:octEnd,
  484. novStart:novStart,
  485. novEnd:novEnd,
  486. decStart:decStart,
  487. decEnd:decEnd,
  488. }
  489. console.log("params",params)
  490. getMonthProjectList(params).then(response=>{
  491. if(response.data.state === 1){
  492. var monthlist = response.data.data.monthlist
  493. console.log("monthlist",monthlist)
  494. }
  495. })
  496. }
  497. },
  498. created(){
  499. //获取指标正常范围值
  500. this.getNormData()
  501. },
  502. };
  503. </script>
  504. <style lang="scss" scoped>
  505. .newLi {
  506. li {
  507. background: #f5f5f6;
  508. }
  509. }
  510. .chartTitle {
  511. font-size: 16px;
  512. font-weight: bold;
  513. color: #000000;
  514. }
  515. .point {
  516. width: 13px;
  517. height: 13px;
  518. background: linear-gradient(
  519. 0deg,
  520. rgba(169, 224, 243, 1),
  521. rgba(159, 189, 252, 1)
  522. );
  523. border-radius: 7px;
  524. margin-right: 8px;
  525. }
  526. .pointTitle {
  527. font-size: 13px;
  528. }
  529. .index {
  530. color: #a09ba3;
  531. font-size: 13px;
  532. margin-right: 36px;
  533. margin-bottom: 20px;
  534. }
  535. .newDisplay {
  536. flex-wrap: wrap;
  537. }
  538. </style>