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

112 lines
2.9 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 = {
'confinedSpace': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/confined_space/apply'
},
'blindBoard': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/blind_board/apply'
},
'breakGround': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/break_ground/apply'
},
'highWork': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/high_work/apply'
},
'hoisting': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/hoisting/apply'
},
'electricity': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/electricity/apply'
},
'cutRoad': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/cut_road/apply'
},
'hotWork': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/hot_work/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
})
}
}
}
</script>
<style scoped lang="scss">
.button_placeholder {
height: 100rpx;
}
.button {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
</style>