Commit 8a2f0a2c authored by zhengke's avatar zhengke
parents 9fdc599e 538d1e2a
...@@ -26,7 +26,6 @@ export function getSchoolDropdown(data) { ...@@ -26,7 +26,6 @@ export function getSchoolDropdown(data) {
/** /**
* 获取学校分页列表 * 获取学校分页列表
*
*/ */
export function saveSchool(data) { export function saveSchool(data) {
return request({ return request({
...@@ -36,6 +35,17 @@ export function saveSchool(data) { ...@@ -36,6 +35,17 @@ export function saveSchool(data) {
}) })
} }
/**
* 根据校区编号获取校区信息
*/
export function getSchoolInfo(data) {
return request({
url: '/user/GetSchool',
method: 'post',
data
})
}
/** /**
* 获取教师分页数据 * 获取教师分页数据
*/ */
...@@ -371,8 +381,8 @@ export function createManagerAccount(data) { ...@@ -371,8 +381,8 @@ export function createManagerAccount(data) {
/** /**
* 获取学历列表 * 获取学历列表
* *
*/ */
export function getEducation(data){ export function getEducation(data) {
return request({ return request({
url: '/User/GetEducationList', url: '/User/GetEducationList',
method: 'post', method: 'post',
...@@ -383,11 +393,11 @@ export function getEducation(data){ ...@@ -383,11 +393,11 @@ export function getEducation(data){
/** /**
* 获取在职状态 * 获取在职状态
* *
*/ */
export function GetLeaveStatus(data){ export function GetLeaveStatus(data) {
return request({ return request({
url: '/User/GetLeaveStatus', url: '/User/GetLeaveStatus',
method: 'post', method: 'post',
data data
}); });
} }
\ No newline at end of file
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.SId==0?'新增校区':'修改校区'}}</div>
</q-card-section>
<div class="text-caption q-mb-lg q-px-md text-grey-6">基本资料</div>
<q-card-section class="q-pt-none">
<div class="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SName" ref="SName"
class="col-6 q-pr-lg q-pb-lg" label="校区名称" :rules="[val => !!val || '请填写校区名称']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SAddress" ref="SAddress"
class="col-6 q-pb-lg" label="校区地址" :rules="[val => !!val || '请填写校区地址']" />
<q-select class="col-6 q-pb-lg q-pr-lg" clearable filled stack-label use-input option-value="Id"
option-label="EmployeeName" v-model="objOption.ManagerId" ref="ManagerId" :options="EmployeeList"
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="20" :dense="false" v-model="objOption.SLinkTel" ref="SLinkTel"
class="col-6 q-pb-lg" label="校区联系电话" :rules="[val => !!val || '请填写校区联系电话']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.Remark"
class="col-6 q-pb-lg q-pr-lg" label="校区备注" />
<selectTree v-if="DeptList&&DeptList.length>0" :treeData='DeptList' :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-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="saveSchool" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
//校区相关
import {
saveSchool,
getSchoolInfo
} from '../../../api/school/index'
//部门
import {
getDeptTree
} from '../../../api/system/dept'
//员工
import {
queryEmployee
} from '../../../api/users/user'
//树形下拉
import selectTree from '../../../components/common/select-tree'
export default {
components: {},
props: {
saveObj: {
type: Object,
default: null
}
},
components: {
selectTree
},
data() {
return {
persistent: true,
objOption: {
SId: 0, //校区编号
SName: "", //校区名称
SAddress: "", //校区地址
SLinkTel: "", //校区联系电话
SDomain: "", //校区域名
SLogo: "", //校区Logo
Remark: "", //校区备注
Status: "0", //校区状态
Dept_Id: 0, //校区直属上级部门编号
ManagerId: 0, //校区负责人
},
optionTitle: "",
saveLoading: false,
DeptList: [], //部门列表
returnString: [], //默认部门数组
AllemployeeList: [], //所有员工列表
EmployeeList: [], //搜索后的员工列表
}
},
created() {
this.getEmployee();
this.queryDeptTree();
},
mounted() {
this.initObj();
},
methods: {
//初始化对象
initObj() {
if (this.saveObj && this.saveObj.SId > 0) {
getSchoolInfo({
SId: this.saveObj.SId
}).then(res => {
this.objOption.SId = res.Data.SId;
this.objOption.SName = res.Data.SName;
this.objOption.SAddress = res.Data.SAddress;
this.objOption.SLinkTel = res.Data.SLinkTel;
this.objOption.SDomain = res.Data.SDomain;
this.objOption.SLogo = res.Data.SLogo;
this.objOption.Remark = res.Data.Remark;
this.objOption.Status = res.Data.Status;
this.objOption.Dept_Id = res.Data.Dept_Id;
this.objOption.ManagerId = res.Data.ManagerId;
this.returnString.push(this.objOption.Dept_Id.toString());
})
} else {
this.objOption.SId = 0;
this.objOption.SName = "";
this.objOption.SAddress = "";
this.objOption.SLinkTel = "";
this.objOption.SDomain = "";
this.objOption.SLogo = "";
this.objOption.Remark = "";
this.objOption.Status = "0";
this.objOption.Dept_Id = 0;
this.objOption.ManagerId = 0;
}
this.persistent = true;
},
//筛选员工
filterFn(val, update) {
update(() => {
if (val === '') {
this.EmployeeList = JSON.parse(JSON.stringify(this.AllemployeeList))
} else {
const needle = val.toLowerCase()
this.EmployeeList = 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.EmployeeList = JSON.parse(JSON.stringify(jsonData));;
}
}
})
},
getChild(deptArray) {
var tempStr = "";
if (deptArray && deptArray != '') {
tempStr = deptArray;
}
this.objOption.Dept_Id = tempStr;
},
//获取部门结构树
queryDeptTree() {
getDeptTree({}).then(res => {
if (res.Code == 1) {
this.DeptList = res.Data;
}
})
},
//保存校区
saveSchool() {
this.saveLoading = true;
this.$refs.SName.validate()
this.$refs.SAddress.validate()
this.$refs.SLinkTel.validate()
if (
!this.$refs.SName.hasError &&
!this.$refs.SAddress.hasError &&
!this.$refs.SLinkTel.hasError
) {
if (this.tempManager && this.tempManager.Id) {
this.objOption.ManagerId = this.tempManager.Id;
}
saveSchool(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
if (this.objOption.SId == 0) {
this.msg.pageIndex = 1
}
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
} else {
this.saveLoading = false
}
},
closeSaveForm() {
this.persistent = false
},
}
}
</script>
<style>
.upload-assiatant-box .q-uploader__list {
display: none;
}
.upload-assiatant-box .q-uploader {
width: auto;
}
</style>
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<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"> <div class="col-3">
<q-input @change="resetSearch" clearable standout="bg-primary text-white" v-model="msg.SName" label="校区名称" /> <q-input @change="resetSearch" clearable standout="bg-primary text-white" v-model="msg.SName" label="校区名称"
@clear="resetSearch" />
</div> </div>
<div class="col-3"> <div class="col-3">
<q-select @input="resetSearch" standout="bg-primary text-white" v-model="StatusTemp" :options="StatusOpts" <q-select @input="resetSearch" standout="bg-primary text-white" v-model="StatusTemp" :options="StatusOpts"
...@@ -13,18 +14,17 @@ ...@@ -13,18 +14,17 @@
<div class="page-option"> <div class="page-option">
<!-- 原则上不能操作过三个按钮,建议不要使用查询按钮,增加用户操作次数 --> <!-- 原则上不能操作过三个按钮,建议不要使用查询按钮,增加用户操作次数 -->
<!-- <q-btn color="primary" outline label="立即查询" /> --> <!-- <q-btn color="primary" outline label="立即查询" /> -->
<q-btn color="accent" class="q-mr-md" icon="add" label="新增校区" @click="initObj(null)" /> <q-btn color="accent" class="q-mr-md" icon="add" label="新增校区" @click="EditSchool(null)" />
<q-btn-dropdown outline color="dark" label="更多"> <q-btn-dropdown outline color="dark" label="更多">
<q-list> <q-list>
<q-item clickable v-close-popup @click="onItemClick"> <q-item clickable v-close-popup @click="onItemClick">
<!-- <q-item-section side> <!-- <q-item-section side>
<q-icon name="style" /> <q-icon name="style" />
</q-item-section> --> </q-item-section> -->
<q-item-section> <q-item-section>
<q-item-label>导出</q-item-label> <q-item-label>导出</q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item clickable v-close-popup @click="onItemClick"> <q-item clickable v-close-popup @click="onItemClick">
<q-item-section> <q-item-section>
<q-item-label>导入</q-item-label> <q-item-label>导入</q-item-label>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<template v-slot:body-cell-optioned="props"> <template v-slot:body-cell-optioned="props">
<q-td :props="props"> <q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-family:perfectFont" label="编辑" <q-btn flat size="xs" icon="edit" color="accent" style="font-family:perfectFont" label="编辑"
@click="initObj(props.value)" /> @click="EditSchool(props.row)" />
</q-td> </q-td>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
...@@ -58,52 +58,8 @@ ...@@ -58,52 +58,8 @@
:input="true" @input="changePage" /> :input="true" @input="changePage" />
</template> </template>
</q-table> </q-table>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" <school-form v-if="isShowSchoolForm" :save-obj="objOption" @close="closeSchoolForm" @success="refreshPage">
transition-hide="scale"> </school-form>
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.SId==0?'新增校区':'修改校区'}}</div>
</q-card-section>
<div class="text-caption q-mb-lg q-px-md text-grey-6">基本资料</div>
<q-card-section class="q-pt-none">
<div class="row wrap">
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SName" ref="SName"
class="col-6 q-pr-lg q-pb-lg" label="校区名称" :rules="[val => !!val || '请填写校区名称']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.SAddress" ref="SAddress"
class="col-6 q-pb-lg" label="校区地址" :rules="[val => !!val || '请填写校区地址']" />
<q-select class="col-6 q-pb-lg q-pr-lg" clearable filled stack-label use-input option-value="Id"
option-label="EmployeeName" v-model="objOption.ManagerId" ref="ManagerId" :options="EmployeeList"
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="20" :dense="false" v-model="objOption.SLinkTel" ref="SLinkTel"
class="col-6 q-pb-lg" label="校区联系电话" :rules="[val => !!val || '请填写校区联系电话']" />
<q-input filled stack-label maxlength="20" :dense="false" v-model="objOption.Remark"
class="col-6 q-pb-lg q-pr-lg" label="校区备注" />
<selectTree v-if="DeptList&&DeptList.length>0" :treeData='DeptList' :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-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="saveSchool" />
</q-card-actions>
</q-card>
</q-dialog>
</div> </div>
</div> </div>
</template> </template>
...@@ -111,23 +67,15 @@ ...@@ -111,23 +67,15 @@
<script> <script>
import { import {
getSchoolPage, getSchoolPage,
saveSchool
} from '../../api/school/index' } from '../../api/school/index'
//部门 //校区管理
import { import schoolForm from '../../components/school/schoolarea/school-form'
getDeptTree
} from '../../api/system/dept'
//员工
import {
queryEmployee
} from '../../api/users/user'
import selectTree from '../../components/common/select-tree'
export default { export default {
meta: { meta: {
title: "校区管理" title: "校区管理"
}, },
components: { components: {
selectTree schoolForm
}, },
data() { data() {
return { return {
...@@ -205,7 +153,7 @@ ...@@ -205,7 +153,7 @@
value: '-1' value: '-1'
}, },
{ {
label: '开启', label: '正常',
value: '0' value: '0'
}, },
{ {
...@@ -235,156 +183,60 @@ ...@@ -235,156 +183,60 @@
Dept_Id: 0, //管理部门 Dept_Id: 0, //管理部门
ManagerId: 0, //负责人编号 ManagerId: 0, //负责人编号
}, },
tempManager: "", isShowSchoolForm: false, //是否显示校区弹窗
saveLoading: false,
DeptList: [], //部门列表
returnString: [], //默认值
EmployeeList: [], //员工列表
AllemployeeList: [], //所有员工
} }
}, },
created() { created() {
this.queryDeptTree();
this.getEmployee();
this.StatusTemp = this.StatusOpts[0] this.StatusTemp = this.StatusOpts[0]
}, },
mounted() { mounted() {
this.currentUrl = this.$route.path this.currentUrl = this.$route.path
this.getSchool() this.getSchool();
}, },
methods: { methods: {
//筛选员工 //更多按钮点击事件
filterFn(val, update) { onItemClick() {},
update(() => {
if (val === '') {
this.EmployeeList = JSON.parse(JSON.stringify(this.AllemployeeList))
} else {
const needle = val.toLowerCase()
this.EmployeeList = 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.EmployeeList = JSON.parse(JSON.stringify(jsonData));;
}
}
})
},
getChild(deptArray) {
var tempStr = "";
if (deptArray && deptArray != '') {
tempStr = deptArray;
}
this.objOption.Dept_Id = tempStr;
},
//获取部门结构树
queryDeptTree() {
getDeptTree({}).then(res => {
if (res.Code == 1) {
this.DeptList = res.Data;
}
})
},
onItemClick() {
},
//初始化对象
initObj(id) {
if (id) {
let obj = this.data.filter(x => {
if (x.SId == id) {
return x
}
return false
})
this.objOption = obj[0];
this.returnString.push(this.objOption.Dept_Id.toString());
} else {
this.objOption.SId = 0;
this.objOption.SName = "";
this.objOption.SAddress = "";
this.objOption.SLinkTel = "";
this.objOption.SDomain = "";
this.objOption.SLogo = "";
this.objOption.Remark = "";
this.objOption.Status = "0";
this.objOption.Dept_Id = 0;
this.objOption.ManagerId = 0;
}
this.persistent = true;
},
//重新查询 //重新查询
resetSearch() { resetSearch() {
this.msg.pageIndex = 1 this.msg.pageIndex = 1;
this.loading = true this.getSchool();
this.msg.Status = this.StatusTemp ? this.StatusTemp.value : '-1'
this.getSchool()
}, },
//分页改变 //分页改变
changePage(val) { changePage(val) {
this.msg.Status = this.StatusTemp ? this.StatusTemp.value : '-1' this.msg.pageIndex = val;
this.msg.pageIndex = val
this.loading = true
this.getSchool() this.getSchool()
}, },
//获取学校分页列表 //获取学校分页列表
getSchool() { getSchool() {
this.loading = true;
this.msg.Status = this.StatusTemp ? this.StatusTemp.value : '-1'
getSchoolPage(this.msg).then(res => { getSchoolPage(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;
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false;
}) })
}, },
closeSaveForm() { //关闭校区弹窗
this.persistent = false closeSchoolForm() {
this.isShowSchoolForm = false;
}, },
//保存校区 //刷新页面
saveSchool() { refreshPage() {
this.saveLoading = true this.getSchool();
this.$refs.SName.validate() },
this.$refs.SAddress.validate() //新增、修改校区
this.$refs.SLinkTel.validate() EditSchool(obj) {
if ( console.log("obj",obj)
!this.$refs.SName.hasError && if (obj) {
!this.$refs.SAddress.hasError && this.objOption = obj;
!this.$refs.SLinkTel.hasError
) {
if (this.tempManager && this.tempManager.Id) {
this.objOption.ManagerId = this.tempManager.Id;
}
saveSchool(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
if (this.objOption.SId == 0) {
this.msg.pageIndex = 1
}
this.getSchool()
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
} else { } else {
this.saveLoading = false this.objOption = null;
} }
} this.isShowSchoolForm = true;
}, },
}
} }
</script> </script>
......
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