el-table动态行和列及多级表头

主页面 

<template>
    <div class="result-wrapper">
      <dynamic-table :table-data="tableData" :table-header="tableConfig" :tableTitle="tableTitle" :flowParams="flowParams"></dynamic-table>
    </div>
</template>

<script>
import DynamicTable from './components/DynamicTable'
import dataInfo from "./data.json";
export default {
  props: {},
  components: {
    DynamicTable
  },
  data() {
    return {
      tableTitle: '邮政企业三级领导人员2024年7月绩效考核指标得分数据库',
      tableData: [],
      tableConfig: []
    }
  },
  computed: {
  },
  async created() {
  },
  methods: {
    openFlowPage() {
      let respData = dataInfo.data;
      if (respData.evalPerformanceRecordDetailList && respData.evalPerformanceRecordDetailList.length) {
        let list = JSON.parse(JSON.stringify(respData.evalPerformanceRecordDetailList)) // 表格业务数据
        let tableData = JSON.parse(JSON.stringify(respData.evalPerformanceRecordDetailList)) // 表格业务数据
        this.tableData = list
        this.tableConfigDeal(list[0].evalFormIndicatorBlocks)
        this.gettableData(tableData);
        console.log(this.tableConfig, 'tableConfig')
        console.log(this.tableData, 'tableData')
      }
    },
    tableDataFormat () {
      const data = JSON.parse(JSON.stringify([...this.tableData]));
      data.forEach((item) => {
        const newArray = [];
        for (const key in item.value) {
          // console.log(item.value, 'item.value');
          // console.log(key, 'key');
          if (item.value[key]) {
            delete item.value[key].children
            newArray.push(item.value[key])
          }
        }
        item.newArray = newArray
        delete item.value
      })
      return data
    },
    getForData(array, count) {
      if (count) {
        count++
      } else {
        count = 1
      }
      array.forEach((item) => {
          item.floor = count;
        if (item.children && item.children.length) {
          this.getForData(item.children, count)
        } else {
          item.children = [
            {
              label: '标杆值',
              prop: 'benchmarkVal', 
              valueData: item.id,
              formIndicatorBlockId: item.formIndicatorBlockId
            },
            {
              label: '完成值',
              prop: 'completionVal',
              valueData: item.id,
              formIndicatorBlockId: item.formIndicatorBlockId
            },
            {
              label: '建议得分',
              prop: 'scoreVal',
              valueData: item.id,
              formIndicatorBlockId: item.formIndicatorBlockId,
            }
          ]
        }
        if (item.floor === 2 && item && !this.hasLabelData(item.children, '建议得分合计')) { 
          item.children.push({
            label: '建议得分合计',
            prop: 'suggestScoreTotal',
            valueData: item.id,
            type: true,
            formIndicatorBlockId: item.formIndicatorBlockId
          })
          if (item.isShowLeaderMarkScore) {
            item.children.push( { 
              label: '领导评分',
              prop: 'leaderScore',
              valueData: item.id,
              type: false,
              formIndicatorBlockId: item.formIndicatorBlockId
            })
          }
        }
      })
    },
    getTablejson(array, json, personObj, count) {
      if (count) {
        count++
      } else {
        count = 1
      }
      array.forEach((obj) => {
        if (obj.hasOwnProperty('suggestScoreTotal')) {
          json[obj.id] = {
            ...obj,
          };
        } 
        obj.floor = count;
        if (obj.children && obj.children.length) {
          this.getTablejson(obj.children, json, obj, count)
        } else {
          json[obj.id] = {
            ...obj,
           originDataNoChild: true
          };
        }
      });
    },
    gettableData(array) {
      const tableData = [];
      array.forEach((item) => {
        const json = {
          value: {}
        };
        json.id = item.empNumber;
        json.company = item.company;
        if (item.evalFormIndicatorBlocks && item.evalFormIndicatorBlocks.length) {
          item.evalFormIndicatorBlocks.forEach((list) => {
            this.getTablejson(list.children, json.value, list, 0);
          })
        }
        tableData.push(json);
      });
      this.tableData = tableData;
    },
    tableConfigDeal(array) {
      // console.log(array, 'array');
      this.getForData(array, 0);
      let tableConfig = [
        {
          id: 10,
          label: '单位',
          prop: 'company'
        }
      ]
      this.tableConfig = tableConfig.concat(array);
    },
    hasLabelData (children, key) {
      let flag = false
      for(let i = 0; i < children.length; i++) {
        if (children[i].label === key) {
          flag = true
          break
        }
      }
      return flag
    }
  }                 
}
</script>
<style scoped lang="scss">
::v-deep .el-table--border th, ::v-deep .el-table__fixed-right-patch {
  border-bottom: 1px solid #666666;
}
::v-deep .el-table--border td, .el-table--border th, ::v-deep .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
  border-right: 1px solid #666666;
}
::v-deep .el-table--border, ::v-deep .el-table--group {
  border: 1px solid #666666;
}
::v-deep .el-table--border td, ::v-deep .el-table--border th, ::v-deep .el-table__body-wrapper .el-table--border.is-scrolling-left~.el-table__fixed {
  border-right: 1px solid #666666;
}
::v-deep .el-table td, ::v-deep .el-table th.is-leaf {
  border-bottom: 1px solid #666666;
}
</style>

页面表格表头和表内容数据 

{
    "code": "0",
    "msg": "成功",
    "data": [
        {
            "id": "8837445335765553152",
            "empNumber": "LXZT00002",
            "company": "石家庄",
            "evalFormIndicatorBlocks": [
                {
                    "id": "8837445339947274240",
                    "performanceRecordId": "8837445334637285376",
                    "sectionType": "quality",
                    "children": [
                        {
                            "id": "8837445434885345280",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445339947274240",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "80",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT00008",
                            "itemLevel": "/战略绩效得分",
                            "children": null,
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": null,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": true,
                            "label": "战略绩效得分"
                        }
                    ],
                    "score": "80",
                    "label": "战略绩效指标"
                },
                {
                    "id": "8837445391839203328",
                    "performanceRecordId": "8837445334637285376",
                    "sectionType": "quantity",
                    "children": [
                        {
                            "id": "8837445436214939648",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445391839203328",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "6",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT00006",
                            "itemLevel": "/“两集中”改革",
                            "children": [
                                {
                                    "id": "8837445437431287808",
                                    "parentId": "8837445436214939648",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "3",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00006",
                                    "itemLevel": "/“两集中”改革/组织管理架构和质量指标体系建设情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "组织管理架构和质量指标体系建设情况"
                                },
                                {
                                    "id": "8837445440002396160",
                                    "parentId": "8837445436214939648",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "3",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00006",
                                    "itemLevel": "/“两集中”改革/处理中心人均处理效率",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "处理中心人均处理效率"
                                }
                            ],
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": null,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": false,
                            "label": "“两集中”改革"
                        },
                        {
                            "id": "8837445442326040576",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445391839203328",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "7",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT00007",
                            "itemLevel": "/协同与服务乡村振兴",
                            "children": [
                                {
                                    "id": "8837445443424948224",
                                    "parentId": "8837445442326040576",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "3",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00006",
                                    "itemLevel": "/协同与服务乡村振兴/服务乡村振兴重点指标完成情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "服务乡村振兴重点指标完成情况"
                                },
                                {
                                    "id": "8837445445991862272",
                                    "parentId": "8837445442326040576",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "2",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00007",
                                    "itemLevel": "/协同与服务乡村振兴/协同项目重点目标完成情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "协同项目重点目标完成情况"
                                },
                                {
                                    "id": "8837445448374226944",
                                    "parentId": "8837445442326040576",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "2",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00007",
                                    "itemLevel": "/协同与服务乡村振兴/营销体系建设落实情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "营销体系建设落实情况"
                                }
                            ],
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": true,
                            "isCanLeaderMarkScore": true,
                            "isCanScore": false,
                            "label": "协同与服务乡村振兴"
                        },
                        {
                            "id": "8837445451129884672",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445391839203328",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "7",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT000016",
                            "itemLevel": "/三级物流体系、“网点+站点”",
                            "children": [
                                {
                                    "id": "8837445452400758784",
                                    "parentId": "8837445451129884672",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "5",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT000015",
                                    "itemLevel": "/三级物流体系、“网点+站点”/三级物流体系",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "三级物流体系"
                                },
                                {
                                    "id": "8837445454976061440",
                                    "parentId": "8837445451129884672",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "2",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT000016",
                                    "itemLevel": "/三级物流体系、“网点+站点”/“网点+站点”",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "“网点+站点”"
                                }
                            ],
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": true,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": false,
                            "label": "三级物流体系、“网点+站点”"
                        }
                    ],
                    "score": "20",
                    "label": "重点任务指标"
                }
            ]
        },
        {
            "id": "8837445336914792448",
            "empNumber": "LXZT00001",
            "company": "唐山",
            "evalFormIndicatorBlocks": [
                {
                    "id": "8837445339947274240",
                    "performanceRecordId": "8837445334637285376",
                    "sectionType": "quality",
                    "children": [
                        {
                            "id": "8837445434885345280",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445339947274240",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "80",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT00008",
                            "itemLevel": "/战略绩效得分",
                            "children": null,
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": null,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": null,
                            "label": "战略绩效得分"
                        }
                    ],
                    "score": "80",
                    "label": "战略绩效指标"
                },
                {
                    "id": "8837445391839203328",
                    "performanceRecordId": "8837445334637285376",
                    "sectionType": "quantity",
                    "children": [
                        {
                            "id": "8837445436214939648",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445391839203328",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "6",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT00006",
                            "itemLevel": "/“两集中”改革",
                            "children": [
                                {
                                    "id": "8837445437431287808",
                                    "parentId": "8837445436214939648",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "3",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00006",
                                    "itemLevel": "/“两集中”改革/组织管理架构和质量指标体系建设情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "组织管理架构和质量指标体系建设情况"
                                },
                                {
                                    "id": "8837445440002396160",
                                    "parentId": "8837445436214939648",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "3",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00006",
                                    "itemLevel": "/“两集中”改革/处理中心人均处理效率",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "处理中心人均处理效率"
                                }
                            ],
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": null,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": false,
                            "label": "“两集中”改革"
                        },
                        {
                            "id": "8837445442326040576",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445391839203328",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "7",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT00007",
                            "itemLevel": "/协同与服务乡村振兴",
                            "children": [
                                {
                                    "id": "8837445443424948224",
                                    "parentId": "8837445442326040576",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "3",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00006",
                                    "itemLevel": "/协同与服务乡村振兴/服务乡村振兴重点指标完成情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "服务乡村振兴重点指标完成情况"
                                },
                                {
                                    "id": "8837445445991862272",
                                    "parentId": "8837445442326040576",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "2",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00007",
                                    "itemLevel": "/协同与服务乡村振兴/协同项目重点目标完成情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "协同项目重点目标完成情况"
                                },
                                {
                                    "id": "8837445448374226944",
                                    "parentId": "8837445442326040576",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "2",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT00007",
                                    "itemLevel": "/协同与服务乡村振兴/营销体系建设落实情况",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "营销体系建设落实情况"
                                }
                            ],
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": null,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": false,
                            "label": "协同与服务乡村振兴"
                        },
                        {
                            "id": "8837445451129884672",
                            "parentId": null,
                            "performanceRecordId": "8837445334637285376",
                            "formIndicatorBlockId": "8837445391839203328",
                            "scoreVal": null,
                            "empNumber": "LXZT00001",
                            "company": "唐山",
                            "benchmarkVal": null,
                            "completionVal": null,
                            "score": "7",
                            "suggestScoreTotal": null,
                            "leaderScore": null,
                            "informantNumber": "LXZT000016",
                            "itemLevel": "/三级物流体系、“网点+站点”",
                            "children": [
                                {
                                    "id": "8837445452400758784",
                                    "parentId": "8837445451129884672",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "5",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT000015",
                                    "itemLevel": "/三级物流体系、“网点+站点”/三级物流体系",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "三级物流体系"
                                },
                                {
                                    "id": "8837445454976061440",
                                    "parentId": "8837445451129884672",
                                    "performanceRecordId": "8837445334637285376",
                                    "formIndicatorBlockId": "8837445391839203328",
                                    "scoreVal": null,
                                    "empNumber": "LXZT00001",
                                    "company": "唐山",
                                    "benchmarkVal": null,
                                    "completionVal": null,
                                    "score": "2",
                                    "suggestScoreTotal": null,
                                    "leaderScore": null,
                                    "informantNumber": "LXZT000016",
                                    "itemLevel": "/三级物流体系、“网点+站点”/“网点+站点”",
                                    "children": null,
                                    "leaderMarkScoreList": null,
                                    "isShowLeaderMarkScore": null,
                                    "isCanLeaderMarkScore": null,
                                    "isCanScore": null,
                                    "label": "“网点+站点”"
                                }
                            ],
                            "leaderMarkScoreList": null,
                            "isShowLeaderMarkScore": null,
                            "isCanLeaderMarkScore": null,
                            "isCanScore": false,
                            "label": "三级物流体系、“网点+站点”"
                        }
                    ],
                    "score": "20",
                    "label": "重点任务指标"
                }
            ]
        }
    ]
}

DynamicTable.vue

n<template>
  <div>
    <el-table :data="tableData" border :height="height">
        <template v-for="(item) in tableHeader">
            <table-column v-if="item.children && item.children.length" :key="item.id" :coloumn-header="item" :flowParams="flowParams"></table-column>
            <el-table-column v-else :key="item.id" :label="item.label" :prop="item.prop" align="center">
            </el-table-column>
        </template>
    </el-table>
  </div>
   
  </template>
  
  <script>
  import TableColumn from './TableColumn'
  export default {
    props: {
      tableTitle: {
        type: String,
        require: true
      },
      // 表格的数据
      tableData: {
        type: Array,
        required: true
      },
      // 多级表头的数据
      tableHeader: {
        type: Array,
        required: true
      },
      // 表格的高度
      height: {
        type: String,
        // default: '300'
      },
      // 流程数据
      flowParams: {
        type: Object,
        default: ()=>{ return {} } 
      }
    },
    data () {
      return {
      }
    },
    watch: {
    },
    components: {
      TableColumn
    },
    methods: {
      
    }
  }
  </script>
  
  <style scoped>
  
  </style>

 TableColumn.vue

<template>
    <el-table-column :label="`${coloumnHeader.label}(${coloumnHeader.score}分)`" :prop="coloumnHeader.label" align="center">
      <template v-for="item in coloumnHeader.children">
        <tableColumn v-if="item.children && item.children.length" :key="item.id" :coloumn-header="item" :flowParams="flowParams"></tableColumn>
        <el-table-column v-else :key="item.label" :label="item.label" :prop="item.prop" align="center">
          <template slot-scope="{row}">
              <template v-if="item.type">
                {{getScope1(item, row)}}
              </template>
              <template v-else>
                <!-- isCanLeaderMarkScore为true领导可编辑 isCanScore 固定三项可编辑 已办不可编辑 -->
                <el-input v-model="row.value[item.valueData][item.prop]" @input="handleIpt(row.value, item)" :title="row.value[item.valueData][item.prop]" :disabled="(flowParams && flowParams.isView === 'true') || (item.prop === 'leaderScore' ? !row.value[item.valueData].isCanLeaderMarkScore : !row.value[item.valueData].isCanScore)"></el-input>
              </template>
          </template> 
        </el-table-column>
      </template>
    </el-table-column>
  </template>
  ;
  <script>
  export default {
    name: 'tableColumn',
    props: {
      coloumnHeader: {
        type: Object,
        required: true
      },
      // 流程数据
      flowParams: {
        type: Object,
        default: ()=>{ return {} } 
      }
    },
    methods: {
      handleIpt(value, item) {
       console.log('进来了。。。')
        if (item.prop === 'scoreVal' && value[item.valueData].score && value[item.valueData][item.prop]) {
          value[item.valueData][item.prop] = this.isNumber(value[item.valueData][item.prop])
          if (Number(value[item.valueData][item.prop]) > Number(value[item.valueData].score)) {
            this.$message({ type: "onfo", message: `建议得分不能超出设定的分值(${Number(value[item.valueData].score)}分) `});
            value[item.valueData][item.prop] = ''
          }
        }
      },
      isNumber(num, decimalPlace) {
        num = num.replace(/[^\d\.]+/g, "");
        var len1 = num.substr(0, 1);
        var len2 = num.substr(1, 1);
        //如果第一位是0,第二位不是点,就用数字把点替换掉
        if (num.length > 1 && len1 == 0 && len2 != ".") {
          num = num.substr(1, 1);
        }
        //第一位不能是.
        if (len1 == ".") {
          num = "";
        }
        //限制只能输入一个小数点
        if (num.indexOf(".") != -1) {
          var str_ = num.substr(num.indexOf(".") + 1);
          if (str_.indexOf(".") != -1) {
            num = num.substr(0, num.indexOf(".") + str_.indexOf(".") + 1);
          }
        }
        //动态位数
        num = num.replace(
          /\.\d{2,}$/,
          num.substr(num.indexOf("."), decimalPlace + 1)
        );
        return num;
      },
      getScope1(item, row) {
        let total = 0;
        if (row.value[item.valueData].children && row.value[item.valueData].children) {
          row.value[item.valueData].children.forEach((item) => {
            total = total + Number(row.value[item.id].scoreVal || 0)
          });
        } else {
          total = Number(row.value[item.valueData].scoreVal || 0);
        }
        console.log(total, 0)
        row.value[item.valueData][item.prop] = total.toFixed(2);
        return total.toFixed(2);
      }
    }
  }
  </script>
  
  <style scoped>
  
  </style>

效果图

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/945655.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【MySQL】数据库 Navicat 可视化工具与 MySQL 命令行基本操作

&#x1f4af; 欢迎光临清流君的博客小天地&#xff0c;这里是我分享技术与心得的温馨角落 &#x1f4af; &#x1f525; 个人主页:【清流君】&#x1f525; &#x1f4da; 系列专栏: 运动控制 | 决策规划 | 机器人数值优化 &#x1f4da; &#x1f31f;始终保持好奇心&…

2024年12月30日Github流行趋势

项目名称&#xff1a;free-programming-books 项目地址url&#xff1a;https://github.com/EbookFoundation/free-programming-books项目语言&#xff1a;HTML历史star数&#xff1a;343,398今日star数&#xff1a;246项目维护者&#xff1a;vhf, eshellman, davorpa, MHM5000,…

Mysql数据库Redo日志和Undo日志的理解

数据库redo日志和undo日志 1、redo日志1.1 redo日志的作用1.1.1 不使用redo日志的问题1.1.2 使用redo日志的好处 1.2 redo日志刷盘策略 2、undo日志2.1 undo日志的作用2.2 undo日志的简要生成过程 1、redo日志 事务的4大特性&#xff08;ACID&#xff09;&#xff1a;原子性、…

Windows配置cuda,并安装配置Pytorch-GPU版本

文章目录 1. CUDA Toolkit安装2. 安装cuDNN3. 添加环境变量配置Pytorch GPU版本 博主的电脑是Windows11&#xff0c;在安装cuda之前&#xff0c;请先查看pytorch支持的版本&#xff0c;cuda可以向下兼容&#xff0c;但是pytorch不行&#xff0c;请先进入&#xff1a;https://py…

Oracle 数据库 dmp文件从高版本导入低版本的问题处理

当前有个需求是将oracle 19c上的数据备份恢复到oracle 11g上使用。我们通过exp命令远程进行备份&#xff0c;然后通过imp进行恢复时出现IMP-00010: not a valid export file, header failed verification报错。 这是数据库版本问题&#xff0c;在使用exp命令导出的时候使用的客…

RedisDesktopManager新版本不再支持SSH连接远程redis后

背景 RedisDesktopManager(又名RDM)是一个用于Windows、Linux和MacOS的快速开源Redis数据库管理应用程序。这几天从新下载RedisDesktopManager最新版本&#xff0c;结果发现新版本开始不支持SSH连接远程redis了。 解决方案 第一种 根据网上有效的信息&#xff0c;可以回退版…

C# 读取多种CAN报文文件转换成统一格式数据,工具类:CanMsgRead

因为经常有读取CAN报文trace文件的需求&#xff0c;而且因为CAN卡不同、记录软件不同会导致CAN报文trace文件的格式都有差异。为了方便自己后续开发&#xff0c;我写了一个CanMsgRead工具类&#xff0c;只要提供CAN报文路径和CAN报文格式的选项即可将文件迅速读取转换为统一的C…

REDIS2.0

string list hash set 无序集合 声明一个key&#xff0c;键里面的值是元素&#xff0c;元素的类型是string 元素的值是唯一的&#xff0c;不能重复 多个集合类型之间可以进行并集&#xff0c;交集&#xff0c;集查的运算 sadd test1 a b c c d &#xff1a;添加5个元素&am…

【源码 导入教程 文档 讲解】基于springboot校园新闻管理系统源码和论文

可做计算机毕业设计JAVA、PHP、爬虫、APP、小程序、C#、C、python、数据可视化、大数据、文案 传统信息的管理大部分依赖于管理人员的手工登记与管理&#xff0c;然而&#xff0c;随着近些年信息技术的迅猛发展&#xff0c;让许多比较老套的信息管理模式进行了更新迭代&#xf…

分布式项目___某污水处理项目

一.分布式项目___污水处理项目 项目地址:https://gitee.com/yanyigege/collaborative-water-springboot.git ​ 1.项目背景 总公司在全国各地有处理污水的项目部,各项目部处理自己的污水,总部需要监控各地分项目部每天处理污水的原料用量,掌握各分部的污水处理情况 ​ 2.功…

小程序基础 —— 08 文件和目录结构

文件和目录结构 一个完整的小程序项目由两部分组成&#xff1a;主体文件、页面文件&#xff1a; 主体文件&#xff1a;全局文件&#xff0c;能够作用于整个小程序&#xff0c;影响小程序的每个页面&#xff0c;主体文件必须放到项目的根目录下&#xff1b; 主体文件由三部分组…

计算机网络 (7)物理层下面的传输媒体

一、定义与位置 物理层是计算机网络体系结构的最低层&#xff0c;它位于传输媒体&#xff08;传输介质&#xff09;之上&#xff0c;主要作用是为数据链路层提供一个原始比特流的物理连接。这里的“比特流”是指数据以一个个0或1的二进制代码形式表示。物理层并不是特指某种传输…

基于FPGA的2ASK+帧同步系统verilog开发,包含testbench,高斯信道,误码统计,可设置SNR

目录 1.算法仿真效果 2.算法涉及理论知识概要 2.1 2ASK调制解调 2.2 帧同步 3.Verilog核心程序 4.完整算法代码文件获得 1.算法仿真效果 vivado2019.2仿真结果如下&#xff08;完整代码运行后无水印&#xff09;&#xff1a; 设置SNR8db 设置SNR20db 整体波形效果&…

各种 Amazon EBS 卷类型

Amazon Elastic Block Store&#xff08;EBS&#xff09;是 Amazon Web Services&#xff08;AWS&#xff09;提供的一项持久性块存储服务&#xff0c;它允许用户为 EC2 实例提供高效、可靠的存储。EBS 卷是 AWS 云环境中存储数据的基础组件&#xff0c;广泛应用于数据库、文件…

nvidia_gpu_exporter 显卡监控

导入 grafana/dashboard.json https://github.com/utkuozdemir/nvidia_gpu_exporter/blob/master/grafana/dashboard.json参考 nvidia_gpu_exporter

jvm排查问题-实践追踪问题 与思路--堆内堆外内存泄漏排查方针

概述 排查问题的一般思路是:现象 ——> 直接原因 ——>根本原因。 从问题现象出发,可以分为 应用逻辑问题、资源使用问题、虚拟机异常: 应用逻辑可能导致报错增加、死锁、程序退出等;资源问题主要集中在CPU上升和内存上升(OOM Kill);虚拟机问题通常包括GC问题、进…

CPT203 Software Engineering 软件工程 Pt.1 概论和软件过程(中英双语)

文章目录 1.Introduction1.1 What software engineering is and why it is important&#xff08;什么是软件工程&#xff0c;为什么它很重要&#xff09;1.1 We can’t run the modern world without software&#xff08;我们的世界离不开软件&#xff09;1.1.1 What is Soft…

【Java数据结构】LinkedList与链表

认识LinkedList LinkedList就是一个链表&#xff0c;它也是实现List接口的一个类。LinkedList就是通过next引用将所有的结点链接起来&#xff0c;所以不需要数组。LinkedList也是以泛型的方法实现的&#xff0c;所以使用这个类都需要实例化对象。 链表分为很多种&#xff0c;比…

从0入门自主空中机器人-2-2【无人机硬件选型-PX4篇】

1. 常用资料以及官方网站 无人机飞控PX4用户使用手册&#xff08;无人机基本设置、地面站使用教程、软硬件搭建等&#xff09;&#xff1a;https://docs.px4.io/main/en/ PX4固件开源地址&#xff1a;https://github.com/PX4/PX4-Autopilot 飞控硬件、数传模块、GPS、分电板等…

详解MySQL在Windows上的安装

目录 查看电脑上是否安装了MySQL 下载安装MySQL 打开MySQL官网&#xff0c;找到DOWNLOADS 然后往下翻&#xff0c;找到MySQL Community(GPL) Downloads>> 然后找到MySQL Community Server 然后下载&#xff0c;选择No thanks,just start my download. 然后双击进行…