mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 20:36:45 +08:00
-- 项目经理
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import {onMounted, reactive, toRefs, watch} from "vue";
|
||||
import {scrollLoad} from "@/api/method";
|
||||
import {scrollLoad, throttle} from "@/api/method";
|
||||
import * as api1 from "@/api/index1";
|
||||
|
||||
export default {
|
||||
@@ -46,8 +46,9 @@ export default {
|
||||
loading: false,
|
||||
init: false
|
||||
});
|
||||
const getMemberThrottle = throttle(getMember, 500)
|
||||
|
||||
watch(() => state.memberParam, getMember)
|
||||
watch(() => state.memberParam, getMemberThrottle)
|
||||
watch(props, init)
|
||||
|
||||
onMounted(() => {
|
||||
@@ -57,15 +58,24 @@ export default {
|
||||
|
||||
function getMember() {
|
||||
state.loading = true
|
||||
state.options = []
|
||||
getMemberData()
|
||||
}
|
||||
|
||||
|
||||
function getMemberData() {
|
||||
api1.getMemberInfo(state.memberParam).then((res) => {
|
||||
const list = res.data.data.rows.filter(e => !props.value?.includes(e.id + '')).map(e => ({
|
||||
label: e.realName,
|
||||
value: e.id
|
||||
}));
|
||||
state.options.push(...list)
|
||||
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 memberScroll = (e) => {
|
||||
@@ -82,16 +92,25 @@ export default {
|
||||
};
|
||||
|
||||
function init() {
|
||||
if (!props.value) {
|
||||
state.managerArray = []
|
||||
console.log('init--', props)
|
||||
if (props.value !== state.managerArray.join(',')) {
|
||||
if (props.value) {
|
||||
const arrManager = props.name.split(',')
|
||||
const arrManagerId = props.value.split(',')
|
||||
state.managerArray = arrManagerId
|
||||
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
|
||||
} else {
|
||||
state.managerArray = []
|
||||
}
|
||||
getMemberData()
|
||||
return;
|
||||
}
|
||||
if (props.value !== state.managerArray.join(',')) {
|
||||
const arrManager = props.name.split(',')
|
||||
const arrManagerId = props.value.split(',')
|
||||
state.managerArray = arrManagerId
|
||||
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
|
||||
getMember()
|
||||
if (!props.value) {
|
||||
if (!(state.options && state.options.length)) {
|
||||
state.options = []
|
||||
getMember()
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user