提交 e1256285 authored 作者: huang's avatar huang

添加模块菜单

上级 d3b5272d
...@@ -30,9 +30,33 @@ export function addAnnouncement(data) { ...@@ -30,9 +30,33 @@ export function addAnnouncement(data) {
export function getAnnouncement(data) { export function getAnnouncement(data) {
return request({ return request({
url: '/announcement/getAnnouncement', url: '/announcement/getAnnouncement',
method: 'get', method: 'post',
data: data
})
}
// update announcement
export function updateAnnouncement(data) {
return request({
url: '/announcement/updateAnnouncement',
method: 'post',
data: data data: data
}) })
} }
//delete announce
export function delAnnouncement(ids) {
return request({
url: '/announcement/delAnnouncement/'+ids,
method: 'delete'
})
}
//activate announcement
export function activateAnnouncement(ids) {
return request({
url: '/announcement/activateAnnouncement/'+ids,
method: 'get'
})
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div style="background:#eee;padding: 20px;margin-bottom: 20px"> <div style="background:#eee;padding: 20px;margin-bottom: 20px">
<Card :bordered="false"> <Card :bordered="false">
<p slot="title">当前公告通知</p> <p slot="title">当前公告通知</p>
<p v-if="announcement==null">通知公告为空哦~快去添加吧</p> <p v-if="announcement==null">通知公告为空哦~快去添加吧或选择一个吧!!</p>
<p v-else v-text="announcement.content"></p> <p v-else v-text="announcement.content"></p>
</Card> </Card>
</div> </div>
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']" >删除</el-button> <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']" >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button type="success" icon="el-icon-delete" size="mini" :disabled="single" @click="handleActivate" v-hasPermi="['system:user:active']" >激活</el-button>
</el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="announcementList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="announcementList" @selection-change="handleSelectionChange">
...@@ -29,14 +32,12 @@ ...@@ -29,14 +32,12 @@
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']" >修改</el-button>
<el-button v-if="scope.row.userId !== 1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']" >删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!--分页按钮组-->
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"
/>
<!-- 添加或修改公告通知对话框 --> <!-- 添加或修改公告通知对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getList,getCurrent,addAnnouncement,getAnnouncement} from "@/api/announcement/announcementList"; import { getList,getCurrent,addAnnouncement,getAnnouncement,updateAnnouncement,delAnnouncement,activateAnnouncement} from "@/api/announcement/announcementList";
export default { export default {
//页签缓存页面的name要和路由中的那么要相同,才能缓存, //页签缓存页面的name要和路由中的那么要相同,才能缓存,
//如果是自定义菜单,则页面的name和菜单管理中路由地址要相同,才能页签缓存 //如果是自定义菜单,则页面的name和菜单管理中路由地址要相同,才能页签缓存
...@@ -97,8 +98,9 @@ ...@@ -97,8 +98,9 @@
getList() { getList() {
this.loading = true; this.loading = true;
getList(this.queryParams).then(response=>{ getList(this.queryParams).then(response=>{
this.announcementList = response.data this.announcementList = response.rows
this.loading = false this.total=response.total
this.loading = false
}) })
}, },
/** get current announcement */ /** get current announcement */
...@@ -107,6 +109,7 @@ ...@@ -107,6 +109,7 @@
getCurrent().then(response=>{ getCurrent().then(response=>{
if (response.data){ if (response.data){
this.announcement = response.data this.announcement = response.data
this.loading = false
} }
}) })
}, },
...@@ -130,14 +133,15 @@ ...@@ -130,14 +133,15 @@
}, },
//多选框选中数据 //多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId) this.ids = selection.map(item => item.id)
this.single = selection.length!=1 this.single = selection.length!=1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
//清空表单
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids[0]
let data ={ let data ={
id:id id:id
} }
...@@ -147,18 +151,34 @@ ...@@ -147,18 +151,34 @@
this.title = "修改公告通知内容"; this.title = "修改公告通知内容";
}); });
}, },
/** 激活按钮操作 */
handleActivate(row){
const ids = row.id || this.ids[0]
this.$confirm('激活以在小程序端展示?', "确认", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return activateAnnouncement(ids);
}).then(() => {
//重置
this.getCurrent()
this.msgSuccess("激活成功");
}).catch(function() {});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.dictId != undefined) {
updateType(this.form).then(response => { if (this.form.id != undefined) {
updateAnnouncement(this.form).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
} else { } else {
this.msgError(response.msg); this.msgError("修改失败:"+response.msg);
} }
}); });
} else { } else {
...@@ -177,30 +197,17 @@ ...@@ -177,30 +197,17 @@
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictIds = row.dictId || this.ids; const ids = row.dictId || this.ids;
this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', "警告", { this.$confirm('是否确认删除已选中的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function() {
return delType(dictIds); return delAnnouncement(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); }).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有类型数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportType(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
} }
} }
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论