|
@@ -0,0 +1,167 @@
|
|
|
+<template>
|
|
|
+ <div class="hui-flex hui-content border-box">
|
|
|
+ <div class="hui-content-title">
|
|
|
+ <div class="hui-title-item active">公告管理</div>
|
|
|
+ </div>
|
|
|
+ <div class="hui-flex-box hui-flex hui-table">
|
|
|
+ <div class="hui-content-insert">
|
|
|
+ <el-button type="primary" size="small" @click="insert">
|
|
|
+ 新增公告
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="hui-flex-box">
|
|
|
+ <el-table :data="tableData" row-key="id" height="100%" v-loading="loading">
|
|
|
+ <el-table-column label="序号" width="50">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div style="text-align: center;">{{scope.$index + 1}}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="公告标题" prop="title"></el-table-column>
|
|
|
+ <el-table-column label="公告分类">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{$field.findTypeName('announcementType',scope.row.category)}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="优先级">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{$field.findTypeName('announcementPriority',scope.row.priority)}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="生效时间" prop="startTime"></el-table-column>
|
|
|
+ <el-table-column label="状态" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-state" v-if="!scope.row.status">
|
|
|
+ <div class="hui-state-bage hui-state-info"></div>
|
|
|
+ <div class="hui-state-label">待发布</div>
|
|
|
+ </div>
|
|
|
+ <div class="hui-state" v-else-if="scope.row.status === 1">
|
|
|
+ <div class="hui-state-bage hui-state-success"></div>
|
|
|
+ <div class="hui-state-label">已发布</div>
|
|
|
+ </div>
|
|
|
+ <div class="hui-state" v-else-if="scope.row.status === 2">
|
|
|
+ <div class="hui-state-bage hui-state-waiting"></div>
|
|
|
+ <div class="hui-state-label">已过期</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="hui-table-operation">
|
|
|
+ <span class="table-operation" @click="lookItem(scope.row)">
|
|
|
+ 详情
|
|
|
+ </span>
|
|
|
+ <span class="table-operation" @click="updateItem(scope.row)">
|
|
|
+ 编辑
|
|
|
+ </span>
|
|
|
+ <span class="table-operation" @click="deleteItem(scope.row)">
|
|
|
+ 删除
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <template slot="empty">
|
|
|
+ <el-empty description="暂无数据"></el-empty>
|
|
|
+ </template>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="hui-content-pagination">
|
|
|
+ <el-pagination :pager-count="9" layout="prev, pager, next" :page-size="pageSize" :total="totalCount"
|
|
|
+ @current-change="currentChange" background>
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px"
|
|
|
+ :append-to-body="true">
|
|
|
+ <edit v-if="visible" :isUpdate="isUpdate" @callback="callback" :detailId="detailId">
|
|
|
+ </edit>
|
|
|
+ </el-dialog>
|
|
|
+ <el-drawer title="公告详情" :visible.sync="drawer" :size="400" :append-to-body="true">
|
|
|
+ <detail v-if="drawer" :detailId="detailId" @callback="callback"></detail>
|
|
|
+ </el-drawer>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ const edit = () => import('@/components/work/organization/announcement/edit');
|
|
|
+ const detail = () => import('@/components/work/organization/announcement/detail');
|
|
|
+
|
|
|
+ import {
|
|
|
+ getAnnouncementListByQueryAndPage,
|
|
|
+ deleteAnnouncementById
|
|
|
+ } from '@/api/organization'
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ titleName: '',
|
|
|
+ tableData: [],
|
|
|
+ currPage: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ totalCount: 0,
|
|
|
+ isUpdate: false,
|
|
|
+ visible: false,
|
|
|
+ detailId: '',
|
|
|
+ filterOption: {},
|
|
|
+ loading: false,
|
|
|
+ drawer: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ let filterOption = {
|
|
|
+ organizationId: this.$store.getters.organization.id,
|
|
|
+ projectId: this.$store.getters.id
|
|
|
+ };
|
|
|
+ filterOption = Object.assign(filterOption, this.filterOption);
|
|
|
+ this.loading = true;
|
|
|
+ getAnnouncementListByQueryAndPage(this.currPage, this.pageSize, filterOption).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.tableData = res.data.dataList;
|
|
|
+ this.totalCount = res.data.totalCount;
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ currentChange(currPage) {
|
|
|
+ this.currPage = currPage;
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ insert() {
|
|
|
+ this.visible = true;
|
|
|
+ this.isUpdate = false;
|
|
|
+ },
|
|
|
+ lookItem(val) {
|
|
|
+ this.detailId = val.id;
|
|
|
+ this.drawer = true;
|
|
|
+ },
|
|
|
+ updateItem(val) {
|
|
|
+ this.detailId = val.id;
|
|
|
+ this.isUpdate = true;
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
+ deleteItem(val) {
|
|
|
+ this.$confirm('确定要删除公告?', () => {
|
|
|
+ deleteAnnouncementById(val.id).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.init();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ callback(type) {
|
|
|
+ this.visible = false;
|
|
|
+ if (type === 'init') this.init();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ edit,
|
|
|
+ detail
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+</style>
|