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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
| <template>
| <a-cascader v-bind="getProps" class="pca-select" @change="handleChange" />
| </template>
|
| <script lang="ts">
| import { computed, defineComponent } from 'vue';
| import { regionData, getRealCode } from '/@/components/Form/src/utils/areaDataUtil';
| import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
| import { useJVxeComponent, useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
| import { dispatchEvent } from '/@/components/jeecg/JVxeTable/utils';
|
| export default defineComponent({
| name: 'JVxePcaCell',
| props: useJVxeCompProps(),
| setup(props: JVxeComponent.Props) {
| const { innerValue, cellProps, handleChangeCommon } = useJVxeComponent(props);
|
| const selectedValue = computed(() => {
| let val: any = innerValue.value;
| if (!val) {
| return []
| }
| let arr = getRealCode(val, 3);
| return arr;
| });
|
| const getProps = computed(() => {
| return {
| ...cellProps.value,
| options: regionData,
| showOverflow: false,
| value: selectedValue.value,
| };
| });
|
| function handleChange(arr) {
| let str = '';
| if(arr && arr.length==3){
| str = arr[2];
| }
| handleChangeCommon(str);
| }
|
| return {
| handleChange,
| selectedValue,
| getProps
| };
| },
| // 【组件增强】注释详见:JVxeComponent.Enhanced
| enhanced: {
| switches: {
| visible: true,
| },
| translate: {
| enabled: false,
| },
| aopEvents: {
| editActived({ $event }) {
| dispatchEvent({
| $event,
| props: this.props,
| className: '.ant-select .ant-select-selection-search-input',
| isClick: true,
| });
| },
| },
| } as JVxeComponent.EnhancedPartial,
| });
| </script>
| <style lang="less">
| .pca-select{
| .ant-select-selection-placeholder{
| color: #bfbfbf !important;
| }
| }
| </style>
|
|