fix: 全局bug调整

This commit is contained in:
xinxin.wu 2024-03-01 13:38:30 +08:00 committed by 刘瑞斌
parent e1c098cbc9
commit dd470ba328
13 changed files with 55 additions and 33 deletions

View File

@ -239,7 +239,9 @@
watchEffect(() => { watchEffect(() => {
if (switchOrgVisible.value || menuSwitchOrgVisible.value) { if (switchOrgVisible.value || menuSwitchOrgVisible.value) {
getOrgList(); if (appStore.packageType === 'enterprise' && licenseStore.hasLicense()) {
getOrgList();
}
nextTick(() => { nextTick(() => {
// //
const activeOrgDom = document.querySelector('.switch-org-dropdown-list')?.querySelector('.active-org'); const activeOrgDom = document.querySelector('.switch-org-dropdown-list')?.querySelector('.active-org');

View File

@ -21,10 +21,12 @@
import usePermission from '@/hooks/usePermission'; import usePermission from '@/hooks/usePermission';
import appClientMenus from '@/router/app-menus'; import appClientMenus from '@/router/app-menus';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import useLicenseStore from '@/store/modules/setting/license';
import { listenerRouteChange } from '@/utils/route-listener'; import { listenerRouteChange } from '@/utils/route-listener';
import { RouteEnum } from '@/enums/routeEnum'; import { RouteEnum } from '@/enums/routeEnum';
const licenseStore = useLicenseStore();
const copyRouters = cloneDeep(appClientMenus) as RouteRecordRaw[]; const copyRouters = cloneDeep(appClientMenus) as RouteRecordRaw[];
const permission = usePermission(); const permission = usePermission();
const appStore = useAppStore(); const appStore = useAppStore();
@ -85,9 +87,9 @@
const filterMenuTopRouter = const filterMenuTopRouter =
currentParent?.children?.filter((item: any) => { currentParent?.children?.filter((item: any) => {
if (permission.accessRouter(item) && item.meta?.isTopMenu) { if (permission.accessRouter(item) && item.meta?.isTopMenu) {
if (item.name === RouteEnum.SETTING_SYSTEM_AUTHORIZED_MANAGEMENT) { // if (item.name === RouteEnum.SETTING_SYSTEM_AUTHORIZED_MANAGEMENT) {
return appStore.packageType === 'enterprise'; // return appStore.packageType === 'enterprise';
} // }
return true; return true;
} }
return false; return false;
@ -112,9 +114,30 @@
activeMenus.value = [appStore.getCurrentTopMenu?.name || '']; activeMenus.value = [appStore.getCurrentTopMenu?.name || ''];
} }
onBeforeMount(() => { watch(
appStore.initSystemPackage(); () => appStore.currentOrgId,
}); async () => {
await appStore.initSystemPackage();
if (appStore.packageType === 'enterprise') {
licenseStore.getValidateLicense();
}
},
{
immediate: true,
}
);
watch(
() => appStore.packageType,
(val) => {
const topMenus = appStore.getTopMenus;
if (val === 'enterprise') {
appStore.setTopMenus(topMenus);
} else {
appStore.setTopMenus(topMenus.filter((item) => item.name !== RouteEnum.SETTING_SYSTEM_AUTHORIZED_MANAGEMENT));
}
}
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,4 +1,4 @@
export default { export default {
'formCreate.PleaseEnter': '默认值', 'formCreate.PleaseEnter': '请输入',
'formCreate.PleaseSelect': '请选择', 'formCreate.PleaseSelect': '请选择',
}; };

View File

@ -155,10 +155,13 @@
import { LOCALE_OPTIONS } from '@/locale'; import { LOCALE_OPTIONS } from '@/locale';
import useLocale from '@/locale/useLocale'; import useLocale from '@/locale/useLocale';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useLicenseStore from '@/store/modules/setting/license';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { IconInfoCircle, IconQuestionCircle } from '@arco-design/web-vue/es/icon'; import { IconInfoCircle, IconQuestionCircle } from '@arco-design/web-vue/es/icon';
const licenseStore = useLicenseStore();
const props = defineProps<{ const props = defineProps<{
isPreview?: boolean; isPreview?: boolean;
logo?: string; logo?: string;

View File

@ -11,10 +11,6 @@ export default function setupUserLoginInfoGuard(router: Router) {
clearToken(); clearToken();
} }
if (to.name !== 'login' && hasToken(to.name as string)) { if (to.name !== 'login' && hasToken(to.name as string)) {
const appStore = useAppStore();
if (!appStore.packageType) {
await appStore.initSystemPackage();
}
next(); next();
} else { } else {
// 未登录的都直接跳转至登录页,访问的页面地址缓存到 query 上 // 未登录的都直接跳转至登录页,访问的页面地址缓存到 query 上

View File

@ -240,8 +240,6 @@ const useAppStore = defineStore('app', {
async initSystemPackage() { async initSystemPackage() {
try { try {
this.packageType = await getPackageType(); this.packageType = await getPackageType();
// await getPackageType();
// this.packageType = 'community';
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);

View File

@ -23,14 +23,11 @@ const useLicenseStore = defineStore('license', {
async getValidateLicense() { async getValidateLicense() {
const appStore = useAppStore(); const appStore = useAppStore();
try { try {
await appStore.initSystemPackage(); const result = await getLicenseInfo();
if (appStore.packageType === 'enterprise') { if (!result || !result.status || !result.license || !result.license.count) {
const result = await getLicenseInfo(); return;
if (!result || !result.status || !result.license || !result.license.count) {
return;
}
this.setLicenseStatus(result.status);
} }
this.setLicenseStatus(result.status);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@ -84,9 +84,8 @@ const useUserStore = defineStore('user', {
async login(loginForm: LoginData) { async login(loginForm: LoginData) {
try { try {
const res = await userLogin(loginForm); const res = await userLogin(loginForm);
const licenseStore = useLicenseStore();
const appStore = useAppStore(); const appStore = useAppStore();
licenseStore.getValidateLicense();
setToken(res.sessionId, res.csrfToken); setToken(res.sessionId, res.csrfToken);
appStore.setCurrentOrgId(res.lastOrganizationId || ''); appStore.setCurrentOrgId(res.lastOrganizationId || '');

View File

@ -1210,7 +1210,7 @@
title: item.fieldName, title: item.fieldName,
slotName: item.fieldId as string, slotName: item.fieldId as string,
dataIndex: item.fieldId, dataIndex: item.fieldId,
showInTable: true, showInTable: false,
showDrag: true, showDrag: true,
width: 300, width: 300,
}; };

View File

@ -731,7 +731,7 @@
async function handleBatchDelete() { async function handleBatchDelete() {
openModal({ openModal({
type: 'error', type: 'error',
title: t('caseManagement.featureCase.batchDeleteCompleted', {number: batchParams.value.currentSelectCount}), title: t('caseManagement.featureCase.batchDeleteCompleted', { number: batchParams.value.currentSelectCount }),
content: t('caseManagement.featureCase.cleanOutDeleteOnRecycleTip'), content: t('caseManagement.featureCase.cleanOutDeleteOnRecycleTip'),
okText: t('common.confirmDelete'), okText: t('common.confirmDelete'),
cancelText: t('common.cancel'), cancelText: t('common.cancel'),
@ -791,7 +791,7 @@
function handleBatchCleanOut(record: CaseManagementTable) { function handleBatchCleanOut(record: CaseManagementTable) {
openModal({ openModal({
type: 'error', type: 'error',
title: t('caseManagement.featureCase.completedDeleteCaseTitle', {name: characterLimit(record.name)}), title: t('caseManagement.featureCase.completedDeleteCaseTitle', { name: characterLimit(record.name) }),
content: t('caseManagement.featureCase.cleanOutDeleteOnRecycleTip'), content: t('caseManagement.featureCase.cleanOutDeleteOnRecycleTip'),
okText: t('common.confirmDelete'), okText: t('common.confirmDelete'),
cancelText: t('common.cancel'), cancelText: t('common.cancel'),
@ -854,7 +854,7 @@
title: item.fieldName, title: item.fieldName,
slotName: item.fieldId as string, slotName: item.fieldId as string,
dataIndex: item.fieldId, dataIndex: item.fieldId,
showInTable: true, showInTable: false,
showDrag: true, showDrag: true,
width: 300, width: 300,
}; };
@ -1010,10 +1010,10 @@
onMounted(async () => { onMounted(async () => {
getRecycleModules(); getRecycleModules();
await getDefaultFields();
await initFilter(); await initFilter();
initRecycleList(); initRecycleList();
}); });
await getDefaultFields();
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -285,7 +285,11 @@ export const getTotalFieldOptionList = (totalData: DefinedFieldItem[]) => {
effect: { effect: {
required: false, required: false,
}, },
props: { ...currentFormRules.props, options: selectOptions }, props: {
...currentFormRules.props,
options: selectOptions,
placeholder: t('system.orgTemplate.defaultValue'),
},
}, },
], ],
fApi: null, fApi: null,

View File

@ -128,7 +128,7 @@ export default {
'system.orgTemplate.deleteStateContent': 'system.orgTemplate.deleteStateContent':
'After delete, will be effective in the project and delete irrevocable, please careful operation.', 'After delete, will be effective in the project and delete irrevocable, please careful operation.',
'system.orgTemplate.deleteFiledContent': 'system.orgTemplate.deleteFiledContent':
'After deleting fields will be removed from the field list, please careful operation.', 'This field has been used in the template, data will be lost after deletion, please be careful!',
'system.orgTemplate.deleteSuccess': 'Delete Successfully', 'system.orgTemplate.deleteSuccess': 'Delete Successfully',
'system.orgTemplate.setInitStateSuccess': 'Set the initial state successfully', 'system.orgTemplate.setInitStateSuccess': 'Set the initial state successfully',
'system.orgTemplate.setEndStateSuccess': 'Setting the end status succeeded', 'system.orgTemplate.setEndStateSuccess': 'Setting the end status succeeded',
@ -179,7 +179,7 @@ export default {
'system.orgTemplate.templateBug': 'Bug', 'system.orgTemplate.templateBug': 'Bug',
'system.orgTemplate.enableTip': 'Are you sure to enable the project template', 'system.orgTemplate.enableTip': 'Are you sure to enable the project template',
'system.orgTemplate.enableWarningTip': 'Enabled, irreversible for organization template, please careful operation.', 'system.orgTemplate.enableWarningTip': 'Enabled, irreversible for organization template, please careful operation.',
'system.orgTemplate.typeEmptyTip': 'The type cannot be empty', 'system.orgTemplate.typeEmptyTip': 'The filed type cannot be empty',
'system.orgTemplate.searchOrgPlaceholder': 'Please enter the organization name :{name}', 'system.orgTemplate.searchOrgPlaceholder': 'Please enter the organization name :{name}',
'system.orgTemplate.associatedField': 'Associated field ', 'system.orgTemplate.associatedField': 'Associated field ',
'system.orgTemplate.associatedHasField': 'Associate an added field', 'system.orgTemplate.associatedHasField': 'Associate an added field',

View File

@ -122,7 +122,7 @@ export default {
'system.orgTemplate.setInitState': '设为初始态', 'system.orgTemplate.setInitState': '设为初始态',
'system.orgTemplate.deleteStateTitle': '确定删除 {name} 状态吗?', 'system.orgTemplate.deleteStateTitle': '确定删除 {name} 状态吗?',
'system.orgTemplate.deleteStateContent': '删除后,会在项目中立即生效且删除不可撤回,请谨慎操作!', 'system.orgTemplate.deleteStateContent': '删除后,会在项目中立即生效且删除不可撤回,请谨慎操作!',
'system.orgTemplate.deleteFiledContent': '删除后,字段将从字段列表移除,请谨慎操作!', 'system.orgTemplate.deleteFiledContent': '该字段在模板中已使用,删除后数据将会丢失,请谨慎操作!',
'system.orgTemplate.deleteSuccess': '删除成功', 'system.orgTemplate.deleteSuccess': '删除成功',
'system.orgTemplate.setInitStateSuccess': '设置初始态成功', 'system.orgTemplate.setInitStateSuccess': '设置初始态成功',
'system.orgTemplate.setEndStateSuccess': '设置结束状态成功', 'system.orgTemplate.setEndStateSuccess': '设置结束状态成功',
@ -168,7 +168,7 @@ export default {
'system.orgTemplate.templateBug': '缺陷', 'system.orgTemplate.templateBug': '缺陷',
'system.orgTemplate.enableTip': '确认启用项目模版吗', 'system.orgTemplate.enableTip': '确认启用项目模版吗',
'system.orgTemplate.enableWarningTip': '启用后,不可恢复为组织模版,请谨慎操作!', 'system.orgTemplate.enableWarningTip': '启用后,不可恢复为组织模版,请谨慎操作!',
'system.orgTemplate.typeEmptyTip': '类型不能为空', 'system.orgTemplate.typeEmptyTip': '字段类型不能为空',
'system.orgTemplate.searchOrgPlaceholder': '请输入组织名称: {name} ', 'system.orgTemplate.searchOrgPlaceholder': '请输入组织名称: {name} ',
'system.orgTemplate.associatedField': '关联字段 ', 'system.orgTemplate.associatedField': '关联字段 ',
'system.orgTemplate.associatedHasField': '关联已添加的字段', 'system.orgTemplate.associatedHasField': '关联已添加的字段',