index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="page-container column-container">
  3. <el-row :gutter="24" style="margin-left: 10px;">
  4. <el-col :span="8" class="notifications-label">
  5. <!-- <div class="dashboard-total-item">
  6. <img :src="totalIcon2" />
  7. <div class="dashboard-total-item-label">
  8. <span>员工总数</span>
  9. <span>
  10. <span>本月新入职</span>
  11. <span>{{ monthTotalCompanies }} 人</span>
  12. </span>
  13. </div>
  14. <div class="number-label">{{ totalCompanies }} 人</div>
  15. </div> -->
  16. <div class="notifications-header">公告</div>
  17. <el-card v-for="item in notifications" style="width: 100%;margin-bottom: 5px;" shadow="always">
  18. <template #default>
  19. <div style="display: flex; flex-direction: row;">
  20. <i class="fa fa-bell-o" aria-hidden="true"
  21. style="display: inline-block; height: 25px; line-height: 25px;" />
  22. <div style="margin-left: 5px;display: inline-block; height: 25px; line-height: 25px;">{{ item.title }}
  23. </div>
  24. </div>
  25. </template>
  26. </el-card>
  27. <!-- <el-row v-for="item in notifications" style="padding: 5px 10px;">
  28. {{ item.title }}
  29. </el-row> -->
  30. </el-col>
  31. <el-col :span="8">
  32. <!-- <div class="dashboard-total-item">
  33. <img :src="totalIcon3" />
  34. <div class="dashboard-total-item-label">
  35. <span>设备总数</span>
  36. <span>
  37. <span>本月新购量</span>
  38. <span>{{ identityMonthTotal }} 台</span>
  39. </span>
  40. </div>
  41. <div class="number-label">{{ identityTotal }} 台</div>
  42. </div> -->
  43. </el-col>
  44. </el-row>
  45. <!-- <div class="statistic-container">
  46. <el-row :gutter="16">
  47. <el-col :span="12">
  48. <div class="item-statistic-container" id="information-statistic"></div>
  49. </el-col>
  50. <el-col :span="12">
  51. <div class="item-statistic-container" id="appointment-statistic"></div>
  52. </el-col>
  53. </el-row>
  54. </div> -->
  55. </div>
  56. </template>
  57. <script setup>
  58. // import totalIcon2 from '@/assets/images/dashboard-total-icon-2.png'
  59. // import totalIcon3 from '@/assets/images/dashboard-total-icon-3.png'
  60. import { parseTime } from '@/utils/tools.js'
  61. import { listNotification } from '@/api/business/notification'
  62. // import { index } from '@/api/business/production'
  63. //import { getDashboardStatistics } from '@/api/ss/visitor/general.js'
  64. //import { getTenant } from '@/utils/auth'
  65. // import * as echarts from 'echarts'
  66. const statisticOption = reactive({
  67. title: {
  68. text: '企业与标识每日注册统计',
  69. left: 8
  70. },
  71. tooltip: {
  72. trigger: 'axis'
  73. },
  74. legend: {
  75. data: ['企业', '标识']
  76. },
  77. grid: {
  78. left: '16px',
  79. right: '48px',
  80. bottom: '48px',
  81. containLabel: true
  82. },
  83. xAxis: {
  84. type: 'category',
  85. boundaryGap: false,
  86. // x 坐标轴对应的值
  87. data: []
  88. },
  89. yAxis: {
  90. type: 'value'
  91. },
  92. // 缩放
  93. dataZoom: [
  94. {
  95. type: 'slider',
  96. xAxisIndex: 0,
  97. filterMode: 'none'
  98. },
  99. {
  100. type: 'slider',
  101. yAxisIndex: 0,
  102. filterMode: 'none'
  103. },
  104. {
  105. type: 'inside',
  106. xAxisIndex: 0,
  107. filterMode: 'none'
  108. },
  109. {
  110. type: 'inside',
  111. yAxisIndex: 0,
  112. filterMode: 'none'
  113. }
  114. ],
  115. // y 坐标轴对应的值
  116. series: [
  117. {
  118. name: '企业',
  119. type: 'line',
  120. data: [11, 0, 0, 22, 38, 32, 20, 12, 0, 0, 14, 9, 17, 18, 35, 0, 0, 16, 20, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  121. },
  122. {
  123. name: '标识',
  124. type: 'line',
  125. data: [173, 101, 120, 240, 182, 123, 255, 198, 156, 110, 155, 121, 120, 128, 209, 127, 140, 205, 142, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  126. }
  127. ]
  128. })
  129. let totalCompanies = ref(0)
  130. let monthTotalCompanies = ref(0)
  131. let identityTotal = ref(0)
  132. let identityMonthTotal = ref(0)
  133. let currentMonth = ref('')
  134. let statisticDom, statistic
  135. const notifications = ref([])
  136. onMounted(() => {
  137. currentMonth.value = parseTime(new Date(), '{y}-{m}')
  138. //statisticDom = document.getElementById('information-statistic')
  139. //statistic = echarts.init(statisticDom)
  140. //getCurrentMonthDayArr()
  141. getList()
  142. })
  143. function getList() {
  144. listNotification({}).then(res => {
  145. notifications.value = res.rows
  146. })
  147. }
  148. const getCurrentMonthDayArr = (dateStr) => {
  149. // 获取当前日期
  150. var currentDate = dateStr ? new Date(dateStr) : new Date()
  151. // 获取当前月份
  152. var currentMonth = currentDate.getMonth()
  153. // 获取下个月的第一天
  154. var nextMonth = new Date(currentDate.getFullYear(), currentMonth + 1, 1)
  155. // 设置日期为当前月份的最后一天
  156. nextMonth.setDate(nextMonth.getDate() - 1)
  157. // 根据当前月最后一天的日期,判断每个月有多少天
  158. var days = nextMonth.getDate()
  159. // 创建一个空数组来存储日期
  160. const dateArray = []
  161. // 循环遍历天数
  162. for (var day = 1; day <= days; ++day) {
  163. // 使用padStart函数将日期补齐到两位数,不足的地方用0填充
  164. var formattedDay = String(day).padStart(2, '0')
  165. // 将格式化后的日期添加到数组中
  166. dateArray.push(formattedDay)
  167. }
  168. statisticOption.xAxis.data = dateArray
  169. totalCompanies.value = 523
  170. monthTotalCompanies.value = 276
  171. identityTotal.value = 5133
  172. identityMonthTotal.value = 3015
  173. statisticOption && statistic.setOption(statisticOption)
  174. }
  175. const handleChangeMonth = (val) => {
  176. getCurrentMonthDayArr(val)
  177. }
  178. </script>
  179. <style scoped>
  180. .notifications-header {
  181. height: 30px;
  182. margin: 10px 5px;
  183. font-size: 20px;
  184. padding: 0 5px;
  185. }
  186. :deep(.notifications-label .el-card__body) {
  187. padding: 5px 10px !important;
  188. }
  189. .notifications-label .el-card {
  190. border: 1px solid #fdf1aa;
  191. border-radius: 2px;
  192. }
  193. .notifications-label .el-card.is-always-shadow {
  194. box-shadow: 0 0 5px #fdf1aa;
  195. }
  196. .dashboard-total-item {
  197. display: flex;
  198. align-items: center;
  199. padding: 0 24px;
  200. height: 152px;
  201. background-color: #fff;
  202. font-size: 16px;
  203. justify-content: space-between;
  204. }
  205. .dashboard-total-item>.dashboard-total-item-label {
  206. flex: 1;
  207. display: flex;
  208. flex-direction: column;
  209. line-height: 32px;
  210. padding: 0 16px;
  211. }
  212. .dashboard-total-item>.dashboard-total-item-label>span:first-child {
  213. font-weight: bold;
  214. font-size: 18px;
  215. }
  216. .dashboard-total-item>.dashboard-total-item-label>span:last-child {
  217. color: #6b6b6b;
  218. }
  219. .dashboard-total-item>.dashboard-total-item-label>span:last-child>span:first-child {
  220. margin-right: 8px;
  221. }
  222. .dashboard-total-item>.dashboard-total-item-label>span:last-child>span:last-child {
  223. color: #4367df;
  224. }
  225. .dashboard-total-item>.number-label {
  226. font-size: 40px;
  227. margin-left: 16px;
  228. font-weight: bold;
  229. color: #5a6ac3;
  230. }
  231. .statistic-container {
  232. position: relative;
  233. margin-top: 24px;
  234. background-color: #fff;
  235. padding-top: 16px;
  236. padding-right: 12px;
  237. padding-bottom: 8px;
  238. padding-left: 4px;
  239. }
  240. .statistic-container>.month-picker {
  241. position: absolute;
  242. top: 16px;
  243. left: 240px;
  244. line-height: 24px;
  245. }
  246. .item-statistic-container {
  247. height: 560px;
  248. }
  249. </style>