|
@@ -8,7 +8,7 @@ class SummaryItem {
|
|
|
constructor(key, label, value) {
|
|
|
this.key = key
|
|
|
this.label = label
|
|
|
- this.value = value || '-' // 如果为空,默认值则改为'-'
|
|
|
+ this.value = value || '' // 如果为空,默认值则改为'-'
|
|
|
}
|
|
|
addKey(key, value) {
|
|
|
this[key] = value
|
|
@@ -28,7 +28,7 @@ class PersonTelSummaryItem extends SummaryItem {
|
|
|
|
|
|
class Unit {
|
|
|
constructor(name, id) {
|
|
|
- this.name = name || '-'
|
|
|
+ this.name = name || ''
|
|
|
this.id = id
|
|
|
}
|
|
|
}
|
|
@@ -146,8 +146,28 @@ class SummaryModel extends BaseModel {
|
|
|
// 中标单位
|
|
|
if (Array.isArray(summary.winnerInfos) && summary.winnerInfos.length > 0) {
|
|
|
const winnerList = []
|
|
|
- summary.winnerInfos.forEach((w, index) => {
|
|
|
- const summaryWinner = new SummaryItem('winner', '中标单位', w.winner)
|
|
|
+ const winnerSummaryList = []
|
|
|
+ // 列表中是否有中标候选人
|
|
|
+ let hasWaitWinner = false
|
|
|
+ const winnerInfos = summary.winnerInfos
|
|
|
+ let circularList = []
|
|
|
+ const waitWinnerList = winnerInfos.filter((w) => w.isCandidate)
|
|
|
+ if (Array.isArray(waitWinnerList) && waitWinnerList.length > 0) {
|
|
|
+ // 有中标候选人,则循环中标候选人
|
|
|
+ hasWaitWinner = true
|
|
|
+ circularList = waitWinnerList.slice(0, 1)
|
|
|
+ } else {
|
|
|
+ // 无中标候选人,则循环原始数据
|
|
|
+ circularList = winnerInfos
|
|
|
+ }
|
|
|
+
|
|
|
+ for (let i = 0; i < circularList.length; i++) {
|
|
|
+ const w = circularList[i]
|
|
|
+ const index = i
|
|
|
+ // 有中标候选人,则“中标单位”文案修改为”中标候选人“,仅展示排名第1的中标候选人,其他候选人不展示;
|
|
|
+ const labelText = hasWaitWinner ? '中标候选人' : '中标单位';
|
|
|
+
|
|
|
+ const summaryWinner = new SummaryItem('winner', labelText, w.winner)
|
|
|
// 是否可跳转
|
|
|
summaryWinner.addKey('link', !!w.winnerId)
|
|
|
summaryWinner.addKey('id', w.winnerId)
|
|
@@ -172,7 +192,7 @@ class SummaryModel extends BaseModel {
|
|
|
personTel: winnerContactInfo
|
|
|
})
|
|
|
)
|
|
|
- })
|
|
|
+ }
|
|
|
|
|
|
result.winners = winnerList
|
|
|
}
|