index.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
  1. <!--风险统计-->
  2. <template>
  3. <div class="plan_log scrollbar-box">
  4. <div class="top-max-big-box">
  5. <div class="top-left-box">
  6. <p class="top-max-big-title color_one">风险统计</p>
  7. <div id="left-eCharts" v-if="eChartsTypeOne">
  8. </div>
  9. <img v-if="!eChartsTypeOne" src="@/assets/ZDimages/null-data.png">
  10. <p v-if="!eChartsTypeOne" class="null-p">暂无数据</p>
  11. </div>
  12. <div class="top-right-box">
  13. <div class="top-right-top-box">
  14. <p class="top-max-big-title color_one">风险类型占比</p>
  15. <div id="right-top-eCharts" v-if="eChartsTypeTwo"></div>
  16. <div class="title-button-box">
  17. <p :class="rightTopType==0?'selected-p':(rightTopType==1?'left-p':'left-p-one')" @click="rightTopClick('0')">近半年</p>
  18. <p :class="rightTopType==1?'selected-p':'center-p'" @click="rightTopClick('1')">近一年</p>
  19. <p :class="rightTopType==2?'selected-p':(rightTopType==0?'right-p-one':'right-p')" @click="rightTopClick('2')">近三年</p>
  20. </div>
  21. <img v-if="!eChartsTypeTwo" src="@/assets/ZDimages/null-data.png">
  22. <p v-if="!eChartsTypeTwo" class="null-p">暂无数据</p>
  23. </div>
  24. <div class="top-right-bottom-box">
  25. <p class="top-max-big-title color_one">学院风险数</p>
  26. <div id="right-bottom-eCharts" v-if="eChartsTypeThree"></div>
  27. <div class="title-button-box">
  28. <p :class="rightBottomType==0?'selected-p':(rightBottomType==1?'left-p':'left-p-one')" @click="rightBottomClick('0')">近半年</p>
  29. <p :class="rightBottomType==1?'selected-p':'center-p'" @click="rightBottomClick('1')">近一年</p>
  30. <p :class="rightBottomType==2?'selected-p':(rightBottomType==0?'right-p-one':'right-p')" @click="rightBottomClick('2')">近三年</p>
  31. </div>
  32. <img v-if="!eChartsTypeThree" src="@/assets/ZDimages/null-data.png">
  33. <p v-if="!eChartsTypeThree" class="null-p">暂无数据</p>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="bottom-max-big-box">
  38. <el-form :model="queryParams" ref="queryParams" :inline="true" v-show="showSearch">
  39. <el-form-item label="学院" prop="deptId">
  40. <el-select v-model="queryParams.deptId" placeholder="请选择学院" @change="getSubjectDictList">
  41. <el-option
  42. v-for="dict in deptOptions"
  43. :key="dict.deptId"
  44. :label="dict.deptName"
  45. :value="dict.deptId"
  46. ></el-option>
  47. </el-select>
  48. <!-- <treeselect style="width:190px;" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/>-->
  49. </el-form-item>
  50. <el-form-item label="实验室" prop="subjectId">
  51. <el-select v-model="queryParams.subjectId" placeholder="请选择实验室" clearable size="small">
  52. <el-option
  53. v-for="item in subjectOptions"
  54. :key="item.id"
  55. :label="item.name"
  56. :value="item.id">
  57. </el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="发生风险时间">
  61. <el-date-picker
  62. :clearable="false"
  63. v-model="dateRange"
  64. size="small"
  65. style="width: 240px"
  66. value-format="yyyy-MM-dd"
  67. type="daterange"
  68. range-separator="-"
  69. start-placeholder="开始日期"
  70. end-placeholder="结束日期"
  71. ></el-date-picker>
  72. </el-form-item>
  73. <el-form-item>
  74. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  75. <p class="reset-button-one" @click="resetQuery">重置</p>
  76. </el-form-item>
  77. </el-form>
  78. <el-table v-loading="loading" border :data="logList" @selection-change="handleSelectionChange">
  79. <el-table-column label="风险" align="left" prop="riskPlanName" />
  80. <el-table-column label="实验室名称" align="left" prop="subjectName" />
  81. <el-table-column label="学院" align="left" prop="deptName" />
  82. <el-table-column label="风险详情" align="left" prop="remark" />
  83. <el-table-column label="发生风险时间" align="left" prop="createTime" />
  84. </el-table>
  85. <pagination :page-sizes="[20, 30, 40, 50]"
  86. v-show="total>0"
  87. :total="total"
  88. layout="total, prev, pager, next, sizes, jumper"
  89. :page.sync="queryParams.pageNum"
  90. :limit.sync="queryParams.pageSize"
  91. @pagination="getList"
  92. />
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import { listLog, getLog, delLog, addLog, updateLog, lineChart, happenChart, statisticsChartDept } from "@/api/laboratory/plan_log";
  98. import { subjectDictList } from "@/api/laboratory/record";
  99. import echarts from 'echarts'
  100. import { listDepartments, treeselect } from '@/api/system/dept'
  101. import Treeselect from "@riophae/vue-treeselect";
  102. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  103. export default {
  104. name: "Log",
  105. components: { Treeselect },
  106. data() {
  107. return {
  108. // 遮罩层
  109. loading: true,
  110. // 选中数组
  111. ids: [],
  112. // 非单个禁用
  113. single: true,
  114. // 非多个禁用
  115. multiple: true,
  116. // 显示搜索条件
  117. showSearch: true,
  118. // 总条数
  119. total: 0,
  120. // 风险异常日志表格数据
  121. logList: [],
  122. // 弹出层标题
  123. title: "",
  124. // 是否显示弹出层
  125. open: false,
  126. //选择时间
  127. dateRange:[],
  128. // 部门树选项
  129. deptOptions: [],
  130. // 查询参数
  131. queryParams: {
  132. pageNum: 1,
  133. pageSize:20,
  134. riskPlanId: null,
  135. riskPlanName: null,
  136. subjectId: null,
  137. deptId: null,
  138. deptName: null,
  139. userId: null,
  140. startDate: null,
  141. endDate: null
  142. },
  143. // 表单参数
  144. form: {},
  145. // 表单校验
  146. rules: {
  147. },
  148. //右上echarts选中状态
  149. rightTopType:0,
  150. //右下echarts选中状态
  151. rightBottomType:0,
  152. lineCharts: null,
  153. eChartsTypeOne:true,
  154. happenCharts: null,
  155. eChartsTypeTwo:true,
  156. statisticsChartDepts: null,
  157. eChartsTypeThree:true,
  158. // 实验室下拉框
  159. subjectOptions: [],
  160. option : {
  161. backgroundColor: 'transparent',
  162. grid: {
  163. left: '5%',
  164. right: '5%',
  165. top: '20%',
  166. bottom: '20%',
  167. containLabel: true,
  168. },
  169. tooltip: {
  170. trigger: 'axis',
  171. },
  172. xAxis: [
  173. {
  174. type: 'category',
  175. boundaryGap: false,
  176. axisLabel: {
  177. color: '#333333', //字体颜色
  178. },
  179. axisLine: {
  180. show: true,
  181. lineStyle: {
  182. color: '#E0E0E0', //底线颜色
  183. width: 1,
  184. },
  185. },
  186. axisTick: {
  187. show: false,
  188. },
  189. splitLine: {
  190. show: false,
  191. lineStyle: {
  192. color: '#195384',
  193. },
  194. },
  195. data: [],
  196. },
  197. ],
  198. yAxis: [
  199. {
  200. type: 'value',
  201. nameTextStyle: {
  202. color: '#65aaf1',
  203. fontStyle: 'normal',
  204. },
  205. axisLabel: {
  206. formatter: '{value}',
  207. textStyle: {
  208. color: '#333333', //字体颜色
  209. },
  210. },
  211. axisTick: {
  212. show: false,
  213. },
  214. axisLine: {
  215. show: true,
  216. lineStyle: {
  217. color: '#E0E0E0', //底线颜色
  218. width: 1,
  219. },
  220. },
  221. splitLine: {
  222. show: true,
  223. lineStyle: {
  224. color: '#E0E0E0',
  225. width: 1,
  226. type: 'dashed',
  227. },
  228. },
  229. },
  230. ],
  231. // 缩放组件
  232. dataZoom: {
  233. type: 'slider',
  234. start: 0,
  235. end: 50, //缩放组件显示70%的位置
  236. minSpan :0,
  237. maxSpan:50,
  238. backgroundColor: '#999',//组件背景颜色
  239. dataBackground: {
  240. lineStyle: {
  241. color: '#0183FA',
  242. opacity: '1',
  243. },
  244. areaStyle: {
  245. color: '#0183FA',
  246. opacity: '1',
  247. },
  248. },
  249. selectedDataBackground: {
  250. lineStyle: {
  251. color: '#0183FA',
  252. opacity: '1',
  253. },
  254. areaStyle: {
  255. color: '#0183FA',
  256. opacity: '1',
  257. },
  258. },
  259. fillerColor: 'rgba(0,0,0,0)',//滚动框冲田颜色
  260. // borderColor: '#0183FA',//滚动框边框颜色
  261. // handleIcon:'image://https://img-qn-1.51miz.com/Element/00/78/74/76/d87f9e3f_E787476_14131ebe.png!/quality/90/unsharp/true/compress/true/format/png/fh/320',//手柄样式
  262. moveHandleSize: 14,
  263. textStyle:{//文字样式
  264. color:'#fff',
  265. lineHeight:'34',
  266. fontStyle:'oblique',
  267. fontSize:'16'
  268. },
  269. },
  270. series: [
  271. {
  272. name: '',
  273. type: 'line',
  274. stack: '总量',
  275. symbol: 'circle',
  276. showSymbol: false,
  277. symbolSize: 8,
  278. itemStyle: {
  279. normal: {
  280. color: '#0092f6',
  281. lineStyle: {
  282. color: '#0092f6',
  283. width: 1,
  284. },
  285. areaStyle: {
  286. //color: '#94C9EC'
  287. color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
  288. {
  289. offset: 0.4,
  290. color: 'rgba(0,146,246,0.1)',
  291. },
  292. {
  293. offset: 1,
  294. color: 'rgba(0,146,246,1)',
  295. },
  296. ]),
  297. },
  298. },
  299. },
  300. markPoint: {
  301. itemStyle: {
  302. normal: {
  303. color: 'red',
  304. },
  305. },
  306. },
  307. data: [],
  308. },
  309. ],
  310. },
  311. };
  312. },
  313. created() {
  314. this.getList();
  315. //this.getTreeselect();
  316. this.getDeptList();
  317. // this.getSubjectDictList();
  318. this.lineChart();
  319. this.happenChart();
  320. this.statisticsChartDept()
  321. },
  322. mounted(){
  323. },
  324. methods: {
  325. /** 查询实验室字典列表 */
  326. getSubjectDictList () {
  327. subjectDictList({deptId: this.queryParams.deptId}).then(response => {
  328. this.subjectOptions = response.data;
  329. });
  330. },
  331. /** 查询部门下拉树结构 */
  332. /*getTreeselect() {
  333. treeselect().then(response => {
  334. this.deptOptions = response.data;
  335. });
  336. },*/
  337. /** 查询学院列表 */
  338. getDeptList() {
  339. listDepartments().then(response => {
  340. this.deptOptions = response.data;
  341. });
  342. },
  343. //右上eCharts标签点击时间
  344. rightTopClick(type){
  345. let self = this;
  346. if(this.rightTopType != type){
  347. this.rightTopType = type;
  348. if(this.happenCharts[type][0]){
  349. setTimeout(function(){
  350. self.eChartsTypeTwo = true;
  351. self.eChartsTwo();
  352. },200);
  353. }else{
  354. // 无数据
  355. this.eChartsTypeTwo = false;
  356. }
  357. }
  358. },
  359. //
  360. rightBottomClick(type){
  361. let self = this;
  362. if(this.rightBottomType != type){
  363. this.rightBottomType = type;
  364. if(this.statisticsChartDepts[type].data[0]){
  365. setTimeout(function(){
  366. self.eChartsTypeThree = true;
  367. self.eChartsThree();
  368. },200);
  369. }else{
  370. // 无数据
  371. this.eChartsTypeThree = false;
  372. }
  373. }
  374. },
  375. /** 查询风险异常日志列表 */
  376. getList() {
  377. this.loading = true;
  378. listLog(this.queryParams).then(response => {
  379. this.logList = response.rows;
  380. this.total = response.total;
  381. this.loading = false;
  382. });
  383. },
  384. // 取消按钮
  385. cancel() {
  386. this.open = false;
  387. this.reset();
  388. },
  389. // 表单重置
  390. reset() {
  391. this.form = {
  392. id: null,
  393. riskPlanId: null,
  394. riskPlanName: null,
  395. subjectId: null,
  396. deptId: null,
  397. deptName: null,
  398. remark: null,
  399. createTime: null,
  400. userId: null,
  401. createBy: null,
  402. updateTime: null,
  403. updateBy: null
  404. };
  405. this.resetForm("form");
  406. },
  407. /** 搜索按钮操作 */
  408. handleQuery() {
  409. this.queryParams.pageNum = 1;
  410. if(this.dateRange[0]){
  411. this.queryParams.startDate = this.dateRange[0]
  412. this.queryParams.endDate = this.dateRange[1]
  413. }else {
  414. this.queryParams.startDate = null
  415. this.queryParams.endDate = null
  416. }
  417. this.getList();
  418. },
  419. /** 重置按钮操作 */
  420. resetQuery() {
  421. this.resetForm("queryParams");
  422. this.dateRange = []
  423. this.queryParams.startDate = null
  424. this.queryParams.endDate = null
  425. this.handleQuery();
  426. },
  427. // 多选框选中数据
  428. handleSelectionChange(selection) {
  429. this.ids = selection.map(item => item.id)
  430. this.single = selection.length!==1
  431. this.multiple = !selection.length
  432. },
  433. /** 新增按钮操作 */
  434. handleAdd() {
  435. this.reset();
  436. this.open = true;
  437. this.title = "添加风险异常日志";
  438. },
  439. /** 修改按钮操作 */
  440. handleUpdate(row) {
  441. this.reset();
  442. const id = row.id || this.ids
  443. getLog(id).then(response => {
  444. this.form = response.data;
  445. this.open = true;
  446. this.title = "修改风险异常日志";
  447. });
  448. },
  449. /** 提交按钮 */
  450. submitForm() {
  451. this.$refs["form"].validate(valid => {
  452. if (valid) {
  453. if (this.form.id != null) {
  454. updateLog(this.form).then(response => {
  455. this.msgSuccess("修改成功");
  456. this.open = false;
  457. this.getList();
  458. });
  459. } else {
  460. addLog(this.form).then(response => {
  461. this.msgSuccess("新增成功");
  462. this.open = false;
  463. this.getList();
  464. });
  465. }
  466. }
  467. });
  468. },
  469. /** 风险发生数折线统计图 */
  470. lineChart(){
  471. let self = this;
  472. // TODO 时间
  473. lineChart({}).then(response => {
  474. if(response.data.xAxis) {
  475. if(this.option.xAxis.length==1){
  476. response.data.xAxis.data.unshift("");
  477. response.data.series[0].data.unshift(0)
  478. this.option.xAxis[0].data=response.data.xAxis.data
  479. this.option.series[0].data=response.data.series[0].data
  480. setTimeout(function(){
  481. self.eChartsOne();
  482. },500);
  483. }else{
  484. this.option.xAxis[0].data=response.data.xAxis.data
  485. this.option.series[0].data=response.data.series[0].data
  486. setTimeout(function(){
  487. self.eChartsOne();
  488. },500);
  489. }
  490. }else{
  491. // 无数据处理
  492. this.eChartsTypeOne = false;
  493. }
  494. });
  495. },
  496. /** 风险发生占比图 */
  497. happenChart(){
  498. let self = this;
  499. happenChart({}).then(response => {
  500. let list = [
  501. [],
  502. [],
  503. [],
  504. ];
  505. if(response.data.halfList[0]){
  506. for(let i=0;i<response.data.halfList.length;i++){
  507. let obj = {
  508. name:response.data.halfList[i].riskPlanName,
  509. value:response.data.halfList[i].count,
  510. };
  511. list[0].push(obj);
  512. }
  513. }
  514. if(response.data.nearlyList[0]){
  515. for(let i=0;i<response.data.nearlyList.length;i++){
  516. let obj = {
  517. name:response.data.nearlyList[i].riskPlanName,
  518. value:response.data.nearlyList[i].count,
  519. };
  520. list[1].push(obj);
  521. }
  522. }
  523. if(response.data.threeList[0]){
  524. for(let i=0;i<response.data.threeList.length;i++){
  525. let obj = {
  526. name:response.data.threeList[i].riskPlanName,
  527. value:response.data.threeList[i].count,
  528. };
  529. list[2].push(obj);
  530. }
  531. }
  532. this.happenCharts = [...list];
  533. if(this.happenCharts[0][0]||this.happenCharts[1][0]||this.happenCharts[2][0]){
  534. if(this.happenCharts[0][0]){
  535. this.eChartsTypeTwo = true;
  536. setTimeout(function(){
  537. self.eChartsTwo();
  538. },500);
  539. }else{
  540. this.eChartsTypeTwo = false;
  541. }
  542. }else{
  543. // 无数据
  544. this.eChartsTypeTwo = false;
  545. }
  546. });
  547. },
  548. /** 学院风险统计图 */
  549. statisticsChartDept(){
  550. let self = this;
  551. statisticsChartDept({}).then(response => {
  552. let list = [
  553. {
  554. data:[],
  555. title:[]
  556. },
  557. {
  558. data:[],
  559. title:[]
  560. },
  561. {
  562. data:[],
  563. title:[]
  564. }
  565. ];
  566. if(response.data.halfList[0]){
  567. for(let i=0;i<response.data.halfList.length;i++){
  568. list[0].title.push(response.data.halfList[i].deptName);
  569. list[0].data.push(response.data.halfList[i].count);
  570. }
  571. }
  572. if(response.data.nearlyList[0]){
  573. for(let i=0;i<response.data.nearlyList.length;i++){
  574. list[1].title.push(response.data.nearlyList[i].deptName);
  575. list[1].data.push(response.data.nearlyList[i].count);
  576. }
  577. }
  578. if(response.data.threeList[0]){
  579. for(let i=0;i<response.data.threeList.length;i++){
  580. list[2].title.push(response.data.threeList[i].deptName);
  581. list[2].data.push(response.data.threeList[i].count);
  582. }
  583. }
  584. this.statisticsChartDepts = list;
  585. if(this.statisticsChartDepts[0].data[0]||this.statisticsChartDepts[1].data[0]||this.statisticsChartDepts[2].data[0]){
  586. if(this.statisticsChartDepts[0].data[0]){
  587. this.eChartsTypeThree = true;
  588. setTimeout(function(){
  589. self.eChartsThree();
  590. },500);
  591. }else{
  592. this.eChartsTypeThree = false;
  593. }
  594. }else{
  595. // 无数据
  596. this.eChartsTypeThree = false;
  597. }
  598. });
  599. },
  600. /** 删除按钮操作 */
  601. handleDelete(row) {
  602. const ids = row.id || this.ids;
  603. this.$confirm('是否确认删除风险异常日志?', "警告", {
  604. confirmButtonText: "确定",
  605. cancelButtonText: "取消",
  606. type: "warning"
  607. }).then(function() {
  608. return delLog(ids);
  609. }).then(() => {
  610. this.getList();
  611. this.msgSuccess("删除成功");
  612. }).catch(() => {});
  613. },
  614. /** 导出按钮操作 */
  615. handleExport() {
  616. this.download('laboratory/log/export', {
  617. ...this.queryParams
  618. }, `laboratory_log.xlsx`)
  619. },
  620. //eCharts方法
  621. eChartsOne(){
  622. let self = this;
  623. let myChart = this.$echarts.init(document.getElementById('left-eCharts'));
  624. myChart.setOption(self.option);
  625. },
  626. //eCharts方法
  627. eChartsTwo(){
  628. let self = this;
  629. let myChart = this.$echarts.init(document.getElementById('right-top-eCharts'));
  630. let title = '风险数';
  631. let color = ['#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'];
  632. let echartData = self.happenCharts[self.rightTopType];
  633. let formatNumber = function(num) {
  634. let reg = /(?=(\B)(\d{3})+$)/g;
  635. return num.toString().replace(reg, ',');
  636. }
  637. let total = echartData.reduce((a, b) => {
  638. return a + b.value * 1
  639. }, 0);
  640. let option = {
  641. color: color,
  642. tooltip: {
  643. trigger: 'item'
  644. },
  645. title: [{
  646. text: '{name|' + title + '}\n{val|' + formatNumber(total) + '}',
  647. top: '138',
  648. left:'128',
  649. textStyle: {
  650. rich: {
  651. name: {
  652. fontSize: 18,
  653. fontWeight: 'normal',
  654. color: '#666666',
  655. align :'center',
  656. padding: [10, 0]
  657. },
  658. val: {
  659. fontSize: 18,
  660. fontWeight: 'bold',
  661. color: '#333333',
  662. align :'center',
  663. }
  664. }
  665. }
  666. }],
  667. legend: {
  668. type: 'scroll',
  669. orient: 'vertical',
  670. right: '15%',
  671. top: '70',
  672. itemGap: 40,
  673. selectedMode: true,
  674. icon: 'rect',
  675. textStyle: {
  676. rich: {
  677. a: {
  678. color: '#000',
  679. width: 30
  680. },
  681. b0: {
  682. color: '#999',
  683. fontSize: 14,
  684. padding: [0, 10, 0, 80]
  685. },
  686. b1: {
  687. color: '#999',
  688. fontSize: 14,
  689. padding: [0, 10, 0, 80]
  690. },
  691. b2: {
  692. color: '#999',
  693. fontSize: 14,
  694. padding: [0, 10, 0, 80]
  695. },
  696. b3: {
  697. color: '#999',
  698. fontSize: 14,
  699. padding: [0, 10, 0, 80]
  700. },
  701. c0:{
  702. color: '#999',
  703. fontSize: 14,
  704. padding: [0, 10, 0, 10]
  705. },
  706. c1:{
  707. color: '#999',
  708. fontSize: 14,
  709. padding: [0, 10, 0, 10]
  710. },
  711. c2:{
  712. color: '#999',
  713. fontSize: 14,
  714. padding: [0, 10, 0, 10]
  715. },
  716. c3:{
  717. color: '#999',
  718. fontSize: 14,
  719. padding: [0, 10, 0, 10]
  720. }
  721. }
  722. },
  723. formatter: function(name) {
  724. let title = ''
  725. let total = echartData.reduce((a, b) => {
  726. return a + b.value * 1
  727. }, 0);
  728. var target;
  729. var index;
  730. var percentage;
  731. for (var i = 0, l = echartData.length; i < l; i++) {
  732. if (echartData[i].name == name) {
  733. target = echartData[i].value;
  734. title = echartData[i].label;
  735. percentage = ((echartData[i].value / total) * 100).toFixed(0);
  736. index = i < 6 ? i : 5;
  737. }
  738. }
  739. return `{a| ${name}}`+`{b${index}| ${percentage}%}`+`{a| 次数}`+`{c${index}| ${target}}`
  740. }
  741. },
  742. series: [{
  743. type: 'pie',
  744. radius: ['45%', '60%'],
  745. center: ['160', '170'],
  746. data: echartData,
  747. hoverAnimation: true,
  748. itemStyle: {
  749. normal: {
  750. borderWidth: 0
  751. }
  752. },
  753. labelLine: {
  754. show:false,
  755. },
  756. label: {
  757. normal: {
  758. show:false,
  759. }
  760. },
  761. }]
  762. };
  763. myChart.on('legendselectchanged', (e) => {
  764. total=0;
  765. //循环取value值
  766. echartData.forEach(function(item) {
  767. //根据选中状态总和计算total
  768. for(let i in e.selected){
  769. if(e.selected[i]==true){
  770. if(item.name==i){
  771. total+=item.value
  772. }
  773. }
  774. }
  775. //重新渲染title
  776. myChart.setOption({
  777. title: [{
  778. text: '{name|' + title + '}\n{val|' + formatNumber(total) + '}',
  779. }],
  780. })
  781. })
  782. })
  783. myChart.setOption(option);
  784. },
  785. //eCharts方法
  786. eChartsThree(){
  787. let self = this;
  788. let myChart = this.$echarts.init(document.getElementById('right-bottom-eCharts'));
  789. let data = self.statisticsChartDepts[self.rightBottomType].data;
  790. let title = self.statisticsChartDepts[self.rightBottomType].title;
  791. let option = {
  792. color: ['#3398DB'],
  793. tooltip: {
  794. trigger: 'axis',
  795. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  796. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  797. }
  798. },
  799. grid: {
  800. left: '3%',
  801. right: '4%',
  802. bottom: '3%',
  803. containLabel: true
  804. },
  805. xAxis: [
  806. {
  807. type: 'category',
  808. axisLabel: {
  809. color: '#333333', //字体颜色
  810. },
  811. axisLine: {
  812. show: true,
  813. lineStyle: {
  814. color: '#E0E0E0', //底线颜色
  815. width: 1,
  816. },
  817. },
  818. data: title,
  819. axisTick: {
  820. alignWithLabel: true
  821. }
  822. }
  823. ],
  824. yAxis: [
  825. {
  826. type: 'value',
  827. axisLabel: {
  828. formatter: '{value}',
  829. textStyle: {
  830. color: '#333333', //字体颜色
  831. },
  832. },
  833. axisLine: {
  834. show: true,
  835. lineStyle: {
  836. color: '#E0E0E0', //底线颜色
  837. width: 1,
  838. },
  839. },
  840. splitLine: {
  841. show: true,
  842. lineStyle: {
  843. color: '#E0E0E0',
  844. width: 1,
  845. type: 'dashed',
  846. },
  847. },
  848. }
  849. ],
  850. series: [
  851. {
  852. name: '风险发生数',
  853. type: 'bar',
  854. barWidth: '15',
  855. itemStyle:{
  856. color:'#0183FA',
  857. },
  858. data: data
  859. }
  860. ]
  861. };
  862. myChart.setOption(option);
  863. },
  864. }
  865. };
  866. </script>
  867. <style lang="scss" scoped>
  868. .plan_log {
  869. flex:1;
  870. display: flex!important;
  871. flex-direction: column;
  872. overflow-y: scroll;
  873. p{
  874. margin:0;
  875. }
  876. .top-max-big-box{
  877. height: 499px;
  878. /*margin:11px 20px 20px;*/
  879. margin:11px 10px 20px;
  880. display: flex;
  881. .top-max-big-title{
  882. position: absolute;
  883. left:20px;
  884. top:20px;
  885. line-height: 16px;
  886. font-size: 16px;
  887. }
  888. .top-left-box{
  889. /*width:807px;*/
  890. flex:1;
  891. height:499px;
  892. border-radius:10px;
  893. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  894. margin-right:20px;
  895. position: relative;
  896. overflow: hidden;
  897. padding-bottom:20px;
  898. #left-eCharts{
  899. height:100%;
  900. width:100%;
  901. }
  902. img{
  903. position: absolute;
  904. top:50%;
  905. left:50%;
  906. width:276px;
  907. height:274px;
  908. margin-top:-180px;
  909. margin-left:-100px;
  910. }
  911. .null-p{
  912. text-align: center;
  913. color:#999;
  914. margin-top:360px;
  915. }
  916. }
  917. .top-right-box{
  918. .top-right-top-box{
  919. overflow: hidden;
  920. border-radius:10px;
  921. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  922. width:754px;
  923. height:291px;
  924. margin-bottom:20px;
  925. position: relative;
  926. #right-top-eCharts{
  927. height:100%;
  928. width:100%;
  929. }
  930. img{
  931. position: absolute;
  932. top:50%;
  933. left:50%;
  934. width:140px;
  935. height:140px;
  936. margin-top:-70px;
  937. margin-left:-52px;
  938. }
  939. .null-p{
  940. text-align: center;
  941. color:#999;
  942. margin-top:230px;
  943. }
  944. .title-button-box{
  945. display: flex;
  946. position: absolute;
  947. left:160px;
  948. top:13px;
  949. p{
  950. width:80px;
  951. line-height:30px;
  952. font-size:14px;
  953. text-align: center;
  954. color:#999;
  955. cursor:pointer;
  956. }
  957. p:nth-child(1){
  958. border-top-left-radius: 4px;
  959. border-bottom-left-radius: 4px;
  960. }
  961. p:nth-child(3){
  962. border-top-right-radius: 4px;
  963. border-bottom-right-radius: 4px;
  964. }
  965. .selected-p{
  966. border:1px solid #0183FA;
  967. color:#0183FA;
  968. }
  969. .left-p{
  970. border-top:1px solid #999;
  971. border-bottom:1px solid #999;
  972. border-left:1px solid #999;
  973. border-right:1px solid rgba(255,255,255,0);
  974. color:#999;
  975. }
  976. .left-p-one{
  977. border:1px solid #999;
  978. color:#999;
  979. }
  980. .center-p{
  981. border-top:1px solid #999;
  982. border-bottom:1px solid #999;
  983. color:#999;
  984. }
  985. .right-p{
  986. border-top:1px solid #999;
  987. border-bottom:1px solid #999;
  988. border-right:1px solid #999;
  989. border-left:1px solid rgba(255,255,255,0);
  990. color:#999;
  991. }
  992. .right-p-one{
  993. border:1px solid #999;
  994. color:#999;
  995. }
  996. }
  997. }
  998. .top-right-bottom-box{
  999. overflow: hidden;
  1000. border-radius:10px;
  1001. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  1002. width:754px;
  1003. height:188px;
  1004. position: relative;
  1005. #right-bottom-eCharts{
  1006. height:100%;
  1007. width:100%;
  1008. }
  1009. img{
  1010. position: absolute;
  1011. top:50%;
  1012. left:50%;
  1013. width:100px;
  1014. height:100px;
  1015. margin-top:-50px;
  1016. margin-left:-36px;
  1017. }
  1018. .null-p{
  1019. text-align: center;
  1020. color:#999;
  1021. margin-top:150px;
  1022. }
  1023. .title-button-box{
  1024. display: flex;
  1025. position: absolute;
  1026. left:160px;
  1027. top:13px;
  1028. p{
  1029. width:80px;
  1030. line-height:30px;
  1031. font-size:14px;
  1032. text-align: center;
  1033. color:#999;
  1034. cursor:pointer;
  1035. }
  1036. p:nth-child(1){
  1037. border-top-left-radius: 4px;
  1038. border-bottom-left-radius: 4px;
  1039. }
  1040. p:nth-child(3){
  1041. border-top-right-radius: 4px;
  1042. border-bottom-right-radius: 4px;
  1043. }
  1044. .selected-p{
  1045. border:1px solid #0183FA;
  1046. color:#0183FA;
  1047. }
  1048. .left-p{
  1049. border-top:1px solid #999;
  1050. border-bottom:1px solid #999;
  1051. border-left:1px solid #999;
  1052. border-right:1px solid rgba(255,255,255,0);
  1053. color:#999;
  1054. }
  1055. .left-p-one{
  1056. border:1px solid #999;
  1057. color:#999;
  1058. }
  1059. .center-p{
  1060. border-top:1px solid #999;
  1061. border-bottom:1px solid #999;
  1062. color:#999;
  1063. }
  1064. .right-p{
  1065. border-top:1px solid #999;
  1066. border-bottom:1px solid #999;
  1067. border-right:1px solid #999;
  1068. border-left:1px solid rgba(255,255,255,0);
  1069. color:#999;
  1070. }
  1071. .right-p-one{
  1072. border:1px solid #999;
  1073. color:#999;
  1074. }
  1075. }
  1076. }
  1077. }
  1078. }
  1079. .bottom-max-big-box{
  1080. border-radius:10px;
  1081. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  1082. /*margin:0 20px 20px;*/
  1083. margin:0 10px 20px;
  1084. padding:20px 20px 20px!important;
  1085. display: flex;
  1086. flex:1;
  1087. flex-direction: column;
  1088. /*overflow: hidden;*/
  1089. }
  1090. }
  1091. </style>