|
|
|
@ -65,7 +65,7 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span v-if="item.id === 'totalBook'" class="middle-unit">册</span> |
|
|
|
<span v-if="item.id === 'fansNum'" class="middle-unit">人</span> |
|
|
|
<span v-if="item.id === 'fansNum'" class="middle-unit">册</span> |
|
|
|
<span v-if="item.id === 'cardNum'" class="middle-unit">个</span> |
|
|
|
<span v-if="item.id === 'lendingNum'" class="middle-unit">册</span> |
|
|
|
</div> |
|
|
|
@ -134,7 +134,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchInitSetting, FetchUsertotal, FetchLibBookTotal, FetchHotSearch, FetchFansCount, FetchLendingTotal, FetchNewBook, FetchMarcByISBN } from '@/api/library' |
|
|
|
// FetchFansCount |
|
|
|
import { FetchInitSetting, FetchInitIntoNum, FetchUsertotal, FetchLibBookTotal, FetchHotSearch, FetchLendingTotal, FetchNewBook, FetchMarcByISBN } from '@/api/library' |
|
|
|
export default { |
|
|
|
name: 'PageOne', |
|
|
|
data() { |
|
|
|
@ -255,9 +256,52 @@ export default { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
this.pageOneVisitBase = result.visitBase |
|
|
|
this.wecharQrCodeSrc = linkSrc + '/downloadFile' + result.wecharQrCode |
|
|
|
this.initLeftPreview(result) |
|
|
|
// this.initLeftPreview(result) |
|
|
|
this.initIntoNum() |
|
|
|
}) |
|
|
|
}, |
|
|
|
initIntoNum() { |
|
|
|
// 初始化数据,使用更语义化的变量名 |
|
|
|
this.progressData = [] |
|
|
|
this.leftData = [] |
|
|
|
|
|
|
|
FetchInitIntoNum() |
|
|
|
.then(res => { |
|
|
|
console.log('InitIntoNum response:', res) |
|
|
|
const result = res?.data || {} |
|
|
|
|
|
|
|
const progressDataConfig = [ |
|
|
|
{ name: '今日出馆', key: 'dayOutNUm', type: 3 }, |
|
|
|
{ name: '本月到馆', key: 'monthPeopleNum', type: 2 }, |
|
|
|
{ name: '本年到馆', key: 'historyPeopleNum', type: 1 } |
|
|
|
] |
|
|
|
|
|
|
|
this.progressData = progressDataConfig.map(item => ({ |
|
|
|
name: item.name, |
|
|
|
value: result[item.key] || 0, |
|
|
|
type: item.type |
|
|
|
})) |
|
|
|
|
|
|
|
// 处理今日到馆数据,抽离变量提高可读性 |
|
|
|
const dayPeopleNum = result.dayPeopleNum || 0 |
|
|
|
const formattedNum = this.$parent.formatter(dayPeopleNum) |
|
|
|
|
|
|
|
const newData = [{ |
|
|
|
id: 'totayTotal', |
|
|
|
name: '今日到馆', |
|
|
|
value: formattedNum, |
|
|
|
valueArr: formattedNum.split(''), |
|
|
|
timestamp: Date.now() |
|
|
|
}] |
|
|
|
|
|
|
|
// 更新数据 |
|
|
|
this.$set(this, 'leftData', newData) |
|
|
|
this.$parent.timedRefresh(this.leftData, 'left') |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
console.error('获取入馆数据失败:', error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
initLeftPreview(result) { |
|
|
|
this.progressData = [] |
|
|
|
this.leftData = [] |
|
|
|
@ -471,13 +515,13 @@ export default { |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'fansNum', |
|
|
|
name: '粉丝数量', |
|
|
|
name: '今日归还', |
|
|
|
value: fansNum, |
|
|
|
valueArr: this.$parent.formatter(fansNum).toString().split('') |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 'lendingNum', |
|
|
|
name: '累计借出', |
|
|
|
name: '今日借出', |
|
|
|
value: lendingTotal, |
|
|
|
valueArr: this.$parent.formatter(lendingTotal).toString().split('') |
|
|
|
} |
|
|
|
@ -532,7 +576,7 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
getUserTotal() { |
|
|
|
const libraries = ['1201'] |
|
|
|
const libraries = ['DWSF'] |
|
|
|
const getTotalPromises = libraries.map(libcode => this.getTotalForLibcode(libcode)) |
|
|
|
return Promise.all(getTotalPromises) |
|
|
|
.then(counts => counts.reduce((sum, count) => sum + parseInt(count, 10), 0)) |
|
|
|
@ -542,9 +586,23 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 粉丝数量 |
|
|
|
// getFansNum() { |
|
|
|
// return FetchFansCount().then(res => { |
|
|
|
// return res.data ? parseInt(res.data) : 0 |
|
|
|
// }).catch(error => { |
|
|
|
// console.error('Error', error) |
|
|
|
// return 0 |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
// 累计借出 |
|
|
|
getFansNum() { |
|
|
|
return FetchFansCount().then(res => { |
|
|
|
return res.data ? parseInt(res.data) : 0 |
|
|
|
return FetchLendingTotal().then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success & result.resultlist.length !== 0) { |
|
|
|
return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.HCC_DAY, 0) |
|
|
|
} else { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('Error', error) |
|
|
|
return 0 |
|
|
|
@ -555,7 +613,7 @@ export default { |
|
|
|
return FetchLendingTotal().then(res => { |
|
|
|
const result = JSON.parse(res.data) |
|
|
|
if (result.success & result.resultlist.length !== 0) { |
|
|
|
return result.resultlist.filter(item => item.LIBCODE !== '999').reduce((acc, obj) => acc + obj.JCC, 0) |
|
|
|
return result.resultlist.filter(item => item.LIBCODE === 'DWSF').reduce((acc, obj) => acc + obj.JCC_DAY, 0) |
|
|
|
} else { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|