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

93 lines
2.4 KiB
Vue
Raw Normal View History

2024-07-04 17:57:31 +08:00
<template>
<view>
<u-modal :show="modelShow" title="选择所属端" showCancelButton cancelText="返回" @cancel="fnModalCancel"
@confirm="fnModalConfirm">
<u-radio-group v-model="type" placement="column">
<u-radio :customStyle="{marginBottom: '8px'}" label="企业端" name="0"/>
<u-radio :customStyle="{marginBottom: '8px'}" label="监管端" name="1"/>
<u-radio :customStyle="{marginBottom: '8px'}" label="相关方端" name="2"/>
</u-radio-group>
</u-modal>
<next-tree
v-if="!modelShow"
uiMode="page"
ref="nextTreeRef"
checkStrictly
funcMode="radio"
selectParent
:ifSearch="false"
:treeData="treeData"
themeColor="#2a56f7"
page-height="92vh"
labelKey="DEPARTMENT_NAME"
valueKey="DEPARTMENT_ID"
childrenKey="nodes"
@change="fnTreeChange"
>
<template #fixedBottomBar>
<view style="padding: 20upx;margin-bottom: 20upx;">
<u-button type="primary" text="确定" @click="fnTreeConfirm"/>
</view>
</template>
</next-tree>
</view>
</template>
<script>
import {getDepartmentTree} from "@/api";
export default {
data() {
return {
modelShow: true,
type: '',
CORP_ID: '',
2024-07-04 17:58:10 +08:00
treeData: [],
treeSelectData: []
2024-07-04 17:57:31 +08:00
}
},
onLoad(query) {
this.CORP_ID = query.CORP_ID
},
methods: {
fnModalCancel() {
uni.navigateBack()
},
fnModalConfirm() {
if (!this.type) {
uni.$u.toast('请选择所属端')
return
}
this.modelShow = false
this.fnGetDepartmentTree()
},
async fnGetDepartmentTree() {
let CORP_ID = ''
if (this.type === '0') CORP_ID = this.CORP_ID
if (this.type === '2') CORP_ID = this.$store.getters.getUserInfo.CORPINFO_ID
let resData = await getDepartmentTree({TYPE: this.type, CORP_ID})
this.treeData = resData.tree.tree
},
2024-07-04 17:58:10 +08:00
fnTreeChange(event) {
2024-07-04 17:57:31 +08:00
this.treeSelectData = event
},
2024-07-04 17:58:10 +08:00
fnTreeConfirm() {
if (this.treeSelectData.length === 0) {
uni.$u.toast('请选择部门')
return
}
2024-07-04 17:57:31 +08:00
this.getOpenerEventChannel().emit("confirm", {
DEPARTMENT_NAME: this.treeSelectData[0].DEPARTMENT_NAME,
DEPARTMENT_ID: this.treeSelectData[0].DEPARTMENT_ID,
TYPE: this.type
});
uni.navigateBack();
}
},
}
</script>
<style scoped lang="scss">
</style>