elementui表格合并列和合并行

    <el-table
        :data="tableData"
        ref="JZPFData"
        v-loading="loading"
        border
        :span-method="objectJBXXMethod"
        height="calc(90vh - 140px)"
        :header-cell-style="{ background: '#deebff', color: '#606266' }"
        highlight-current-row
      >
        <el-table-column
          prop="name"
          label="考核因素"
          width="80px"
          align="center"
        >
          <template slot-scope="scope">
            {{ scope.row.name }}
          </template>
        </el-table-column>
        <el-table-column prop="templateStr" align="center" label="考核指标">
          <template slot-scope="scope">
            <div style="text-align: left" v-if="!scope.row.form_id">
              {{ scope.row.templateStr }}
            </div>
            <div
              style="display: flex"
              v-else-if="scope.row.type == 'otherScore'"
            >
              <span>{{ scope.row.templateStr }}</span>

              <el-form-item :prop="scope.row.form_id" label-width="0px">
                <el-input
                  :disabled="
                    formType=='status' || formType == 'see'
                  "
                  v-model="form[scope.row.form_id]"
                  size="mini"
                  style="width: 70px"
                ></el-input>
              </el-form-item>
            </div>
            <div
              style="text-align: center"
              v-else-if="scope.row.form_id == 'totalScore'"
            >
              {{ totalScore }}
            </div>
            <el-form-item v-else :prop="scope.row.form_id" label-width="0px">
              <div style="margin-boottom: 10px; float: left"  v-if="
                    (formType == 'status'||formType =='edit'||(formStatus ==1)) &&
                    scope.row.form_id == 'managerCheck'
                  ">
                <span>审核状态:</span>
                <el-radio-group
                  v-model="status"
                 :disabled="formType!='status'"
                 
                >
                  <el-radio :label="1">同意</el-radio>
                  <el-radio :label="2">拒绝</el-radio>
                </el-radio-group>
              </div>
              <el-input
                :disabled="formType == 'see' ? true: formType == 'edit' &&scope.row.form_id == 'managerCheck' ? true: formType == 'status' 
                     && scope.row.form_id != 'managerCheck'
                    ? true
                    : false
                "
                v-model="form[scope.row.form_id]"
                size="mini"
                type="textarea"
              ></el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column
          label="权重分"
          align="center"
          prop="templateScore"
          width="65px"
        ></el-table-column>

        <el-table-column prop="value" label="得分" width="80px">
          <template slot-scope="scope">
            <span v-if="scope.row.type == 'otherScore'">{{ otherScore }} </span>
            <el-select
              v-else
              v-model="scope.row.typeDetailScore"
              :disabled="
                formType=='status' || formType == 'see'
              "
              placeholder=""
              size="mini"
            >
              <el-option
                v-for="(item, i) in scope.row.detailScoreSelect"
                :key="i"
                :label="i"
                :value="i * 1"
              />
            </el-select>
          </template>
        </el-table-column>
      </el-table>

 方法

  getDetail(id) {
      this.loading = true;
     let  totalList= [
        {
          span_num: 1,
          name: "考核得分",
          templateScore: 100,
          templateStr: "其它加分或减分 :",
          type: "otherScore",
          form_id: "score",
        },
        {
          span_num: 1,
          type: "totalInput",
          name: "最终得分",
          form_id: "totalScore", //不输入
        },
        {
          span_num: 1,
          type: "totalInput",
          name: "部门主管考评意见",
          form_id: "chargerCheck",
        },
        {
          span_num: 1,
          type: "totalInput",
          name: "部门经理考评意见",
          form_id: "managerCheck",
        },
        {
          span_num: 1,
          type: "totalInput",
          name: "备注",
          form_id: "remark",
        },
      ]
        let tableData = [
{
detailScoreSelect: 4
name: "安全生产 6分"
span_num: 3
templateScore: 3
templateStr: "1.确保自身人身安全,工作时做好必要防护,进入工地组戴安全帽、穿工作服,不能穿拖鞋,进药剂间戴防护罩和橡胶手套;"
type: 1
typeDetail: 1
typeDetailScore: 2
}...
];
       tableData = tableData.concat(totalList);
        this.tableData = tableData;
        this.loading = false;
      });
    },
    objectJBXXMethod({ row, column, rowIndex, columnIndex }) {
      //columnIndex:列
      // 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex四个属性。
      if (columnIndex === 0) {
        return {
          rowspan: row.span_num, //合并行【3,0,0,5...
          colspan: 1,
        };
      }
      if (columnIndex === 1) {
        if (row.type == "totalInput") {
          return [1, 3];
        }
      }
    },

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

瘦瘦瘦大人

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

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

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

打赏作者

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

抵扣说明:

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

余额充值