fix(系统设置): 修改任务中心表空白&授权管理相关bug

This commit is contained in:
xinxin.wu 2024-04-15 14:10:05 +08:00 committed by 刘瑞斌
parent cbb6c163ae
commit bc163fbf32
9 changed files with 49 additions and 22 deletions

View File

@ -18,11 +18,9 @@
import { EQUAL } from '@/components/pure/ms-advance-filter/index'; import { EQUAL } from '@/components/pure/ms-advance-filter/index';
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue'; import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
import { responseHeaderOption } from '@/config/apiTest';
import type { ExecuteAssertionItem } from '@/models/apiTest/common'; import type { ExecuteAssertionItem } from '@/models/apiTest/common';
import { statusCodeOptions } from './utils'; import { responseHeaderOption, statusCodeOptions } from './utils';
interface Param { interface Param {
[key: string]: any; [key: string]: any;

View File

@ -14,4 +14,18 @@ import {
export const statusCodeOptions = [CONTAINS, NO_CONTAINS, EQUAL, NOT_EQUAL]; export const statusCodeOptions = [CONTAINS, NO_CONTAINS, EQUAL, NOT_EQUAL];
export const codeOptions = [CONTAINS, NO_CONTAINS, EQUAL, NOT_EQUAL, NO_CHECK]; export const codeOptions = [CONTAINS, NO_CONTAINS, EQUAL, NOT_EQUAL, NO_CHECK];
// 断言响应头
export const responseHeaderOption = [
{ label: 'Content-Type', value: 'Content-Type' },
{ label: 'Content-Length', value: 'Content-Length' },
{ label: 'Content-Control', value: 'Content-Control' },
{ label: 'Content-Disposition', value: 'Content-Disposition' },
{ label: 'Content-Encoding', value: 'Content-Encoding' },
{ label: 'Location', value: 'Location' },
{ label: 'Set-Cookie', value: 'Set-Cookie' },
{ label: 'Access-Control-Allow-Origin', value: 'Access-Control-Allow-Origin' },
{ label: 'Expires', value: 'Expires' },
{ label: 'Last-Modified', value: 'Last-Modified' },
];
export default {}; export default {};

View File

@ -35,23 +35,23 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
}, },
{ {
title: t('project.processor.codeTemplateGetVariable'), title: t('project.processor.codeTemplateGetVariable'),
value: 'vars.get("variable_name")', value: 'vars.get("variable_name");',
}, },
{ {
title: t('project.processor.codeTemplateSetVariable'), title: t('project.processor.codeTemplateSetVariable'),
value: 'vars.put("variable_name", "variable_value")', value: 'vars.put("variable_name", "variable_value");',
}, },
{ {
title: t('project.processor.codeTemplateGetResponseHeader'), title: t('project.processor.codeTemplateGetResponseHeader'),
value: 'prev.getResponseHeaders()', value: 'prev.getResponseHeaders();',
}, },
{ {
title: t('project.processor.codeTemplateGetResponseCode'), title: t('project.processor.codeTemplateGetResponseCode'),
value: 'prev.getResponseCode()', value: 'prev.getResponseCode();',
}, },
{ {
title: t('project.processor.codeTemplateGetResponseResult'), title: t('project.processor.codeTemplateGetResponseResult'),
value: 'prev.getResponseDataAsString()', value: 'prev.getResponseDataAsString();',
}, },
{ {
title: t('project.processor.paramEnvironmentSetGlobalVariable'), title: t('project.processor.paramEnvironmentSetGlobalVariable'),

View File

@ -21,13 +21,15 @@
<template #title> {{ t('settings.navbar.task') }}</template> <template #title> {{ t('settings.navbar.task') }}</template>
<div class="divider h-full"> <div class="divider h-full">
<TaskCenter group="project" mode="modal"></TaskCenter> <Suspense>
<TaskCenter group="project" mode="modal"></TaskCenter>
</Suspense>
</div> </div>
</a-modal> </a-modal>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref, Suspense } from 'vue';
import { useVModel } from '@vueuse/core'; import { useVModel } from '@vueuse/core';
import TaskCenter from '@/views/project-management/taskCenter/component/taskCom.vue'; import TaskCenter from '@/views/project-management/taskCenter/component/taskCom.vue';

View File

@ -181,7 +181,7 @@
const exportLoading = ref<boolean>(false); const exportLoading = ref<boolean>(false);
function exportHandler() {} function exportHandler() {}
const detailDrawerRef = ref(); const detailDrawerRef = ref<InstanceType<typeof MsDetailDrawer>>();
watch( watch(
() => showDrawer.value, () => showDrawer.value,

View File

@ -610,9 +610,7 @@
} }
} }
onMounted(async () => { await tableStore.initColumn(groupColumnsMap[props.group].key, groupColumnsMap[props.group].columns, 'drawer', true);
await tableStore.initColumn(groupColumnsMap[props.group].key, groupColumnsMap[props.group].columns, 'drawer', true);
});
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -42,7 +42,7 @@
<li> <li>
<span>{{ t('system.authorized.authorizationsCount') }}</span> <span>{{ t('system.authorized.authorizationsCount') }}</span>
<div <div
><span>{{ licenseInfo?.license?.count }}</span></div ><span>{{ addCommasToNumber(licenseInfo?.license?.count || 0) }}</span></div
> >
</li> </li>
<li> <li>
@ -99,7 +99,7 @@
:auto-size="{ :auto-size="{
minRows: 3, minRows: 3,
}" }"
:rules="[{ required: true }]" :rules="[{ required: true, message: t('system.authorized.LicenseIsRequired') }]"
:max-length="1000" :max-length="1000"
></a-textarea> ></a-textarea>
</a-form-item> </a-form-item>
@ -124,6 +124,7 @@
import { addLicense, getLicenseInfo } from '@/api/modules/setting/authorizedManagement'; import { addLicense, getLicenseInfo } from '@/api/modules/setting/authorizedManagement';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useLicenseStore from '@/store/modules/setting/license'; import useLicenseStore from '@/store/modules/setting/license';
import { addCommasToNumber } from '@/utils';
import type { LicenseInfo } from '@/models/setting/authorizedManagement'; import type { LicenseInfo } from '@/models/setting/authorizedManagement';
@ -149,11 +150,18 @@
loading.value = false; loading.value = false;
} }
}; };
const authDrawer = ref<boolean>(false); const authDrawer = ref<boolean>(false);
const drawerLoading = ref<boolean>(false); const drawerLoading = ref<boolean>(false);
const authFormRef = ref<FormInstance | null>(null); const authFormRef = ref<FormInstance | null>(null);
const fileList = ref([]); const fileList = ref([]);
const cancelHandler = () => {
authDrawer.value = false;
fileList.value = [];
authFormRef.value?.resetFields();
};
const confirmHandler = () => { const confirmHandler = () => {
authFormRef.value?.validate(async (errors: undefined | Record<string, ValidatedError>) => { authFormRef.value?.validate(async (errors: undefined | Record<string, ValidatedError>) => {
if (!errors) { if (!errors) {
@ -163,6 +171,7 @@
authDrawer.value = false; authDrawer.value = false;
Message.success(t('system.authorized.licenseSuccessTip')); Message.success(t('system.authorized.licenseSuccessTip'));
getLicenseDetail(); getLicenseDetail();
cancelHandler();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally { } finally {
@ -174,12 +183,6 @@
}); });
}; };
const cancelHandler = () => {
authDrawer.value = false;
fileList.value = [];
authFormRef.value?.resetFields();
};
const authChecking = () => { const authChecking = () => {
authDrawer.value = true; authDrawer.value = true;
}; };
@ -192,6 +195,7 @@
reader.readAsText((fileList.value[0] as any)?.file, 'UTF-8'); reader.readAsText((fileList.value[0] as any)?.file, 'UTF-8');
reader.onload = (e) => { reader.onload = (e) => {
authorizedForm.licenseCode = e.target?.result; authorizedForm.licenseCode = e.target?.result;
authFormRef.value?.validate();
}; };
}; };
@ -204,6 +208,15 @@
} }
); );
// watch(
// () => authorizedForm.value.licenseCode,
// (val) => {
// if (val.trim().length) {
// authFormRef.value?.validate();
// }
// }
// );
onBeforeMount(() => { onBeforeMount(() => {
getLicenseDetail(); getLicenseDetail();
}); });

View File

@ -14,4 +14,5 @@ export default {
'system.authorized.license': 'License', 'system.authorized.license': 'License',
'system.authorized.licenseCode': 'License Code', 'system.authorized.licenseCode': 'License Code',
'system.authorized.licenseSuccessTip': 'Authorized Successfully', 'system.authorized.licenseSuccessTip': 'Authorized Successfully',
'system.authorized.LicenseIsRequired': 'License Code is required',
}; };

View File

@ -14,4 +14,5 @@ export default {
'system.authorized.license': 'License', 'system.authorized.license': 'License',
'system.authorized.licenseCode': 'License Code', 'system.authorized.licenseCode': 'License Code',
'system.authorized.licenseSuccessTip': '授权成功', 'system.authorized.licenseSuccessTip': '授权成功',
'system.authorized.LicenseIsRequired': 'License Code 是必填项',
}; };