|
|
|
@ -208,7 +208,7 @@ export default { |
|
|
|
this.currentHover = (this.currentHover + 1) % this.rankingData.length |
|
|
|
}, 1000) |
|
|
|
} else { |
|
|
|
throw new Error('Failed' + libcode) |
|
|
|
throw new Error('Failed') |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
@ -237,7 +237,7 @@ export default { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success & result.resultlist.length !== 0) { |
|
|
|
// BZL_YEAR 本年办证人数 |
|
|
|
this.cardTotal = result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.BZL_YEAR, 0) |
|
|
|
this.cardTotal = result.resultlist.filter(item => item.LIBCODE === 'GD').reduce((acc, obj) => acc + obj.BZL_YEAR, 0) |
|
|
|
} else { |
|
|
|
this.cardTotal = 0 |
|
|
|
} |
|
|
|
@ -252,36 +252,61 @@ export default { |
|
|
|
'starttime': '2000-01-01', |
|
|
|
'endtime': '2034-01-01' |
|
|
|
} |
|
|
|
FetchLibBookTotal(params).then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success & result.resultlist.length !== 0) { |
|
|
|
// 目的拿到馆藏量 |
|
|
|
this.libALLNum = result.resultlist |
|
|
|
} else { |
|
|
|
this.libALLNum = [] |
|
|
|
} |
|
|
|
|
|
|
|
this.getUserTotal() |
|
|
|
.then(userTotals => { |
|
|
|
// 先初始化馆藏量数据,避免后续找不到对应属性 |
|
|
|
this.libALLNum = [] |
|
|
|
|
|
|
|
FetchLibBookTotal(params) |
|
|
|
.then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success && result.resultlist.length !== 0) { |
|
|
|
this.libALLNum = result.resultlist |
|
|
|
} |
|
|
|
return this.getUserTotal() |
|
|
|
}) |
|
|
|
.then(userTotals => { |
|
|
|
console.log('userTotal', userTotals) |
|
|
|
if (Array.isArray(userTotals) && userTotals.length > 0) { |
|
|
|
userTotals.forEach(userTotal => { |
|
|
|
const libCode = Object.keys(userTotal)[0] |
|
|
|
const count = userTotal[libCode] |
|
|
|
|
|
|
|
const foundItem = this.libALLNum.find(item => item.LIBCODE === libCode) |
|
|
|
|
|
|
|
if (foundItem) { |
|
|
|
foundItem.countCard = count |
|
|
|
} else { |
|
|
|
this.libALLNum.push({ |
|
|
|
LIBCODE: libCode, |
|
|
|
countCard: count |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.getLibcodeDetails() |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
this.getLibcodeDetails() |
|
|
|
}) |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
this.libALLNum = [] |
|
|
|
this.getLibcodeDetails() |
|
|
|
}) |
|
|
|
} |
|
|
|
// 执行后续逻辑 |
|
|
|
this.getLibcodeDetails() |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
// 即使接口报错,也执行 getUserTotal 保证 countCard 有值 |
|
|
|
this.getUserTotal() |
|
|
|
.then(userTotals => { |
|
|
|
console.log('userTotal (error case)', userTotals) |
|
|
|
if (Array.isArray(userTotals) && userTotals.length > 0) { |
|
|
|
userTotals.forEach(userTotal => { |
|
|
|
const libCode = Object.keys(userTotal)[0] |
|
|
|
const count = userTotal[libCode] |
|
|
|
this.libALLNum.push({ |
|
|
|
LIBCODE: libCode, |
|
|
|
countCard: count |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.getLibcodeDetails() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 左边办证量 |
|
|
|
getTotalForLibcode(libcode) { |
|
|
|
@ -304,7 +329,7 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
getUserTotal() { |
|
|
|
const libraries = ['DWSF'] |
|
|
|
const libraries = ['GD'] |
|
|
|
const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode)) |
|
|
|
return Promise.all(getTotalPromises) |
|
|
|
.then(results => { |
|
|
|
@ -321,11 +346,13 @@ export default { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.length !== 0) { |
|
|
|
const libCode = { |
|
|
|
'DWSF': [114.664064, 30.478882] |
|
|
|
'DWSF': [114.664064, 30.478882], |
|
|
|
'ZJWSF': [114.635376, 30.532215] |
|
|
|
} |
|
|
|
// console.log('this.libALLNum', this.libALLNum) |
|
|
|
const updatedLibraries = result.map(library => { |
|
|
|
const matchingData = this.libALLNum.find(item => item.LIBCODE === library.tcId) |
|
|
|
console.log('matchingData', matchingData) |
|
|
|
const gdData = this.libALLNum.find(item => item.LIBCODE === 'GD') |
|
|
|
if (matchingData) { |
|
|
|
return { |
|
|
|
...library, |
|
|
|
@ -337,10 +364,10 @@ export default { |
|
|
|
} else { |
|
|
|
return { |
|
|
|
...library, |
|
|
|
GCL: 0, |
|
|
|
GCL: 10000, |
|
|
|
sort: Object.keys(libCode).indexOf(library.tcId) + 1, |
|
|
|
coordinate: libCode[library.tcId], |
|
|
|
countCard: 0 |
|
|
|
countCard: gdData?.countCard || 0 |
|
|
|
} |
|
|
|
} |
|
|
|
}).sort((a, b) => a.sort - b.sort) |
|
|
|
@ -376,7 +403,7 @@ export default { |
|
|
|
mapImg.src = require('../../assets/images/map-bg2.png') |
|
|
|
var XAData = this.libInfoData.map(item => { |
|
|
|
return [ |
|
|
|
{ name: '葛店城市书房' }, |
|
|
|
{ name: '大湾城市书房' }, |
|
|
|
{ name: item.name, value: item.address } |
|
|
|
] |
|
|
|
}) |
|
|
|
@ -399,7 +426,7 @@ export default { |
|
|
|
} |
|
|
|
var series = []; |
|
|
|
[ |
|
|
|
['葛店城市书房', XAData] |
|
|
|
['大湾城市书房', XAData] |
|
|
|
].forEach(function(item, i) { |
|
|
|
series.push( |
|
|
|
{ |
|
|
|
|