zhangwei
3 天以前 9488f2bcb346c32c64f2c4eb5814fece8726b363
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import { h } from 'vue';
import { BasicColumn, FormSchema } from '/@@/components/Table';
@foreach (var column in Model.TableField){
if(column.EffectType == "Upload"){
@:import { uploadFile } from '/@@/api/sys/admin';
}else if(column.EffectType == "ForeignKey"){
@:import { get@(column.FkEntityName)Dropdown } from '/@@/api/main/@(Model.ClassName)';
}else if(column.EffectType == "DictSelector"){
@:import { getDataList } from '/@@/api/sys/admin';
}else if(column.EffectType == "ApiTreeSelector"){
@:import { get@(column.FkEntityName)Tree } from '/@@/api/main/@(Model.ClassName)';
}else if(column.EffectType == "ConstSelector"){
@:import { codeToName, getSelector } from '/@@/utils/helper/constSelectorHelper';
}else if(column.EffectType == "Switch"){
@:import { Switch } from 'ant-design-vue';
}
}
export const columns: BasicColumn[] = [
  @foreach (var column in Model.TableField){
  if(column.WhetherTable == "Y"){
  @:{
    @:title: '@column.ColumnComment',
    @:dataIndex: '@column.LowerPropertyName',    
    @:sorter: true,
if(column.EffectType == "Upload"){
    @:slots: { customRender: '@(column.LowerPropertyName)' },
}else if(column.EffectType == "ForeignKey"){
    @:customRender: ({ record }) => {
      @:return record.fk@(column.PropertyName).@(column.LowerFkDisplayColumnsList?.First());
    @:},
}else if(column.EffectType == "Switch"){
    @:customRender: ({ record }) => {
      @:return h(@(column.EffectType), { checked: record.@(column.LowerPropertyName) });
    @:},
}else if(column.EffectType == "ConstSelector"){
    @:customRender: ({ record }) => {
      @:return codeToName(record.@(column.LowerPropertyName), '@(column.DictTypeCode)');
    @:},
}
  @:},
    }
 
  }
];
 
export const searchFormSchema: FormSchema[] = [
@foreach (var column in Model.WhetherQueryList){  
  @:{
    @:field: '@column.LowerPropertyName',
    @:label: '@column.ColumnComment',
    @:colProps: { span: 8 },
if(column.EffectType == "ForeignKey"){
    @:component: 'ApiSelect',
    @:componentProps: {
      @:api: get@(column.FkEntityName)Dropdown,
      @:labelField: 'label',
      @:valueField: 'value',
    @:},
}else if(column.EffectType == "DictSelector"){
    @:component: 'ApiSelect',
    @:componentProps: {
      @:api: getDataList,
      @:params: '@(column.DictTypeCode)',
      @:fieldNames: {
        @:label: 'label',
        @:value: 'value',
      @:},
    @:},
}else if(column.EffectType == "ConstSelector"){
    @:component: 'Select',
    @:componentProps: {
      @:options: getSelector('@(column.DictTypeCode)'),
      @:fieldNames: {
        @:label: 'name',
        @:value: 'code',
      @:},
    @:},
}else if(column.EffectType == "ApiTreeSelector"){
    @:component: '@(column.EffectType)',
    @:componentProps: {
      @:api: get@(column.FkEntityName)Tree,
    @:},
}
else if(column.NetType?.TrimEnd('?') == "DateTime" && column.QueryType == "~"){
    @:component: 'RangePicker',
    @:componentProps: {
    @:  valueFormat:"YYYY-MM-DD"
    @:},
} else {
    @:component: 'Input',
}
 
  @:},
}
];
 
export const formSchema: FormSchema[] = [
  @foreach (var column in Model.TableField){
  @:{
    @:label: '@column.ColumnComment',
    @:field: '@column.LowerPropertyName',
if(column.EffectType == "ForeignKey"){
    @:component: 'ApiSelect',
    @:componentProps: {
      @:api: get@(column.FkEntityName)Dropdown,
      @:labelField: 'label',
      @:valueField: 'value',
    @:},
}else if(column.EffectType == "DictSelector"){
    @:component: 'ApiSelect',
    @:componentProps: {
      @:api: getDataList,
      @:params: '@(column.DictTypeCode)',
      @:fieldNames: {
        @:label: 'label',
        @:value: 'value',
      @:},
    @:},
}else if(column.EffectType == "ConstSelector"){
    @:component: 'Select',
    @:componentProps: {
      @:options: getSelector('@(column.DictTypeCode)'),
      @:fieldNames: {
        @:label: 'name',
        @:value: 'code',
      @:},
    @:},
}else if(column.EffectType == "ApiTreeSelector"){
    @:component: '@(column.EffectType)',
    @:componentProps: {
      @:api: get@(column.FkEntityName)Tree,
    @:},
}else if(column.EffectType == "Switch"){
    @:component: '@(column.EffectType)',
    @:componentProps: {
      @:checkedChildren: '是',
      @:unCheckedChildren: '否',
    @:},
}else{
    @:component: '@column.EffectType',
}
    if(column.WhetherRequired == "Y"){
    @:required: true,
    }else{
    @:required: false,
    }
    if(column.EffectType == "Upload"){
    @:componentProps: {
      @:maxNumber: 1,
      @:api: uploadFile,
    @:},
    }
  if(column.LowerPropertyName == "id"){
    @:show: false,
  }
    @:colProps: { span: 12 },
  @:},
  }
];