Skip to content

Commit 1b7e54e

Browse files
committed
增加表单[FormFields]拼写错误兼容
1 parent f1f58bd commit 1b7e54e

File tree

12 files changed

+500
-418
lines changed

12 files changed

+500
-418
lines changed

Vol.Vue/src/components/basic/QuickSearch.vue

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
clearable
55
v-if="singleSearch.type=='drop'||singleSearch.type=='dropList'||
66
singleSearch.type=='select'||singleSearch.type=='selectList'"
7-
v-model="searchFormFileds[singleSearch.field]"
7+
v-model="searchFormFields[singleSearch.field]"
88
:placeholder="'请选择'+singleSearch.title"
99
>
1010
<Option
@@ -20,13 +20,13 @@
2020
:type="singleSearch.type+'range'"
2121
:format="singleSearch.type=='date'? 'yyyy-MM-dd':'yyyy-MM-dd HH:mm:ss'"
2222
:placeholder="singleSearch.title"
23-
v-model="searchFormFileds[singleSearch.field]"
23+
v-model="searchFormFields[singleSearch.field]"
2424
></DatePicker>
2525

2626
<Input
2727
clearable
2828
v-else
29-
v-model="searchFormFileds[singleSearch.field]"
29+
v-model="searchFormFields[singleSearch.field]"
3030
:placeholder="singleSearch.title"
3131
@on-keypress="tiggerPress"
3232
/>
@@ -37,16 +37,18 @@ export default {
3737
props: {
3838
singleSearch: {
3939
type: Object,
40-
default: {}
40+
default: {},
4141
},
42-
searchFormFileds: {
42+
searchFormFields: {
4343
type: Object,
44-
default: {}
44+
default: () => {
45+
return {};
46+
},
4547
},
4648
tiggerPress: {
4749
type: Function,
48-
default: () => {}
49-
}
50-
}
50+
default: () => {},
51+
},
52+
},
5153
};
5254
</script>

Vol.Vue/src/components/basic/ViewGrid.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
<!--查询条件-->
3636
<div class="grid-search">
3737
<div :class="[fiexdSearchForm?'fiexd-search-box':'search-box']" v-show="searchBoxShow">
38+
<!-- 2020.09.13增加formFileds拼写错误兼容处理 -->
3839
<vol-form
3940
ref="searchForm"
4041
:label-width="labelWidth"
4142
:formRules="searchFormOptions"
42-
:formFileds="searchFormFileds"
43+
:formFields="_searchFormFields"
4344
>
4445
<div v-if="!fiexdSearchForm" class="form-closex" slot="footer">
4546
<Button size="small" type="info" ghost @click="search">
@@ -71,7 +72,7 @@
7172
<QuickSearch
7273
v-if="singleSearch"
7374
:singleSearch="singleSearch"
74-
:searchFormFileds="searchFormFileds"
75+
:searchFormFields="_searchFormFields"
7576
:tiggerPress="quickSearchKeyPress"
7677
></QuickSearch>
7778
</div>
@@ -131,7 +132,7 @@
131132
ref="form"
132133
:label-width="boxOptions.labelWidth"
133134
:formRules="editFormOptions"
134-
:formFileds="editFormFileds"
135+
:formFields="_editFormFields"
135136
></vol-form>
136137
</div>
137138
<!--明细body自定义组件-->
@@ -289,6 +290,8 @@ var vueParam = {
289290
props: {},
290291
data() {
291292
return {
293+
_searchFormFields: {}, //2020.09.13增加formFileds拼写错误兼容处理
294+
_editFormFields: {}, //2020.09.13增加formFileds拼写错误兼容处理
292295
fiexdSearchForm: false, //2020.09.011是否固定查询表单,true查询表单将固定显示在表单的最上面
293296
_inited: false,
294297
single: false, //表是否单选
@@ -421,6 +424,14 @@ var vueParam = {
421424
// this.$refs.searchForm.forEach()
422425
},
423426
created: function () {
427+
//2020.09.13增加formFileds拼写错误兼容处理
428+
this._searchFormFields = Object.keys(this.searchFormFields).length
429+
? this.searchFormFields
430+
: this.searchFormFileds;
431+
//2020.09.13增加formFileds拼写错误兼容处理
432+
this._editFormFields = Object.keys(this.editFormFields).length
433+
? this.editFormFields
434+
: this.editFormFileds;
424435
//在其他方法中如果拿不到this,请使用$viewGridVue或$this
425436
$viewGridVue = this;
426437
$this = this;

Vol.Vue/src/components/basic/ViewGridConfig/methods.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let methods = {
1919
quickSearchKeyPress($event) {
2020
//查询字段为input时,按回车查询
2121
if ($event.keyCode == 13) {
22-
if (this.searchFormFileds[this.singleSearch.field] != "") {
22+
if (this._searchFormFields[this.singleSearch.field] != "") {
2323
this.search();
2424
}
2525
}
@@ -232,8 +232,8 @@ let methods = {
232232
}
233233

234234
let query = { wheres: [] };
235-
for (const key in this.searchFormFileds) {
236-
let value = this.searchFormFileds[key];
235+
for (const key in this._searchFormFields) {
236+
let value = this._searchFormFields[key];
237237
if (this.emptyValue(value)) continue;
238238
if (typeof value == "number") {
239239
value = value + "";
@@ -326,7 +326,7 @@ let methods = {
326326
let objKey = {};
327327
//编辑状态下,不需要重置主键,创建时间创建人
328328
if (isEdit) {
329-
objKey[this.table.key] = this.editFormFileds[this.table.key];
329+
objKey[this.table.key] = this._editFormFields[this.table.key];
330330
}
331331
this.resetEditForm(objKey);
332332
//重置之后
@@ -389,10 +389,10 @@ let methods = {
389389
if (!sourceObj) return;
390390
let form, keyLeft;
391391
if (formName == "searchForm") {
392-
form = this.searchFormFileds;
392+
form = this._searchFormFields;
393393
keyLeft = "s" + "_b_";
394394
} else {
395-
form = this.editFormFileds;
395+
form = this._editFormFields;
396396
keyLeft = "e" + "_b_";
397397
}
398398
//获取数据源的data类型,否则如果数据源data的key是数字,重置的值是字符串就无法绑定值
@@ -464,36 +464,36 @@ let methods = {
464464
});
465465
},
466466
saveExecute() {
467-
let editFormFileds = {};
467+
let _editFormFields = {};
468468
//上传文件以逗号隔开
469-
for (const key in this.editFormFileds) {
469+
for (const key in this._editFormFields) {
470470
if (
471471
this.uploadfiled &&
472472
this.uploadfiled.length > 0 &&
473473
this.uploadfiled.indexOf(key) != -1 &&
474-
this.editFormFileds[key] instanceof Array
474+
this._editFormFields[key] instanceof Array
475475
) {
476-
let allPath = this.editFormFileds[key].map(x => {
476+
let allPath = this._editFormFields[key].map(x => {
477477
return x.path;
478478
});
479-
editFormFileds[key] = allPath.join(",");
479+
_editFormFields[key] = allPath.join(",");
480480
} else {
481-
editFormFileds[key] = this.editFormFileds[key];
481+
_editFormFields[key] = this._editFormFields[key];
482482
}
483483
}
484484

485485
// else {
486-
// editFormFileds = this.editFormFileds;
486+
// _editFormFields = this._editFormFields;
487487
// }
488488
//将数组转换成string
489-
for (const key in editFormFileds) {
490-
if (editFormFileds[key] instanceof Array) {
491-
editFormFileds[key] = editFormFileds[key].join(",");
489+
for (const key in _editFormFields) {
490+
if (_editFormFields[key] instanceof Array) {
491+
_editFormFields[key] = _editFormFields[key].join(",");
492492
}
493493
}
494494

495495
let formData = {
496-
mainData: editFormFileds,
496+
mainData: _editFormFields,
497497
detailData: null,
498498
delKeys: null
499499
};
@@ -536,7 +536,7 @@ let methods = {
536536

537537
if (this.currentAction == this.const.ADD) {
538538
// this.currentRow=x.data;
539-
this.editFormFileds[this.table.key] = "";
539+
this._editFormFields[this.table.key] = "";
540540
this.currentAction = this.const.EDIT;
541541
this.currentRow = resultRow.data;
542542
}
@@ -606,9 +606,9 @@ let methods = {
606606
});
607607
});
608608
});
609-
this.editFormFileds;
609+
this._editFormFields;
610610
//重置编辑表单数据
611-
this.editFormFileds[this.table.key] = row[this.table.key];
611+
this._editFormFields[this.table.key] = row[this.table.key];
612612

613613
this.resetEditForm(row);
614614
this.currentAction = this.const.EDIT;
@@ -989,12 +989,12 @@ let methods = {
989989
let keys = [];
990990
this.dicKeys.splice(0);
991991
//初始化编辑数据源,默认为一个空数组,如果要求必填设置type=number/decimal的最小值
992-
this.initFormOptions(this.editFormOptions, keys, this.editFormFileds, true);
992+
this.initFormOptions(this.editFormOptions, keys, this._editFormFields, true);
993993
//初始化查询数据源,默认为一个空数组
994994
this.initFormOptions(
995995
this.searchFormOptions,
996996
keys,
997-
this.searchFormFileds,
997+
this._searchFormFields,
998998
false
999999
);
10001000
//查询日期设置为可选开始与结果日期

Vol.Vue/src/components/basic/ViewGridConfig/props.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ let props = {
2020
return {};
2121
}
2222
},
23+
//2020.09.13增加formFileds拼写错误兼容处理
24+
editFormFields: {//新建、编辑字段(key/value)
25+
type: Object,
26+
default: () => {
27+
return {};
28+
}
29+
},
2330
editFormOptions: {//新建、编辑配置信息
2431
type: Array,
2532
default: () => {
@@ -31,6 +38,13 @@ let props = {
3138
default: () => {
3239
return {};
3340
}
41+
},
42+
//2020.09.13增加formFileds拼写错误兼容处理
43+
searchFormFields: {//查询字段(key/value)
44+
type: Object,
45+
default: () => {
46+
return {};
47+
}
3448
},
3549
searchFormOptions: {//查询配置信息(key/value)
3650
type: Array,

0 commit comments

Comments
 (0)