This commit is contained in:
aoli.qu 2022-02-24 18:09:14 +08:00
parent cca5552a30
commit 83859e2d1c
11 changed files with 180 additions and 106 deletions

View File

@ -6,7 +6,8 @@ const noticeApi = {
get: 'notice/get',
page: 'notice/pageList',
read: 'notice/read',
pagePerson: 'notice/pagePersonList'
pagePerson: 'notice/pagePersonList',
cancel: 'notice/cancel'
}
export function noticeAdd (params) {
@ -52,3 +53,10 @@ export function noticePagePerson (params) {
params: params
})
}
export function noticeCancel (params) {
return request({
url: noticeApi.cancel,
method: 'post',
params: params
})
}

View File

@ -2,7 +2,7 @@
<div>
<a-card :bordered="false">
<template slot="extra">
<a-button size="small" @click="close">返回</a-button>
<a-button type="primary" @click="close">返回</a-button>
</template>
<div>
<div>
@ -73,6 +73,7 @@ export default {
queryParam: { noticeId: this.$route.query.id, isRead: 1 },
readCount: 0,
unreadCount: 0,
noticeRange : 1,
//
columns1: [
{
@ -122,17 +123,16 @@ export default {
const noticeId = this.$route.query.id
this.getDetail(noticeId)
const type = this.$route.query.type
console.log(type)
//
if (type == 2) {
this.readNotice(noticeId)
}
this.noticeRange = type
},
methods: {
//
close () {
// this.$router.push({ path: '/notice/list', query: {} })
this.$router.go(-1)
this.$router.push({ path: '/notice/list', query: {noticeRange: this.noticeRange} })
},
getDetail (id) {
noticeGet({ id: id }).then(res => {
@ -140,11 +140,8 @@ export default {
})
},
readNotice (id) {
console.log('-------------read')
console.log(id)
noticeRead({ id: id }).then(res => {
//
console.log(res)
})
},
tabsCallback (key) {

View File

@ -176,7 +176,11 @@ export default {
methods: {
//
goback() {
this.$router.push({ path: '/notice/list', query: {} })
this.$router.push({ path: '/notice/list',
query: {
noticeRange: 1 // noticeRange=1/
}
})
},
edit(id) {
noticeGet({ id: id }).then(res => {

View File

@ -1,6 +1,57 @@
<template>
<a-card :bordered="false">
<a-tabs default-active-key="2" @change="tabsCallback">
<a-tabs @change="tabsCallback" :default-active-key="noticeRange">
<a-tab-pane key="1" tab="我发布的" v-if="hasPerm('notice:edit')" >
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="6" :sm="24">
<a-form-item label="公告标题"><a-input v-model="queryParam.title" placeholder="请输入公告标题" @pressEnter="loadData" /></a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table1.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => {queryParam = {noticeRange: 1}, $refs.table1.refresh(true)}">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button @click="showAddPage()" icon="plus" type="primary" v-if="hasPerm('notice:edit')">发布</a-button>
</div>
<s-table
ref="table1"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
>
<template slot="type" slot-scope="text, record">
<a-tag>{{ record.type | typeFilter }}</a-tag>
</template>
<template slot="publishTime" slot-scope="text, record">
{{ record.publishTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
<template slot="status" slot-scope="text, record">
<a-tag>{{ record.status | statusFilter }}</a-tag>
</template>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('notice:edit')" @click="showAddPage(record.id)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('notice:edit') && record.status == 1" />
<a-popconfirm v-if="hasPerm('notice:edit') && record.status == 1" placement="topRight" title="确认撤销?" @confirm="() => handleCancel(record)">
<a>撤销</a>
</a-popconfirm>
<a-divider type="vertical" v-if="hasPerm('notice:edit')" />
<a v-if="hasPerm('notice:list')" @click="showGetPage(record.id, 1)">查看</a>
<a-divider type="vertical" v-if="hasPerm('notice:list')"/>
<a-popconfirm v-if="hasPerm('notice:del')" placement="topRight" title="确认删除?" @confirm="() => handleDel(record)">
<a>删除</a>
</a-popconfirm>
</span>
</s-table>
</a-tab-pane>
<a-tab-pane key="2" tab="我接收的">
<div class="table-page-search-wrapper">
<a-form layout="inline">
@ -9,8 +60,8 @@
<a-form-item label="公告标题"><a-input v-model="queryParam.title" placeholder="请输入公告标题" @pressEnter="loadData" /></a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => {queryParam = {}, $refs.table.refresh(true)}">重置</a-button>
<a-button type="primary" @click="$refs.table2.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => {queryParam = {noticeRange: 2}, $refs.table2.refresh(true)}">重置</a-button>
</a-col>
</a-row>
</a-form>
@ -33,56 +84,12 @@
</span>
</s-table>
</a-tab-pane>
<a-tab-pane key="1" tab="我发布的" v-if="hasPerm('notice:edit')" >
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
<a-col :md="6" :sm="24">
<a-form-item label="公告标题"><a-input v-model="queryParam.title" placeholder="请输入公告标题" @pressEnter="loadData" /></a-form-item>
</a-col>
<a-col :md="8" :sm="24">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => {queryParam = {}, $refs.table.refresh(true)}">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button @click="showAddPage()" icon="plus" type="primary" v-if="hasPerm('notice:edit')">发布</a-button>
</div>
<s-table
ref="table1"
:columns="columns"
:data="loadData"
:rowKey="(record) => record.id"
>
<template slot="type" slot-scope="text, record">
<a-tag>{{ record.type | typeFilter }}</a-tag>
</template>
<template slot="publishTime" slot-scope="text, record">
{{ record.publishTime | moment('YYYY-MM-DD HH:mm:ss') }}
</template>
<span slot="action" slot-scope="text, record">
<a v-if="hasPerm('notice:edit')" @click="showAddPage(record.id)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('notice:edit')" />
<a v-if="hasPerm('notice:list')" @click="showGetPage(record.id, 1)">查看</a>
<a-divider type="vertical" v-if="hasPerm('notice:list')"/>
<a-popconfirm v-if="hasPerm('notice:del')" placement="topRight" title="确认删除?" @confirm="() => handleDel(record)">
<a>删除</a>
</a-popconfirm>
</span>
</s-table>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script>
import { STable } from '@/components'
import { noticePage, noticeDel } from '@/api/notice/notice'
import { noticePage, noticeDel, noticeCancel } from '@/api/notice/notice'
export default {
components: {
@ -90,8 +97,9 @@
},
data () {
return {
noticeRange : 2,
//
queryParam: { noticeRange: 2 },
queryParam: { },
//
columns: [
{
@ -113,11 +121,16 @@
title: '菜单类型',
dataIndex: 'type',
scopedSlots: { customRender: 'type' }
},
{
title: '发布状态',
dataIndex: 'status',
scopedSlots: { customRender: 'status' }
}
],
// Promise
loadData: parameter => {
return noticePage(Object.assign(parameter, this.queryParam)).then((res) => {
return noticePage(Object.assign(parameter, this.queryParam, {noticeRange : this.noticeRange})).then((res) => {
console.log(res)
return res
})
@ -132,29 +145,46 @@
3: '通知'
}
return typeMap[type]
},
statusFilter (status) {
const statusMap = {
0: '未发布',
1: '已发布',
2: '已撤销'
}
return statusMap[status]
}
},
created () {
if (this.hasPerm('notice:edit') || this.hasPerm('notice:del') || this.hasPerm('notice:list')) {
this.columns.push({
title: '操作',
width: '150px',
width: 200,
dataIndex: 'action',
scopedSlots: { customRender: 'action' }
})
}
const noticeRange = this.$route.query.noticeRange
if (!noticeRange) {
this.noticeRange = this.hasPerm('notice:edit') ? '1' : '2'
} else {
this.noticeRange = noticeRange
}
},
methods: {
tabsCallback (key) {
if (key === '1') {
this.queryParam.noticeRange = 1
this.noticeRange = '1'
this.$nextTick(()=>{
this.$refs.table1.refresh(true)
})
}
if (key === '2') {
this.queryParam.noticeRange = 2
this.noticeRange = '2'
this.$nextTick(()=>{
this.$refs.table2.refresh(true)
})
}
},
/**
@ -164,14 +194,23 @@
noticeDel({ id: record.id, deleteReason: '' }).then((res) => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$refs.table.refresh(true)
this.$refs.table1.refresh(true)
} else {
this.$message.error('删除失败:' + res.msg)
}
})
},
handleCancel (record) {
noticeCancel({ id: record.id }).then((res) => {
if (res.code === 200) {
this.$message.success('撤销成功')
this.$refs.table1.refresh(true)
} else {
this.$message.error('撤销失败:' + res.msg)
}
})
},
showAddPage (id) {
console.log(id)
this.$router.push({
path: '/notice/add',
query: {

View File

@ -188,7 +188,7 @@ export default {
this.visibleDef = true
}
this.form.getFieldDecorator('visible', { valuePropName: 'checked', initialValue: this.visibleDef })
this.treeSelDefaultValue = record.id
this.treeSelDefaultValue = record.pid
setTimeout(() => {
this.setMenuItem(record)

View File

@ -46,8 +46,8 @@
<a v-if="hasPerm('sys:menu:add') && record.type !== 2" @click="$refs.menuForm.add(record.id)">新增下级</a>
<a-divider type="vertical" v-if="hasPerm('sys:menu:add') && record.type !== 2 && hasPerm('sys:menu:edit')" />
<a v-if="hasPerm('sys:menu:edit')" @click="$refs.menuForm.edit(record)">编辑</a>
<a-divider type="vertical" v-if="hasPerm('sys:menu:edit') && hasPerm('sys:menu:delete') " />
<a-popconfirm v-if="hasPerm('sys:menu:delete')" placement="topRight" title="删除本菜单与下级?" @confirm="() => handleDel(record)">
<a-divider type="vertical" v-if="hasPerm('sys:menu:edit') && hasPerm('sys:menu:del') " />
<a-popconfirm v-if="hasPerm('sys:menu:del')" placement="topRight" title="删除本菜单与下级?" @confirm="() => handleDel(record)">
<a>删除</a>
</a-popconfirm>
</template>
@ -115,7 +115,7 @@ export default {
},
created () {
//
if (this.hasPerm('sys:menu:edit') || this.hasPerm('sys:menu:delete')) {
if (this.hasPerm('sys:menu:edit') || this.hasPerm('sys:menu:del')) {
this.columns.push({
title: '操作',
dataIndex: 'action',

View File

@ -77,7 +77,7 @@
this.visible = true
},
edit(obj) {
var _obj = obj
var _obj = {...obj}
this.modalTitle = '修改角色'
this.visible = true
this.form = _obj

View File

@ -66,10 +66,11 @@ export default {
this.form.id = undefined
},
edit (obj) {
var _obj = {...obj}
this.modalTitle = '修改'
this.visible = true
this.operable = true
this.form = obj
this.form = _obj
},
detail (obj) {
this.modalTitle = '详情'
@ -83,11 +84,13 @@ export default {
console.log(this.form)
if (this.form.id) {
dictionaryUpdate(this.form).then(data => {
this.$message.success('编辑成功')
this.$emit('ok')
this.onCancel()
})
} else {
dictionaryAdd(this.form).then(data => {
this.$message.success('新增成功')
this.$emit('ok')
this.onCancel()
})

View File

@ -8,7 +8,9 @@
@reset="() => {queryParam = {}, handleRefresh()}" >
</SearchCom>
<a-button type="primary" @click="handleCreate">新增</a-button>
<div class="table-operator">
<a-button v-if="hasPerm('sys:dictionary:edit')" type="primary" @click="handleCreate">新增</a-button>
</div>
</div>
<s-table
ref="table"
@ -18,15 +20,19 @@
:data="loadData"
>
<template slot="action" slot-scope="text, record">
<a href="javascript:;" @click="handleEdit(record)">修改</a>
<a href="javascript:;" @click="handleEdit(record)" v-if="hasPerm('sys:dictionary:edit')">修改</a>
<a-divider type="vertical" />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-popconfirm title="是否删除?" v-if="hasPerm('sys:dictionary:del')"
@confirm="() => handleDelete(record)">
<a href="javascript:;">删除</a>
</a-popconfirm>
<a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record)">详情</a>
<a href="javascript:;" v-if="hasPerm('sys:dictionary:get')" @click="handleDetail(record)">详情</a>
<a-divider type="vertical" />
<router-link :to="'/dictionary/dictionaryItem/list/' + record.dictionaryCode">词典项</router-link>
<router-link :to="'/dictionaryItem/list/' + record.dictionaryCode"
v-if="hasPerm('sys:dictionary:item:list')">
词典项
</router-link>
</template>
</s-table>
<dictionary-form ref="modal" @ok="handleOk" />
@ -52,14 +58,7 @@ export default {
selectedRows: [], //
columns: [
{ title: '词典名称', width: 30, dataIndex: 'dictionaryName', key: 'dictionaryName' },
{ title: '词典编码', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
{
title: '操作',
key: 'operation',
width: 10,
align: 'right',
scopedSlots: { customRender: 'action' }
}
{ title: '词典编码', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' }
],
loadData: parameter => {
return dictionaryPage(Object.assign(parameter, this.queryParam))
@ -73,9 +72,7 @@ export default {
queryOptions: function () {
const list = [{ 'value': 1, 'name': '类型1' }, { 'value': 2, 'name': '类型2' }]
return [
{ type: 'input', placeholder: '词典名称', key: 'dictionaryName' },
{ type: 'date', placeholder: '请选择开始时间', key: 'createTime', format: 'YYYY-MM-DD HH:mm:ss' },
{ type: 'select', placeholder: '请选择类型', key: 'status', options: [{ name: '类型', id: undefined }, ...list] }
{ type: 'input', placeholder: '词典名称', key: 'dictionaryName' }
]
},
rowSelection () {
@ -85,6 +82,18 @@ export default {
}
}
},
created () {
//
if (this.hasPerm('sys:dictionary:edit') || this.hasPerm('sys:dictionary:get') ||
this.hasPerm('sys:dictionary:del') || this.hasPerm('sys:dictionary:item:list') ) {
this.columns.push({
title: '操作',
dataIndex: 'action',
width: 15,
scopedSlots: { customRender: 'action' }
})
}
},
methods: {
//
handleCreate () {

View File

@ -94,10 +94,11 @@ export default {
this.form.id = undefined
},
edit (obj) {
var _obj = {...obj}
this.modalTitle = '修改'
this.visible = true
this.operable = true
this.form = obj
this.form = _obj
},
detail (obj) {
this.modalTitle = '详情'
@ -112,11 +113,13 @@ export default {
console.log(this.form)
if (this.form.id) {
dictionaryItemUpdate(this.form).then(data => {
this.$message.success('编辑成功')
this.$emit('ok')
this.onCancel()
})
} else {
dictionaryItemAdd(this.form).then(data => {
this.$message.success('新增成功')
this.$emit('ok')
this.onCancel()
})

View File

@ -1,5 +1,9 @@
<template>
<a-card :bordered="false">
<template slot="extra">
<a-button type="primary" @click="goback">返回</a-button>
</template>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="48">
@ -17,12 +21,12 @@
<a-button type="primary" @click="handleRefresh">查询</a-button>
<a-button @click="() => {queryParam = { dictionaryCode: this.$route.params.id }, handleRefresh()}">重置</a-button>
</a-col>
<a-col :md="6" :sm="24" align="right" >
<a-button type="primary" @click="handleCreate">新增</a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button type="primary" v-if="hasPerm('sys:dictionary:item:edit')" @click="handleCreate">新增</a-button>
</div>
<s-table
ref="table"
size="default"
@ -31,13 +35,14 @@
:data="loadData"
>
<template slot="action" slot-scope="text, record">
<a href="javascript:;" @click="handleEdit(record)">修改</a>
<a href="javascript:;" v-if="hasPerm('sys:dictionary:item:edit')" @click="handleEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm title="是否删除?" @confirm="() => handleDelete(record)">
<a-popconfirm title="是否删除?" v-if="hasPerm('sys:dictionary:item:del')"
@confirm="() => handleDelete(record)">
<a href="javascript:;">删除</a>
</a-popconfirm>
<a-divider type="vertical" />
<a href="javascript:;" @click="handleDetail(record)">详情</a>
<a href="javascript:;" v-if="hasPerm('sys:dictionary:item:get')" @click="handleDetail(record)">详情</a>
</template>
</s-table>
<dictionaryItem-form ref="modal" @ok="handleOk" />
@ -65,14 +70,7 @@ export default {
{ title: '词典项值', width: 30, dataIndex: 'value', key: 'value' },
{ title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
{ title: '上级', width: 30, dataIndex: 'parentid', key: 'parentid' },
{ title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' },
{
title: '操作',
key: 'operation',
width: 10,
align: 'right',
scopedSlots: { customRender: 'action' }
}
{ title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' }
],
loadData: parameter => {
return dictionaryItemPage(Object.assign(parameter, this.queryParam))
@ -90,10 +88,23 @@ export default {
}
}
},
created () {
//
if (this.hasPerm('sys:dictionary:item:edit') || this.hasPerm('sys:dictionary:item:get') ||
this.hasPerm('sys:dictionary:item:del') ) {
this.columns.push({
title: '操作',
dataIndex: 'action',
width: 15,
scopedSlots: { customRender: 'action' }
})
}
},
methods: {
goBack () {
goback () {
//
this.$router.push({ path: '/dictionary' })
// this.$router.go(-1);
},
//
handleCreate () {