123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- <template>
- <div class="auxiliary-notice-container layout-pd">
- <el-card shadow="never">
- <el-tabs v-model="listType" @tab-change="queryList">
- <el-tab-pane name="0" label="通知"></el-tab-pane>
- <el-tab-pane name="1" label="公告"></el-tab-pane>
- </el-tabs>
- <el-form :model="state.queryParams" ref="ruleFormRef" :inline="true" @submit.native.prevent class="mt10">
- <el-form-item label="标题" prop="Title">
- <el-input v-model="state.queryParams.Title" placeholder="标题" clearable @keyup.enter="queryList" style="width: 250px" />
- </el-form-item>
- <template v-if="listType === '0'">
- <el-form-item label="通知类型" prop="CircularTypeId">
- <el-select v-model="state.queryParams.CircularTypeId" placeholder="请选择通知类型">
- <el-option v-for="item in circularType" :value="item.dicDataValue" :key="item.dicDataValue" :label="item.dicDataName" />
- </el-select>
- </el-form-item>
- <el-form-item label="通知时间" prop="exTime">
- <el-date-picker
- v-model="state.queryParams.exTime"
- type="datetimerange"
- unlink-panels
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- :shortcuts="shortcuts"
- @change="timeStartChangeCr"
- value-format="YYYY-MM-DD[T]HH:mm:ss"
- />
- </el-form-item>
- </template>
- <template v-else>
- <el-form-item label="公告类型" prop="BulletinTypeId">
- <el-select v-model="state.queryParams.BulletinTypeId" placeholder="请选择公告类型">
- <el-option v-for="item in bulletinType" :value="item.dicDataValue" :key="item.dicDataValue" :label="item.dicDataName" />
- </el-select>
- </el-form-item>
- <el-form-item label="公告时间" prop="Time">
- <el-date-picker
- v-model="state.queryParams.Time"
- type="datetimerange"
- unlink-panels
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- :shortcuts="shortcuts"
- @change="timeStartChange"
- value-format="YYYY-MM-DD[T]HH:mm:ss"
- />
- </el-form-item>
- </template>
- <el-form-item>
- <el-button type="primary" @click="queryList" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
- <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
- </el-form-item>
- </el-form>
- <div class="mb20">
- <el-button type="primary" @click="onNoticeAdd('0')" v-if="listType === '0'" v-auth="'auxiliary:notice:add'" title="新增通知">
- <SvgIcon name="ele-Plus" class="mr5" />新增
- </el-button>
- <el-button type="primary" @click="onNoticeAdd('1')" v-else v-auth="'auxiliary:bulletin:add'" title="新增公告">
- <SvgIcon name="ele-Plus" class="mr5" />新增
- </el-button>
- </div>
- <!-- 表格 -->
- <el-table :data="state.tableData" v-loading="state.loading" row-key="id" ref="multipleTableRef" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55" />
- <!-- 通知 -->
- <template v-if="listType === '0'">
- <el-table-column prop="circularTypeName" label="通知类型" show-overflow-tooltip width="120"></el-table-column>
- <el-table-column prop="circularStateText" label="通知状态" show-overflow-tooltip width="120"></el-table-column>
- <el-table-column prop="title" label="通知标题" show-overflow-tooltip width="150"></el-table-column>
- <el-table-column prop="commonTypeText" label="必须阅读" show-overflow-tooltip>
- <template #default="{ row }">
- {{ row.isMustRead ? '是' : '否' }}
- </template>
- </el-table-column>
- <el-table-column label="已阅读数" show-overflow-tooltip>
- <template #default="{ row }">
- <el-popover placement="right" :width="450" trigger="click" popper-class="notice-container" v-if="[2].includes(row.circularState)">
- <template #reference>
- <el-button link type="primary">{{ row.readedNum + '/' + row.needReadNum }}</el-button>
- </template>
- <div class="notice-container-box">
- <div class="notice-container-box-inner">
- 已读:{{ row.readedNum }}
- <el-scrollbar class="mt5" v-if="row.circularReadGroups?.length">
- <el-tag v-for="item in row.circularReadGroups.filter((i) => i.isRead)">{{
- row.circularType === 1 ? item.userName : item.orgName
- }} <span v-if="item.isTimeOut" class="color-danger">(超时阅读)</span> </el-tag>
- </el-scrollbar>
- </div>
- <div class="notice-container-box-inner">
- 未读:{{ row.needReadNum - row.readedNum }}
- <el-scrollbar class="mt5 mb10" v-if="row.circularReadGroups?.length">
- <el-tag v-for="item in row.circularReadGroups.filter((i) => !i.isRead)">{{
- row.circularType === 1 ? item.userName : item.orgName
- }}</el-tag>
- </el-scrollbar>
- </div>
- </div>
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column prop="circularTypeText" label="通知对象" show-overflow-tooltip></el-table-column>
- <el-table-column prop="commonTypeText" label="通知时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="失效时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.lostEfficacyTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="sourceOrgName" label="来源单位" show-overflow-tooltip width="120"></el-table-column>
- <el-table-column prop="circularStateText" label="审核状态" show-overflow-tooltip width="120"></el-table-column>
- </template>
- <!-- 公告 -->
- <template v-if="listType === '1'">
- <el-table-column prop="bulletinTypeName" label="公告类型" show-overflow-tooltip width="120"></el-table-column>
- <el-table-column prop="bulletinStateText" label="公告状态" show-overflow-toolti width="120"></el-table-column>
- <el-table-column prop="title" label="公告标题" show-overflow-tooltip width="150"></el-table-column>
- <el-table-column prop="readedNum" label="已阅次数" show-overflow-tooltip></el-table-column>
- <el-table-column prop="pushRangesText" label="公告范围" show-overflow-tooltip width="300"></el-table-column>
- <el-table-column prop="commonTypeText" label="通知时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.creationTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="失效时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.loseEfficacyTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column prop="creatorOrgName" label="来源单位" show-overflow-tooltip width="120"></el-table-column>
- <el-table-column prop="bulletinStateText" label="审核状态" show-overflow-tooltip width="120"></el-table-column>
- </template>
- <el-table-column prop="examinOpinion" label="审核理由" show-overflow-tooltip width="150"></el-table-column>
- <el-table-column prop="examinMan" label="审核人" show-overflow-tooltip></el-table-column>
- <el-table-column prop="examinOpinion" label="审核时间" show-overflow-tooltip width="170">
- <template #default="{ row }">
- <span>{{ formatDate(row.examinTime, 'YYYY-mm-dd HH:MM:SS') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="200" fixed="right" align="center">
- <template #default="{ row }">
- <template v-if="listType === '0'">
- <el-button link type="primary" @click="onEdit(row, '0')" v-if="[0, 3].includes(row.circularState)" v-auth="'auxiliary:notice:edit'">
- 编辑
- </el-button>
- <el-button link type="danger" @click="onDelete(row, '0')" v-if="[0].includes(row.circularState)" v-auth="'auxiliary:notice:delete'">
- 删除
- </el-button>
- <el-button
- link
- type="primary"
- @click="onCommit(row, '0')"
- v-if="[0, 3].includes(row.circularState)"
- title="提交审批"
- v-auth="'auxiliary:notice:commit'"
- >
- 提交
- </el-button>
- <el-button link type="primary" @click="onDetail(row, '0')" v-auth="'auxiliary:notice:detail'" v-if="[1, 2].includes(row.circularState)">
- 查看详情
- </el-button>
- </template>
- <template v-if="listType === '1'">
- <el-button link type="primary" @click="onEdit(row, '1')" v-if="[0, 3].includes(row.bulletinState)" v-auth="'auxiliary:notice:edit'">
- 编辑
- </el-button>
- <el-button link type="danger" @click="onDelete(row, '1')" v-if="[0].includes(row.bulletinState)" v-auth="'auxiliary:notice:delete'">
- 删除
- </el-button>
- <el-button
- link
- type="primary"
- @click="onCommit(row, '1')"
- v-if="[0, 3].includes(row.bulletinState)"
- title="提交审批"
- v-auth="'auxiliary:notice:commit'"
- >
- 提交
- </el-button>
- <el-button link type="primary" @click="onDetail(row, '1')" v-auth="'auxiliary:notice:detail'" v-if="[1, 2].includes(row.bulletinState)">
- 查看详情
- </el-button>
- </template>
- </template>
- </el-table-column>
- <template #empty>
- <Empty />
- </template>
- </el-table>
- <!-- 分页 -->
- <pagination
- :total="state.total"
- v-model:page="state.queryParams.PageIndex"
- v-model:limit="state.queryParams.PageSize"
- @pagination="queryList"
- />
- </el-card>
- <!-- 流程审批 -->
- <process-audit ref="processAuditRef" @orderProcessSuccess="queryList" />
- <!-- 新增通知公告 -->
- <notice-add ref="noticeAddRef" @updateList="queryList" />
- <!-- 编辑通知公告 -->
- <notice-edit ref="noticeEditRef" @updateList="queryList" />
- </div>
- </template>
- <script lang="ts" setup name="auxiliaryNotice">
- import { defineAsyncComponent, onActivated, onMounted, reactive, ref } from 'vue';
- import { useRouter } from 'vue-router';
- import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
- import { shortcuts } from '/@/utils/constants';
- import { formatDate } from '/@/utils/formatTime';
- import { auth } from '/@/utils/authFunction';
- import {
- bulletinBaseData,
- bulletinCommit,
- bulletinDelete,
- bulletinList,
- circularBaseData,
- circularCommit,
- circularDelete,
- circularList,
- } from '/@/api/auxiliary/notice';
- import { businessTagDelete } from '/@/api/auxiliary/businessTag';
- // 引入组件
- const ProcessAudit = defineAsyncComponent(() => import('/@/components/ProcessAudit/index.vue')); // 流程审批
- const NoticeAdd = defineAsyncComponent(() => import('/@/views/auxiliary/notice/component/Notice-add.vue')); // 通知公告新增
- const NoticeEdit = defineAsyncComponent(() => import('/@/views/auxiliary/notice/component/Notice-edit.vue')); // 通知公告编辑
- // 定义变量内容
- const state = reactive<any>({
- loading: false, // 加载状态
- queryParams: {
- // 查询参数
- PageIndex: 1,
- PageSize: 10,
- Title: null,
- BulletinTimeStart: null, // 创建时间 开始
- BulletinTimeEnd: null, // 创建时间 结束
- CircularTimeStart: null,
- CircularTimeEnd: null,
- exTime: [],
- Time: [],
- BulletinTypeId: null, //通知类型
- CircularTypeId: null,
- },
- total: 0, // 总条数
- tableData: [], // 表格数据
- });
- const ruleFormRef = ref<RefType>(null); // 表单ref
- const bulletinType = ref<EmptyArrayType>([]); // 通知类型
- const circularType = ref<EmptyArrayType>([]); // 通知类型
- const listType = ref<string>('0'); // 列表类型
- const handleTimeChange = (val: string[], startKey: string, endKey: string) => {
- if (val) {
- state.queryParams[startKey] = val[0];
- state.queryParams[endKey] = val[1];
- } else {
- state.queryParams[startKey] = '';
- state.queryParams[endKey] = '';
- }
- queryList();
- };
- // 甄别时间
- const timeStartChangeCr = (val: string[]) => {
- handleTimeChange(val, 'CircularTimeStart', 'CircularTimeEnd');
- };
- const timeStartChange = (val: string[]) => {
- handleTimeChange(val, 'BulletinTimeStart', 'BulletinTimeEnd');
- };
- const getBaseData = async () => {
- try {
- const resCircularType = await circularBaseData();
- circularType.value = resCircularType.result?.circularType ?? [];
- const res = await bulletinBaseData();
- bulletinType.value = res.result.bulletinType ?? [];
- } catch (error) {
- console.log(error);
- }
- };
- // 获取参数列表
- const queryList = () => {
- state.loading = true;
- switch (listType.value) {
- case '0': //通知
- if (!auth('auxiliary:notice:query')) ElMessage.error('抱歉,您没有权限获取通知公告列表!');
- else {
- const requestCircular = {
- title: state.queryParams.Title,
- CircularTypeId: state.queryParams.CircularTypeId,
- CircularTimeStart: state.queryParams.CircularTimeStart,
- CircularTimeEnd: state.queryParams.CircularTimeEnd,
- PageIndex: state.queryParams.PageIndex,
- PageSize: state.queryParams.PageSize,
- };
- circularList(requestCircular)
- .then((res) => {
- state.loading = false;
- state.tableData = res.result.items ?? [];
- state.total = res.result.total ?? 0;
- })
- .finally(() => {
- state.loading = false;
- });
- }
- break;
- case '1': // 公告
- if (!auth('auxiliary:bulletin:query')) ElMessage.error('抱歉,您没有权限获取通知公告列表!');
- else {
- const requestBulletin = {
- title: state.queryParams.Title,
- BulletinTypeId: state.queryParams.BulletinTypeId,
- BulletinTimeStart: state.queryParams.BulletinTimeStart,
- BulletinTimeEnd: state.queryParams.BulletinTimeEnd,
- PageIndex: state.queryParams.PageIndex,
- PageSize: state.queryParams.PageSize,
- };
- bulletinList(requestBulletin)
- .then((res) => {
- state.loading = false;
- state.tableData = res.result.items ?? [];
- state.total = res.result.total ?? 0;
- })
- .finally(() => {
- state.loading = false;
- });
- }
- break;
- }
- };
- // 重置表单
- const resetQuery = (formEl: FormInstance | undefined) => {
- if (!formEl) return;
- formEl.resetFields();
- state.queryParams.BulletinTimeStart = null;
- state.queryParams.BulletinTimeEnd = null;
- state.queryParams.CircularTimeStart = null;
- state.queryParams.CircularTimeEnd = null;
- queryList();
- };
- // 通知公告新增
- const processAuditRef = ref<RefType>(); // 处理流程
- const noticeAddRef = ref<RefType>(); // 通知公告新增
- const onNoticeAdd = (type: string) => {
- const processType = type === '0' ? '新增通知' : '新增公告';
- noticeAddRef.value.openDialog(processType);
- };
- // 查看详情
- const router = useRouter();
- const onDetail = (row: any, type: string) => {
- const tagsViewName = type === '0' ? '通知详情' : '公告详情';
- router.push({
- name: 'auxiliaryNoticeDetail',
- params: {
- id: row.id,
- isRead: 0,
- tagsViewName,
- },
- });
- };
- // 编辑
- const noticeEditRef = ref<RefType>(); // 通知公告编辑
- const onEdit = (row: any, type: string) => {
- noticeEditRef.value.openDialog(row, type === '0' ? '编辑通知' : '编辑公告');
- };
- // 删除
- const onDelete = (row: any, type: string) => {
- ElMessageBox.confirm(`您确定要删除:【${row.title}】,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- if (type === '0') {
- circularDelete(row.id).then(() => {
- ElMessage.success('操作成功!');
- queryList();
- });
- } else {
- bulletinDelete(row.id).then(() => {
- ElMessage.success('操作成功!');
- queryList();
- });
- }
- })
- .catch(() => {});
- };
- // 提交
- const onCommit = (row: any, type: string) => {
- ElMessageBox.confirm(`您确定要提交:【${row.title}】,是否继续?`, '提示', {
- confirmButtonText: '确认',
- cancelButtonText: '取消',
- type: 'warning',
- draggable: true,
- cancelButtonClass: 'default-button',
- autofocus: false,
- })
- .then(() => {
- if (type === '0') {
- circularCommit(row.id).then(() => {
- ElMessage.success('操作成功!');
- queryList();
- });
- } else {
- bulletinCommit(row.id).then(() => {
- ElMessage.success('操作成功!');
- queryList();
- });
- }
- })
- .catch(() => {});
- };
- // 表格多选
- const multipleTableRef = ref<RefType>();
- const multipleSelection = ref<any>([]);
- const handleSelectionChange = (val: any[]) => {
- multipleSelection.value = val;
- };
- const params = history.state;
- // 页面加载时
- onMounted(() => {
- getBaseData();
- if (params.index) {
- listType.value = params.index as string;
- }
- queryList();
- });
- onActivated(() => {
- if (params.index) {
- listType.value = params.index as string;
- }
- });
- </script>
- <style lang="scss">
- .notice-container {
- &-box {
- display: flex;
- padding: 10px;
- max-height: 300px;
- &-inner {
- flex: 1;
- padding: 10px 0 10px 10px;
- &:last-child {
- border-left: var(--el-border);
- }
- .el-tag {
- margin: 0 5px 5px 0;
- }
- }
- }
- }
- </style>
|