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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
| <template>
| <app-layout-row>
| <app-layout-col :span="24">
| <app-table-search
| v-bind="searchProps"
| />
| </app-layout-col>
| <app-layout-col :span="24" :padding-top="10">
| <app-table-pro
| v-bind="tableProps"
| />
| </app-layout-col>
| </app-layout-row>
| </template>
|
| <script setup>
| import {useEntityStore, useAppStore} from '@/store/modules';
|
| const props = defineProps({
| subCurrent: {
| type: Function,
| default: () => {
| }
| }
| });
|
| const tableSearchRef = ref();
| const tableProRef = ref();
| const entityStore = useEntityStore();
| const appStore = useAppStore();
|
| const formFields = [
| {
| type: 'el-input',
| prop: 'code',
| label: '编码',
| col: {
| span: 8
| },
| item: {
| label: '编码',
| prop: 'code',
| },
| input: {
| placeholder: '请输入'
| }
| }
| ];
|
| const tableProps = {
| ref: tableProRef,
| requestParams: {search: {}, base: {}},
| complementHeight: -110,
| subRequest: async (page) => {
| const result = await entityStore.getEntitySet({
| dataName: "sys_dict_item",
| attachMeta: false,
| filter: `parent_id='${tableProps.requestParams.base.id}'`,
| orderBy: "create_time desc",
| ...page
| });
| return result;
| },
| subCurrent(row) {
| props.subCurrent(row);
| },
| title: '内容列表',
| columns: [
| {prop: 'value', label: "字典名称", table: {sortable: 'value'}},
| {prop: "code", label: "字典值", table: {sortable: 'code'}},
| ]
| };
|
| const searchProps = {
| ref: tableSearchRef,
| formFields,
| subSubmit: (params) => {
| tableProps.requestParams.search = params;
| tableProRef.value.getTableData(true);
| }
| }
|
| const setActive = (val) => {
| tableProps.requestParams.base = val;
| tableProRef.value.getTableData(true);
| }
|
| onMounted(async () => {
| if (Object.keys(tableProps.requestParams.base).length > 0) {
| tableProRef.value.getTableData(true);
| }
| })
|
|
| defineExpose({
| setActive
| });
|
| </script>
|
|