Skip to content

Commit

Permalink
[feature]{CrudTable}: 去掉formValueToArray.formValueToString
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Jun 4, 2019
1 parent 05859d3 commit d0a9b81
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
17 changes: 0 additions & 17 deletions src/components/CrudTable/CrudTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,6 @@ export default {
Refresh() {
this.fetchData(this.listQuery);
},
formValueToArray(genList) {
// 如果select,radio,checkbox等组件为多选情况 后台返回逗号分隔字符串 => 数组
for (let i = 0; i < genList.length; i += 1) {
if (genList[i].type === 'grid') {
genList[i].columns.forEach((item) => {
this.formValueToArray(item.list);
});
} else {
const row = genList[i];
if ((row.options.multiple || row.type === 'cascader') && this.formValues[row.model]) {
this.formValues[row.model] = this.formValues[row.model].split(',');
}
}
}
},
async fetchData(params) {
const response = this.customForFetchData === null
? await this.crud('list', this.tableName, params)
Expand Down Expand Up @@ -233,14 +218,12 @@ export default {
this.dialogStatus = 'update';
const response = await this.crud('detail', this.tableName, { id });
this.formValues = response.data;
this.formValueToArray(this.jsonData.list);
this.dialogFormVisible = true;
},
async Detail(id) {
this.dialogStatus = 'detail';
const response = await this.crud('detail', this.tableName, { id });
this.formValues = response.data;
this.formValueToArray(this.jsonData.list);
this.dialogFormVisible = true;
},
},
Expand Down
6 changes: 0 additions & 6 deletions src/components/CrudTable/components/GenerateFormDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ export default {
} else {
data = { ...this.formValues, ...data };
}
// 如果select,radio,checkbox等多选情况返回数组的话,默认拼接成逗号分隔的字符串传给后台
Object.keys(data).forEach((k) => {
if (Array.isArray(data[k])) {
data[k] = data[k].toString();
}
});
this.crud(
this.dialogStatus === 'create' ? 'add' : 'update',
this.tableName,
Expand Down

0 comments on commit d0a9b81

Please sign in to comment.