6abf1a02a79a0db5ebd257f0d8b4e0575ca13561.svn-base 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. <!-- -->
  2. <template>
  3. <div>
  4. <el-row style="text-align: center;">
  5. <el-radio-group v-model="useObjFlagRadio" @change="searchTypeChangeEvent">
  6. <el-radio label="1">问题数量</el-radio>
  7. <el-radio label="2">项目数量</el-radio>
  8. </el-radio-group>
  9. </el-row>
  10. <el-row>
  11. <el-col :span="14">
  12. <div style="width:100%;" :style="{'height': colHeight - 40 + 'px'}" ref="left_bar"></div>
  13. </el-col>
  14. <el-col :span="10">
  15. <el-row>
  16. <div style="width:100%;" :style="{'height': colHeight/2 - 40 + 'px'}" ref="right_top_bar"></div>
  17. </el-row>
  18. <el-row>
  19. <div style="width:100%;" :style="{'height': colHeight/2 - 40 + 'px'}" ref="right_bottom_pie"></div>
  20. </el-row>
  21. </el-col>
  22. </el-row>
  23. </div>
  24. </template>
  25. <script>
  26. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  27. //例如:import 《组件名称》 from '《组件路径》';
  28. import echarts from 'echarts'
  29. import request from "@util/gw_ajax_request"
  30. import {
  31. leftData,
  32. right_topData,
  33. right_bottomData,
  34. } from "./inspectionApi.js";
  35. export default {
  36. //import引入的组件需要注入到对象中才能使用
  37. props: ['addForm', 'addForms', 'addFormt', 'isClear', 'testBool','singleOrMach'],
  38. components: {},
  39. data() {
  40. //这里存放数据
  41. return {
  42. returnedTarget: {},
  43. useObjFlagRadio: "1",
  44. selectNum: 1,
  45. barData_zy: {},
  46. barData_zy_right_top: {},
  47. barData_zy_right_bottom: {},
  48. name_left: [],
  49. value_left: [],
  50. nameShow: [],
  51. name_right_top: [],
  52. value_right_top: [],
  53. mySeries: [],
  54. mySeries_right_top: [],
  55. mySeries_right_bottom: [],
  56. pieData_zy: [],
  57. chart: {},
  58. chart_right_top: {},
  59. chart_right_bottom: {},
  60. barData: [],
  61. barData_right_top: [],
  62. barData_right_bottom: [],
  63. radius_in: "",
  64. radius_out: "",
  65. stbClaName: "前期与设计",
  66. colHeight: window.innerHeight - 90,
  67. scale: 1,
  68. rich: {
  69. yellow: {
  70. color: "#ffc72b",
  71. fontSize: 30 * this.scale,
  72. padding: [5, 4],
  73. align: 'center'
  74. },
  75. black: {
  76. // color: "#3a3a3a",
  77. fontSize: 30 * this.scale,
  78. padding: [5, 4],
  79. align: 'center'
  80. },
  81. blackSmall: {
  82. // color: "#3a3a3a",
  83. fontSize: 16 * this.scale,
  84. padding: [5, 4],
  85. align: 'center'
  86. },
  87. total: {
  88. // color: "#ffc72b",
  89. fontSize: 40 * this.scale,
  90. align: 'center'
  91. },
  92. white: {
  93. // color: "#fff",
  94. align: 'center',
  95. fontSize: 14 * this.scale,
  96. padding: [21, 0]
  97. },
  98. blue: {
  99. color: '#49dff0',
  100. fontSize: 16 * this.scale,
  101. align: 'center'
  102. },
  103. hr: {
  104. borderColor: '#3a3a3a',
  105. width: '100%',
  106. borderWidth: 1,
  107. height: 0,
  108. }
  109. },
  110. standSize: document.body.clientWidth
  111. };
  112. },
  113. //监听属性 类似于data概念
  114. computed: {},
  115. //监控data中的数据变化
  116. watch: {
  117. isClear(n, o) {//从多批次切换到单批次时数据回归
  118. this.testBool = !this.testBool;
  119. this.chart.clear();
  120. this.chart_right_top.clear();
  121. this.chart_right_bottom.clear();
  122. this.clearAllData();
  123. // this.mySeries = [];
  124. this.paramsConfigEvent();
  125. this.getDataChartData_left(this.addForm, 1)
  126. this.getDataChartData_right_top(this.addForm, 1)
  127. this.getDataChartData_right_bottom({
  128. "year": new Date().getFullYear(),
  129. "batch": "",
  130. "stbClaName": this.returnedTarget.stbClaName,
  131. "rgstrId": this.addForm.rgstrId
  132. }, 1)
  133. },
  134. "addForm.year": {
  135. handler(newVal, oldVal) {
  136. // if(newVal) {
  137. var _self = this;
  138. console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  139. this.selectNum = 1;
  140. this.clearData();
  141. this.paramsConfigEvent();
  142. if (this.testBool) {
  143. _self.getDataChartData_left(_self.addForm, _self.selectNum)
  144. _self.getDataChartData_right_top(_self.addForm, _self.selectNum)
  145. _self.getDataChartData_right_bottom(_self.returnedTarget, _self.selectNum)
  146. }
  147. // }
  148. },
  149. deep: true
  150. },
  151. "addForm.batch": {
  152. handler(newVal, oldVal) {
  153. // if(newVal) {
  154. var _self = this;
  155. console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  156. this.selectNum = 1;
  157. this.clearData();
  158. this.paramsConfigEvent();
  159. if (this.testBool) {
  160. _self.getDataChartData_left(_self.addForm, _self.selectNum)
  161. _self.getDataChartData_right_top(_self.addForm, _self.selectNum)
  162. _self.getDataChartData_right_bottom(_self.returnedTarget, _self.selectNum)
  163. }
  164. // }
  165. },
  166. deep: true
  167. },
  168. "addForm.rgstrId": {
  169. handler(newVal, oldVal) {
  170. if(newVal) {
  171. var _self = this;
  172. console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  173. this.selectNum = 1;
  174. this.clearData();
  175. this.paramsConfigEvent();
  176. if (this.testBool) {
  177. _self.getDataChartData_left(_self.addForm, _self.selectNum)
  178. _self.getDataChartData_right_top(_self.addForm, _self.selectNum)
  179. _self.getDataChartData_right_bottom(_self.returnedTarget, _self.selectNum)
  180. }
  181. }
  182. },
  183. deep: true
  184. },
  185. // "addForms.year": {
  186. // handler(newVal, oldVal) {
  187. // if(newVal) {
  188. // var _self = this;
  189. // console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  190. // this.selectNum = 2;
  191. // this.clearData();
  192. // // this.paramsConfigEvent();
  193. // if (this.testBool) {
  194. // _self.getDataChartData_left(_self.addForms, _self.selectNum)
  195. // // _self.getDataChartData_right_top(_self.addForms,_self.selectNum)
  196. // // _self.getDataChartData_right_bottom(_self.returnedTarget,_self.selectNum)
  197. // }
  198. // }
  199. // },
  200. // deep: true
  201. // },
  202. // "addForms.batch": {
  203. // handler(newVal, oldVal) {
  204. // if(newVal) {
  205. // var _self = this;
  206. // console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  207. // this.selectNum = 2;
  208. // this.clearData();
  209. // // this.paramsConfigEvent();
  210. // if (this.testBool) {
  211. // _self.getDataChartData_left(_self.addForms, _self.selectNum)
  212. // // _self.getDataChartData_right_top(_self.addForms,_self.selectNum)
  213. // // _self.getDataChartData_right_bottom(_self.returnedTarget,_self.selectNum)
  214. // }
  215. // }
  216. // },
  217. // deep: true
  218. // },
  219. // "addForms.rgstrId": {
  220. // handler(newVal, oldVal) {
  221. // if(newVal) {
  222. // var _self = this;
  223. // console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  224. // this.selectNum = 2;
  225. // this.clearData();
  226. // // this.paramsConfigEvent();
  227. // if (this.testBool) {
  228. // _self.getDataChartData_left(_self.addForms, _self.selectNum)
  229. // // _self.getDataChartData_right_top(_self.addForms,_self.selectNum)
  230. // // _self.getDataChartData_right_bottom(_self.returnedTarget,_self.selectNum)
  231. // }
  232. // }
  233. // },
  234. // deep: true
  235. // },
  236. // "addFormt.year": {
  237. // handler(newVal, oldVal) {
  238. // if(newVal) {
  239. // var _self = this;
  240. // console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  241. // this.selectNum = 3;
  242. // this.clearData();
  243. // // this.paramsConfigEvent();
  244. // if (this.testBool) {
  245. // _self.getDataChartData_left(_self.addFormt, _self.selectNum)
  246. // // _self.getDataChartData_right_top(_self.addFormt,_self.selectNum)
  247. // // _self.getDataChartData_right_bottom(_self.returnedTarget,_self.selectNum)
  248. // }
  249. // }
  250. // },
  251. // deep: true
  252. // },
  253. // "addFormt.batch": {
  254. // handler(newVal, oldVal) {
  255. // if(newVal) {
  256. // var _self = this;
  257. // console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  258. // this.selectNum = 3;
  259. // this.clearData();
  260. // // this.paramsConfigEvent();
  261. // if (this.testBool) {
  262. // _self.getDataChartData_left(_self.addFormt, _self.selectNum)
  263. // // _self.getDataChartData_right_top(_self.addFormt,_self.selectNum)
  264. // // _self.getDataChartData_right_bottom(_self.returnedTarget,_self.selectNum)
  265. // }
  266. // }
  267. // },
  268. // deep: true
  269. // },
  270. // "addFormt.rgstrId": {
  271. // handler(newVal, oldVal) {
  272. // if(newVal) {
  273. // var _self = this;
  274. // console.log("newVal:" + newVal + ", oldVal:" + oldVal)
  275. // this.selectNum = 3;
  276. // this.clearData();
  277. // // this.paramsConfigEvent();
  278. // if (this.testBool) {
  279. // _self.getDataChartData_left(_self.addFormt, _self.selectNum)
  280. // // _self.getDataChartData_right_top(_self.addFormt,_self.selectNum)
  281. // // _self.getDataChartData_right_bottom(_self.returnedTarget,_self.selectNum)
  282. // }
  283. // }
  284. // },
  285. // deep: true
  286. // },
  287. },
  288. //方法集合
  289. methods: {
  290. // getDataChartReslove(params,item){
  291. // var _self = this;
  292. // let paramsSelf = params;
  293. // paramsSelf.useObjFlag = _self.useObjFlagRadio;
  294. // _self.getDataChartData_left(paramsSelf,item);
  295. // _self.getDataChartData_right_top(paramsSelf,item);
  296. // _self.getDataChartData_right_bottom(paramsSelf,item);
  297. // },
  298. functiontofindIndexByKeyValue(arraytosearch, key, valuetosearch) {
  299. for (var i = 0; i < arraytosearch.length; i++) {
  300. if (arraytosearch[i][key] == valuetosearch) {
  301. return i;
  302. }
  303. }
  304. return null;
  305. },
  306. //柱图左侧
  307. getDataChartData_left(params, item) {
  308. var _self = this;
  309. if (params.years) {
  310. delete params['years']
  311. // params.years = params.years.join(',');
  312. }
  313. leftData(params).then((res) => {//正确的接口地址
  314. if (res.success) {
  315. res.data = res.data.sort(_self.sortFun('count'));
  316. res.data.forEach(ele => {
  317. _self.name_left.push(ele.name);
  318. _self.value_left.push(ele.count);
  319. });
  320. _self.barData_zy = {
  321. "name_left": _self.name_left,
  322. "value_left": _self.value_left,
  323. "pcNum": item
  324. };
  325. if (_self.barData.length != 0) {
  326. var index = _self.functiontofindIndexByKeyValue(_self.barData, "pcNum", _self.barData_zy.pcNum);
  327. if (index == null) {
  328. _self.barData.push(_self.barData_zy)
  329. } else {
  330. _self.mySeries = [];
  331. _self.barData[index] = _self.barData_zy;
  332. }
  333. } else {
  334. _self.barData.push(_self.barData_zy)
  335. }
  336. _self.init_left_barChart();
  337. }
  338. })
  339. },
  340. //柱图右侧——上
  341. getDataChartData_right_top(params, item) {
  342. var _self = this;
  343. if (params.years) {
  344. delete params['years']
  345. // params.years = params.years.join(',');
  346. }
  347. right_topData(params).then((res) => {//正确的接口地址
  348. if (res.success) {
  349. res.data.forEach(ele => {
  350. _self.name_right_top.push(ele.name);
  351. _self.value_right_top.push(ele.count);
  352. _self.nameShow.push(ele.showName)
  353. });
  354. _self.barData_zy_right_top = {
  355. "name_right_top": _self.name_right_top,
  356. "value_right_top": _self.value_right_top,
  357. "nameShow": _self.nameShow,
  358. "pcNum": item
  359. };
  360. if (_self.barData_right_top.length != 0) {
  361. var index = _self.functiontofindIndexByKeyValue(_self.barData_right_top, "pcNum", _self.barData_zy_right_top.pcNum);
  362. if (index == null) {
  363. _self.barData_right_top.push(_self.barData_zy_right_top)
  364. } else {
  365. _self.mySeries_right_top = [];
  366. _self.barData_right_top[index] = _self.barData_zy_right_top;
  367. }
  368. } else {
  369. _self.barData_right_top.push(_self.barData_zy_right_top)
  370. }
  371. _self.init_right_top_barChart();
  372. }
  373. })
  374. },
  375. //饼图右下
  376. getDataChartData_right_bottom(params, item) {
  377. var _self = this;
  378. var dataList = [];
  379. let paramsSelf = params;
  380. if (params.years) {
  381. delete paramsSelf['years']
  382. // params.years = params.years.join(',');
  383. }
  384. right_bottomData(paramsSelf).then((res) => {//正确的接口地址
  385. if (res.success) {
  386. _self.clearData();
  387. _self.pieData_zy = [];
  388. res.data.forEach(ele => {
  389. _self.barData_right_bottom.push({
  390. "value": ele.count,
  391. "name": ele.name
  392. });
  393. });
  394. _self.barData_zy_right_bottom = {
  395. "value_right_bottom_pieData": _self.barData_right_bottom,
  396. "pcNum": 1
  397. };
  398. // if(_self.pieData_zy.length != 0){
  399. // var index = _self.functiontofindIndexByKeyValue(_self.pieData_zy, "pcNum", _self.barData_zy_right_bottom.pcNum);
  400. // if(index == null){
  401. // _self.pieData_zy.push(_self.barData_zy_right_bottom)
  402. // }else{
  403. // _self.mySeries_right_bottom = [];
  404. // _self.pieData_zy[index] = _self.barData_zy_right_bottom;
  405. // }
  406. // }else{
  407. // _self.pieData_zy.push(_self.barData_zy_right_bottom)
  408. // }
  409. _self.pieData_zy.push(_self.barData_zy_right_bottom)
  410. }
  411. _self.init_right_bottom_pieChart();
  412. })
  413. },
  414. sortFun(property) {
  415. return function (a, b) {
  416. var value1 = a[property];
  417. var value2 = b[property];
  418. return value1 - value2;
  419. }
  420. },
  421. functiontofindIndexByKeyValue(arraytosearch, key, valuetosearch) {
  422. for (var i = 0; i < arraytosearch.length; i++) {
  423. if (arraytosearch[i][key] == valuetosearch) {
  424. return i;
  425. }
  426. }
  427. return null;
  428. },
  429. init_left_barChart: function () {
  430. var _self = this;
  431. this.chart = echarts.init(this.$refs['left_bar']);
  432. this.barData.forEach(ele => {
  433. let barNormal = {
  434. name: "问题数量" + ele.pcNum,
  435. type: "bar",
  436. barWidth: '20%',
  437. itemStyle: {
  438. normal: {
  439. color: "#5ce9c7"
  440. }
  441. },
  442. // data: [47,47,35,36,35,15,15]
  443. data: ele.value_left,
  444. }
  445. this.mySeries.push(barNormal);
  446. })
  447. let option = {
  448. toolbox: {
  449. show: true,
  450. orient: "vertical",
  451. left: "right",
  452. top: "top",
  453. feature: {
  454. saveAsImage: { show: true }, // 保存图表
  455. },
  456. },
  457. title: {
  458. text: "全专业各类问题发生频率",
  459. textStyle: {
  460. align: 'center',
  461. fontSize: 20,
  462. },
  463. top: '0%',
  464. },
  465. // backgroundColor: '#0f375f',
  466. grid: {
  467. top: "5%",
  468. bottom: "15%",
  469. left: "1%",
  470. right: "5%",
  471. containLabel: true
  472. },
  473. tooltip: {
  474. trigger: "axis",
  475. axisPointer: {
  476. type: "shadow",
  477. label: {
  478. show: false
  479. }
  480. }
  481. },
  482. legend: {
  483. data: ["个数"],
  484. top: "5%",
  485. textStyle: {
  486. // color: "#ffffff"
  487. }
  488. },
  489. xAxis: {
  490. type: "value",
  491. axisLine: {
  492. show: true //隐藏X轴轴线
  493. },
  494. axisTick: {
  495. show: true //隐藏X轴刻度
  496. },
  497. axisLabel: {
  498. rotate: 15,
  499. show: true,
  500. textStyle: {
  501. // color: "#ebf8ac" //X轴文字颜色
  502. }
  503. },
  504. axisLine: {
  505. lineStyle: {
  506. // color: '#01FCE3'
  507. }
  508. },
  509. },
  510. yAxis: [{
  511. data: _self.barData[0].name_left,
  512. type: 'category',
  513. name: "个",
  514. nameTextStyle: {
  515. // color: "#ebf8ac"
  516. },
  517. splitLine: {
  518. show: false
  519. },
  520. splitLine: {
  521. show: false
  522. },
  523. axisTick: {
  524. show: true
  525. },
  526. axisLine: {
  527. show: true
  528. },
  529. axisLabel: {
  530. show: false,
  531. textStyle: {
  532. // color: "#ebf8ac"
  533. }
  534. },
  535. },
  536. ],
  537. series: _self.mySeries,
  538. };
  539. this.chart.setOption(option);
  540. window.addEventListener("resize", () => {
  541. this.chart.resize();
  542. });
  543. },
  544. init_right_top_barChart: function () {
  545. var _self = this;
  546. this.chart_right_top = echarts.init(this.$refs['right_top_bar']);
  547. this.barData_right_top.forEach(ele => {
  548. let barNormal = {
  549. name: "问题数量" + ele.pcNum,
  550. type: "bar",
  551. barWidth: 25,
  552. itemStyle: {
  553. normal: {
  554. // color: ["#5ce9c7","#5085f2","#f59a8f","#fdb301","#8d7fec","#f2719a"]
  555. color: function (params) {
  556. let colorList = ["#5ce9c7", "#5085f2", "#f59a8f", "#fdb301", "#8d7fec", "#f2719a"];
  557. return colorList[params.dataIndex]
  558. }
  559. }
  560. },
  561. // data: [47,47,35,36,35,15,15]
  562. data: ele.value_right_top,
  563. }
  564. this.mySeries_right_top.push(barNormal);
  565. })
  566. let option = {
  567. toolbox: {
  568. show: true,
  569. orient: "vertical",
  570. left: "right",
  571. top: "top",
  572. feature: {
  573. saveAsImage: { show: true }, // 保存图表
  574. },
  575. },
  576. title: {
  577. text: "各专业高频问题",
  578. textStyle: {
  579. align: 'left',
  580. fontSize: 20,
  581. },
  582. top: '0%',
  583. left: '5%',
  584. },
  585. // backgroundColor: '#0f375f',
  586. grid: {
  587. top: "5%",
  588. bottom: "15%",
  589. left: "1%",
  590. right: "5%",
  591. containLabel: true
  592. },
  593. tooltip: {
  594. formatter: function (params, ticket, callback) {
  595. return params[0].value;
  596. },
  597. trigger: "axis",
  598. axisPointer: {
  599. type: "shadow",
  600. label: {
  601. show: true
  602. }
  603. }
  604. },
  605. legend: {
  606. data: ["个数"],
  607. top: "5%",
  608. textStyle: {
  609. // color: "#ffffff"
  610. }
  611. },
  612. xAxis: [
  613. {
  614. data: _self.barData_right_top[0].name_right_top,
  615. axisLine: {
  616. show: true //隐藏X轴轴线
  617. },
  618. axisTick: {
  619. show: true //隐藏X轴刻度
  620. },
  621. axisLabel: {
  622. rotate: 15,
  623. show: true,
  624. textStyle: {
  625. // color: "#ebf8ac" //X轴文字颜色
  626. }
  627. },
  628. axisLine: {
  629. lineStyle: {
  630. // color: '#01FCE3'
  631. }
  632. },
  633. },
  634. {
  635. data: _self.barData_right_top[0].nameShow,
  636. show: false,
  637. },
  638. ],
  639. yAxis: [{
  640. type: "value",
  641. name: "个",
  642. nameTextStyle: {
  643. // color: "#ebf8ac"
  644. },
  645. splitLine: {
  646. show: false
  647. },
  648. splitLine: {
  649. show: false
  650. },
  651. axisTick: {
  652. show: true
  653. },
  654. axisLine: {
  655. show: true
  656. },
  657. axisLabel: {
  658. show: true,
  659. textStyle: {
  660. // color: "#ebf8ac"
  661. }
  662. },
  663. },
  664. ],
  665. series: _self.mySeries_right_top,
  666. };
  667. this.chart_right_top.setOption(option);
  668. window.addEventListener("resize", () => {
  669. this.chart_right_top.resize();
  670. });
  671. this.chart_right_top.on('click', function (params) {
  672. _self.clearData();
  673. _self.chart_right_bottom.clear();
  674. _self.stbClaName = params.name;
  675. const piePa = {
  676. "stbClaName": params.name
  677. };
  678. _self.returnedTarget = Object.assign(piePa, _self.addForm);
  679. _self.getDataChartData_right_bottom(_self.returnedTarget, _self.selectNum);
  680. })
  681. },
  682. init_right_bottom_pieChart: function () {
  683. var _self = this;
  684. // this.mySeries_right_bottom = [];
  685. this.chart_right_bottom = echarts.init(this.$refs['right_bottom_pie']);
  686. this.pieData_zy.forEach(ele => {
  687. _self.radius_in = (ele.pcNum * 10 * 6) + '%'
  688. _self.radius_out = (ele.pcNum * 10 * 2 + 8) + '%'
  689. let pieData = {
  690. name: '严重程度分布情况',
  691. type: 'pie',
  692. // radius:'25%',
  693. radius: _self.radius_in,
  694. center: ['50%', '40%'],
  695. // hoverAnimation: false,
  696. color: ['#5ce9c7', '#fed172', '#fb6086'],
  697. labelLine: {
  698. normal: {
  699. show: true,
  700. position: 'outside',
  701. formatter: '{c}'
  702. }
  703. },
  704. label: {
  705. normal: {
  706. show: true,
  707. formatter: "{d}% ",
  708. textStyle: {
  709. fontSize: this.standSize / 150,
  710. },
  711. }
  712. },
  713. data: ele.value_right_bottom_pieData,
  714. }
  715. _self.mySeries_right_bottom.push(pieData);
  716. })
  717. let option = {
  718. toolbox: {
  719. show: true,
  720. orient: "vertical",
  721. left: "right",
  722. top: "top",
  723. feature: {
  724. saveAsImage: { show: true }, // 保存图表
  725. },
  726. },
  727. title: {
  728. text: _self.stbClaName + " 各类问题分布",
  729. textStyle: {
  730. align: 'left',
  731. fontSize: 20,
  732. },
  733. top: '3%',
  734. left: '5%',
  735. },
  736. grid: {
  737. top: "0%",
  738. bottom: "25%",
  739. left: "5%",
  740. right: "5%",
  741. },
  742. tooltip: {
  743. trigger: 'item',
  744. },
  745. series: _self.mySeries_right_bottom,
  746. };
  747. this.chart_right_bottom.setOption(option);
  748. window.addEventListener("resize", () => {
  749. this.chart_right_bottom.resize();
  750. });
  751. },
  752. //置空数据
  753. clearData() {
  754. this.name_left = [];
  755. this.value_left = [];
  756. this.nameShow = [];
  757. this.name_right_top = [];
  758. this.value_right_top = [];
  759. this.mySeries = [];
  760. this.mySeries_right_top = [];
  761. this.mySeries_right_bottom = [];
  762. this.barData_right_bottom = [];
  763. // this.pieData_zy = [];
  764. // this.barData = [];
  765. // this.barData_right_top = [];
  766. // this.barData_right_bottom = [];
  767. },
  768. clearAllData() {
  769. this.barData_zy = {};
  770. this.barData_zy_right_top = {};
  771. this.barData_zy_right_bottom = {};
  772. this.name_left = [];
  773. this.value_left = [];
  774. this.nameShow = [];
  775. this.name_right_top = [];
  776. this.value_right_top = [];
  777. this.mySeries = [];
  778. this.mySeries_right_top = [];
  779. this.mySeries_right_bottom = [];
  780. this.pieData_zy = [];
  781. this.chart = {};
  782. this.chart_right_top = {};
  783. this.chart_right_bottom = {};
  784. this.barData = [];
  785. this.barData_right_top = [];
  786. this.barData_right_bottom = [];
  787. },
  788. searchTypeChangeEvent() {
  789. // alert(this.useObjFlagRadio);
  790. this.$emit("changeType", "single_fspd")
  791. this.addForm["useObjFlag"] = this.useObjFlagRadio;
  792. this.clearAllData();
  793. this.getDataChartData_left(this.addForm, this.selectNum)
  794. this.getDataChartData_right_top(this.addForm, this.selectNum)
  795. this.getDataChartData_right_bottom(this.returnedTarget, this.selectNum)
  796. },
  797. paramsConfigEvent() {
  798. const piePa = {
  799. "stbClaName": this.stbClaName
  800. };
  801. this.returnedTarget = Object.assign(piePa, this.addForm);
  802. }
  803. },
  804. //生命周期 - 创建完成(可以访问当前this实例)
  805. created() {
  806. },
  807. //生命周期 - 挂载完成(可以访问DOM元素)
  808. mounted() {
  809. // this.getDataChartReslove(this.addForm,this.selectNum)
  810. this.paramsConfigEvent();
  811. this.getDataChartData_left(this.addForm, this.selectNum)
  812. this.getDataChartData_right_top(this.addForm, this.selectNum)
  813. this.getDataChartData_right_bottom(this.returnedTarget, this.selectNum)
  814. },
  815. beforeCreate() {
  816. }, //生命周期 - 创建之前
  817. beforeMount() {
  818. }, //生命周期 - 挂载之前
  819. beforeUpdate() {
  820. }, //生命周期 - 更新之前
  821. updated() {
  822. }, //生命周期 - 更新之后
  823. beforeDestroy() {
  824. }, //生命周期 - 销毁之前
  825. destroyed() {
  826. }, //生命周期 - 销毁完成
  827. activated() {
  828. }, //如果页面有keep-alive缓存功能,这个函数会触发
  829. }
  830. </script>
  831. <style scoped>
  832. </style>