点击筛选框动态增加 多条可输入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
相关推荐
小桥风满袖8 分钟前
极简三分钟ES6 - ES8中字符串扩展
前端·javascript
少年阿闯~~12 分钟前
CSS3的新特性
前端·javascript·css3
我是菜鸟0713号16 分钟前
Qt 中 OPC UA 通讯实战
开发语言·qt
JCBP_18 分钟前
QT(4)
开发语言·汇编·c++·qt·算法
Brookty23 分钟前
【JavaEE】线程安全-内存可见性、指令全排序
java·开发语言·后端·java-ee·线程安全·内存可见性·指令重排序
百锦再36 分钟前
[特殊字符] Python在CentOS系统执行深度指南
开发语言·python·plotly·django·centos·virtualenv·pygame
Anson Jiang36 分钟前
浏览器标签页管理:使用chrome.tabs API实现新建、切换、抓取内容——Chrome插件开发从入门到精通系列教程06
开发语言·前端·javascript·chrome·ecmascript·chrome devtools·chrome插件
掘金安东尼39 分钟前
黑客劫持:周下载量超20+亿的NPM包被攻击
前端·javascript·面试
会开花的二叉树1 小时前
继承与组合:C++面向对象的核心
java·开发语言·c++
剑亦未配妥2 小时前
移动端触摸事件与鼠标事件的触发机制详解
前端·javascript