This commit is contained in:
parent
cca5552a30
commit
83859e2d1c
|
@ -6,7 +6,8 @@ const noticeApi = {
|
||||||
get: 'notice/get',
|
get: 'notice/get',
|
||||||
page: 'notice/pageList',
|
page: 'notice/pageList',
|
||||||
read: 'notice/read',
|
read: 'notice/read',
|
||||||
pagePerson: 'notice/pagePersonList'
|
pagePerson: 'notice/pagePersonList',
|
||||||
|
cancel: 'notice/cancel'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function noticeAdd (params) {
|
export function noticeAdd (params) {
|
||||||
|
@ -52,3 +53,10 @@ export function noticePagePerson (params) {
|
||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function noticeCancel (params) {
|
||||||
|
return request({
|
||||||
|
url: noticeApi.cancel,
|
||||||
|
method: 'post',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div>
|
<div>
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<template slot="extra">
|
<template slot="extra">
|
||||||
<a-button size="small" @click="close">返回</a-button>
|
<a-button type="primary" @click="close">返回</a-button>
|
||||||
</template>
|
</template>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -73,6 +73,7 @@ export default {
|
||||||
queryParam: { noticeId: this.$route.query.id, isRead: 1 },
|
queryParam: { noticeId: this.$route.query.id, isRead: 1 },
|
||||||
readCount: 0,
|
readCount: 0,
|
||||||
unreadCount: 0,
|
unreadCount: 0,
|
||||||
|
noticeRange : 1,
|
||||||
// 表头
|
// 表头
|
||||||
columns1: [
|
columns1: [
|
||||||
{
|
{
|
||||||
|
@ -122,17 +123,16 @@ export default {
|
||||||
const noticeId = this.$route.query.id
|
const noticeId = this.$route.query.id
|
||||||
this.getDetail(noticeId)
|
this.getDetail(noticeId)
|
||||||
const type = this.$route.query.type
|
const type = this.$route.query.type
|
||||||
console.log(type)
|
|
||||||
// 查看类型是“我接收的”
|
// 查看类型是“我接收的”
|
||||||
if (type == 2) {
|
if (type == 2) {
|
||||||
this.readNotice(noticeId)
|
this.readNotice(noticeId)
|
||||||
}
|
}
|
||||||
|
this.noticeRange = type
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 返回 按钮
|
// 返回 按钮
|
||||||
close () {
|
close () {
|
||||||
// this.$router.push({ path: '/notice/list', query: {} })
|
this.$router.push({ path: '/notice/list', query: {noticeRange: this.noticeRange} })
|
||||||
this.$router.go(-1)
|
|
||||||
},
|
},
|
||||||
getDetail (id) {
|
getDetail (id) {
|
||||||
noticeGet({ id: id }).then(res => {
|
noticeGet({ id: id }).then(res => {
|
||||||
|
@ -140,11 +140,8 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
readNotice (id) {
|
readNotice (id) {
|
||||||
console.log('-------------read')
|
|
||||||
console.log(id)
|
|
||||||
noticeRead({ id: id }).then(res => {
|
noticeRead({ id: id }).then(res => {
|
||||||
//
|
//
|
||||||
console.log(res)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
tabsCallback (key) {
|
tabsCallback (key) {
|
||||||
|
|
|
@ -176,7 +176,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// 返回 按钮
|
// 返回 按钮
|
||||||
goback() {
|
goback() {
|
||||||
this.$router.push({ path: '/notice/list', query: {} })
|
this.$router.push({ path: '/notice/list',
|
||||||
|
query: {
|
||||||
|
noticeRange: 1 // 只有noticeRange=1的才有新增/编辑页面权限
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
edit(id) {
|
edit(id) {
|
||||||
noticeGet({ id: id }).then(res => {
|
noticeGet({ id: id }).then(res => {
|
||||||
|
|
|
@ -1,6 +1,57 @@
|
||||||
<template>
|
<template>
|
||||||
<a-card :bordered="false">
|
<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="我接收的">
|
<a-tab-pane key="2" tab="我接收的">
|
||||||
<div class="table-page-search-wrapper">
|
<div class="table-page-search-wrapper">
|
||||||
<a-form layout="inline">
|
<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-form-item label="公告标题"><a-input v-model="queryParam.title" placeholder="请输入公告标题" @pressEnter="loadData" /></a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :md="8" :sm="24">
|
<a-col :md="8" :sm="24">
|
||||||
<a-button type="primary" @click="$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 = {}, $refs.table.refresh(true)}">重置</a-button>
|
<a-button style="margin-left: 8px" @click="() => {queryParam = {noticeRange: 2}, $refs.table2.refresh(true)}">重置</a-button>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
@ -33,56 +84,12 @@
|
||||||
</span>
|
</span>
|
||||||
</s-table>
|
</s-table>
|
||||||
</a-tab-pane>
|
</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-tabs>
|
||||||
</a-card>
|
</a-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { STable } from '@/components'
|
import { STable } from '@/components'
|
||||||
import { noticePage, noticeDel } from '@/api/notice/notice'
|
import { noticePage, noticeDel, noticeCancel } from '@/api/notice/notice'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -90,8 +97,9 @@
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
noticeRange : 2,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParam: { noticeRange: 2 },
|
queryParam: { },
|
||||||
// 表头
|
// 表头
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -113,11 +121,16 @@
|
||||||
title: '菜单类型',
|
title: '菜单类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
scopedSlots: { customRender: 'type' }
|
scopedSlots: { customRender: 'type' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '发布状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
scopedSlots: { customRender: 'status' }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// 加载数据方法 必须为 Promise 对象
|
// 加载数据方法 必须为 Promise 对象
|
||||||
loadData: parameter => {
|
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)
|
console.log(res)
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
|
@ -132,29 +145,46 @@
|
||||||
3: '通知'
|
3: '通知'
|
||||||
}
|
}
|
||||||
return typeMap[type]
|
return typeMap[type]
|
||||||
|
},
|
||||||
|
statusFilter (status) {
|
||||||
|
const statusMap = {
|
||||||
|
0: '未发布',
|
||||||
|
1: '已发布',
|
||||||
|
2: '已撤销'
|
||||||
|
}
|
||||||
|
return statusMap[status]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
if (this.hasPerm('notice:edit') || this.hasPerm('notice:del') || this.hasPerm('notice:list')) {
|
if (this.hasPerm('notice:edit') || this.hasPerm('notice:del') || this.hasPerm('notice:list')) {
|
||||||
this.columns.push({
|
this.columns.push({
|
||||||
title: '操作',
|
title: '操作',
|
||||||
width: '150px',
|
width: 200,
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
scopedSlots: { customRender: '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: {
|
methods: {
|
||||||
tabsCallback (key) {
|
tabsCallback (key) {
|
||||||
if (key === '1') {
|
if (key === '1') {
|
||||||
this.queryParam.noticeRange = 1
|
this.noticeRange = '1'
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(()=>{
|
||||||
this.$refs.table1.refresh(true)
|
this.$refs.table1.refresh(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (key === '2') {
|
if (key === '2') {
|
||||||
this.queryParam.noticeRange = 2
|
this.noticeRange = '2'
|
||||||
|
this.$nextTick(()=>{
|
||||||
this.$refs.table2.refresh(true)
|
this.$refs.table2.refresh(true)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -164,14 +194,23 @@
|
||||||
noticeDel({ id: record.id, deleteReason: '' }).then((res) => {
|
noticeDel({ id: record.id, deleteReason: '' }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message.success('删除成功')
|
this.$message.success('删除成功')
|
||||||
this.$refs.table.refresh(true)
|
this.$refs.table1.refresh(true)
|
||||||
} else {
|
} else {
|
||||||
this.$message.error('删除失败:' + res.msg)
|
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) {
|
showAddPage (id) {
|
||||||
console.log(id)
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/notice/add',
|
path: '/notice/add',
|
||||||
query: {
|
query: {
|
||||||
|
|
|
@ -188,7 +188,7 @@ export default {
|
||||||
this.visibleDef = true
|
this.visibleDef = true
|
||||||
}
|
}
|
||||||
this.form.getFieldDecorator('visible', { valuePropName: 'checked', initialValue: this.visibleDef })
|
this.form.getFieldDecorator('visible', { valuePropName: 'checked', initialValue: this.visibleDef })
|
||||||
this.treeSelDefaultValue = record.id
|
this.treeSelDefaultValue = record.pid
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setMenuItem(record)
|
this.setMenuItem(record)
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
<a v-if="hasPerm('sys:menu:add') && record.type !== 2" @click="$refs.menuForm.add(record.id)">新增下级</a>
|
<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-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 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-divider type="vertical" v-if="hasPerm('sys:menu:edit') && hasPerm('sys:menu:del') " />
|
||||||
<a-popconfirm v-if="hasPerm('sys:menu:delete')" placement="topRight" title="删除本菜单与下级?" @confirm="() => handleDel(record)">
|
<a-popconfirm v-if="hasPerm('sys:menu:del')" placement="topRight" title="删除本菜单与下级?" @confirm="() => handleDel(record)">
|
||||||
<a>删除</a>
|
<a>删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
@ -115,7 +115,7 @@ export default {
|
||||||
},
|
},
|
||||||
created () {
|
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({
|
this.columns.push({
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
this.visible = true
|
this.visible = true
|
||||||
},
|
},
|
||||||
edit(obj) {
|
edit(obj) {
|
||||||
var _obj = obj
|
var _obj = {...obj}
|
||||||
this.modalTitle = '修改角色'
|
this.modalTitle = '修改角色'
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.form = _obj
|
this.form = _obj
|
||||||
|
|
|
@ -66,10 +66,11 @@ export default {
|
||||||
this.form.id = undefined
|
this.form.id = undefined
|
||||||
},
|
},
|
||||||
edit (obj) {
|
edit (obj) {
|
||||||
|
var _obj = {...obj}
|
||||||
this.modalTitle = '修改'
|
this.modalTitle = '修改'
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.operable = true
|
this.operable = true
|
||||||
this.form = obj
|
this.form = _obj
|
||||||
},
|
},
|
||||||
detail (obj) {
|
detail (obj) {
|
||||||
this.modalTitle = '详情'
|
this.modalTitle = '详情'
|
||||||
|
@ -83,11 +84,13 @@ export default {
|
||||||
console.log(this.form)
|
console.log(this.form)
|
||||||
if (this.form.id) {
|
if (this.form.id) {
|
||||||
dictionaryUpdate(this.form).then(data => {
|
dictionaryUpdate(this.form).then(data => {
|
||||||
|
this.$message.success('编辑成功')
|
||||||
this.$emit('ok')
|
this.$emit('ok')
|
||||||
this.onCancel()
|
this.onCancel()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
dictionaryAdd(this.form).then(data => {
|
dictionaryAdd(this.form).then(data => {
|
||||||
|
this.$message.success('新增成功')
|
||||||
this.$emit('ok')
|
this.$emit('ok')
|
||||||
this.onCancel()
|
this.onCancel()
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
@reset="() => {queryParam = {}, handleRefresh()}" >
|
@reset="() => {queryParam = {}, handleRefresh()}" >
|
||||||
</SearchCom>
|
</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>
|
</div>
|
||||||
<s-table
|
<s-table
|
||||||
ref="table"
|
ref="table"
|
||||||
|
@ -18,15 +20,19 @@
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
>
|
>
|
||||||
<template slot="action" slot-scope="text, record">
|
<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-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 href="javascript:;">删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<a-divider type="vertical" />
|
<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" />
|
<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>
|
</template>
|
||||||
</s-table>
|
</s-table>
|
||||||
<dictionary-form ref="modal" @ok="handleOk" />
|
<dictionary-form ref="modal" @ok="handleOk" />
|
||||||
|
@ -52,14 +58,7 @@ export default {
|
||||||
selectedRows: [], // 选中行的数据
|
selectedRows: [], // 选中行的数据
|
||||||
columns: [
|
columns: [
|
||||||
{ title: '词典名称', width: 30, dataIndex: 'dictionaryName', key: 'dictionaryName' },
|
{ title: '词典名称', width: 30, dataIndex: 'dictionaryName', key: 'dictionaryName' },
|
||||||
{ title: '词典编码', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
|
{ title: '词典编码', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' }
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'operation',
|
|
||||||
width: 10,
|
|
||||||
align: 'right',
|
|
||||||
scopedSlots: { customRender: 'action' }
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
loadData: parameter => {
|
loadData: parameter => {
|
||||||
return dictionaryPage(Object.assign(parameter, this.queryParam))
|
return dictionaryPage(Object.assign(parameter, this.queryParam))
|
||||||
|
@ -73,9 +72,7 @@ export default {
|
||||||
queryOptions: function () {
|
queryOptions: function () {
|
||||||
const list = [{ 'value': 1, 'name': '类型1' }, { 'value': 2, 'name': '类型2' }]
|
const list = [{ 'value': 1, 'name': '类型1' }, { 'value': 2, 'name': '类型2' }]
|
||||||
return [
|
return [
|
||||||
{ type: 'input', placeholder: '词典名称', key: 'dictionaryName' },
|
{ 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] }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
rowSelection () {
|
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: {
|
methods: {
|
||||||
// 增
|
// 增
|
||||||
handleCreate () {
|
handleCreate () {
|
||||||
|
|
|
@ -94,10 +94,11 @@ export default {
|
||||||
this.form.id = undefined
|
this.form.id = undefined
|
||||||
},
|
},
|
||||||
edit (obj) {
|
edit (obj) {
|
||||||
|
var _obj = {...obj}
|
||||||
this.modalTitle = '修改'
|
this.modalTitle = '修改'
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.operable = true
|
this.operable = true
|
||||||
this.form = obj
|
this.form = _obj
|
||||||
},
|
},
|
||||||
detail (obj) {
|
detail (obj) {
|
||||||
this.modalTitle = '详情'
|
this.modalTitle = '详情'
|
||||||
|
@ -112,11 +113,13 @@ export default {
|
||||||
console.log(this.form)
|
console.log(this.form)
|
||||||
if (this.form.id) {
|
if (this.form.id) {
|
||||||
dictionaryItemUpdate(this.form).then(data => {
|
dictionaryItemUpdate(this.form).then(data => {
|
||||||
|
this.$message.success('编辑成功')
|
||||||
this.$emit('ok')
|
this.$emit('ok')
|
||||||
this.onCancel()
|
this.onCancel()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
dictionaryItemAdd(this.form).then(data => {
|
dictionaryItemAdd(this.form).then(data => {
|
||||||
|
this.$message.success('新增成功')
|
||||||
this.$emit('ok')
|
this.$emit('ok')
|
||||||
this.onCancel()
|
this.onCancel()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
|
<template slot="extra">
|
||||||
|
<a-button type="primary" @click="goback">返回</a-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div class="table-page-search-wrapper">
|
<div class="table-page-search-wrapper">
|
||||||
<a-form layout="inline">
|
<a-form layout="inline">
|
||||||
<a-row :gutter="48">
|
<a-row :gutter="48">
|
||||||
|
@ -17,12 +21,12 @@
|
||||||
<a-button type="primary" @click="handleRefresh">查询</a-button>
|
<a-button type="primary" @click="handleRefresh">查询</a-button>
|
||||||
<a-button @click="() => {queryParam = { dictionaryCode: this.$route.params.id }, handleRefresh()}">重置</a-button>
|
<a-button @click="() => {queryParam = { dictionaryCode: this.$route.params.id }, handleRefresh()}">重置</a-button>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :md="6" :sm="24" align="right" >
|
|
||||||
<a-button type="primary" @click="handleCreate">新增</a-button>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-form>
|
</a-form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="table-operator">
|
||||||
|
<a-button type="primary" v-if="hasPerm('sys:dictionary:item:edit')" @click="handleCreate">新增</a-button>
|
||||||
|
</div>
|
||||||
<s-table
|
<s-table
|
||||||
ref="table"
|
ref="table"
|
||||||
size="default"
|
size="default"
|
||||||
|
@ -31,13 +35,14 @@
|
||||||
:data="loadData"
|
:data="loadData"
|
||||||
>
|
>
|
||||||
<template slot="action" slot-scope="text, record">
|
<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-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 href="javascript:;">删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
<a-divider type="vertical" />
|
<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>
|
</template>
|
||||||
</s-table>
|
</s-table>
|
||||||
<dictionaryItem-form ref="modal" @ok="handleOk" />
|
<dictionaryItem-form ref="modal" @ok="handleOk" />
|
||||||
|
@ -65,14 +70,7 @@ export default {
|
||||||
{ title: '词典项值', width: 30, dataIndex: 'value', key: 'value' },
|
{ title: '词典项值', width: 30, dataIndex: 'value', key: 'value' },
|
||||||
{ title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
|
{ title: '词典标识', width: 30, dataIndex: 'dictionaryCode', key: 'dictionaryCode' },
|
||||||
{ title: '上级', width: 30, dataIndex: 'parentid', key: 'parentid' },
|
{ title: '上级', width: 30, dataIndex: 'parentid', key: 'parentid' },
|
||||||
{ title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' },
|
{ title: '排序', width: 30, dataIndex: 'sortid', key: 'sortid' }
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'operation',
|
|
||||||
width: 10,
|
|
||||||
align: 'right',
|
|
||||||
scopedSlots: { customRender: 'action' }
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
loadData: parameter => {
|
loadData: parameter => {
|
||||||
return dictionaryItemPage(Object.assign(parameter, this.queryParam))
|
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: {
|
methods: {
|
||||||
goBack () {
|
goback () {
|
||||||
// 返回到上一级
|
// 返回到上一级
|
||||||
this.$router.push({ path: '/dictionary' })
|
this.$router.push({ path: '/dictionary' })
|
||||||
|
// this.$router.go(-1);
|
||||||
},
|
},
|
||||||
// 增
|
// 增
|
||||||
handleCreate () {
|
handleCreate () {
|
||||||
|
|
Loading…
Reference in New Issue