|
|
@@ -1,6 +1,7 @@
|
|
|
import request from '@/api'
|
|
|
import { CascaderOption } from 'element-plus'
|
|
|
import { usePlanStore } from '@/store/modules/plan.store'
|
|
|
+import { useUserStore } from '@/store/modules/user'
|
|
|
|
|
|
export interface OptionItem {
|
|
|
value: string
|
|
|
@@ -23,6 +24,8 @@ export interface StudentItem {
|
|
|
}
|
|
|
|
|
|
export const usePlanOptions = () => {
|
|
|
+ const { getUserType } = toRefs(useUserStore())
|
|
|
+ const planStore = usePlanStore()
|
|
|
// 培训计划选项
|
|
|
const planActive = ref<string[]>([])
|
|
|
const planDate = ref<PlanItem[]>([])
|
|
|
@@ -51,9 +54,13 @@ export const usePlanOptions = () => {
|
|
|
children: item.PlanInfo?.map((plan) => ({ value: plan.JXJHID || '', label: plan.KMMC || '' })) || []
|
|
|
}))
|
|
|
})
|
|
|
+ const planId = computed(() => {
|
|
|
+ if (planActive.value.length < 2) return ''
|
|
|
+ return planActive.value[1] || ''
|
|
|
+ })
|
|
|
|
|
|
- // // 学员列表
|
|
|
- const studentActive = ref<string>('')
|
|
|
+ // 学员列表
|
|
|
+ const studentActive = ref<string>(getUserType.value === 2 ? '' : '1001')
|
|
|
const studentData = ref<StudentItem[]>([])
|
|
|
const getStudentOptions = async () => {
|
|
|
console.log(planActive.value)
|
|
|
@@ -75,7 +82,7 @@ export const usePlanOptions = () => {
|
|
|
}))
|
|
|
})
|
|
|
// 监听培训计划选项变化,更新学员列表
|
|
|
- const planStore = usePlanStore()
|
|
|
+
|
|
|
watch(planActive, (newVal) => {
|
|
|
if (newVal.length > 1) {
|
|
|
planStore.updatePlan(newVal[1], '', newVal[0])
|
|
|
@@ -91,8 +98,10 @@ export const usePlanOptions = () => {
|
|
|
})
|
|
|
|
|
|
return {
|
|
|
+ getUserType,
|
|
|
planActive,
|
|
|
planOptions,
|
|
|
+ planId,
|
|
|
studentActive,
|
|
|
studentOptions
|
|
|
}
|