Files
fini-ui/src/views/login/components/Select.vue
T

472 lines
14 KiB
Vue
Raw Normal View History

2023-04-13 23:31:04 +08:00
<template>
<div class="selectWrap" v-if="showSelect" @click="preVant">
<div class="box">
<div class="content">
2023-04-21 16:54:59 +08:00
<li>
<div class="word" @click="checkAll(1)">
{{ $t(i18n.global.t('home.title.All')) }}
<div class="check">
2023-04-23 16:31:24 +08:00
<el-icon v-if="checkedAll == 1">
<Check></Check>
</el-icon>
2023-04-21 16:54:59 +08:00
</div>
</div>
2023-04-23 16:31:24 +08:00
<div class="word" @click="checkAll(2)">{{ $t(i18n.global.t('home.title.None')) }}
2023-04-21 16:54:59 +08:00
<div class="check">
2023-04-23 16:31:24 +08:00
<el-icon v-if="checkedAll == 2">
<Check></Check>
</el-icon>
2023-04-21 16:54:59 +08:00
</div>
2023-04-23 16:31:24 +08:00
2023-04-21 16:54:59 +08:00
</div>
</li>
<div class="title">{{ $t(i18n.global.t('home.title.IPOStatus')) }}</div>
2023-04-13 23:31:04 +08:00
<li>
2023-04-23 16:31:24 +08:00
<div class="word" v-for="item in obj.ipoStatus" :key="item.key"
@click="checkOne(item.key, 'ipoStatus')">
2023-04-13 23:31:04 +08:00
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
2023-04-21 16:54:59 +08:00
<div class="title">{{ $t(i18n.global.t('home.title.TradingCurrency')) }}</div>
2023-04-13 23:31:04 +08:00
<li>
<div class="word" v-for="item in obj.tradingCurrency" :key="item.key"
2023-04-23 16:31:24 +08:00
@click="checkOne(item.key, 'tradingCurrency')">
2023-04-13 23:31:04 +08:00
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
2023-04-21 16:54:59 +08:00
<div class="title">{{ $t(i18n.global.t('home.title.OfferingType')) }}</div>
<li>
2023-04-23 16:31:24 +08:00
<div class="word" v-for="item in obj.offeringType" :key="item.key"
@click="checkOne(item.key, 'offeringType')">
2023-04-21 16:54:59 +08:00
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
<div class="title">{{ $t(i18n.global.t('home.title.SecuritiestobeListed')) }}</div>
<li>
2023-04-23 16:31:24 +08:00
<div class="word" v-for="item in obj.SecuritiestobeListed" :key="item.key"
@click="checkOne(item.key, 'SecuritiestobeListed')">
2023-04-21 16:54:59 +08:00
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
</li>
2023-04-23 16:31:24 +08:00
<!-- <div class="title">{{ $t(i18n.global.t('home.title.ListingPlatform')) }}</div>
2023-04-21 16:54:59 +08:00
<li>
2023-04-23 16:31:24 +08:00
<div class="word" v-for="item in obj.ListingPlatform" :key="item.key"
@click="checkOne(item.key, 'ListingPlatform')">
2023-04-21 16:54:59 +08:00
<div class="check">
<el-icon v-if="item.isSelcted">
<Check />
</el-icon>
</div>
<span>{{ item.value }}</span>
</div>
2023-04-23 16:31:24 +08:00
</li> -->
2023-04-13 23:31:04 +08:00
</div>
<div class="footer">
2023-04-21 16:54:59 +08:00
<button @click="confirm">{{ $t(i18n.global.t('home.title.APPLY')) }}</button>
2023-04-23 16:31:24 +08:00
<button @click="Cancel">{{ $t(i18n.global.t('home.title.Cancel')) }}</button>
2023-04-13 23:31:04 +08:00
</div>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "XSelect",
};
</script>
<script lang="ts" setup>
2023-04-28 14:33:16 +08:00
import { ref, defineExpose, reactive ,inject,onMounted} from 'vue';
2023-04-21 16:54:59 +08:00
import i18n from '@/locales'
import { getCurrentInstance } from 'vue'
2023-04-23 16:31:24 +08:00
import { getSelectList } from "@/api/reqIpo/ipo"
type keyType = 'ipoStatus' | 'tradingCurrency' | 'offeringType' | 'SecuritiestobeListed' | 'ListingPlatform'
type requestType = 'status' | 'trade_currency' | 'offer_type' | 'list_securities' | 'list_platform'
2023-04-21 16:54:59 +08:00
const { proxy } = (getCurrentInstance() as any)
2023-04-13 23:31:04 +08:00
const showSelect = ref(false)
2023-04-23 16:31:24 +08:00
const checkedAll = ref(0)
const selectCards=inject('selectCards') as Function
2023-04-28 14:33:16 +08:00
onMounted(()=>{
console.log('select组件挂载');
})
2023-04-23 16:31:24 +08:00
const confirm = async () => {
var keyArry = ['status', 'trade_currency', 'offer_type', 'list_securities', 'list_platform',]
var reqeustObj = {
status: [] as string[],
trade_currency: [] as string[],
offer_type: [] as string[],
list_securities: [] as string[],
list_platform: [] as string[],
}
Object.keys(obj).forEach((item: string, index: number) => {
obj[item as keyType].forEach((element: any) => {
if (element.isSelcted) {
reqeustObj[keyArry[index] as requestType].push(element.key as string)
}
})
})
const result = await getSelectList(reqeustObj)
console.log('result',result);
selectCards(result);
showSelect.value=false
}
const Cancel = () => {
2023-04-13 23:31:04 +08:00
showSelect.value = false;
2023-04-23 16:31:24 +08:00
2023-04-13 23:31:04 +08:00
}
const preVant = (e: any) => {
e.stopPropagation();
}
const obj = reactive({
ipoStatus: [{
2023-04-23 16:31:24 +08:00
key: "25",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.DealInitiated'),
2023-04-13 23:31:04 +08:00
isSelcted: false
},
{
2023-04-23 16:31:24 +08:00
key: "30",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.PublicOfferClosed'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-13 23:31:04 +08:00
}, {
2023-04-23 16:31:24 +08:00
key: "35",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.ApplicationValidated'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-13 23:31:04 +08:00
}, {
2023-04-23 16:31:24 +08:00
key: "45",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.AllotmentConfirmed'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
2023-04-23 16:31:24 +08:00
key: "50",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.MoneySettlement'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
key: 55,
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.AllocationConfirmed'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
2023-04-23 16:31:24 +08:00
key: "60",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.placingApproved'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
2023-04-23 16:31:24 +08:00
key: "65",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.AllotmentResultsApproved'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
2023-04-23 16:31:24 +08:00
key: "70",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.TradingStarted'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
2023-04-23 16:31:24 +08:00
key: "80",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.Suspended'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}, {
2023-04-23 16:31:24 +08:00
key: "90",
2023-04-21 16:54:59 +08:00
value: proxy.$t('home.Cancelled'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}],
tradingCurrency: [
{
key: 'HKD',
2023-04-23 16:31:24 +08:00
value: proxy.$t('home.HongKongDollar'),
2023-04-13 23:31:04 +08:00
isSelcted: false
},
{
key: 'CNY',
2023-04-23 16:31:24 +08:00
value: proxy.$t('home.ChineseYuan'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-13 23:31:04 +08:00
},
{
key: 'USD',
2023-04-23 16:31:24 +08:00
value: proxy.$t('home.UnitedStatesDollar'),
2023-04-13 23:31:04 +08:00
isSelcted: false
}
2023-04-21 16:54:59 +08:00
],
2023-04-23 16:31:24 +08:00
offeringType: [{
key: '1',
value: proxy.$t('ipo.TypeofListing.Globalofferplacingandpublicoffer'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}, {
key: '2',
value: proxy.$t('ipo.TypeofListing.Byplacingonly'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}, {
key: '3',
value: proxy.$t('ipo.TypeofListing.Bypublicofferonly'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}, {
key: '4',
value: proxy.$t('ipo.TypeofListing.Byintroduction'),
2023-04-21 16:54:59 +08:00
isSelcted: false
},
{
2023-04-23 16:31:24 +08:00
key: '5',
value: proxy.$t('ipo.TypeofListing.TransferfromGEM'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-21 16:54:59 +08:00
}
2023-04-23 16:31:24 +08:00
],
SecuritiestobeListed: [{
key: '1',
value: proxy.$t('ipo.TypeofListing.Ordinaryshares'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}, {
key: '2',
value: proxy.$t('ipo.TypeofListing.OrdinarysharesHshares'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}, {
key: '3',
value: proxy.$t('ipo.TypeofListing.OrdinarysharesconversionfromBtoHshares'),
isSelcted: false
}, {
key: '4',
value: proxy.$t('ipo.TypeofListing.Preferenceshares'),
2023-04-21 16:54:59 +08:00
isSelcted: false
},
{
2023-04-23 16:31:24 +08:00
key: '5',
value: proxy.$t('ipo.TypeofListing.RealEstateInvestmentTrust'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-21 16:54:59 +08:00
},
{
2023-04-23 16:31:24 +08:00
key: '6',
value: proxy.$t('ipo.TypeofListing.ExchangeTradedProduct'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-21 16:54:59 +08:00
},
{
2023-04-23 16:31:24 +08:00
key: '7',
value: proxy.$t('ipo.TypeofListing.DepositaryReceipts'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-21 16:54:59 +08:00
},
{
2023-04-23 16:31:24 +08:00
key: '8',
value: proxy.$t('ipo.TypeofListing.ShareStapledUnits'),
2023-04-28 14:33:16 +08:00
isSelcted: false
2023-04-21 16:54:59 +08:00
},
{
2023-04-23 16:31:24 +08:00
key: '99',
value: proxy.$t('ipo.TypeofListing.Other'),
2023-04-21 16:54:59 +08:00
isSelcted: false
}
2023-04-23 16:31:24 +08:00
],
ListingPlatform: [{
key: '1',
value: proxy.$t('home.Mainboard'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}, {
key: '2',
value: proxy.$t('home.GEM'),
2023-04-21 16:54:59 +08:00
isSelcted: false
2023-04-23 16:31:24 +08:00
}],
// ListingType: [{
// key: '1',
// value: proxy.$t('ipo.TypeofListing.Ordinaryshares'),
// isSelcted: false
// }, {
// key: '2',
// value: proxy.$t('ipo.TypeofListing.OrdinarysharesHshares'),
// isSelcted: false
// }, {
// key: '3',
// value: proxy.$t('ipo.TypeofListing.OrdinarysharesconversionfromBtoHshares'),
// isSelcted: false
// }, {
// key: '4',
// value: proxy.$t('ipo.TypeofListing.Preferenceshares'),
// isSelcted: false
// },
// {
// key: '5',
// value: proxy.$t('ipo.TypeofListing.RealEstateInvestmentTrust'),
2023-04-28 14:33:16 +08:00
// isSelcted: false
2023-04-23 16:31:24 +08:00
// },
// {
// key: '6',
// value: proxy.$t('ipo.TypeofListing.ExchangeTradedProduct'),
// isSelcted: true
// },
// {
// key: '7',
// value: proxy.$t('ipo.TypeofListing.DepositaryReceipts'),
// isSelcted: true
// },
// {
// key: '8',
// value: proxy.$t('ipo.TypeofListing.ShareStapledUnits'),
// isSelcted: true
// },
// {
// key: '99',
// value: proxy.$t('ipo.TypeofListing.Other'),
// isSelcted: false
// }
// ]
2023-04-13 23:31:04 +08:00
})
2023-04-23 16:31:24 +08:00
const checkOne = (key: number | string, objKey: keyType) => {
obj[objKey] = obj[objKey].map((item: any) => {
2023-04-13 23:31:04 +08:00
if (item.key == key) {
return { ...item, isSelcted: !item.isSelcted }
}
return item
})
}
2023-04-23 16:31:24 +08:00
const checkAll = (number: number) => {
if (checkedAll.value && checkedAll.value == number) {
checkedAll.value = 0;
} else {
checkedAll.value = number;
selectAll(number as 1 | 2)
2023-04-21 16:54:59 +08:00
}
}
2023-04-23 16:31:24 +08:00
function selectAll(all: 1 | 2) {
var boolean1 = all == 1 ? true : false;
Object.keys(obj).forEach((item: string) => {
obj[item as keyType] = obj[item as keyType].map(element => {
return { ...element, isSelcted: boolean1 } as any;
2023-04-21 16:54:59 +08:00
})
})
}
2023-04-13 23:31:04 +08:00
defineExpose({
showSelect
})
</script>
<style lang="scss" scoped>
.selectWrap {
width: 800px;
2023-04-28 14:33:16 +08:00
height: 620px;
2023-04-13 23:31:04 +08:00
background-color: #fff;
border-radius: 20px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
2023-04-28 14:33:16 +08:00
@media screen and (max-width: 768px){
width: 90vw;
height: 93vh;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow-y: scroll;
}
2023-04-13 23:31:04 +08:00
.box {
box-sizing: border-box;
padding: 10px 20px 20px 20px;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.content {
.title {
2023-04-21 16:54:59 +08:00
font-size: 18px;
color: #879db2;
2023-04-13 23:31:04 +08:00
margin-top: 10px;
2023-04-28 14:33:16 +08:00
// @media screen and (max-width: 768px){
// font-size: 12px;
// }
2023-04-13 23:31:04 +08:00
}
li {
display: flex;
font-size: 18px;
flex-wrap: wrap;
2023-04-28 14:33:16 +08:00
@media screen and (max-width: 768px){
flex-direction: column;
flex-wrap:nowrap;
//font-size: 12px;
width: fit-content;
}
2023-04-13 23:31:04 +08:00
.word {
margin-right: 10px;
margin-top: 5px;
border-radius: 20px;
// width: 50px;
height: 20px;
2023-04-21 16:54:59 +08:00
background-color: #eff1f4;
2023-04-13 23:31:04 +08:00
padding: 5px 15px 5px 10px;
2023-04-21 16:54:59 +08:00
color: #879db2;
2023-04-13 23:31:04 +08:00
display: flex;
justify-content: space-between;
cursor: pointer;
2023-04-28 14:33:16 +08:00
@media screen and (max-width: 768px){
height: fit-content;
width: fit-content;
}
&:hover {
background-color: #0F426F;
border-radius: 5px;
color: #fff;
}
2023-04-13 23:31:04 +08:00
.check {
width: 30px;
span {
line-height: 35px;
2023-04-28 14:33:16 +08:00
2023-04-13 23:31:04 +08:00
}
}
}
}
}
.footer {
display: flex;
flex-direction: row-reverse;
// margin-bottom: 20px;
button {
margin-right: 10px;
font-size: 18px;
border: none;
font-weight: 600;
background-color: #fff;
2023-04-21 16:54:59 +08:00
color: #557795;
2023-04-13 23:31:04 +08:00
padding: 10px 20px 10px 20px;
2023-04-28 14:33:16 +08:00
@media screen and (max-width: 768px){
margin:0;
// font-size: 12px;
}
2023-04-13 23:31:04 +08:00
&:hover {
background-color: #0F426F;
border-radius: 5px;
color: #fff;
}
}
}
}
2023-04-28 14:33:16 +08:00
2023-04-13 23:31:04 +08:00
</style>