AuctionControlPage.vue
15.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<template>
<a-card class="tabs-card" :bordered="false" :tab-list="tabs" :active-tab-key="currentAuctionType" @tabChange="key => changeTab(key )">
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm" @onSearch="pageReload" @onReset="pageReset" :simpleFieldNum="4"/>
<div class="table-operations">
<a-radio-group class="state-radio-group mt-12" v-model:value="pagination.queryForm.auctionState" @change="pageReload">
<a-radio-button :value="null">{{ $t('common.all') }}</a-radio-button>
<a-radio-button v-for="item in auctionStates" :key="item" :value="item">
{{ $t('enum.auction.auctionState.' + item) }}({{ auctionStateCount[item] ?? 0 }})
</a-radio-button>
</a-radio-group>
</div>
<a-list :grid="{ gutter: 16, xs: 1, sm: 2, md: 2, lg: 3, xl: 3, xxl: 3 }" :loading="loading" :data-source="contents">
<template #footer>
<a-pagination style="float: right" v-model:current="pagination.pageIndex" :total="pagination.totalElements" @change="pageChange" v-model:page-size="pagination.pageSize"
:show-total="showTotal"/>
</template>
<template #renderItem="{ item }">
<a-list-item style="padding-bottom: 0;margin-bottom:4px">
<a-card class="control-card" size="default" :bordered="false">
<template #title>
<a-typography-text type="secondary">ID {{ item.auctionId }}</a-typography-text>
</template>
<template #extra>
<auction-state-tag :auction-state="item.auctionState"></auction-state-tag>
</template>
<h4>{{ item.auctionName }}</h4>
<a-typography-text type="secondary">
<CalendarOutlined/>
{{ item.auctionStartTime }}至 {{ item.auctionEndTime }}
</a-typography-text>
<a-flex class="mt-12 mb-8">
<a-tooltip :title="updateTime">
<a-progress class="mt-8 mb-8" :percent="item.auctionedCount*100/item.vehicleCount" stroke-color="#1956FE" trail-color="#B1C8FD" :show-info="false"/>
</a-tooltip>
<a-space align="center" style="min-width: 50px">
{{ item.auctionedCount }}/ {{ item.vehicleCount + '辆' }}
</a-space>
</a-flex>
<a-row :gutter="[10,10]">
<!-- <a-col :span="12">-->
<!-- <a-card size="small" :bordered="false" style="background-color: #ECF4FE">-->
<!-- <a-statistic :value="item.auctionedCount+'/'+item.vehicleCount" :precision="0" suffix="辆">-->
<!-- <template #title>-->
<!-- <LineChartOutlined/>-->
<!-- 拍卖进展-->
<!-- </template>-->
<!-- </a-statistic>-->
<!-- </a-card>-->
<!-- </a-col>-->
<a-col :span="8">
<a-card size="small" :bordered="false">
<a-tooltip :title="updateTime">
<a-statistic :value="item.accountCount" :precision="0" :value-style="statisticStyle">
<template #title>
<TeamOutlined/>
参拍人数
</template>
</a-statistic>
</a-tooltip>
</a-card>
</a-col>
<a-col :span="8">
<a-card size="small" :bordered="false">
<a-tooltip :title="updateTime">
<a-statistic :value="item.vehicleCount===0?0:(item.auctionedCount/ item.vehicleCount)*100" :precision="1" suffix="%" :value-style="statisticStyle">
<template #title>
<RiseOutlined/>
成交率
</template>
</a-statistic>
</a-tooltip>
</a-card>
</a-col>
<a-col :span="8">
<a-card size="small" :bordered="false">
<a-tooltip :title="updateTime">
<a-statistic :value="item.transactionVolume/10000" :precision="2" suffix="万" :value-style="statisticStyle">
<template #title>
<DollarOutlined/>
成交额
</template>
</a-statistic>
</a-tooltip>
</a-card>
</a-col>
</a-row>
<a-flex class="mt-16" justify="space-between">
<a-space>
<template v-if="item.auctionState==='WAIT_AUCTION'||item.auctionState==='PREVIEW'">
<router-link :to="{path:'/auction/view/control',query:{auctionId: item.auctionId }}">
<a-button type="link" size="small">
<template #icon>
<EyeOutlined class="mr-5"/>
</template>
详情
</a-button>
</router-link>
<router-link v-sec="'control_10'" v-if="item.auctionState==='WAIT_AUCTION'" :to="{path:'/auction/form',query:{id: item.auctionId,action:'edit'}}">
<a-button type="link" size="small">
<template #icon>
<EditOutlined class="mr-5"/>
</template>
编辑
</a-button>
</router-link>
</template>
<router-link v-sec="'control_1'" v-if="item.auctionState==='AUCTIONING'" :to="{ path:'/auction/view/control',query:{auctionId: item.auctionId}}">
<a-button type="link" size="small">
<template #icon>
<ToolOutlined class="mr-5"/>
</template>
拍卖管控
</a-button>
</router-link>
<template v-if="item.auctionState==='CLOSED'">
<router-link v-sec="'control_13'" :to="{path:'/auction/order',query:{auctionId: item.auctionId }}">
<a-button type="link" size="small">
<template #icon>
<AccountBookOutlined class="mr-5"/>
</template>
查看订单
</a-button>
</router-link>
<!-- <a-button v-sec="'control_14'" type="link" size="small">-->
<!-- <template #icon>-->
<!-- <LineChartOutlined class="mr-5"/>-->
<!-- </template>-->
<!-- 查看数据-->
<!-- </a-button>-->
</template>
</a-space>
<a-space>
<template v-if="item.auctionState==='WAIT_AUCTION'||item.auctionState==='PREVIEW'">
<a-button v-sec="'control_11'" type="link" danger size="small" @click="cancelAuction(item)">
<template #icon>
<StopOutlined class="mr-5"/>
</template>
取消
</a-button>
</template>
</a-space>
</a-flex>
</a-card>
</a-list-item>
</template>
</a-list>
</a-card>
</template>
<script lang="ts">
import {Component} from 'vue-facing-decorator';
import {PaginationComponent} from "@/components/PaginationComponent";
import {Auction} from "lib/src/entity/auction/entity/Auction";
import {Operator, Order} from "lib/src/core/page/Pagination";
import {AuctionController} from "@/api/AuctionController";
import {AuctionControl} from "lib/src/entity/auction/domain/AuctionControl";
import {convertToTree} from "@/common/chinaarea";
import {
AccountBookOutlined,
CalendarOutlined,
DollarOutlined,
EditOutlined,
EyeOutlined,
LineChartOutlined,
PlusSquareOutlined,
RiseOutlined,
SearchOutlined,
StopOutlined,
TeamOutlined,
ToolOutlined
} from "@ant-design/icons-vue";
import AuctionStateTag from "@/views/auction/auction/tag/AuctionStateTag.vue";
import {ModalService} from "@/components/ModalService";
import AuctionChangeCancel from "@/views/auction/control/change/AuctionChangeCancel.vue";
import dayjs from "dayjs";
@Component({
methods: {},
components: {
AuctionStateTag,
PlusSquareOutlined,
SearchOutlined,
LineChartOutlined,
RiseOutlined,
StopOutlined,
AccountBookOutlined,
ToolOutlined,
EyeOutlined,
EditOutlined,
TeamOutlined,
DollarOutlined,
CalendarOutlined
}
})
export default class AuctionControlPage extends PaginationComponent<AuctionControl> {
areaData = [];
currentAuctionType = 'LIGHT';
tabs = [{key: "LIGHT", tab: '明拍管理'}, {key: "DARK", tab: '暗拍管理'}];
auctionStates = ['WAIT_AUCTION', 'PREVIEW', 'AUCTIONING', 'CLOSED'];
auctionStateCount = {};
statisticStyle = {fontSize: '16px', fontWeight: 500};
intervalId: number;
updateTime = "";
/**
* 初始化配置
*/
created(): void {
this.areaData = convertToTree(false);
this.init(this.axios, AuctionController.PAGE_AUCTION_CONTROL);
this.buildQueryForm({
auctionName: [null, {label: '场次名称', field: 'auctionName', operator: Operator.like}],
auctionState: [this.$route.query.auctionState ?? null, {label: '拍场状态', field: 'auctionState', operator: Operator.eq, hidden: true}],
auctionDate: [null, {label: '拍卖日期', field: 'auctionDate', operator: Operator.dateBetween, type: 'date-range'}],
accountCount: [null, {label: '当前参拍人数', field: 'accountCount', fieldName2: 'accountCount1', type: 'number-range', operator: Operator.numberBetween}],
auctionedCount: [null, {label: '成交数量', field: 'auctionedCount', fieldName2: "auctionedCount1", type: 'number-range', min: 0, max: 100, step: 1, operator: Operator.numberBetween}],
transactionVolume: [null, {label: '实时成交额(元)', field: 'transactionVolume', fieldName2: "transactionVolume1", type: 'number-range', operator: Operator.numberBetween}],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pagination.addDefaultFilter('auctionType', this.currentAuctionType);
this.pageLoad().then(() => {
this.updateTime = '数据更新于' + dayjs().format('YYYY-MM-DD HH:mm:ss');
});
this.loadAuctionStateCount();
this.intervalId = setInterval(() => {
this.pageRefresh().then(res => {
this.updateTime = '数据更新于' + dayjs().format('YYYY-MM-DD HH:mm:ss');
});
}, 60000);
}
get contents(): AuctionControl[] {
return this.pagination.content;
}
unmounted(): void {
clearInterval(this.intervalId);
}
cancelAuction(auction: Auction): void {
const modal = ModalService.confirm({
title: '申请中止拍卖', component: AuctionChangeCancel, closable: true, appContext: this.$.appContext,
props: {
auction: auction
},
onOk: (component): void => {
component.submitForm();
},
emits: {
handleOk: (e) => {
modal.destroy();
this.pagination.refresh();
this.loadAuctionStateCount();
}
},
});
}
changeTab(key: string): void {
this.currentAuctionType = key;
this.pagination.addDefaultFilter('auctionType', this.currentAuctionType);
this.loadAuctionStateCount();
this.loading = true;
this.pagination.reload().then(res => {
this.loadAuctionStateCount();
}).finally(() => this.loading = false);
}
loadAuctionStateCount(): void {
AuctionController.getAuctionStateCountByType(this.axios, this.currentAuctionType).then(res => {
this.auctionStateCount = res.data;
});
}
percentFormat(item, percent, successPercent) {
return `${percent.toFixed(2)}%(${successPercent.toFixed(2)}%)`
}
showTotal(total, range) {
return this.$t('common.page_state', {start: range[0], end: range[1], total: total});
}
/**
* 当前分页状态
*/
// get listPageState(): unknown {
// return {
// current: this.pagination.pageIndex,
// pageSize: this.pagination.pageSize,
// total: this.pagination.totalElements,
// showSizeChanger: true,
// pageSizeOptions: ['10', '20', '30', '50', '100'],
// showQuickJumper: true,
// // @ts-ignore
// showTotal: (total, range) => this.$t('common.page_state', {start: range[0], end: range[1], total: total}),
// // change: (page: number, pageSize: number) => this.pageChange(page, pageSize),
// change: this.pageChange
// };
// }
}
</script>
<style scoped lang="less">
::v-deep(.ant-list .ant-list-item) {
padding: 12px 0;
}
</style>