home-tzgg-list.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <a-list :class="$style.home" :data-source="data">
  3. <a-skeleton active :paragraph="{ rows: 4 }" :loading="loading" />
  4. <a-list-item slot="renderItem" slot-scope="record, index" :class="$style.items">
  5. <template>
  6. <div :class="$style.list">
  7. <div :class="$style.dates">
  8. <span style="font-size: 22px">{{ moment(record.finishTime).format('DD') }}</span
  9. ><br />
  10. <span>{{ moment(record.finishTime).format('YYYY-MM') }}</span>
  11. </div>
  12. <a-list-item-meta :description="''">
  13. <a
  14. slot="title"
  15. :href="getArticleUrl(type, record)"
  16. target="_blank"
  17. rel="opener"
  18. :title="record.title"
  19. >
  20. {{ record.title }}
  21. </a>
  22. </a-list-item-meta>
  23. </div>
  24. </template>
  25. </a-list-item>
  26. <a-empty v-if="isempty" :class="$style.emptySize">
  27. <a-icon slot="image" type="sd-notebook3" />
  28. </a-empty>
  29. </a-list>
  30. </template>
  31. <script>
  32. import moment from 'moment'
  33. import homepageService from './homepage-service'
  34. import components from './_import-components/home-tzgg-list-import'
  35. export default {
  36. name: 'HomeTzggList',
  37. components,
  38. props: {
  39. type: {
  40. default: '',
  41. type: String,
  42. },
  43. newsId: {
  44. default: '',
  45. type: String,
  46. },
  47. maxResults: {
  48. default: 6,
  49. type: Number,
  50. },
  51. },
  52. data() {
  53. return {
  54. loading: false,
  55. data: [],
  56. skeletonLoading: true,
  57. isempty: false,
  58. moment,
  59. }
  60. },
  61. mounted() {
  62. this.loading = true
  63. this.getNewsList({ articleBusinessType: this.type, maxResults: this.maxResults })
  64. },
  65. methods: {
  66. getArticleUrl(type, record) {
  67. // return `?#/sd-webflow/done-pages/${record.instId}`
  68. return `?#/iam-audit-home-three?type=${this.newsId}&id=${record.instId}`
  69. },
  70. // 降序函数 封装
  71. Desc(arr, StrKey) {
  72. var desc = function(x, y) {
  73. return x[StrKey] < y[StrKey] ? 1 : -1
  74. }
  75. return arr.sort(desc)
  76. },
  77. getNewsList(params) {
  78. this.loading = true
  79. const Num = 0
  80. const regex = /(<([^>]+)>)/gi
  81. homepageService.getNews(params).then((res) => {
  82. this.loading = false
  83. if (res) {
  84. if (this.newsId === 'tzgg') {
  85. if (res.data['03'].length) {
  86. res.data['03'].forEach((item) => {
  87. item.finishTime = item.finishdate
  88. let content = item.inforDescription
  89. if (content !== null) {
  90. content = content.replace(regex, '')
  91. content = content.replace(/&nbsp;/g, '')
  92. item.content = content
  93. } else {
  94. item.content = ''
  95. }
  96. })
  97. this.data = res.data['03'].splice(0, this.maxResults)
  98. } else {
  99. this.isempty = true
  100. }
  101. } else if (this.newsId === 'gxjb') {
  102. if (res.data['05'].length) {
  103. res.data['05'].forEach((item) => {
  104. item.finishTime = item.finishdate
  105. let content = item.inforDescription
  106. if (content !== null) {
  107. content = content.replace(regex, '')
  108. content = content.replace(/&nbsp;/g, '')
  109. item.content = content
  110. } else {
  111. item.content = ''
  112. }
  113. })
  114. this.data = res.data['05'].splice(0, this.maxResults)
  115. } else {
  116. this.isempty = true
  117. }
  118. } else {
  119. if (res.data.length) {
  120. if (this.type === 'getLawInstitutions') {
  121. res.data.forEach((item) => {
  122. item.title = item.docTitle
  123. item.finishTime = moment(item.publishTime).format('YYYY-MM-DD')
  124. })
  125. } else {
  126. res.data.forEach((item) => {
  127. item.finishTime = moment(item.lastModifiedTime).format('YYYY-MM-DD')
  128. })
  129. }
  130. this.data = res.data.splice(0, this.maxResults)
  131. } else {
  132. this.isempty = true
  133. }
  134. }
  135. } else {
  136. this.isempty = true
  137. }
  138. })
  139. },
  140. },
  141. }
  142. </script>
  143. <style module lang="scss">
  144. @use '@/common/design' as *;
  145. $importcolor: #e02020;
  146. $importsize: 28px;
  147. $lineheight: 28px;
  148. $fonsicon-bg: 48px;
  149. $nodata-icon: #d9d9d9;
  150. .home {
  151. :global(.ant-table-placeholder) {
  152. border: 0;
  153. }
  154. .first-notice {
  155. max-width: 90%;
  156. overflow: hidden;
  157. text-overflow: ellipsis;
  158. a {
  159. overflow: hidden;
  160. font-size: $importsize;
  161. font-weight: bold;
  162. color: $importcolor;
  163. text-overflow: ellipsis;
  164. white-space: nowrap;
  165. }
  166. .detail {
  167. max-height: 60px;
  168. overflow: hidden;
  169. line-height: $lineheight;
  170. }
  171. }
  172. .items {
  173. border-bottom: none;
  174. .list {
  175. display: flex;
  176. align-items: center;
  177. justify-content: space-between;
  178. width: 100%;
  179. :global(.ant-list-item-meta) {
  180. display: block;
  181. flex: inherit;
  182. width: calc(100% - 100px);
  183. }
  184. :global(.ant-badge) {
  185. display: inline-block;
  186. max-width: calc(100% - 50px);
  187. overflow: hidden;
  188. text-overflow: ellipsis;
  189. white-space: nowrap;
  190. vertical-align: middle;
  191. }
  192. }
  193. .dates {
  194. min-width: 80px;
  195. margin-left: 10px;
  196. text-align: center;
  197. border: 1px solid #e8e8e8;
  198. border-radius: 10px;
  199. }
  200. }
  201. :global(.ant-tag) {
  202. margin-left: 10px;
  203. }
  204. :global(.ant-badge-status-primary) {
  205. background-color: $primary-color;
  206. }
  207. :global(.ant-badge-status-dot) {
  208. width: 10px;
  209. height: 10px;
  210. }
  211. :global(.ant-badge-status-text) {
  212. font-size: $font-size-lg;
  213. }
  214. }
  215. .empty-size {
  216. margin: 10% 0;
  217. :global(.ant-empty-image) {
  218. height: 50px;
  219. i {
  220. height: 100%;
  221. font-size: $fonsicon-bg;
  222. color: $nodata-icon;
  223. }
  224. }
  225. }
  226. @media screen and (min-width: 1920px) {
  227. .items {
  228. padding: 12px 0;
  229. }
  230. }
  231. @media screen and (min-width: 1440px) and (max-width: 1599px) {
  232. .items {
  233. padding: 10px 0;
  234. }
  235. }
  236. @media screen and (min-width: 1600px) and (max-width: 1919px) {
  237. .items {
  238. padding: 10px 0;
  239. }
  240. }
  241. @media screen and (min-width: 992px) and (max-width: 1439px) {
  242. .items {
  243. padding: 8px 0;
  244. }
  245. }
  246. </style>