diff --git a/src/views/modules/oss/ossComponents.vue b/src/views/modules/oss/ossComponents.vue index 8c5b100..4c88ecd 100644 --- a/src/views/modules/oss/ossComponents.vue +++ b/src/views/modules/oss/ossComponents.vue @@ -72,6 +72,10 @@ export default { type: Boolean, default: false }, + rowClickSelect: { + type: Boolean, + default: false + }, enableUpgrade: { type: Boolean, default: false @@ -97,6 +101,7 @@ export default { remark:'' }, fileList:[], + currentSelectedRowId: null, upgradeVisible:false, upgradeLoading:false, upgradeFileList:[], @@ -111,8 +116,44 @@ export default { }, methods:{ handleSelectionChange(val){ + if (this.rowClickSelect) { + return + } this.selectionDataList = val }, + rowStyle ({ row }) { + if (!this.rowClickSelect) { + return {} + } + if (this.currentSelectedRowId && row.id === this.currentSelectedRowId) { + return { 'background-color': '#E8F7F6', cursor: 'pointer' } + } + return { cursor: 'pointer' } + }, + handleRowClick (row) { + if (!this.rowClickSelect) { + return + } + this.selectionDataList = row ? [row] : [] + this.currentSelectedRowId = row ? row.id : null + if (this.$refs.table) { + this.$refs.table.setCurrentRow(row || null) + } + }, + handleCurrentChange (row) { + if (!this.rowClickSelect) { + return + } + this.selectionDataList = row ? [row] : [] + this.currentSelectedRowId = row ? row.id : null + }, + resetRowSelection () { + this.selectionDataList = [] + this.currentSelectedRowId = null + if (this.$refs.table) { + this.$refs.table.setCurrentRow() + } + }, handleQuery(){ if (!this.params.orderRef1 && !this.params.orderRef2){ return; @@ -124,6 +165,19 @@ export default { queryOss(params).then(({data})=>{ if (data && data.code === 0){ this.dataList = data.rows; + if (this.rowClickSelect && this.currentSelectedRowId) { + const selectedRow = (this.dataList || []).find(item => item.id === this.currentSelectedRowId) + if (selectedRow) { + this.selectionDataList = [selectedRow] + this.$nextTick(() => { + if (this.$refs.table) { + this.$refs.table.setCurrentRow(selectedRow) + } + }) + } else { + this.resetRowSelection() + } + } }else { this.$message.warning(data.msg); } @@ -273,7 +327,9 @@ export default { this.$message.success(data.msg); this.upgradeVisible = false; this.handleQuery(); - if (this.$refs.table){ + if (this.rowClickSelect) { + this.resetRowSelection(); + } else if (this.$refs.table){ this.$refs.table.clearSelection(); } }else { @@ -384,7 +440,11 @@ export default { link.target = '_blank'; // 打开新窗口预览 link.click(); URL.revokeObjectURL(link.href); - this.$refs.table.clearSelection(); + if (this.rowClickSelect) { + this.resetRowSelection(); + } else if (this.$refs.table) { + this.$refs.table.clearSelection(); + } }); } } @@ -410,6 +470,7 @@ export default { this.ossForm.orderRef2 = this.orderRef2; this.ossForm.orderRef3 = this.orderRef3; this.dataList = []; + this.resetRowSelection(); this.handleQuery(); } }, @@ -442,9 +503,12 @@ export default { ref="table" v-loading="queryLoading" border + :row-style="rowStyle" + @row-click="handleRowClick" + @current-change="handleCurrentChange" @selection-change="handleSelectionChange" style="width: 100%;margin-top: 5px"> - + - @@ -525,26 +588,26 @@ export default { - - + + - + - + - + - + - + - - + + @@ -579,4 +642,8 @@ export default { height: auto; line-height: 1; } +.auto /deep/ .el-upload, +.auto /deep/ .el-upload-dragger{ + height: auto; +} diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue index bf940d7..0ef9dd1 100644 --- a/src/views/modules/rohs/rohsRecord.vue +++ b/src/views/modules/rohs/rohsRecord.vue @@ -340,9 +340,10 @@ :require-file-no-rev="true" :auto-file-no="true" :single-upload="true" + :row-click-select="true" :show-order-ref2="false" label="序列号" - :height="180" + :height="350" style="margin-top: 2px" :columns="tdsFileColumnList" :order-ref1="modalData.site || ''"