通知公告更改
parent
60c56e3ea7
commit
9f27722319
|
@ -9,6 +9,29 @@ export function listNotice(query) {
|
|||
})
|
||||
}
|
||||
|
||||
export function updateAsUserDept(id) {
|
||||
return request({
|
||||
url: '/system/userDept/UpdateAsUserDept?id=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getNum(id) {
|
||||
return request({
|
||||
url: '/system/userDept/GetNum?noticeId=' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getNoticeList(data) {
|
||||
return request({
|
||||
url: '/system/notice/GetNoticeList',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 查询公告详细
|
||||
export function getNotice(noticeId) {
|
||||
return request({
|
||||
|
@ -42,3 +65,7 @@ export function delNotice(noticeId) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<div class="right-menu">
|
||||
<template v-if="device!=='mobile'">
|
||||
<i class="el-icon-message-solid" @click="noticeTableList"></i>
|
||||
<search id="header-search" class="right-menu-item"/>
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect"/>
|
||||
|
||||
|
@ -35,6 +36,80 @@
|
|||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<el-dialog
|
||||
title="公告"
|
||||
:visible.sync="noticeTableVisible"
|
||||
width="50%">
|
||||
<el-radio-group v-model="form.noticeType" @change="getNoticeList">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="1">通知</el-radio-button>
|
||||
<el-radio-button label="2">公告</el-radio-button>
|
||||
</el-radio-group>
|
||||
<br> <br>
|
||||
<el-radio-group v-model="form.isRead" @change="getNoticeList">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="0">已读</el-radio-button>
|
||||
<el-radio-button label="1">未读</el-radio-button>
|
||||
</el-radio-group>
|
||||
<br><br><br>
|
||||
<el-card class="box-card" v-for="notice in noticeAttr">
|
||||
|
||||
<!-- <div slot="header" class="clearfix">-->
|
||||
<!-- <span>卡片名称</span>-->
|
||||
<!-- <el-button style="float: right">阅 读 消 息</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div v-for="o in 4" :key="o" class="text item">-->
|
||||
<!-- {{'列表内容 ' + o }}-->
|
||||
<!-- </div>-->
|
||||
<el-descriptions class="margin-top" :title="notice.noticeTitle" :column="2" :size="'medium'" border>
|
||||
<template slot="extra">
|
||||
<el-button size="small" @click="readNotice(notice)">阅读消息</el-button>
|
||||
</template>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-user"></i>
|
||||
消息发布时间
|
||||
</template>
|
||||
{{notice.createTime}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-user"></i>
|
||||
消息发布人
|
||||
</template>
|
||||
{{notice.createBy}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-tickets"></i>
|
||||
消息类型
|
||||
</template>
|
||||
<dict-tag :options="dict.type.sys_notice_type" :value="notice.noticeType"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-office-building"></i>
|
||||
消息当前状态
|
||||
</template>
|
||||
<dict-tag :options="dict.type.is_read" :value="notice.isRead"/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="noticeTableVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="noticeTableVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
:title="noticeInfo.noticeTitle"
|
||||
:visible.sync="noticeVisble"
|
||||
width="30%">
|
||||
<editor v-model="noticeInfo.noticeContent" :min-height="192"/>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="noticeVisble = false">取 消</el-button>
|
||||
<el-button type="primary" @click="noticeVisble = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -46,8 +121,51 @@ import Hamburger from '@/components/Hamburger'
|
|||
import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
import Search from '@/components/HeaderSearch'
|
||||
import { getNoticeList, updateAsUserDept } from '@/api/system/notice'
|
||||
|
||||
export default {
|
||||
dicts: ['is_read', 'sys_notice_type'],
|
||||
data() {
|
||||
return {
|
||||
noticeVisble: false,
|
||||
noticeInfo: {},
|
||||
noticeAttr: [
|
||||
{
|
||||
createTime: '',
|
||||
createBy: 'admin',
|
||||
noticeType: '1',
|
||||
isRead: '1',
|
||||
noticeTitle: '哈哈',
|
||||
noticeContent: '嘻嘻嘻嘻嘻',
|
||||
noticeId: 1,
|
||||
},
|
||||
{
|
||||
createTime: '',
|
||||
createBy: 'admin',
|
||||
noticeType: '2',
|
||||
isRead: '0',
|
||||
noticeTitle: '哈撒大大哈',
|
||||
noticeContent: '嘻嘻嘻嘻阿尽快嘻',
|
||||
noticeId: 2,
|
||||
},
|
||||
{
|
||||
createTime: '',
|
||||
createBy: 'admin',
|
||||
noticeType: '1',
|
||||
isRead: '0',
|
||||
noticeTitle: '哈哈是',
|
||||
noticeContent: '嘻嘻嘻萨达嘻嘻',
|
||||
noticeId: 3,
|
||||
}
|
||||
],
|
||||
form: {
|
||||
noticeType: '',
|
||||
isRead: ''
|
||||
},
|
||||
messageTotal: undefined,
|
||||
noticeTableVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Breadcrumb,
|
||||
TopNav,
|
||||
|
@ -80,6 +198,23 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
getNoticeList() {
|
||||
getNoticeList(this.form).then(res => {
|
||||
console.log(res)
|
||||
this.noticeAttr = res.data
|
||||
})
|
||||
},
|
||||
readNotice(row) {
|
||||
this.noticeInfo = row
|
||||
this.noticeVisble = true
|
||||
updateAsUserDept(row.id).then(res => {
|
||||
this.getNoticeList()
|
||||
})
|
||||
},
|
||||
noticeTableList() {
|
||||
this.getNoticeList()
|
||||
this.noticeTableVisible = true
|
||||
},
|
||||
toggleSideBar() {
|
||||
this.$store.dispatch('app/toggleSideBar')
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
|
||||
<el-form-item label="公告标题" prop="noticeTitle">
|
||||
<el-input
|
||||
|
@ -86,6 +87,7 @@
|
|||
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="状态" prop="status" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/>
|
||||
|
@ -99,6 +101,14 @@
|
|||
</el-table-column>
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-hasPermi="['system:notice:edit']"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="noticeDetails(scope.row.noticeId)"
|
||||
>通知详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-hasPermi="['system:notice:edit']"
|
||||
icon="el-icon-edit"
|
||||
|
@ -119,6 +129,7 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
|
@ -148,7 +159,17 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-col v-show="form.noticeType == 2">
|
||||
<span style="margin-right: 15px;margin-left: 10px"><b>公告时间</b></span>
|
||||
<el-date-picker
|
||||
v-model="form.time"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
|
@ -160,6 +181,21 @@
|
|||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div v-if="form.noticeType==2">
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="form.dateRange"
|
||||
end-placeholder="结束日期"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
style="width: 240px"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="内容">
|
||||
<editor v-model="form.noticeContent" :min-height="192"/>
|
||||
|
@ -167,22 +203,136 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template>
|
||||
<div v-if="form.noticeType==1">
|
||||
<el-tabs v-model="activeName" @tab-click="handleClick">
|
||||
<el-tab-pane label="部门" name="first" @click="handleClick1">
|
||||
{{form.checkedDept}}
|
||||
<el-tree
|
||||
:data="partDate"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
:default-expanded-keys="[2, 3]"
|
||||
:default-checked-keys="[5]"
|
||||
@check-change="handleCheckChange"
|
||||
>
|
||||
</el-tree>
|
||||
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="特定人员" name="second">
|
||||
{{form.ids}}
|
||||
<el-select v-model="form.ids" multiple placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
|
||||
<el-dialog title="通知详细" :visible.sync="dialogTableVisible " width="40%">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
<div>
|
||||
<el-statistic
|
||||
:value="asUserDeptNum.num"
|
||||
title="总共通知数量"
|
||||
></el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div>
|
||||
<el-statistic
|
||||
:value="asUserDeptNum.readNum"
|
||||
title="已阅读通知数量"
|
||||
></el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div>
|
||||
<el-statistic
|
||||
:value="asUserDeptNum.noReadNum"
|
||||
title="未阅读通知数量"
|
||||
></el-statistic>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogTableVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogTableVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addNotice, delNotice, getNotice, listNotice, updateNotice} from "@/api/system/notice";
|
||||
import { addNotice, delNotice, getNotice, getNum, listNotice, updateNotice } from '@/api/system/notice'
|
||||
import { listDept } from '@/api/system/dept'
|
||||
import { listUser } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
name: "Notice",
|
||||
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||
data() {
|
||||
return {
|
||||
|
||||
asUserDeptNum: {},
|
||||
dialogTableVisible : false,
|
||||
|
||||
options: [],
|
||||
value:'',
|
||||
|
||||
partDate:[],
|
||||
// partDate: [{
|
||||
// id: 1,
|
||||
// label: '一级 2',
|
||||
// children: [{
|
||||
// id: 3,
|
||||
// label: '二级 2-1',
|
||||
// children: [{
|
||||
// id: 4,
|
||||
// label: '三级 3-1-1'
|
||||
// }, {
|
||||
// id: 5,
|
||||
// label: '三级 3-1-2',
|
||||
// // disabled: true
|
||||
// }]
|
||||
// }, {
|
||||
// id: 2,
|
||||
// label: '二级 2-2',
|
||||
// disabled: true,
|
||||
// children: [{
|
||||
// id: 6,
|
||||
// label: '三级 3-2-1'
|
||||
// }, {
|
||||
// id: 7,
|
||||
// label: '三级 3-2-2',
|
||||
// // disabled: true
|
||||
// }]
|
||||
// }]
|
||||
// }],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
},
|
||||
|
||||
activeName: 'second',
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
|
@ -210,7 +360,11 @@ export default {
|
|||
status: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
form: {
|
||||
dateRange:[],
|
||||
checkedDept:[],
|
||||
ids:[],
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
noticeTitle: [
|
||||
|
@ -224,8 +378,74 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.listDeptTree();
|
||||
},
|
||||
methods: {
|
||||
|
||||
noticeDetails(noticeId){
|
||||
this.dialogTableVisible= true
|
||||
getNum(noticeId).then(response=>{
|
||||
this.asUserDeptNum= response.data
|
||||
})
|
||||
},
|
||||
|
||||
handleCheckChange(data,checked,node){
|
||||
// console.log(data,checked,node)
|
||||
if(checked && data.children==null){
|
||||
console.log(data)
|
||||
this.form.checkedDept.push(data.id)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
handleClick1(val){
|
||||
console.log(val)
|
||||
|
||||
},
|
||||
|
||||
listDeptTree(){
|
||||
listUser().then(response=>{
|
||||
console.log(response)
|
||||
response.data.rows.forEach(
|
||||
item =>{
|
||||
if (item.userName){
|
||||
this.options.push({"value":item.userId,"label":item.userName})
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
listDept().then(response => {
|
||||
console.log(response)
|
||||
const treeData = this.handleTree(response.data, "deptId");
|
||||
|
||||
// 转换deptId和deptName为id和label,并递归处理children
|
||||
const convertedTreeData = this.convertDeptTree(treeData);
|
||||
|
||||
this.partDate = convertedTreeData;
|
||||
console.log(this.partDate);
|
||||
}).catch(error => {
|
||||
// 处理错误
|
||||
console.error('Error fetching department list:', error);
|
||||
});
|
||||
},
|
||||
convertDeptTree(deptList) {
|
||||
console.log(deptList)
|
||||
return deptList.map(item => {
|
||||
const { deptId, deptName, children } = item;
|
||||
return {
|
||||
id: deptId,
|
||||
label: deptName,
|
||||
// leader:leader,
|
||||
// 如果children存在,递归转换它们
|
||||
children: children ? this.convertDeptTree(children) : undefined
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
},
|
||||
|
||||
/** 查询公告列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
@ -234,6 +454,7 @@ export default {
|
|||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.form.checkedDept=[]
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
|
@ -247,7 +468,11 @@ export default {
|
|||
noticeTitle: undefined,
|
||||
noticeType: undefined,
|
||||
noticeContent: undefined,
|
||||
status: "0"
|
||||
status: "0",
|
||||
dateRange:[],
|
||||
checkedDept:[],
|
||||
ids:[],
|
||||
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
@ -286,6 +511,9 @@ export default {
|
|||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
console.log(this.form)
|
||||
|
||||
|
||||
if (valid) {
|
||||
if (this.form.noticeId != undefined) {
|
||||
updateNotice(this.form).then(response => {
|
||||
|
|
|
@ -182,6 +182,9 @@ export default {
|
|||
submitForm() {
|
||||
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
|
||||
const genForm = this.$refs.genInfo.$refs.genInfoForm;
|
||||
console.log(basicForm)
|
||||
console.log(genForm)
|
||||
|
||||
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
|
||||
const validateResult = res.data.every(item => !!item);
|
||||
if (validateResult) {
|
||||
|
@ -195,14 +198,17 @@ export default {
|
|||
};
|
||||
updateGenTable(genTable).then(res => {
|
||||
this.$modal.msgSuccess(res.data.msg);
|
||||
if (res.code === 200) {
|
||||
if (res.data.code === 200) {
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.$modal.msgError("表单校验未通过,请重新检查提交内容");
|
||||
}
|
||||
});
|
||||
})
|
||||
/* .catch(error=>{
|
||||
console.log('表单验证过程中发生错误:',error)
|
||||
}) */
|
||||
},
|
||||
getFormPromise(form) {
|
||||
return new Promise(resolve => {
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = {
|
|||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://10.1.123.73:8080`,
|
||||
target: `http://127.0.0.1:8080`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
|
Loading…
Reference in New Issue