AntD的一些骚操作

1、TreeSelect

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
<a-form-model-item label="审核科室" class="flex-item" prop="OrgCode">
<a-tree-select
v-model="form.ShowName"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="orgList"
:replaceFields="{
children: 'Children',
title: 'OrgName',
key: 'OrgCode',
value: 'Search', // 数据拦截后增加Search字段(字段由OrgName+OrgCode组成)
}"
allowClear
showSearch
placeholder="请选择审核科室"
@select="selectOrgCode"
>
</a-tree-select>
</a-form-model-item>
</template>
<script>
class classForm {
OrgCode: string;
OrgName: string | undefined;
ShowName: string;
constructor({ OrgCode, OrgName, Order }: classForm | any = {}) {
this.OrgCode = OrgCode;
this.OrgName = OrgName;
this.ShowName = typeof OrgCode === 'undefined' ? undefined : OrgName + OrgCode;

}
}
methods: {
selectOrgCode(_value: string, node: any) {
this.form.OrgCode = node.eventKey;
this.form.OrgName = node.title;
},
}
</script>