|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
- <el-form-item label="公告标题" prop="noticeTitle">
|
|
|
+ <el-form-item label="公告标题" prop="title">
|
|
|
<el-input
|
|
|
- v-model="queryParams.noticeTitle"
|
|
|
+ v-model="queryParams.title"
|
|
|
placeholder="请输入公告标题"
|
|
|
clearable
|
|
|
size="small"
|
|
@@ -19,13 +19,13 @@
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="类型" prop="noticeType">
|
|
|
- <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small">
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
+ <el-select v-model="queryParams.type" placeholder="公告类型" clearable size="small">
|
|
|
<el-option
|
|
|
- v-for="dict in typeOptions"
|
|
|
- :key="dict.dictValue"
|
|
|
- :label="dict.dictLabel"
|
|
|
- :value="dict.dictValue"
|
|
|
+ v-for="dict in noticeTypeDictDatas"
|
|
|
+ :key="parseInt(dict.value)"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="parseInt(dict.value)"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -45,42 +45,21 @@
|
|
|
v-hasPermi="['system:notice:add']"
|
|
|
>新增</el-button>
|
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- icon="el-icon-edit"
|
|
|
- size="mini"
|
|
|
- :disabled="single"
|
|
|
- @click="handleUpdate"
|
|
|
- v-hasPermi="['system:notice:edit']"
|
|
|
- >修改</el-button>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- icon="el-icon-delete"
|
|
|
- size="mini"
|
|
|
- :disabled="multiple"
|
|
|
- @click="handleDelete"
|
|
|
- v-hasPermi="['system:notice:remove']"
|
|
|
- >删除</el-button>
|
|
|
- </el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table v-loading="loading" :data="noticeList">
|
|
|
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
|
|
|
<el-table-column
|
|
|
label="公告标题"
|
|
|
align="center"
|
|
|
- prop="noticeTitle"
|
|
|
+ prop="title"
|
|
|
:show-overflow-tooltip="true"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
label="公告类型"
|
|
|
align="center"
|
|
|
- prop="noticeType"
|
|
|
+ prop="type"
|
|
|
:formatter="typeFormat"
|
|
|
width="100"
|
|
|
/>
|
|
@@ -120,7 +99,7 @@
|
|
|
<pagination
|
|
|
v-show="total>0"
|
|
|
:total="total"
|
|
|
- :page.sync="queryParams.pageNum"
|
|
|
+ :page.sync="queryParams.pageNo"
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
@pagination="getList"
|
|
|
/>
|
|
@@ -130,13 +109,13 @@
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="公告标题" prop="noticeTitle">
|
|
|
- <el-input v-model="form.noticeTitle" placeholder="请输入公告标题" />
|
|
|
+ <el-form-item label="公告标题" prop="title">
|
|
|
+ <el-input v-model="form.title" placeholder="请输入公告标题" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="公告类型" prop="noticeType">
|
|
|
- <el-select v-model="form.noticeType" placeholder="请选择">
|
|
|
+ <el-form-item label="公告类型" prop="type">
|
|
|
+ <el-select v-model="form.type" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="dict in typeOptions"
|
|
|
:key="dict.dictValue"
|
|
@@ -150,16 +129,16 @@
|
|
|
<el-form-item label="状态">
|
|
|
<el-radio-group v-model="form.status">
|
|
|
<el-radio
|
|
|
- v-for="dict in statusOptions"
|
|
|
- :key="dict.dictValue"
|
|
|
- :label="dict.dictValue"
|
|
|
- >{{dict.dictLabel}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
+ v-for="dict in statusDictDatas"
|
|
|
+ :key="parseInt(dict.value)"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="parseInt(dict.value)"
|
|
|
+ >{{dict.label}}</el-radio>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="内容">
|
|
|
- <editor v-model="form.noticeContent" :min-height="192"/>
|
|
|
+ <editor v-model="form.content" :min-height="192"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -173,9 +152,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice } from "@/api/system/notice";
|
|
|
+import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
|
|
import Editor from '@/components/Editor';
|
|
|
|
|
|
+import {SysCommonStatusEnum} from '@/utils/constants'
|
|
|
+import { getDictDataLabel, getDictDatas, DICT_TYPE } from '@/utils/dict'
|
|
|
+
|
|
|
export default {
|
|
|
name: "Notice",
|
|
|
components: {
|
|
@@ -185,12 +167,6 @@ export default {
|
|
|
return {
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
// 显示搜索条件
|
|
|
showSearch: true,
|
|
|
// 总条数
|
|
@@ -207,9 +183,9 @@ export default {
|
|
|
typeOptions: [],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
- pageNum: 1,
|
|
|
+ pageNo: 1,
|
|
|
pageSize: 10,
|
|
|
- noticeTitle: undefined,
|
|
|
+ title: undefined,
|
|
|
createBy: undefined,
|
|
|
status: undefined
|
|
|
},
|
|
@@ -217,41 +193,41 @@ export default {
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
- noticeTitle: [
|
|
|
+ title: [
|
|
|
{ required: true, message: "公告标题不能为空", trigger: "blur" }
|
|
|
],
|
|
|
- noticeType: [
|
|
|
+ type: [
|
|
|
{ required: true, message: "公告类型不能为空", trigger: "change" }
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 枚举
|
|
|
+ CommonStatusEnum: SysCommonStatusEnum,
|
|
|
+ // 数据字典
|
|
|
+ noticeTypeDictDatas: getDictDatas(DICT_TYPE.SYS_NOTICE_TYPE),
|
|
|
+ statusDictDatas: getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
- this.getDicts("sys_notice_status").then(response => {
|
|
|
- this.statusOptions = response.data;
|
|
|
- });
|
|
|
- this.getDicts("sys_notice_type").then(response => {
|
|
|
- this.typeOptions = response.data;
|
|
|
- });
|
|
|
},
|
|
|
methods: {
|
|
|
/** 查询公告列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
listNotice(this.queryParams).then(response => {
|
|
|
- this.noticeList = response.rows;
|
|
|
- this.total = response.total;
|
|
|
+ this.noticeList = response.data.list;
|
|
|
+ this.total = response.data.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
// 公告状态字典翻译
|
|
|
statusFormat(row, column) {
|
|
|
- return this.selectDictLabel(this.statusOptions, row.status);
|
|
|
+ return getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, row.status)
|
|
|
},
|
|
|
// 公告状态字典翻译
|
|
|
typeFormat(row, column) {
|
|
|
- return this.selectDictLabel(this.typeOptions, row.noticeType);
|
|
|
+ return getDictDataLabel(DICT_TYPE.SYS_NOTICE_TYPE, row.status)
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
@@ -262,16 +238,16 @@ export default {
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
noticeId: undefined,
|
|
|
- noticeTitle: undefined,
|
|
|
- noticeType: undefined,
|
|
|
- noticeContent: undefined,
|
|
|
- status: "0"
|
|
|
+ title: undefined,
|
|
|
+ type: undefined,
|
|
|
+ content: undefined,
|
|
|
+ status: SysCommonStatusEnum.ENABLE
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
+ this.queryParams.pageNo = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
@@ -279,12 +255,6 @@ export default {
|
|
|
this.resetForm("queryForm");
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.noticeId)
|
|
|
- this.single = selection.length!=1
|
|
|
- this.multiple = !selection.length
|
|
|
- },
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
this.reset();
|
|
@@ -305,7 +275,7 @@ export default {
|
|
|
submitForm: function() {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (this.form.noticeId != undefined) {
|
|
|
+ if (this.form.noticeId !== undefined) {
|
|
|
updateNotice(this.form).then(response => {
|
|
|
this.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
@@ -337,4 +307,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
-</script>
|
|
|
+</script>
|