123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <!-- 订单 -->
- <template>
- <div class="order">
- <template v-if="!addOrUpdateVisible">
- <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
- <el-form-item label="标题">
- <el-input v-model="dataForm.title" clearable/>
- </el-form-item>
- <el-form-item>
- <el-button @click="queryData()">查询</el-button>
- </el-form-item>
- </el-form>
- <el-table
- :data="dataList"
- border
- v-loading="dataListLoading"
- @selection-change="selectionChangeHandle"
- style="width: 100%;">
- <el-table-column
- label="序号"
- type="index"
- width="50"
- align="center">
- </el-table-column>
- <el-table-column
- prop="title"
- header-align="center"
- align="center"
- width="180"
- :show-tooltip-when-overflow="true"
- label="公告主题名称">
- </el-table-column>
- <el-table-column
- prop="levelName"
- header-align="center"
- align="center"
- label="级别">
- </el-table-column>
- <el-table-column
- prop="content"
- header-align="center"
- align="center"
- width="200"
- :show-tooltip-when-overflow="true"
- label="公告内容">
- </el-table-column>
- <el-table-column
- prop="attachList"
- header-align="center"
- align="center"
- min-width="200"
- label="附件">
- <template slot-scope="scope">
- <div v-for="(item, index) in scope.row.attachList" style="display: inline">
- <span v-if="index > 0">,</span>
- <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- prop="isRead"
- header-align="center"
- align="center"
- label="是否已读">
- <template slot-scope="scope">
- <span v-if="Number(scope.row.isRead) === 0" style="color: red">未读</span>
- <span v-else>已读</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="publisherName"
- header-align="center"
- align="center"
- label="发布人">
- </el-table-column>
- <el-table-column
- prop="createTime"
- header-align="center"
- align="center"
- width="160"
- label="发布时间">
- </el-table-column>
- <el-table-column
- prop="notes"
- header-align="center"
- align="center"
- width="200"
- :show-tooltip-when-overflow="true"
- label="备注">
- </el-table-column>
- <el-table-column
- fixed="right"
- header-align="center"
- align="center"
- width="150"
- label="操作">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="sizeChangeHandle"
- @current-change="currentChangeHandle"
- :current-page="pageIndex"
- :page-sizes="[10, 20, 50, 100]"
- :page-size="pageSize"
- :total="totalPage"
- layout="total, sizes, prev, pager, next, jumper">
- </el-pagination>
- </template>
- <!-- 弹窗,详情 -->
- <detail v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getAnnouncementList" @onChose="onChose"></detail>
- <!-- 文件预览 -->
- <preview-component v-if="previewVisible" ref="preview"/>
- </div>
- </template>
- <script>
- import Detail from './announcement-detail'
- import { getAnnouncementList } from '@/api/msg'
- import { getCusList } from '@/api/cus'
- import { downloadUrl } from '@/api/file'
- import {readNotice} from '@/utils/msg'
- import PreviewComponent from '../common/preview-component'
- export default {
- name: 'announcement',
- components: {
- PreviewComponent,
- Detail
- },
- created () {
- this.optionsState = this.$store.state.common.approveStates
- this.queryData()
- },
- computed: {
- // 监听消息ID
- listenNotice () {
- return this.$route.params.notice
- }
- },
- watch: {
- listenNotice: function (notice) {
- console.log('notice = ' + JSON.stringify(notice))
- if (!notice) return
- this.dataForm.noticeId = notice.noticeId
- this.dataForm.businessId = notice.businessId
- this.queryData()
- }
- },
- data () {
- return {
- addOrUpdateVisible: false,
- previewVisible: false,
- dataForm: {},
- dataList: [],
- pageIndex: 1,
- pageSize: 10,
- totalPage: 0,
- downloadUrl: downloadUrl,
- dataListLoading: false,
- dataListSelections: [],
- optionsState: [],
- optionsCustomer: []
- }
- },
- methods: {
- onChose () {
- this.addOrUpdateVisible = false
- },
- // 查询
- queryData () {
- this.pageIndex = 1
- this.getAnnouncementList()
- },
- // 获取数据列表
- getAnnouncementList () {
- this.dataList = []
- this.dataListLoading = true
- let params = {
- 'current': this.pageIndex,
- 'size': this.pageSize,
- 'createTime': this.dataForm.createTime ? this.dataForm.createTime : null,
- 'state': this.dataForm.state ? this.dataForm.state : null,
- 'businessId': this.dataForm.businessId ? this.dataForm.businessId : null
- }
- getAnnouncementList(params).then(({data}) => {
- if (data && data.code === '200') {
- this.dataList = data.data.records
- this.totalPage = Number(data.data.total)
- } else {
- this.dataList = []
- this.totalPage = 0
- }
- this.dataListLoading = false
- })
- },
- // 每页数
- sizeChangeHandle (val) {
- this.pageSize = val
- this.pageIndex = 1
- this.getAnnouncementList()
- },
- // 当前页
- currentChangeHandle (val) {
- this.pageIndex = val
- this.getAnnouncementList()
- },
- // 多选
- selectionChangeHandle (val) {
- this.dataListSelections = val
- },
- // 远程方法:获取客户列表
- async remoteCustomer (query) {
- if (!query) {
- query = ''
- }
- await getCusList({'customerName': query}).then(({data}) => {
- if (data && data.code === '200') {
- this.optionsCustomer = []
- data.data.records.forEach((item) => {
- this.optionsCustomer.push({
- code: item.customerId,
- value: item.customerName
- })
- })
- }
- })
- },
- // 详情
- detailHandle (row) {
- this.addOrUpdateVisible = true
- this.$nextTick(() => {
- this.$refs.addOrUpdate.init(row.noticeId)
- })
- if (row.noticeId) {
- readNotice(this, row.noticeId)
- }
- },
- // 预览
- previewFile (fileName, url) {
- this.previewVisible = true
- this.$nextTick(() => {
- this.$refs.preview.init(fileName, url)
- })
- }
- }
- }
- </script>
- <style scoped>
- </style>
|