mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-24 02:02:55 +08:00
二维码积分
This commit is contained in:
@@ -46,16 +46,19 @@ const id = computed(() => {
|
||||
|
||||
const emit = defineEmits({});
|
||||
const secondItem = store.state.project_level.find((e, index) => index === 1);
|
||||
const options = computed(() =>
|
||||
store.state.project_level
|
||||
.sort((a, b) => parseInt(b.value) - parseInt(a.value))
|
||||
.filter((e) => e != secondItem)
|
||||
.concat(secondItem)
|
||||
.map((e) => ({
|
||||
const options = computed(() =>{
|
||||
const projectLevels = store.state.project_level.slice();
|
||||
const lastItem = projectLevels.pop();
|
||||
projectLevels.unshift(lastItem);
|
||||
if (projectLevels.length >= 3) {
|
||||
const thirdItem = projectLevels.splice(1, 1)[0];
|
||||
projectLevels.splice(2, 0, thirdItem);
|
||||
}
|
||||
return projectLevels.map((e) => ({
|
||||
value: parseInt(e.value),
|
||||
label: e.name,
|
||||
}))
|
||||
);
|
||||
}));
|
||||
});
|
||||
|
||||
function change(key) {
|
||||
emit("update:value", key);
|
||||
|
||||
121
src/components/project/ProjectManagerNewTeacher.vue
Normal file
121
src/components/project/ProjectManagerNewTeacher.vue
Normal file
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<a-select
|
||||
:getPopupContainer="
|
||||
(triggerNode) => {
|
||||
return triggerNode.parentNode || document.body;
|
||||
}
|
||||
"
|
||||
v-model:value="managerArray"
|
||||
:placeholder="placeholder"
|
||||
:filterOption="false"
|
||||
:options="isOpen?options:selectOptions"
|
||||
allowClear
|
||||
showSearch
|
||||
:mode="mode"
|
||||
:disabled="disabled"
|
||||
@popupScroll="memberScroll"
|
||||
@search="searchMember"
|
||||
:open="isOpen"
|
||||
@change="change"
|
||||
@blur="blur"
|
||||
:show-arrow="false"
|
||||
style="width: 60%"
|
||||
>
|
||||
<template v-if="loading" #notFoundContent>
|
||||
<a-spin size="small"/>
|
||||
</template>
|
||||
</a-select>
|
||||
</template>
|
||||
<script setup>
|
||||
import {computed, defineEmits, defineProps, onMounted, ref, watch} from "vue";
|
||||
import {useThrottlePage} from "@/api/request";
|
||||
import {USER_LIST} from "@/api/apis";
|
||||
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
disabled: Boolean,
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请输入搜索关键字",
|
||||
},
|
||||
mode: String
|
||||
})
|
||||
|
||||
const selectOptions = ref([])
|
||||
|
||||
const managerArray = computed(() => props.mode === 'select' ? props.value : (props.value ? props.value.split(',') : []))
|
||||
|
||||
const emit = defineEmits({})
|
||||
|
||||
const isOpen = ref(false)
|
||||
|
||||
const memberParam = ref({keyword: '', pageNo:1, pageSize: 20})
|
||||
|
||||
const {data: userList, loading} = useThrottlePage(USER_LIST, memberParam.value, false)
|
||||
|
||||
const options = computed(() => userList.value.filter(e => !(props.value + '').includes(e.id)).map(e => ({
|
||||
label: e.realName + e.userNo,
|
||||
value: e.id,
|
||||
...e,
|
||||
audienceList: null
|
||||
})))
|
||||
|
||||
watch(props, init)
|
||||
|
||||
function init() {
|
||||
//第一次进来 编辑赋值
|
||||
if (props.value && (props.value + '') !== selectOptions.value.map(e => e.value).join(',')) {
|
||||
selectOptions.value = (props.value + '').split(',').map((e, i) => ({label: props.name.split(',')[i], value: e}))
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
console.log('onMounted')
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
const memberScroll = ({target: {scrollHeight, scrollTop, clientHeight}}) => {
|
||||
scrollHeight === (clientHeight + scrollTop) && memberParam.value.pageNo++
|
||||
};
|
||||
|
||||
//搜索学员
|
||||
const searchMember = (keyword) => {
|
||||
console.log('searchMember', keyword)
|
||||
loading.value = true
|
||||
isOpen.value = true
|
||||
userList.value = []
|
||||
memberParam.value.pageNo = 1
|
||||
memberParam.value.keyword = keyword
|
||||
console.log('searchMember', memberParam.value)
|
||||
};
|
||||
|
||||
function blur() {
|
||||
isOpen.value = false
|
||||
memberParam.value.keyword = ''
|
||||
memberParam.value.pageNo = 1
|
||||
}
|
||||
|
||||
function change(e, l) {
|
||||
memberParam.value.keyword = ''
|
||||
memberParam.value.pageNo = 1
|
||||
isOpen.value = false
|
||||
Array.isArray(l) && (selectOptions.value = l)
|
||||
Array.isArray(selectOptions.value) && emit('onChange', e, l, selectOptions.value.find(e => e.departId)?.departId, selectOptions.value.find(e => e.departId)?.departName, selectOptions.value.find(e => e.departId)?.orgName)
|
||||
if (Array.isArray(l)) {
|
||||
emit('update:name', l.map(t => t.label).join(','))
|
||||
emit('update:value', l.map(t => t.value).join(','))
|
||||
} else {
|
||||
emit('update:name', l?.label)
|
||||
emit('update:value', l?.value)
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user