移动端集中修改dict字典展示

This commit is contained in:
zlwu committed 2025-08-10 09:53:20 +08:00
1 parent 4b9dbe40fb
commit 8bbe4e6a35
16 files changed
+1684 -134

No files matched your search

+37
View File
@@ -305,5 +305,42 @@ export const refreshDict = async (dictTypes) => {
}
};
/**
* 获取字典项的标签类型(Tag Type)
* @param {Array} dictData - 字典数据数组
* @param {string|number} value - 字典值
* @param {Object} fallbackMap - 降级处理映射对象(可选)
* @returns {string} 标签类型
*/
export const getDictTagType = (dictData, value, fallbackMap = {}) => {
// 参数验证
if (!Array.isArray(dictData) || value === null || value === undefined) {
return 'info'; // 默认类型
}
// 优先从字典数据中获取
if (dictData.length > 0) {
const dictItem = dictData.find((item) => String(item.value) === String(value));
if (dictItem && dictItem.elTagType) {
// 处理特殊值转换
let tagType = dictItem.elTagType;
if (tagType === 'danger') {
tagType = 'error';
} else if (tagType === 'default') {
tagType = 'primary';
}
return tagType;
}
}
// 字典未加载或无样式信息时的降级处理
if (fallbackMap && typeof fallbackMap === 'object') {
return fallbackMap[value] || 'info';
}
return 'info';
};
// 导出缓存管理对象(用于高级用法)
export { dictCache };
@@ -80,12 +80,17 @@
)"
:key="nameIndex"
:text="name.trim()"
type="success"
:type="getApproverType()"
size="mini"
class="approver-tag"
/>
</template>
<u-tag v-else text="无" type="info" size="mini" />
<u-tag
v-else
text="无"
:type="getNoApproverType()"
size="mini"
/>
</view>
</view>
@@ -458,6 +463,16 @@ export default {
}
},
// 获取审批人员标签类型
getApproverType() {
return 'success'; // 审批人员使用成功样式
},
// 获取无审批人员标签类型
getNoApproverType() {
return 'info'; // 无审批人员使用信息样式
},
// 注:getDownloadUrl方法已被移除,现在统一使用request.js中的downloadFile方法
},
};
@@ -76,7 +76,7 @@
v-for="user in selectCopyUserList"
:key="user.userId"
:text="user.nickName"
type="primary"
:type="getCopyUserType()"
size="mini"
closable
@close="handleCopyCloseTag(user)"
@@ -1060,6 +1060,11 @@ export default {
});
});
},
// 获取抄送用户标签类型
getCopyUserType() {
return 'primary'; // 抄送用户使用主要样式
},
},
};
</script>
+6 -1
View File
@@ -20,7 +20,7 @@
v-for="user in selectUserList"
:key="user.userId"
:text="user.nickName"
type="primary"
:type="getSelectedUserType()"
size="mini"
closable
@close="handleCloseTag(user)"
@@ -403,6 +403,11 @@ export default {
this.$emit('confirmCallBack', this.selectUserList);
this.close();
},
// 获取选中用户标签类型
getSelectedUserType() {
return 'primary'; // 选中用户使用主要样式
},
},
};
</script>
+12 -2
View File
@@ -11,7 +11,7 @@
<u-col span="6">
<u-tag
:text="isInitialized ? '已初始化' : '未初始化'"
:type="isInitialized ? 'success' : 'warning'"
:type="getInitStatusType(isInitialized)"
/>
</u-col>
</u-row>
@@ -23,7 +23,7 @@
<u-col span="6">
<u-tag
:text="isWeChatEnv ? '微信浏览器' : '非微信环境'"
:type="isWeChatEnv ? 'success' : 'error'"
:type="getWeChatEnvType(isWeChatEnv)"
/>
</u-col>
</u-row>
@@ -462,6 +462,16 @@ export default {
duration: 2000,
});
},
// 获取初始化状态标签类型
getInitStatusType(isInitialized) {
return isInitialized ? 'success' : 'warning';
},
// 获取微信环境标签类型
getWeChatEnvType(isWeChatEnv) {
return isWeChatEnv ? 'success' : 'error';
},
},
};
</script>
+8
View File
@@ -81,6 +81,14 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/xg/xsjcxx/xsqj/leave/index",
"style": {
"navigationBarTitleText": "学生请假",
"navigationBarBackgroundColor": "#0051d9",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/xg/xsjcxx/xsqj/leaveEdit/index",
"style": {
+8 -1
View File
@@ -99,7 +99,7 @@
<ServiceItem
v-if="hasPermi(['student:leave:list'])"
title="学生请假"
@click="handleServiceClick"
@click="gotoStudentLeave"
>
<template #icon>
<u-icon name="calendar" size="24" />
@@ -725,6 +725,13 @@ export default {
});
},
// 跳转到学生请假页面
gotoStudentLeave() {
uni.navigateTo({
url: '/pages/xg/xsjcxx/xsqj/leave/index',
});
},
// 图片加载成功处理
handleImageLoad(event) {
console.log('✅ 轮播图片加载成功:', event.detail);
+240 -23
View File
@@ -71,7 +71,7 @@
<u-tag
v-if="form.gender"
:text="getDictLabel(genderOptions, form.gender)"
type="primary"
:type="getGenderType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -87,7 +87,7 @@
<u-tag
v-if="form.nationality"
:text="getDictLabel(nationalityOptions, form.nationality)"
type="warning"
:type="getNationalityType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -103,7 +103,7 @@
<u-tag
v-if="form.politicalStatus"
:text="getDictLabel(politicalStatusOptions, form.politicalStatus)"
type="error"
:type="getPoliticalStatusType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -142,7 +142,7 @@
<u-tag
v-if="form.educationLevel"
:text="getDictLabel(educationLevelOptions, form.educationLevel)"
type="success"
:type="getEducationLevelType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -159,7 +159,7 @@
form.householdRegisterType,
)
"
type="info"
:type="getHouseholdRegisterType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -197,7 +197,7 @@
<u-tag
v-if="form.maritalStatus"
:text="getDictLabel(maritalStatusOptions, form.maritalStatus)"
type="primary"
:type="getMaritalStatusType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -221,7 +221,7 @@
<u-tag
v-if="form.isPoorStudent !== undefined"
:text="getDictLabel(yesNoOptions, form.isPoorStudent)"
:type="form.isPoorStudent === '1' ? 'warning' : 'info'"
:type="getYesNoType(form.isPoorStudent)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -233,7 +233,7 @@
<u-tag
v-if="form.isMinority !== undefined"
:text="getDictLabel(yesNoOptions, form.isMinority)"
:type="form.isMinority === '1' ? 'warning' : 'info'"
:type="getYesNoType(form.isMinority)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -245,7 +245,7 @@
<u-tag
v-if="form.isOrphan !== undefined"
:text="getDictLabel(yesNoOptions, form.isOrphan)"
:type="form.isOrphan === '1' ? 'error' : 'info'"
:type="getOrphanType(form.isOrphan)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -257,7 +257,7 @@
<u-tag
v-if="form.isLeftBehindChild !== undefined"
:text="getDictLabel(yesNoOptions, form.isLeftBehindChild)"
:type="form.isLeftBehindChild === '1' ? 'error' : 'info'"
:type="getLeftBehindType(form.isLeftBehindChild)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -269,7 +269,7 @@
<u-tag
v-if="form.isSingleChild !== undefined"
:text="getDictLabel(yesNoOptions, form.isSingleChild)"
:type="form.isSingleChild === '1' ? 'primary' : 'info'"
:type="getSingleChildType(form.isSingleChild)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -281,7 +281,7 @@
<u-tag
v-if="form.isLowIncome !== undefined"
:text="getDictLabel(yesNoOptions, form.isLowIncome)"
:type="form.isLowIncome === '1' ? 'warning' : 'info'"
:type="getYesNoType(form.isLowIncome)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -293,7 +293,7 @@
<u-tag
v-if="form.hasLoan !== undefined"
:text="getDictLabel(yesNoOptions, form.hasLoan)"
:type="form.hasLoan === '1' ? 'success' : 'info'"
:type="getLoanType(form.hasLoan)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -382,7 +382,7 @@
:text="
getDictLabel(familyEconomicOptions, form.familyEconomicStatus)
"
type="primary"
:type="getFamilyEconomicStatusType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -413,7 +413,7 @@
<u-tag
v-if="form.bloodType"
:text="getDictLabel(bloodTypeOptions, form.bloodType)"
type="error"
:type="getBloodType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -429,7 +429,7 @@
<u-tag
v-if="form.isDisabled !== undefined"
:text="getDictLabel(yesNoOptions, form.isDisabled)"
:type="form.isDisabled === '1' ? 'warning' : 'info'"
:type="getYesNoType(form.isDisabled)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -441,7 +441,7 @@
<u-tag
v-if="form.disabilityType"
:text="getDictLabel(disabilityTypeOptions, form.disabilityType)"
type="warning"
:type="getDisabilityType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -492,7 +492,7 @@
<u-tag
v-if="form.academicLevel"
:text="getDictLabel(academicLevelOptions, form.academicLevel)"
type="success"
:type="getAcademicLevelType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -520,7 +520,7 @@
<u-tag
v-if="form.trainingType"
:text="getDictLabel(trainingModeOptions, form.trainingType)"
type="primary"
:type="getTrainingType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -534,7 +534,7 @@
:text="
getDictLabel(admissionCategoryOptions, form.admissionCategory)
"
type="info"
:type="getAdmissionCategoryType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -546,7 +546,7 @@
<u-tag
v-if="form.studentStatus"
:text="getDictLabel(studentStatusOptions, form.studentStatus)"
type="warning"
:type="getStudentStatusType()"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -558,7 +558,7 @@
<u-tag
v-if="form.isBoarder !== undefined"
:text="getDictLabel(yesNoOptions, form.isBoarder)"
:type="form.isBoarder === '1' ? 'success' : 'info'"
:type="getBoarderType(form.isBoarder)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -615,7 +615,7 @@
<script>
import { request } from '@/common/request.js';
import { useDict, getDictLabel } from '@/common/dict.js';
import { useDict, getDictLabel, getDictTagType } from '@/common/dict.js';
export default {
name: 'StuPersonalMsg',
@@ -799,6 +799,223 @@ export default {
uni.navigateBack();
},
// 获取是否类型(Yes/No)的类型
getYesNoType(value) {
const fallbackMap = {
1: 'warning', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取孤儿状态类型
getOrphanType(value) {
const fallbackMap = {
1: 'error', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取留守儿童状态类型
getLeftBehindType(value) {
const fallbackMap = {
1: 'error', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取独生子女状态类型
getSingleChildType(value) {
const fallbackMap = {
1: 'primary', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取助学贷款状态类型
getLoanType(value) {
const fallbackMap = {
1: 'success', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取寄宿生状态类型
getBoarderType(value) {
const fallbackMap = {
1: 'success', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取性别类型
getGenderType() {
const fallbackMap = {
1: 'primary', // 男
0: 'success', // 女
};
return getDictTagType(this.genderOptions, this.form.gender, fallbackMap);
},
// 获取民族类型
getNationalityType() {
const fallbackMap = {
1: 'primary', // 汉族
2: 'warning', // 少数民族
};
return getDictTagType(this.nationalityOptions, this.form.nationality, fallbackMap);
},
// 获取政治面貌类型
getPoliticalStatusType() {
const fallbackMap = {
1: 'error', // 中共党员
2: 'warning', // 共青团员
3: 'info', // 群众
};
return getDictTagType(
this.politicalStatusOptions,
this.form.politicalStatus,
fallbackMap,
);
},
// 获取文化程度类型
getEducationLevelType() {
const fallbackMap = {
1: 'info', // 小学
2: 'primary', // 初中
3: 'warning', // 高中
4: 'success', // 大专
5: 'error', // 本科
};
return getDictTagType(
this.educationLevelOptions,
this.form.educationLevel,
fallbackMap,
);
},
// 获取户口类型
getHouseholdRegisterType() {
const fallbackMap = {
1: 'primary', // 城镇
2: 'success', // 农村
};
return getDictTagType(
this.householdRegisterTypeOptions,
this.form.householdRegisterType,
fallbackMap,
);
},
// 获取婚姻状况类型
getMaritalStatusType() {
const fallbackMap = {
1: 'info', // 未婚
2: 'primary', // 已婚
3: 'warning', // 离异
4: 'error', // 丧偶
};
return getDictTagType(this.maritalStatusOptions, this.form.maritalStatus, fallbackMap);
},
// 获取家庭经济状况类型
getFamilyEconomicStatusType() {
const fallbackMap = {
1: 'error', // 贫困
2: 'warning', // 一般困难
3: 'primary', // 一般
4: 'success', // 富裕
};
return getDictTagType(
this.familyEconomicOptions,
this.form.familyEconomicStatus,
fallbackMap,
);
},
// 获取血型类型
getBloodType() {
const fallbackMap = {
1: 'error', // A型
2: 'primary', // B型
3: 'warning', // AB型
4: 'success', // O型
};
return getDictTagType(this.bloodTypeOptions, this.form.bloodType, fallbackMap);
},
// 获取残疾类型
getDisabilityType() {
const fallbackMap = {
1: 'error', // 视力残疾
2: 'warning', // 听力残疾
3: 'primary', // 言语残疾
4: 'success', // 肢体残疾
5: 'info', // 智力残疾
};
return getDictTagType(
this.disabilityTypeOptions,
this.form.disabilityType,
fallbackMap,
);
},
// 获取学历层次类型
getAcademicLevelType() {
const fallbackMap = {
1: 'info', // 专科
2: 'primary', // 本科
3: 'success', // 硕士
4: 'error', // 博士
};
return getDictTagType(this.academicLevelOptions, this.form.academicLevel, fallbackMap);
},
// 获取培养方式类型
getTrainingType() {
const fallbackMap = {
1: 'primary', // 全日制
2: 'warning', // 非全日制
3: 'info', // 函授
4: 'success', // 自考
};
return getDictTagType(this.trainingModeOptions, this.form.trainingType, fallbackMap);
},
// 获取录取类别类型
getAdmissionCategoryType() {
const fallbackMap = {
1: 'success', // 统招
2: 'primary', // 单招
3: 'warning', // 对口升学
4: 'info', // 其他
};
return getDictTagType(
this.admissionCategoryOptions,
this.form.admissionCategory,
fallbackMap,
);
},
// 获取学籍状态类型
getStudentStatusType() {
const fallbackMap = {
1: 'success', // 在读
2: 'warning', // 休学
3: 'error', // 退学
4: 'primary', // 毕业
5: 'info', // 结业
};
return getDictTagType(this.studentStatusOptions, this.form.studentStatus, fallbackMap);
},
// 加载字典数据
async loadDictData() {
console.log('开始加载字典数据...');
File diff suppressed because it is too large. Load diff
+23 -4
View File
@@ -43,7 +43,7 @@
<view class="batch-status">
<u-tag
:text="item.status === '0' ? '正常' : '停用'"
:type="item.status === '0' ? 'success' : 'error'"
:type="getStatusType(item.status)"
size="mini"
></u-tag>
</view>
@@ -67,7 +67,7 @@
<text class="label">收集类型:</text>
<u-tag
:text="item.collectionType === '1' ? '新学期收集' : '其他'"
:type="item.collectionType === '1' ? 'primary' : 'info'"
:type="getCollectionType(item.collectionType)"
size="mini"
></u-tag>
</view>
@@ -143,7 +143,7 @@
<text class="detail-label">状态:</text>
<u-tag
:text="viewForm.status === '0' ? '正常' : '停用'"
:type="viewForm.status === '0' ? 'success' : 'error'"
:type="getStatusType(viewForm.status)"
size="mini"
></u-tag>
</view>
@@ -151,7 +151,7 @@
<text class="detail-label">收集类型:</text>
<u-tag
:text="viewForm.collectionType === '1' ? '新学期收集' : '其他'"
:type="viewForm.collectionType === '1' ? 'primary' : 'info'"
:type="getCollectionType(viewForm.collectionType)"
size="mini"
></u-tag>
</view>
@@ -181,6 +181,7 @@
<script>
import { request } from '@/common/request.js';
import { getDictTagType } from '@/common/dict.js';
export default {
name: 'StuMsgSupply',
@@ -229,6 +230,24 @@ export default {
uni.navigateBack();
},
// 获取批次状态类型
getStatusType(status) {
const fallbackMap = {
0: 'success', // 正常
1: 'error', // 停用
};
return getDictTagType([], status, fallbackMap);
},
// 获取收集类型类型
getCollectionType(collectionType) {
const fallbackMap = {
1: 'primary', // 新学期收集
0: 'info', // 其他
};
return getDictTagType([], collectionType, fallbackMap);
},
// 获取学生信息收集批次列表
async getList() {
this.loading = true;
@@ -90,7 +90,7 @@
<u-tag
v-if="studentInfo.gender"
:text="getDictLabel(genderOptions, studentInfo.gender)"
type="primary"
:type="getGenderType(studentInfo.gender)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -113,7 +113,7 @@
studentInfo.nationality,
)
"
type="warning"
:type="getNationalityType(studentInfo.nationality)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -136,7 +136,9 @@
studentInfo.politicalStatus,
)
"
type="error"
:type="
getPoliticalStatusType(studentInfo.politicalStatus)
"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -186,7 +188,9 @@
studentInfo.educationLevel,
)
"
type="success"
:type="
getEducationLevelType(studentInfo.educationLevel)
"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -203,7 +207,11 @@
studentInfo.householdRegisterType,
)
"
type="info"
:type="
getHouseholdRegisterType(
studentInfo.householdRegisterType,
)
"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -250,7 +258,7 @@
studentInfo.maritalStatus,
)
"
type="primary"
:type="getMaritalStatusType(studentInfo.maritalStatus)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -287,11 +295,7 @@
studentInfo.isPoorStudent,
)
"
:type="
studentInfo.isPoorStudent === '1'
? 'warning'
: 'info'
"
:type="getPoorStudentType(studentInfo.isPoorStudent)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -305,9 +309,7 @@
:text="
getDictLabel(yesNoOptions, studentInfo.isMinority)
"
:type="
studentInfo.isMinority === '1' ? 'warning' : 'info'
"
:type="getYesNoType(studentInfo.isMinority)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -319,7 +321,7 @@
<u-tag
v-if="studentInfo.isOrphan !== undefined"
:text="getDictLabel(yesNoOptions, studentInfo.isOrphan)"
:type="studentInfo.isOrphan === '1' ? 'error' : 'info'"
:type="getOrphanType(studentInfo.isOrphan)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -337,9 +339,9 @@
)
"
:type="
studentInfo.isLeftBehindChild === '1'
? 'error'
: 'info'
getLeftBehindChildType(
studentInfo.isLeftBehindChild,
)
"
size="mini"
></u-tag>
@@ -357,11 +359,7 @@
studentInfo.isSingleChild,
)
"
:type="
studentInfo.isSingleChild === '1'
? 'primary'
: 'info'
"
:type="getSingleChildType(studentInfo.isSingleChild)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -375,9 +373,7 @@
:text="
getDictLabel(yesNoOptions, studentInfo.isLowIncome)
"
:type="
studentInfo.isLowIncome === '1' ? 'warning' : 'info'
"
:type="getYesNoType(studentInfo.isLowIncome)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -389,7 +385,7 @@
<u-tag
v-if="studentInfo.hasLoan !== undefined"
:text="getDictLabel(yesNoOptions, studentInfo.hasLoan)"
:type="studentInfo.hasLoan === '1' ? 'success' : 'info'"
:type="getLoanType(studentInfo.hasLoan)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -501,7 +497,11 @@
studentInfo.familyEconomicStatus,
)
"
type="primary"
:type="
getFamilyEconomicType(
studentInfo.familyEconomicStatus,
)
"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -539,7 +539,7 @@
studentInfo.bloodType,
)
"
type="error"
:type="getBloodType(studentInfo.bloodType)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -559,9 +559,7 @@
:text="
getDictLabel(yesNoOptions, studentInfo.isDisabled)
"
:type="
studentInfo.isDisabled === '1' ? 'warning' : 'info'
"
:type="getYesNoType(studentInfo.isDisabled)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -578,7 +576,7 @@
studentInfo.disabilityType,
)
"
type="warning"
:type="getDisabilityType(studentInfo.disabilityType)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -644,7 +642,7 @@
studentInfo.academicLevel,
)
"
type="success"
:type="getAcademicLevelType(studentInfo.academicLevel)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -681,7 +679,7 @@
studentInfo.trainingType,
)
"
type="primary"
:type="getTrainingModeType(studentInfo.trainingType)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -698,7 +696,11 @@
studentInfo.admissionCategory,
)
"
type="info"
:type="
getAdmissionCategoryType(
studentInfo.admissionCategory,
)
"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -715,7 +717,7 @@
studentInfo.studentStatus,
)
"
type="warning"
:type="getStudentStatusType(studentInfo.studentStatus)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -729,9 +731,7 @@
:text="
getDictLabel(yesNoOptions, studentInfo.isBoarder)
"
:type="
studentInfo.isBoarder === '1' ? 'success' : 'info'
"
:type="getBoarderType(studentInfo.isBoarder)"
size="mini"
></u-tag>
<text v-else>-</text>
@@ -830,7 +830,7 @@
<script>
import { request } from '@/common/request.js';
import { useDict, getDictLabel } from '@/common/dict.js';
import { useDict, getDictLabel, getDictTagType } from '@/common/dict.js';
export default {
name: 'StuMsgDetailDialog',
@@ -920,6 +920,205 @@ export default {
uni.navigateBack();
},
// 获取是否类型(Yes/No)的类型
getYesNoType(value) {
const fallbackMap = {
1: 'warning', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取孤儿状态类型
getOrphanType(value) {
const fallbackMap = {
1: 'error', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取助学贷款状态类型
getLoanType(value) {
const fallbackMap = {
1: 'success', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取是否贫困生状态类型
getPoorStudentType(value) {
const fallbackMap = {
1: 'warning', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取是否留守儿童状态类型
getLeftBehindChildType(value) {
const fallbackMap = {
1: 'error', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取是否独生子女状态类型
getSingleChildType(value) {
const fallbackMap = {
1: 'primary', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取是否住校状态类型
getBoarderType(value) {
const fallbackMap = {
1: 'success', // 是
0: 'info', // 否
};
return getDictTagType(this.yesNoOptions, value, fallbackMap);
},
// 获取性别标签类型
getGenderType(value) {
const fallbackMap = {
0: 'primary', // 男
1: 'error', // 女
2: 'info', // 未知
};
return getDictTagType(this.genderOptions, value, fallbackMap);
},
// 获取民族标签类型
getNationalityType(value) {
const fallbackMap = {
'01': 'primary', // 汉族
};
// 其他民族使用warning类型
return getDictTagType(this.nationalityOptions, value, fallbackMap) || 'warning';
},
// 获取政治面貌标签类型
getPoliticalStatusType(value) {
const fallbackMap = {
'01': 'error', // 中共党员
'02': 'warning', // 中共预备党员
'03': 'primary', // 共青团员
13: 'info', // 群众
};
return getDictTagType(this.politicalStatusOptions, value, fallbackMap);
},
// 获取文化程度标签类型
getEducationLevelType(value) {
const fallbackMap = {
7: 'success', // 博士
6: 'primary', // 硕士
5: 'warning', // 本科
4: 'info', // 专科
};
return getDictTagType(this.educationLevelOptions, value, fallbackMap);
},
// 获取户口类型标签类型
getHouseholdRegisterType(value) {
const fallbackMap = {
1: 'primary', // 农业户口
2: 'info', // 非农业户口
};
return getDictTagType(this.householdRegisterTypeOptions, value, fallbackMap);
},
// 获取婚姻状况标签类型
getMaritalStatusType(value) {
const fallbackMap = {
1: 'success', // 未婚
2: 'primary', // 已婚
3: 'warning', // 离异
4: 'error', // 丧偶
};
return getDictTagType(this.maritalStatusOptions, value, fallbackMap);
},
// 获取家庭经济状况标签类型
getFamilyEconomicType(value) {
const fallbackMap = {
1: 'error', // 困难
2: 'warning', // 一般困难
3: 'primary', // 一般
4: 'success', // 富裕
};
return getDictTagType(this.familyEconomicOptions, value, fallbackMap);
},
// 获取血型标签类型
getBloodType(value) {
const fallbackMap = {
A: 'error',
B: 'warning',
AB: 'primary',
O: 'success',
};
return getDictTagType(this.bloodTypeOptions, value, fallbackMap);
},
// 获取残疾类型标签类型
getDisabilityType(value) {
const fallbackMap = {
1: 'warning', // 视力残疾
2: 'error', // 听力残疾
3: 'primary', // 言语残疾
4: 'info', // 肢体残疾
};
return getDictTagType(this.disabilityTypeOptions, value, fallbackMap);
},
// 获取学历层次标签类型
getAcademicLevelType(value) {
const fallbackMap = {
1: 'success', // 博士
2: 'primary', // 硕士
3: 'warning', // 本科
4: 'info', // 专科
};
return getDictTagType(this.academicLevelOptions, value, fallbackMap);
},
// 获取培养方式标签类型
getTrainingModeType(value) {
const fallbackMap = {
1: 'primary', // 统招
2: 'warning', // 委培
3: 'info', // 自费
};
return getDictTagType(this.trainingModeOptions, value, fallbackMap);
},
// 获取录取类别标签类型
getAdmissionCategoryType(value) {
const fallbackMap = {
1: 'success', // 统招
2: 'primary', // 推免
3: 'info', // 其他
};
return getDictTagType(this.admissionCategoryOptions, value, fallbackMap);
},
// 获取学籍状态标签类型
getStudentStatusType(value) {
const fallbackMap = {
1: 'success', // 在校
2: 'warning', // 休学
3: 'error', // 退学
4: 'primary', // 毕业
};
return getDictTagType(this.studentStatusOptions, value, fallbackMap);
},
// Tab点击事件处理
handleTabClick(item, index) {
index = item.index;
+1 -1
View File
@@ -8,7 +8,7 @@ const SERVICE_ROUTES = {
// 学工管理
'student:info': '/pages/xg/xsjcxx/xsjcxx/index',
'student:dorm': '/pages/student/dorm/index',
'student:leave': '/pages/student/leave/index',
'student:leave': '/pages/xg/xsjcxx/xsqj/leave/index',
'student:psychology': '/pages/student/psychology/index',
'student:club': '/pages/student/club/index',
'student:counsel': '/pages/student/counsel/index',