首页接口调试

This commit is contained in:
BianLzhaoMin 2025-03-25 18:34:37 +08:00
parent b478fa87e9
commit 233684f22b
4 changed files with 65 additions and 13 deletions

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 获取卡片列表信息 // 获取卡片列表信息
export const getCardListApi = data => { export const getCardListApi = data => {
return request({ return request({
url: '/***', url: '/material/mainPage/demandAndSupply',
method: 'get', method: 'get',
params: data params: data
}) })

View File

@ -4,7 +4,7 @@
<svg-icon :icon-class="iconType" class="icon-box" /> <svg-icon :icon-class="iconType" class="icon-box" />
</div> </div>
<div class="right-text"> <div class="right-text">
<div>200</div> <div>{{ cardNum }}</div>
<div>{{ cardTitle }}</div> <div>{{ cardTitle }}</div>
</div> </div>
</div> </div>
@ -24,6 +24,11 @@ export default {
iconType: { iconType: {
type: String, type: String,
default: 'project_num' default: 'project_num'
},
//
cardNum: {
type: Number,
default: 0
} }
} }
} }

View File

@ -4,9 +4,9 @@
<svg-icon :icon-class="iconType" class="icon-box" /> <svg-icon :icon-class="iconType" class="icon-box" />
{{ cardTitle }} {{ cardTitle }}
</div> </div>
<div class="f-count">2000.00</div> <div class="f-count">{{ cardNum }}</div>
<div class="f-14"> <div class="f-14">
较上月降低15.95 较上月{{ isReduce ? '增高' : '降低' }}{{ ratio }}%
<svg-icon v-if="isReduce" icon-class="down_arrow" /> <svg-icon v-if="isReduce" icon-class="down_arrow" />
<svg-icon v-else icon-class="up_arrow" /> <svg-icon v-else icon-class="up_arrow" />
@ -36,6 +36,16 @@ export default {
isReduce: { isReduce: {
type: Boolean, type: Boolean,
default: true default: true
},
//
cardNum: {
type: Number,
default: 0
},
//
ratio: {
type: Number,
default: 0
} }
}, },

View File

@ -12,7 +12,7 @@
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
value-format="yyyy-M" value-format="yyyy-MM-DD"
style="width: 95%" style="width: 95%"
/> />
</el-form-item> </el-form-item>
@ -64,8 +64,10 @@
<div class="card-box-content-1"> <div class="card-box-content-1">
<div v-for="(card, index) in cardList_1" :key="index"> <div v-for="(card, index) in cardList_1" :key="index">
<CardModel <CardModel
:ratio="card.ratio"
:theme="card.theme" :theme="card.theme"
:iconType="card.icon" :iconType="card.icon"
:cardNum="card.cardNum"
:cardTitle="card.title" :cardTitle="card.title"
:isReduce="card.isReduce" :isReduce="card.isReduce"
@onOpenLevelTwoPages="onOpenLevelTwoPages" @onOpenLevelTwoPages="onOpenLevelTwoPages"
@ -77,6 +79,7 @@
:theme="card.theme" :theme="card.theme"
:iconType="card.icon" :iconType="card.icon"
:cardTitle="card.title" :cardTitle="card.title"
:cardNum="card.cardNum"
v-for="(card, index) in cardList_3" v-for="(card, index) in cardList_3"
/> />
</div> </div>
@ -154,19 +157,25 @@ export default {
title: '需求量', title: '需求量',
theme: '#ffa94c', theme: '#ffa94c',
icon: 'demand_count', icon: 'demand_count',
isReduce: false isReduce: false,
cardNum: 0,
ratio: 0
}, },
{ {
title: '已供应量', title: '已供应量',
theme: '#027db4', theme: '#027db4',
icon: 'supply_ready', icon: 'supply_ready',
isReduce: false isReduce: false,
cardNum: 0,
ratio: 0
}, },
{ {
title: '待供应量', title: '待供应量',
theme: '#fb6260', theme: '#fb6260',
icon: 'supply_to_be', icon: 'supply_to_be',
isReduce: true isReduce: true,
cardNum: 0,
ratio: 0
} }
], ],
cardList_2: [ cardList_2: [
@ -205,17 +214,20 @@ export default {
{ {
title: '工程总数量(个)', title: '工程总数量(个)',
theme: '#ffa94c', theme: '#ffa94c',
icon: 'project_num' icon: 'project_num',
cardNum: 0
}, },
{ {
title: '供应总件数(件)', title: '供应总件数(件)',
theme: '#52c1f5', theme: '#52c1f5',
icon: 'quantity_num' icon: 'quantity_num',
cardNum: 0
}, },
{ {
title: '供应总价值(万元)', title: '供应总价值(万元)',
theme: '#73a0fa', theme: '#73a0fa',
icon: 'total_price' icon: 'total_price',
cardNum: 0
} }
], ],
@ -248,7 +260,32 @@ export default {
startTime: this.queryDate && this.queryDate.length > 0 ? this.queryDate[0] : '', startTime: this.queryDate && this.queryDate.length > 0 ? this.queryDate[0] : '',
endTime: this.queryDate && this.queryDate.length > 0 ? this.queryDate[1] : '' endTime: this.queryDate && this.queryDate.length > 0 ? this.queryDate[1] : ''
} }
const res = await getCardListApi() const { data: res } = await getCardListApi(queryParams)
const {
demandNum,
demandIncrease,
suppliedQuantityNum,
suppliedQuantityIncrease,
suppliedToBeQuantityNum,
suppliedToBeQuantityIncrease,
projectNum,
suppliedQuantityAllNum,
suppliedQuantityPrice
} = res
this.cardList_1[0].cardNum = demandNum
this.cardList_1[0].ratio = demandIncrease
demandIncrease > 0 ? (this.cardList_1[0].isReduce = true) : (this.cardList_1[0].isReduce = false)
this.cardList_1[1].cardNum = suppliedQuantityNum
this.cardList_1[1].ratio = suppliedQuantityIncrease
suppliedQuantityIncrease > 0 ? (this.cardList_1[1].isReduce = true) : (this.cardList_1[1].isReduce = false)
this.cardList_1[2].cardNum = suppliedToBeQuantityNum
this.cardList_1[2].ratio = suppliedToBeQuantityIncrease
suppliedToBeQuantityIncrease > 0
? (this.cardList_1[2].isReduce = true)
: (this.cardList_1[2].isReduce = false)
this.cardList_3[0].cardNum = projectNum
this.cardList_3[1].cardNum = suppliedQuantityAllNum || 0
this.cardList_3[2].cardNum = suppliedQuantityPrice || 0
console.log(res, '--') console.log(res, '--')
}, },
// //
@ -260,7 +297,7 @@ export default {
}, },
// //
onHandleSearch() { onHandleSearch() {
console.log('this.queryParams', this.queryParams) this.getCardListFun()
}, },
// //
onHandleReset() { onHandleReset() {