index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <div class="home-container">
  3. <!-- 快捷菜单 -->
  4. <el-row :gutter="20">
  5. <el-col :span="24">
  6. <el-card>
  7. <p class="card-title">快捷菜单</p>
  8. <panel-group />
  9. </el-card>
  10. </el-col>
  11. <!-- 待办事项 -->
  12. <el-col :xs="24" :sm="12" :md="13" :lg="10">
  13. <el-card class="card-group">
  14. <p class="card-title">待办事项</p>
  15. <el-row :gutter="20">
  16. <el-col :xs="24" :sm="24" :md="12" :lg="12" v-for="(v,i) in dataList" :key="i">
  17. <div class="card-panel">
  18. <div class="card-panel-icon-wrapper icon-people">
  19. <svg-icon icon-class="example" class-name="card-panel-icon" />
  20. <div class="card-icon-text">
  21. {{v.taskTypeText}}
  22. </div>
  23. </div>
  24. <div class="card-panel-description">
  25. <div class="card-panel-text">
  26. {{v.statusText}}
  27. </div>
  28. <count-to :start-val="0" :end-val="v.nums" :duration="3000" class="card-panel-num" />
  29. </div>
  30. </div>
  31. </el-col>
  32. </el-row>
  33. </el-card>
  34. </el-col>
  35. <!-- 其他 -->
  36. <el-col :xs="24" :sm="12" :md="11" :lg="14">
  37. <el-card class="chart-wrapper">
  38. <el-tabs type="border-card">
  39. <el-tab-pane label="通知公告">
  40. <div class="tab-panel">
  41. <div class="msg-item" v-for="(v,i) in msgsList" :key="v.id" @click="showMsg(v)">
  42. <span>{{v.title}}</span>
  43. <span>{{v.publishTime}}</span>
  44. </div>
  45. </div>
  46. </el-tab-pane>
  47. <el-tab-pane label="知识库">
  48. <div class="tab-panel">
  49. <div class="file-item" v-for="(v,i) in fileList" :key="i">
  50. <a :href="imageUrl(v.url)" target="_blank">
  51. <i>{{v.name}}</i>
  52. <span>{{v.createTime}}</span>
  53. </a>
  54. </div>
  55. </div>
  56. </el-tab-pane>
  57. </el-tabs>
  58. </el-card>
  59. </el-col>
  60. </el-row>
  61. <!-- 新闻详情 -->
  62. <DialogCom
  63. title="详情"
  64. :visible.sync="show"
  65. width="800px"
  66. append-to-body
  67. @close="handleClose">
  68. <div class="panel-box" v-if="selectMsg">
  69. <h2>{{selectMsg.title}}</h2>
  70. <p>{{selectMsg.publishTime}}</p>
  71. <div class="content-box">
  72. <p>{{selectMsg.content}}</p>
  73. <ul v-if="selectMsg.fileList && selectMsg.fileList.length > 0">
  74. <li v-for="(v,i) in selectMsg.fileList" :key="v.url">
  75. <a :href="imageUrl(v.url)" target="_blank">
  76. <!-- <i class="el-icon-document"></i>-->
  77. {{v.name}}
  78. </a>
  79. </li>
  80. </ul>
  81. </div>
  82. </div>
  83. </DialogCom>
  84. </div>
  85. </template>
  86. <script>
  87. import PanelGroup from './dashboard/PanelGroup'
  88. import CountTo from 'vue-count-to'
  89. import {homeData,fileList} from '@/api/login'
  90. import {imageUrl} from "@/utils/ruoyi";
  91. import dayjs from 'dayjs'
  92. export default {
  93. name: 'Index',
  94. components: {
  95. PanelGroup,
  96. CountTo
  97. },
  98. data() {
  99. return {
  100. iconList:[],
  101. dataList:[],
  102. fileList:[],
  103. msgsList:[],
  104. show:false,
  105. selectMsg:null,
  106. }
  107. },
  108. mounted(){
  109. this.getData();
  110. },
  111. methods: {
  112. imageUrl,
  113. showMsg(v){
  114. this.show = true;
  115. this.selectMsg = v;
  116. },
  117. handleClose() {
  118. this.show = false;
  119. this.selectMsg = null;
  120. },
  121. getData(){
  122. homeData().then(res=>{
  123. this.dataList = res.data;
  124. });
  125. fileList().then(res=>{
  126. let {index1,index2} = res.data;
  127. if(index1){
  128. this.msgsList = index1;
  129. }
  130. if(!index2)return;
  131. this.fileList = index2.map(v=>{
  132. return JSON.parse(v)
  133. });
  134. this.fileList.forEach(v=>{
  135. v.createTime = dayjs(v.createTime).format('YYYY-DD-MM')
  136. })
  137. })
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. .home-container{
  144. .el-card__body{
  145. padding: 10px 20px 20px 20px;
  146. }
  147. .card-group{
  148. .el-card__body {
  149. padding-bottom: 10px;
  150. }
  151. }
  152. .el-tabs{
  153. border-radius: 4px;
  154. box-shadow: none;
  155. }
  156. .chart-wrapper{
  157. .el-card__body{
  158. padding: 0;
  159. }
  160. }
  161. }
  162. </style>
  163. <style lang="scss" scoped>
  164. .home-container {
  165. padding: 20px;
  166. background-color: rgb(240, 242, 245);
  167. .chart-wrapper {
  168. background: #fff;
  169. margin-top: 20px;
  170. }
  171. }
  172. .card-title{
  173. width: 120px;
  174. margin: 0 0 10px 0;
  175. padding-left: 4px;
  176. color:#fff;
  177. font-weight: bold;
  178. letter-spacing: 2px;
  179. background: linear-gradient(to right, #71bfe3, #fff);
  180. }
  181. .card-group{
  182. .card-title{
  183. margin: 0;
  184. }
  185. }
  186. .tab-panel{
  187. height: 455px;
  188. overflow: auto;
  189. }
  190. .msg-item{
  191. font-size: 15px;
  192. padding: 0 10px;
  193. color:#1ea8e9;
  194. line-height: 39px;
  195. display: flex;
  196. justify-content: space-between;
  197. cursor:pointer;
  198. &:hover{
  199. text-decoration: underline;
  200. }
  201. >span{
  202. display: inline-block;
  203. overflow: hidden;
  204. white-space:nowrap;
  205. text-overflow: ellipsis;
  206. text-align: start;
  207. }
  208. }
  209. .file-item{
  210. font-size: 15px;
  211. padding: 0 10px;
  212. color:#1ea8e9;
  213. text-decoration:underline;
  214. line-height: 39px;
  215. >a{
  216. display: flex;
  217. justify-content: space-between;
  218. >i{
  219. width: 70%;
  220. overflow: hidden;
  221. white-space:nowrap;
  222. text-overflow: ellipsis;
  223. text-align: start;
  224. }
  225. }
  226. &:hover{
  227. background-color: #1ea8e9;
  228. color:#fff;
  229. transition: all .38s ease-out;
  230. }
  231. }
  232. .card-group {
  233. margin-top: 20px;
  234. .card-panel {
  235. display: flex;
  236. flex:1;
  237. justify-content: space-between;
  238. cursor: pointer;
  239. font-size: 12px;
  240. color: #666;
  241. background: #fff;
  242. box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
  243. border-color: rgba(0, 0, 0, .05);
  244. margin: 10px 0;
  245. .icon-people {
  246. color: #40c9c6;
  247. }
  248. .card-panel-icon-wrapper {
  249. height: 120px;
  250. margin: 10px;
  251. padding: 10px;
  252. transition: all 0.38s ease-out;
  253. border-radius: 6px;
  254. display: flex;
  255. flex-direction: column;
  256. justify-content: center;
  257. align-items: center;
  258. }
  259. .card-panel-icon {
  260. float: left;
  261. font-size: 44px;
  262. }
  263. .card-icon-text{
  264. padding-top: 8px;
  265. text-align: center;
  266. line-height: 20px;
  267. color: rgba(0, 0, 0, 0.65);
  268. font-size: 16px;
  269. }
  270. .card-panel-description {
  271. display: flex;
  272. flex-direction: column;
  273. justify-content: center;
  274. font-weight: bold;
  275. margin: 10px;
  276. .card-panel-text {
  277. text-align: center;
  278. line-height: 18px;
  279. color: rgba(0, 0, 0, 0.65);
  280. font-size: 16px;
  281. margin-bottom: 12px;
  282. }
  283. .card-panel-num {
  284. font-size: 20px;
  285. }
  286. }
  287. }
  288. }
  289. .panel-box{
  290. >h2{
  291. text-align: center;
  292. }
  293. >p{
  294. font-size: 14px;
  295. color: #999;
  296. text-align: end;
  297. }
  298. .content-box{
  299. max-height: 600px;
  300. overflow: auto;
  301. >p{
  302. text-indent: 2em;
  303. word-break: break-word;
  304. white-space: pre-wrap;
  305. text-align: justify;
  306. width: 100%;
  307. color: #777;
  308. }
  309. >ul{
  310. font-size: 15px;
  311. color:#1ea8e9;
  312. >li{
  313. margin-bottom: 6px;
  314. }
  315. >li:hover{
  316. text-decoration:underline;
  317. }
  318. }
  319. }
  320. }
  321. @media (max-width:550px) {
  322. .card-panel-description {
  323. display: none;
  324. }
  325. .card-panel-icon-wrapper {
  326. float: none !important;
  327. width: 100%;
  328. height: 100%;
  329. margin: 0 !important;
  330. .svg-icon {
  331. display: block;
  332. margin: 14px auto !important;
  333. float: none !important;
  334. }
  335. }
  336. }
  337. </style>