|
@@ -26,13 +26,13 @@
|
|
|
<p class="page-reset-common-style-button" @click="resetQuery">重置</p>
|
|
|
<p class="page-submit-common-style-button"
|
|
|
style="float: right;"
|
|
|
- @click="handleAdd"
|
|
|
+ @click="tableButton(1)"
|
|
|
v-hasPermiRouter="['system:notice:add']"
|
|
|
>新增</p>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="page-content-box">
|
|
|
- <el-table class="table-box" v-loading="loading" border :data="dataList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table class="table-box" v-loading="loading" border :data="dataList">
|
|
|
<el-table-column label="消息类型" align="left" prop="sendName" width="140" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
<span v-for="item in typeList" v-if="item.code==scope.row.noticeType">{{item.name}}</span>
|
|
@@ -40,26 +40,48 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="消息标题" align="left" prop="title" width="200" show-overflow-tooltip/>
|
|
|
<el-table-column label="消息内容" align="left" prop="content" show-overflow-tooltip/>
|
|
|
- <el-table-column label="发送时间" align="left" prop="createTime" width="160" show-overflow-tooltip>
|
|
|
+ <el-table-column label="发送状态" align="left" prop="sendState" width="160" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{scope.row.sendState == 0 ? '待发送' : (scope.row.sendState == 1 ? '已发送' : (scope.row.sendState == 2 ? '已撤回' : ''))}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="发送时间" align="left" prop="sendTime" width="160" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{parseTime(scope.row.sendTime,"{y}-{m}-{d} {h}:{i}")}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="发送人" align="left" prop="createTime" width="160" show-overflow-tooltip>
|
|
|
+ <el-table-column label="发送人" align="left" prop="userName" width="160" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{scope.row.userName?scope.row.userName:'--'}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="160" v-if="tableButtonType">
|
|
|
+ <el-table-column label="创建时间" align="left" prop="createTime" width="160" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{parseTime(scope.row.createTime,"{y}-{m}-{d} {h}:{i}")}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="200" v-if="tableButtonType">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="table-button-box">
|
|
|
<p class="table-button-null"></p>
|
|
|
<p class="table-button-p"
|
|
|
- @click="handleUpdate(scope.row)"
|
|
|
+ v-if="scope.row.sendState == 0"
|
|
|
+ @click="tableButton(2,scope.row)"
|
|
|
+ v-hasPermiRouter="['system:notice:edit']"
|
|
|
+ >发送</p>
|
|
|
+ <p class="table-button-p"
|
|
|
+ v-if="scope.row.sendState == 1"
|
|
|
+ @click="tableButton(3,scope.row)"
|
|
|
+ v-hasPermiRouter="['system:notice:edit']"
|
|
|
+ >撤回</p>
|
|
|
+ <p class="table-button-p"
|
|
|
+ v-if="scope.row.sendState != 1"
|
|
|
+ @click="tableButton(4,scope.row)"
|
|
|
v-hasPermiRouter="['system:notice:edit']"
|
|
|
>编辑</p>
|
|
|
<p class="table-button-p"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
+ v-if="scope.row.sendState != 1"
|
|
|
+ @click="tableButton(5,scope.row)"
|
|
|
v-hasPermiRouter="['system:notice:del']"
|
|
|
>删除</p>
|
|
|
<p class="table-button-null"></p>
|
|
@@ -77,59 +99,14 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <add-page v-if="pageType == 2"></add-page>
|
|
|
- <!-- 添加或修改公告对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="780px" append-to-body :close-on-click-modal="false">
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <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-option
|
|
|
- v-for="dict in typeList"
|
|
|
- :key="dict.value"
|
|
|
- :label="dict.label"
|
|
|
- :value="dict.value"
|
|
|
- ></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="状态" prop="state">
|
|
|
- <el-radio-group v-model="form.state">
|
|
|
- <el-radio
|
|
|
- v-for="dict in statusOptions"
|
|
|
- :key="dict.value"
|
|
|
- :label="dict.value"
|
|
|
- >{{dict.label}}</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="内容" prop="content">
|
|
|
- <editor v-model="form.content" :min-height="192"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer dialog-footer-box">
|
|
|
- <p class="dialog-footer-button-null"></p>
|
|
|
- <p class="dialog-footer-button-info" @click="cancel">取消</p>
|
|
|
- <p class="dialog-footer-button-primary" @click="submitForm">提交</p>
|
|
|
- <p class="dialog-footer-button-null"></p>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+ <add-page v-if="pageType == 2" :propsData="propsData"></add-page>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/systemManagement/index";
|
|
|
-import { systemNoticeGetNoticeList,systemNoticeGetNoticeType } from "@/api/commonality/permission";
|
|
|
+import { systemNoticeList,systemNoticeDelete,systemNoticeCancel,
|
|
|
+ systemNoticeSend } from "@/api/systemManagement/index";
|
|
|
+import { systemNoticeGetNoticeType } from "@/api/commonality/permission";
|
|
|
import addPage from "./addPage.vue"
|
|
|
|
|
|
export default {
|
|
@@ -143,31 +120,14 @@ export default {
|
|
|
pageType:1,
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
// 显示搜索条件
|
|
|
showSearch: true,
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
// 公告表格数据
|
|
|
dataList: [],
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- // 类型数据字典
|
|
|
- statusOptions: [{label:"正常",value:true},{label:"关闭",value:false},],
|
|
|
- // 状态数据字典0-通知,1-公告, 2-消息, 3-自定义"
|
|
|
- typeList: [
|
|
|
- {label:"通知",value:0},
|
|
|
- {label:"公告",value:1},
|
|
|
- {label:"消息",value:2},
|
|
|
- {label:"自定义",value:3},
|
|
|
- ],
|
|
|
+ // 消息类型
|
|
|
+ typeList: [],
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
page: 1,
|
|
@@ -177,24 +137,8 @@ export default {
|
|
|
createBy: undefined,
|
|
|
state: undefined
|
|
|
},
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- title: [
|
|
|
- { required: true, message: "公告标题不能为空", trigger: "blur" },
|
|
|
- { required: true, message: "公告标题不能为空", validator: this.spaceJudgment, trigger: "blur" }
|
|
|
- ],
|
|
|
- noticeType: [
|
|
|
- { required: true, message: "公告类型不能为空", trigger: "change" }
|
|
|
- ],
|
|
|
- state: [
|
|
|
- { required: true, message: "请选择状态", trigger: "change" }
|
|
|
- ],
|
|
|
- content: [
|
|
|
- { required: true, message: "请输入内容", trigger: "change" }
|
|
|
- ]
|
|
|
- }
|
|
|
+ //新增编辑页面传参
|
|
|
+ propsData:{},
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -204,55 +148,6 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
- /** 查询列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
- systemNoticeGetNoticeList(this.queryParams).then(response => {
|
|
|
- this.$set(this,'dataList',response.data.records);
|
|
|
- this.$set(this,'total',response.data.total);
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- //消息类型
|
|
|
- systemNoticeGetNoticeType(){
|
|
|
- systemNoticeGetNoticeType().then(response => {
|
|
|
- this.$set(this,'typeList',response.data);
|
|
|
- });
|
|
|
- },
|
|
|
- // 公告状态字典翻译
|
|
|
- statusFormat(row, column) {
|
|
|
- let self = this;
|
|
|
- for(let i=0;i<self.statusOptions.length;i++){
|
|
|
- if(row.state == self.statusOptions[i].value){
|
|
|
- return self.statusOptions[i].label
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 公告状态字典翻译
|
|
|
- typeFormat(row, column) {
|
|
|
- let self = this;
|
|
|
- for(let i=0;i<self.typeList.length;i++){
|
|
|
- if(row.noticeType == self.typeList[i].value){
|
|
|
- return self.typeList[i].label
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
- },
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
- noticeId: null,
|
|
|
- title: null,
|
|
|
- noticeType: null,
|
|
|
- content: null,
|
|
|
- state: null
|
|
|
- };
|
|
|
- this.resetForm("form");
|
|
|
- },
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
this.queryParams.page = 1;
|
|
@@ -264,63 +159,76 @@ 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();
|
|
|
- // this.open = true;
|
|
|
- // this.title = "添加公告";
|
|
|
- this.$set(this,'pageType',2);
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const noticeId = row.noticeId || this.ids
|
|
|
- getNotice({noticeId:noticeId}).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改公告";
|
|
|
+ /** 查询列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ systemNoticeList(this.queryParams).then(response => {
|
|
|
+ this.$set(this,'dataList',response.data.records);
|
|
|
+ this.$set(this,'total',response.data.total);
|
|
|
+ this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm: function() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.noticeId != undefined) {
|
|
|
- updateNotice(this.form).then(response => {
|
|
|
- this.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- addNotice(this.form).then(response => {
|
|
|
- this.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ //消息类型
|
|
|
+ systemNoticeGetNoticeType(){
|
|
|
+ systemNoticeGetNoticeType().then(response => {
|
|
|
+ this.$set(this,'typeList',response.data);
|
|
|
});
|
|
|
},
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const noticeIds = row.noticeId || this.ids
|
|
|
- this.$confirm('是否确认删除公告?', "警告", {
|
|
|
+ //按钮
|
|
|
+ tableButton(type,row){
|
|
|
+ let self = this;
|
|
|
+ if(type == 1){
|
|
|
+ //新增
|
|
|
+ this.$set(this,'propsData',{});
|
|
|
+ this.$set(this,'pageType',2);
|
|
|
+ }else if(type == 2){
|
|
|
+ //发送
|
|
|
+ this.$confirm('是否确认发送?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(function() {
|
|
|
- return delNotice({noticeId:noticeIds});
|
|
|
+ systemNoticeSend({noticeId:row.noticeId}).then(response => {
|
|
|
+ self.msgSuccess(response.message)
|
|
|
+ self.getList();
|
|
|
+ });
|
|
|
}).then(() => {
|
|
|
- this.getList();
|
|
|
- this.msgSuccess("删除成功");
|
|
|
}).catch(() => {});
|
|
|
- }
|
|
|
+ }else if(type == 3){
|
|
|
+ //撤回
|
|
|
+ this.$confirm('是否确认撤回?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ systemNoticeCancel({noticeId:row.noticeId}).then(response => {
|
|
|
+ self.msgSuccess(response.message)
|
|
|
+ self.getList();
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ }).catch(() => {});
|
|
|
+ }else if(type == 4){
|
|
|
+ //编辑
|
|
|
+ this.$set(this,'propsData',row);
|
|
|
+ this.$set(this,'pageType',2);
|
|
|
+ }else if(type == 5){
|
|
|
+ //删除
|
|
|
+ this.$confirm('是否确认删除?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ systemNoticeDelete({noticeId:row.noticeId}).then(response => {
|
|
|
+ self.msgSuccess(response.message)
|
|
|
+ self.getList();
|
|
|
+ });
|
|
|
+ }).then(() => {
|
|
|
+ }).catch(() => {});
|
|
|
+ }else if(type == 6){
|
|
|
+ this.handleQuery();
|
|
|
+ this.$set(this,'pageType',1);
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
};
|
|
|
</script>
|