mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-22 01:06:45 +08:00
t
This commit is contained in:
@@ -19,13 +19,13 @@
|
||||
@change="change"
|
||||
>
|
||||
<template v-if="loading" #notFoundContent>
|
||||
<a-spin size="small"/>
|
||||
<a-spin size="small" />
|
||||
</template>
|
||||
</a-select>
|
||||
</template>
|
||||
<script>
|
||||
import {onMounted, reactive, toRefs, watch} from "vue";
|
||||
import {scrollLoad, throttle} from "@/api/method";
|
||||
import { onMounted, reactive, toRefs, watch } from "vue";
|
||||
import { scrollLoad, throttle } from "@/api/method";
|
||||
import * as api1 from "@/api/index1";
|
||||
|
||||
export default {
|
||||
@@ -34,69 +34,73 @@ export default {
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择'
|
||||
default: "请选择",
|
||||
},
|
||||
// 'multiple' | 'tags'
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'select'
|
||||
default: "select",
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
options: [],
|
||||
managerArray: [],
|
||||
memberParam: {keyWord: '', pageNo: 1, pageSize: 10},
|
||||
memberParam: { keyWord: "", pageNo: 1, pageSize: 10 },
|
||||
loading: false,
|
||||
init: false
|
||||
init: false,
|
||||
});
|
||||
|
||||
watch(()=>state.memberParam.keyWord , throttle(getMember, 500))
|
||||
watch(()=>state.memberParam.pageNo , throttle(getPushMember, 500))
|
||||
watch(props, init)
|
||||
watch(() => state.memberParam.keyWord, throttle(getMember, 500));
|
||||
watch(() => state.memberParam.pageNo, throttle(getPushMember, 500));
|
||||
watch(props, init);
|
||||
|
||||
onMounted(() => {
|
||||
console.log('onMounted')
|
||||
console.log("onMounted");
|
||||
// init()
|
||||
})
|
||||
});
|
||||
|
||||
function getMember() {
|
||||
state.loading = true
|
||||
state.options = []
|
||||
getMemberData()
|
||||
state.loading = true;
|
||||
state.options = [];
|
||||
getMemberData();
|
||||
}
|
||||
|
||||
function getPushMember() {
|
||||
state.loading = true
|
||||
getMemberData()
|
||||
state.loading = true;
|
||||
getMemberData();
|
||||
}
|
||||
|
||||
|
||||
function getMemberData() {
|
||||
console.log('getMemberData')
|
||||
console.log("getMemberData");
|
||||
api1.getMemberInfo(state.memberParam).then((res) => {
|
||||
const list = res.data.data.rows.filter(e => !(props.value + '')?.includes(e.id + '')).map(e => ({
|
||||
const list = res.data.data.rows
|
||||
.filter((e) => !(props.value + "")?.includes(e.id + ""))
|
||||
.map((e) => ({
|
||||
label: e.realName,
|
||||
value: e.id
|
||||
value: e.id,
|
||||
}));
|
||||
if (state.memberParam.pageNo === 1 && props.value) {
|
||||
const arrManagerId = (props.value + '').split(',')
|
||||
const arrManager = props.name.split(',')
|
||||
state.options = [...arrManager.map((e, i) => ({label: e, value: arrManagerId[i]})), ...list]
|
||||
} else state.options.push(...list)
|
||||
state.loading = false
|
||||
const arrManagerId = (props.value + "").split(",");
|
||||
const arrManager = props.name.split(",");
|
||||
state.options = [
|
||||
...arrManager.map((e, i) => ({ label: e, value: arrManagerId[i] })),
|
||||
...list,
|
||||
];
|
||||
} else state.options.push(...list);
|
||||
state.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,41 +114,50 @@ export default {
|
||||
|
||||
//搜索学员
|
||||
const searchMember = (keyWord) => {
|
||||
keyWord && (state.memberParam = {keyWord, pageNo: 1, pageSize: 10});
|
||||
keyWord && (state.memberParam = { keyWord, pageNo: 1, pageSize: 10 });
|
||||
};
|
||||
|
||||
function init() {
|
||||
console.log('init--', props)
|
||||
console.log(Array.isArray(state.managerArray))
|
||||
if ((props.value + '') !== (Array.isArray(state.managerArray) ? state.managerArray.join(',') : (state.managerArray + ''))) {
|
||||
console.log("init--", props);
|
||||
console.log(Array.isArray(state.managerArray));
|
||||
if (
|
||||
props.value + "" !==
|
||||
(Array.isArray(state.managerArray)
|
||||
? state.managerArray.join(",")
|
||||
: state.managerArray + "")
|
||||
) {
|
||||
if (props.value) {
|
||||
const arrManager = props.name.split(',')
|
||||
const arrManagerId = (props.value + '').split(',')
|
||||
state.managerArray = props.mode === 'select' ? props.value : arrManagerId;
|
||||
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
|
||||
const arrManager = props.name.split(",");
|
||||
const arrManagerId = (props.value + "").split(",");
|
||||
state.managerArray =
|
||||
props.mode === "select" ? props.value : arrManagerId;
|
||||
state.options = arrManager.map((e, i) => ({
|
||||
label: e,
|
||||
value: arrManagerId[i],
|
||||
}));
|
||||
} else {
|
||||
state.managerArray = []
|
||||
state.managerArray = [];
|
||||
}
|
||||
getMemberData()
|
||||
getMemberData();
|
||||
return;
|
||||
}
|
||||
if (!props.value) {
|
||||
if (!(state.options && state.options.length)) {
|
||||
state.options = []
|
||||
getMember()
|
||||
state.options = [];
|
||||
getMember();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function change(e, l) {
|
||||
console.log('change', l)
|
||||
console.log("change", l);
|
||||
if (Array.isArray(l)) {
|
||||
ctx.emit('update:value', l.map(t => t.value).join(','))
|
||||
ctx.emit('update:name', l.map(t => t.label).join(','))
|
||||
ctx.emit("update:value", l.map((t) => t.value).join(","));
|
||||
ctx.emit("update:name", l.map((t) => t.label).join(","));
|
||||
} else {
|
||||
ctx.emit('update:value', l.value)
|
||||
ctx.emit('update:name', l.label)
|
||||
ctx.emit("update:value", l.value);
|
||||
ctx.emit("update:name", l.label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +165,7 @@ export default {
|
||||
...toRefs(state),
|
||||
searchMember,
|
||||
memberScroll,
|
||||
change
|
||||
change,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -547,6 +547,7 @@
|
||||
alt="asterisk"
|
||||
/>
|
||||
</div>
|
||||
<!-- 授课教师1 -->
|
||||
<span style="margin-right: 14px">授课教师</span>
|
||||
</div>
|
||||
<div class="item_inp">
|
||||
@@ -4501,6 +4502,7 @@ export default defineComponent({
|
||||
state.qdms_inputV1 = state.xzinputV1;
|
||||
state.xzinputV1 = "";
|
||||
getDictList("faceclassPic");
|
||||
getTea();
|
||||
}
|
||||
if (state.bs_hs && state.valueE1 != "") {
|
||||
state.addOnlineCoursevisible = true;
|
||||
@@ -5062,7 +5064,7 @@ export default defineComponent({
|
||||
};
|
||||
//获取教师
|
||||
const getTea = async () => {
|
||||
console.log("获取授课教师信息");
|
||||
console.log("获取授课教师信息33333333333");
|
||||
options4CurName.value = state.teacher;
|
||||
options4CurId.value = state.teacherId;
|
||||
|
||||
@@ -5157,6 +5159,7 @@ export default defineComponent({
|
||||
|
||||
state.ft_hs = true;
|
||||
state.ft_eidt = true;
|
||||
getTea();
|
||||
};
|
||||
|
||||
// 预览弹框 开启和关闭
|
||||
|
||||
Reference in New Issue
Block a user