<div>
    <a-table
      rowKey="id"
      key="list"
      style="width: 100vw"
      :columns="columns"
      :data-source="tableData"
      :customRow="customRow" //选中绑定重点
      :pagination="false"
      :scroll="{ y: '72vh', x: 250 }"
    />
    <div class="returnbut">
      <van-button @click="$router.go(-1)">返回</van-button>
    </div>
  </div>

方法

data() {
    return {
     // 重点
     customRow: (record, index) => {
        return {
          on: {
            click: () => {
             console.log(record,index);// ok
              tableSelectRow(record.qisOpnChecklistHeadId,record.qisOpnChecklistDistributionId).then(res=>{
              
                if(res){
 
                this.$router.push({
                  name: "Implementation",
                  query: {...record},
                });
                }else{
                  
                  this.$router.push({
                  name: "InspectionFrequency",
                  query: {...record},
                });
                }
              })
            
              
            },
          },
        };
      },

      columns: [
        {
          dataIndex: "checklistName",
          key: "checklistName",
          id: "1",
          title: this.$t("table.ChecklistName"),
          width: 150,
          fixed: "left",
          scopedSlots: { customRender: "name" },
        },
        {
          title: this.$t("table.ManufacturingProcess"),
          dataIndex: "productionProcess",
          key: "productionProcess",
          fixed: "left",
          width: 100,
          id: "2",
        },
        {
          title: this.$t("table.base"),
          dataIndex: "site",
          key: "site",
          width: 150,
          id: "3",
        },
        {
          title: this.$t("table.FactoryArea"),
          key: "plant",
          dataIndex: "plant",
          width: 150,
          scopedSlots: { customRender: "tags" },
          id: "4",
        },
        {
          title: this.$t("table.StayWire"),
          key: "line",
          dataIndex: "line",
          width: 250,
          scopedSlots: { customRender: "line" },
          id: "5",
        },
        {
          title: this.$t("table.varieties"),
          key: "productBo",
          dataIndex: "productBo",
          width: 150,
          scopedSlots: { customRender: "productBo" },
          id: "6",
        },
        {
          title: this.$t("table.entryName"),
          key: "projectName",
          dataIndex: "projectName",
          width: 150,
          scopedSlots: { customRender: "projectName" },
          id: "7",
        },
      ],
      tableData: [],
    };
  },
Logo

前往低代码交流专区

更多推荐