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

83 lines
1.7 KiB
Vue
Raw Normal View History

2024-06-25 18:01:18 +08:00
<template>
<view class="content">
<view class="card">
2024-07-04 17:57:31 +08:00
<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">
2024-06-25 18:01:18 +08:00
</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
2024-07-04 17:57:31 +08:00
} from '../../api'
2024-06-25 18:01:18 +08:00
export default {
data() {
return {
type: '',
list: [],
2024-07-04 17:57:31 +08:00
select_corp: ''
2024-06-25 18:01:18 +08:00
}
},
onLoad(options) {
this.type = options.type
this.fnGetData()
},
methods: {
async fnGetData() {
const resData = await getCorpInfoList()
2024-07-04 17:57:31 +08:00
this.list = resData.list.corpInfoDos
2024-06-25 18:01:18 +08:00
},
fnConfirm() {
2024-07-04 17:57:31 +08:00
if (!this.select_corp) {
2024-06-25 18:01:18 +08:00
uni.$u.toast('请选择作业分公司')
return;
}
const urlByTypeMap = {
'confined_space': {
'035958e685cf4850bc40151c5e0617a6': '',
'default': '/pages/eight_assignments/confined_space/apply'
}
}
2024-07-04 17:57:31 +08:00
const url = urlByTypeMap[this.type][this.select_corp] ?? urlByTypeMap[this.type].default
2024-06-25 18:01:18 +08:00
let params = {}
for (let i = 0; i < this.list.length; i++) {
2024-07-04 17:57:31 +08:00
if (this.list[i].CORPINFO_ID === this.select_corp) {
2024-06-25 18:01:18 +08:00
params = {
CORPINFO_ID: this.list[i].CORPINFO_ID,
2024-07-04 17:57:31 +08:00
CORP_NAME: this.list[i].NAME,
2024-06-25 18:01:18 +08:00
}
break
}
}
uni.$u.route({
url,
type: 'redirect',
params
})
}
}
}
</script>
<style scoped lang="scss">
.button_placeholder {
2024-07-04 17:57:31 +08:00
height: 100rpx;
2024-06-25 18:01:18 +08:00
}
.button {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
2024-07-04 17:57:31 +08:00
</style>