华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
5.7 KiB

  1. <template>
  2. <div class="app-container home">
  3. <el-card class="box-card home-top">
  4. <div class="count-box">
  5. <div class="count-item">
  6. <div class="count-left">
  7. <img src="@/assets/images/home-icon1.jpg" />
  8. </div>
  9. <div class="count-right">
  10. <div class="count-count">{{count.formTodayCount}}</div>
  11. <div class="count-tip">{{$t('page.business.home.jrxzbd')}}</div>
  12. </div>
  13. </div>
  14. <div class="count-item">
  15. <div class="count-left">
  16. <img src="@/assets/images/home-icon1.jpg" />
  17. </div>
  18. <div class="count-right">
  19. <div class="count-count">{{count.formYtjCount}}</div>
  20. <div class="count-tip">{{$t('page.business.home.ytjbd')}}</div>
  21. </div>
  22. </div>
  23. <div class="count-item">
  24. <div class="count-left">
  25. <img src="@/assets/images/home-icon1.jpg" />
  26. </div>
  27. <div class="count-right">
  28. <div class="count-count">{{count.formTbzCount}}</div>
  29. <div class="count-tip">{{$t('page.business.home.dtjbd')}}</div>
  30. </div>
  31. </div>
  32. <div class="count-item">
  33. <div class="count-left">
  34. <img src="@/assets/images/home-icon1.jpg" />
  35. </div>
  36. <div class="count-right">
  37. <div class="count-count">{{count.studyWeekCount}}</div>
  38. <div class="count-tip">{{$t('page.business.home.bzxzsy')}}</div>
  39. </div>
  40. </div>
  41. <div class="count-item">
  42. <div class="count-left">
  43. <img src="@/assets/images/home-icon1.jpg" />
  44. </div>
  45. <div class="count-right">
  46. <div class="count-count">{{count.studyFinishCount}}</div>
  47. <div class="count-tip">{{$t('page.business.home.ywcsy')}}</div>
  48. </div>
  49. </div>
  50. </div>
  51. </el-card>
  52. <el-card class="box-card home-content">
  53. <div slot="header" class="clearfix">
  54. <span>系统通知</span>
  55. </div>
  56. <div class="notice-list" v-loading="loading">
  57. <div class="notice-item" v-for="(item,index) in noticeList" :key="index" @click="gotoPage(item)">
  58. <div class="notice-title"><el-badge is-dot class="notice-dot" v-if="item.status===1"></el-badge>{{item.title}}</div>
  59. <div class="notice-date">{{item.createTime}}</div>
  60. </div>
  61. <pagination
  62. v-show="noticeTotal>0"
  63. :total="noticeTotal"
  64. :page.sync="searchForm.pageNum"
  65. :limit.sync="searchForm.pageSize"
  66. @pagination="getNoticeList"
  67. />
  68. </div>
  69. </el-card>
  70. </div>
  71. </template>
  72. <script>
  73. import { home_count,home_noticeList,home_noticeRead} from "@/api/business/home/home";
  74. export default {
  75. name: "Index",
  76. data() {
  77. return {
  78. count:{
  79. formTodayCount:'',
  80. formYtjCount:'',
  81. formTbzCount:'',
  82. studyFinishCount:'',
  83. studyWeekCount:'',
  84. },
  85. loading:false,
  86. searchForm: {
  87. pageNum: 1,
  88. pageSize: 10,
  89. },
  90. noticeList:[],
  91. noticeTotal:0
  92. }
  93. },
  94. created(){
  95. this.getCount()
  96. this.getNoticeList()
  97. },
  98. methods: {
  99. getCount(){
  100. this.count = {
  101. formTodayCount:'',
  102. formYtjCount:'',
  103. formTbzCount:'',
  104. studyFinishCount:'',
  105. studyWeekCount:'',
  106. }
  107. this.$modal.loading()
  108. home_count().then(response => {
  109. this.count = response.data
  110. })
  111. .finally(() => {
  112. this.$modal.closeLoading()
  113. })
  114. },
  115. getNoticeList(){
  116. this.loading = true;
  117. home_noticeList(this.searchForm).then(response => {
  118. this.noticeList = response.rows;
  119. this.noticeTotal = response.total;
  120. }).finally(()=>{
  121. this.loading = false;
  122. this.refreshNoticeCount()
  123. })
  124. },
  125. gotoPage(item){
  126. this.read(item)
  127. let index = _.findIndex(this.$store.state.tagsView.visitedViews,(tab)=>{
  128. return tab.path === item.url
  129. })
  130. if(index>-1){
  131. this.$tab.refreshPage(this.$store.state.tagsView.visitedViews[index]);
  132. }else{
  133. this.$tab.openPage(" ",item.url)
  134. }
  135. },
  136. refreshNoticeCount(){
  137. this.$store.dispatch('GetMenuCount').then(() => {
  138. }).catch(error => {
  139. console.log('GetMenuCount出错:' + (error.msg || ''))
  140. })
  141. },
  142. read(item){
  143. home_noticeRead({id:item.id}).then(response => {
  144. }).finally(()=>{
  145. this.refreshNoticeCount()
  146. })
  147. },
  148. }
  149. }
  150. </script>
  151. <style scoped lang="scss">
  152. .home{
  153. .home-top{
  154. margin-bottom: 20px;
  155. .count-box{
  156. display: flex;
  157. flex-direction: row;
  158. align-items: center;
  159. .count-item{
  160. flex-shrink: 0;
  161. width: 20%;
  162. display: flex;
  163. flex-direction: row;
  164. align-items: center;
  165. .count-left{
  166. flex-shrink: 0;
  167. img{
  168. width: 60px;
  169. }
  170. }
  171. .count-right{
  172. flex-grow: 1;
  173. margin-left: 20px;
  174. .count-count{
  175. font-size: 20px;
  176. font-weight: bold;
  177. }
  178. .count-tip{
  179. margin-top: 10px;
  180. }
  181. }
  182. }
  183. }
  184. }
  185. .home-content{
  186. min-height: 400px;
  187. .notice-list{
  188. .notice-item{
  189. display: flex;
  190. flex-direction: row;
  191. justify-content: space-between;
  192. align-items: center;
  193. border-bottom: 1px solid #eee;
  194. margin-bottom: 10px;
  195. padding-bottom: 5px;
  196. font-size: 12px;
  197. cursor: pointer;
  198. .notice-title{
  199. flex-grow: 1;
  200. flex-wrap: wrap;
  201. .notice-dot{
  202. margin-right: 2px;
  203. margin-top: 5px;
  204. }
  205. }
  206. .notice-date{
  207. flex-shrink: 0;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. </style>