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

页面修改

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