mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-13 04:46:46 +08:00
-- bug 授课教师
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<a-select
|
||||
v-model:value="managerArray"
|
||||
placeholder="请选择项目经理"
|
||||
:placeholder="placeholder"
|
||||
:filterOption="false"
|
||||
style="width: 100%"
|
||||
:options="options"
|
||||
allowClear
|
||||
showSearch
|
||||
mode="multiple"
|
||||
:mode="mode"
|
||||
:disabled="disabled"
|
||||
@popupScroll="memberScroll"
|
||||
@search="searchMember"
|
||||
@@ -37,6 +37,15 @@ export default {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择'
|
||||
},
|
||||
// 'multiple' | 'tags'
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'select'
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
@@ -93,11 +102,11 @@ export default {
|
||||
|
||||
function init() {
|
||||
console.log('init--', props)
|
||||
if (props.value !== state.managerArray.join(',')) {
|
||||
if (props.value !== typeof state.managerArray === 'object' ? state.managerArray.join(',') : state.managerArray) {
|
||||
if (props.value) {
|
||||
const arrManager = props.name.split(',')
|
||||
const arrManagerId = props.value.split(',')
|
||||
state.managerArray = arrManagerId
|
||||
state.managerArray = props.mode === 'select' ? props.value : arrManagerId;
|
||||
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
|
||||
} else {
|
||||
state.managerArray = []
|
||||
@@ -114,10 +123,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
function change(e, l) {
|
||||
function change(e, {label, value}) {
|
||||
console.log('change')
|
||||
ctx.emit('update:value', e.join(','))
|
||||
ctx.emit('update:name', l.map(t => t.label).join(','))
|
||||
ctx.emit('update:value', typeof value === 'object' ? e.join(',') : value)
|
||||
ctx.emit('update:name', typeof label === 'object' ? label.join(',') : label)
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user