123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <template>
- <a-list :class="$style.home" :data-source="data">
- <a-skeleton active :paragraph="{ rows: xwdt ? 3 : 6 }" :loading="loading" />
- <a-list-item slot="renderItem" slot-scope="record, index" :class="$style.items">
- <div
- custom-div
- :style="{ width: newsId === 'xwdt' && index === 0 ? '100%' : 'auto' }"
- style="display: flex; flex-flow: row wrap"
- >
- <div v-if="index === 0 && xwdt" :class="$style.firstNotice">
- <a-row v-if="imgdata.length > 0" :gutter="24" :class="$style.maint" style="height: 200px">
- <a-col v-for="(img, index) in imgdata" :key="index" :span="12">
- <img
- :class="['previewimg', $style.tpxwimg]"
- :src="
- `api/flow-mobile/v1/task-form-process/download-attachments/${img[0].code}`
- | sdResource
- "
- @click="
- () => {
- openUrl(getArticleUrl('', img))
- }
- "
- />
- </a-col>
- </a-row>
- </div>
- <template v-if="index === 0 && xwdt">
- <div :class="$style.list" style="padding-top: 20px">
- <a-list-item-meta>
- <a
- slot="title"
- :href="getArticleUrl(type, record)"
- target="_blank"
- rel="opener"
- :title="record.title"
- >
- <a-badge color="blue" :text="record.title" />
- </a>
- </a-list-item-meta>
- <div :class="$style.dates">{{ moment(record.finishTime).format('YYYY-MM-DD') }}</div>
- </div>
- </template>
- </div>
- <template v-if="index !== 0 || !xwdt">
- <div :class="$style.list">
- <a-list-item-meta>
- <a
- slot="title"
- :href="getArticleUrl(type, record)"
- target="_blank"
- rel="opener"
- :title="record.title"
- >
- <a-badge color="blue" :text="record.title" />
- </a>
- </a-list-item-meta>
- <div :class="$style.dates">{{ moment(record.finishTime).format('YYYY-MM-DD') }}</div>
- </div>
- </template>
- </a-list-item>
- <a-empty v-if="isempty" :class="$style.emptySize">
- <a-icon slot="image" type="sd-notebook3" />
- </a-empty>
- </a-list>
- </template>
- <script>
- import moment from 'moment'
- import homepageService from './homepage-service'
- import components from './_import-components/home-xwdt-list-import'
- import axios from '@/common/services/axios-instance'
- export default {
- name: 'HomeXwdtList',
- components,
- props: {
- type: {
- default: '',
- type: String,
- },
- newsId: {
- default: '',
- type: String,
- },
- xwdt: {
- default: false,
- type: Boolean,
- },
- maxResults: {
- default: 6,
- type: Number,
- },
- },
- data() {
- return {
- loading: false,
- data: [],
- imgdata: [],
- skeletonLoading: true,
- isempty: false,
- moment,
- }
- },
- mounted() {
- this.loading = true
- this.getNewsList({ articleBusinessType: this.type, maxResults: this.maxResults })
- },
- methods: {
- getArticleUrl(type, record) {
- if (type === 'getKmKnowledges') {
- return `?#/km-knowledage-view?id=${record.id}&title=${record.title}`
- } else if (type === 'getLawInstitutions') {
- if (record.attribute === 'laws') {
- // return `?#/iam-audit-auditsource-law-form?record=${record.id}`
- return `?#/iam-audit-home-three?type=laws&id=${record.id}`
- } else {
- // return `?#/iam-audit-auditsource-institution-form?record=${record.id}`
- return `?#/iam-audit-home-three?type=nbzd&id=${record.id}`
- }
- } else {
- // return `?#/sd-webflow/done-pages/${record.instId}`
- return `?#/iam-audit-home-three?type=xwdt&id=${record.instId}`
- }
- },
- // 降序函数 封装
- Desc(arr, StrKey) {
- var desc = function (x, y) {
- return x[StrKey] < y[StrKey] ? 1 : -1
- }
- return arr.sort(desc)
- },
- getNewsList(params) {
- this.loading = true
- homepageService.getNews(params).then((res) => {
- this.loading = false
- if (res) {
- if (this.newsId === 'xwdt') {
- if (res.data['02'].length) {
- res.data['02'].forEach((item) => {
- item.finishTime = item.finishdate
- })
- this.data = res.data['02'].splice(0, this.maxResults)
- } else {
- this.isempty = true
- }
- if (res.data['01']) {
- if (res.data['01'].length) {
- this.imgdata = []
- res.data['01'].forEach((item) => {
- this.fngetattachment(
- item.thumbnail,
- 'entity:iamAuditInformation',
- '',
- item.instId
- )
- })
- }
- }
- } else {
- if (res.data.length) {
- if (this.type === 'getLawInstitutions') {
- res.data.forEach((item) => {
- item.title = item.docTitle
- item.finishTime = moment(item.publishTime).format('YYYY-MM-DD')
- })
- } else {
- res.data.forEach((item) => {
- // item.title = item.docTitle
- item.finishTime = moment(item.lastModifiedTime).format('YYYY-MM-DD')
- })
- }
- this.data = res.data.splice(0, this.maxResults)
- } else {
- this.isempty = true
- }
- }
- } else {
- this.isempty = true
- }
- })
- },
- fngetattachment(id, formId, beanId, instId) {
- return axios
- .get(`api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${id}`, {
- params: {
- formId: formId,
- beanId: beanId,
- instId: instId,
- },
- })
- .then((res) => {
- this.imgdata.push({ ...res.data, instId: instId })
- })
- },
- openUrl(url) {
- window.open(url)
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- $importcolor: #e02020;
- $importsize: 28px;
- $lineheight: 28px;
- $fonsicon-bg: 48px;
- $nodata-icon: #d9d9d9;
- .home {
- :global(.ant-table-placeholder) {
- border: 0;
- }
- .first-notice {
- height: 150px;
- width: 100%;
- text-align: center;
- overflow: hidden;
- text-overflow: ellipsis;
- a {
- overflow: hidden;
- font-size: $importsize;
- font-weight: bold;
- color: $importcolor;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .detail {
- max-height: 60px;
- overflow: hidden;
- line-height: $lineheight;
- }
- }
- .items {
- border-bottom: none;
- .list {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- :global(.ant-list-item-meta) {
- display: block;
- flex: inherit;
- width: calc(100% - 100px);
- }
- :global(.ant-badge) {
- display: inline-block;
- max-width: calc(100% - 50px);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- vertical-align: middle;
- }
- }
- .dates {
- min-width: 90px;
- }
- }
- :global(.ant-tag) {
- margin-left: 10px;
- }
- :global(.ant-badge-status-primary) {
- background-color: $primary-color;
- }
- :global(.ant-badge-status-dot) {
- width: 10px;
- height: 10px;
- }
- :global(.ant-badge-status-text) {
- font-size: $font-size-lg;
- }
- }
- .empty-size {
- margin: 10% 0;
- :global(.ant-empty-image) {
- height: 50px;
- i {
- height: 100%;
- font-size: $fonsicon-bg;
- color: $nodata-icon;
- }
- }
- }
- .tpxwimg {
- width: 340px !important;
- cursor: pointer;
- }
- @media screen and (min-width: 1920px) {
- .items {
- padding: 12px 0;
- }
- }
- @media screen and (min-width: 1440px) and (max-width: 1599px) {
- .items {
- padding: 10px 0;
- }
- }
- @media screen and (min-width: 1600px) and (max-width: 1919px) {
- .items {
- padding: 10px 0;
- }
- }
- @media screen and (min-width: 992px) and (max-width: 1439px) {
- .items {
- padding: 8px 0;
- }
- }
- </style>
|