| | |
| | | <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="item.dataType === 'action' || item.dataType === 'slot' ? false : true" |
| | | :min-width="item.dataType == 'action' ? btnWidth : getTitleWidth(item)" |
| | | :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 : getTitleWidth(item)" :sortable="item.sortable ? true : false" |
| | | :type="item.type" |
| | | :width="item.dataType == 'action' ? btnWidth : (column.length < 6 ? 'auto' : getTitleWidth(item))" |
| | | 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> |
| | | |
| | | <!-- 按钮 --> |
| | | <div v-else-if="item.dataType == 'action'" |
| | | :style="`width:${getWidth(item.operation, scope.row)}`"> |
| | | <div v-else-if="item.dataType == 'action'" :style="`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" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" :plain="o.plain" |
| | | :style="{ color: o.name === '删除' ? '#f56c6c' : o.color }" :type="o.type | typeFn(scope.row)" |
| | | @click="o.clickFun(scope.row)" :key="key"> |
| | | {{ o.name }} |
| | | </el-button> |
| | | <el-upload :action="javaApi + o.url + '?id=' + (o.uploadIdFun ? o.uploadIdFun(scope.row) : scope.row.id)" |
| | | :key="uploadKeys[scope.$index]" |
| | | ref="uploadRef" |
| | | size="mini" :multiple="o.multiple ? o.multiple : false" :limit="1" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept |
| | | :key="uploadKeys[scope.$index]" ref="uploadRef" size="mini" :multiple="o.multiple ? o.multiple : false" |
| | | :limit="1" :disabled="o.disabled ? o.disabled(scope.row) : false" :accept="o.accept |
| | | ? o.accept |
| | | : '.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' |
| | | " v-if="o.type == 'upload'" style="display: inline-block; width: 50px" |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" :headers="uploadHeader" |
| | | :before-upload="(file) => beforeUpload(file, scope.$index)" |
| | | :on-change="(file, fileList) => handleChange(file, fileList, scope.$index)" |
| | | :on-error="(error, file, fileList) => onError(error, file, fileList, scope.$index)" |
| | | :on-success="(response, file, fileList) => handleSuccessUp(response, file, fileList, scope.$index)" |
| | | :on-exceed="onExceed" :show-file-list="false"> |
| | | v-show="o.showHide ? o.showHide(scope.row) : true" :headers="uploadHeader" |
| | | :before-upload="(file) => beforeUpload(file, scope.$index)" |
| | | :on-change="(file, fileList) => handleChange(file, fileList, scope.$index)" |
| | | :on-error="(error, file, fileList) => onError(error, file, fileList, scope.$index)" |
| | | :on-success="(response, file, fileList) => handleSuccessUp(response, file, fileList, scope.$index)" |
| | | :on-exceed="onExceed" :show-file-list="false"> |
| | | <el-button :size="o.size ? o.size : 'small'" type="text" |
| | | :disabled="o.disabled ? o.disabled(scope.row) : false">{{ o.name }}</el-button> |
| | | </el-upload> |
| | |
| | | count += a.name.length; |
| | | } |
| | | }); |
| | | this.btnWidth = count * 15 + 50 + "px"; |
| | | this.btnWidth = count * 15 + 60 + "px"; |
| | | return count * 15 + 50 + "px"; |
| | | }, |
| | | getTitleWidth(row) { |
| | | if (row.label.includes('时间') || row.label.includes('编号') || row.label.includes('样品名称') || row.label.includes('零件')) { |
| | | return 160 |
| | | } else if (row.label.includes('产品')) { |
| | | return 210 |
| | | } 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 + 50}px`; |
| | | const width = `${span.offsetWidth + 60}px`; |
| | | document.body.removeChild(span); |
| | | |
| | | return width; |
| | |
| | | // 更新当前文件 |
| | | this.currentFiles[index] = file; |
| | | }, |
| | | beforeUpload (file, index) { |
| | | beforeUpload(file, index) { |
| | | this.currentFiles[index] = {} |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('上传文件不超过10M'); |
| | |
| | | color: rgb(64, 158, 255); |
| | | cursor: pointer; |
| | | } |
| | | |
| | | >>>.cell { |
| | | padding: 0 !important; |
| | | } |
| | | |
| | | .cell { |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | |
| | | height: 10px; |
| | | /* 设置滚动条宽度 */ |
| | | } |
| | | |
| | | .lims-table .highlight-warning-row-border td:first-child { |
| | | border-left: 4px solid #ffcd29; |
| | | } |