mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 10:56:46 +08:00
讲师查询管理供应商
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
<template>
|
||||
<a-select :getPopupContainer="(triggerNode) => {
|
||||
return triggerNode.parentNode || document.body;
|
||||
}
|
||||
" v-model:value="managerArray" :placeholder="placeholder" :filterOption="false"
|
||||
:options="isOpen ? options : selectOptions" allowClear showSearch :disabled="disabled" @popupScroll="memberScroll"
|
||||
@search="searchMember" :open="isOpen" @change="change" @blur="blur" :show-arrow="false" style="width: 100%">
|
||||
<a-select
|
||||
:getPopupContainer="
|
||||
(triggerNode) => {
|
||||
return triggerNode.parentNode || document.body;
|
||||
}
|
||||
"
|
||||
v-model:value="managerArray"
|
||||
:placeholder="placeholder"
|
||||
:filterOption="false"
|
||||
:options="isOpen ? options : selectOptions"
|
||||
allowClear
|
||||
showSearch
|
||||
:disabled="disabled"
|
||||
@popupScroll="memberScroll"
|
||||
@search="searchMember"
|
||||
:open="isOpen"
|
||||
@change="change"
|
||||
@blur="blur"
|
||||
:show-arrow="false"
|
||||
style="width: 100%"
|
||||
>
|
||||
<template v-if="loading" #notFoundContent>
|
||||
<a-spin size="small" />
|
||||
</template>
|
||||
@@ -17,31 +32,38 @@ import { getTeacherList } from "@/api/Lecturer";
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
supplier: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
mobile: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
disabled: Boolean,
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请输入搜索关键字",
|
||||
},
|
||||
mode: String
|
||||
})
|
||||
mode: String,
|
||||
});
|
||||
|
||||
const selectOptions = ref([])
|
||||
const selectOptions = ref([]);
|
||||
|
||||
const managerArray = computed(() => props.value === '' ? null : props.value)
|
||||
const supplier = ref('')
|
||||
|
||||
const emit = defineEmits({})
|
||||
|
||||
const isOpen = ref(false)
|
||||
const managerArray = computed(() => (props.value === "" ? null : props.value));
|
||||
|
||||
const emit = defineEmits({});
|
||||
|
||||
const isOpen = ref(false);
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function (...args) {
|
||||
@@ -49,29 +71,36 @@ function debounce(func, wait) {
|
||||
timeout = setTimeout(() => func.apply(this, args), wait);
|
||||
};
|
||||
}
|
||||
const memberParam = ref({ name: '', pageNo: 1, pageSize: 999, teacherType: 2, status: 1 })
|
||||
const memberParam = ref({
|
||||
name: "",
|
||||
pageNo: 1,
|
||||
pageSize: 999,
|
||||
teacherType: 2,
|
||||
status: 1,
|
||||
});
|
||||
|
||||
const userList = ref([])
|
||||
const loading = ref(false)
|
||||
const userList = ref([]);
|
||||
const loading = ref(false);
|
||||
const getOutTeacher = () => {
|
||||
getTeacherList(memberParam.value).then(res => {
|
||||
getTeacherList(memberParam.value).then((res) => {
|
||||
if (res.data.code == 200) {
|
||||
userList.value = res.data.data.records
|
||||
loading.value = false
|
||||
userList.value = res.data.data.records;
|
||||
loading.value = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
const options = computed(() =>
|
||||
userList.value.map(e => ({
|
||||
// label: e.name + '(' + e.userNo + ')' + e.organizationName,
|
||||
label: e.name + '/' + e.supplier,
|
||||
value: e.name,
|
||||
...e,
|
||||
audienceList: null
|
||||
})
|
||||
))
|
||||
});
|
||||
};
|
||||
const options = computed(() =>
|
||||
userList.value.map((e) => ({
|
||||
// label: e.name + '(' + e.userNo + ')' + e.organizationName,
|
||||
label: e.name + "/" + e.supplier,
|
||||
value: e.name,
|
||||
supplier: e.supplier,
|
||||
...e,
|
||||
audienceList: null,
|
||||
}))
|
||||
);
|
||||
|
||||
watch(props, init)
|
||||
watch(props, init);
|
||||
|
||||
function init() {
|
||||
//第一次进来 编辑赋值
|
||||
@@ -81,46 +110,47 @@ function init() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
console.log('onMounted')
|
||||
init()
|
||||
getOutTeacher()
|
||||
})
|
||||
console.log("onMounted");
|
||||
init();
|
||||
getOutTeacher();
|
||||
});
|
||||
|
||||
|
||||
const memberScroll = ({ target: { scrollHeight, scrollTop, clientHeight } }) => {
|
||||
scrollHeight === (clientHeight + scrollTop) && memberParam.value.pageNo++
|
||||
const memberScroll = ({
|
||||
target: { scrollHeight, scrollTop, clientHeight },
|
||||
}) => {
|
||||
scrollHeight === clientHeight + scrollTop && memberParam.value.pageNo++;
|
||||
};
|
||||
const debounceObject = debounce(getOutTeacher, 1000)
|
||||
const debounceObject = debounce(getOutTeacher, 1000);
|
||||
//搜索学员
|
||||
const searchMember = (keyword) => {
|
||||
console.log('searchMember', keyword)
|
||||
loading.value = true
|
||||
isOpen.value = true
|
||||
userList.value = []
|
||||
memberParam.value.pageNo = 1
|
||||
memberParam.value.teacherType = 2
|
||||
memberParam.value.name = keyword
|
||||
console.log('searchMember', memberParam.value)
|
||||
debounceObject()
|
||||
console.log("searchMember", keyword);
|
||||
loading.value = true;
|
||||
isOpen.value = true;
|
||||
userList.value = [];
|
||||
memberParam.value.pageNo = 1;
|
||||
memberParam.value.teacherType = 2;
|
||||
memberParam.value.name = keyword;
|
||||
console.log("searchMember", memberParam.value);
|
||||
debounceObject();
|
||||
};
|
||||
|
||||
function blur() {
|
||||
isOpen.value = false
|
||||
memberParam.value.name = ''
|
||||
memberParam.value.pageNo = 1
|
||||
memberParam.value.teacherType = 2
|
||||
isOpen.value = false;
|
||||
memberParam.value.name = "";
|
||||
memberParam.value.pageNo = 1;
|
||||
memberParam.value.teacherType = 2;
|
||||
}
|
||||
|
||||
function change(e, l) {
|
||||
memberParam.value.name = ''
|
||||
memberParam.value.teacherType = 2
|
||||
memberParam.value.pageNo = 1
|
||||
isOpen.value = false
|
||||
Array.isArray(l) && (selectOptions.value = l)
|
||||
Array.isArray(selectOptions.value) && emit('onChange', e, l)
|
||||
emit('update:name', l?.label)
|
||||
emit('update:value', l?.value)
|
||||
emit('update:mobile', l?.label)
|
||||
memberParam.value.name = "";
|
||||
memberParam.value.teacherType = 2;
|
||||
memberParam.value.pageNo = 1;
|
||||
isOpen.value = false;
|
||||
Array.isArray(l) && (selectOptions.value = l);
|
||||
Array.isArray(selectOptions.value) && emit("onChange", e, l);
|
||||
emit("update:name", l?.label);
|
||||
emit("update:value", l?.value);
|
||||
emit("update:supplier", l?.supplier);
|
||||
emit("update:mobile", l?.label);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -139,7 +139,8 @@
|
||||
</template>
|
||||
<!-- TODO GX01 -->
|
||||
<ProjectManagerOutTeacher v-model:value="formParam.name" v-model:name="formParam.teacherName"
|
||||
placeholder="请输入工号/讲师姓名进行检索" @onChange="managerChange"></ProjectManagerOutTeacher>
|
||||
v-model:supplier="formParam.supplier"
|
||||
placeholder="请输入工号/讲师姓名进行检索" @onChange="managerChange"></ProjectManagerOutTeacher>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
@@ -474,15 +475,15 @@ export default {
|
||||
|
||||
//获取内容分类
|
||||
const sysTypeOptions = computed(() => store.state.content_type);
|
||||
|
||||
//TODO GX01
|
||||
watch(() => state.formParam.name ,
|
||||
(newValue, oldValue) => {
|
||||
console.log('教师姓名值 发生了变更', newValue, oldValue);
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
|
||||
watch(() => state.formParam.name, (val) => {
|
||||
console.log(val, 'name gx data')
|
||||
})
|
||||
|
||||
watch(() => state.formParam.teacherName, (val) => {
|
||||
console.log(val, 'teacherName gx data')
|
||||
})
|
||||
|
||||
const treetype = (val, lab) => {
|
||||
state.formParam.courseTypeName = lab.toString()
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@
|
||||
src="@/assets/images/coursewareManage/asterisk.png" alt="" />
|
||||
讲师姓名
|
||||
</template>
|
||||
<!-- TODO GX01 -->
|
||||
<SearchTeacher @tlevel="teacherTlevel" :lecturer="true" :disabled="!!id"
|
||||
v-model:value="formParam.name" v-model:lable="formParam.orgNames" v-model:orgId="formParam.orgId"
|
||||
v-model:id="formParam.id" v-model:system="tSystemNames" v-model:level="formParam.tlevelId">
|
||||
|
||||
Reference in New Issue
Block a user