Commit 79d574f4 authored by 黄奎's avatar 黄奎

页面修改

parent 534e9667
...@@ -52,6 +52,54 @@ export function getMenuLevelList() { ...@@ -52,6 +52,54 @@ export function getMenuLevelList() {
return MenuLevelOpts; return MenuLevelOpts;
} }
/**
* 获取部门层级列表
*/
export function getDeptTierList() {
var deptTierOpts = [{
label: '1级',
value: 1
},
{
label: '2级',
value: 2
},
{
label: '3级',
value: 3
},
{
label: '4级',
value: 4
},
{
label: '5级',
value: 5
},
{
label: '6级',
value: 6
},
{
label: '7级',
value: 7
},
{
label: '8级',
value: 8
},
{
label: '9级',
value: 9
},
{
label: '10级',
value: 10
},
];
return deptTierOpts;
}
/** /**
* 获取菜单分页列表 * 获取菜单分页列表
* *
......
...@@ -7,16 +7,32 @@ ...@@ -7,16 +7,32 @@
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="text-caption q-mb-lg q-px-md text-grey-6">部门信息</div> <div class="text-caption q-mb-lg q-px-md text-grey-6">部门信息</div>
<div class="row wrap"> <div class="row wrap">
<q-select filled stack-label option-value="SId" option-label="SName" v-model="objOption.School_Id"
ref="School_Id" :options="schoolList" label="所属校区" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value
map-options :rules="[val => !!val || '请选择所属校区']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.DeptName" ref="DeptName" <q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.DeptName" ref="DeptName"
class="col-6 q-pr-lg q-pb-lg" label="部门名称" :rules="[val => !!val || '请填写部门名称']" /> class="col-6 q-pr-lg q-pb-lg" label="部门名称" :rules="[val => !!val || '请填写部门名称']" />
<q-input filled stack-label maxlength="50" :dense="false" v-model="objOption.DeptTel" ref="DeptTel" <q-select filled stack-label option-value="value" option-label="label" v-model="objOption.DeptTier"
class="col-6 q-pr-lg q-pb-lg" label="部门电话" /> ref="DeptTier" :options="DeptTierList" label="部门层级" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value
map-options :rules="[val => !!val || '部门层级']" />
<selectTree v-if="DeptTreeList&&DeptTreeList.length>0" :treeData='DeptTreeList' :defaultArray="returnString" <selectTree v-if="DeptTreeList&&DeptTreeList.length>0" :treeData='DeptTreeList' :defaultArray="returnString"
nodeKey="DeptId" :multiple="false" labelKey="DeptName" childrenKey="ChildList" tipText="选择上级部门" nodeKey="DeptId" :multiple="false" labelKey="DeptName" childrenKey="ChildList" tipText="选择上级部门"
@getChild="getChild" classStr="col-6 q-pr-lg q-pb-lg"></selectTree> @getChild="getChild" classStr="col-6 q-pr-lg q-pb-lg"></selectTree>
<q-select :option-value="(item) => item === null ? null : item.MenuId" option-label="MenuName" <q-select class="col-6 q-pb-lg q-pr-lg" multiple clearable filled stack-label use-input use-chips
v-model="objOption.ParentId" :options="PersionList" label="部门负责人" :dense="false" emit-value map-options option-value="Id" option-label="EmployeeName" v-model="tempManager" ref="ManagerId" :options="PersionList"
class="col-6 q-pr-lg q-pb-lg" /> label="部门负责人" :dense="false" emit-value map-options @filter="filterFn">
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
<q-input filled stack-label maxlength="50" :dense="false" v-model="objOption.DeptTel" ref="DeptTel"
class="col-6 q-pr-lg q-pb-lg" label="部门电话" />
<q-input filled stack-label maxlength="50" :dense="false" v-model="objOption.DeptSort" ref="DeptSort"
class="col-6 q-pr-lg q-pb-lg" label="排序" />
<div class="col-6 q-pr-lg q-pb-lg q-pt-lg"> <div class="col-6 q-pr-lg q-pb-lg q-pt-lg">
<q-toggle size="md" label="状态" color="primary" :false-value="1" :true-value="0" <q-toggle size="md" label="状态" color="primary" :false-value="1" :true-value="0"
v-model="objOption.Status" /> v-model="objOption.Status" />
...@@ -41,6 +57,15 @@ ...@@ -41,6 +57,15 @@
saveDeptInfo, saveDeptInfo,
getDeptInfo getDeptInfo
} from '../../api/system/dept' } from '../../api/system/dept'
import {
getSchoolDropdown,
} from '../../api/school/index'
import {
getDeptTierList
} from '../../api/system/index'
import {
queryEmployee
} from '../../api/users/user'
export default { export default {
props: { props: {
saveObj: { saveObj: {
...@@ -61,24 +86,71 @@ ...@@ -61,24 +86,71 @@
DeptTel: "", //部门联系电话 DeptTel: "", //部门联系电话
ManagerIds: "", //部门负责人编号 ManagerIds: "", //部门负责人编号
Status: 0, //状态(0-正常,1-禁用), Status: 0, //状态(0-正常,1-禁用),
School_Id: 0, //校区编号
DeptTier: 0, //部门层级
DeptSort: 0, //部门排序
}, },
optionTitle: "", optionTitle: "",
returnString: [], returnString: [], //部门树默认值
//部门树形列表 DeptTreeList: [], //部门树形列表
DeptTreeList: [],
saveLoading: false, saveLoading: false,
PersionList: [], PersionList: [], //员工列表
AllemployeeList: [], //所有员工
DeptTierList: [], //部门层级列表
schoolList: [], //校区列表
tempManager: [], //负责人编号数组
} }
}, },
created() { created() {
this.queryDeptTier();
this.queryDeptTree(); this.queryDeptTree();
this.getEmployee();
this.getSchool();
}, },
mounted() { mounted() {
this.initObj() this.initObj()
}, },
methods: { methods: {
//筛选员工
filterFn(val, update) {
update(() => {
if (val === '') {
this.PersionList = JSON.parse(JSON.stringify(this.AllemployeeList))
} else {
const needle = val.toLowerCase()
this.PersionList = this.AllemployeeList.filter(v => v.EmployeeName.toLowerCase().indexOf(needle) > -1)
}
})
},
//获取员工列表
getEmployee() {
var qMsg = {
EmployeeName: ""
}
queryEmployee(qMsg).then(res => {
if (res.Code == 1) {
var jsonData = res.Data;
if (jsonData && jsonData.length > 0) {
this.AllemployeeList = JSON.parse(JSON.stringify(jsonData));
this.PersionList = JSON.parse(JSON.stringify(jsonData));;
}
}
})
},
//部门层级列表
queryDeptTier() {
this.DeptTierList = getDeptTierList();
},
//获取校区
getSchool() {
getSchoolDropdown({}).then(res => {
this.schoolList = res.Data;
this.$forceUpdate();
})
},
//获取选中的部门
getChild(menuArray) { getChild(menuArray) {
var tempStr = ""; var tempStr = "0";
if (menuArray && menuArray != '') { if (menuArray && menuArray != '') {
tempStr = menuArray; tempStr = menuArray;
} }
...@@ -105,6 +177,10 @@ ...@@ -105,6 +177,10 @@
this.objOption.DeptTel = res.Data.DeptTel; this.objOption.DeptTel = res.Data.DeptTel;
this.objOption.ManagerIds = res.Data.ManagerIds; this.objOption.ManagerIds = res.Data.ManagerIds;
this.objOption.Status = res.Data.Status; this.objOption.Status = res.Data.Status;
this.objOption.DeptSort = res.Data.DeptSort;
this.objOption.DeptTier = res.Data.DeptTier;
this.objOption.School_Id = res.Data.School_Id;
this.tempManager = res.Data.ManagerList;
}) })
this.optionTitle = "修改部门信息" this.optionTitle = "修改部门信息"
} else { } else {
...@@ -115,26 +191,43 @@ ...@@ -115,26 +191,43 @@
this.objOption.DeptTel = ""; this.objOption.DeptTel = "";
this.objOption.ManagerIds = ""; this.objOption.ManagerIds = "";
this.objOption.Status = 0; this.objOption.Status = 0;
this.objOption.DeptSort = 0;
this.objOption.DeptTier = 0;
this.objOption.School_Id = 0;
this.tempManager = [];
} }
}, },
//关闭弹窗 //关闭弹窗
closeSaveForm() { closeSaveForm() {
this.$emit('close') this.$emit('close')
this.persistent = false this.persistent = false;
}, },
//保存部门 //保存部门
saveDept() { saveDept() {
this.saveLoading = true this.saveLoading = true;
var tempStr = "";
if (this.tempManager && this.tempManager.length > 0) {
this.tempManager.forEach(item => {
tempStr += "," + item;
});
}
if (tempStr && tempStr != '') {
//去掉第一个字符
tempStr = tempStr.substr(1);
}
this.objOption.ManagerIds = tempStr;
saveDeptInfo(this.objOption).then(res => { saveDeptInfo(this.objOption).then(res => {
this.saveLoading = false this.saveLoading = false
this.$q.notify({ if (res.Code == 1) {
icon: 'iconfont icon-chenggong', this.$q.notify({
color: 'accent', icon: 'iconfont icon-chenggong',
timeout: 2000, color: 'accent',
message: '数据保存成功!', timeout: 2000,
position: 'top' message: '数据保存成功!',
}) position: 'top'
this.$emit("success") })
this.$emit("success")
}
this.closeSaveForm() this.closeSaveForm()
}).catch(() => { }).catch(() => {
this.saveLoading = false this.saveLoading = false
......
...@@ -253,6 +253,7 @@ ...@@ -253,6 +253,7 @@
this.getSchool() this.getSchool()
}, },
methods: { methods: {
//筛选员工
filterFn(val, update) { filterFn(val, update) {
update(() => { update(() => {
if (val === '') { if (val === '') {
......
...@@ -2,10 +2,25 @@ ...@@ -2,10 +2,25 @@
<div class="page-body"> <div class="page-body">
<div class="page-search row items-center"> <div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md"> <div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-select @input="resetSearch" filled stack-label option-value="SId" option-label="SName"
v-model="msg.School_Id" :options="schoolList" label="校区" :dense="false" class="col-6 q-pr-lg q-pb-lg"
emit-value map-options clearable @clear="resetSearch" />
</div>
<div class="col-3"> <div class="col-3">
<q-input @change="resetSearch" clearable standout="bg-primary text-white" v-model="msg.DeptName" <q-input @change="resetSearch" clearable standout="bg-primary text-white" v-model="msg.DeptName"
label="部门名称" /> label="部门名称" />
</div> </div>
<div class="col-3">
<q-select @input="resetSearch" filled stack-label option-value="value" option-label="label"
v-model="msg.DeptTier" ref="DeptTier" :options="DeptTierList" label="部门层级" :dense="false"
class="col-6 q-pr-lg q-pb-lg" emit-value map-options clearable @clear="resetSearch" />
</div>
<div class="col-3">
<selectTree v-if="DeptTreeList&&DeptTreeList.length>0" :treeData='DeptTreeList' :defaultArray="returnString"
nodeKey="DeptId" :multiple="false" labelKey="DeptName" childrenKey="ChildList" tipText="选择上级部门"
@getChild="getChild" classStr="col-6 q-pr-lg q-pb-lg"></selectTree>
</div>
<div class="col-3"> <div class="col-3">
<q-select @input="resetSearch" standout="bg-primary text-white" v-model="msg.Status" :options="ShowOpts" <q-select @input="resetSearch" standout="bg-primary text-white" v-model="msg.Status" :options="ShowOpts"
emit-value map-options label="状态" /> emit-value map-options label="状态" />
...@@ -46,22 +61,31 @@ ...@@ -46,22 +61,31 @@
import { import {
getDeptPage, getDeptPage,
setDeptStatusInfo, setDeptStatusInfo,
getDeptTree
} from '../../api/system/dept' } from '../../api/system/dept'
import {
getSchoolDropdown,
} from '../../api/school/index'
import {
getDeptTierList
} from '../../api/system/index'
import deptForm from '../../components/system/dept-form' import deptForm from '../../components/system/dept-form'
import selectTree from '../../components/common/select-tree'
export default { export default {
meta: { meta: {
title: "部门管理" title: "部门管理"
}, },
components: { components: {
deptForm, deptForm,
selectTree
}, },
data() { data() {
return { return {
currentUrl: "", currentUrl: "",
columns: [{ columns: [{
name: 'DeptId', name: 'SchoolName',
label: '部门编号', label: '校区',
field: 'DeptId', field: 'SchoolName',
align: 'left' align: 'left'
}, },
{ {
...@@ -72,9 +96,9 @@ ...@@ -72,9 +96,9 @@
field: row => row.DeptName field: row => row.DeptName
}, },
{ {
name: 'ParentDeptName', name: 'DeptTier',
label: '上级部门', label: '部门层级',
field: 'ParentDeptName', field: 'DeptTier',
align: 'left' align: 'left'
}, },
{ {
...@@ -90,9 +114,9 @@ ...@@ -90,9 +114,9 @@
align: 'left' align: 'left'
}, },
{ {
name: 'CreateTimeStr', name: 'DeptSort',
label: '创建时间', label: '排序',
field: 'CreateTimeStr', field: 'DeptSort',
align: 'left' align: 'left'
}, },
{ {
...@@ -129,17 +153,57 @@ ...@@ -129,17 +153,57 @@
DeptName: "", //部门名称 DeptName: "", //部门名称
DeptId: 0, //部门编号 DeptId: 0, //部门编号
Status: "-1", Status: "-1",
School_Id: "",
DeptTier: "",
ParentId: "",
}, },
pageCount: 0, pageCount: 0,
returnString: [], //树形结构初始化数组
isShowDeptForm: false, isShowDeptForm: false,
deptObjOption: null, deptObjOption: null,
schoolList: [], //校区列表
DeptTierList: [], //部门层级
DeptTreeList: [], //部门树形结构列表
} }
}, },
created() {
this.queryDeptTier();
this.queryDeptTree();
this.getSchool();
},
mounted() { mounted() {
this.currentUrl = this.$route.path; this.currentUrl = this.$route.path;
this.queryDeptPage(); this.queryDeptPage();
}, },
methods: { methods: {
//获取部门树形结构
queryDeptTree() {
getDeptTree({}).then(res => {
if (res.Code == 1) {
this.DeptTreeList = res.Data;
}
})
},
//获取选中的部门
getChild(menuArray) {
var tempStr = "0";
if (menuArray && menuArray != '') {
tempStr = menuArray;
}
this.msg.ParentId = tempStr;
this.resetSearch();
},
//部门层级列表
queryDeptTier() {
this.DeptTierList = getDeptTierList();
},
//获取校区
getSchool() {
getSchoolDropdown({}).then(res => {
this.schoolList = res.Data;
this.$forceUpdate();
})
},
gotoRelation() { gotoRelation() {
var tempStr = '/system/deptrelation'; var tempStr = '/system/deptrelation';
this.$router.push({ this.$router.push({
...@@ -158,11 +222,29 @@ ...@@ -158,11 +222,29 @@
}, },
//获取部门分页列表 //获取部门分页列表
queryDeptPage() { queryDeptPage() {
if (this.msg.School_Id == "" || this.msg.School_Id == null) {
this.msg.School_Id = "0";
}
if (this.msg.DeptTier == "" || this.msg.DeptTier == null) {
this.msg.DeptTier = "0"
}
if (this.msg.ParentId == "" || this.msg.ParentId == null) {
this.msg.ParentId = "0"
}
this.loading = true; this.loading = true;
getDeptPage(this.msg).then(res => { getDeptPage(this.msg).then(res => {
this.loading = false; this.loading = false;
this.data = res.Data.PageData; this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount; this.pageCount = res.Data.PageCount;
if (this.msg.School_Id == "0") {
this.msg.School_Id = "";
}
if (this.msg.DeptTier == "0") {
this.msg.DeptTier = ""
}
if (this.msg.ParentId == "0") {
this.msg.ParentId = ""
}
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false;
}) })
......
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