Files
dvcp_v2_webapp/packages/wxwork/AppNotification/components/manageDetail.vue

205 lines
5.9 KiB
Vue
Raw Normal View History

2021-12-14 18:36:19 +08:00
<template>
<ai-detail>
<template slot="title">
<ai-title title="公告详情" isShowBack isShowBottomBorder @onBackClick="$parent.goBack"></ai-title>
</template>
<template #content>
<ai-sidebar v-model="index" :tabTitle="tabTitle" @change="onChange"></ai-sidebar>
<template v-if="index==0">
<ai-card :title="detailObj.title" class="title">
<template #content>
<el-row type="flex" justify="space-between" class="info">
2022-01-25 17:06:41 +08:00
<span>时间{{ detailObj.releaseTime }}</span>
2021-12-14 18:36:19 +08:00
<span style="display:flex">发布单位
2022-01-04 18:38:27 +08:00
<span v-text="detailObj.unitName"/>
2021-12-14 18:36:19 +08:00
</span>
<span style="display:flex">发布人
2022-01-04 18:38:27 +08:00
<span v-text="detailObj.releaseUserName"/>
2021-12-14 18:36:19 +08:00
</span>
</el-row>
<div v-html="detailObj.content" style="margin: 20px 0;"></div>
</template>
</ai-card>
<ai-card title="附件" v-if="detailObj.files && detailObj.files.length">
<template #right>
<span class="Edit" @click="downFileAll"><i class="iconfont iconDownload"></i>下载全部</span>
</template>
<template #content>
2022-01-25 17:06:41 +08:00
<ai-file-list :fileList="detailObj.files" :fileOps="{ name: 'fileName', size: 'size' }"></ai-file-list>
2021-12-14 18:36:19 +08:00
</template>
</ai-card>
</template>
<template v-else>
<ai-list>
<template #content>
<ai-search-bar>
<template #left>
<ai-select
2022-01-25 17:06:41 +08:00
v-model="search.readStatus"
@change="search.current=1,getList()"
placeholder="查阅状态"
:selectList="dict.getDict('announcementReadStatus')"
2021-12-14 18:36:19 +08:00
></ai-select>
</template>
<template #right>
<el-input v-model="search.readUserName" @keyup.enter.native="getList()" placeholder="姓名"
2022-01-25 17:06:41 +08:00
size="small" suffix-icon="iconfont iconSearch" clearable
@clear="search.current=1,getList()"></el-input>
2021-12-14 18:36:19 +08:00
</template>
</ai-search-bar>
<ai-table
2022-01-25 17:06:41 +08:00
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
2021-12-14 18:36:19 +08:00
<el-table-column slot="readUserName" label="姓名" align="center">
<template slot-scope="{ row }">
2022-01-04 18:38:27 +08:00
<span v-text="row.readUserName"/>
2021-12-14 18:36:19 +08:00
</template>
</el-table-column>
<el-table-column slot="unitName" label="所属部门" align="center">
<template slot-scope="{ row }">
2022-01-04 18:38:27 +08:00
<span v-text="row.unitName"/>
2021-12-14 18:36:19 +08:00
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
</template>
</ai-detail>
</template>
<script>
2022-01-25 17:06:41 +08:00
export default {
name: "manageDetail",
props: {
instance: Function,
dict: Object,
detail: Object
},
data() {
return {
index: 0,
tableData: [],
total: 0,
detailObj: {},
search: {
current: 1,
size: 10
}
}
},
computed: {
tabTitle() {
return ["公告详情", "查询情况"];
2021-12-14 18:36:19 +08:00
},
2022-01-25 17:06:41 +08:00
colConfigs() {
return [
{slot: "readUserName"},
{prop: "readUserPhone", label: "手机号", align: "center"},
{slot: "unitName"},
{
prop: "readStatus", label: "查阅状态", align: "center",
render: (h, {row}) => [<span
style={{color: this.dict.getColor("announcementReadStatus", row.readStatus)}}>{this.dict.getLabel("announcementReadStatus", row.readStatus)}</span>]
},
];
}
},
methods: {
downFileAll() {
if (this.detailObj.files.length > 0) {
this.instance.post('/app/appannouncement/downLoadAllFileForDetail', null, {
responseType: 'blob',
params: {
id: this.detailObj.id
}
}).then((res) => {
const link = document.createElement('a')
let blob = new Blob([res], {type: 'application/octet-stream'})
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
var num = ''
for (let i = 0; i < 10; i++) {
num += Math.ceil(Math.random() * 10)
}
link.setAttribute('download', '公告文件' + '.zip')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
} else {
this.$message.error('暂无附件提供下载')
2021-12-14 18:36:19 +08:00
}
},
2022-01-25 17:06:41 +08:00
onChange(val) {
if (val == 0) {
this.getDetail();
} else {
this.getList();
2021-12-14 18:36:19 +08:00
}
},
2022-01-25 17:06:41 +08:00
getDetail() {
this.instance.post("/app/appannouncement/detail", null, {
params: {
id: this.detail.id
2021-12-14 18:36:19 +08:00
}
2022-01-25 17:06:41 +08:00
}).then(res => {
if (res && res.data) {
this.detailObj = res.data;
2021-12-14 18:36:19 +08:00
}
2022-01-25 17:06:41 +08:00
})
2021-12-14 18:36:19 +08:00
},
2022-01-25 17:06:41 +08:00
getList() {
this.instance.post("/app/appannouncementreader/list", null, {
params: {
announcementId: this.detail.id,
...this.search
}
}).then(res => {
if (res && res.data) {
this.tableData = res.data.records;
this.total = res.data.total;
}
})
},
},
created() {
this.dict.load("announcementReadStatus").then(this.getDetail);
2021-12-14 18:36:19 +08:00
}
2022-01-25 17:06:41 +08:00
}
2021-12-14 18:36:19 +08:00
</script>
<style lang="scss" scoped>
2022-01-25 17:06:41 +08:00
::v-deep .title {
.aibar-left {
width: 100%;
text-align: center;
2021-12-14 18:36:19 +08:00
}
2022-01-25 17:06:41 +08:00
}
.file {
height: 40px;
line-height: 40px;
padding: 0 8px;
font-size: 14px;
color: #333;
background: #fff;
border-radius: 4px;
border: 1px solid #d0d4dc;
margin-bottom: 16px;
cursor: pointer;
}
2021-12-14 18:36:19 +08:00
2022-01-25 17:06:41 +08:00
.info {
& > span {
2021-12-14 18:36:19 +08:00
font-size: 14px;
color: #333;
}
2022-01-25 17:06:41 +08:00
}
2021-12-14 18:36:19 +08:00
</style>