qa-prevention-xgf-app/pages/eight_assignments/select_corp_info.vue

84 lines
1.8 KiB
Vue
Raw Normal View History

2024-06-25 18:01:18 +08:00
<template>
2024-07-08 17:59:08 +08:00
<view class="content">
<view class="card">
<u-radio-group v-model="select_corp" placement="column">
<u-radio :customStyle="{marginBottom: '20rpx'}" v-for="item in list" :key="item.CORPINFO_ID"
:label="item.NAME" :name="item.CORPINFO_ID">
</u-radio>
</u-radio-group>
<view class="button_placeholder"></view>
<view class="button">
<u-button type="primary" text="确定" @click="fnConfirm"></u-button>
</view>
</view>
</view>
2024-06-25 18:01:18 +08:00
</template>
<script>
2024-07-08 17:59:08 +08:00
import {
getCorpInfoList
} from '../../api'
2024-06-25 18:01:18 +08:00
2024-07-08 17:59:08 +08:00
export default {
data() {
return {
type: '',
list: [],
select_corp: ''
}
},
onLoad(options) {
this.type = options.type
this.fnGetData()
},
methods: {
async fnGetData() {
const resData = await getCorpInfoList()
this.list = resData.list.corpInfoDos
},
fnConfirm() {
if (!this.select_corp) {
uni.$u.toast('请选择作业分公司')
return;
}
const urlByTypeMap = {
'confinedSpace': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/confined_space/apply'
}
}
const url = urlByTypeMap[this.type][this.select_corp] ?? urlByTypeMap[this.type].default
let params = {}
for (let i = 0; i < this.list.length; i++) {
if (this.list[i].CORPINFO_ID === this.select_corp) {
params = {
CORPINFO_ID: this.list[i].CORPINFO_ID,
CORP_NAME: this.list[i].NAME,
type: this.type
}
break
}
}
uni.$u.route({
url,
type: 'redirect',
params
})
}
}
}
2024-06-25 18:01:18 +08:00
</script>
<style scoped lang="scss">
2024-07-08 17:59:08 +08:00
.button_placeholder {
height: 100rpx;
}
2024-06-25 18:01:18 +08:00
2024-07-08 17:59:08 +08:00
.button {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
2024-07-04 17:57:31 +08:00
</style>