Commit 647d7faa authored by 黄奎's avatar 黄奎

新增页面

parent abfcc41f
<template>
<div style="width:300px" :id="id">
<div :class="classStr" :id="id">
<!--多选-->
<template v-if="multiple">
<q-select filled v-model="resultObj" :options="selectList" clearable @clear="clearData()" :label="tipText"
:multiple="multiple" emit-value map-options>
<template v-slot:option="scope">
<q-item v-if="scope.index==0">
<q-item-section class="text-grey">
<q-item-section>
<q-tree :nodes="treeData" :node-key="nodeKey" :label-key="labelKey" :children-key="childrenKey"
tick-strategy="strict" :default-expand-all="defaultExpandAll" no-connectors
:ticked.sync="chooseTreeNodeArray">
......@@ -22,7 +22,7 @@
:multiple="multiple" emit-value map-options>
<template v-slot:option="scope">
<q-item v-if="scope.index==0">
<q-item-section class="text-grey">
<q-item-section>
<q-tree :nodes="treeData" :node-key="nodeKey" :label-key="labelKey" :children-key="childrenKey"
tick-strategy="strict" :default-expand-all="defaultExpandAll" no-connectors
:ticked.sync="chooseTreeNodeArray">
......@@ -37,6 +37,11 @@
<script>
export default {
props: {
//样式字符串
classStr: {
type: String,
default: ''
},
//树形结构列表
treeData: {
type: Array,
......
......@@ -102,7 +102,6 @@
queryTeachPlanInfo({
PlanId: this.saveObj.PlanId
}).then(res => {
console.log("res", res.Data)
this.objOption.PlanName = res.Data.PlanName;
this.objOption.PlanId = res.Data.PlanId;
this.objOption.CourseId = res.Data.CourseId;
......
<template>
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.MenuId==0?'新增部门信息':'修改部门信息'}}</div>
</q-card-section>
<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="row wrap">
<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 || '请填写部门名称']" />
<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="部门电话" />
<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>
<q-select :option-value="(item) => item === null ? null : item.MenuId" option-label="MenuName"
v-model="objOption.ParentId" :options="PersionList" label="部门负责人" :dense="false" emit-value map-options
class="col-6 q-pr-lg q-pb-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"
v-model="objOption.Status" />
<div class="text-grey-6 text-caption">注意:关闭后,部门将无法正常使用.</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveDept" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import selectTree from '../common/select-tree'
import {
getDeptTree,
saveDeptInfo,
getDeptInfo
} from '../../api/system/dept'
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
components: {
selectTree
},
data() {
return {
persistent: true,
objOption: {
DeptId: 0, //部门编号
ParentId: 0, //上级部门编号
DeptName: "", //部门名称
DeptTel: "", //部门联系电话
ManagerIds: "", //部门负责人编号
Status: 0, //状态(0-正常,1-禁用),
},
optionTitle: "",
returnString: [],
//部门树形列表
DeptTreeList: [],
saveLoading: false,
PersionList: [],
}
},
created() {
this.queryDeptTree();
},
mounted() {
this.initObj()
},
methods: {
getChild(menuArray) {
var tempStr = "";
if (menuArray && menuArray != '') {
tempStr = menuArray;
}
this.objOption.ParentId = tempStr;
},
//获取部门树形结构
queryDeptTree() {
getDeptTree({}).then(res => {
if (res.Code == 1) {
this.DeptTreeList = res.Data;
}
})
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.DeptId > 0) {
getDeptInfo({
DeptId: this.saveObj.DeptId
}).then(res => {
this.objOption.DeptId = res.Data.DeptId;
this.objOption.ParentId = res.Data.ParentId.toString();
this.returnString.push(this.objOption.ParentId);
this.objOption.DeptName = res.Data.DeptName;
this.objOption.DeptTel = res.Data.DeptTel;
this.objOption.ManagerIds = res.Data.ManagerIds;
this.objOption.Status = res.Data.Status;
})
this.optionTitle = "修改部门信息"
} else {
this.optionTitle = "新增部门"
this.objOption.DeptId = 0;
this.objOption.ParentId = 0;
this.objOption.DeptName = "";
this.objOption.DeptTel = "";
this.objOption.ManagerIds = "";
this.objOption.Status = 0;
}
},
//关闭弹窗
closeSaveForm() {
this.$emit('close')
this.persistent = false
},
//保存部门
saveDept() {
this.saveLoading = true
saveDeptInfo(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
}
},
}
</script>
<template>
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.MenuId==0?'新增岗位信息':'修改岗位信息'}}</div>
</q-card-section>
<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="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.PostName" ref="PostName"
class="col-6 q-pr-lg q-pb-lg" label="岗位名称" :rules="[val => !!val || '请填写岗位名称']" />
<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 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"
v-model="objOption.Status" />
<div class="text-grey-6 text-caption">注意:关闭后,岗位将无法正常使用.</div>
</div>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" color="dark" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="savePost" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import selectTree from '../common/select-tree'
import {
getDeptTree,
} from '../../api/system/dept'
import {
getPostInfo,
savePostInfo
}
from '../../api/system/post'
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
components: {
selectTree
},
data() {
return {
persistent: true,
objOption: {
PostId: 0, //岗位编号
PostName: "", //岗位名称
RB_Dept_Id: 0, //所属部门
Status: 0, //状态(0-正常,1-禁用),
},
optionTitle: "",
returnString: [],
//岗位树形列表
DeptTreeList: [],
saveLoading: false,
PersionList: [],
}
},
created() {
this.queryDeptTree();
},
mounted() {
this.initObj()
},
methods: {
getChild(menuArray) {
var tempStr = "";
if (menuArray && menuArray != '') {
tempStr = menuArray;
}
this.objOption.RB_Dept_Id = tempStr;
},
//获取岗位树形结构
queryDeptTree() {
getDeptTree({}).then(res => {
if (res.Code == 1) {
this.DeptTreeList = res.Data;
}
})
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.PostId > 0) {
getPostInfo({
PostId: this.saveObj.PostId
}).then(res => {
this.objOption.PostId = res.Data.PostId;
this.objOption.RB_Dept_Id = res.Data.RB_Dept_Id.toString();
this.returnString.push(this.objOption.RB_Dept_Id);
this.objOption.PostName = res.Data.PostName;
this.objOption.Status = res.Data.Status;
})
this.optionTitle = "修改岗位信息"
} else {
this.optionTitle = "新增岗位"
this.objOption.PostId = 0;
this.objOption.RB_Dept_Id = 0;
this.objOption.PostName = "";
this.objOption.Status = 0;
}
},
//关闭弹窗
closeSaveForm() {
this.$emit('close')
this.persistent = false
},
//保存岗位
savePost() {
this.saveLoading = true
savePostInfo(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
}
},
}
</script>
......@@ -20,7 +20,7 @@
<div class="row wrap">
<selectTree v-if="TreeMenuList&&TreeMenuList.length>0" :treeData='TreeMenuList' :defaultArray="returnString"
nodeKey="MenuId" :multiple="true" labelKey="MenuName" childrenKey="SubList" tipText="选择菜单"
@getChild="getChild"></selectTree>
@getChild="getChild" classStr="col-6 q-pr-lg q-pb-lg"></selectTree>
</div>
</q-card-section>
<q-separator />
......
......@@ -171,7 +171,6 @@
getchaperTree() {
this.loading = true;
queryChapterTree(this.msg).then(res => {
console.log("res", res);
this.loading = false
this.data = res.Data;
}).catch(() => {
......
......@@ -21,7 +21,7 @@
<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)" />
title="注意:关闭后,分类将无法正常使用." @input="SetDeptStatus(props.row)" />
</q-td>
</template>
<template v-slot:bottom>
......@@ -35,8 +35,8 @@
</q-td>
</template>
</q-table>
<menu-form v-if="isShowDeptForm" :save-obj="deptObjOption" @close="closeDeptSaveForm" @success="refreshPage">
</menu-form>
<dept-form v-if="isShowDeptForm" :save-obj="deptObjOption" @close="closeDeptSaveForm" @success="refreshPage">
</dept-form>
</div>
</div>
</template>
......@@ -46,13 +46,13 @@
getDeptPage,
setDeptStatusInfo,
} from '../../api/system/dept'
import menuForm from '../../components/system/menu-form'
import deptForm from '../../components/system/dept-form'
export default {
meta: {
title: "部门管理"
},
components: {
menuForm,
deptForm,
},
data() {
return {
......@@ -71,9 +71,15 @@
field: row => row.DeptName
},
{
name: 'MenuUrl',
name: 'ParentDeptName',
label: '上级部门',
field: 'ParentDeptName',
align: 'left'
},
{
name: 'ManagerName',
label: '负责人',
field: 'MenuUrl',
field: 'ManagerName',
align: 'left'
},
{
......@@ -97,7 +103,7 @@
{
name: 'optioned',
label: '操作',
field: 'MenuId'
field: 'DeptId'
}
],
data: [],
......@@ -119,7 +125,7 @@
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
DeptName: "", //部门编号
DeptName: "", //部门名称
DeptId: 0, //部门编号
Status: "-1",
},
......@@ -129,8 +135,8 @@
}
},
mounted() {
this.currentUrl = this.$route.path
this.queryDeptPage()
this.currentUrl = this.$route.path;
this.queryDeptPage();
},
methods: {
//重新查询
......@@ -141,18 +147,17 @@
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.queryDeptPage()
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
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
}).catch(() => {
this.loading = false
this.loading = false;
})
},
//刷新页面
......@@ -163,23 +168,23 @@
this.msg.DeptId = 0;
this.msg.Status = "-1";
}
this.queryDeptPage()
this.queryDeptPage();
},
//新增修改部门
EditDept(obj) {
if (obj) {
this.deptObjOption = obj
this.deptObjOption = obj;
} else {
this.deptObjOption = null
this.deptObjOption = null;
}
this.isShowDeptForm = true
this.isShowDeptForm = true;
},
//关闭弹窗
closeDeptSaveForm() {
this.isShowDeptForm = false
this.isShowDeptForm = false;
},
//修改菜单状态
DeleteMenu(obj) {
//修改部门状态
SetDeptStatus(obj) {
var that = this;
var delMsg = {
DeptId: obj.DeptId,
......@@ -187,9 +192,9 @@
};
var tipMsg = "";
if (delMsg.Status == 0) {
tipMsg = "是否启用【" + obj.DeptName + "】菜单?";
tipMsg = "是否启用【" + obj.DeptName + "】部门?";
} else {
tipMsg = "是否禁用【" + obj.DeptName + "】菜单?";
tipMsg = "是否禁用【" + obj.DeptName + "】部门?";
}
this.$q.dialog({
title: '提示信息',
......
<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.PostName"
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="EditPost(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="SetPostStatus(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="EditPost(props.row)" />
</q-td>
</template>
</q-table>
<post-form v-if="isShowPostForm" :save-obj="postObjOption" @close="closeDeptSaveForm" @success="refreshPage">
</post-form>
</div>
</div>
</template>
<script>
import {
getPostPage,
setPostStatusInfo,
} from '../../api/system/post'
import postForm from '../../components/system/post-form'
export default {
meta: {
title: "岗位管理"
},
components: {
postForm,
},
data() {
return {
currentUrl: "",
columns: [{
name: 'PostId',
label: '岗位编号',
field: 'PostId',
align: 'left'
},
{
name: 'PostName',
required: true,
label: '岗位名称',
align: 'left',
field: row => row.PostName
},
{
name: 'DeptName',
label: '所属部门',
field: 'DeptName',
align: 'left'
},
{
name: 'UpdateByName',
label: '操作人',
field: 'UpdateByName',
align: 'left'
},
{
name: 'UpdateTimeStr',
label: '创建时间',
field: 'UpdateTimeStr',
align: 'left'
},
{
name: 'Status',
label: '状态',
align: 'left',
field: 'Status'
},
{
name: 'optioned',
label: '操作',
field: 'PostId'
}
],
data: [],
loading: true,
ShowOpts: [{
label: '全部',
value: '-1'
},
{
label: '正常',
value: '0'
},
{
label: '删除',
value: '1'
}
],
msg: {
pageIndex: 1,
pageSize: 12,
rowsPerPage: 12,
PostName: "", //岗位名称
PostId: 0, //岗位编号
Status: "-1",
},
pageCount: 0,
isShowPostForm: false,
postObjOption: null,
}
},
mounted() {
this.currentUrl = this.$route.path;
this.queryPostPage();
},
methods: {
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
this.queryPostPage();
},
//翻页
changePage(val) {
this.msg.pageIndex = val;
this.queryPostPage();
},
//获取岗位分页列表
queryPostPage() {
this.loading = true;
getPostPage(this.msg).then(res => {
this.loading = false;
this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount;
}).catch(() => {
this.loading = false;
})
},
//刷新页面
refreshPage() {
if (!this.postObjOption) {
this.msg.pageIndex = 1;
this.msg.PostName = "";
this.msg.PostId = 0;
this.msg.Status = "-1";
}
this.queryPostPage();
},
//新增修改岗位
EditPost(obj) {
if (obj) {
this.postObjOption = obj;
} else {
this.postObjOption = null;
}
this.isShowPostForm = true;
},
//关闭弹窗
closeDeptSaveForm() {
this.isShowPostForm = false;
},
//修改岗位状态
SetPostStatus(obj) {
var that = this;
var delMsg = {
PostId: obj.PostId,
Status: obj.Status
};
var tipMsg = "";
if (delMsg.Status == 0) {
tipMsg = "是否启用【" + obj.PostName + "】岗位?";
} else {
tipMsg = "是否禁用【" + obj.PostName + "】岗位?";
}
this.$q.dialog({
title: '提示信息',
message: tipMsg,
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
setPostStatusInfo(delMsg).then(res => {
if (res.Code == 1) {
that.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功',
position: 'top'
})
that.queryPostPage();
}
})
}).onCancel(() => {
obj.Status = obj.Status == 1 ? 0 : 1;
});
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass');
</style>
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