@@ -109,9 +109,21 @@
< / span >
< / template >
< template # cell ( level ) = " { item } " >
< template v-if = "(item.role || 'attendant') === 'attendant'" >
< span class = "badge fs-xxs" :class = "`badge-soft-${ATTENDANT_STAGE_VARIANTS[stageOf(item)]}`" >
{ { ATTENDANT _STAGE _LABELS [ stageOf ( item ) ] } }
< / span >
< p class = "text-muted mb-0 fs-12 mt-1" >
{ { ATTENDANT _GRADE _LABELS [ gradeOf ( item ) ] } }
< span v-if = "gradeOf(item) === 'diamond' && starOf(item) > 0" > {{ ' ★ ' .repeat ( starOf ( item ) ) }} < / span >
< / p >
< / template >
< span v-else class = "text-muted" > - < / span >
< / template >
< template # cell ( service ) = " { item } " >
< div > 服务年限 : { { item . work ? . workYears || 0 } } 年 < / div >
< p class = "text-muted mb-0 fs-12" > 累计接单 : { { item . attendantInfo ? . orderCount || 0 } } < / p >
< / template >
< template # cell ( area ) = " { item } " >
@@ -128,6 +140,15 @@
< BButton variant = "light" class = "btn btn-icon btn-sm rounded-circle" title = "编辑" @click ="openEdit(item)" >
< Icon icon = "edit" class = "fs-lg" / >
< / BButton >
< BButton
v-if = "(item.role || 'attendant') === 'attendant'"
variant = "light"
class = "btn btn-icon btn-sm rounded-circle"
title = "阶段与等级"
@click ="openLevel(item)"
>
< Icon icon = "award" class = "fs-lg" / >
< / BButton >
< BButton
: variant = "item.status === 'active' ? 'danger' : 'success'"
class = "btn btn-icon btn-sm rounded-circle"
@@ -459,6 +480,40 @@
通过后将自动为其创建 ( 或启用 ) 陪诊师档案 , 小程序端权限立即生效 。
< / p >
< / ConfirmModal >
< BModal v-model = "levelVisible" title="阶段与等级" hide -footer >
< p class = "mb-3" > 陪诊师 : < strong > { { levelTarget ? . profile ? . name || '-' } } < / strong > < / p >
< BRow class = "g-3" >
< BCol md = "6" >
< label class = "form-label" > 阶段 < / label >
< BFormSelect v-model = "levelForm.stage" >
< option value = "intern" > 实习 ( 仅可查看 , 不能接单 ) < / option >
< option value = "certified" > 正式 ( 可接单 ) < / option >
< / BFormSelect >
< / BCol >
< BCol md = "6" >
< label class = "form-label" > 等级 < / label >
< BFormSelect v-model = "levelForm.grade" >
< option v-for = "(label, value) in ATTENDANT_GRADE_LABELS" :key="value" :value="value" > {{ label }} < / option >
< / BFormSelect >
< / BCol >
< BCol v-if = "levelForm.grade === 'diamond'" md="6" >
< label class = "form-label" > 星级 < / label >
< BFormSelect v -model .number = " levelForm.star " >
< option v-for = "n in 6" :key="n - 1" :value="n - 1" > {{ n - 1 = = = 0 ? ' 无 ' : ` $ { n - 1 } 星 ` }} < / option >
< / BFormSelect >
< / BCol >
< / BRow >
< p class = "text-muted fs-12 mt-3 mb-0" >
等级只做展示与排序 , 不参与权限判定 ; 实习转正后才可接单 。
< / p >
< div class = "d-flex justify-content-end gap-2 mt-4" >
< BButton variant = "light" @click ="levelVisible = false" > 取消 < / BButton >
< BButton variant = "primary" :disabled = "levelSaving" @click ="confirmLevel" >
{{ levelSaving ? ' 保存中... ' : ' 保存 ' }}
< / BButton >
< / div >
< / BModal >
< / div >
< / template >
@@ -477,6 +532,9 @@ import type { AttendantApplication, Employee } from '~/types/api'
import { exportCsv } from '~/utils/csv'
import { fetchAllPages } from '~/utils/paging'
import {
ATTENDANT _GRADE _LABELS ,
ATTENDANT _STAGE _LABELS ,
ATTENDANT _STAGE _VARIANTS ,
EMPLOYEE _STATUS _LABELS ,
EMPLOYEE _STATUS _VARIANTS ,
ROLE _LABELS ,
@@ -509,6 +567,7 @@ const fields = [
{ key : 'contact' , label : '联系方式' } ,
{ key : 'role' , label : '角色' } ,
{ key : 'status' , label : '状态' } ,
{ key : 'level' , label : '阶段 / 等级' } ,
{ key : 'service' , label : '服务数据' } ,
{ key : 'area' , label : '服务区域 / 擅长' } ,
{ key : 'action' , label : '操作' } ,
@@ -557,7 +616,7 @@ const exportEmployees = async () => {
)
exportCsv (
` attendants- ${ today ( ) } .csv ` ,
[ '工号' , '姓名' , '手机号' , '邮箱' , '角色' , '职称/部门' , '状态' , '工作年限' , '累计接单' , '服务区域' , '擅长领域' , '简介' ] ,
[ '工号' , '姓名' , '手机号' , '邮箱' , '角色' , '职称/部门' , '状态' , '工作年限' , '服务区域' , '擅长领域' , '简介' ] ,
items . map ( ( item ) => [
item . employeeNo || '' ,
item . profile ? . name || '' ,
@@ -567,7 +626,6 @@ const exportEmployees = async () => {
[ item . work ? . title , item . work ? . department ] . filter ( Boolean ) . join ( ' / ' ) ,
EMPLOYEE _STATUS _LABELS [ item . status || '' ] || item . status || '' ,
item . work ? . workYears ? ? 0 ,
item . attendantInfo ? . orderCount ? ? 0 ,
( item . attendantInfo ? . serviceAreas || [ ] ) . join ( '、' ) ,
( item . attendantInfo ? . specialties || [ ] ) . join ( '、' ) ,
item . introduction || '' ,
@@ -614,6 +672,51 @@ const form = reactive({
const statusVisible = ref ( false )
const statusTarget = ref < Employee | null > ( null )
// ==================== 阶段与等级 ====================
const stageOf = ( item : Employee ) => ( item . attendantInfo ? . stage === 'intern' ? 'intern' : 'certified' )
const gradeOf = ( item : Employee ) => item . attendantInfo ? . grade || 'bronze'
const starOf = ( item : Employee ) => Number ( item . attendantInfo ? . star ) || 0
const levelVisible = ref ( false )
const levelSaving = ref ( false )
const levelTarget = ref < Employee | null > ( null )
const levelForm = reactive < { stage : 'intern' | 'certified' ; grade : string ; star : number } > ( {
stage : 'intern' ,
grade : 'bronze' ,
star : 0 ,
} )
const openLevel = ( employee : Employee ) => {
levelTarget . value = employee
levelForm . stage = employee . attendantInfo ? . stage === 'intern' ? 'intern' : 'certified'
levelForm . grade = employee . attendantInfo ? . grade || 'bronze'
levelForm . star = Number ( employee . attendantInfo ? . star ) || 0
levelVisible . value = true
}
const confirmLevel = async ( ) => {
const target = levelTarget . value
if ( ! target || levelSaving . value ) return
levelSaving . value = true
try {
const payload : { stage : 'intern' | 'certified' ; grade : string ; star ? : number } = {
stage : levelForm . stage ,
grade : levelForm . grade ,
}
// 星级只对钻石有效:其他等级不传,服务端会把旧星级归零
if ( levelForm . grade === 'diamond' ) payload . star = Number ( levelForm . star ) || 0
await employeeApi . updateLevel ( target . _id , payload )
notify . success ( '阶段与等级已更新' )
levelVisible . value = false
await load ( )
} catch {
// 请求层已统一提示
} finally {
levelSaving . value = false
}
}
// ==================== 入驻审核 ====================
const appFields = [
{ key : 'person' , label : '申请人' } ,