11<template >
22 <div class =" form-page" >
3- <component
4- v-if =" attrs.top"
5- :is =" attrs.top.componentName"
6- :attrs =" attrs.top"
7- />
3+ <component v-if =" attrs.top" :is =" attrs.top.componentName" :attrs =" attrs.top" />
84 <component
95 :is =" attrs.attrs.isDialog ? 'div' : 'el-card'"
106 shadow =" never"
3733 v-for =" tab in attrs.tabs"
3834 :key =" tab"
3935 >
40- <template v-for =" (item , index ) in attrs .formItems " >
41- <ItemIf
42- v-if =" tab == item.tab"
43- :key =" index"
44- :form_item =" item"
45- :form_items =" attrs.formItems"
46- :form_data =" formData"
47- >
48- <component
49- v-if =" item.topComponent"
50- :is =" item.topComponent.componentName"
51- :attrs =" item.topComponent"
52- />
53-
54- <el-form-item
55- :prop =" item.prop"
56- :label-width =" item.labelWidth"
57- :error =" item.error"
58- :show-message =" item.showMessage"
59- :inline-message =" item.inlineMessage"
60- :size =" item.size"
61- >
62- <span slot =" label" v-if =" !item.hideLabel" >
63- {{ item.label }}
64- </span >
65- <template >
66- <el-col :span =" item.inputWidth" >
67- <template v-if =" item .relationName " >
68- <ItemDiaplsy
69- v-model ="
70- formData[item.relationName][item.relationValueKey]
71- "
72- :form-item =" item"
73- :form-items =" attrs.formItems"
74- :form-data =" formData"
75- />
76- </template >
77- <template v-else >
78- <ItemDiaplsy
79- v-model =" formData[item.prop]"
80- :form-item =" item"
81- :form-items =" attrs.formItems"
82- :form-data =" formData"
83- />
84- </template >
85-
86- <div
87- v-if =" item.help"
88- class =" form-item-help"
89- v-html =" item.help"
90- ></div >
91- </el-col >
92- </template >
93- </el-form-item >
94- <component
95- v-if =" item.footerComponent"
96- :is =" item.footerComponent.componentName"
97- :attrs =" item.footerComponent"
98- />
99- </ItemIf >
100- </template >
36+ <component
37+ v-for =" (row, index) in attrs.formItemLayout"
38+ :key =" index"
39+ :is =" row.componentName"
40+ :attrs =" row"
41+ :formData =" formData"
42+ :formItems =" attrs.formItems"
43+ :tab =" tab"
44+ />
10145 </component >
10246 </component >
103- <component
104- :is =" attrs.actions.fixed ? 'Affix' : 'div'"
105- :offset-bottom =" 20"
106- >
47+ <component :is =" attrs.actions.fixed ? 'Affix' : 'div'" :offset-bottom =" 20" >
10748 <div
10849 class =" form-bottom-actions flex padding-tb"
10950 :class =" { 'form-bottom-actions-fixedxxx': attrs.actions.fixed }"
13778 :autofocus =" attrs.actions.cancelButton.autofocus"
13879 :loading =" loading"
13980 @click =" onCancel"
140- ><template v-if =" attrs .actions .cancelButton .content " >{{
81+ >
82+ <template v-if =" attrs .actions .cancelButton .content " >
83+ {{
14184 attrs.actions.cancelButton.content
142- }}</template >
85+ }}
86+ </template >
14387 </el-button >
14488
14589 <el-button
156100 :autofocus =" attrs.actions.submitButton.autofocus"
157101 :loading =" loading"
158102 @click =" submitForm(attrs.ref || 'form')"
159- ><template v-if =" attrs .actions .submitButton .content " >{{
103+ >
104+ <template v-if =" attrs .actions .submitButton .content " >
105+ {{
160106 attrs.actions.submitButton.content
161- }}</template >
107+ }}
108+ </template >
162109 </el-button >
163110 </div >
164111 </div >
165112 </component >
166113 </el-form >
167114 </component >
168- <component
169- v-if =" attrs.bottom"
170- :is =" attrs.bottom.componentName"
171- :attrs =" attrs.bottom"
172- />
115+ <component v-if =" attrs.bottom" :is =" attrs.bottom.componentName" :attrs =" attrs.bottom" />
173116 </div >
174117</template >
175118<script >
176119import { BaseComponent } from " @/mixins.js" ;
177- import ItemDiaplsy from " ./ItemDiaplsy" ;
178- import ItemIf from " ./ItemIf" ;
120+
179121import { isNull } from " ../../utils" ;
180122import Affix from " ../widgets/common/affix" ;
181123export default {
182124 mixins: [BaseComponent],
183125 components: {
184- ItemDiaplsy,
185- ItemIf,
186126 Affix,
187127 },
188128 props: {
@@ -192,14 +132,6 @@ export default {
192132 isEdit () {
193133 return this .attrs .mode == " edit" ;
194134 },
195- ignoreKey () {
196- return this ._ .map (
197- this .attrs .formItems .filter (
198- (e ) => ! e .ignoreEmpty || ! isNull (this .formData [e .prop ])
199- ),
200- " prop"
201- );
202- },
203135 },
204136 data () {
205137 return {
@@ -250,7 +182,8 @@ export default {
250182 this .$refs [formName].validate ((valid ) => {
251183 if (valid) {
252184 this .loading = true ;
253- const formatData = this ._ .pick (this .formData , this .ignoreKey );
185+ console .log (this .ignoreKey );
186+ const formatData = this ._ .omit (this .formData , this .attrs .ignoreEmptyProps );
254187 if (this .isEdit ) {
255188 this .$http
256189 .put (this .attrs .action , formatData)
0 commit comments