Browse Source

fix: [系统组件] 选择用户的组件优化

master
memorylkf 2 weeks ago
parent
commit
0824a6a997
3 changed files with 8 additions and 25 deletions
  1. +2
    -2
      src/views/business/comps/select/SelectDeptUser.vue
  2. +4
    -21
      src/views/business/comps/select/SelectDeptUserDialog.vue
  3. +2
    -2
      src/views/business/study/comp/suject.vue

+ 2
- 2
src/views/business/comps/select/SelectDeptUser.vue View File

@ -3,7 +3,7 @@
<template> <template>
<div> <div>
<el-input v-model="selected.name" :placeholder="$t('form.placeholderSelect')" readonly @click.native="showSelectDeptUser" /> <el-input v-model="selected.name" :placeholder="$t('form.placeholderSelect')" readonly @click.native="showSelectDeptUser" />
<SelectDeptUserDialog ref="selectDeptUserDialog" v-model="selected.id" :name="selected.name" @change="handleChange" />
<SelectDeptUserDialog ref="selectDeptUserDialog" @change="handleChange" />
</div> </div>
</template> </template>
@ -53,7 +53,7 @@ export default {
methods: { methods: {
showSelectDeptUser(){ showSelectDeptUser(){
if(!this.readOnly){ if(!this.readOnly){
this.$refs.selectDeptUserDialog.show()
this.$refs.selectDeptUserDialog.show(this.selected.id,this.selected.name)
} }
}, },
handleChange(obj) { handleChange(obj) {

+ 4
- 21
src/views/business/comps/select/SelectDeptUserDialog.vue View File

@ -52,28 +52,8 @@ export default {
name: "SelectDeptUserDialog", name: "SelectDeptUserDialog",
components: {}, components: {},
props: { props: {
value: {
type: [Number, String , Array],
default: ''
},
name: {
type: String,
default: ''
},
}, },
watch: { watch: {
value: {
immediate: true,
handler(v) {
this.selected.id = v ?((v+'').indexOf('u_')>-1? v:('u_'+v)):''
}
},
name: {
immediate: true,
handler(v) {
this.selected.name=v || ''
}
},
filterText(val) { filterText(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
} }
@ -100,7 +80,9 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
show(){
show(id,name){
this.selected.id = id ?((id+'').indexOf('u_')>-1? id:('u_'+id)):''
this.selected.name=name || ''
this.open = true this.open = true
this.filterText = '' this.filterText = ''
}, },
@ -137,6 +119,7 @@ export default {
id:this.selected && this.selected.id?this.selected.id.replace('u_',''):'', id:this.selected && this.selected.id?this.selected.id.replace('u_',''):'',
name:this.selected.name name:this.selected.name
} }
debugger
this.$emit('change', obj) this.$emit('change', obj)
this.$emit('input', obj.id) this.$emit('input', obj.id)
this.open = false this.open = false

+ 2
- 2
src/views/business/study/comp/suject.vue View File

@ -49,7 +49,7 @@
</div> </div>
</el-dialog> </el-dialog>
<SelectDeptUserDialog ref="selectSubjectDeptUserDialog" v-model="infoDialog.subject.leader" :name="infoDialog.subject.leaderName" @change="changeSubject" />
<SelectDeptUserDialog ref="selectSubjectDeptUserDialog" @change="changeSubject" />
</div> </div>
</template> </template>
@ -138,7 +138,7 @@ export default {
}, },
chooseLeader(row){ chooseLeader(row){
this.infoDialog.subject = row this.infoDialog.subject = row
this.$refs.selectSubjectDeptUserDialog.show()
this.$refs.selectSubjectDeptUserDialog.show(this.infoDialog.subject.leader,this.infoDialog.subject.leaderName)
}, },
changeSubject(val){ changeSubject(val){
this.infoDialog.subject.leader = val.id this.infoDialog.subject.leader = val.id

Loading…
Cancel
Save