index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <template>
  2. <main class='homepage'>
  3. <section class='homepage-cards-content'>
  4. <div class='cards-item' v-for='(item , index) in cardsList' :key='index' :style='itemStyle(item)'>
  5. <h4>{{item.smsxtname}}</h4>
  6. <div class='equipment-list' v-if='item.assetTypeList'>
  7. <div @click='navToInnerPage(item, equip)' class='equipment-item' v-for='(equip , index) in item.assetTypeList' :key="index">
  8. <div class='equip-name' >
  9. <h5>{{equip.category_name}}</h5>
  10. <div class='exception-number' v-if="equip.is_exception_num">{{equip.is_exception_num}}</div>
  11. </div>
  12. <section >
  13. <div class='equip-statis'>
  14. <span class='equip-number'>{{equip.asset_num}}</span>
  15. <span class='equip-unit'>台</span>
  16. </div>
  17. <div>
  18. <em v-if='false'>维保中</em>
  19. </div>
  20. </section>
  21. </div>
  22. </div>
  23. <div v-else class="empty-content" style="border-top:none; height:8rem;line-height:8rem;">暂无数据</div>
  24. <div v-if="item.rptGlsmsStatisticsList && item.rptGlsmsStatisticsList.length" class="alert-list" @click="navToGanttPage(item)">
  25. <div class="alert-item" v-for="(option , index) in item.rptGlsmsStatisticsList" :key="index" >
  26. <img v-if="option.total" :src="srcList[option.type][option.level]" >
  27. <div class="content" v-if="option.total">
  28. <p class="line">
  29. <span >{{option.type === 1 ? '维保': option.type === 0 ? '专维' : '第三方检测' }}</span>
  30. <span><em :style="{color:item.level == 1? '#646C73': item.level == 2 ? '#E07A04 ' :'#C13830'}">{{option.unfinished}}</em>/<em>{{option.total}}</em></span>
  31. </p>
  32. <p class='desc'>当月未完成/总任务</p>
  33. </div>
  34. </div>
  35. </div>
  36. <div v-else class='empty-content'>暂无数据</div>
  37. </div>
  38. </section>
  39. <section class='homepage-nav-list'>
  40. <nav>
  41. <div class='main-title'>
  42. <span>重点关注事项</span>
  43. <a @click='navToFocusItem'>更多</a>
  44. </div>
  45. <div class='table'>
  46. <div class='row table-header'>
  47. <article>日期</article>
  48. <article>政府部门</article>
  49. <article>记录事项</article>
  50. </div>
  51. <div class='table-body'>
  52. <div class='row' v-for='(item , index) in itemsList' :key='index'>
  53. <article>{{item.createdate}}</article>
  54. <article>{{item.department}}</article>
  55. <article>{{item.recordsx}}</article>
  56. </div>
  57. </div>
  58. </div>
  59. </nav>
  60. <nav>
  61. <div class='main-title'>
  62. <span>说明书更新记录</span>
  63. <a @click='navToIntroduce'>更多</a>
  64. </div>
  65. <div class='table'>
  66. <div class='row table-header'>
  67. <article>日期</article>
  68. <article>事项类型</article>
  69. <article>更新内容</article>
  70. </div>
  71. <div class='table-body'>
  72. <div class='row' v-for='(item , index) in changeList' :key='index'>
  73. <article>{{item.changedate}}</article>
  74. <article>{{item.type}}</article>
  75. <article>{{item.content || '--'}}</article>
  76. </div>
  77. </div>
  78. </div>
  79. </nav>
  80. </section>
  81. </main>
  82. </template>
  83. <script>
  84. import { getCardList, getQueryList, getChangeList } from '@/api/homePage'
  85. import moment from 'moment'
  86. export default {
  87. data() {
  88. return {
  89. cardsList: [],
  90. itemsList: [],
  91. changeList: [],
  92. plazaId:'',
  93. srcList: {
  94. 0: {
  95. 1: require('../../assets/images/icons/edit_blue_b.png'), //1.正常(蓝色) 2.警告(黄色) 3.严重(红色)
  96. 2: require('../../assets/images/icons/edit_yellow_b.png'),
  97. 3: require('../../assets/images/icons/edit_red_b.png')
  98. },
  99. 1: {
  100. 1: require('../../assets/images/icons/fix_blue_b.png'),
  101. 2: require('../../assets/images/icons/fix_yellow_b.png'),
  102. 3: require('../../assets/images/icons/fix_red_b.png')
  103. },
  104. 2: {
  105. 1: require('../../assets/images/icons/search_blue_b.png'),
  106. 2: require('../../assets/images/icons/search_yellow_b.png'),
  107. 3: require('../../assets/images/icons/search_red_b.png')
  108. }
  109. }
  110. }
  111. },
  112. created () {
  113. let plazaId = localStorage.getItem('PLAZAID')
  114. if (plazaId) {
  115. this.plazaId = plazaId
  116. }
  117. },
  118. mounted() {
  119. this.testAjax()
  120. this.getItemsQuery()
  121. this.getInstructionList()
  122. },
  123. methods: {
  124. /**
  125. * 点击跳转进入综合事项管理页面
  126. */
  127. navToFocusItem () {
  128. this.$router.push({path:"./other", query:{module:'comprehensive'}})
  129. },
  130. /**
  131. * 点击跳转进入 分析|报表 说明书更新记录页面
  132. */
  133. navToIntroduce () {
  134. this.$router.push({path:"./analysis", query:{module:'specification'}})
  135. },
  136. itemStyle (option) {
  137. let num = 0
  138. if (option.assetTypeList) {
  139. option.assetTypeList.forEach(item=>{
  140. if (typeof item.is_exception_num === "number") {
  141. num += item.is_exception_num
  142. }
  143. })
  144. }
  145. if (option.rptGlsmsStatisticsList) {
  146. option.rptGlsmsStatisticsList.forEach(option => {
  147. if (typeof option.unfinished === "number") {
  148. num += option.unfinished
  149. }
  150. })
  151. }
  152. if (num > 0) {
  153. return {
  154. borderLeft:"3px solid #EF6B66"
  155. }
  156. }
  157. },
  158. navToInnerPage (item, equip) {
  159. this.$router.push({path:"./analysis", query:{smsxt:item.smsxt, equipId: equip.category_code, module:'core'}})
  160. },
  161. /**
  162. * 跳转到甘特图详情页
  163. */
  164. navToGanttPage (item) {
  165. this.$router.push({path:"./analysis", query:{smsxt:item.smsxt, module:'gantt'}})
  166. },
  167. testAjax() {
  168. let params = {
  169. getParams: {
  170. plazaId: this.plazaId
  171. }
  172. }
  173. getCardList(params).then(res => {
  174. if (res.result == 'success') {
  175. let result = res.data
  176. if (result && Array.isArray(result)) {
  177. result.forEach(item => {
  178. if (item.assetTypeList) {
  179. let list = item.assetTypeList
  180. let len = list.length
  181. for (let i=0; i< len; i++) {
  182. if (list[i] && !list[i].asset_num) {
  183. list.splice(i, 1)
  184. i--
  185. }
  186. }
  187. }
  188. })
  189. this.cardsList = result
  190. }
  191. }
  192. })
  193. },
  194. /**
  195. * 获取说明书变更记录
  196. */
  197. getInstructionList() {
  198. let params = {
  199. getParams: {
  200. plazaId: this.plazaId,
  201. page: 1,
  202. size: 10
  203. }
  204. }
  205. getChangeList(params).then(res => {
  206. if (res.result == 'success' && res.data) {
  207. let result = res.data
  208. result.forEach(item => {
  209. item.changedate = moment.unix(item.changedate / 1000).format('YYYY.MM.DD')
  210. if (item.objtype === 0) {
  211. item.type = '专维'
  212. } else if (item.objtype === 1) {
  213. item.type = '维保'
  214. } else if (item.objtype === 2) {
  215. item.type = '第三方检测'
  216. } else {
  217. item.type = '重点关注'
  218. }
  219. })
  220. if (result && Array.isArray(result)) {
  221. this.changeList = result
  222. }
  223. }
  224. })
  225. },
  226. getItemsQuery() {
  227. let params = {
  228. getParams: {
  229. // department=部门 //部门
  230. // startDate: '20200208000000', //开始时间
  231. // endDate: '20200608000000', //结束时间
  232. plazaId: this.plazaId, //广场id 必填
  233. page: 1, //页数
  234. size: 10 //条数
  235. }
  236. }
  237. getQueryList(params).then(res => {
  238. moment().format('YYYY.MM.DD HH:mm')
  239. if (res.result == 'success') {
  240. if (res.data && Array.isArray(res.data)) {
  241. res.data.forEach(item => {
  242. item.createdate = moment.unix(item.createdate / 1000).format('YYYY.MM.DD')
  243. })
  244. this.itemsList = res.data
  245. }
  246. }
  247. })
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang='less'>
  253. .homepage {
  254. display: flex;
  255. justify-content: space-between;
  256. height: calc(100vh - 48px);
  257. padding: 15px;
  258. background: rgba(242, 245, 247, 1);
  259. overflow: auto;
  260. .homepage-cards-content {
  261. display: flex;
  262. flex-wrap: wrap;
  263. justify-content: space-between;
  264. align-content: flex-start;
  265. width: 75%;
  266. .cards-item {
  267. width: calc(50% - 5px);
  268. height: 24%;
  269. padding: 0.4rem;
  270. padding-bottom: 0;
  271. margin-bottom: 1rem;
  272. background: #fff;
  273. box-shadow: 0 2px 10px 0 rgba(31, 36, 41, 0.06);
  274. h4 {
  275. color: rgba(31, 36, 41, 1);
  276. padding: 1rem;
  277. font-size: 1.6rem;
  278. font-weight: bold;
  279. }
  280. .equipment-list {
  281. display: flex;
  282. padding:0 1rem 1.2rem;
  283. .equipment-item {
  284. width: 33.33%;
  285. padding: 0.6rem;
  286. box-sizing: border-box;
  287. border-radius: 4px;
  288. cursor: pointer;
  289. .equip-name {
  290. position: relative;
  291. display: inline-block;
  292. h5 {
  293. position: relative;
  294. color: #1f2429;
  295. font-size: 1.4rem;
  296. em {
  297. margin-left: 1rem;
  298. color: #e19e51;
  299. font-size: 1.2rem;
  300. }
  301. }
  302. .exception-number {
  303. position: absolute;
  304. right: -20%;
  305. top: -5px;
  306. height: 1.6rem;
  307. border-radius: 8rem;
  308. padding: 0.2rem 0.4rem;
  309. line-height: 1.2rem;
  310. text-align: center;
  311. font-size: 1.2rem;
  312. color: #f54e45;
  313. background: #ffe0df;
  314. }
  315. }
  316. section {
  317. display: flex;
  318. justify-content: flex-start;
  319. align-items: center;
  320. .equip-statis {
  321. .equip-number {
  322. font-size: 1.8rem;
  323. font-weight: bold;
  324. color: rgba(31, 36, 41, 1);
  325. }
  326. .equip-unit {
  327. color: #ccc;
  328. font-size: 1.2rem;
  329. }
  330. }
  331. }
  332. }
  333. .equipment-item:hover {
  334. background: #f5f6f7;
  335. }
  336. }
  337. .alert-list {
  338. display: flex;
  339. align-items: center;
  340. justify-content: flex-start;
  341. border-top: 1px solid #f5f6f7;
  342. height: 44%;
  343. border-radius: 4px;
  344. cursor: pointer;
  345. &:hover {
  346. background: #f5f6f7;
  347. }
  348. .alert-item {
  349. display: flex;
  350. width: 33.33%;
  351. align-items: center;
  352. img {
  353. width: 4rem;
  354. height: 4rem;
  355. margin:0 1rem;
  356. }
  357. .content {
  358. border-right: 1px solid #f5f6f7;
  359. padding-right: 2rem;
  360. .line {
  361. display: flex;
  362. justify-content: space-between;
  363. align-items: center;
  364. line-height: 1;
  365. span:first-child {
  366. margin-right: 1rem;
  367. font-size: 1.2rem;
  368. color: #1f2429;
  369. font-weight: bold;
  370. white-space: nowrap;
  371. }
  372. em {
  373. font-weight: normal;
  374. }
  375. em:first-child {
  376. font-size: 1.6rem;
  377. font-weight: bold;
  378. }
  379. }
  380. .desc {
  381. padding-top: 0.6rem;
  382. color: #8d9399;
  383. font-size: 1.2rem;
  384. text-align: right;
  385. white-space: nowrap;
  386. }
  387. }
  388. }
  389. }
  390. .empty-content {
  391. height: 9rem;
  392. line-height: 9rem;
  393. border-top: 1px solid #f5f6f7;
  394. text-align: center;
  395. color: #8d9399;
  396. }
  397. }
  398. }
  399. .homepage-nav-list {
  400. width: calc(25% - 10px);
  401. nav:first-child {
  402. height: 320px;
  403. }
  404. nav:last-child {
  405. height: 320px;
  406. }
  407. nav {
  408. padding: 14px 16px;
  409. margin-bottom: 10px;
  410. background: white;
  411. overflow: hidden;
  412. box-shadow: 0 2px 10px 0 rgba(31, 36, 41, 0.06);
  413. .main-title {
  414. display: flex;
  415. justify-content: space-between;
  416. margin-bottom: 12px;
  417. span:first-child {
  418. color: #1f2429;
  419. font-weight: bold;
  420. font-size: 1.4rem;
  421. }
  422. }
  423. .table {
  424. .row {
  425. display: flex;
  426. align-items: center;
  427. padding: 6px;
  428. border-bottom: 1px solid #e4e6e7;
  429. font-size: 1.4rem;
  430. article {
  431. margin-right: 10px;
  432. }
  433. article:nth-of-type(1) {
  434. width: 20%;
  435. }
  436. article:nth-of-type(2) {
  437. width: 30%;
  438. padding-left: 1.2rem;
  439. white-space: nowrap;
  440. overflow: hidden;
  441. text-overflow: ellipsis;
  442. }
  443. article:nth-of-type(3) {
  444. width: calc(50% - 30px);
  445. overflow: hidden;
  446. text-overflow: ellipsis;
  447. display: -webkit-box;
  448. -webkit-line-clamp: 2;
  449. -webkit-box-orient: vertical;
  450. }
  451. }
  452. .table-header {
  453. height: 3.2rem;
  454. padding: 6px;
  455. line-height: 3.2rem;
  456. color: #646a73;
  457. font-weight: 600;
  458. border-bottom: none;
  459. background: #f8f9fa;
  460. }
  461. .table-body {
  462. overflow: auto;
  463. }
  464. }
  465. }
  466. nav:first-child {
  467. height: 40%;
  468. .table-body {
  469. height: 27vh;
  470. }
  471. }
  472. nav:last-child {
  473. height: calc(60% - 12px);
  474. .table-body {
  475. height: 45vh;
  476. }
  477. }
  478. }
  479. }
  480. </style>