|
|
|
@ -96,19 +96,14 @@ |
|
|
|
<input class="form-input" v-model="formData.wx" placeholder="请输入微信号" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 账号类型 --> |
|
|
|
<!-- 职位类型 --> |
|
|
|
<view class="form-item required"> |
|
|
|
<view class="label">职位类型</view> |
|
|
|
<view class="radio-group"> |
|
|
|
<label class="radio-item" @click="formData.account_type = 'teacher'"> |
|
|
|
<view class="radio" :class="formData.account_type === 'teacher' ? 'checked' : ''"></view> |
|
|
|
<text>教师</text> |
|
|
|
</label> |
|
|
|
<label class="radio-item" @click="formData.account_type = 'market'"> |
|
|
|
<view class="radio" :class="formData.account_type === 'market' ? 'checked' : ''"></view> |
|
|
|
<text>市场</text> |
|
|
|
</label> |
|
|
|
<picker :range="roleTypeOptions" range-key="role_name" @change="onRoleTypeChange"> |
|
|
|
<view class="picker-input"> |
|
|
|
{{getRoleTypeName(formData.account_type) || '请选择职位类型'}} |
|
|
|
</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 入职时间 --> |
|
|
|
@ -290,7 +285,7 @@ |
|
|
|
</view> |
|
|
|
<view class="info-item"> |
|
|
|
<text class="info-label">职位:</text> |
|
|
|
<text class="info-value">{{formData.account_type === 'teacher' ? '教师' : '市场'}}</text> |
|
|
|
<text class="info-value">{{getRoleTypeName(formData.account_type)}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -377,7 +372,9 @@ export default { |
|
|
|
politicsOptions: ['群众', '共青团员', '中共党员', '民主党派', '无党派人士'], |
|
|
|
educationOptions: ['高中', '中专', '大专', '本科', '硕士', '博士'], |
|
|
|
householdTypeOptions: ['城镇', '农村'], |
|
|
|
maritalStatusOptions: ['未婚', '已婚', '离异', '丧偶'] |
|
|
|
maritalStatusOptions: ['未婚', '已婚', '离异', '丧偶'], |
|
|
|
// 职位类型选项 |
|
|
|
roleTypeOptions: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
@ -404,6 +401,8 @@ export default { |
|
|
|
|
|
|
|
// 加载审批配置 |
|
|
|
this.loadApprovalConfigs() |
|
|
|
// 加载职位类型 |
|
|
|
this.loadRoleTypes() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 返回上一页 |
|
|
|
@ -491,6 +490,15 @@ export default { |
|
|
|
this.detailData.marital_status = this.maritalStatusOptions[e.detail.value] |
|
|
|
}, |
|
|
|
|
|
|
|
// 职位类型选择事件 |
|
|
|
onRoleTypeChange(e) { |
|
|
|
const index = e.detail.value |
|
|
|
const selectedRole = this.roleTypeOptions[index] |
|
|
|
if (selectedRole) { |
|
|
|
this.formData.account_type = selectedRole.role_key |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 计算年龄 |
|
|
|
calculateAge() { |
|
|
|
if (this.formData.birthday) { |
|
|
|
@ -588,15 +596,38 @@ export default { |
|
|
|
this.approvalData.selectedConfig = this.approvalConfigs[index] |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取职位类型文本 |
|
|
|
getAccountTypeText(type) { |
|
|
|
const typeMap = { |
|
|
|
'teacher': '教师', |
|
|
|
'market': '市场', |
|
|
|
'admin': '管理员', |
|
|
|
'other': '其他' |
|
|
|
// 获取职位类型名称 |
|
|
|
getRoleTypeName(roleKey) { |
|
|
|
if (!roleKey) return '' |
|
|
|
const role = this.roleTypeOptions.find(item => item.role_key === roleKey) |
|
|
|
return role ? role.role_name : roleKey |
|
|
|
}, |
|
|
|
|
|
|
|
// 加载职位类型数据 |
|
|
|
async loadRoleTypes() { |
|
|
|
try { |
|
|
|
const response = await apiRoute.get('personnel/role-types') |
|
|
|
if (response.code === 1 && response.data) { |
|
|
|
this.roleTypeOptions = response.data |
|
|
|
console.log('职位类型加载成功:', this.roleTypeOptions) |
|
|
|
} else { |
|
|
|
console.error('职位类型加载失败:', response.msg) |
|
|
|
// 如果加载失败,使用默认选项 |
|
|
|
this.roleTypeOptions = [ |
|
|
|
{ role_id: 1, role_name: '教练主管', role_key: 'teacher_manager' }, |
|
|
|
{ role_id: 2, role_name: '普通市场', role_key: 'market' }, |
|
|
|
{ role_id: 3, role_name: '班主任', role_key: 'teacher' } |
|
|
|
] |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('加载职位类型失败:', error) |
|
|
|
// 网络错误时使用默认选项 |
|
|
|
this.roleTypeOptions = [ |
|
|
|
{ role_id: 1, role_name: '教练主管', role_key: 'teacher_manager' }, |
|
|
|
{ role_id: 2, role_name: '普通市场', role_key: 'market' }, |
|
|
|
{ role_id: 3, role_name: '班主任', role_key: 'teacher' } |
|
|
|
] |
|
|
|
} |
|
|
|
return typeMap[type] || type |
|
|
|
}, |
|
|
|
|
|
|
|
// 提交表单 |
|
|
|
|