招标解析

This commit is contained in:
cwchen 2025-11-28 13:55:16 +08:00
parent c6fef5519c
commit cd327898f5
3 changed files with 94 additions and 22 deletions

View File

@ -78,7 +78,11 @@
v-if="selectionShow && isSelectShow" />
<el-table-column width="45" align="center" label="" v-if="isRadioShow">
<template slot-scope="scope">
<el-radio :label="getRowUniqueId(scope.row)" v-model="currentRowId">
<el-radio
:label="getRowUniqueId(scope.row, scope.$index)"
v-model="currentRowId"
@change="handleRadioChange(scope.row, scope.$index)"
>
<span></span>
</el-radio>
</template>
@ -194,6 +198,11 @@ export default {
type: Boolean,
default: false,
},
// 'id', 'proId', 'bidId'
radioKey: {
type: String,
default: 'id',
},
// 使
testTableList: {
type: Array,
@ -429,10 +438,17 @@ export default {
this.total = res.total
//
if (this.isRadioShow && this.currentRowId) {
const exists = this.tableList.some(
(row) =>
this.getRowUniqueId(row) === this.currentRowId,
)
let exists = false
for (let i = 0; i < this.tableList.length; i++) {
const row = this.tableList[i]
const uniqueId = this.getRowUniqueId(row, i)
if (uniqueId === this.currentRowId) {
exists = true
//
this.currentRowData = row
break
}
}
if (!exists) {
this.currentRowId = null
this.currentRowData = null
@ -546,16 +562,62 @@ export default {
this.selectedData = e
},
// 使id使
getRowUniqueId(row) {
return row.id || row.proId || row.bidId || JSON.stringify(row)
// 使 radioKey
getRowUniqueId(row, index) {
// 使 radioKey
if (this.radioKey && row[this.radioKey] !== undefined && row[this.radioKey] !== null && row[this.radioKey] !== '') {
return String(row[this.radioKey])
}
// radioKey 使ID
if (row.id !== undefined && row.id !== null && row.id !== '') {
return String(row.id)
}
if (row.proId !== undefined && row.proId !== null && row.proId !== '') {
return String(row.proId)
}
if (row.bidId !== undefined && row.bidId !== null && row.bidId !== '') {
return String(row.bidId)
}
// 使
// ID使
const rowIndex = index !== undefined ? index : this.tableList.findIndex(r => r === row)
// 使
try {
const rowStr = JSON.stringify(row)
//
let hash = 0
for (let i = 0; i < rowStr.length; i++) {
const char = rowStr.charCodeAt(i)
hash = ((hash << 5) - hash) + char
hash = hash & hash // Convert to 32bit integer
}
return `hash_${Math.abs(hash)}_${rowIndex}`
} catch (e) {
// 使
return `index_${rowIndex}`
}
},
//
handleRadioChange(row, index) {
if (this.isRadioShow && row) {
const uniqueId = this.getRowUniqueId(row, index)
//
if (this.currentRowId !== uniqueId) {
this.currentRowId = uniqueId
this.currentRowData = row
// emit watch
}
}
},
//
handleCurrentChange(currentRow) {
if (this.isRadioShow && currentRow) {
this.currentRowId = this.getRowUniqueId(currentRow)
const index = this.tableList.findIndex(r => r === currentRow)
const uniqueId = this.getRowUniqueId(currentRow, index)
this.currentRowId = uniqueId
this.currentRowData = currentRow
}
},
@ -613,12 +675,21 @@ export default {
//
currentRowId(newVal, oldVal) {
if (this.isRadioShow && newVal && newVal !== oldVal) {
//
const row = this.tableList.find(r => this.getRowUniqueId(r) === newVal)
if (row) {
const index = this.tableList.findIndex(r => this.getRowUniqueId(r) === newVal)
this.currentRowData = row
this.$emit('radio-change', row, index)
//
let foundRow = null
let foundIndex = -1
for (let i = 0; i < this.tableList.length; i++) {
const row = this.tableList[i]
const uniqueId = this.getRowUniqueId(row, i)
if (uniqueId === newVal) {
foundRow = row
foundIndex = i
break
}
}
if (foundRow) {
this.currentRowData = foundRow
this.$emit('radio-change', foundRow, foundIndex)
}
}
},

View File

@ -78,7 +78,7 @@
<TableModel :showSearch="false" :showOperation="false" :showRightTools="false"
ref="detailTableRef" :columnsList="detailColumnsList" :request-api="getBidListAPI"
:sendParams="sendParams" :handleColWidth="180" :isRadioShow="true"
@radio-change="handleRadioChange" :indexNumShow="false" :isShowtableCardStyle="false">
@radio-change="handleRadioChange" :indexNumShow="false" :isShowtableCardStyle="false" :radioKey="radioKey">
<template slot="tableTitle">
<div class="card-header">
<img src="@/assets/enterpriseLibrary/basic-info.png" alt="标的信息">
@ -171,7 +171,8 @@ export default {
},
rules: {},
dialogVisible:false,
fileData:{}
fileData:{},
radioKey: 'bidId',
}
},

View File

@ -10,16 +10,16 @@
<template slot="tableActions">
<el-button @click="handleAdd" v-hasPermi="['analysis:analysis:add']" class="add-btn"><i
class="el-icon-plus"></i> 新建项目</el-button>
<el-button @click="handleOnlyOffice">预览文档</el-button>
<!-- <el-button @click="handleOnlyOffice">预览文档</el-button>
<el-button @click="handleDocumentSearch">文档搜索功能</el-button>
<el-button @click="handleDocumentSearchWord">Word文档搜索功能</el-button>
<el-button @click="handleDocumentExcel">Excel文档查看</el-button>
<el-button @click="handleTestMQ">测试MQ</el-button>
<el-button @click="handleTestMQ">测试MQ</el-button> -->
</template>
<template slot="analysisStatus" slot-scope="{ data }">
<el-tag v-if="data.analysisStatus === 0" type="info">解析中</el-tag>
<el-tag v-else-if="data.analysisStatus === 1" type="success">解析成功</el-tag>
<el-tag v-else-if="data.analysisStatus === 2" type="danger">解析失败</el-tag>
<el-tag v-if="data.analysisStatus === '0'" type="info">解析中</el-tag>
<el-tag v-else-if="data.analysisStatus === '1'" type="success">解析成功</el-tag>
<el-tag v-else-if="data.analysisStatus === '2'" type="danger">解析失败</el-tag>
</template>
<template slot="handle" slot-scope="{ data }">
<el-button type="text" v-hasPermi="['enterpriseLibrary:analysis:detail']" class="action-btn"