103
103
<template #default =" scope" >{ { " {{ formatDate(scope.row.CreatedAt) }}" } }</template >
104
104
</el-table-column >
105
105
{ { end } }
106
- { {- range .Fields } }
106
+ { {- range .FrontFields } }
107
107
{ {- if .DictType} }
108
108
<el-table-column { { - if .Sort} } sortable{{- end}} align =" left" label =" { { .FieldDesc} } " prop =" { { .FieldJson} } " width =" 120" >
109
109
<template #default =" scope" >
203
203
</template >
204
204
205
205
<el-form :model =" formData" label-position =" top" ref =" elFormRef" :rules =" rule" label-width =" 80px" >
206
- { {- range .Fields } }
206
+ { {- range .FrontFields } }
207
207
<el-form-item label =" { { .FieldDesc} } :" prop =" { { .FieldJson} } " >
208
208
{ {- if eq .FieldType " bool" } }
209
209
<el-switch v-model =" formData.{ { .FieldJson} } " active-color =" #13ce66" inactive-color =" #ff4949" active-text =" 是" inactive-text =" 否" clearable ></el-switch >
270
270
{ {- end } }
271
271
</el-form >
272
272
</el-drawer >
273
-
274
- <el-drawer size =" 800" v-model =" detailShow" :before-close =" closeDetailShow" destroy-on-close >
275
- <template #header >
276
- <div class =" flex justify-between items-center" >
277
- <span class =" text-lg" >查看详情</span >
278
- </div >
279
- </template >
280
- <el-descriptions :column =" 1" border >
281
- { {- range .Fields} }
282
- <el-descriptions-item label =" { { .FieldDesc } } " >
283
- { {- if .DictType} }
284
- { {" {{" } } filterDict(formData.{ {.FieldJson} },{ {.DictType} }Options) { {" }}" } }
285
- { {- else if eq .FieldType " picture" } }
286
- <el-image style =" width : 50px ; height : 50px " :preview-src-list =" ReturnArrImg(formData.{ { .FieldJson } } )" :src =" getUrl(formData.{ { .FieldJson } } )" fit =" cover" />
287
- { {- else if eq .FieldType " video" } }
288
- <video
289
- style =" width : 50px ; height : 50px "
290
- muted
291
- preload =" metadata"
292
- >
293
- <source :src =" getUrl(formData.{ { .FieldJson } } ) + '#t=1'" >
294
- </video >
295
- { {- else if eq .FieldType " pictures" } }
296
- <el-image style =" width : 50px ; height : 50px ; margin-right : 10px " :preview-src-list =" ReturnArrImg(formData.{ { .FieldJson } } )" :initial-index =" index" v-for =" (item,index) in formData.{ { .FieldJson } } " :key =" index" :src =" getUrl(item)" fit =" cover" />
297
- { {- else if eq .FieldType " file" } }
298
- <div class =" fileBtn" v-for =" (item,index) in formData.{ { .FieldJson } } " :key =" index" >
299
- <el-button type =" primary" text bg @click =" onDownloadFile(item.url)" >
300
- <el-icon style =" margin-right : 5px " ><Download /></el-icon >
301
- { {" {{" } } item.name { {" }}" } }
302
- </el-button >
303
- </div >
304
- { {- else if eq .FieldType " bool" } }
305
- { {" {{" } } formatBoolean(formData.{ {.FieldJson} }) { {" }}" } }
306
- { {- else if eq .FieldType " time.Time" } }
307
- { {" {{" } } formatDate(formData.{ {.FieldJson} }) { {" }}" } }
308
- { {- else if eq .FieldType " richtext" } }
309
- [富文本内容]
310
- { {- else if eq .FieldType " json" } }
311
- [JSON]
312
- { {- else } }
313
- { {" {{" } } formData.{ {.FieldJson} } { {" }}" } }
314
- { {- end } }
315
- </el-descriptions-item >
316
- { {- end } }
317
- </el-descriptions >
318
- </el-drawer >
319
273
</div >
320
274
</template >
321
275
@@ -362,7 +316,7 @@ defineOptions({
362
316
const { { $element } } Options = ref ([])
363
317
{ { - end } }
364
318
const formData = ref ({
365
- { { - range .Fields } }
319
+ { { - range .FrontFields } }
366
320
{ { - if eq .FieldType " bool" } }
367
321
{ { .FieldJson} } : false ,
368
322
{ { - end } }
@@ -402,7 +356,7 @@ const formData = ref({
402
356
403
357
// 验证规则
404
358
const rule = reactive ({
405
- { { - range .Fields } }
359
+ { { - range .FrontFields } }
406
360
{ { - if eq .Require true } }
407
361
{ { .FieldJson } } : [{
408
362
required: true ,
@@ -435,7 +389,7 @@ const searchRule = reactive({
435
389
}
436
390
} , trigger: ' change' }
437
391
],
438
- { { - range .Fields } }
392
+ { { - range .FrontFields } }
439
393
{ { - if .FieldSearchType} }
440
394
{ { - if eq .FieldType " time.Time" } }
441
395
{ { .FieldJson } } : [{ validator: (rule, value, callback) => {
@@ -468,7 +422,7 @@ const searchInfo = ref({})
468
422
// 排序
469
423
const sortChange = ({ prop, order } ) => {
470
424
const sortMap = {
471
- { { - range .Fields } }
425
+ { { - range .FrontFields } }
472
426
{ { - if and .Sort} }
473
427
{ { - if not (eq .ColumnName " " )} }
474
428
{ { .FieldJson} } : ' { { .ColumnName} } ' ,
@@ -500,7 +454,7 @@ const onSubmit = () => {
500
454
if (! valid) return
501
455
page.value = 1
502
456
pageSize.value = 10
503
- { { - range .Fields } } { { - if eq .FieldType " bool" } }
457
+ { { - range .FrontFields } } { { - if eq .FieldType " bool" } }
504
458
if (searchInfo.value.{ { .FieldJson} } === " " ){
505
459
searchInfo.value.{ { .FieldJson} } =null
506
460
} { { end } } { { end } }
@@ -629,53 +583,6 @@ const delete{{.StructName}}Func = async (row) => {
629
583
// 弹窗控制标记
630
584
const dialogFormVisible = ref (false )
631
585
632
-
633
- // 查看详情控制标记
634
- const detailShow = ref (false )
635
-
636
-
637
- // 打开详情弹窗
638
- const openDetailShow = () => {
639
- detailShow.value = true
640
- }
641
-
642
-
643
- // 打开详情
644
- const getDetails = async (row ) => {
645
- // 打开弹窗
646
- const res = await find{ { .StructName} } ({ { { .PrimaryField.FieldJson} } : row.{ { .PrimaryField.FieldJson} } } )
647
- if (res.code === 0) {
648
- formData.value = res.data.re{ { .Abbreviation} }
649
- openDetailShow()
650
- }
651
- }
652
-
653
-
654
- // 关闭详情弹窗
655
- const closeDetailShow = () => {
656
- detailShow.value = false
657
- formData.value = {
658
- { { - range .Fields} }
659
- { { - if eq .FieldType " bool" } }
660
- { { .FieldJson} } : false ,
661
- { { - end } }
662
- { { - if eq .FieldType " string" } }
663
- { { .FieldJson} } : ' ' ,
664
- { { - end } }
665
- { { - if eq .FieldType " int" } }
666
- { { .FieldJson} } : { { - if .DictType } } undefined{ { else } } 0{ { - end } } ,
667
- { { - end } }
668
- { { - if eq .FieldType " time.Time" } }
669
- { { .FieldJson} } : new Date(),
670
- { { - end } }
671
- { { - if eq .FieldType " float64" } }
672
- { { .FieldJson} } : 0,
673
- { { - end } }
674
- { { - end } }
675
- }
676
- }
677
-
678
-
679
586
// 打开弹窗
680
587
const openDialog = () => {
681
588
type.value = ' create'
@@ -686,7 +593,7 @@ const openDialog = () => {
686
593
const closeDialog = () => {
687
594
dialogFormVisible.value = false
688
595
formData.value = {
689
- { { - range .Fields } }
596
+ { { - range .FrontFields } }
690
597
{ { - if eq .FieldType " bool" } }
691
598
{ { .FieldJson} } : false ,
692
599
{ { - end } }
0 commit comments