Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc-auto-import.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
"watchWithFilter": true,
"whenever": true,
"DataTableColumns": true,
"useWorkPlatform": true
"useWorkPlatform": true,
"FormInst": true
}
}
2 changes: 1 addition & 1 deletion auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ declare global {
// @ts-ignore
export type { RouteRecordRaw, RouteLocationRaw, LocationQuery, NavigationFailure, RouteParams, RouteLocationNormalizedLoaded, RouteRecordName, NavigationGuard } from 'vue-router'
// @ts-ignore
export type { DataTableColumns } from 'naive-ui'
export type { DataTableColumns, FormInst } from 'naive-ui'
}
// for vue template auto import
import { UnwrapRef } from 'vue'
Expand Down
56 changes: 44 additions & 12 deletions src/modules/MemberTeam/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,38 @@ function getRandomValueFromArray<T>(arr: Array<T>): T {
return arr[randomIndex]
}



// 级别映射表
export const userRankMap = [
{
value: 'junior',
value: 'junior_development',
label: '初级开发',
type: 'info'
},
{
value: 'middle',
value: 'middle_development',
label: '中级开发',
type: 'success'
},
{
value: 'senior',
value: 'senior_development',
label: '高级开发',
type: 'error'
}
]

/**
* 查询目标【级别映射】
*/
export const findUserRankMapByRankName = (targetRank) => {
return userRankMap.find(
rankItem => rankItem.value === targetRank
)!
}



// 角色映射表
export const userRoleMap = [
{
Expand All @@ -50,30 +63,48 @@ export const userRoleMap = [
]

/**
* 查询目标【级别映射
* 查询目标【角色映射
*/
export const findUserRankMapByRankName = (targetRank) => {
return userRankMap.find(
rankItem => rankItem.value === targetRank
export const findUserRoleMapByRankName = (targetRole) => {
return userRoleMap.find(
roleItem => roleItem.value === targetRole
)!
}



// 状态映射表
export const userStatusMap = [
{
value: 1,
label: '活跃'
},
{
value: 0,
label: '停用'
}
]

/**
* 查询目标【角色映射
* 查询目标【状态映射
*/
export const findUserRoleMapByRankName = (targetRole) => {
return userRoleMap.find(
roleItem => roleItem.value === targetRole
export const findUserStatusMapByRankName = (targetStatus) => {
return userStatusMap.find(
statusItem => statusItem.value === targetStatus
)!
}



export interface TypeMemberPerson {
username: string
roleId: string
userId: string
email: string
phone: string
rank: string
// 1活跃, 0停用
memberStatus: number | null | undefined
}

/**
Expand All @@ -91,7 +122,8 @@ export const memberTeamList = Array.from({ length: 100 }).map((_, index) => {
roleId: roleItem.value,
rank: rankItem.value,
phone: 10000000000 + _index + '',
email: `${userId}@admin.com`
email: `${userId}@admin.com`,
memberStatus: Math.random() > 0.5 ? 0 : 1
} as TypeMemberPerson
})

Expand Down
10 changes: 2 additions & 8 deletions src/modules/MemberTeam/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const pagination = reactive({

const columns: DataTableColumns<TypeMemberPerson> = [
{
title: '姓名',
title: '成员名称',
key: 'username',
width: 80,
fixed: 'left'
Expand All @@ -67,7 +67,7 @@ const columns: DataTableColumns<TypeMemberPerson> = [
width: 60
},
{
title: '角色',
title: '项目角色',
key: 'roleId',
align: 'center',
width: 100,
Expand Down Expand Up @@ -112,12 +112,6 @@ const columns: DataTableColumns<TypeMemberPerson> = [
align: 'center',
width: 150
},
{
title: '手机号',
key: 'phone',
align: 'center',
width: 80
},
{
title: '操作列',
key: 'actions',
Expand Down
33 changes: 27 additions & 6 deletions src/modules/MemberTeam/pages/preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@
</template>

<script lang="ts" setup>
import { NSelect } from 'naive-ui'
import type { FormInst } from 'naive-ui'
import { NRadioGroup, NRadio, NSelect } from 'naive-ui'
import { sleep } from '@/utils/request'

import type { TypeMemberPerson } from '../data'
import { userRoleMap, userRankMap, findMemberInfoById } from '../data'
import { userRoleMap, userRankMap, findMemberInfoById, userStatusMap } from '../data'

/**
* MemberTeamPreview 成员管理-成员信息查看
Expand All @@ -73,7 +72,8 @@ const memberFormModel = ref<TypeMemberPerson>({
userId: '',
email: '',
rank: '',
phone: ''
phone: '',
memberStatus: null
})

const loadingForm = ref(true)
Expand All @@ -90,15 +90,15 @@ fetchMemberInfo()
const memberInfoMap = [
{
path: 'username',
label: '姓名'
label: '成员名称'
},
{
path: 'userId',
label: '工号'
},
{
path: 'roleId',
label: '角色',
label: '项目角色',
render: () => h(
NSelect,
{
Expand All @@ -118,6 +118,27 @@ const memberInfoMap = [
path: 'phone',
label: '手机号'
},
{
path: 'memberStatus',
label: '成员状态',
render: () => h(
NRadioGroup,
{
value: memberFormModel.value.memberStatus,
onUpdateValue (v) {
memberFormModel.value.memberStatus = v
}
},
() => userStatusMap.map(
(statusItem) => h(
NRadio,
{
...statusItem
}
)
)
)
},
{
path: 'rank',
label: '职级',
Expand Down
2 changes: 0 additions & 2 deletions src/modules/Project/components/ProjectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
</template>

<script lang="ts">
import { FormInst } from 'naive-ui'

export default defineComponent({
name: 'ProjectForm',
props: {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/UserAccount/components/ContainerLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

import { omit } from 'lodash-es'
import { isFunction } from '@/utils/type'
import { FormInst, lightTheme } from 'naive-ui'
import { lightTheme } from 'naive-ui'

const { theme, themeOverrides } = useTheme()

Expand Down
2 changes: 1 addition & 1 deletion src/modules/UserAccount/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import NavigationSideLogo from '@/components/Navigation/Side/SideLogo.vue'

import Cookie from 'js-cookie'
import { useUserAccountStore } from '@/modules/UserAccount/store'
import { FormInst, useMessage } from 'naive-ui'
import { useMessage } from 'naive-ui'

import { User as IconUserFa } from '@vicons/carbon'
import { Password as IconPasswordCarbon } from '@vicons/carbon'
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export default defineConfig(({ mode }) => {
{
from: 'naive-ui',
imports: [
'DataTableColumns'
'DataTableColumns',
'FormInst'
],
type: true
}
Expand Down