|
@@ -1,5 +1,5 @@
|
|
|
-import BaseModel from '../../../core/base'
|
|
|
import { dateFormatter, formatMoney, splitMoney } from '@jy/util'
|
|
|
+import BaseModel from '../../../core/base'
|
|
|
|
|
|
/**
|
|
|
* 摘要 Item 基础类
|
|
@@ -47,15 +47,19 @@ class Buyer extends Unit {
|
|
|
constructor(name, id, { seoId, link }) {
|
|
|
super(name, id)
|
|
|
this.link = link
|
|
|
- this.type ='buyer'
|
|
|
+ this.type = 'buyer'
|
|
|
this.seoId = seoId || ''
|
|
|
}
|
|
|
}
|
|
|
class Winner extends Unit {
|
|
|
- constructor(name, id, { seoId, winnerPerson, winnerTel, link, isCandidate, personTel }) {
|
|
|
+ constructor(
|
|
|
+ name,
|
|
|
+ id,
|
|
|
+ { seoId, winnerPerson, winnerTel, link, isCandidate, personTel }
|
|
|
+ ) {
|
|
|
super(name, id)
|
|
|
|
|
|
- this.type ='winner'
|
|
|
+ this.type = 'winner'
|
|
|
this.seoId = seoId || ''
|
|
|
this.winnerPerson = winnerPerson || ''
|
|
|
this.winnerTel = winnerTel || ''
|
|
@@ -65,12 +69,7 @@ class Winner extends Unit {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
class SummaryModel extends BaseModel {
|
|
|
- constructor(config) {
|
|
|
- super(config)
|
|
|
- }
|
|
|
-
|
|
|
createModel() {
|
|
|
return {
|
|
|
// 是否超前项目
|
|
@@ -85,31 +84,31 @@ class SummaryModel extends BaseModel {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- formatModel(data, isInit = false) {
|
|
|
- const { baseInfo, abstract } = data
|
|
|
- const isProposed = this.isProposedCheck(baseInfo?.subType)
|
|
|
- const model = isProposed
|
|
|
- ? this.tranSummaryOfProposed(abstract.proposed, baseInfo)
|
|
|
- : this.tranSummaryOfDefault(abstract.default, baseInfo)
|
|
|
- model.isProposed = isProposed
|
|
|
+ formatModel(data) {
|
|
|
+ const model = this.getSummaryContentObject(data)
|
|
|
return model
|
|
|
}
|
|
|
|
|
|
getSummaryContentObject(data) {
|
|
|
const { baseInfo, abstract } = data
|
|
|
const isProposed = this.isProposedCheck(baseInfo?.subType)
|
|
|
- const model = isProposed ? abstract.proposed : abstract.default
|
|
|
+
|
|
|
+ const model = isProposed
|
|
|
+ ? this.tranSummaryOfProposed(abstract.proposed, baseInfo)
|
|
|
+ : this.tranSummaryOfDefault(abstract.default, baseInfo)
|
|
|
return model
|
|
|
}
|
|
|
|
|
|
isProposedCheck(type) {
|
|
|
- return type === '拟建' || type === '采购意向'
|
|
|
+ return type === '拟建'
|
|
|
+ // return type === '拟建' || type === '采购意向'
|
|
|
}
|
|
|
|
|
|
formatTime(time, fmt = 'yyyy-MM-dd') {
|
|
|
if (time) {
|
|
|
return dateFormatter(time * 1000, fmt)
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return time
|
|
|
}
|
|
|
}
|
|
@@ -121,9 +120,10 @@ class SummaryModel extends BaseModel {
|
|
|
formatTel(name, tel) {
|
|
|
if (name === 'freeView' || tel === 'freeView') {
|
|
|
return 'freeView'
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
const arr = [name, tel]
|
|
|
- return arr.filter((item) => !!item).join(' / ')
|
|
|
+ return arr.filter(item => !!item).join(' / ')
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -145,59 +145,91 @@ class SummaryModel extends BaseModel {
|
|
|
list.push(buyerInfo)
|
|
|
if (summary?.buyer) {
|
|
|
result.buyers.push(
|
|
|
- new Buyer(summary?.buyer, summary?.buyer, { seoId: baseInfo?.buyerSeoId, link: summary?.buyerPortraitShow })
|
|
|
+ new Buyer(summary?.buyer, summary?.buyer, {
|
|
|
+ seoId: baseInfo?.buyerSeoId,
|
|
|
+ link: summary?.buyerPortraitShow
|
|
|
+ })
|
|
|
)
|
|
|
}
|
|
|
|
|
|
// 采购人/联系电话
|
|
|
- const buyerContactInfoValue = this.formatTel(summary?.buyerPerson, summary?.buyerTel)
|
|
|
- const buyerContactInfo = new PersonTelSummaryItem('buyerContactInfo', '采购联系人/电话', buyerContactInfoValue, summary?.buyerTel, buyerInfo)
|
|
|
+ const buyerContactInfoValue = this.formatTel(
|
|
|
+ summary?.buyerPerson,
|
|
|
+ summary?.buyerTel
|
|
|
+ )
|
|
|
+ const buyerContactInfo = new PersonTelSummaryItem(
|
|
|
+ 'buyerContactInfo',
|
|
|
+ '采购联系人/电话',
|
|
|
+ buyerContactInfoValue,
|
|
|
+ summary?.buyerTel,
|
|
|
+ buyerInfo
|
|
|
+ )
|
|
|
list.push(buyerContactInfo)
|
|
|
|
|
|
// 招标代理机构
|
|
|
- list.push(
|
|
|
- new SummaryItem('agency', '招标代理机构', summary?.agency)
|
|
|
- )
|
|
|
+ list.push(new SummaryItem('agency', '招标代理机构', summary?.agency))
|
|
|
|
|
|
// 代理联系人
|
|
|
- const agencyContactInfoValue = this.formatTel(summary?.agencyPerson, summary?.agencyTel)
|
|
|
- const agencyContactInfo = new PersonTelSummaryItem('agencyContactInfo', '代理联系人/电话', agencyContactInfoValue, summary?.agencyTel)
|
|
|
+ const agencyContactInfoValue = this.formatTel(
|
|
|
+ summary?.agencyPerson,
|
|
|
+ summary?.agencyTel
|
|
|
+ )
|
|
|
+ const agencyContactInfo = new PersonTelSummaryItem(
|
|
|
+ 'agencyContactInfo',
|
|
|
+ '代理联系人/电话',
|
|
|
+ agencyContactInfoValue,
|
|
|
+ summary?.agencyTel
|
|
|
+ )
|
|
|
list.push(agencyContactInfo)
|
|
|
|
|
|
// 截止日期
|
|
|
if (IsSunPublishContent) {
|
|
|
list.push(
|
|
|
- new SummaryItem('signEndTime', '报名截止日期', this.formatTime(summary?.signEndTime, 'yyyy-MM-dd HH:mm'))
|
|
|
+ new SummaryItem(
|
|
|
+ 'signEndTime',
|
|
|
+ '报名截止日期',
|
|
|
+ this.formatTime(summary?.signEndTime, 'yyyy-MM-dd HH:mm')
|
|
|
+ )
|
|
|
)
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
list.push(
|
|
|
- new SummaryItem('signEndTime', '报名截止日期', this.formatTime(summary?.signEndTime))
|
|
|
+ new SummaryItem(
|
|
|
+ 'signEndTime',
|
|
|
+ '报名截止日期',
|
|
|
+ this.formatTime(summary?.signEndTime)
|
|
|
+ )
|
|
|
)
|
|
|
}
|
|
|
// 投标截止日期
|
|
|
if (IsSunPublishContent) {
|
|
|
// do something...
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
list.push(
|
|
|
- new SummaryItem('bidEndTime', '投标截止日期', this.formatTime(summary?.bidEndTime))
|
|
|
+ new SummaryItem(
|
|
|
+ 'bidEndTime',
|
|
|
+ '投标截止日期',
|
|
|
+ this.formatTime(summary?.bidEndTime)
|
|
|
+ )
|
|
|
)
|
|
|
}
|
|
|
-
|
|
|
|
|
|
// 中标单位
|
|
|
if (Array.isArray(summary.winnerInfos) && summary.winnerInfos.length > 0) {
|
|
|
const winnerList = []
|
|
|
- const winnerSummaryList = []
|
|
|
+ // const winnerSummaryList = []
|
|
|
// 列表中是否有中标候选人
|
|
|
let hasWaitWinner = false
|
|
|
const winnerInfos = summary.winnerInfos
|
|
|
let circularList = []
|
|
|
- const waitWinnerList = winnerInfos.filter((w) => w.isCandidate)
|
|
|
+ const waitWinnerList = winnerInfos.filter(w => w.isCandidate)
|
|
|
if (Array.isArray(waitWinnerList) && waitWinnerList.length > 0) {
|
|
|
// 有中标候选人,则循环中标候选人
|
|
|
hasWaitWinner = true
|
|
|
circularList = waitWinnerList.slice(0, 1)
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
// 无中标候选人,则循环原始数据
|
|
|
circularList = winnerInfos
|
|
|
}
|
|
@@ -206,7 +238,7 @@ class SummaryModel extends BaseModel {
|
|
|
const w = circularList[i]
|
|
|
const index = i
|
|
|
// 有中标候选人,则“中标单位”文案修改为”中标候选人“,仅展示排名第1的中标候选人,其他候选人不展示;
|
|
|
- const labelText = hasWaitWinner ? '中标候选人' : '中标单位';
|
|
|
+ const labelText = hasWaitWinner ? '中标候选人' : '中标单位'
|
|
|
|
|
|
const summaryWinner = new SummaryItem('winner', labelText, w.winner)
|
|
|
// 是否可跳转
|
|
@@ -214,7 +246,13 @@ class SummaryModel extends BaseModel {
|
|
|
summaryWinner.addKey('id', w.winnerId)
|
|
|
|
|
|
const wContactInfoValue = this.formatTel(w?.winnerPerson, w?.winnerTel)
|
|
|
- const winnerContactInfo = new PersonTelSummaryItem(`winnerContactInfo-${index}`, '中标联系人/电话', wContactInfoValue, w?.winnerTel, summaryWinner)
|
|
|
+ const winnerContactInfo = new PersonTelSummaryItem(
|
|
|
+ `winnerContactInfo-${index}`,
|
|
|
+ '中标联系人/电话',
|
|
|
+ wContactInfoValue,
|
|
|
+ w?.winnerTel,
|
|
|
+ summaryWinner
|
|
|
+ )
|
|
|
|
|
|
list.push(summaryWinner)
|
|
|
list.push(winnerContactInfo)
|
|
@@ -239,40 +277,38 @@ class SummaryModel extends BaseModel {
|
|
|
}
|
|
|
|
|
|
// 中标金额
|
|
|
- const bidAmountFormat = summary?.bidAmount ? this.formatMoney(summary?.bidAmount) : ''
|
|
|
+ const bidAmountFormat = summary?.bidAmount
|
|
|
+ ? this.formatMoney(summary?.bidAmount)
|
|
|
+ : ''
|
|
|
this.formatMoney()
|
|
|
- list.push(
|
|
|
- new SummaryItem('bidAmount', '中标金额(元)', bidAmountFormat)
|
|
|
- )
|
|
|
+ list.push(new SummaryItem('bidAmount', '中标金额(元)', bidAmountFormat))
|
|
|
|
|
|
// 项目地区
|
|
|
const pArea = baseInfo?.area || ''
|
|
|
const pCity = baseInfo?.city || ''
|
|
|
- const pDistrict = baseInfo?.district|| ''
|
|
|
+ const pDistrict = baseInfo?.district || ''
|
|
|
const projectArea = `${pArea}${pCity}${pDistrict}` || ''
|
|
|
- list.push(
|
|
|
- new SummaryItem('projectArea', '项目地区', projectArea)
|
|
|
- )
|
|
|
+ list.push(new SummaryItem('projectArea', '项目地区', projectArea))
|
|
|
|
|
|
// 交付地点
|
|
|
const jArea = summary?.deliverArea || ''
|
|
|
const jCity = summary?.deliverCity || ''
|
|
|
- const jDistrict = summary?.deliverDistrict|| ''
|
|
|
+ const jDistrict = summary?.deliverDistrict || ''
|
|
|
const jDetail = summary?.deliverDetail || ''
|
|
|
const jfArea = `${jArea}${jCity}${jDistrict}` || ''
|
|
|
- list.push(
|
|
|
- new SummaryItem('jfArea', '交付地点', `${jfArea}${jDetail}`)
|
|
|
- )
|
|
|
+ list.push(new SummaryItem('jfArea', '交付地点', `${jfArea}${jDetail}`))
|
|
|
|
|
|
- result.list = list.filter((s) => !!s.value)
|
|
|
+ result.list = list.filter(s => !!s.value)
|
|
|
result.originMap = summary
|
|
|
|
|
|
// 项目清单
|
|
|
result._s = summary
|
|
|
result.purchasingList = summary.purchasingList
|
|
|
if (Array.isArray(result.purchasingList)) {
|
|
|
- result.purchasingList = result.purchasingList.map(item => {
|
|
|
- const numberUnit = item.number ? `${item.number}${item.unitName || ''}` : ''
|
|
|
+ result.purchasingList = result.purchasingList.map((item) => {
|
|
|
+ const numberUnit = item.number
|
|
|
+ ? `${item.number}${item.unitName || ''}`
|
|
|
+ : ''
|
|
|
return {
|
|
|
...item,
|
|
|
numberUnit
|
|
@@ -284,9 +320,9 @@ class SummaryModel extends BaseModel {
|
|
|
|
|
|
tranSummaryOfProposed(summary, baseInfo = {}) {
|
|
|
const result = this.createModel()
|
|
|
- if (!summary) {
|
|
|
- return result
|
|
|
- }
|
|
|
+ // if (!summary) {
|
|
|
+ // return result
|
|
|
+ // }
|
|
|
|
|
|
const list = []
|
|
|
|
|
@@ -311,10 +347,16 @@ class SummaryModel extends BaseModel {
|
|
|
const label = summaryMap[key]
|
|
|
let s = null
|
|
|
if (key === 'buyerClass') {
|
|
|
- s = new SummaryItem(key, label, summary?.buyerClass === '其它' ? '' : summary?.buyerClass)
|
|
|
- } else if (key === 'totalInvestment') {
|
|
|
+ s = new SummaryItem(
|
|
|
+ key,
|
|
|
+ label,
|
|
|
+ summary?.buyerClass === '其它' ? '' : summary?.buyerClass
|
|
|
+ )
|
|
|
+ }
|
|
|
+ else if (key === 'totalInvestment') {
|
|
|
s = new SummaryItem(key, label, formatMoney(summary[key]))
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
s = new SummaryItem(key, label, summary[key] || '')
|
|
|
}
|
|
|
|
|
@@ -322,12 +364,17 @@ class SummaryModel extends BaseModel {
|
|
|
s.addKey('link', summary?.buyerPortraitShow) // 是否可进行跳转
|
|
|
if (summary?.buyer) {
|
|
|
result.buyers.push(
|
|
|
- new Buyer(summary?.buyer, summary?.buyer, { seoId: baseInfo?.buyerSeoId, link: summary?.buyerPortraitShow })
|
|
|
+ new Buyer(summary?.buyer, summary?.buyer, {
|
|
|
+ seoId: baseInfo?.buyerSeoId,
|
|
|
+ link: summary?.buyerPortraitShow
|
|
|
+ })
|
|
|
)
|
|
|
}
|
|
|
- } else if (key === 'address') {
|
|
|
+ }
|
|
|
+ else if (key === 'address') {
|
|
|
s.addKey('row', true)
|
|
|
- } else if (key === 'content') {
|
|
|
+ }
|
|
|
+ else if (key === 'content') {
|
|
|
s.addKey('row', true)
|
|
|
}
|
|
|
|