Commit 33d835fb authored by 黄奎's avatar 黄奎

页面修改

parent 057ced88
<template> <template>
<!--带搜索功能的下拉框-->
<q-select filled stack-label <q-select filled stack-label :option-value="optionValue" :option-label="optionLabel" v-model="vdata_model" :ref="id"
:option-value="optionValue" :options="newData" :label="label" :class="classStr" :dense='densetype' :reactive-rules='reactiveRules' emit-value
:option-label="optionLabel" map-options clearable :use-input="useInput" @input="resetSearch" @filter="filterFn">
v-model="vdata_model" <template v-slot:no-option>
ref="DeptTier" <q-item>
:options="newData" <q-item-section class="text-grey">
:label="label" 未找到相关数据
:class="classStr" </q-item-section>
:dense ='densetype' </q-item>
:reactive-rules = 'reactiveRules' </template>
emit-value </q-select>
map-options
clearable
:use-input="useInput"
@input="resetSearch"
@filter="filterFn"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
</template> </template>
<script> <script>
export default { export default {
name: "select-search", name: "select-search",
props: { props: {
//样式字符串 //样式字符串
classStr: { classStr: {
type: String, type: String,
default: '' default: ''
},
//选中数据
vModel:{
type: String,
default: ''
},
//下拉的数据
Data: {
type: Array,
default: []
},
//是否紧凑
densetype:{
type: Boolean,
default: false
},
//是否能输入
useInput:{
type: Boolean,
default: false
},
//是否验证
reactiveRules:{
type: Boolean,
default: false
},
//选项的值
optionValue: {
type: String,
default: ''
},
//选项的标签
optionLabel: {
type: String,
default: ''
},
//名称
label:{
type: String,
default: ''
},
//指定的下拉 当前是那个下啦模块
type:{
type: String,
default: ''
}
}, },
data(){ //选中数据
return{ vModel: {
vdata_model:'', type: Number,
newData:[] default: ''
}
}, },
created(){ //下拉的数据
this.vdata_model = this.vModel.toString();//赋值 Data: {
this.newData = this.Data type: Array,
default: []
}, },
//是否紧凑
methods:{ densetype: {
resetSearch(){ type: Boolean,
let data= this.vdata_model!=null ? this.vdata_model.toString():''; default: false
this.$emit('returnData',data ,this.type); },
//是否能输入
useInput: {
type: Boolean,
default: false
},
//是否验证
reactiveRules: {
type: Boolean,
default: false
},
//选项的值
optionValue: {
type: String,
default: ''
},
//选项的标签
optionLabel: {
type: String,
default: ''
},
//名称
label: {
type: String,
default: ''
},
},
data() {
return {
id: 'select-search' + (Math.floor((Math.random() * 10000) + 1)),
vdata_model: 0,
newData: []
}
},
//监听数据变化
watch: {
//有默认值
Data: {
handler(newValue) {
this.newData = JSON.parse(JSON.stringify(this.Data));
}, },
filterFn(val, update) { immediate: true
update(() => { },
let Name = this.optionLabel //值改变
if (val === '') { vModel: {
this.newData = JSON.parse(JSON.stringify(this.Data)) handler(newValue) {
} else { this.vdata_model = this.vModel;
const needle = val.toLowerCase()
let that = this
that.newData=[]
that.newData = that.Data.filter(v => v[Name].indexOf(needle) > -1)
}
})
}, },
} immediate: true
},
},
created() {
},
methods: {
resetSearch() {
let data = this.vdata_model != null ? this.vdata_model : 0;
this.$emit('returnData', data);
},
//搜索方法
filterFn(val, update) {
update(() => {
let Name = this.optionLabel
if (val === '') {
this.newData = JSON.parse(JSON.stringify(this.Data));
} else {
const needle = val.toLowerCase();
let that = this;
that.newData = [];
that.newData = that.Data.filter(v => v[Name].indexOf(needle) > -1);
}
})
},
} }
</script> }
</script>
<style scoped> <style scoped>
</style> </style>
...@@ -7,23 +7,10 @@ ...@@ -7,23 +7,10 @@
<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 />-->
<div class="col-6"> <div class="col-6">
<selectSearch <selectSearch classStr="col-12 q-pr-lg q-pb-lg" :Data='schoolList' optionValue="SId" optionLabel="SName"
classStr="col-12 q-pr-lg q-pb-lg" :densetype="false" :vModel="objOption.School_Id" label="所属校区" @returnData="returnData" :useInput="true"
:Data='schoolList' :reactiveRules="false">
optionValue="SId"
optionLabel="SName"
:densetype="false"
:vModel="objOption.School_Id"
label="所属校区"
@returnData="returnData"
:useInput="true"
:reactiveRules="false"
type="1"
>
</selectSearch> </selectSearch>
</div> </div>
<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"
...@@ -105,7 +92,7 @@ ...@@ -105,7 +92,7 @@
DeptTel: "", //部门联系电话 DeptTel: "", //部门联系电话
ManagerIds: "", //部门负责人编号 ManagerIds: "", //部门负责人编号
Status: 0, //状态(0-正常,1-禁用), Status: 0, //状态(0-正常,1-禁用),
School_Id: '', //校区编号 School_Id: 0, //校区编号
DeptTier: 0, //部门层级 DeptTier: 0, //部门层级
DeptSort: 0, //部门排序 DeptSort: 0, //部门排序
}, },
...@@ -163,8 +150,18 @@ ...@@ -163,8 +150,18 @@
//获取校区 //获取校区
getSchool() { getSchool() {
getSchoolDropdown({}).then(res => { getSchoolDropdown({}).then(res => {
this.schoolList = res.Data; if (res.Code == 1) {
this.$forceUpdate(); var tempSchoolArray = res.Data;
if (!tempSchoolArray) {
tempSchoolArray = [];
}
tempSchoolArray.unshift({
SId: 0,
SName: "不限"
});
this.schoolList = tempSchoolArray;
this.$forceUpdate();
}
}) })
}, },
//获取选中的部门 //获取选中的部门
...@@ -212,7 +209,7 @@ ...@@ -212,7 +209,7 @@
this.objOption.Status = 0; this.objOption.Status = 0;
this.objOption.DeptSort = 0; this.objOption.DeptSort = 0;
this.objOption.DeptTier = 0; this.objOption.DeptTier = 0;
this.objOption.School_Id = ''; this.objOption.School_Id = 0;
this.tempManager = []; this.tempManager = [];
} }
}, },
...@@ -252,11 +249,8 @@ ...@@ -252,11 +249,8 @@
this.saveLoading = false this.saveLoading = false
}) })
}, },
returnData(data,type){ returnData(data) {
if(type==1){ this.objOption.School_Id = data;
this.objOption.School_Id = data;
}
} }
}, },
} }
......
<style> <style>
.post-form .tranbox .el-transfer-panel{ .post-form .tranbox .el-transfer-panel {
width: 300px; width: 300px;
} }
.post-form .tranbox .el-button{
padding: 7px 10px; .post-form .tranbox .el-button {
} padding: 7px 10px;
}
</style> </style>
<template> <template>
<q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale"> <q-dialog v-model="persistent" persistent transition-show="scale" transition-hide="scale">
...@@ -27,16 +29,10 @@ ...@@ -27,16 +29,10 @@
</div> </div>
</div> </div>
<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 tranbox" > <div class="row wrap tranbox">
<template> <template>
<el-transfer <el-transfer filterable :filter-method="filterMethod" filter-placeholder="请输入城市拼音"
filterable :props="{key: 'RoleId',label: 'RoleName'}" v-model="value" :titles="['可选角色', '已选角色']" :data="data">
:filter-method="filterMethod"
filter-placeholder="请输入城市拼音"
:props="{key: 'RoleId',label: 'RoleName'}"
v-model="value"
:titles="['可选角色', '已选角色']"
:data="data">
</el-transfer> </el-transfer>
</template> </template>
...@@ -95,7 +91,7 @@ ...@@ -95,7 +91,7 @@
RoleList: [], //角色列表 RoleList: [], //角色列表
data: [], data: [],
value: [], value: [],
filterMethod(query, item) {//根据名称搜索 filterMethod(query, item) { //根据名称搜索
return item.RoleName.indexOf(query) > -1; return item.RoleName.indexOf(query) > -1;
} }
} }
...@@ -141,12 +137,11 @@ ...@@ -141,12 +137,11 @@
this.returnString.push(this.objOption.RB_Dept_Id); this.returnString.push(this.objOption.RB_Dept_Id);
this.objOption.PostName = res.Data.PostName; this.objOption.PostName = res.Data.PostName;
this.objOption.Status = res.Data.Status; this.objOption.Status = res.Data.Status;
if(res.Data.PostRoleList.length>0){ if (res.Data.PostRoleList.length > 0) {
res.Data.PostRoleList.forEach(x=>{ res.Data.PostRoleList.forEach(x => {
this.value.push(x.RoleId) this.value.push(x.RoleId)
}) })
} }
}) })
this.optionTitle = "修改岗位信息" this.optionTitle = "修改岗位信息"
} else { } else {
...@@ -157,7 +152,6 @@ ...@@ -157,7 +152,6 @@
this.objOption.Status = 0; this.objOption.Status = 0;
} }
}, },
//关闭弹窗 //关闭弹窗
closeSaveForm() { closeSaveForm() {
this.$emit('close') this.$emit('close')
...@@ -168,14 +162,21 @@ ...@@ -168,14 +162,21 @@
var tempRole = []; var tempRole = [];
if (this.RoleList && this.RoleList.length > 0) { if (this.RoleList && this.RoleList.length > 0) {
this.RoleList.forEach(x => { this.RoleList.forEach(x => {
this.value.forEach(j=>{ this.value.forEach(j => {
if(x.RoleId==j){ if (x.RoleId == j) {
tempRole.push(x) tempRole.push(x)
} }
}) })
}) })
} }
this.objOption.PostRoleList=tempRole; if (this.objOption.RB_Dept_Id) {
if (this.objOption.RB_Dept_Id == "") {
this.objOption.RB_Dept_Id = 0;
}
} else {
this.objOption.RB_Dept_Id = 0;
}
this.objOption.PostRoleList = tempRole;
this.saveLoading = true; this.saveLoading = true;
savePostInfo(this.objOption).then(res => { savePostInfo(this.objOption).then(res => {
this.saveLoading = false this.saveLoading = false
......
...@@ -2,26 +2,10 @@ ...@@ -2,26 +2,10 @@
<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">
<selectSearch <selectSearch classStr="col-12 q-pr-lg q-pb-lg" :Data='schoolList' optionValue="SId" optionLabel="SName"
classStr="col-12 q-pr-lg q-pb-lg" :densetype="false" :vModel="msg.School_Id" label="校区" @returnData="returnData" :useInput="true"
:Data='schoolList' :reactiveRules="false">
optionValue="SId"
optionLabel="SName"
:densetype="false"
:vModel="msg.School_Id"
label="校区"
@returnData="returnData"
:useInput="true"
:reactiveRules="false"
type="1"
>
</selectSearch> </selectSearch>
</div> </div>
<div class="col-3"> <div class="col-3">
...@@ -59,7 +43,7 @@ ...@@ -59,7 +43,7 @@
</template> </template>
<template v-slot:body-cell-School_Id="props"> <template v-slot:body-cell-School_Id="props">
<q-td :props="props"> <q-td :props="props">
{{props.row.School_Id>0? props.row.SchoolName:'总部'}} {{props.row.School_Id>0? props.row.SchoolName:'总部'}}
</q-td> </q-td>
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
...@@ -175,7 +159,7 @@ ...@@ -175,7 +159,7 @@
DeptName: "", //部门名称 DeptName: "", //部门名称
DeptId: 0, //部门编号 DeptId: 0, //部门编号
Status: "-1", Status: "-1",
School_Id: "", School_Id: 0,
DeptTier: "", DeptTier: "",
ParentId: "", ParentId: "",
}, },
...@@ -222,7 +206,15 @@ ...@@ -222,7 +206,15 @@
//获取校区 //获取校区
getSchool() { getSchool() {
getSchoolDropdown({}).then(res => { getSchoolDropdown({}).then(res => {
this.schoolList = res.Data; var tempSchoolArray = res.Data;
if (!tempSchoolArray) {
tempSchoolArray = [];
}
tempSchoolArray.unshift({
SId: 0,
SName: "不限"
});
this.schoolList = tempSchoolArray;
this.$forceUpdate(); this.$forceUpdate();
}) })
}, },
...@@ -244,9 +236,6 @@ ...@@ -244,9 +236,6 @@
}, },
//获取部门分页列表 //获取部门分页列表
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) { if (this.msg.DeptTier == "" || this.msg.DeptTier == null) {
this.msg.DeptTier = "0" this.msg.DeptTier = "0"
} }
...@@ -258,9 +247,7 @@ ...@@ -258,9 +247,7 @@
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") { if (this.msg.DeptTier == "0") {
this.msg.DeptTier = "" this.msg.DeptTier = ""
} }
...@@ -331,14 +318,10 @@ ...@@ -331,14 +318,10 @@
obj.Status = obj.Status == 1 ? 0 : 1; obj.Status = obj.Status == 1 ? 0 : 1;
}); });
}, },
returnData(data,type){ returnData(data) {
if(type==1){ this.msg.School_Id = data;
this.msg.School_Id = data; this.resetSearch()
}
this.resetSearch()
} }
} }
} }
......
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