- 注册时间
- 2017-4-21
- 最后登录
- 2021-12-29
- 阅读权限
- 10
- 积分
- 564
- 精华
- 0
- 帖子
- 75
|
页面加载进来的时候就触发了vue的updated方法,这时候操作列的渲染是正确的,这时候没有修改的数据,所以write为true,我保存完成后,点击提交按钮使用vue重新获取回来数据,再次执行updated方法,更新了表格内的数据,已经进入了index的判断,而且断点查看write也为false,可是执行到drawcell方法里的时候 去判断操作列的时候write还是true
updated:function () { mini.parse(); if(this.grid!=''){ if(this.isForm){ if(this.formid!=''){ readOnly(this.formid); } }else { var grid = mini.get(this.grid); var index = $('#'+this.grid).parents('.maintainContent').attr('attr'); var write = true; if(index){ if(this.datas[index].TexamineData&&this.datas[index].TexamineData.length>0){ write = false; grid.setData(this.datas[index].TexamineData); }else{ grid.setData(mini.decode(this.datas[index].data)); } } var that = this; grid.on("drawcell", function (e) { var record = e.record, column = e.column, field = e.field, value = e.value; //翻译 if(column.name!=undefined&&column.name != "action"){ var items = formVue.datas[index].codeSet[column.name]; for (var item in items){ if(items[item].id == e.cellHtml){ e.cellHtml = items[item].text; } } } //action列,超连接操作按钮 if (column.name == "action") { e.cellStyle = "text-align:center"; if(write){ e.cellHtml = '<a class="button_form_see inline_block" alt="查看" title="查看" class="editClass" style="cursor: pointer;"o" style="color: rgb(102, 102, 102);">+record._uid+')" id="'+that.grid+'" data='+JSON.stringify(record)+'></a> ' +'<a class="button_form_operation inline_block" alt="修改" title="修改" class="editClass" style="cursor: pointer;"o" style="color: rgb(102, 102, 102);">+record._uid+')" id="'+that.grid+'" data='+JSON.stringify(record)+'></a> ' + '<a class="button_form_delete inline_block" o" style="color: rgb(102, 102, 102);">+record._uid+')" id="'+record.SUBID+'" attr="'+that.grid+'" width="16" style="cursor: pointer;" alt="删除" title="删除"></a>' }else{ e.cellHtml = '<a class="button_form_see inline_block" alt="查看" title="查看" class="editClass" style="cursor: pointer;"o" style="color: rgb(102, 102, 102);">+record._uid+')" id="'+that.grid+'" data='+JSON.stringify(record)+'></a> ' } } }); } } },
|
|