Commit a4b1aa57 authored by 黄奎's avatar 黄奎

新增页面

parent 0aa6144d
import request from '../../utils/request'
/**
* 获取部门分页列表
*/
export function getDeptPage(data) {
return request({
url: '/User/GetDeptPageList',
method: 'post',
data
});
}
/**
* 获取部门列表
*/
export function getDeptList(data) {
return request({
url: '/User/GetDeptList',
method: 'post',
data
});
}
/**
* 获取部门树形列表
*/
export function getDeptTree(data) {
return request({
url: '/User/GetDeptTree',
method: 'post',
data
});
}
/**
* 新增修改部门信息
*/
export function saveDeptInfo(data) {
return request({
url: '/User/SetDept',
method: 'post',
data
});
}
/**
* 获取部门信息
*/
export function getDeptInfo(data)
{
return request({
url: '/User/GetDept',
method: 'post',
data
});
}
/**
* 设置部门状态
*/
export function setDeptStatusInfo(data)
{
return request({
url: '/User/RemoveDept',
method: 'post',
data
});
}
\ No newline at end of file
import request from '../../utils/request'
/**
* 获取岗位分页列表
*/
export function getPostPage(data) {
return request({
url: '/User/GetPostPageList',
method: 'post',
data
});
}
/**
* 获取岗位列表
*/
export function getPostList(data) {
return request({
url: '/User/GetPostList',
method: 'post',
data
});
}
/**
* 新增修改岗位信息
*/
export function savePostInfo(data) {
return request({
url: '/User/SetPost',
method: 'post',
data
});
}
/**
* 获取岗位信息
*/
export function getPostInfo(data) {
return request({
url: '/User/GetPost',
method: 'post',
data
});
}
/**
* 设置岗位状态
*/
export function setPostStatusInfo(data) {
return request({
url: '/User/RemovePost',
method: 'post',
data
});
}
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input @change="resetSearch" clearable standout="bg-primary text-white" v-model="msg.DeptName"
label="部门名称" />
</div>
<div class="col-3">
<q-select @input="resetSearch" standout="bg-primary text-white" v-model="msg.Status" :options="ShowOpts"
emit-value map-options label="状态" />
</div>
</div>
<div class="page-option">
<q-btn color="accent" class="q-mr-md" icon="add" label="新增部门" @click="EditDept(null)" />
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-tow-column-table"
separator="none" title="部门信息" :data="data" :columns="columns" row-key="name">
<template v-slot:body-cell-Status="props">
<q-td :props="props">
<q-toggle size="md" color="primary" :false-value="1" :true-value="0" v-model="props.row.Status"
title="注意:关闭后,分类将无法正常使用." @input="DeleteMenu(props.row)" />
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
<template v-slot:body-cell-optioned="props">
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditDept(props.row)" />
</q-td>
</template>
</q-table>
<menu-form v-if="isShowDeptForm" :save-obj="deptObjOption" @close="closeDeptSaveForm" @success="refreshPage">
</menu-form>
</div>
</div>
</template>
<script>
import {
getDeptPage,
setDeptStatusInfo,
} from '../../api/system/dept'
import menuForm from '../../components/system/menu-form'
export default {
meta: {
title: "部门管理"
},
components: {
menuForm,
},
data() {
return {
currentUrl: "",
columns: [{
name: 'DeptId',
label: '部门编号',
field: 'DeptId',
align: 'left'
},
{
name: 'DeptName',
required: true,
label: '部门名称',
align: 'left',
field: row => row.DeptName
},
{
name: 'MenuUrl',
label: '负责人',
field: 'MenuUrl',
align: 'left'
},
{
name: 'DeptTel',
label: '电话',
field: 'DeptTel',
align: 'left'
},
{
name: 'CreateTimeStr',
label: '创建时间',
field: 'CreateTimeStr',
align: 'left'
},
{
name: 'Status',
label: '状态',
align: 'left',
field: 'Status'
},
{
name: 'optioned',
label: '操作',
field: 'MenuId'
}
],
data: [],
loading: true,
ShowOpts: [{
label: '全部',
value: '-1'
},
{
label: '正常',
value: '0'
},
{
label: '删除',
value: '1'
}
],
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
DeptName: "", //部门编号
DeptId: 0, //部门编号
Status: "-1",
},
pageCount: 0,
isShowDeptForm: false,
deptObjOption: null,
}
},
mounted() {
this.currentUrl = this.$route.path
this.queryDeptPage()
},
methods: {
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
this.queryDeptPage();
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.queryDeptPage()
},
//获取菜单分页列表
queryDeptPage() {
this.loading = true;
getDeptPage(this.msg).then(res => {
console.log("res", res);
this.loading = false
this.data = res.Data.PageData
this.pageCount = res.Data.PageCount
}).catch(() => {
this.loading = false
})
},
//刷新页面
refreshPage() {
if (!this.deptObjOption) {
this.msg.pageIndex = 1;
this.msg.DeptName = "";
this.msg.DeptId = 0;
this.msg.Status = "-1";
}
this.queryDeptPage()
},
//新增修改部门
EditDept(obj) {
if (obj) {
this.deptObjOption = obj
} else {
this.deptObjOption = null
}
this.isShowDeptForm = true
},
//关闭弹窗
closeDeptSaveForm() {
this.isShowDeptForm = false
},
//修改菜单状态
DeleteMenu(obj) {
var that = this;
var delMsg = {
DeptId: obj.DeptId,
Status: obj.Status
};
var tipMsg = "";
if (delMsg.Status == 0) {
tipMsg = "是否启用【" + obj.DeptName + "】菜单?";
} else {
tipMsg = "是否禁用【" + obj.DeptName + "】菜单?";
}
this.$q.dialog({
title: '提示信息',
message: tipMsg,
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
setDeptStatusInfo(delMsg).then(res => {
if (res.Code == 1) {
that.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功',
position: 'top'
})
that.queryDeptPage();
}
})
}).onCancel(() => {
obj.Status = obj.Status == 1 ? 0 : 1;
});
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass');
</style>
......@@ -52,6 +52,16 @@ const routes = [{
component: () =>
import("pages/system/menu.vue")
},
{
path: "/system/dept", //部门管理
component: () =>
import("pages/system/dept.vue")
},
{
path: "/system/post", //岗位管理
component: () =>
import("pages/system/post.vue")
},
{
path: "/system/role", //角色管理
component: () =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment