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
| <template>
| <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid">
| <avue-form v-model="form" :option="option">
| <template v-for="item in slotData" :slot="item.prop + 'Label'">
| <span>
| <span>{{ item.label }} </span>
| <el-tooltip
| v-if="item.keyAttr"
| class="item"
| content="该属性为关键属性"
| effect="dark"
| placement="top-start"
| >
| <i class="el-icon-star-on" style="font-size: 17px !important; color: red;vertical-align: baseline;"></i>
| </el-tooltip>
| </span>
| </template>
| <template slot="menuForm">
| <dynamic-button type="form" :butttonList="componentVO.buttons" @buttonClick="buttonClick"></dynamic-button>
| </template>
| </avue-form>
| </div>
| </template>
|
| <script>
| export default {
| name: "dynamic-form",
| props: {
| componentVO: {
| type: Object,
| default: {}
| },
| inDialog: {
| type: Boolean,
| default: false
| },
| areasName: {
| type: String,
| default: ''
| },
| sourceData: {
| //菜单源数据或者弹窗时按钮所属区域的上一区域选中数据
| type: Object,
| default: {}
| },
| paramVOS: {
| type: Object,
| default: {}
| },
| },
| data() {
| return {
| form: {},
| }
| },
| mounted() {
| // console.log('componentVO--',this.componentVO.tableDefineVO.cols[0])
| },
| computed: {
| option() {
| return {
| submitBtn: false,
| emptyBtn: false,
| height: 300,
| column: this.formColumn(this.componentVO.tableDefineVO.cols[0])
| }
| },
| slotData() {
| return this.formColumn(this.componentVO.tableDefineVO.cols[0])
| }
| },
| methods: {
| //转化数据
| formColumn(formList) {
| return formList.map(item => {
| const typeValue = item.type === 'text' ? 'input' : item.type === 'combox' ? 'select' : item.type;
|
| return {
| label: item.text,
| prop: item.field,
| type: typeValue,
| value: item.defaultValue,
| dicData: item.type === 'combox' ? item.dicData : null,
| readonly: item.readOnly,
| disabled: item.disabled,
| labelSuffix: item.suffix,
| suffixIcon: item.prefix,
| placeholder: item.placeholder,
| clearable: item.clearable,
| tip: item.tooltips,
| keyAttr: item.keyAttr,
| rules: [{
| required: item.required,
| message: `请输入${item.text}!`,
| trigger: "blur"
| }]
| }
| })
| },
| buttonClick(item) {
| console.log(item.id)
| },
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|