iam-audit-dsc-bottom-div.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <div :class="$style.mainDiv">
  3. <div :class="$style.title">
  4. <span v-html="title"></span>
  5. <div :class="$style.year">
  6. <a-date-picker
  7. v-model="planYear"
  8. :class="$style.yearSelect"
  9. allow-clear
  10. mode="year"
  11. picker="YYYY"
  12. format="YYYY"
  13. :input-read-only="true"
  14. :open="yearOpen"
  15. placeholder="选择年份"
  16. @panelChange="panelChange"
  17. @openChange="openChange"
  18. />
  19. </div>
  20. </div>
  21. <a-row>
  22. <a-col :span="24">
  23. <div :class="[$style.pietitle]">
  24. <sd-echart
  25. ref="echartss"
  26. :options="options || leftpie"
  27. autoresize
  28. :class="$style.onepieClass"/></div
  29. ></a-col>
  30. </a-row>
  31. </div>
  32. </template>
  33. <script>
  34. import 'echarts/lib/component/title'
  35. import 'echarts/lib/chart/pie'
  36. import 'echarts/lib/component/legend'
  37. import 'echarts/lib/component/tooltip'
  38. import iamAuditDscService from './iam-audit-dsc-service'
  39. import components from './_import-components/iam-audit-dsc-bottom-div-import'
  40. export default {
  41. name: 'IamAuditDscBottomDiv',
  42. metaInfo: {
  43. title: 'IamAuditDscBottomDiv',
  44. },
  45. components: {
  46. ...components,
  47. },
  48. props: {
  49. years: {
  50. type: [String, Number],
  51. default: null,
  52. },
  53. options: {
  54. type: Object,
  55. default: () => null,
  56. },
  57. /**
  58. * 标题
  59. *
  60. * */
  61. title: {
  62. type: String,
  63. default: null,
  64. },
  65. /**
  66. * 统计的组织ID
  67. */
  68. unidId: {
  69. type: Array,
  70. default: () => {
  71. return []
  72. },
  73. },
  74. },
  75. data() {
  76. return {
  77. planYear: undefined,
  78. yearOpen: false,
  79. leftactiveKey: '1',
  80. rightactiveKey: '1',
  81. total: 0,
  82. leftpie: {
  83. legend: {
  84. show: false,
  85. },
  86. color: ['#fff', '#8675ff', '#dce0fa'],
  87. series: [
  88. {
  89. left: 100,
  90. top: 65,
  91. type: 'pie',
  92. radius: [1111, 1111],
  93. label: {
  94. show: true,
  95. position: 'center',
  96. fontSize: 30,
  97. fontWeight: '600',
  98. color: '#8675ff',
  99. },
  100. emphasis: {
  101. disabled: true,
  102. scale: true,
  103. scaleSize: 0,
  104. },
  105. tooltip: {
  106. show: false,
  107. },
  108. labelLine: {
  109. show: true,
  110. },
  111. data: [],
  112. },
  113. {
  114. top: 65,
  115. left: 100,
  116. type: 'pie',
  117. radius: [73, 90],
  118. avoidLabelOverlap: false,
  119. label: {
  120. show: false,
  121. position: 'center',
  122. },
  123. legendHoverLink: false,
  124. emphasis: {
  125. scale: true,
  126. scaleSize: 0,
  127. },
  128. labelLine: {
  129. show: false,
  130. },
  131. data: [],
  132. },
  133. {
  134. type: 'pie',
  135. top: -270,
  136. left: 100,
  137. radius: [1111, 1111],
  138. label: {
  139. show: true,
  140. position: 'center',
  141. fontSize: 15,
  142. fontWeight: '600',
  143. color: 'rgba(0, 0, 0, 0.65)',
  144. },
  145. emphasis: {
  146. disabled: true,
  147. scale: true,
  148. scaleSize: 0,
  149. },
  150. tooltip: {
  151. show: false,
  152. },
  153. labelLine: {
  154. show: true,
  155. },
  156. data: [{ value: 0, name: '整改完成率' }],
  157. },
  158. ],
  159. },
  160. rightpie: {
  161. legend: {
  162. show: false,
  163. },
  164. color: ['#fff', '#54c5eb', '#dce0fa'],
  165. series: [
  166. {
  167. top: 65,
  168. type: 'pie',
  169. radius: [1111, 1111],
  170. label: {
  171. show: true,
  172. position: 'center',
  173. fontSize: 30,
  174. fontWeight: '600',
  175. color: '#54c5eb',
  176. },
  177. emphasis: {
  178. disabled: true,
  179. scale: true,
  180. scaleSize: 0,
  181. },
  182. tooltip: {
  183. show: false,
  184. },
  185. labelLine: {
  186. show: true,
  187. },
  188. data: [],
  189. },
  190. {
  191. top: 65,
  192. type: 'pie',
  193. radius: [73, 90],
  194. avoidLabelOverlap: false,
  195. label: {
  196. show: false,
  197. position: 'center',
  198. },
  199. legendHoverLink: false,
  200. emphasis: {
  201. scale: true,
  202. scaleSize: 0,
  203. },
  204. labelLine: {
  205. show: false,
  206. },
  207. data: [],
  208. },
  209. {
  210. type: 'pie',
  211. top: -270,
  212. radius: [1111, 1111],
  213. label: {
  214. show: true,
  215. position: 'center',
  216. fontSize: 15,
  217. fontWeight: '600',
  218. color: 'rgba(0, 0, 0, 0.65)',
  219. },
  220. emphasis: {
  221. disabled: true,
  222. scale: true,
  223. scaleSize: 0,
  224. },
  225. tooltip: {
  226. show: false,
  227. },
  228. labelLine: {
  229. show: true,
  230. },
  231. data: [{ value: 0, name: '到期整改率' }],
  232. },
  233. ],
  234. },
  235. onepie: {
  236. color: ['#000', '#bb7ec4', '#ffb74a', '#ff4a55', '#54c5eb', '#dce0fa'],
  237. textStyle: {
  238. color: '#8a8a8a',
  239. fontSize: 13,
  240. },
  241. tooltip: {
  242. trigger: 'item',
  243. },
  244. legend: {
  245. orient: 'vertical',
  246. right: 170,
  247. icon: 'circle',
  248. top: 90,
  249. textStyle: {
  250. width: 1000,
  251. backgroundColor: {
  252. image: require('./backgroundimg.png'),
  253. },
  254. color: '#8a8a8a',
  255. lineHeight: 25,
  256. padding: [0, 20, 0, 0],
  257. },
  258. data: [],
  259. },
  260. series: [
  261. {
  262. type: 'pie',
  263. top: 68,
  264. left: -500,
  265. radius: [1111, 1111],
  266. label: {
  267. show: true,
  268. position: 'center',
  269. fontSize: 20,
  270. fontWeight: 'bold',
  271. },
  272. emphasis: {
  273. disabled: true,
  274. scale: true,
  275. scaleSize: 0,
  276. },
  277. tooltip: {
  278. show: false,
  279. },
  280. labelLine: {
  281. show: true,
  282. },
  283. data: [],
  284. },
  285. {
  286. type: 'pie',
  287. left: -500,
  288. top: 70,
  289. radius: [60, 90],
  290. data: [],
  291. emphasis: {
  292. itemStyle: {
  293. shadowBlur: 10,
  294. shadowOffsetX: 0,
  295. shadowColor: 'rgba(0, 0, 0, 0.5)',
  296. },
  297. },
  298. label: {
  299. minMargin: 5,
  300. edgeDistance: 10,
  301. lineHeight: 15,
  302. padding: [0, -65],
  303. formatter: (params) => {
  304. return (
  305. params.data.name.split('\u2003')[0] +
  306. ' ' +
  307. Math.round(this.total * (params.percent / 100)) +
  308. '\n'
  309. )
  310. },
  311. },
  312. labelLine: {
  313. length2: '80px',
  314. },
  315. },
  316. {
  317. type: 'pie',
  318. top: -270,
  319. left: -500,
  320. radius: [1111, 1111],
  321. label: {
  322. show: true,
  323. position: 'center',
  324. fontSize: 15,
  325. fontWeight: '600',
  326. color: 'rgba(0, 0, 0, 0.65)',
  327. },
  328. emphasis: {
  329. disabled: true,
  330. scale: true,
  331. scaleSize: 0,
  332. },
  333. tooltip: {
  334. show: false,
  335. },
  336. labelLine: {
  337. show: true,
  338. },
  339. data: [{ value: 0, name: '需要整改的问题' }],
  340. },
  341. ],
  342. },
  343. }
  344. },
  345. computed: {
  346. // 因为props传值不会自动更新,使用计算值
  347. selectYear() {
  348. return this.planYear
  349. },
  350. // 因为props传值不会自动更新,使用计算值
  351. selectUnidId() {
  352. if (this.unidId.length > 0) {
  353. return this.unidId[0].id
  354. } else {
  355. return null
  356. }
  357. },
  358. },
  359. watch: {
  360. years: {
  361. handler: function(oldVal, newVal) {
  362. this.planYear = this.years
  363. console.log(this.years, 'newVal---')
  364. },
  365. deep: true,
  366. immediate: true,
  367. },
  368. },
  369. created() {
  370. // 获取项目总览
  371. // this.planYear = new Date().getFullYear().toString()
  372. // this.getData()
  373. },
  374. mounted() {
  375. this.$nextTick(() => {
  376. const chart = this.$refs.echartss?.chart
  377. if (chart) {
  378. chart.on('click', (e) => {
  379. this.$emit('echartClick', e)
  380. })
  381. chart.on('legendselectchanged', (params) => {
  382. const isSelected = params.selected[params.name]
  383. this.$emit('changeLegend', params)
  384. })
  385. }
  386. })
  387. },
  388. methods: {
  389. /**
  390. * 打开或关闭年度选择
  391. */
  392. openChange(open) {
  393. this.yearOpen = open
  394. },
  395. /**
  396. * 年份选择时,关闭弹窗
  397. */
  398. panelChange(value) {
  399. console.log('关闭年份选择器-------', value)
  400. this.planYear = value.format('YYYY')
  401. this.yearOpen = !this.yearOpen
  402. this.$emit('getYear', this.planYear)
  403. },
  404. getData() {
  405. // 获取项目总览
  406. const params = {
  407. unitId: this.selectUnidId,
  408. planYear: this.selectYear,
  409. }
  410. },
  411. },
  412. }
  413. </script>
  414. <style module lang="scss">
  415. @use '@/common/design' as *;
  416. .main-div {
  417. height: 380px;
  418. margin: 0 10px;
  419. background: #fff;
  420. border-radius: 10px;
  421. .title {
  422. font-size: 18px;
  423. padding: 25px 0 10px 25px;
  424. margin: 0;
  425. font-weight: 700;
  426. // border-bottom: 1px solid #e8e8e8;
  427. position: relative;
  428. &::before {
  429. position: absolute;
  430. left: 0;
  431. bottom: 0;
  432. content: '';
  433. width: 8px;
  434. height: 70%;
  435. background-color: #e73030;
  436. }
  437. .year {
  438. position: absolute;
  439. right: 0;
  440. top: 50%;
  441. transform: translateY(-50%);
  442. margin-right: 15px;
  443. .year-select {
  444. display: block;
  445. width: 120px;
  446. margin-top: 15px;
  447. :global(.ant-calendar-picker-input) {
  448. cursor: pointer;
  449. }
  450. }
  451. }
  452. }
  453. }
  454. .onepie-class {
  455. width: 100%;
  456. height: 330px;
  457. }
  458. .pietitle {
  459. height: 50px;
  460. font-weight: bold;
  461. line-height: 75px;
  462. }
  463. </style>