index.vue 17 KB

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