页面优化

This commit is contained in:
cwchen 2025-11-30 14:07:16 +08:00
parent 12e2cc847c
commit e92e9d805e
3 changed files with 73 additions and 11 deletions

View File

@ -81,6 +81,7 @@
<el-radio <el-radio
:label="getRowUniqueId(scope.row, scope.$index)" :label="getRowUniqueId(scope.row, scope.$index)"
v-model="currentRowId" v-model="currentRowId"
:disabled="isRadioDisabled(scope.row)"
@change="handleRadioChange(scope.row, scope.$index)" @change="handleRadioChange(scope.row, scope.$index)"
> >
<span></span> <span></span>
@ -203,6 +204,11 @@ export default {
type: String, type: String,
default: 'id', default: 'id',
}, },
//
radioDisabledKey: {
type: String,
default: '',
},
// 使 // 使
testTableList: { testTableList: {
type: Array, type: Array,
@ -436,20 +442,25 @@ export default {
if (res.code === 200) { if (res.code === 200) {
this.tableList = res.rows this.tableList = res.rows
this.total = res.total this.total = res.total
// //
if (this.isRadioShow && this.currentRowId) { if (this.isRadioShow && this.currentRowId) {
let exists = false let exists = false
let isDisabled = false
for (let i = 0; i < this.tableList.length; i++) { for (let i = 0; i < this.tableList.length; i++) {
const row = this.tableList[i] const row = this.tableList[i]
const uniqueId = this.getRowUniqueId(row, i) const uniqueId = this.getRowUniqueId(row, i)
if (uniqueId === this.currentRowId) { if (uniqueId === this.currentRowId) {
exists = true exists = true
// //
this.currentRowData = row isDisabled = this.isRadioDisabled(row)
if (!isDisabled) {
//
this.currentRowData = row
}
break break
} }
} }
if (!exists) { if (!exists || isDisabled) {
this.currentRowId = null this.currentRowId = null
this.currentRowData = null this.currentRowData = null
} }
@ -601,6 +612,10 @@ export default {
// //
handleRadioChange(row, index) { handleRadioChange(row, index) {
if (this.isRadioShow && row) { if (this.isRadioShow && row) {
//
if (this.isRadioDisabled(row)) {
return
}
const uniqueId = this.getRowUniqueId(row, index) const uniqueId = this.getRowUniqueId(row, index)
// //
if (this.currentRowId !== uniqueId) { if (this.currentRowId !== uniqueId) {
@ -611,9 +626,26 @@ export default {
} }
}, },
//
isRadioDisabled(row) {
//
if (!this.radioDisabledKey) {
return false
}
//
const disabledValue = row[this.radioDisabledKey]
// nullundefined'' false
// true
return disabledValue !== null && disabledValue !== undefined && disabledValue !== ''
},
// //
handleCurrentChange(currentRow) { handleCurrentChange(currentRow) {
if (this.isRadioShow && currentRow) { if (this.isRadioShow && currentRow) {
//
if (this.isRadioDisabled(currentRow)) {
return
}
const index = this.tableList.findIndex(r => r === currentRow) const index = this.tableList.findIndex(r => r === currentRow)
const uniqueId = this.getRowUniqueId(currentRow, index) const uniqueId = this.getRowUniqueId(currentRow, index)
this.currentRowId = uniqueId this.currentRowId = uniqueId
@ -688,6 +720,12 @@ export default {
} }
} }
if (foundRow) { if (foundRow) {
//
if (this.isRadioDisabled(foundRow)) {
this.currentRowId = oldVal
this.currentRowData = null
return
}
this.currentRowData = foundRow this.currentRowData = foundRow
this.$emit('radio-change', foundRow, foundIndex) this.$emit('radio-change', foundRow, foundIndex)
} }
@ -835,6 +873,20 @@ export default {
height: 16px; height: 16px;
} }
} }
//
&.is-disabled {
cursor: not-allowed;
pointer-events: auto; // pointer-events
.el-radio__input {
cursor: not-allowed;
}
.el-radio__label {
cursor: not-allowed;
}
}
} }
// //

View File

@ -79,7 +79,7 @@
ref="detailTableRef" :columnsList="detailColumnsList" :request-api="getBidListAPI" ref="detailTableRef" :columnsList="detailColumnsList" :request-api="getBidListAPI"
:sendParams="sendParams" :handleColWidth="180" :isRadioShow="true" :sendParams="sendParams" :handleColWidth="180" :isRadioShow="true"
@radio-change="handleRadioChange" :indexNumShow="false" :isShowtableCardStyle="false" @radio-change="handleRadioChange" :indexNumShow="false" :isShowtableCardStyle="false"
:radioKey="radioKey"> :radioKey="radioKey" :radioDisabledKey="radioDisabledKey">
<template slot="tableTitle"> <template slot="tableTitle">
<div class="card-header"> <div class="card-header">
<img src="@/assets/enterpriseLibrary/basic-info.png" alt="标的信息"> <img src="@/assets/enterpriseLibrary/basic-info.png" alt="标的信息">
@ -174,6 +174,7 @@ export default {
dialogVisible: false, dialogVisible: false,
fileData: {}, fileData: {},
radioKey: 'bidId', radioKey: 'bidId',
radioDisabledKey: 'parsingState',
} }
}, },
@ -245,6 +246,10 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.fileData = {} this.fileData = {}
}, },
handleReuslt(res) {
this.$modal.msgSuccess(res.msg)
this.handleClose()
},
// //
handleClose() { handleClose() {
let obj = { path: "/analysis" } let obj = { path: "/analysis" }
@ -300,11 +305,13 @@ export default {
bidId: this.selectedRow.bidId, bidId: this.selectedRow.bidId,
proId: this.proId, proId: this.proId,
uploadType: this.uploadType, uploadType: this.uploadType,
allFiles: [ allFiles: Object.keys(data)
...data.fileList.map((file) => .filter(key => key.startsWith('fileList'))
JSON.parse(JSON.stringify(file)), .flatMap(key =>
(data[key] || []).map(file =>
JSON.parse(JSON.stringify(file))
)
), ),
],
delFiles: [...data.delFileList], delFiles: [...data.delFileList],
} }
@ -318,7 +325,9 @@ export default {
}) })
.filter((item) => item !== null) .filter((item) => item !== null)
formData.files = allFiles formData.files = allFiles
delete formData.fileList Object.keys(formData)
.filter(key => key.startsWith('fileList'))
.forEach(key => delete formData[key]);
delete formData.delFileList delete formData.delFileList
delete formData.allFiles delete formData.allFiles
// //

View File

@ -11,7 +11,8 @@
:columnsList="bidListColumnsList" :request-api="getBidListAPI" :sendParams="sendParams" :columnsList="bidListColumnsList" :request-api="getBidListAPI" :sendParams="sendParams"
:handleColWidth="200" :isShowtableCardStyle="false"> :handleColWidth="200" :isShowtableCardStyle="false">
<template slot="parsingState" slot-scope="{ data }"> <template slot="parsingState" slot-scope="{ data }">
<el-tag v-if="data.parsingState === '0'" type="info">解析中</el-tag> <el-tag v-if="!data.parsingState" type="info">待解析</el-tag>
<el-tag v-if="data.parsingState === '0'" type="warn">解析中</el-tag>
<el-tag v-else-if="data.parsingState === '1'" type="success">解析成功</el-tag> <el-tag v-else-if="data.parsingState === '1'" type="success">解析成功</el-tag>
<el-tag v-else-if="data.parsingState === '2'" type="danger">解析失败</el-tag> <el-tag v-else-if="data.parsingState === '2'" type="danger">解析失败</el-tag>
</template> </template>