-- bug 授课教师

This commit is contained in:
yuping
2022-12-03 13:03:57 +08:00
parent 965f59b691
commit fa6e9bc85f
4 changed files with 23 additions and 11 deletions

View File

@@ -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 {