index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div class="right-section">
  3. <div class="common-title gradient-text">突发事件</div>
  4. <div class="box">
  5. <div class="box-header">
  6. <div class="common-title-box">事件情况</div>
  7. <el-select v-model="queryParams.year" class="custom-select" popper-class="custom-select-popper" :teleported="false" @change="initData">
  8. <el-option v-for="level in yearOptions" :key="level.value" :label="level.name" :value="level.value"></el-option>
  9. </el-select>
  10. </div>
  11. <div class="data-box">
  12. <div class="box-item">
  13. <i class="year-icon" />
  14. <div class="box-flex">
  15. <div class="text-box">
  16. <div class="gradient-text3 text1">{{ statisticalData.nf_value }}</div>
  17. <div class="text2">件</div>
  18. </div>
  19. <div class="text3">{{ statisticalData.nf }}年度</div>
  20. </div>
  21. </div>
  22. <div class="box-item">
  23. <i class="season-icon" />
  24. <div class="box-flex">
  25. <div class="text-box">
  26. <div class="gradient-text3 text1">{{ statisticalData.jd_value }}</div>
  27. <div class="text2">件</div>
  28. </div>
  29. <div class="text3">第{{ getChineseQuarter(statisticalData.jd) }}季度</div>
  30. </div>
  31. </div>
  32. <div class="box-item">
  33. <i class="month-icon" />
  34. <div class="box-flex">
  35. <div class="text-box">
  36. <div class="text4">{{ statisticalData.yf_value }}</div>
  37. <div class="text2">件</div>
  38. </div>
  39. <div class="text3">{{ statisticalData.yf }}月份</div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="chart-box">
  45. <Chart :option="chartOption1" style="width: 546px; height: 546px" />
  46. <div class="data-box2">
  47. <div class="table">
  48. <div class="tr" style="background: none">
  49. <div class="th"></div>
  50. <div class="th">事件类型</div>
  51. <div class="th">数量</div>
  52. <div class="th">百分比</div>
  53. </div>
  54. <div class="table-content">
  55. <div v-for="(item, index) in eventTypeData" :key="index" class="tr">
  56. <div class="td">
  57. <div :class="['0'].includes(item.event_type) ? 'td-icon' : 'td-icon2'"></div>
  58. </div>
  59. <div class="td">
  60. <dict-tag :options="mm_event_type" :value="item.event_type" />
  61. </div>
  62. <div class="td">
  63. <div :class="['0'].includes(item.event_type) ? 'td-text1' : 'td-text2'">{{ item.cn }}</div>
  64. </div>
  65. <div class="td td-text2">{{ item.ratio ? item.ratio + '%' : '' }}</div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. <EventReport />
  72. </div>
  73. </template>
  74. <script lang="ts" setup name="RightSection">
  75. import EventReport from './EventReport/index.vue';
  76. import { option1 } from './chartOptions';
  77. import BigNumber from 'bignumber.js';
  78. import { getEventCount, getEventTypeCount } from '@/api/duty/eventing';
  79. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  80. const { mm_event_type } = toRefs<any>(
  81. proxy?.useDict('mm_event_type')
  82. );
  83. const queryParams = reactive({
  84. year: '2024'
  85. });
  86. const yearOptions = reactive([{ name: '2024', value: '2024' }]);
  87. const statisticalData = ref({
  88. nf: '',
  89. nf_value: '',
  90. jd: '',
  91. jd_value: '',
  92. yf: '',
  93. yf_value: ''
  94. });
  95. const chartOption1 = ref(option1);
  96. const eventTypeData = ref([]);
  97. const colorList = reactive(['#247dff', '#00fde7']);
  98. const initData = () => {
  99. getEventCount({
  100. query: {
  101. year_n: queryParams.year
  102. }
  103. }).then((res) => {
  104. statisticalData.value = res.rows[0];
  105. });
  106. getEventTypeCount({
  107. query: {
  108. year_n: queryParams.year
  109. }
  110. }).then((res) => {
  111. const data = res.rows;
  112. eventTypeData.value = data;
  113. const placeHolderStyle = {
  114. label: {
  115. show: false
  116. },
  117. labelLine: {
  118. show: false
  119. },
  120. color: 'rgba(0, 0, 0, 0)',
  121. borderColor: 'rgba(0, 0, 0, 0)',
  122. borderWidth: 0
  123. };
  124. let total = 0;
  125. data.forEach((item) => {
  126. total += item.cn;
  127. });
  128. const transparentData = {
  129. value: new BigNumber(total).multipliedBy(0.02).toNumber(),
  130. name: '',
  131. itemStyle: placeHolderStyle
  132. };
  133. const len = data.length;
  134. const chartData = [];
  135. const chartData2 = [];
  136. for (let i = 0; i < len; i++) {
  137. chartData.push({
  138. // name: data[i].name,
  139. value: data[i].cn,
  140. itemStyle: {
  141. color: ['0'].includes(data[i].event_type) ? colorList[0] : colorList[1]
  142. }
  143. });
  144. chartData2.push({
  145. // name: data[i].name,
  146. value: data[i].cn,
  147. itemStyle: {
  148. color: ['0'].includes(data[i].event_type) ? colorList[0] : colorList[1],
  149. opacity: 0.1
  150. }
  151. });
  152. chartData.push(transparentData);
  153. chartData2.push(transparentData);
  154. }
  155. chartOption1.value.series[0].data = chartData;
  156. chartOption1.value.series[1].data = chartData2;
  157. });
  158. };
  159. const getChineseQuarter = (quarter: number): string => {
  160. const chineseQuarters = ['一', '二', '三', '四'];
  161. return chineseQuarters[quarter - 1] || '';
  162. };
  163. onMounted(() => {
  164. initData();
  165. });
  166. </script>
  167. <style lang="scss" scoped>
  168. .right-section {
  169. display: flex;
  170. flex-direction: column;
  171. font-size: 36px;
  172. margin-left: 65px;
  173. width: 1962px;
  174. height: 2116px;
  175. background: url('@/assets/images/routineCommandMap/eventReport/dialog.png') no-repeat;
  176. background-size: 100% 100%;
  177. position: relative;
  178. padding: 140px 60px 0 50px;
  179. .box {
  180. .box-header {
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. }
  185. .data-box {
  186. width: 1896px;
  187. height: 230px;
  188. background: url('@/assets/images/routineCommandMap/dataBox.png') no-repeat bottom center;
  189. background-size: 1896px 123px;
  190. display: flex;
  191. padding-left: 130px;
  192. .box-item {
  193. display: flex;
  194. align-items: center;
  195. margin-right: 180px;
  196. &:last-child {
  197. margin-right: 0;
  198. }
  199. .year-icon {
  200. background: url('@/assets/images/routineCommandMap/year.png') no-repeat;
  201. }
  202. .season-icon {
  203. background: url('@/assets/images/routineCommandMap/season.png') no-repeat;
  204. }
  205. .month-icon {
  206. background: url('@/assets/images/routineCommandMap/month.png') no-repeat;
  207. }
  208. .year-icon,
  209. .season-icon,
  210. .month-icon {
  211. width: 192px;
  212. height: 200px;
  213. background-size: 100% 100%;
  214. display: inline-block;
  215. }
  216. .box-flex {
  217. margin-left: 38px;
  218. .text-box {
  219. display: flex;
  220. align-items: flex-end;
  221. .text1 {
  222. font-size: 64px;
  223. font-family: BEBAS-1;
  224. }
  225. .text2 {
  226. font-size: 38px;
  227. color: #a7ccdf;
  228. margin-left: 5px;
  229. }
  230. }
  231. .text3 {
  232. font-size: 44px;
  233. color: #ffffff;
  234. }
  235. .text4 {
  236. font-size: 64px;
  237. font-family: BEBAS-1;
  238. color: transparent;
  239. background-image: linear-gradient(to bottom, #ffffff 25%, #ff8015 100%);
  240. -webkit-background-clip: text;
  241. background-clip: text;
  242. display: inline-block;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. .custom-select {
  249. width: 440px !important;
  250. margin-left: 30px;
  251. }
  252. }
  253. .chart-box {
  254. display: flex;
  255. align-items: center;
  256. justify-content: space-between;
  257. .data-box2 {
  258. display: flex;
  259. justify-content: center;
  260. align-items: center;
  261. width: 1204px;
  262. height: 389px;
  263. background: url('@/assets/images/routineCommandMap/dataBox2.png') no-repeat;
  264. .table {
  265. .tr {
  266. display: flex;
  267. align-items: center;
  268. padding: 0 50px 0 0;
  269. width: 1087px;
  270. height: 96px;
  271. background: url('@/assets/images/routineCommandMap/eventReport/tr.png') no-repeat;
  272. background-size: 100% 100%;
  273. margin-top: 15px;
  274. .td {
  275. &:nth-child(2) {
  276. color: #ffffff;
  277. }
  278. &:nth-child(4) {
  279. font-size: 48px;
  280. color: #00e8ff;
  281. font-family: BEBAS-1;
  282. }
  283. }
  284. .td,
  285. .th {
  286. font-size: 38px;
  287. color: #a7ccdf;
  288. &:nth-child(1) {
  289. width: 90px;
  290. display: flex;
  291. justify-content: center;
  292. align-items: center;
  293. }
  294. &:nth-child(2) {
  295. flex: 1;
  296. text-align: left;
  297. }
  298. &:nth-child(3),
  299. &:nth-child(4) {
  300. width: 240px;
  301. text-align: right;
  302. }
  303. }
  304. .td-icon {
  305. width: 36px;
  306. height: 36px;
  307. border-radius: 10px;
  308. background-color: #247dff;
  309. }
  310. .td-icon2 {
  311. width: 36px;
  312. height: 36px;
  313. border-radius: 10px;
  314. background-color: #00fde7;
  315. }
  316. .td-text1 {
  317. font-size: 48px;
  318. color: transparent;
  319. background-image: linear-gradient(to bottom, #ffffff 25%, #2b72d6 100%);
  320. -webkit-background-clip: text;
  321. background-clip: text;
  322. display: inline-block;
  323. font-family: BEBAS-1;
  324. }
  325. .td-text2 {
  326. font-size: 48px;
  327. color: transparent;
  328. background-image: linear-gradient(to bottom, #ffffff 25%, #21c8d4 100%);
  329. -webkit-background-clip: text;
  330. background-clip: text;
  331. display: inline-block;
  332. font-family: BEBAS-1;
  333. }
  334. }
  335. }
  336. }
  337. }
  338. .table-content {
  339. height: 240px;
  340. overflow-y: auto;
  341. }
  342. </style>