点击复制时能正确回显当前行的属性

Vue 未结 2 961
hdwy
hdwy 剑圣 2021-03-17 10:02

一、该问题的重现步骤是什么?

1. 前端调用自定义按钮复制时,调用新增按钮 并将当前选中行的内容回写到新增弹出框内

2. 此时不保存点击取消,接下来不管是点击新增还是复制,新增弹出框内的值都不会发生改变


二、你期待的结果是什么?实际看到的又是什么?


正确的应该是 选中行点击复制时,能正确回显当前行的值

现在错误的 选中行点击复制时,回显的是第一次回显的值  后面无论选择哪行都不会发生改变 只有刷新页面才可以

三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。

 <el-button type="primary"
           size="small"
           icon="el-icon-printer"
           @click="copyTeam">复制
</el-button>
 
 
      //复制条码
      copyTeam() {
        if (this.selectionList.length == 0) {
          this.$message({
            type: 'error',
            showClose: true,
            message: "未勾选任何信息"
          });
          return;
        }
        if (this.selectionList.length > 1) {
          this.$message({
            type: 'error',
            showClose: true,
            message: "只能选择一条信息进行复制"
          });
          return;
        }
        //迭代选择内容
        this.selectionList.forEach(ele => {
           console.log(ele.teamNo);
              //调用系统的新增窗体
//          this.$refs.crud.option.
              //给弹出窗体赋默认值
              this.$refs.crud.option.column.filter(item => {

                if (item.prop === "teamNo") {
                 item.value = ele.teamNo;
                  item.addDisabled = true;

                }
                console.log(ele.teamName);
                if (item.prop === "teamName") {
                 item.value = ele.teamName;
                }
                if (item.prop === "processId") {
                 item.value = ele.processId;
                }
              });
              this.$refs.crud.rowAdd();

             // return;
         // this.selectionList = [];
        });

       // this.$refs.crud.toggleSelection();
      },


2条回答
  • 2021-03-17 14:55

    你点击复制后,给表单赋予了值,那新增和修改窗口关闭的时候,也需要对他进行清空才行

    作者追问:2021-03-17 21:02

    如何情况 我直接赋值当前行的值无法显示,显示的还是第一次回显的值

    0 讨论(0)
  • 2021-03-22 15:08
    //也输入框清空了
    item.value ="";
    
    //之后打开后还是显示第一次回显的值,必须刷新才能解决


    0 讨论(0)
提交回复