| | |
| | | <el-table ref="multipleTable" v-loading="tableLoading" :border="border" :data="tableData" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" :height="height" |
| | | :highlight-current-row="highlightCurrentRow" :row-class-name="rowClassName" :row-style="rowStyle" |
| | | :row-key="rowKey" :span-method="spanMethod" stripe style="width: 100%" tooltip-effect="dark" @row-click="rowClick" |
| | | :row-key="rowKey" :span-method="spanMethod" :show-summary="showSummary" :summary-method="summaryMethod" stripe style="width: 100%" tooltip-effect="dark" @row-click="rowClick" |
| | | @current-change="currentChange" @selection-change="handleSelectionChange" class="lims-table"> |
| | | <el-table-column align="center" type="selection" width="55" v-if="isSelection" /> |
| | | <el-table-column align="center" label="序号" type="index" width="60" :index="indexMethod" /> |
| | |
| | | :filter-method="item.filterHandler" :filter-multiple="item.filterMultiple" :filtered-value="item.filteredValue" |
| | | :filters="item.filters" :fixed="item.fixed" :label="item.label" :prop="item.prop" |
| | | :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true" |
| | | :min-width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" |
| | | :min-width="item.dataType == 'action' ? btnWidth : item.width" |
| | | :sortable="item.sortable ? true : false" :type="item.type" :width="item.dataType == 'action' ? btnWidth : item.width" align="center"> |
| | | <!-- <div class="123" v-if="item.type == ''"> --> |
| | | <template v-if="item.hasOwnProperty('colunmTemplate')" :slot="item.colunmTemplate" slot-scope="scope"> |
| | |
| | | |
| | | <!-- 按钮 --> |
| | | <div v-else-if="item.dataType == 'action'" |
| | | :style="`width:${getWidth(item.operation, scope.row)}`"> |
| | | :style="`min-width:${getWidth(item.operation, scope.row)}`"> |
| | | <template v-for="(o, key) in item.operation"> |
| | | <el-button v-show="o.type != 'upload'" size="mini" v-if="o.showHide ? o.showHide(scope.row) : true" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" :icon="iconFn(o)" :plain="o.plain" |
| | |
| | | }; |
| | | }, |
| | | }, |
| | | showSummary: { |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | summaryMethod: { |
| | | type: Function, |
| | | default: null |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | watch: { |
| | | tableData: { |
| | | handler() { |
| | | // 当表格数据变化时,初始化 uploadKeys |
| | | this.tableData.forEach((_, index) => { |
| | | this.$set(this.uploadKeys, index, Date.now()); |
| | | }); |
| | | this.$nextTick(() => { |
| | | if (this.$refs.multipleTable) { |
| | | this.$refs.multipleTable.doLayout(); |
| | | } |
| | | }); |
| | | }, |
| | | immediate: true |
| | |
| | | count += a.name.length; |
| | | } |
| | | }); |
| | | this.btnWidth = count * 15 + 50 + "px"; |
| | | return count * 15 + 50 + "px"; |
| | | this.btnWidth = count * 15 + 60 + "px"; |
| | | return count * 15 + 60 + "px"; |
| | | }, |
| | | getTitleWidth(row) { |
| | | if (row.label.includes('时间') || row.label.includes('编号') || row.label.includes('样品名称') || row.label.includes('零件')) { |
| | |
| | | iconFn(row) { |
| | | if (row.name === "编辑" || row.name === "修改") { |
| | | return "el-icon-edit"; |
| | | } else if (row.name === "删除") { |
| | | return "el-icon-delete"; |
| | | } else if (row.name === "查看") { |
| | | return "el-icon-view"; |
| | | } else { |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .el-table>>>.el-table__empty-text { |
| | | .el-table ::v-deep .el-table__empty-text { |
| | | text-align: center; |
| | | } |
| | | |
| | |
| | | color: rgb(64, 158, 255); |
| | | cursor: pointer; |
| | | } |
| | | >>>.cell { |
| | | ::v-deep .cell { |
| | | padding: 0 !important; |
| | | } |
| | | .cell { |
| | |
| | | .lims-table .highlight-danger-row-border td:last-child { |
| | | border-right: 4px solid #f56c6c; |
| | | } |
| | | >>>.red-row td { |
| | | background: #FFCCCC !important; |
| | | } |
| | | </style> |