<template> <div class="page"> <!-- S 班次表格主体 --> <LayoutTable :data="tableData" :config="tableConfig"></LayoutTable> <dialog-show ref="dialogform" @ok="getData" /> <!-- E 班次表格主体 --> </div> </template> <script> /** 表单弹出框模式需引入 */ import dialogShow from './dialogshow'; import table from '@/assets/mixins/table'; export default { name: 'AttendanceClassList', components: { dialogShow }, mixins: [table], data() { return { /** 子表列元素 */ columnSet: [ { prop: 'goWorkDate', label: '上班打卡时间', width: 150, align: 'center' }, { prop: 'goWorkDateBefore', label: '上班前打卡(分钟)', width: 150, align: 'center' }, { prop: 'goWorkDateAfter', label: '上班后打卡(分钟)', width: 150, align: 'center' }, { prop: 'offWorkDate', label: '下班打卡时间', width: 150, align: 'center' }, { prop: 'offWorkDateBefore', label: '下班前打卡(分钟)', width: 150, align: 'center' }, { prop: 'offWorkDateAfter', label: '下班后打卡(分钟)', width: 150, align: 'center' } // {prop:"remark",label:"备注",width:150}, // {prop:"classId",label:"班次ID",width:150}, ], config: { search: [ { name: 'className', type: 'text', label: '班次名称', fuzzy: true } ], isshowTabPane: true, columns: [ { type: 'selection', width: 60 }, { type: 'index', label: '序号', width: 50 }, { label: '班次名称', prop: 'className' }, // {label: "考勤时间", prop: "className"}, { label: '考勤班次详细信息', width: 200, prop: 'subColumns', formatter: (row) => { let widthsize = this.columnSet.reduce((pre, cur) => { return pre + Number(cur.width); }, 50); return ( <el-popover placement="right" width={widthsize} trigger="click"> {this.renderTable(row.attendanceClassDetailList)} <el-button type="text" slot="reference"> 详细 </el-button> </el-popover> ); } }, { label: '操作', width: 240, formatter: (row) => { return ( <table-buttons noAdd noView row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} /> ); } } ] } }; }, created() {}, methods: { // 表格渲染数据 renderTable(tableData) { return ( <el-table stripe data={tableData} class="total-table"> {this.columnSet.map((item) => this.renderTableColumn(item))} </el-table> ); }, // 表格渲染表头 renderTableColumn(options) { return ( <el-table-column prop={options.prop} label={options.label} width={options.width} align="center" ></el-table-column> ); }, /** 重写新增方法 */ toAdd(row) { this.$refs.dialogform.add(row); }, /** 重写编辑方法 */ toEdit(row) { this.$refs.dialogform.edit(row); }, /** 重写查看方法 */ toView(row) { this.$refs.dialogform.view(row); } } }; </script>