Vue.js+elementui实现单选

<el-tabs v-model="activeName">
        <el-tab-pane label="未审核" name="1">
          <el-table
            border
            style="width: 100%"
            :data="tableData"
            ref="multipleTable"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="75" align="center"></el-table-column>
            <el-table-column
              type="index"
              label="序号"
              width="100"
              align="center"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column label="申请名称" width="100" align="center" show-overflow-tooltip>
              <template slot-scope="scope">
                <a
                  target="_blank"
                  @click="updatasee(scope.row.ID)"
                  style="cursor: pointer;color: #3B9AF9;"
                >{{scope.row.SQMC}}</a>
              </template>
            </el-table-column>
            <el-table-column
              property="SQMS"
              label="申请描述"
              width="100"
              align="center"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column property="ZXDWID" label="执行单位" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column property="ZXZQ" label="执行周期" align="center" show-tooltip-when-overflow></el-table-column>
            <el-table-column property="SJLX" label="数据类型" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                      <span  v-if="scope.row.SJLX == 0" >矢量数据</span>
                      <span  v-if="scope.row.SJLX == 1" >影像数据</span>
                      <span  v-if="scope.row.SJLX == 2" >POI数据</span>
                      <span  v-if="scope.row.SJLX == 3" >大比例尺数据</span>
                  </template>
            </el-table-column>
            <el-table-column property="SJFW" label="数据范围" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column
              property="SJFW"
              label="数据范围级别"
              width="130"
              align="center"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column label="是否含有数据成果" width="160" align="center" show-overflow-tooltip>
              <template slot-scope="scope">
                <span v-if="scope.row.SFHYSJCG == 0">否</span>
                <span v-if="scope.row.SFHYSJCG == 1">是</span>
              </template>
            </el-table-column>
            <el-table-column property="SQSJ" label="申请时间" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column property="BZ" label="备注" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column property="SHZT" label="审核状态" align="center" show-overflow-tooltip>
              <template slot-scope="scope">
                <span v-if="scope.row.SHZT == 1">待审核</span>
                <span v-if="scope.row.SHZT == 2">已审核</span>
              </template>
            </el-table-column>
            <el-table-column
              label="操作"
              width="130"
              align="center"
              fixed="right"
              v-if="activeName == '1'"
            >
              <template slot-scope="scope">
                <a style="cursor:pointer;vertical-align: middle;">
                  <i title="审核" @click="jumpeditsh(scope.row.ID)" class="fa fa-edit fa-lg"></i>
                </a>
                <a style="cursor:pointer;margin-left:5px" @click="downsee(scope.row.ID)">
                  <i class="fa fa-download fa-lg" style="color: red;" title="导出"></i>
                </a>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="已审核" name="2">
          <el-table border style="width: 100%" :data="tableData">
            <el-table-column
              type="index"
              label="序号"
              width="100"
              align="center"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              property="SQMC"
              label="申请名称"
              width="100"
              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <a
                  target="_blank"
                  @click="updatasee(scope.row.ID)"
                  style="cursor: pointer;color: #3B9AF9;"
                >{{scope.row.SQMC}}</a>
              </template>
            </el-table-column>
            <el-table-column
              property="SQMS"
              label="申请描述"
              width="100"
              align="center"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column property="ZXDWID" label="执行单位" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column property="ZXZQ" label="执行周期" align="center" show-tooltip-when-overflow></el-table-column>
            <el-table-column property="SJLX" label="数据类型" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                      <span  v-if="scope.row.SJLX == 0" >矢量数据</span>
                      <span  v-if="scope.row.SJLX == 1" >影像数据</span>
                      <span  v-if="scope.row.SJLX == 2" >POI数据</span>
                      <span  v-if="scope.row.SJLX == 3" >大比例尺数据</span>
                  </template>
            </el-table-column>
            <el-table-column property="SJFW" label="数据范围" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column
              property="SJFW"
              label="数据范围级别"
              width="130"
              align="center"
              show-overflow-tooltip
            ></el-table-column>
            <el-table-column
              property="SFHYSJCG"
              label="是否含有数据成果"
              width="160"
              align="center"
              show-overflow-tooltip
            >
              <template slot-scope="scope">
                <span v-if="scope.row.SFHYSJCG == 0">否</span>
                <span v-if="scope.row.SFHYSJCG == 1">是</span>
              </template>
            </el-table-column>
            <el-table-column property="SQSJ" label="申请时间" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column property="BZ" label="备注" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column property="SHZT" label="审核状态" align="center" show-overflow-tooltip>
              <template slot-scope="scope">
                <span v-if="scope.row.SHZT == 1">待审核</span>
                <span v-if="scope.row.SHZT == 2">已审核</span>
              </template>
            </el-table-column>
            <el-table-column
            label="操作"
            width="130"
            align="center"
            fixed="right"
          >
            <template slot-scope="scope">
              <a style="cursor:pointer;margin-left:5px" @click="downsee(scope.row.ID)">
                <i class="fa fa-download fa-lg" style="color: red;" title="导出"></i>
              </a>
            </template>
          </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>

页面如上,elementUI中有一个方法,我觉得挺好的直接做判断就可以了 

//选择表格中的某一项进行提交或退回
    handleSelectionChange(val) {
      let info = {};
      if (this.activename == "1") {
        this.$refs.multipleTable.clearSelection();
        return false;
      }
      if (val.length > 1) {
        this.$refs.multipleTable.clearSelection();
        this.$message("仅能提交一条数据");
        return false;
      } else if (val.length == 1) {
        info = val;
      } else {
        info = {};
      }

      this.sjdata = info[0];
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

侧耳倾听...

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值