点击筛选框动态增加 多条可输入Table列 以及通过操作数组改造数据

点击筛选框动态增加 多条可输入Table列 以及通过操作数组改造数据

复制代码
<el-col :span="8" class="tab_group">
              <el-form-item label="动态筛选">
                <el-select v-model.trim="ruleForm.flowType" placeholder="请选择" style="width: 100%" :disabled="disabled" @change="flowTypeChange">
                  <el-option
                    v-for="item in List"
                    :key="item.key"
                    :label="item.value"
                    :value="item.key">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
<el-col :span="24" style="margin-bottom:20px">
              <el-form ref="myForm" :model="csmFetr">
              <el-table
                  :data="csmFetr"
                  ref="table"
                  header-row-class-name="customcss"
                  size="small"
                  row-key="id">
                  <el-table-column
                    prop="flowTypeName"
                    header-align="center"
                    align="center"
                    label="交易类型">
                  </el-table-column>
                  <el-table-column
                    header-align="center"
                    align="left"
                    label="交易详情"
                    minWidth="180">
                    <template slot-scope="scope">
                        <div class="tableInnerBox">     
                          <div class="inlineTable" v-for="(item,index) in csmFetr[scope.$index].amtFlows">
                            <span class="inlineSpan">{{item.name}}</span> 
                            <el-input class="inlineInput" v-model="item.value" :disabled="disabled"></el-input>
                          </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    header-align="center"
                    align="center"
                    label="操作"
                    width="90">
                    <template slot-scope="scope">
                      <el-form-item> 
                              <el-button style="vertical-align: text-top;" size="small" @click="delTradeList(scope.$index)">删除</el-button>
                        </el-form-item>
                    </template>
                  </el-table-column>
                </el-table>
              </el-form>
            </el-col>

data
flowTypeOptions : [{
        flowType: "card",
        flowTypeName: "卡",
        eventAccount: "",
        details: [{
            key: "am",
            name: "分",
            value: "",
            required: true,
            icon: "fa-jpy"
        }, {
            key: "CardNo",
            name: "卡号",
            isSm4: true,
            value: "",
            required: true,
            icon: "fa-credit-card"
        }]
    }]

flowTypeChange(v){ //筛选框改变数据改造
        this.flowTypeOptions.forEach((item,index) => {
          if(item.flowType == v){
            this.csmFetr.push({
              flowTypeName:item.flowTypeName,
              'amtFlows':[]
            })
            item.details.forEach(element => {
              this.csmFetr[this.csmFetr.length-1].amtFlows.push({
                flowType:item.flowType,
                name:element.name,
                key:element.key,
                value:'',
            })
            });

          }
        });
      },
      打印改造你需要的数据格式和后端调试
      _this.ruleForm.amtFlows = []
        _this.csmFetr.forEach(item => { //提交资金流向改造
          var arr = {}
          item.amtFlows.forEach(el => {
            arr[el.key]=el.value

          });
            arr['eventAccount'] = '';
            arr['flowType'] = item.amtFlows[0].flowType;
            _this.ruleForm.amtFlows.push(arr);
        });
        提交ruleForm
相关推荐
方也_arkling3 分钟前
【Java-Day08】static / final / 枚举
java·开发语言
风吹夏回15 分钟前
Python 全局异常处理:从“满屏 try-except”到优雅兜底
开发语言·python
Chengbei1124 分钟前
一站式源码安全检测工具、云安全 / APP / 小程序源码敏感信息递归多层目录扫描AK、JWT、手机号、身份证等敏感信息
java·开发语言·安全·web安全·网络安全·系统安全·安全架构
llz_11229 分钟前
web-第一次课后作业
java·开发语言·idea
小熊Coding40 分钟前
Python爬取当当网二手图书项目实战!
开发语言·爬虫·python·beautifulsoup·requests·二手图书
秋944 分钟前
Java项目运行5天左右自动宕机:系统性定位与解决方案
java·开发语言·python
xiaoshuaishuai81 小时前
C# 内存管理与资源泄漏
开发语言·c#
lsx2024062 小时前
SVN 检出操作
开发语言
basketball6162 小时前
C++ NULL 和 nullptr 区别 以及 nullptr 的核心实现
java·开发语言·c++
zhangyao9403303 小时前
开发pc端时,表格的高度怎么设置才能铺满页面
前端·javascript·elementui