index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  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. console.log(this.queryParams)
  418. this.getList();
  419. },
  420. /** 重置按钮操作 */
  421. resetQuery() {
  422. this.resetForm("queryParams");
  423. this.dateRange = []
  424. this.queryParams.startDate = null
  425. this.queryParams.endDate = null
  426. this.handleQuery();
  427. },
  428. // 多选框选中数据
  429. handleSelectionChange(selection) {
  430. this.ids = selection.map(item => item.id)
  431. this.single = selection.length!==1
  432. this.multiple = !selection.length
  433. },
  434. /** 新增按钮操作 */
  435. handleAdd() {
  436. this.reset();
  437. this.open = true;
  438. this.title = "添加风险异常日志";
  439. },
  440. /** 修改按钮操作 */
  441. handleUpdate(row) {
  442. this.reset();
  443. const id = row.id || this.ids
  444. getLog(id).then(response => {
  445. this.form = response.data;
  446. this.open = true;
  447. this.title = "修改风险异常日志";
  448. });
  449. },
  450. /** 提交按钮 */
  451. submitForm() {
  452. this.$refs["form"].validate(valid => {
  453. if (valid) {
  454. if (this.form.id != null) {
  455. updateLog(this.form).then(response => {
  456. this.msgSuccess("修改成功");
  457. this.open = false;
  458. this.getList();
  459. });
  460. } else {
  461. addLog(this.form).then(response => {
  462. this.msgSuccess("新增成功");
  463. this.open = false;
  464. this.getList();
  465. });
  466. }
  467. }
  468. });
  469. },
  470. /** 风险发生数折线统计图 */
  471. lineChart(){
  472. let self = this;
  473. // TODO 时间
  474. lineChart({}).then(response => {
  475. console.log("折线数据",response.data);
  476. if(response.data.xAxis) {
  477. if(this.option.xAxis.length==1){
  478. response.data.xAxis.data.unshift("");
  479. response.data.series[0].data.unshift(0)
  480. this.option.xAxis[0].data=response.data.xAxis.data
  481. this.option.series[0].data=response.data.series[0].data
  482. setTimeout(function(){
  483. self.eChartsOne();
  484. },500);
  485. }else{
  486. this.option.xAxis[0].data=response.data.xAxis.data
  487. this.option.series[0].data=response.data.series[0].data
  488. setTimeout(function(){
  489. self.eChartsOne();
  490. },500);
  491. }
  492. }else{
  493. // 无数据处理
  494. this.eChartsTypeOne = false;
  495. }
  496. });
  497. },
  498. /** 风险发生占比图 */
  499. happenChart(){
  500. let self = this;
  501. happenChart({}).then(response => {
  502. let list = [
  503. [],
  504. [],
  505. [],
  506. ];
  507. if(response.data.halfList[0]){
  508. for(let i=0;i<response.data.halfList.length;i++){
  509. let obj = {
  510. name:response.data.halfList[i].riskPlanName,
  511. value:response.data.halfList[i].count,
  512. };
  513. list[0].push(obj);
  514. }
  515. }
  516. if(response.data.nearlyList[0]){
  517. for(let i=0;i<response.data.nearlyList.length;i++){
  518. let obj = {
  519. name:response.data.nearlyList[i].riskPlanName,
  520. value:response.data.nearlyList[i].count,
  521. };
  522. list[1].push(obj);
  523. }
  524. }
  525. if(response.data.threeList[0]){
  526. for(let i=0;i<response.data.threeList.length;i++){
  527. let obj = {
  528. name:response.data.threeList[i].riskPlanName,
  529. value:response.data.threeList[i].count,
  530. };
  531. list[2].push(obj);
  532. }
  533. }
  534. this.happenCharts = [...list];
  535. if(this.happenCharts[0][0]||this.happenCharts[1][0]||this.happenCharts[2][0]){
  536. if(this.happenCharts[0][0]){
  537. this.eChartsTypeTwo = true;
  538. setTimeout(function(){
  539. self.eChartsTwo();
  540. },500);
  541. }else{
  542. this.eChartsTypeTwo = false;
  543. }
  544. }else{
  545. // 无数据
  546. this.eChartsTypeTwo = false;
  547. }
  548. console.log("饼数据",this.happenCharts)
  549. });
  550. },
  551. /** 学院风险统计图 */
  552. statisticsChartDept(){
  553. let self = this;
  554. statisticsChartDept({}).then(response => {
  555. let list = [
  556. {
  557. data:[],
  558. title:[]
  559. },
  560. {
  561. data:[],
  562. title:[]
  563. },
  564. {
  565. data:[],
  566. title:[]
  567. }
  568. ];
  569. if(response.data.halfList[0]){
  570. for(let i=0;i<response.data.halfList.length;i++){
  571. list[0].title.push(response.data.halfList[i].deptName);
  572. list[0].data.push(response.data.halfList[i].count);
  573. }
  574. }
  575. if(response.data.nearlyList[0]){
  576. for(let i=0;i<response.data.nearlyList.length;i++){
  577. list[1].title.push(response.data.nearlyList[i].deptName);
  578. list[1].data.push(response.data.nearlyList[i].count);
  579. }
  580. }
  581. if(response.data.threeList[0]){
  582. for(let i=0;i<response.data.threeList.length;i++){
  583. list[2].title.push(response.data.threeList[i].deptName);
  584. list[2].data.push(response.data.threeList[i].count);
  585. }
  586. }
  587. this.statisticsChartDepts = list;
  588. if(this.statisticsChartDepts[0].data[0]||this.statisticsChartDepts[1].data[0]||this.statisticsChartDepts[2].data[0]){
  589. if(this.statisticsChartDepts[0].data[0]){
  590. this.eChartsTypeThree = true;
  591. setTimeout(function(){
  592. self.eChartsThree();
  593. },500);
  594. }else{
  595. this.eChartsTypeThree = false;
  596. }
  597. }else{
  598. // 无数据
  599. this.eChartsTypeThree = false;
  600. }
  601. console.log("柱数据",this.statisticsChartDepts)
  602. });
  603. },
  604. /** 删除按钮操作 */
  605. handleDelete(row) {
  606. const ids = row.id || this.ids;
  607. this.$confirm('是否确认删除风险异常日志?', "警告", {
  608. confirmButtonText: "确定",
  609. cancelButtonText: "取消",
  610. type: "warning"
  611. }).then(function() {
  612. return delLog(ids);
  613. }).then(() => {
  614. this.getList();
  615. this.msgSuccess("删除成功");
  616. }).catch(() => {});
  617. },
  618. /** 导出按钮操作 */
  619. handleExport() {
  620. this.download('laboratory/log/export', {
  621. ...this.queryParams
  622. }, `laboratory_log.xlsx`)
  623. },
  624. //eCharts方法
  625. eChartsOne(){
  626. let self = this;
  627. let myChart = this.$echarts.init(document.getElementById('left-eCharts'));
  628. myChart.setOption(self.option);
  629. },
  630. //eCharts方法
  631. eChartsTwo(){
  632. let self = this;
  633. let myChart = this.$echarts.init(document.getElementById('right-top-eCharts'));
  634. let title = '风险数';
  635. let color = ['#0E7CE2', '#FF8352', '#E271DE', '#F8456B', '#00FFFF', '#4AEAB0'];
  636. let echartData = self.happenCharts[self.rightTopType];
  637. let formatNumber = function(num) {
  638. let reg = /(?=(\B)(\d{3})+$)/g;
  639. return num.toString().replace(reg, ',');
  640. }
  641. let total = echartData.reduce((a, b) => {
  642. return a + b.value * 1
  643. }, 0);
  644. let option = {
  645. color: color,
  646. tooltip: {
  647. trigger: 'item'
  648. },
  649. title: [{
  650. text: '{name|' + title + '}\n{val|' + formatNumber(total) + '}',
  651. top: '138',
  652. left:'128',
  653. textStyle: {
  654. rich: {
  655. name: {
  656. fontSize: 18,
  657. fontWeight: 'normal',
  658. color: '#666666',
  659. align :'center',
  660. padding: [10, 0]
  661. },
  662. val: {
  663. fontSize: 18,
  664. fontWeight: 'bold',
  665. color: '#333333',
  666. align :'center',
  667. }
  668. }
  669. }
  670. }],
  671. legend: {
  672. type: 'scroll',
  673. orient: 'vertical',
  674. right: '15%',
  675. top: '70',
  676. itemGap: 40,
  677. selectedMode: true,
  678. icon: 'rect',
  679. textStyle: {
  680. rich: {
  681. a: {
  682. color: '#000',
  683. width: 30
  684. },
  685. b0: {
  686. color: '#999',
  687. fontSize: 14,
  688. padding: [0, 10, 0, 80]
  689. },
  690. b1: {
  691. color: '#999',
  692. fontSize: 14,
  693. padding: [0, 10, 0, 80]
  694. },
  695. b2: {
  696. color: '#999',
  697. fontSize: 14,
  698. padding: [0, 10, 0, 80]
  699. },
  700. b3: {
  701. color: '#999',
  702. fontSize: 14,
  703. padding: [0, 10, 0, 80]
  704. },
  705. c0:{
  706. color: '#999',
  707. fontSize: 14,
  708. padding: [0, 10, 0, 10]
  709. },
  710. c1:{
  711. color: '#999',
  712. fontSize: 14,
  713. padding: [0, 10, 0, 10]
  714. },
  715. c2:{
  716. color: '#999',
  717. fontSize: 14,
  718. padding: [0, 10, 0, 10]
  719. },
  720. c3:{
  721. color: '#999',
  722. fontSize: 14,
  723. padding: [0, 10, 0, 10]
  724. }
  725. }
  726. },
  727. formatter: function(name) {
  728. let title = ''
  729. let total = echartData.reduce((a, b) => {
  730. return a + b.value * 1
  731. }, 0);
  732. var target;
  733. var index;
  734. var percentage;
  735. for (var i = 0, l = echartData.length; i < l; i++) {
  736. if (echartData[i].name == name) {
  737. target = echartData[i].value;
  738. title = echartData[i].label;
  739. percentage = ((echartData[i].value / total) * 100).toFixed(0);
  740. index = i < 6 ? i : 5;
  741. }
  742. }
  743. return `{a| ${name}}`+`{b${index}| ${percentage}%}`+`{a| 次数}`+`{c${index}| ${target}}`
  744. }
  745. },
  746. series: [{
  747. type: 'pie',
  748. radius: ['45%', '60%'],
  749. center: ['160', '170'],
  750. data: echartData,
  751. hoverAnimation: true,
  752. itemStyle: {
  753. normal: {
  754. borderWidth: 0
  755. }
  756. },
  757. labelLine: {
  758. show:false,
  759. },
  760. label: {
  761. normal: {
  762. show:false,
  763. }
  764. },
  765. }]
  766. };
  767. myChart.on('legendselectchanged', (e) => {
  768. total=0;
  769. //循环取value值
  770. echartData.forEach(function(item) {
  771. //根据选中状态总和计算total
  772. for(let i in e.selected){
  773. if(e.selected[i]==true){
  774. if(item.name==i){
  775. total+=item.value
  776. }
  777. }
  778. }
  779. //重新渲染title
  780. myChart.setOption({
  781. title: [{
  782. text: '{name|' + title + '}\n{val|' + formatNumber(total) + '}',
  783. }],
  784. })
  785. })
  786. })
  787. myChart.setOption(option);
  788. },
  789. //eCharts方法
  790. eChartsThree(){
  791. let self = this;
  792. let myChart = this.$echarts.init(document.getElementById('right-bottom-eCharts'));
  793. let data = self.statisticsChartDepts[self.rightBottomType].data;
  794. let title = self.statisticsChartDepts[self.rightBottomType].title;
  795. let option = {
  796. color: ['#3398DB'],
  797. tooltip: {
  798. trigger: 'axis',
  799. axisPointer: { // 坐标轴指示器,坐标轴触发有效
  800. type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  801. }
  802. },
  803. grid: {
  804. left: '3%',
  805. right: '4%',
  806. bottom: '3%',
  807. containLabel: true
  808. },
  809. xAxis: [
  810. {
  811. type: 'category',
  812. axisLabel: {
  813. color: '#333333', //字体颜色
  814. },
  815. axisLine: {
  816. show: true,
  817. lineStyle: {
  818. color: '#E0E0E0', //底线颜色
  819. width: 1,
  820. },
  821. },
  822. data: title,
  823. axisTick: {
  824. alignWithLabel: true
  825. }
  826. }
  827. ],
  828. yAxis: [
  829. {
  830. type: 'value',
  831. axisLabel: {
  832. formatter: '{value}',
  833. textStyle: {
  834. color: '#333333', //字体颜色
  835. },
  836. },
  837. axisLine: {
  838. show: true,
  839. lineStyle: {
  840. color: '#E0E0E0', //底线颜色
  841. width: 1,
  842. },
  843. },
  844. splitLine: {
  845. show: true,
  846. lineStyle: {
  847. color: '#E0E0E0',
  848. width: 1,
  849. type: 'dashed',
  850. },
  851. },
  852. }
  853. ],
  854. series: [
  855. {
  856. name: '风险发生数',
  857. type: 'bar',
  858. barWidth: '15',
  859. itemStyle:{
  860. color:'#0183FA',
  861. },
  862. data: data
  863. }
  864. ]
  865. };
  866. myChart.setOption(option);
  867. },
  868. }
  869. };
  870. </script>
  871. <style lang="scss" scoped>
  872. .plan_log {
  873. flex:1;
  874. display: flex!important;
  875. flex-direction: column;
  876. overflow-y: scroll;
  877. p{
  878. margin:0;
  879. }
  880. .top-max-big-box{
  881. height: 499px;
  882. /*margin:11px 20px 20px;*/
  883. margin:11px 10px 20px;
  884. display: flex;
  885. .top-max-big-title{
  886. position: absolute;
  887. left:20px;
  888. top:20px;
  889. line-height: 16px;
  890. font-size: 16px;
  891. }
  892. .top-left-box{
  893. /*width:807px;*/
  894. flex:1;
  895. height:499px;
  896. border-radius:10px;
  897. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  898. margin-right:20px;
  899. position: relative;
  900. overflow: hidden;
  901. padding-bottom:20px;
  902. #left-eCharts{
  903. height:100%;
  904. width:100%;
  905. }
  906. img{
  907. position: absolute;
  908. top:50%;
  909. left:50%;
  910. width:276px;
  911. height:274px;
  912. margin-top:-180px;
  913. margin-left:-100px;
  914. }
  915. .null-p{
  916. text-align: center;
  917. color:#999;
  918. margin-top:360px;
  919. }
  920. }
  921. .top-right-box{
  922. .top-right-top-box{
  923. overflow: hidden;
  924. border-radius:10px;
  925. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  926. width:754px;
  927. height:291px;
  928. margin-bottom:20px;
  929. position: relative;
  930. #right-top-eCharts{
  931. height:100%;
  932. width:100%;
  933. }
  934. img{
  935. position: absolute;
  936. top:50%;
  937. left:50%;
  938. width:140px;
  939. height:140px;
  940. margin-top:-70px;
  941. margin-left:-52px;
  942. }
  943. .null-p{
  944. text-align: center;
  945. color:#999;
  946. margin-top:230px;
  947. }
  948. .title-button-box{
  949. display: flex;
  950. position: absolute;
  951. left:160px;
  952. top:13px;
  953. p{
  954. width:80px;
  955. line-height:30px;
  956. font-size:14px;
  957. text-align: center;
  958. color:#999;
  959. cursor:pointer;
  960. }
  961. p:nth-child(1){
  962. border-top-left-radius: 4px;
  963. border-bottom-left-radius: 4px;
  964. }
  965. p:nth-child(3){
  966. border-top-right-radius: 4px;
  967. border-bottom-right-radius: 4px;
  968. }
  969. .selected-p{
  970. border:1px solid #0183FA;
  971. color:#0183FA;
  972. }
  973. .left-p{
  974. border-top:1px solid #999;
  975. border-bottom:1px solid #999;
  976. border-left:1px solid #999;
  977. border-right:1px solid rgba(255,255,255,0);
  978. color:#999;
  979. }
  980. .left-p-one{
  981. border:1px solid #999;
  982. color:#999;
  983. }
  984. .center-p{
  985. border-top:1px solid #999;
  986. border-bottom:1px solid #999;
  987. color:#999;
  988. }
  989. .right-p{
  990. border-top:1px solid #999;
  991. border-bottom:1px solid #999;
  992. border-right:1px solid #999;
  993. border-left:1px solid rgba(255,255,255,0);
  994. color:#999;
  995. }
  996. .right-p-one{
  997. border:1px solid #999;
  998. color:#999;
  999. }
  1000. }
  1001. }
  1002. .top-right-bottom-box{
  1003. overflow: hidden;
  1004. border-radius:10px;
  1005. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  1006. width:754px;
  1007. height:188px;
  1008. position: relative;
  1009. #right-bottom-eCharts{
  1010. height:100%;
  1011. width:100%;
  1012. }
  1013. img{
  1014. position: absolute;
  1015. top:50%;
  1016. left:50%;
  1017. width:100px;
  1018. height:100px;
  1019. margin-top:-50px;
  1020. margin-left:-36px;
  1021. }
  1022. .null-p{
  1023. text-align: center;
  1024. color:#999;
  1025. margin-top:150px;
  1026. }
  1027. .title-button-box{
  1028. display: flex;
  1029. position: absolute;
  1030. left:160px;
  1031. top:13px;
  1032. p{
  1033. width:80px;
  1034. line-height:30px;
  1035. font-size:14px;
  1036. text-align: center;
  1037. color:#999;
  1038. cursor:pointer;
  1039. }
  1040. p:nth-child(1){
  1041. border-top-left-radius: 4px;
  1042. border-bottom-left-radius: 4px;
  1043. }
  1044. p:nth-child(3){
  1045. border-top-right-radius: 4px;
  1046. border-bottom-right-radius: 4px;
  1047. }
  1048. .selected-p{
  1049. border:1px solid #0183FA;
  1050. color:#0183FA;
  1051. }
  1052. .left-p{
  1053. border-top:1px solid #999;
  1054. border-bottom:1px solid #999;
  1055. border-left:1px solid #999;
  1056. border-right:1px solid rgba(255,255,255,0);
  1057. color:#999;
  1058. }
  1059. .left-p-one{
  1060. border:1px solid #999;
  1061. color:#999;
  1062. }
  1063. .center-p{
  1064. border-top:1px solid #999;
  1065. border-bottom:1px solid #999;
  1066. color:#999;
  1067. }
  1068. .right-p{
  1069. border-top:1px solid #999;
  1070. border-bottom:1px solid #999;
  1071. border-right:1px solid #999;
  1072. border-left:1px solid rgba(255,255,255,0);
  1073. color:#999;
  1074. }
  1075. .right-p-one{
  1076. border:1px solid #999;
  1077. color:#999;
  1078. }
  1079. }
  1080. }
  1081. }
  1082. }
  1083. .bottom-max-big-box{
  1084. border-radius:10px;
  1085. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  1086. /*margin:0 20px 20px;*/
  1087. margin:0 10px 20px;
  1088. padding:20px 20px 20px!important;
  1089. display: flex;
  1090. flex:1;
  1091. flex-direction: column;
  1092. /*overflow: hidden;*/
  1093. }
  1094. }
  1095. </style>