daofu-gov-pc/src/views/system/notify/index.vue

193 lines
5.0 KiB
Vue
Raw Normal View History

2024-01-23 09:11:49 +08:00
<template>
<div class="percentage-content">
<div class="content">
<div style="margin-bottom: 16px" class="h-layout space-between h-center">
<div>
<div class="h-layout">
<div class="tool-item" @click="dialogVisible = true">
<svg-icon name="add" class="icon" />
<span>新增</span>
</div>
<div class="tool-item" @click="getCompanyList">
<svg-icon name="refurbish" class="icon" />
<span>刷新</span>
</div>
</div>
</div>
</div>
<el-table
ref="loading"
v-loading="tableDataloading"
:data="tableData"
header-row-class-name="el-one-header"
@selection-change="handleSelectionChange"
border
>
<el-table-column
align="center"
:resizable="true"
width="100"
label="序列"
type="index"
>
<template #default="scope">
{{ scope.$index + 1 + (currentPage - 1) * pageSize }}
</template>
</el-table-column>
<el-table-column
:resizable="true"
align="center"
label="类型"
width="200"
>
<template #default="scope">
<span>
{{
scope.row.type == 1
? "检查"
: scope.row.type == 2
? "任务"
: scope.row.type == 3
? "政策"
: scope.row.type == 4
? "学习"
: scope.row.type == 5
? "预警"
: scope.row.type == 6
? "系统"
: "暂无"
}}
</span>
</template>
</el-table-column>
<el-table-column
prop="content"
:resizable="true"
align="center"
label="内容"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
prop="createTime"
:resizable="true"
align="center"
label="时间"
width="150"
>
</el-table-column>
<el-table-column
:resizable="true"
align="center"
label="操作"
width="150"
>
<template #default="scope">
<span
class="operate"
@click="deleteEntNotice(scope.row.govNoticeId)"
>
<svg-icon name="delete" class="icon"></svg-icon>
<span class="func">删除</span>
</span>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
class="pagination"
@size-change="getCompanyList"
@current-change="getCompanyList"
v-model:current-page.sync="currentPage"
:page-sizes="[10, 15, 20, 30]"
v-model:page-size.sync="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
background
>
</el-pagination>
<!-- 新增 -->
<Adddetails :visible="dialogVisible" @close="onclone" />
</div>
</div>
</template>
<script setup lang='ts'>
import { onMounted, ref } from "vue";
import { ElMessageBox } from "element-plus";
import { getGovNoticePage, delGovNotice } from "@/api/Sys";
// 用户id
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
const user = ref(JSON.parse(userStore.userInfo));
const userId = ref(user.value.userId);
//新增弹窗
import Adddetails from "./details.vue";
const dialogVisible = ref(false);
// 分页
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const search = ref([]);
// 刷新获取数据状态
const tableDataloading = ref(false);
const tableData = ref([]);
//获取列表
const getCompanyList = () => {
tableDataloading.value = true;
let params = {
userId: userId.value,
limit: pageSize.value,
page: currentPage.value,
};
getGovNoticePage(params).then((res: any) => {
tableData.value = res.data.list;
total.value = res.data.total;
tableDataloading.value = false;
console.log(tableData.value);
});
};
// 删除
const deleteEntNotice = (id) => {
ElMessageBox.confirm("是否确认删除?", "提示", {
confirmButtonText: "是",
cancelButtonText: "否",
type: "warning",
}).then(() => {
delGovNotice(id).then((res: any) => {
getCompanyList();
});
});
};
//关闭新增弹窗
const onclone = () => {
dialogVisible.value = false;
getCompanyList();
};
onMounted(() => {
getCompanyList();
});
</script>
<style lang="scss" scoped>
.content {
width: 100%;
// flex: auto;
background: #fff;
border-radius: 0.26042vw;
box-shadow: 0 0 0.41667vw 0 rgba(8, 33, 85, 0.1);
height: 100%;
padding: 0.83333vw;
overflow-y: auto;
overflow-x: hidden !important;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-o-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
</style>