| | |
| | | <el-table-column v-for="(item, index) in column" :key="index" :column-key="item.columnKey" |
| | | :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="true" |
| | | :sortable="item.sortable ? true : false" :type="item.type" :width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" align="center"> |
| | | :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true" |
| | | :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"> |
| | | <slot v-if="item.theadSlot" :index="index" :name="item.theadSlot" :row="scope.row" /> |
| | |
| | | |
| | | <!-- 按钮 --> |
| | | <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" |
| | |
| | | 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('零件')) { |
| | | return 160 |
| | | } else if (row.label.includes('操作')) { |
| | | return row.width |
| | | } else { |
| | | const span = document.createElement('span'); |
| | | span.innerText = row.label; |
| | | document.body.appendChild(span); |
| | | const width = `${span.offsetWidth + 30}px`; |
| | | const width = `${span.offsetWidth + 50}px`; |
| | | document.body.removeChild(span); |
| | | |
| | | return width; |
| | |
| | | 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 { |
| | |
| | | }; |
| | | } |
| | | } |
| | | // // 特殊的合并行 |
| | | // if ( |
| | | // this.data.spanConfig != undefined && |
| | | // this.data.spanConfig.special && |
| | | // this.data.spanConfig.special.main && |
| | | // this.data.spanConfig.special.rows && |
| | | // this.data.spanConfig.special.rows.length > 0 |
| | | // ) { |
| | | // let i = null; |
| | | // let obj = this.data.spanConfig.special.rows.find((item, index) => { |
| | | // i = index; |
| | | // return item.index == columnIndex; |
| | | // }); |
| | | // if (obj) { |
| | | // const _row = this.specialSpanList[i].arr[rowIndex]; |
| | | // const _col = _row > 0 ? 1 : 0; |
| | | // return { |
| | | // rowspan: _row, |
| | | // colspan: _col, |
| | | // }; |
| | | // } |
| | | // } |
| | | }, |
| | | }, |
| | | }; |
| | |
| | | cursor: pointer; |
| | | } |
| | | >>>.cell { |
| | | padding: 0px !important; |
| | | padding: 0 !important; |
| | | } |
| | | .cell { |
| | | white-space: nowrap; |
| | |
| | | padding-left: 10px !important; |
| | | } |
| | | |
| | | >>>.el-table__body-wrapper::-webkit-scrollbar { |
| | | height: 10px; |
| | | /* 设置滚动条宽度 */ |
| | | } |
| | | .lims-table .highlight-warning-row-border td:first-child { |
| | | border-left: 4px solid #ffcd29; |
| | | } |
| | |
| | | .lims-table .highlight-danger-row-border td:last-child { |
| | | border-right: 4px solid #f56c6c; |
| | | } |
| | | >>>.red-row td { |
| | | background: #FFCCCC !important; |
| | | } |
| | | </style> |