mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-13 04:46:46 +08:00
-- bug 项目经理
This commit is contained in:
@@ -28,10 +28,12 @@ export default {
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: Number,
|
type: String,
|
||||||
|
default: ''
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: Number,
|
type: String,
|
||||||
|
default: ''
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -55,9 +57,9 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
init: false
|
init: false
|
||||||
});
|
});
|
||||||
const getMemberThrottle = throttle(getMember, 500)
|
|
||||||
|
|
||||||
watch(() => state.memberParam, getMemberThrottle)
|
watch(()=>state.memberParam.keyWord , throttle(getMember, 500))
|
||||||
|
watch(()=>state.memberParam.pageNo , throttle(getPushMember, 500))
|
||||||
watch(props, init)
|
watch(props, init)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -71,15 +73,21 @@ export default {
|
|||||||
getMemberData()
|
getMemberData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPushMember() {
|
||||||
|
state.loading = true
|
||||||
|
getMemberData()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getMemberData() {
|
function getMemberData() {
|
||||||
|
console.log('getMemberData')
|
||||||
api1.getMemberInfo(state.memberParam).then((res) => {
|
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,
|
label: e.realName,
|
||||||
value: e.id
|
value: e.id
|
||||||
}));
|
}));
|
||||||
if (state.memberParam.pageNo === 1 && props.value) {
|
if (state.memberParam.pageNo === 1 && props.value) {
|
||||||
const arrManagerId = props.value.split(',')
|
const arrManagerId = (props.value + '').split(',')
|
||||||
const arrManager = props.name.split(',')
|
const arrManager = props.name.split(',')
|
||||||
state.options = [...arrManager.map((e, i) => ({label: e, value: arrManagerId[i]})), ...list]
|
state.options = [...arrManager.map((e, i) => ({label: e, value: arrManagerId[i]})), ...list]
|
||||||
} else state.options.push(...list)
|
} else state.options.push(...list)
|
||||||
@@ -102,10 +110,11 @@ export default {
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
console.log('init--', props)
|
console.log('init--', props)
|
||||||
if (props.value !== typeof state.managerArray === 'object' ? state.managerArray.join(',') : state.managerArray) {
|
console.log(Array.isArray(state.managerArray))
|
||||||
|
if ((props.value + '') !== (Array.isArray(state.managerArray) ? state.managerArray.join(',') : (state.managerArray + ''))) {
|
||||||
if (props.value) {
|
if (props.value) {
|
||||||
const arrManager = props.name.split(',')
|
const arrManager = props.name.split(',')
|
||||||
const arrManagerId = props.value.split(',')
|
const arrManagerId = (props.value + '').split(',')
|
||||||
state.managerArray = props.mode === 'select' ? props.value : arrManagerId;
|
state.managerArray = props.mode === 'select' ? props.value : arrManagerId;
|
||||||
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
|
state.options = arrManager.map((e, i) => ({label: e, value: arrManagerId[i]}))
|
||||||
} else {
|
} else {
|
||||||
@@ -124,7 +133,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change(e, l) {
|
function change(e, l) {
|
||||||
console.log('change')
|
console.log('change', l)
|
||||||
if (Array.isArray(l)) {
|
if (Array.isArray(l)) {
|
||||||
ctx.emit('update:value', l.map(t => t.value).join(','))
|
ctx.emit('update:value', l.map(t => t.value).join(','))
|
||||||
ctx.emit('update:name', l.map(t => t.label).join(','))
|
ctx.emit('update:name', l.map(t => t.label).join(','))
|
||||||
|
|||||||
Reference in New Issue
Block a user