home-xwdt-list.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <a-list :class="$style.home" :data-source="data">
  3. <a-skeleton active :paragraph="{ rows: xwdt ? 3 : 6 }" :loading="loading" />
  4. <a-list-item slot="renderItem" slot-scope="record, index" :class="$style.items">
  5. <div
  6. custom-div
  7. :style="{ width: newsId === 'xwdt' && index === 0 ? '100%' : 'auto' }"
  8. style="display: flex; flex-flow: row wrap"
  9. >
  10. <div v-if="index === 0 && xwdt" :class="$style.firstNotice">
  11. <a-row v-if="imgdata.length > 0" :gutter="24" :class="$style.maint" style="height: 200px">
  12. <a-col v-for="(img, index) in imgdata" :key="index" :span="12">
  13. <img
  14. :class="['previewimg', $style.tpxwimg]"
  15. :src="
  16. `api/flow-mobile/v1/task-form-process/download-attachments/${img[0].code}`
  17. | sdResource
  18. "
  19. @click="
  20. () => {
  21. openUrl(getArticleUrl('', img))
  22. }
  23. "
  24. />
  25. </a-col>
  26. </a-row>
  27. </div>
  28. <template v-if="index === 0 && xwdt">
  29. <div :class="$style.list" style="padding-top: 20px">
  30. <a-list-item-meta>
  31. <a
  32. slot="title"
  33. :href="getArticleUrl(type, record)"
  34. target="_blank"
  35. rel="opener"
  36. :title="record.title"
  37. >
  38. <a-badge color="blue" :text="record.title" />
  39. </a>
  40. </a-list-item-meta>
  41. <div :class="$style.dates">{{ moment(record.finishTime).format('YYYY-MM-DD') }}</div>
  42. </div>
  43. </template>
  44. </div>
  45. <template v-if="index !== 0 || !xwdt">
  46. <div :class="$style.list">
  47. <a-list-item-meta>
  48. <a
  49. slot="title"
  50. :href="getArticleUrl(type, record)"
  51. target="_blank"
  52. rel="opener"
  53. :title="record.title"
  54. >
  55. <a-badge color="blue" :text="record.title" />
  56. </a>
  57. </a-list-item-meta>
  58. <div :class="$style.dates">{{ moment(record.finishTime).format('YYYY-MM-DD') }}</div>
  59. </div>
  60. </template>
  61. </a-list-item>
  62. <a-empty v-if="isempty" :class="$style.emptySize">
  63. <a-icon slot="image" type="sd-notebook3" />
  64. </a-empty>
  65. </a-list>
  66. </template>
  67. <script>
  68. import moment from 'moment'
  69. import homepageService from './homepage-service'
  70. import components from './_import-components/home-xwdt-list-import'
  71. import axios from '@/common/services/axios-instance'
  72. export default {
  73. name: 'HomeXwdtList',
  74. components,
  75. props: {
  76. type: {
  77. default: '',
  78. type: String,
  79. },
  80. newsId: {
  81. default: '',
  82. type: String,
  83. },
  84. xwdt: {
  85. default: false,
  86. type: Boolean,
  87. },
  88. maxResults: {
  89. default: 6,
  90. type: Number,
  91. },
  92. },
  93. data() {
  94. return {
  95. loading: false,
  96. data: [],
  97. imgdata: [],
  98. skeletonLoading: true,
  99. isempty: false,
  100. moment,
  101. }
  102. },
  103. mounted() {
  104. this.loading = true
  105. this.getNewsList({ articleBusinessType: this.type, maxResults: this.maxResults })
  106. },
  107. methods: {
  108. getArticleUrl(type, record) {
  109. if (type === 'getKmKnowledges') {
  110. return `?#/km-knowledage-view?id=${record.id}&title=${record.title}`
  111. } else if (type === 'getLawInstitutions') {
  112. if (record.attribute === 'laws') {
  113. // return `?#/iam-audit-auditsource-law-form?record=${record.id}`
  114. return `?#/iam-audit-home-three?type=laws&id=${record.id}`
  115. } else {
  116. // return `?#/iam-audit-auditsource-institution-form?record=${record.id}`
  117. return `?#/iam-audit-home-three?type=nbzd&id=${record.id}`
  118. }
  119. } else {
  120. // return `?#/sd-webflow/done-pages/${record.instId}`
  121. return `?#/iam-audit-home-three?type=xwdt&id=${record.instId}`
  122. }
  123. },
  124. // 降序函数 封装
  125. Desc(arr, StrKey) {
  126. var desc = function (x, y) {
  127. return x[StrKey] < y[StrKey] ? 1 : -1
  128. }
  129. return arr.sort(desc)
  130. },
  131. getNewsList(params) {
  132. this.loading = true
  133. homepageService.getNews(params).then((res) => {
  134. this.loading = false
  135. if (res) {
  136. if (this.newsId === 'xwdt') {
  137. if (res.data['02'].length) {
  138. res.data['02'].forEach((item) => {
  139. item.finishTime = item.finishdate
  140. })
  141. this.data = res.data['02'].splice(0, this.maxResults)
  142. } else {
  143. this.isempty = true
  144. }
  145. if (res.data['01']) {
  146. if (res.data['01'].length) {
  147. this.imgdata = []
  148. res.data['01'].forEach((item) => {
  149. this.fngetattachment(
  150. item.thumbnail,
  151. 'entity:iamAuditInformation',
  152. '',
  153. item.instId
  154. )
  155. })
  156. }
  157. }
  158. } else {
  159. if (res.data.length) {
  160. if (this.type === 'getLawInstitutions') {
  161. res.data.forEach((item) => {
  162. item.title = item.docTitle
  163. item.finishTime = moment(item.publishTime).format('YYYY-MM-DD')
  164. })
  165. } else {
  166. res.data.forEach((item) => {
  167. // item.title = item.docTitle
  168. item.finishTime = moment(item.lastModifiedTime).format('YYYY-MM-DD')
  169. })
  170. }
  171. this.data = res.data.splice(0, this.maxResults)
  172. } else {
  173. this.isempty = true
  174. }
  175. }
  176. } else {
  177. this.isempty = true
  178. }
  179. })
  180. },
  181. fngetattachment(id, formId, beanId, instId) {
  182. return axios
  183. .get(`api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${id}`, {
  184. params: {
  185. formId: formId,
  186. beanId: beanId,
  187. instId: instId,
  188. },
  189. })
  190. .then((res) => {
  191. this.imgdata.push({ ...res.data, instId: instId })
  192. })
  193. },
  194. openUrl(url) {
  195. window.open(url)
  196. },
  197. },
  198. }
  199. </script>
  200. <style module lang="scss">
  201. @use '@/common/design' as *;
  202. $importcolor: #e02020;
  203. $importsize: 28px;
  204. $lineheight: 28px;
  205. $fonsicon-bg: 48px;
  206. $nodata-icon: #d9d9d9;
  207. .home {
  208. :global(.ant-table-placeholder) {
  209. border: 0;
  210. }
  211. .first-notice {
  212. height: 150px;
  213. width: 100%;
  214. text-align: center;
  215. overflow: hidden;
  216. text-overflow: ellipsis;
  217. a {
  218. overflow: hidden;
  219. font-size: $importsize;
  220. font-weight: bold;
  221. color: $importcolor;
  222. text-overflow: ellipsis;
  223. white-space: nowrap;
  224. }
  225. .detail {
  226. max-height: 60px;
  227. overflow: hidden;
  228. line-height: $lineheight;
  229. }
  230. }
  231. .items {
  232. border-bottom: none;
  233. .list {
  234. display: flex;
  235. align-items: center;
  236. justify-content: space-between;
  237. width: 100%;
  238. :global(.ant-list-item-meta) {
  239. display: block;
  240. flex: inherit;
  241. width: calc(100% - 100px);
  242. }
  243. :global(.ant-badge) {
  244. display: inline-block;
  245. max-width: calc(100% - 50px);
  246. overflow: hidden;
  247. text-overflow: ellipsis;
  248. white-space: nowrap;
  249. vertical-align: middle;
  250. }
  251. }
  252. .dates {
  253. min-width: 90px;
  254. }
  255. }
  256. :global(.ant-tag) {
  257. margin-left: 10px;
  258. }
  259. :global(.ant-badge-status-primary) {
  260. background-color: $primary-color;
  261. }
  262. :global(.ant-badge-status-dot) {
  263. width: 10px;
  264. height: 10px;
  265. }
  266. :global(.ant-badge-status-text) {
  267. font-size: $font-size-lg;
  268. }
  269. }
  270. .empty-size {
  271. margin: 10% 0;
  272. :global(.ant-empty-image) {
  273. height: 50px;
  274. i {
  275. height: 100%;
  276. font-size: $fonsicon-bg;
  277. color: $nodata-icon;
  278. }
  279. }
  280. }
  281. .tpxwimg {
  282. width: 340px !important;
  283. cursor: pointer;
  284. }
  285. @media screen and (min-width: 1920px) {
  286. .items {
  287. padding: 12px 0;
  288. }
  289. }
  290. @media screen and (min-width: 1440px) and (max-width: 1599px) {
  291. .items {
  292. padding: 10px 0;
  293. }
  294. }
  295. @media screen and (min-width: 1600px) and (max-width: 1919px) {
  296. .items {
  297. padding: 10px 0;
  298. }
  299. }
  300. @media screen and (min-width: 992px) and (max-width: 1439px) {
  301. .items {
  302. padding: 8px 0;
  303. }
  304. }
  305. </style>