You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

100 lines
2.6 KiB

<template>
<picker mode="multiSelector" :range="multiSelectorOptions" @columnchange="onPickerColumnChange" @change="handleSection">
<view class="form-select">选择</view>
</picker>
</template>
<script>
import { getProjectListApi, listSectionInfo } from '@/api/system/project'
export default {
props: {
projectId: {
type: String,
default: ''
},
},
data() {
return {
multiSelectorOptions: [['主项目', '项目标段']],
// 重大项目字典
projectOptions: [],
projectNameList: [],
// 面上项目字典
sectionOptions: [],
sectionNameList: [],
projectTypeText: '项目类型',
params: {
projectType: '',
isMajor: ''
},
projectType: '',
Query: {
pageNum: 1,
pageSize: 20,
data: {
proNo: null,
proCode: null,
},
},
params: {
sectionName: ''
},
}
},
mounted () {
this.getData()
},
methods: {
getData() {
this.Query.data.proNo = this.projectId
// this.Query.data.proCode = this.proCode
getProjectListApi(this.Query).then((res) => {
this.projectOptions = res.records
this.projectNameList = this.projectOptions.map(item => item.projectName)
this.multiSelectorOptions.push(this.projectNameList)
});
listSectionInfo(this.Query).then((res) => {
const sectionList = []
res.records.forEach(item => {
if (item) {
sectionList.push(item)
}
})
if (sectionList.length===0) {
this.multiSelectorOptions[0] = ['主项目']
return
}
this.sectionOptions = sectionList
this.sectionNameList = this.sectionOptions.map(item => item.sectionName)
});
},
onPickerColumnChange(event) {
const column = event.detail.column
const value = event.detail.value // 获取选择的值
if (column!==0) {
return
}
if (value === 0) {
this.multiSelectorOptions[1] = this.projectNameList
} else if (value === 1) {
this.multiSelectorOptions[1] = this.sectionNameList
}
},
handleSection(event) {
// 处理项目类型
const values = event.detail.value
if (values[0]===0) {
this.params.sectionName = this.projectOptions[values[1]].projectName
} else if (values[0]===1) {
this.params.sectionName = this.sectionOptions[values[1]].sectionName
}
this.$emit('trigge-method', this.params)
},
}
}
</script>
<style lang="scss" scoped>
</style>