element-ui之el-table改造 动态自定义添加行

业务需求:根据select下拉框的选中的数据动态加载其包含的属性值
在这里插入图片描述
业务实现:
html部分

<el-dialog :title="titleName" :visible.sync="DialogVisible" width="60%" center>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="客户名称:">
          <el-select :disabled="isDis" @change="changeValueOne" v-model="form.tradeCode" placeholder="请选择客户名称">
            <el-option v-for="(item, index) in arrayOne" :key="index" :label="item.flagSettingInfo" :value="item.flagSettingCode"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="标签类型:">
          <el-select :disabled="isDis" @change="changeValueTwo" v-model="form.tempFieild1" placeholder="请选择标签类型">
            <el-option v-for="(item, index) in arrayTwo" :key="index" :label="item.flagSettingInfo" :value="item.flagSettingCode"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-table :data="dataNew" :show-header="fal" key="Table" style="width:100%;">
        <el-table-column>
          <template slot-scope="scope">
            <el-input style="display: inline-block;width:100px" v-model.trim="scope.row.custrelLablePropertyName" clearable> </el-input>
            <span>:</span>
            <el-input style="display: inline-block;width:150px;margin-left:10px" v-model.trim="scope.row.custrelLablePropertyValue" clearable> </el-input>
          </template>
        </el-table-column>

        <!-- <el-table-column>
          <template slot-scope="scope">
            <el-button v-if="scope.$index != 0" size="mini" type="text" @click="DeleteNew(scope.$index, scope.row)">删除</el-button>
          </template>
        </el-table-column> -->
      </el-table>
      <span @click="adddataNew" style="cursor:pointer;color:#409eff;">+添加标签类型</span>

      <span slot="footer" class="dialog-footer">
        <el-button @click="DialogVisible = false">取 消</el-button>
        <el-button type="primary" v-if="DialogType == 'add'" @click="onAddSubmit(form)">确 定</el-button>
        <el-button type="primary" v-else @click="onEditSubmit(form)">确 定</el-button>
      </span>
    </el-dialog>

data部分

      dataNew: [{ custrelLablePropertyName: '', custrelLablePropertyValue: '' }],

js部分

//添加
 adddataNew() {
      this.dataNew.push({custrelLablePropertyName:'', custrelLablePropertyValue: '' })
    },
    //选中
 changeValueTwo() {
        API.queryCustrelLablePage({ custrelLableTypeTmp: this.form.tempFieild1, custrelLabletType: 1 }).then(res => {
        this.dataNew = res.list
      })
    },
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值