103103 <template #default =" scope" >{ { " {{ formatDate(scope.row.CreatedAt) }}" } }</template >
104104 </el-table-column >
105105 { { end } }
106- { {- range .Fields } }
106+ { {- range .FrontFields } }
107107 { {- if .DictType} }
108108 <el-table-column { { - if .Sort} } sortable{{- end}} align =" left" label =" { { .FieldDesc} } " prop =" { { .FieldJson} } " width =" 120" >
109109 <template #default =" scope" >
203203 </template >
204204
205205 <el-form :model =" formData" label-position =" top" ref =" elFormRef" :rules =" rule" label-width =" 80px" >
206- { {- range .Fields } }
206+ { {- range .FrontFields } }
207207 <el-form-item label =" { { .FieldDesc} } :" prop =" { { .FieldJson} } " >
208208 { {- if eq .FieldType " bool" } }
209209 <el-switch v-model =" formData.{ { .FieldJson} } " active-color =" #13ce66" inactive-color =" #ff4949" active-text =" 是" inactive-text =" 否" clearable ></el-switch >
270270 { {- end } }
271271 </el-form >
272272 </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 >
319273 </div >
320274</template >
321275
@@ -362,7 +316,7 @@ defineOptions({
362316const { { $element } } Options = ref ([])
363317 { { - end } }
364318const formData = ref ({
365- { { - range .Fields } }
319+ { { - range .FrontFields } }
366320 { { - if eq .FieldType " bool" } }
367321 { { .FieldJson} } : false ,
368322 { { - end } }
@@ -402,7 +356,7 @@ const formData = ref({
402356
403357// 验证规则
404358const rule = reactive ({
405- { { - range .Fields } }
359+ { { - range .FrontFields } }
406360 { { - if eq .Require true } }
407361 { { .FieldJson } } : [{
408362 required: true ,
@@ -435,7 +389,7 @@ const searchRule = reactive({
435389 }
436390 } , trigger: ' change' }
437391 ],
438- { { - range .Fields } }
392+ { { - range .FrontFields } }
439393 { { - if .FieldSearchType} }
440394 { { - if eq .FieldType " time.Time" } }
441395 { { .FieldJson } } : [{ validator: (rule, value, callback) => {
@@ -468,7 +422,7 @@ const searchInfo = ref({})
468422// 排序
469423const sortChange = ({ prop, order } ) => {
470424 const sortMap = {
471- { { - range .Fields } }
425+ { { - range .FrontFields } }
472426 { { - if and .Sort} }
473427 { { - if not (eq .ColumnName " " )} }
474428 { { .FieldJson} } : ' { { .ColumnName} } ' ,
@@ -500,7 +454,7 @@ const onSubmit = () => {
500454 if (! valid) return
501455 page.value = 1
502456 pageSize.value = 10
503- { { - range .Fields } } { { - if eq .FieldType " bool" } }
457+ { { - range .FrontFields } } { { - if eq .FieldType " bool" } }
504458 if (searchInfo.value.{ { .FieldJson} } === " " ){
505459 searchInfo.value.{ { .FieldJson} } =null
506460 } { { end } } { { end } }
@@ -629,53 +583,6 @@ const delete{{.StructName}}Func = async (row) => {
629583// 弹窗控制标记
630584const dialogFormVisible = ref (false )
631585
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-
679586// 打开弹窗
680587const openDialog = () => {
681588 type.value = ' create'
@@ -686,7 +593,7 @@ const openDialog = () => {
686593const closeDialog = () => {
687594 dialogFormVisible.value = false
688595 formData.value = {
689- { { - range .Fields } }
596+ { { - range .FrontFields } }
690597 { { - if eq .FieldType " bool" } }
691598 { { .FieldJson} } : false ,
692599 { { - end } }
0 commit comments