refine code

This commit is contained in:
Pan 2017-05-21 14:32:50 +08:00
parent c628f45e79
commit 06e50a8877
1 changed files with 4 additions and 3 deletions

View File

@ -152,7 +152,7 @@
<script> <script>
import { fetchList, fetchPv } from 'api/article_table'; import { fetchList, fetchPv } from 'api/article_table';
import { parseTime, objectMerge } from 'utils'; import { parseTime } from 'utils';
const calendarTypeOptions = [ const calendarTypeOptions = [
{ key: 'FD', display_name: '经济数据' }, { key: 'FD', display_name: '经济数据' },
@ -265,7 +265,7 @@
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
handleUpdate(row) { handleUpdate(row) {
objectMerge(this.temp, row) this.temp = Object.assign({}, row);
this.dialogStatus = 'update'; this.dialogStatus = 'update';
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
@ -296,7 +296,8 @@
this.temp.timestamp = +this.temp.timestamp; this.temp.timestamp = +this.temp.timestamp;
for (const v of this.list) { for (const v of this.list) {
if (v.id === this.temp.id) { if (v.id === this.temp.id) {
objectMerge(v, this.temp); const index = this.list.indexOf(v);
this.list.splice(index, 1, this.temp);
break; break;
} }
} }