当前位置: 首页 > article >正文

Vxe UI 表格行编辑(默认不显示编辑框,点击后可编辑)

效果:

HTML代码:(type="integer"为这个,是限制只能输入正整数或负整数,英文和汉字自动转成0)

<vxe-table
        show-overflow
        keep-source
        v-loading="loading"
        :data="ruleList"
        ref="Table"
        :row-config="{isHover: true}"
        height="100%"
        :edit-config="{trigger: 'click', mode: 'cell', showStatus: true}"
      >
        
        <vxe-column type="seq" width="60" />
        <vxe-column
          title="排序"
          field="orderNum"
          :show-overflow-tooltip="true"
          :edit-render="{autofocus: '.myinput'}"
        >
          <template #edit="scope">
            <vxe-input
              type="integer"
              maxlength="30"
              class="myinput"
              v-model="scope.row.orderNum"
              placeholder="请输入"
              @input="updateRowStatus(scope)"
              clearable
            ></vxe-input>
          </template>
        </vxe-column>
</vxe-table>

方法:

表格上方的  更新排序  按钮的禁用状态(动态)判断
      this.updateRecords里装的就是已编辑的行数据数组包对象结构,编辑了几个行,就有几个对象

 // 排序处理
    updateRowStatus(params) {
      //获取表格中所有编辑过的行数据(就是所有带红色标志的)
      const $table = this.$refs.Table;
      if ($table) {
        this.updateRecords = $table.getUpdateRecords();
        if (this.updateRecords.length) {//可以控制表格上方排序按钮的disabled状态
          this.multiple = false;
        } else {
          this.multiple = true;
        }
      }
    },

排序按钮方法

  handleStor() {
        this.$modal
          .confirm("是否确按输入顺序排序")
          .then(res => {
            //如果表格中有变更的行数据  就传入及接口  后端排序
            updateAttributeSort(this.updateRecords).then(res => {
              if (res.code === 200) {
                this.multiple = true;
                this.$modal.msgSuccess("更新排序完成");
                this.getList();
              } else {
                this.$modal.msgError(res.msg);
              }
            });
          })
          .catch(() => {});
    },


http://www.kler.cn/a/377168.html

相关文章:

  • 学生成绩查询系统设计与实现
  • css 禁止用户选中元素
  • 【动态规划之斐波那契数列模型】——累加递推型动态规划
  • ELK配置转存redis缓存,采集nginx访问日志
  • linux中级(防火墙firewalld)
  • 汇编练习-1
  • qt QMenu详解
  • 考研资料分享系统的设计与实现(lw+演示+源码+运行)
  • 【力扣专题栏】面试题 01.02. 判定是否互为字符重排,如何利用数组模拟哈希表解决两字符串互排问题?
  • YOLOv6-4.0部分代码阅读笔记-efficientrep.py
  • 【408操作系统】 使用信号量机制实现同步和互斥
  • C语言用GNU源码编译建构系统工具(GNU BUILD SYSTEM)编译创建源码包
  • TypeError: Cannot read properties of undefined (reading ‘__asyncLoader‘)
  • UE4_Niagara基础实例—13、通过纹理采样来创造粒子
  • Speaker Recognition说话人识别(声纹识别)
  • react18中redux-saga实战系统登录功能及阻塞与非阻塞的性能优化
  • 专利生成穿刺demo
  • Type-C PD诱骗取电快充协议芯片 支持PD 5V、9V、12V、15V、20V电压
  • 反常积分的敛散性判别
  • VBA在低版本Excel中创建unique函数的方法