perf: 选择器的优化

This commit is contained in:
kuaifan 2022-11-17 10:00:56 +08:00
parent cbadf25623
commit c817e5815f
5 changed files with 16 additions and 5 deletions

View File

@ -78,6 +78,10 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
maxHiddenSelect: {
type: Boolean,
default: false
},
projectId: { projectId: {
type: Number, type: Number,
default: 0 default: 0
@ -142,6 +146,11 @@
}, },
selects(val) { selects(val) {
this.$emit('input', val); this.$emit('input', val);
if (this.maxHiddenSelect
&& val.length >= this.maxHiddenSelect
&& this.$refs.select) {
this.$refs.select.hideMenu()
}
} }
}, },
methods: { methods: {

View File

@ -409,7 +409,7 @@
:mask-closable="false"> :mask-closable="false">
<Form :model="transferData" label-width="auto" @submit.native.prevent> <Form :model="transferData" label-width="auto" @submit.native.prevent>
<FormItem prop="owner_userid" :label="$L('项目负责人')"> <FormItem prop="owner_userid" :label="$L('项目负责人')">
<UserInput v-model="transferData.owner_userid" :multiple-max="1" :placeholder="$L('选择项目负责人')"/> <UserInput v-model="transferData.owner_userid" :multiple-max="1" max-hidden-select :placeholder="$L('选择项目负责人')"/>
</FormItem> </FormItem>
</Form> </Form>
<div slot="footer" class="adaption"> <div slot="footer" class="adaption">

View File

@ -123,7 +123,8 @@
:multiple-max="1" :multiple-max="1"
:placeholder="$L('选择负责人')" :placeholder="$L('选择负责人')"
:project-id="addData.project_id" :project-id="addData.project_id"
:transfer="false"/> :transfer="false"
max-hidden-select/>
</Col> </Col>
</Row> </Row>
</div> </div>

View File

@ -57,7 +57,8 @@
:multiple-max="1" :multiple-max="1"
:project-id="taskDetail.project_id" :project-id="taskDetail.project_id"
:placeholder="$L('选择任务负责人')" :placeholder="$L('选择任务负责人')"
:transfer="false"/> :transfer="false"
max-hidden-select/>
<div class="task-detail-avatar-buttons"> <div class="task-detail-avatar-buttons">
<Button size="small" type="primary" @click="$refs.owner.ok()">{{$L('确定')}}</Button> <Button size="small" type="primary" @click="$refs.owner.ok()">{{$L('确定')}}</Button>
</div> </div>

View File

@ -154,7 +154,7 @@
<div v-if="departmentParentDisabled" class="form-tip" style="margin-bottom:-16px">{{$L('含有子部门无法修改上级部门')}}</div> <div v-if="departmentParentDisabled" class="form-tip" style="margin-bottom:-16px">{{$L('含有子部门无法修改上级部门')}}</div>
</FormItem> </FormItem>
<FormItem prop="owner_userid" :label="$L('部门负责人')"> <FormItem prop="owner_userid" :label="$L('部门负责人')">
<UserInput v-model="departmentData.owner_userid" :multiple-max="1" :placeholder="$L('请选择部门负责人')"/> <UserInput v-model="departmentData.owner_userid" :multiple-max="1" max-hidden-select :placeholder="$L('请选择部门负责人')"/>
</FormItem> </FormItem>
</Form> </Form>
<div slot="footer" class="adaption"> <div slot="footer" class="adaption">
@ -180,7 +180,7 @@
type="datetime"/> type="datetime"/>
</FormItem> </FormItem>
<FormItem :label="$L('交接人')"> <FormItem :label="$L('交接人')">
<UserInput v-model="disableData.transfer_userid" :disabled-choice="[disableData.userid]" :multiple-max="1" :placeholder="$L('选择交接人')"/> <UserInput v-model="disableData.transfer_userid" :disabled-choice="[disableData.userid]" :multiple-max="1" max-hidden-select :placeholder="$L('选择交接人')"/>
<div class="form-tip">{{ $L(`${disableData.nickname} 负责的项目、任务和文件将移交给交接人`) }}</div> <div class="form-tip">{{ $L(`${disableData.nickname} 负责的项目、任务和文件将移交给交接人`) }}</div>
</FormItem> </FormItem>
</Form> </Form>