2026-02-03 22:05:11 +08:00
|
|
|
import { getDisciplineByRole } from '@/utils/roleDiscipline';
|
2026-02-03 22:10:14 +08:00
|
|
|
import { getUserRoleCodes } from '@/utils/user';
|
2026-02-03 22:05:11 +08:00
|
|
|
|
2026-02-03 17:24:20 +08:00
|
|
|
export const getDemandHideKeys = (key: string) => {
|
|
|
|
|
const allKeys = [
|
|
|
|
|
'simulationPurpose',
|
|
|
|
|
'animationPurpose',
|
|
|
|
|
'robotBrand',
|
|
|
|
|
'axis',
|
|
|
|
|
'beatDemand',
|
|
|
|
|
'useType',
|
|
|
|
|
'styleRequirements',
|
|
|
|
|
'viewRequirements',
|
|
|
|
|
'referenceData',
|
|
|
|
|
'deviceMessage',
|
|
|
|
|
'materialAndCraftsmanship',
|
|
|
|
|
];
|
|
|
|
|
let keys: string[] = [];
|
|
|
|
|
if (key.indexOf('有限元') !== -1 || key.indexOf('DISCIPLINE_TYPE') !== -1) {
|
|
|
|
|
const finiteElementKeys = ['simulationPurpose'];
|
|
|
|
|
keys = allKeys.filter((item) => !finiteElementKeys.includes(item));
|
|
|
|
|
} else if (key.indexOf('动画') !== -1) {
|
|
|
|
|
const animationKeys = ['animationPurpose', 'robotBrand', 'axis', 'beatDemand'];
|
|
|
|
|
keys = allKeys.filter((item) => !animationKeys.includes(item));
|
|
|
|
|
} else if (key.indexOf('工业') !== -1) {
|
|
|
|
|
const industrialKeys = [
|
|
|
|
|
'useType',
|
|
|
|
|
'styleRequirements',
|
|
|
|
|
'viewRequirements',
|
|
|
|
|
'referenceData',
|
|
|
|
|
'deviceMessage',
|
|
|
|
|
'materialAndCraftsmanship',
|
|
|
|
|
];
|
|
|
|
|
keys = allKeys.filter((item) => !industrialKeys.includes(item));
|
|
|
|
|
} else if (key.indexOf('机器人') !== -1) {
|
2026-02-03 17:52:38 +08:00
|
|
|
const robotKeys = ['robotBrand', 'axis', 'robotNum'];
|
2026-02-03 17:24:20 +08:00
|
|
|
keys = allKeys.filter((item) => !robotKeys.includes(item));
|
|
|
|
|
} else if (key.indexOf('公差') !== -1) {
|
|
|
|
|
const toleranceKeys = [''];
|
|
|
|
|
keys = allKeys.filter((item) => !toleranceKeys.includes(item));
|
|
|
|
|
}
|
|
|
|
|
return keys;
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-03 22:05:11 +08:00
|
|
|
/** 获取当前用户所属仿真类型 */
|
2026-02-03 17:24:20 +08:00
|
|
|
export const getUserSimulationType = () => {
|
2026-02-03 22:05:11 +08:00
|
|
|
// const disciplines = await getDisciplineByRole('ROLE_ADMIN, GENERAL_USER');
|
|
|
|
|
// console.log('disciplines', disciplines);
|
2026-02-03 22:10:14 +08:00
|
|
|
const roleSimulationInfo: any = getDisciplineByRole(getUserRoleCodes());
|
2026-02-03 22:05:11 +08:00
|
|
|
return roleSimulationInfo.simulationType[0];
|
2026-02-03 17:24:20 +08:00
|
|
|
// return '动画';
|
|
|
|
|
// return '工业';
|
|
|
|
|
};
|
2026-02-03 22:05:11 +08:00
|
|
|
|
|
|
|
|
/** 获取当前用户能看到的学科 */
|
|
|
|
|
export const getSeeDisciplines = () => {
|
2026-02-03 22:10:14 +08:00
|
|
|
const roleSimulationInfo: any = getDisciplineByRole(getUserRoleCodes());
|
2026-02-03 22:05:11 +08:00
|
|
|
console.log('roleSimulationInfo', roleSimulationInfo);
|
|
|
|
|
return roleSimulationInfo.discipline;
|
|
|
|
|
// return ['结构'];
|
|
|
|
|
};
|