ny
22 小时以前 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { computed } from 'vue';
 
import { buildUUID } from '@jnpf/utils';
 
import Item from './Item.vue';
 
const props = defineProps({
  formConf: { type: Object, required: true },
  relationData: { type: Object, default: () => {} },
  formData: { type: Object },
  loading: { type: Boolean, default: false },
});
const emit = defineEmits(['toDetail']);
 
const getFormName = computed(() => `form-${buildUUID()}`);
const getLabelCol = computed(() => ({ style: { width: `${props.formConf.labelWidth}px` } }));
const getBindValue = computed(() => ({ ...props }));
 
function toDetail(data) {
  emit('toDetail', data);
}
</script>
 
<template>
  <a-row :class="formConf.formStyle ? `${formConf.formStyle} word-form-detail` : ''">
    <a-form
      class="w-full"
      :name="getFormName"
      :colon="formConf.colon"
      :size="formConf.size"
      :disabled="formConf.disabled"
      :label-col="getLabelCol"
      :layout="formConf.labelPosition === 'top' ? 'vertical' : 'horizontal'"
      :label-align="formConf.labelPosition === 'right' ? 'right' : 'left'">
      <a-row :gutter="formConf.formStyle ? 0 : formConf.gutter">
        <Item v-for="(item, index) in formConf.fields" :key="index" :item="item" v-bind="getBindValue" @to-detail="toDetail" />
      </a-row>
    </a-form>
  </a-row>
</template>