j-select-multiple改为可检索的多选下拉框
This commit is contained in:
@@ -1,7 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-select :value="arrayValue" @change="onChange" mode="multiple" :placeholder="placeholder">
|
<a-select
|
||||||
|
mode="multiple"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:value="arrayValue"
|
||||||
|
@change="onChange"
|
||||||
|
@search="search"
|
||||||
|
:filterOption="false"
|
||||||
|
>
|
||||||
<a-select-option
|
<a-select-option
|
||||||
v-for="(item,index) in options"
|
v-for="(item,index) in newOptions"
|
||||||
:key="index"
|
:key="index"
|
||||||
:getPopupContainer="getParentContainer"
|
:getPopupContainer="getParentContainer"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
@@ -51,7 +58,8 @@
|
|||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
arrayValue:!this.value?[]:this.value.split(this.spliter)
|
newOptions:[],
|
||||||
|
arrayValue:!this.value?[]:this.value.split(this.spliter) // arrayValue是已选中的数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
@@ -63,8 +71,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created(){
|
||||||
|
this.newOptions = this.options
|
||||||
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
search(val){
|
||||||
|
let newArr = []
|
||||||
|
this.newOptions = this.options
|
||||||
|
if (this.options && this.options.length > 0){
|
||||||
|
this.options.forEach((item,index)=>{
|
||||||
|
if (item.text.indexOf(val) != -1){
|
||||||
|
newArr.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.newOptions = newArr
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
this.newOptions = this.options
|
||||||
|
}
|
||||||
|
},
|
||||||
onChange (selectedValue) {
|
onChange (selectedValue) {
|
||||||
|
this.newOptions = this.options
|
||||||
if(this.triggerChange){
|
if(this.triggerChange){
|
||||||
this.$emit('change', selectedValue.join(this.spliter));
|
this.$emit('change', selectedValue.join(this.spliter));
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import JTreeTable from './JTreeTable.vue'
|
|||||||
//jerobiz
|
//jerobiz
|
||||||
import JSelectDepart from '../jerobiz/JSelectDepart.vue'
|
import JSelectDepart from '../jerobiz/JSelectDepart.vue'
|
||||||
import JSelectMultiUser from '../jerobiz/JSelectMultiUser.vue'
|
import JSelectMultiUser from '../jerobiz/JSelectMultiUser.vue'
|
||||||
import JSelectPosition from '../jerobiz/JSelectPosition.vue'
|
|
||||||
import JSelectRole from '../jerobiz/JSelectRole.vue'
|
import JSelectRole from '../jerobiz/JSelectRole.vue'
|
||||||
import JSelectUserByDep from '../jerobiz/JSelectUserByDep.vue'
|
import JSelectUserByDep from '../jerobiz/JSelectUserByDep.vue'
|
||||||
|
|
||||||
@@ -68,7 +67,6 @@ export default {
|
|||||||
//jerobiz
|
//jerobiz
|
||||||
Vue.component('JSelectDepart', JSelectDepart)
|
Vue.component('JSelectDepart', JSelectDepart)
|
||||||
Vue.component('JSelectMultiUser', JSelectMultiUser)
|
Vue.component('JSelectMultiUser', JSelectMultiUser)
|
||||||
Vue.component('JSelectPosition', JSelectPosition)
|
|
||||||
Vue.component('JSelectRole', JSelectRole)
|
Vue.component('JSelectRole', JSelectRole)
|
||||||
Vue.component('JSelectUserByDep', JSelectUserByDep)
|
Vue.component('JSelectUserByDep', JSelectUserByDep)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<template>
|
|
||||||
<j-select-biz-component :width="1000" v-bind="configs" v-on="$listeners"/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import JSelectBizComponent from './JSelectBizComponent'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'JSelectPosition',
|
|
||||||
components: { JSelectBizComponent },
|
|
||||||
props: ['value'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
settings: {
|
|
||||||
name: '职务',
|
|
||||||
displayKey: 'name',
|
|
||||||
returnKeys: ['id', 'code'],
|
|
||||||
listUrl: '/sys/position/list',
|
|
||||||
queryParamCode: 'name',
|
|
||||||
queryParamText: '职务名称',
|
|
||||||
columns: [
|
|
||||||
{ title: '职务名称', dataIndex: 'name', align: 'center', width: '30%', widthRight: '70%' },
|
|
||||||
{ title: '职务编码', dataIndex: 'code', align: 'center', width: '35%' },
|
|
||||||
{ title: '职级', dataIndex: 'rank_dictText', align: 'center', width: '25%' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
configs() {
|
|
||||||
return Object.assign({ value: this.value }, this.settings, this.$attrs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@@ -8,13 +8,9 @@ import router from './router'
|
|||||||
import store from './store/'
|
import store from './store/'
|
||||||
import { VueAxios } from "@/utils/request"
|
import { VueAxios } from "@/utils/request"
|
||||||
|
|
||||||
// require('@jeecg/antd-online-mini')
|
|
||||||
// require('@jeecg/antd-online-mini/dist/OnlineForm.css')
|
|
||||||
|
|
||||||
require('@/components/onlineForm/onlineForm')
|
require('@/components/onlineForm/onlineForm')
|
||||||
require('@/components/onlineForm/OnlineForm.css')
|
require('@/components/onlineForm/OnlineForm.css')
|
||||||
|
|
||||||
|
|
||||||
import Antd, { version } from 'ant-design-vue'
|
import Antd, { version } from 'ant-design-vue'
|
||||||
console.log('ant-design-vue version:', version)
|
console.log('ant-design-vue version:', version)
|
||||||
|
|
||||||
|
|||||||
@@ -127,16 +127,6 @@
|
|||||||
<a-col :span="12">选中值:{{ formData.selectRole}}</a-col>
|
<a-col :span="12">选中值:{{ formData.selectRole}}</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<!-- 职务选择 -->
|
|
||||||
<a-row :gutter="24">
|
|
||||||
<a-col :span="12">
|
|
||||||
<a-form-item label="选择职务">
|
|
||||||
<j-select-position :buttons="false" v-model="formData.selectPosition" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="12">选中值:{{ formData.selectPosition}}</a-col>
|
|
||||||
</a-row>
|
|
||||||
|
|
||||||
<!-- JCheckbox -->
|
<!-- JCheckbox -->
|
||||||
<a-row :gutter="24">
|
<a-row :gutter="24">
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
@@ -452,7 +442,6 @@
|
|||||||
import JSuperQuery from '@/components/jero/JSuperQuery'
|
import JSuperQuery from '@/components/jero/JSuperQuery'
|
||||||
import JUpload from '@/components/jero/JUpload'
|
import JUpload from '@/components/jero/JUpload'
|
||||||
import JImageUpload from '@/components/jero/JImageUpload'
|
import JImageUpload from '@/components/jero/JImageUpload'
|
||||||
import JSelectPosition from '@comp/jerobiz/JSelectPosition'
|
|
||||||
import JCategorySelect from '@comp/jero/JCategorySelect'
|
import JCategorySelect from '@comp/jero/JCategorySelect'
|
||||||
import JMultiSelectTag from '@comp/dict/JMultiSelectTag'
|
import JMultiSelectTag from '@comp/dict/JMultiSelectTag'
|
||||||
import JInput from '@comp/jero/JInput'
|
import JInput from '@comp/jero/JInput'
|
||||||
@@ -468,7 +457,6 @@
|
|||||||
JAreaLinkage,
|
JAreaLinkage,
|
||||||
JInput,
|
JInput,
|
||||||
JCategorySelect,
|
JCategorySelect,
|
||||||
JSelectPosition,
|
|
||||||
JImageUpload,
|
JImageUpload,
|
||||||
JUpload,
|
JUpload,
|
||||||
JTreeDict,
|
JTreeDict,
|
||||||
@@ -527,6 +515,7 @@ sayHi('hello, world!')`
|
|||||||
jselectMultiple: {
|
jselectMultiple: {
|
||||||
options: [
|
options: [
|
||||||
{ text: '字符串', value: 'String' },
|
{ text: '字符串', value: 'String' },
|
||||||
|
{ text: '字符串1', value: 'String1' },
|
||||||
{ text: '整数型', value: 'Integer' },
|
{ text: '整数型', value: 'Integer' },
|
||||||
{ text: '浮点型', value: 'Double' },
|
{ text: '浮点型', value: 'Double' },
|
||||||
{ text: '布尔型', value: 'Boolean' }
|
{ text: '布尔型', value: 'Boolean' }
|
||||||
|
|||||||
@@ -168,7 +168,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
// 引入搜索部门弹出框的组件
|
// 引入搜索部门弹出框的组件
|
||||||
import departWindow from './DepartWindow'
|
import departWindow from './DepartWindow'
|
||||||
import JSelectPosition from '@/components/jerobiz/JSelectPosition'
|
|
||||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||||
import { getAction } from '@/api/manage'
|
import { getAction } from '@/api/manage'
|
||||||
import {addUser,editUser,queryUserRole,queryall } from '@/api/api'
|
import {addUser,editUser,queryUserRole,queryall } from '@/api/api'
|
||||||
@@ -181,7 +180,6 @@
|
|||||||
components: {
|
components: {
|
||||||
JImageUpload,
|
JImageUpload,
|
||||||
departWindow,
|
departWindow,
|
||||||
JSelectPosition
|
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user