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

83 lines
1.7 KiB
Vue

<template>
<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>
</template>
<script>
import {
getCorpInfoList
} from '../../api'
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 = {
'confined_space': {
'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,
}
break
}
}
uni.$u.route({
url,
type: 'redirect',
params
})
}
}
}
</script>
<style scoped lang="scss">
.button_placeholder {
height: 100rpx;
}
.button {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
</style>