|
|
@ -1,14 +1,28 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<a-input-search |
|
|
|
<!-- <a-input |
|
|
|
v-model="userNames" |
|
|
|
v-model="userNames" |
|
|
|
placeholder="请先选择用户" |
|
|
|
placeholder="请点击选择用户" |
|
|
|
readOnly |
|
|
|
readOnly |
|
|
|
unselectable="on" |
|
|
|
unselectable="on" |
|
|
|
@search="onSearchDepUser"> |
|
|
|
@search="onSearchDepUser" |
|
|
|
|
|
|
|
:disabled="disabled" |
|
|
|
|
|
|
|
@click="onSearchDepUser" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<a-icon slot="enterButton" type="cluster" title="部门选择控件" /> |
|
|
|
|
|
|
|
</a-input> --> |
|
|
|
|
|
|
|
<a-input-search v-model="userNames" placeholder="请先选择用户" readOnly unselectable="on" @search="onSearchDepUser"> |
|
|
|
<a-button slot="enterButton" :disabled="disabled">选择用户</a-button> |
|
|
|
<a-button slot="enterButton" :disabled="disabled">选择用户</a-button> |
|
|
|
</a-input-search> |
|
|
|
</a-input-search> |
|
|
|
<j-select-user-by-dep-modal ref="selectModal" :modal-width="modalWidth" :multi="multi" @ok="selectOK" :user-ids="value" @initComp="initComp"/> |
|
|
|
<j-select-user-by-dep-modal |
|
|
|
|
|
|
|
ref="selectModal" |
|
|
|
|
|
|
|
:modal-width="modalWidth" |
|
|
|
|
|
|
|
:multi="multi" |
|
|
|
|
|
|
|
@ok="selectOK" |
|
|
|
|
|
|
|
:user-ids="value" |
|
|
|
|
|
|
|
@initComp="initComp" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<!-- :user-ids="value" --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
@ -17,37 +31,37 @@ |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
name: 'JSelectUserByDep', |
|
|
|
name: 'JSelectUserByDep', |
|
|
|
components: {JSelectUserByDepModal}, |
|
|
|
components: { JSelectUserByDepModal }, |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
modalWidth: { |
|
|
|
modalWidth: { |
|
|
|
type: Number, |
|
|
|
type: Number, |
|
|
|
default: 1250, |
|
|
|
default: 1250, |
|
|
|
required: false |
|
|
|
required: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
value: { |
|
|
|
value: { |
|
|
|
type: String, |
|
|
|
type: String, |
|
|
|
required: false |
|
|
|
required: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
disabled: { |
|
|
|
disabled: { |
|
|
|
type: Boolean, |
|
|
|
type: Boolean, |
|
|
|
required: false, |
|
|
|
required: false, |
|
|
|
default: false |
|
|
|
default: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
multi: { |
|
|
|
multi: { |
|
|
|
type: Boolean, |
|
|
|
type: Boolean, |
|
|
|
default: true, |
|
|
|
default: false, |
|
|
|
required: false |
|
|
|
required: false, |
|
|
|
}, |
|
|
|
}, |
|
|
|
backUser: { |
|
|
|
backUser: { |
|
|
|
type: Boolean, |
|
|
|
type: Boolean, |
|
|
|
default: false, |
|
|
|
default: false, |
|
|
|
required: false |
|
|
|
required: false, |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
userIds: "", |
|
|
|
userIds: '', |
|
|
|
userNames: "" |
|
|
|
userNames: '', |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
@ -56,27 +70,27 @@ |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
value(val) { |
|
|
|
value(val) { |
|
|
|
this.userIds = val |
|
|
|
this.userIds = val |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
model: { |
|
|
|
|
|
|
|
prop: 'value', |
|
|
|
|
|
|
|
event: 'change' |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// model: { |
|
|
|
|
|
|
|
// prop: 'value', |
|
|
|
|
|
|
|
// event: 'change', |
|
|
|
|
|
|
|
// }, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
initComp(userNames) { |
|
|
|
initComp(userNames) { |
|
|
|
this.userNames = userNames |
|
|
|
this.userNames = userNames |
|
|
|
}, |
|
|
|
}, |
|
|
|
//返回选中的用户信息 |
|
|
|
//返回选中的用户信息 |
|
|
|
backDeparInfo(){ |
|
|
|
backDeparInfo() { |
|
|
|
if(this.backUser===true){ |
|
|
|
if (this.backUser === true) { |
|
|
|
if(this.userIds && this.userIds.length>0){ |
|
|
|
if (this.userIds && this.userIds.length > 0) { |
|
|
|
let arr1 = this.userIds.split(',') |
|
|
|
let arr1 = this.userIds.split(',') |
|
|
|
let arr2 = this.userNames.split(',') |
|
|
|
let arr2 = this.userNames.split(',') |
|
|
|
let info = [] |
|
|
|
let info = [] |
|
|
|
for(let i=0;i<arr1.length;i++){ |
|
|
|
for (let i = 0; i < arr1.length; i++) { |
|
|
|
info.push({ |
|
|
|
info.push({ |
|
|
|
value: arr1[i], |
|
|
|
value: arr1[i], |
|
|
|
text: arr2[i] |
|
|
|
text: arr2[i], |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
this.$emit('back', info) |
|
|
|
this.$emit('back', info) |
|
|
@ -87,25 +101,45 @@ |
|
|
|
this.$refs.selectModal.showModal() |
|
|
|
this.$refs.selectModal.showModal() |
|
|
|
}, |
|
|
|
}, |
|
|
|
selectOK(rows, idstr) { |
|
|
|
selectOK(rows, idstr) { |
|
|
|
console.log("当前选中用户", rows) |
|
|
|
//修改 |
|
|
|
console.log("当前选中用户ID", idstr) |
|
|
|
let temp = '' |
|
|
|
if (!rows) { |
|
|
|
console.log('当前选中用户', rows) |
|
|
|
|
|
|
|
console.log('当前选中用户ID', idstr) |
|
|
|
|
|
|
|
//修改if(!rows) |
|
|
|
|
|
|
|
if (!rows && rows.length <= 0) { |
|
|
|
this.userNames = '' |
|
|
|
this.userNames = '' |
|
|
|
this.userIds = '' |
|
|
|
this.userIds = '' |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let temp = '' |
|
|
|
// let temp = '' |
|
|
|
|
|
|
|
//修改 |
|
|
|
|
|
|
|
|
|
|
|
for (let item of rows) { |
|
|
|
for (let item of rows) { |
|
|
|
temp += ',' + item.realname |
|
|
|
// |
|
|
|
|
|
|
|
console.log(item) |
|
|
|
|
|
|
|
// temp += item.realname |
|
|
|
|
|
|
|
console.log(temp) |
|
|
|
|
|
|
|
//修改 |
|
|
|
|
|
|
|
temp += ' ' + item.realname |
|
|
|
} |
|
|
|
} |
|
|
|
this.userNames = temp.substring(1) |
|
|
|
// this.userNames = temp.substring(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.userNames = temp |
|
|
|
|
|
|
|
console.log(this.userNames) |
|
|
|
this.userIds = idstr |
|
|
|
this.userIds = idstr |
|
|
|
|
|
|
|
console.log(rows) |
|
|
|
} |
|
|
|
} |
|
|
|
this.$emit("change", this.userIds) |
|
|
|
this.$emit('change', this.userIds) |
|
|
|
} |
|
|
|
//修改 |
|
|
|
} |
|
|
|
// this.$emit('change', this.userNames) |
|
|
|
|
|
|
|
this.backDeparInfo() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
model: { |
|
|
|
|
|
|
|
prop: 'userNames', |
|
|
|
|
|
|
|
event: 'change', |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
<style scoped></style> |
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
|