表格内单元格可点击,查看详情

表格内单元格可点击,查看详情
<el-table
          :data="tableData"
          border
          style="width: 100%"
          stripe
          :header-cell-style="{ background: '#F5F6FA', color: '#000' }"
          :height="queryParams.limit == 10 ? 508 : 573"
          >
    <el-table-column
                     label="序号"
                     width="60"
                     align="center"
                     type="index"
                     :index="indexMethod"
                     ></el-table-column>
    <el-table-column
                     show-overflow-tooltip
                     align="center"
                     v-for="(item, index) in tableColumn"
                     :prop="item.prop"
                     :label="item.label"
                     :key="index"
                     :width="item.width"
                     >
        <template slot-scope="scope">
            <div v-if="item.label == '监测点编号'">
                <span class="clickName" @click="handleDetails(scope.row)">
                    {{ scope.row.monitorCode }}
                </span>
            </div>
            <div v-else>
                {{ scope.row[item.prop] }}
            </div>
        </template>
    </el-table-column>
</el-table>
 
data(){
    return{
        tableData: [],
        tableColumn: [
            {
                label: "省公司",
                prop: "province",
                width: "auto",
            },
            {
                label: "地市公司",
                prop: "city",
                width: "auto",
            },
            {
                label: "运维单位",
                prop: "county",
                width: "auto",
            },
            {
                label: "监测点类别",
                prop: "monitorAlias",
                width: "auto",
            },
            {
                label: "所属电站",
                prop: "stationName",
                width: "auto",
            },
            {
                label: "所属线路",
                prop: "lineName",
                width: "auto",
            },
            {
                label: "所属台区",
                prop: "platformName",
                width: "auto",
            },
            {
                label: "监测对象编号",
                prop: "mid",
                width: "auto",
            },
            {
                label: "监测对象名称",
                prop: "mname",
                width: "auto",
            },
            {
                label: "监测点编号",
                prop: "monitorCode",
                width: "auto",
                //canClick: "true",
            },
            {
                label: "监测点名称",
                prop: "monitorName",
                width: "auto",
            },
            {
                label: "监测点电压等级",
                prop: "voltageLevel",
                width: "auto",
            },
            {
                label: "监测点状态",
                prop: "monitorStatus",
                width: "auto",
            },
            {
                label: "建档日期",
                prop: "createdDate",
                width: "auto",
            },
        ],
        queryParams: {
            page: 1,
            limit: 10,
            name: undefined, //监测点编号/姓名
            province: undefined, //省公司
            city: undefined, //地市公司
            organizationId: undefined, //运维单位
            monitorType: undefined, //监测点类别
            powerStationId: undefined, //所属电站
            lineId: undefined, //所属线路
            platformId: undefined, //所属台区
            monitorObjectId: undefined, //监测对象编号
            monitorObjectName: undefined, //监测对象名称
            monitorCode: undefined, //监测点编号
            monitorName: undefined, //监测点名称
            voltageLevel: undefined, //监测点电压等级
            monitorStatus: undefined, //监测点状态
            createdDate: new Date().getFullYear()+'-'+((new Date().getMonth()+1)>=10?(new Date().getMonth()+1):('0'+(new                                 Date().getMonth()+1)))+'-'+((new Date().getDate()-1)>=10?(new Date().getDate()-1):('0'+(new               Date().getDate()-1)))//建档日期
        },
        type: "",
        dialogTableVisible:false,
        monitorCode: {},
    }
},
methods:{
    indexMethod(index) {
        let curpage = this.page; //当前页码
        let limitpage = this.pageSize; //每页条数
        return index + 1 + (curpage - 1) * limitpage;
    },
     // 点击监测点编号查看详情
    async handleDetails() {
    this.type = item.monitorType;
    const params = {
      monitorCode: item.monitorCode,
    };
    this.dialogTableVisible = true;
    await https(this.url.classIMonitoringPoints, this.monitorCode).then(
         (res) => {
            console.log(res);
            this.form1 = res.data[0];
            this.form1.firstType =
              this.form1.firstType === "1"
                ? "运行"
                : this.form1.firstType === "2"
                ? "检修"
                : this.form1.firstType === "3"
                ? "调试"
                : "故障";
            this.form1.monitorType =
              this.form1.monitorType === "1"
                ? "I类监测点"
                : this.form1.monitorType === "2"
                ? "II类监测点"
                : "III类监测点";
            this.form1.isSpecialSupplyElectricity =
              this.form1.isSpecialSupplyElectricity === "1" ? "是" : "否";
            this.form1.terminalWiringMethod =
              this.form1.terminalWiringMethod === "01"
                ? "三相星型"
                : "三相角型";
          });
    }
},
<style lang="scss" scoped>
    .clickName {
        cursor: pointer !important;
        text-decoration: underline;
        color: rgb(31, 134, 129) !important;
    }
</style>
————————————————
版权声明:本文为CSDN博主「前端程序员杨青文」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yqw13989575652/article/details/125655776

 

posted @ 2023-03-09 11:17  前端白雪  阅读(243)  评论(0编辑  收藏  举报