refactor(typescript): typescript升级&报错修复

This commit is contained in:
baiqi 2024-04-19 17:11:16 +08:00 committed by 刘瑞斌
parent e31e890f7e
commit 91f46cc6ad
80 changed files with 322 additions and 264 deletions

View File

@ -132,4 +132,8 @@ module.exports = {
}, },
}, },
], ],
globals: {
// 在这里添加全局变量
NodeJS: 'readonly',
},
}; };

View File

@ -48,7 +48,7 @@
"@tiptap/suggestion": "^2.1.13", "@tiptap/suggestion": "^2.1.13",
"@tiptap/vue-3": "^2.1.13", "@tiptap/vue-3": "^2.1.13",
"@types/color": "^3.0.4", "@types/color": "^3.0.4",
"@types/node": "^20.11.16", "@types/node": "^20.11.19",
"@vueuse/core": "^10.9.0", "@vueuse/core": "^10.9.0",
"@xmldom/xmldom": "^0.8.10", "@xmldom/xmldom": "^0.8.10",
"ace-builds": "^1.24.2", "ace-builds": "^1.24.2",
@ -93,6 +93,9 @@
"@types/lodash": "^4.14.198", "@types/lodash": "^4.14.198",
"@types/lodash-es": "^4.17.9", "@types/lodash-es": "^4.17.9",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/pretty": "^2.0.3",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@types/sortablejs": "^1.15.2", "@types/sortablejs": "^1.15.2",
"@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1", "@typescript-eslint/parser": "^7.1.1",
@ -144,7 +147,7 @@
"stylelint-less": "^1.0.8", "stylelint-less": "^1.0.8",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.3.3",
"typescript": "^5.4.2", "typescript": "^5.4.5",
"unplugin-auto-import": "^0.16.7", "unplugin-auto-import": "^0.16.7",
"unplugin-vue-components": "^0.24.1", "unplugin-vue-components": "^0.24.1",
"vite": "^3.2.7", "vite": "^3.2.7",

View File

@ -36,6 +36,7 @@ import type {
LocalConfig, LocalConfig,
LoginData, LoginData,
LoginRes, LoginRes,
OrgOptionItem,
PersonalInfo, PersonalInfo,
UpdateAPIKEYParams, UpdateAPIKEYParams,
UpdateBaseInfo, UpdateBaseInfo,
@ -177,5 +178,5 @@ export function getPlatformAccount() {
// 个人信息-获取第三方平台-组织下拉选项 // 个人信息-获取第三方平台-组织下拉选项
export function getPlatformOrgOption() { export function getPlatformOrgOption() {
return MSR.get({ url: GetPlatformOrgOptionUrl }); return MSR.get<OrgOptionItem[]>({ url: GetPlatformOrgOptionUrl });
} }

View File

@ -399,6 +399,7 @@
const { t } = useI18n(); const { t } = useI18n();
// TODO: Param
interface Param { interface Param {
[key: string]: any; [key: string]: any;
} }
@ -713,7 +714,7 @@
function applyMoreSetting(record: ExpressionConfig) { function applyMoreSetting(record: ExpressionConfig) {
switch (condition.value.assertionBodyType) { switch (condition.value.assertionBodyType) {
case ResponseBodyAssertionType.JSON_PATH: case ResponseBodyAssertionType.JSON_PATH:
condition.value.jsonPathAssertion.assertions = condition.value.jsonPathAssertion.assertions?.map((e) => { condition.value.jsonPathAssertion.assertions = condition.value.jsonPathAssertion.assertions?.map((e: Param) => {
if (e.id === activeRecord.value.id) { if (e.id === activeRecord.value.id) {
record.moreSettingPopoverVisible = false; record.moreSettingPopoverVisible = false;
return { return {
@ -725,7 +726,7 @@
}); });
break; break;
case ResponseBodyAssertionType.XPATH: case ResponseBodyAssertionType.XPATH:
condition.value.xpathAssertion.assertions = condition.value.xpathAssertion.assertions?.map((e) => { condition.value.xpathAssertion.assertions = condition.value.xpathAssertion.assertions?.map((e: Param) => {
if (e.id === activeRecord.value.id) { if (e.id === activeRecord.value.id) {
record.moreSettingPopoverVisible = false; record.moreSettingPopoverVisible = false;
return { return {
@ -737,7 +738,7 @@
}); });
break; break;
case ResponseBodyAssertionType.REGEX: case ResponseBodyAssertionType.REGEX:
condition.value.regexAssertion.assertions = condition.value.regexAssertion.assertions?.map((e) => { condition.value.regexAssertion.assertions = condition.value.regexAssertion.assertions?.map((e: Param) => {
if (e.id === activeRecord.value.id) { if (e.id === activeRecord.value.id) {
record.moreSettingPopoverVisible = false; record.moreSettingPopoverVisible = false;
return { return {
@ -761,7 +762,7 @@
config: RegexExtract | JSONPathExtract | XPathExtract, config: RegexExtract | JSONPathExtract | XPathExtract,
matchResult: Record<string, any> matchResult: Record<string, any>
) { ) {
condition.value.jsonPathAssertion.assertions = condition.value.jsonPathAssertion.assertions?.map((e) => { condition.value.jsonPathAssertion.assertions = condition.value.jsonPathAssertion.assertions?.map((e: Param) => {
if (e.id === activeRecord.value.id) { if (e.id === activeRecord.value.id) {
return { return {
...e, ...e,
@ -771,7 +772,7 @@
} }
return e; return e;
}); });
condition.value.xpathAssertion.assertions = condition.value.xpathAssertion.assertions?.map((e) => { condition.value.xpathAssertion.assertions = condition.value.xpathAssertion.assertions?.map((e: Param) => {
if (e.id === activeRecord.value.id) { if (e.id === activeRecord.value.id) {
return { return {
...e, ...e,
@ -780,7 +781,7 @@
} }
return e; return e;
}); });
condition.value.regexAssertion.assertions = condition.value.regexAssertion.assertions?.map((e) => { condition.value.regexAssertion.assertions = condition.value.regexAssertion.assertions?.map((e: Param) => {
if (e.id === activeRecord.value.id) { if (e.id === activeRecord.value.id) {
return { return {
...e, ...e,
@ -794,17 +795,17 @@
nextTick(() => { nextTick(() => {
if (condition.value.assertionBodyType === ResponseBodyAssertionType.JSON_PATH) { if (condition.value.assertionBodyType === ResponseBodyAssertionType.JSON_PATH) {
extractParamsTableRef.value?.addTableLine( extractParamsTableRef.value?.addTableLine(
condition.value.jsonPathAssertion.assertions?.findIndex((e) => e.id === activeRecord.value.id) || 0 condition.value.jsonPathAssertion.assertions?.findIndex((e: Param) => e.id === activeRecord.value.id) || 0
); );
} }
if (condition.value.assertionBodyType === ResponseBodyAssertionType.XPATH) { if (condition.value.assertionBodyType === ResponseBodyAssertionType.XPATH) {
extractParamsTableRef.value?.addTableLine( extractParamsTableRef.value?.addTableLine(
condition.value.xpathAssertion.assertions?.findIndex((e) => e.id === activeRecord.value.id) || 0 condition.value.xpathAssertion.assertions?.findIndex((e: Param) => e.id === activeRecord.value.id) || 0
); );
} }
if (condition.value.assertionBodyType === ResponseBodyAssertionType.REGEX) { if (condition.value.assertionBodyType === ResponseBodyAssertionType.REGEX) {
extractParamsTableRef.value?.addTableLine( extractParamsTableRef.value?.addTableLine(
condition.value.xpathAssertion.regexAssertion?.findIndex((e) => e.id === activeRecord.value.id) || 0 condition.value.xpathAssertion.regexAssertion?.findIndex((e: Param) => e.id === activeRecord.value.id) || 0
); );
} }
}); });
@ -814,7 +815,9 @@
function copyItem(record: Record<string, any>) { function copyItem(record: Record<string, any>) {
switch (condition.value.assertionBodyType) { switch (condition.value.assertionBodyType) {
case ResponseBodyAssertionType.JSON_PATH: case ResponseBodyAssertionType.JSON_PATH:
const jsonIndex = condition.value.jsonPathAssertion.assertions.findIndex((item) => item.id === record.id); const jsonIndex = condition.value.jsonPathAssertion.assertions.findIndex(
(item: Param) => item.id === record.id
);
if (jsonIndex > -1) { if (jsonIndex > -1) {
condition.value.jsonPathAssertion.assertions.splice(jsonIndex, 0, { condition.value.jsonPathAssertion.assertions.splice(jsonIndex, 0, {
...record, ...record,
@ -826,7 +829,7 @@
} }
break; break;
case ResponseBodyAssertionType.XPATH: case ResponseBodyAssertionType.XPATH:
const xpathIndex = condition.value.xpathAssertion.assertions.findIndex((item) => item.id === record.id); const xpathIndex = condition.value.xpathAssertion.assertions.findIndex((item: Param) => item.id === record.id);
if (xpathIndex > -1) { if (xpathIndex > -1) {
condition.value.xpathAssertion.assertions.splice(xpathIndex, 0, { condition.value.xpathAssertion.assertions.splice(xpathIndex, 0, {
...record, ...record,
@ -846,7 +849,7 @@
}); });
break; break;
case ResponseBodyAssertionType.REGEX: case ResponseBodyAssertionType.REGEX:
const regIndex = condition.value.regexAssertion.assertions.findIndex((item) => item.id === record.id); const regIndex = condition.value.regexAssertion.assertions.findIndex((item: Param) => item.id === record.id);
if (regIndex > -1) { if (regIndex > -1) {
condition.value.regexAssertion.assertions.splice(regIndex, 0, { condition.value.regexAssertion.assertions.splice(regIndex, 0, {
...record, ...record,

View File

@ -95,7 +95,7 @@
emit('formApiImport'); emit('formApiImport');
} }
function _handleCommand(command) { function _handleCommand(command: string) {
switch (command) { switch (command) {
// //
case 'custom_function': case 'custom_function':

View File

@ -66,10 +66,10 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
]; ];
// 处理groovyCode 请求头 // 处理groovyCode 请求头
function getGroovyHeaders(requestHeaders) { function getGroovyHeaders(requestHeaders: Record<string, any>) {
let headers = '['; let headers = '[';
let index = 1; let index = 1;
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
if (index !== 1) { if (index !== 1) {
headers += ','; headers += ',';
} }
@ -80,11 +80,11 @@ function getGroovyHeaders(requestHeaders) {
return headers; return headers;
} }
// 解析请求url // 解析请求url
function getRequestPath(requestArgs, requestPath) { function getRequestPath(requestArgs: Record<string, any>, requestPath: string) {
if (requestArgs.size > 0) { if (requestArgs.size > 0) {
requestPath += '?'; requestPath += '?';
let index = 1; let index = 1;
requestArgs.forEach(([k, v]) => { requestArgs.forEach(([k, v]: any[]) => {
if (index !== 1) { if (index !== 1) {
requestPath += '&'; requestPath += '&';
} }
@ -95,7 +95,7 @@ function getRequestPath(requestArgs, requestPath) {
return requestPath; return requestPath;
} }
// 处理mockPath // 处理mockPath
function getMockPath(domain, port, socket) { function getMockPath(domain: string, port: string, socket: string) {
if (domain === socket || !port) { if (domain === socket || !port) {
return ''; return '';
} }
@ -105,11 +105,11 @@ function getMockPath(domain, port, socket) {
} }
// 处理请求参数 // 处理请求参数
function replaceRestParams(path, restMap) { function replaceRestParams(path: string, restMap: Record<string, any>) {
if (!path) { if (!path) {
return path; return path;
} }
let arr = path.match(/{([\w]+)}/g); let arr: any[] | null = path.match(/{([\w]+)}/g);
if (Array.isArray(arr) && arr.length > 0) { if (Array.isArray(arr) && arr.length > 0) {
arr = Array.from(new Set(arr)); arr = Array.from(new Set(arr));
arr.forEach((str) => { arr.forEach((str) => {
@ -128,7 +128,7 @@ function replaceRestParams(path, restMap) {
} }
// 返回最终groovyCode 代码模板片段 // 返回最终groovyCode 代码模板片段
function _groovyCodeTemplate(obj) { function _groovyCodeTemplate(obj: Record<string, any>) {
const { requestUrl, requestMethod, headers, body } = obj; const { requestUrl, requestMethod, headers, body } = obj;
const params = `[ const params = `[
'url': '${requestUrl}', 'url': '${requestUrl}',
@ -164,7 +164,7 @@ log.info(conn.content.text)
} }
// 处理groovyCode语言 // 处理groovyCode语言
function groovyCode(requestObj) { function groovyCode(requestObj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestBody = '', requestBody = '',
@ -183,7 +183,7 @@ function groovyCode(requestObj) {
let requestUrl = ''; let requestUrl = '';
if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) { if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) {
// 如果是get方法要将kv值加入argument中 // 如果是get方法要将kv值加入argument中
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
requestArguments.set(k, v); requestArguments.set(k, v);
}); });
} }
@ -197,7 +197,7 @@ function groovyCode(requestObj) {
if (requestMethod === 'POST' && bodyType === 'kvs') { if (requestMethod === 'POST' && bodyType === 'kvs') {
body = '"'; body = '"';
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
if (body !== '"') { if (body !== '"') {
body += '&'; body += '&';
} }
@ -215,10 +215,10 @@ function groovyCode(requestObj) {
} }
// 获取请求头 // 获取请求头
function getHeaders(requestHeaders) { function getHeaders(requestHeaders: Record<string, any>) {
let headers = '{'; let headers = '{';
let index = 1; let index = 1;
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
if (index !== 1) { if (index !== 1) {
headers += ','; headers += ',';
} }
@ -230,13 +230,13 @@ function getHeaders(requestHeaders) {
return headers; return headers;
} }
// 获取pythonCode 模板 // 获取pythonCode 模板
function _pythonCodeTemplate(obj) { function _pythonCodeTemplate(obj: Record<string, any>) {
const { requestBody, requestBodyKvs, bodyType, requestPath, requestMethod, connType, domain, port } = obj; const { requestBody, requestBodyKvs, bodyType, requestPath, requestMethod, connType, domain, port } = obj;
let { headers } = obj; let { headers } = obj;
let reqBody = obj.requestBody; let reqBody = obj.requestBody;
if (requestMethod.toLowerCase() === 'post' && obj.bodyType === 'kvs' && obj.requestBodyKvs) { if (requestMethod.toLowerCase() === 'post' && obj.bodyType === 'kvs' && obj.requestBodyKvs) {
reqBody = 'urllib.urlencode({'; reqBody = 'urllib.urlencode({';
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
reqBody += `'${k}':'${v}'`; reqBody += `'${k}':'${v}'`;
}); });
reqBody += `})`; reqBody += `})`;
@ -266,7 +266,7 @@ log.info(data)
} }
// 处理pythonCode语言 // 处理pythonCode语言
function pythonCode(requestObj) { function pythonCode(requestObj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestMethod = '', requestMethod = '',
@ -287,7 +287,7 @@ function pythonCode(requestObj) {
const headers = getHeaders(requestHeaders); const headers = getHeaders(requestHeaders);
requestBody = requestBody ? JSON.stringify(requestBody) : '{}'; requestBody = requestBody ? JSON.stringify(requestBody) : '{}';
if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) { if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) {
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
requestArguments.set(k, v); requestArguments.set(k, v);
}); });
} }
@ -299,7 +299,7 @@ function pythonCode(requestObj) {
} }
// 获取javaBeanshell代码模板 // 获取javaBeanshell代码模板
function _beanshellTemplate(obj) { function _beanshellTemplate(obj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestBodyKvs = new Map(), requestBodyKvs = new Map(),
@ -322,14 +322,14 @@ function _beanshellTemplate(obj) {
.setPath("${requestPath}") .setPath("${requestPath}")
`; `;
// http 请求类型 // http 请求类型
const method = requestMethod.toLowerCase().replace(/^\S/, (s) => s.toUpperCase()); const method = requestMethod.toLowerCase().replace(/^\S/, (s: string) => s.toUpperCase());
const httpMethodCode = `Http${method} request = new Http${method}(uri);`; const httpMethodCode = `Http${method} request = new Http${method}(uri);`;
// 设置参数 // 设置参数
requestArguments.forEach(([k, v]) => { requestArguments.forEach(([k, v]: any[]) => {
uri += `.setParameter("${k}", "${v}")`; uri += `.setParameter("${k}", "${v}")`;
}); });
if (method === 'Get' && requestBodyKvs) { if (method === 'Get' && requestBodyKvs) {
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
uri += `.setParameter("${k}", "${v}")`; uri += `.setParameter("${k}", "${v}")`;
}); });
} }
@ -337,7 +337,7 @@ function _beanshellTemplate(obj) {
let postKvsParam = ''; let postKvsParam = '';
if (method === 'Post') { if (method === 'Post') {
// 设置post参数 // 设置post参数
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
postKvsParam += `nameValueList.add(new BasicNameValuePair("${k}", "${v}"));\r\n`; postKvsParam += `nameValueList.add(new BasicNameValuePair("${k}", "${v}"));\r\n`;
}); });
if (postKvsParam !== '') { if (postKvsParam !== '') {
@ -356,7 +356,7 @@ function _beanshellTemplate(obj) {
} }
// 设置请求头 // 设置请求头
let setHeader = ''; let setHeader = '';
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
setHeader = `${setHeader}request.setHeader("${k}", "${v}");\n`; setHeader = `${setHeader}request.setHeader("${k}", "${v}");\n`;
}); });
try { try {
@ -414,12 +414,12 @@ if (response.getStatusLine().getStatusCode() == 200) {
} }
// 处理java语言 // 处理java语言
function javaCode(requestObj) { function javaCode(requestObj: Record<string, any>) {
return _beanshellTemplate(requestObj); return _beanshellTemplate(requestObj);
} }
// 获取js语言代码模板 // 获取js语言代码模板
function _jsTemplate(obj) { function _jsTemplate(obj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestMethod = 'GET', requestMethod = 'GET',
@ -444,7 +444,7 @@ function _jsTemplate(obj) {
} }
if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) { if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) {
// 如果是get方法要将kv值加入argument中 // 如果是get方法要将kv值加入argument中
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
requestArguments.set(k, v); requestArguments.set(k, v);
}); });
} }
@ -459,13 +459,13 @@ function _jsTemplate(obj) {
if (bodyType && bodyType.toUpperCase() === 'RAW') { if (bodyType && bodyType.toUpperCase() === 'RAW') {
requestHeaders.set('Content-type', 'text/plain'); requestHeaders.set('Content-type', 'text/plain');
} }
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
connStr += `conn.setRequestProperty("${k}","${v}");\n`; connStr += `conn.setRequestProperty("${k}","${v}");\n`;
}); });
if (requestMethod === 'POST' && bodyType === 'kvs') { if (requestMethod === 'POST' && bodyType === 'kvs') {
requestBody = '"'; requestBody = '"';
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
if (requestBody !== '"') { if (requestBody !== '"') {
requestBody += '&'; requestBody += '&';
} }
@ -508,7 +508,7 @@ log.info(res);
} }
// 处理js语言 // 处理js语言
function jsCode(requestObj) { function jsCode(requestObj: Record<string, any>) {
return _jsTemplate(requestObj); return _jsTemplate(requestObj);
} }
@ -532,5 +532,3 @@ export function getCodeTemplate(language: Language | RequestConditionScriptLangu
return ''; return '';
} }
} }
export default {};

View File

@ -259,7 +259,7 @@
}); });
// trigger // trigger
const orgTrigger = (e, visible: Ref, slot: (item) => VNode) => ( const orgTrigger = (e: Record<string, any>, visible: Ref, slot: (item: Record<string, any>) => VNode) => (
<a-trigger <a-trigger
v-model:popup-visible={visible.value} v-model:popup-visible={visible.value}
trigger="click" trigger="click"
@ -385,16 +385,16 @@
return ( return (
<MsPersonInfoDrawer <MsPersonInfoDrawer
visible={personalDrawerVisible.value} visible={personalDrawerVisible.value}
onUpdate:visible={(e) => { onUpdate:visible={(e: boolean) => {
personalDrawerVisible.value = e; personalDrawerVisible.value = e;
}} }}
/> />
); );
}; };
let mouseEnterTimer; let mouseEnterTimer: NodeJS.Timeout;
// //
const renderMenuItem = (element: RouteRecordRaw | null, icon) => const renderMenuItem = (element: RouteRecordRaw | null, icon: (() => any) | null) =>
element?.name === SettingRouteEnum.SETTING_ORGANIZATION ? ( element?.name === SettingRouteEnum.SETTING_ORGANIZATION ? (
<a-menu-item key={element?.name} v-slots={{ icon }} onClick={() => goto(element)}> <a-menu-item key={element?.name} v-slots={{ icon }} onClick={() => goto(element)}>
<div class="inline-flex w-[calc(100%-34px)] items-center justify-between !bg-transparent"> <div class="inline-flex w-[calc(100%-34px)] items-center justify-between !bg-transparent">

View File

@ -341,7 +341,8 @@
return count; return count;
} }
const resourceTypeRouteMap = { // TODO: MessageResourceType
const resourceTypeRouteMap: Record<string, string> = {
[MessageResourceType.BUG_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL, [MessageResourceType.BUG_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL,
[MessageResourceType.BUG_SYNC_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL, [MessageResourceType.BUG_SYNC_TASK]: BugManagementRouteEnum.BUG_MANAGEMENT_DETAIL,
[MessageResourceType.FUNCTIONAL_CASE_TASK]: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE_DETAIL, [MessageResourceType.FUNCTIONAL_CASE_TASK]: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE_DETAIL,

View File

@ -23,12 +23,12 @@
</a-tooltip> </a-tooltip>
<MsTag <MsTag
theme="light" theme="light"
:type="tagMap[config.status].type" :type="tagMap[config.status as Status].type"
:self-style="tagMap[config.status].style" :self-style="tagMap[config.status as Status].style"
size="small" size="small"
class="px-[4px]" class="px-[4px]"
> >
{{ tagMap[config.status].text }} {{ tagMap[config.status as Status].text }}
</MsTag> </MsTag>
</div> </div>
<MsFormCreate <MsFormCreate
@ -47,7 +47,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Message } from '@arco-design/web-vue'; import { Message, SelectOptionData } from '@arco-design/web-vue';
import MsFormCreate from '@/components/pure/ms-form-create/ms-form-create.vue'; import MsFormCreate from '@/components/pure/ms-form-create/ms-form-create.vue';
import MsTag, { TagType } from '@/components/pure/ms-tag/ms-tag.vue'; import MsTag, { TagType } from '@/components/pure/ms-tag/ms-tag.vue';
@ -117,7 +117,7 @@
}, },
}); });
const currentOrg = ref(appStore.currentOrgId); const currentOrg = ref(appStore.currentOrgId);
const orgOptions = ref([]); const orgOptions = ref<SelectOptionData[]>([]);
const orgLoading = ref(false); const orgLoading = ref(false);
async function initOrgOptions() { async function initOrgOptions() {
@ -128,7 +128,6 @@
label: e.name, label: e.name,
value: e.id, value: e.id,
})); }));
console.log(orgOptions.value);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -251,4 +250,4 @@
color: var(--color-text-4) !important; color: var(--color-text-4) !important;
} }
} }
</style> </style>

View File

@ -290,7 +290,7 @@
return true; return true;
} }
function onDragStart(e, node: MsTreeNodeData) { function onDragStart(e: DragEvent, node: MsTreeNodeData) {
tempDragNode.value = node; tempDragNode.value = node;
} }

View File

@ -370,7 +370,7 @@
const postStr = currentValue.split(':')[1]; const postStr = currentValue.split(':')[1];
if (postStr === 'READ') { if (postStr === 'READ') {
// //
record.perChecked = record.perChecked.filter((item) => !item.includes(preStr)); record.perChecked = record.perChecked.filter((item: string) => !item.includes(preStr));
} else { } else {
record.perChecked.splice(record.perChecked.indexOf(currentValue), 1); record.perChecked.splice(record.perChecked.indexOf(currentValue), 1);
} }

View File

@ -57,7 +57,7 @@
if (pluginId) { if (pluginId) {
try { try {
const { rule } = (attrs.formCreateInject as { [key: string]: any }).api; const { rule } = (attrs.formCreateInject as { [key: string]: any }).api;
const extra = {}; const extra: Record<string, any> = {};
rule.forEach((item: Rule) => { rule.forEach((item: Rule) => {
extra[item.field as string] = item.value; extra[item.field as string] = item.value;
}); });

View File

@ -75,7 +75,9 @@
'pick', 'pick',
jsonPath.value, jsonPath.value,
json.value, json.value,
JSONPath({ json: json.value, path: jsonPath.value }).map((e) => `${e}`.replace(/Number\(([^)]+)\)/g, '$1')) JSONPath({ json: json.value, path: jsonPath.value }).map((e: any) =>
`${e}`.replace(/Number\(([^)]+)\)/g, '$1')
)
); );
} }
}, 0); }, 0);

View File

@ -10,6 +10,7 @@ import {
BlockActionSeparator, BlockActionSeparator,
type Editor, type Editor,
EditorState, EditorState,
type EditorView,
isActive, isActive,
mergeAttributes, mergeAttributes,
ToolboxItem, ToolboxItem,
@ -128,7 +129,7 @@ const Image = TiptapImage.extend<ExtensionOptions & ImageOptions>({
]; ];
}, },
addOptions() { addOptions(): any {
return { return {
...this.parent?.(), ...this.parent?.(),
getToolboxItems({ editor }: { editor: Editor }) { getToolboxItems({ editor }: { editor: Editor }) {
@ -204,7 +205,7 @@ const Image = TiptapImage.extend<ExtensionOptions & ImageOptions>({
}, },
getDraggable() { getDraggable() {
return { return {
getRenderContainer({ dom, view }) { getRenderContainer({ dom, view }: { dom: Element; view: EditorView }) {
let container = dom; let container = dom;
while (container && container.tagName !== 'P') { while (container && container.tagName !== 'P') {
container = container.parentElement as HTMLElement; container = container.parentElement as HTMLElement;

View File

@ -9,3 +9,9 @@ declare module '*.vue' {
interface ImportMetaEnv { interface ImportMetaEnv {
readonly VITE_API_BASE_URL: string; readonly VITE_API_BASE_URL: string;
} }
declare module 'xml-beautify' {
export default class xmlBeautify {
beautify: (xml: string) => string;
}
}

View File

@ -213,8 +213,8 @@ export interface ReviewCaseItem {
versionName: string; versionName: string;
reviewers: string[]; reviewers: string[];
reviewNames: string[]; reviewNames: string[];
status: string; status: ReviewResult;
myStatus: string; myStatus: ReviewResult;
moduleId: string; moduleId: string;
moduleName: string; moduleName: string;
} }

View File

@ -122,3 +122,8 @@ export interface UpdateBaseInfo {
email: string; email: string;
avatar: string; avatar: string;
} }
export interface OrgOptionItem {
id: string;
name: string;
}

View File

@ -1,10 +1,9 @@
import { cloneDeep, each } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import JSEncrypt from 'jsencrypt'; import JSEncrypt from 'jsencrypt';
import { BatchActionQueryParams, MsTableColumnData } from '@/components/pure/ms-table/type'; import { BatchActionQueryParams, MsTableColumnData } from '@/components/pure/ms-table/type';
import { BugEditCustomField, CustomFieldItem } from '@/models/bug-management'; import { BugEditCustomField, CustomFieldItem } from '@/models/bug-management';
import type { CustomAttributes } from '@/models/caseManagement/featureCase';
import { isObject } from './is'; import { isObject } from './is';
@ -206,7 +205,7 @@ export function traverseTree<T>(
tree = [tree]; tree = [tree];
} }
for (let i = 0; i < tree.length; i++) { for (let i = 0; i < tree.length; i++) {
const node = tree[i]; const node = (tree as TreeNode<T>[])[i];
if (typeof customNodeFn === 'function') { if (typeof customNodeFn === 'function') {
customNodeFn(node); customNodeFn(node);
} }
@ -280,18 +279,18 @@ export function mapTree<T>(
*/ */
export function filterTree<T>( export function filterTree<T>(
tree: TreeNode<T> | TreeNode<T>[] | T | T[], tree: TreeNode<T> | TreeNode<T>[] | T | T[],
filterFn: (node: T) => boolean, filterFn: (node: TreeNode<T>) => boolean,
customChildrenKey = 'children' customChildrenKey = 'children'
): T[] { ): TreeNode<T>[] {
if (!Array.isArray(tree)) { if (!Array.isArray(tree)) {
tree = [tree]; tree = [tree];
} }
const filteredTree: T[] = []; const filteredTree: TreeNode<T>[] = [];
for (let i = 0; i < tree.length; i++) { for (let i = 0; i < tree.length; i++) {
const node: T = tree[i]; const node = (tree as TreeNode<T>[])[i];
// 如果节点满足过滤条件,则保留该节点,并递归过滤子节点 // 如果节点满足过滤条件,则保留该节点,并递归过滤子节点
if (filterFn(node)) { if (filterFn(node)) {
const newNode: T = cloneDeep(node); const newNode = cloneDeep(node);
if (node[customChildrenKey] && node[customChildrenKey].length > 0) { if (node[customChildrenKey] && node[customChildrenKey].length > 0) {
// 递归过滤子节点,并将过滤后的子节点添加到当前节点中 // 递归过滤子节点,并将过滤后的子节点添加到当前节点中
newNode[customChildrenKey] = filterTree(node[customChildrenKey], filterFn, customChildrenKey); newNode[customChildrenKey] = filterTree(node[customChildrenKey], filterFn, customChildrenKey);
@ -683,7 +682,7 @@ export const downloadByteFile = (byte: BlobPart, fileName: string) => {
* @param {*} flag * @param {*} flag
*/ */
export function compress(img, type, maxWidth, flag) { export function compress(img: ImageData, type: string, maxWidth: number, flag: boolean) {
let canvas: HTMLCanvasElement | null = document.createElement('canvas'); let canvas: HTMLCanvasElement | null = document.createElement('canvas');
let ctx2: any = canvas.getContext('2d'); let ctx2: any = canvas.getContext('2d');

View File

@ -5,7 +5,7 @@ export interface Option {
} }
// 递归函数,获取所有父级元素 // 递归函数,获取所有父级元素
export function findParents(data: Option[], targetId: string, parents: string[] = []) { export function findParents(data: Option[], targetId: string, parents: string[] = []): string[] | null {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const current = data[i]; const current = data[i];
if (current.value === targetId) { if (current.value === targetId) {

View File

@ -172,7 +172,7 @@
if (match) { if (match) {
const value = parseInt(match[1], 10); const value = parseInt(match[1], 10);
const type = match[2]; const type = match[2];
const translations = { const translations: Record<string, string> = {
M: t('msTimeSelector.month'), M: t('msTimeSelector.month'),
Y: t('msTimeSelector.year'), Y: t('msTimeSelector.year'),
H: t('msTimeSelector.hour'), H: t('msTimeSelector.hour'),

View File

@ -33,7 +33,9 @@
{{ `${t('apiTestDebug.wait')}${item.delay}` }} ms {{ `${t('apiTestDebug.wait')}${item.delay}` }} ms
</div> </div>
<div v-else class="flex min-w-[42px] items-center justify-between"> <div v-else class="flex min-w-[42px] items-center justify-between">
<div class="one-line-text"> {{ item.name || t(conditionTypeNameMap[item.processorType]) }}</div> <div class="one-line-text">
{{ item.name || t(conditionTypeNameMap[item.processorType as keyof typeof conditionTypeNameMap]) }}</div
>
<a-badge <a-badge
v-if="item.processorType === RequestConditionProcessor.REQUEST_SCRIPT" v-if="item.processorType === RequestConditionProcessor.REQUEST_SCRIPT"
class="ml-1 mt-[2px] min-w-[48px]" class="ml-1 mt-[2px] min-w-[48px]"

View File

@ -255,7 +255,7 @@
JSONPath({ JSONPath({
json: parseJson.value, json: parseJson.value,
path: expressionForm.value.expression, path: expressionForm.value.expression,
})?.map((e) => JSON.stringify(e).replace(/"Number\(([^)]+)\)"|Number\(([^)]+)\)/g, '$1$2')) || []; })?.map((e: any) => JSON.stringify(e).replace(/"Number\(([^)]+)\)"|Number\(([^)]+)\)/g, '$1$2')) || [];
} catch (error) { } catch (error) {
matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }) || []; matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }) || [];
} }

View File

@ -603,7 +603,7 @@
rowIndex: number; rowIndex: number;
columnIndex: number; columnIndex: number;
}) => { rowspan?: number; colspan?: number } | void; }) => { rowspan?: number; colspan?: number } | void;
uploadTempFileApi?: (...args) => Promise<any>; // uploadTempFileApi?: (...args: any) => Promise<any>; //
fileSaveAsSourceId?: string | number; // id fileSaveAsSourceId?: string | number; // id
fileSaveAsApi?: (params: TransferFileParams) => Promise<string>; // fileSaveAsApi?: (params: TransferFileParams) => Promise<string>; //
fileModuleOptionsApi?: (projectId: string) => Promise<ModuleTreeNode[]>; // fileModuleOptionsApi?: (projectId: string) => Promise<ModuleTreeNode[]>; //

View File

@ -168,7 +168,7 @@
disabledParamValue?: boolean; // disabledParamValue?: boolean; //
disabledExceptParam?: boolean; // disabledExceptParam?: boolean; //
isShowCommonContentTabKey?: boolean; // tabKey isShowCommonContentTabKey?: boolean; // tabKey
uploadTempFileApi?: (...args) => Promise<any>; // uploadTempFileApi?: (...args: any) => Promise<any>; //
fileSaveAsSourceId?: string | number; // id fileSaveAsSourceId?: string | number; // id
fileSaveAsApi?: (params: TransferFileParams) => Promise<string>; // fileSaveAsApi?: (params: TransferFileParams) => Promise<string>; //
fileModuleOptionsApi?: (projectId: string) => Promise<ModuleTreeNode[]>; // fileModuleOptionsApi?: (projectId: string) => Promise<ModuleTreeNode[]>; //
@ -382,7 +382,7 @@
const formData = tempForm || requestVModel.value; const formData = tempForm || requestVModel.value;
if (fApi.value) { if (fApi.value) {
fApi.value.nextTick(() => { fApi.value.nextTick(() => {
const form = {}; const form: Record<string, any> = {};
controlPluginFormFields().forEach((key) => { controlPluginFormFields().forEach((key) => {
form[key] = formData[key]; form[key] = formData[key];
}); });

View File

@ -219,7 +219,7 @@
v-show="requestVModel.activeTab === RequestComposition.BASE_INFO" v-show="requestVModel.activeTab === RequestComposition.BASE_INFO"
ref="apiBaseFormRef" ref="apiBaseFormRef"
v-model:requestVModel="requestVModel" v-model:requestVModel="requestVModel"
:select-tree="selectTree" :select-tree="selectTree as ModuleTreeNode[]"
/> />
<a-spin <a-spin
v-show="requestVModel.activeTab === RequestComposition.PLUGIN" v-show="requestVModel.activeTab === RequestComposition.PLUGIN"
@ -565,9 +565,9 @@
otherParams?: Record<string, any>; // otherParams?: Record<string, any>; //
executeApi?: (params: ExecuteRequestParams) => Promise<any>; // executeApi?: (params: ExecuteRequestParams) => Promise<any>; //
localExecuteApi?: (url: string, params: ExecuteRequestParams) => Promise<any>; // localExecuteApi?: (url: string, params: ExecuteRequestParams) => Promise<any>; //
createApi?: (...args) => Promise<any>; // createApi?: (...args: any) => Promise<any>; //
updateApi?: (...args) => Promise<any>; // updateApi?: (...args: any) => Promise<any>; //
uploadTempFileApi?: (...args) => Promise<any>; // uploadTempFileApi?: (...args: any) => Promise<any>; //
fileSaveAsSourceId?: string | number; // id fileSaveAsSourceId?: string | number; // id
fileSaveAsApi?: (params: TransferFileParams) => Promise<string>; // fileSaveAsApi?: (params: TransferFileParams) => Promise<string>; //
fileModuleOptionsApi?: (projectId: string) => Promise<ModuleTreeNode[]>; // fileModuleOptionsApi?: (projectId: string) => Promise<ModuleTreeNode[]>; //
@ -588,7 +588,7 @@
const requestVModel = defineModel<RequestParam>('request', { required: true }); const requestVModel = defineModel<RequestParam>('request', { required: true });
const isHttpProtocol = computed(() => requestVModel.value.protocol === 'HTTP'); const isHttpProtocol = computed(() => requestVModel.value.protocol === 'HTTP');
const temporaryResponseMap = {}; // websockettab const temporaryResponseMap: Record<string, any> = {}; // websockettab
const isInitPluginForm = ref(false); const isInitPluginForm = ref(false);
const isSwitchingContent = ref(false); // const isSwitchingContent = ref(false); //
@ -819,7 +819,7 @@
if (fApi.value) { if (fApi.value) {
fApi.value.nextTick(() => { fApi.value.nextTick(() => {
// 使nextTick使v-if // 使nextTick使v-if
const form = {}; const form: Record<string, any> = {};
controlPluginFormFields().forEach((key) => { controlPluginFormFields().forEach((key) => {
form[key] = formData[key]; form[key] = formData[key];
}); });
@ -1220,7 +1220,7 @@
await nextTick(); await nextTick();
requestVModel.value.executeLoading = true; requestVModel.value.executeLoading = true;
requestVModel.value.response = cloneDeep(defaultResponse); requestVModel.value.response = cloneDeep(defaultResponse);
const res = await props.executeApi(makeRequestParams(executeType)); const res = await props.executeApi(makeRequestParams(executeType) as ExecuteRequestParams);
if (executeType === 'localExec' && props.localExecuteApi && localExecuteUrl.value) { if (executeType === 'localExec' && props.localExecuteApi && localExecuteUrl.value) {
await props.localExecuteApi(localExecuteUrl.value, res); await props.localExecuteApi(localExecuteUrl.value, res);
} }
@ -1238,7 +1238,7 @@
if (!props.executeApi) return; if (!props.executeApi) return;
requestVModel.value.executeLoading = true; requestVModel.value.executeLoading = true;
requestVModel.value.response = cloneDeep(defaultResponse); requestVModel.value.response = cloneDeep(defaultResponse);
const res = await props.executeApi(makeRequestParams(executeType)); const res = await props.executeApi(makeRequestParams(executeType) as ExecuteRequestParams);
if (executeType === 'localExec' && props.localExecuteApi && localExecuteUrl.value) { if (executeType === 'localExec' && props.localExecuteApi && localExecuteUrl.value) {
await props.localExecuteApi(localExecuteUrl.value, res); await props.localExecuteApi(localExecuteUrl.value, res);
} }
@ -1388,7 +1388,7 @@
} }
} }
function initErrorMessageInfoItem(key) { function initErrorMessageInfoItem(key: string) {
if (requestVModel.value.errorMessageInfo && !requestVModel.value.errorMessageInfo[key]) { if (requestVModel.value.errorMessageInfo && !requestVModel.value.errorMessageInfo[key]) {
requestVModel.value.errorMessageInfo[key] = {}; requestVModel.value.errorMessageInfo[key] = {};
} }
@ -1552,6 +1552,8 @@
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
environmentId: appStore.currentEnvConfig?.id || '', environmentId: appStore.currentEnvConfig?.id || '',
apiDefinitionId: requestVModel.value.id, apiDefinitionId: requestVModel.value.id,
uploadFileIds: definitionParams.uploadFileIds || [],
linkFileIds: definitionParams.linkFileIds || [],
}; };
await addCase(params); await addCase(params);
emit('addDone'); emit('addDone');
@ -1611,7 +1613,7 @@
...params, ...params,
...params.request, ...params.request,
polymorphicName: params.request.polymorphicName, polymorphicName: params.request.polymorphicName,
}; } as unknown as RequestParam;
saveNewApiModalVisible.value = true; saveNewApiModalVisible.value = true;
return; return;
} }

View File

@ -109,7 +109,7 @@
hideLayoutSwitch?: boolean; // hideLayoutSwitch?: boolean; //
loading?: boolean; loading?: boolean;
isEdit?: boolean; // isEdit?: boolean; //
uploadTempFileApi?: (...args) => Promise<any>; // uploadTempFileApi?: (...args: any) => Promise<any>; //
isDefinition?: boolean; isDefinition?: boolean;
isResponseModel?: boolean; isResponseModel?: boolean;
showEmpty?: boolean; showEmpty?: boolean;

View File

@ -58,7 +58,7 @@
keys.forEach((key, index) => { keys.forEach((key, index) => {
if (key !== 'responseTime' && key !== 'latency') { if (key !== 'responseTime' && key !== 'latency') {
// 100% // 100%
const itemWidth = (props.responseTiming[key] / props.responseTiming.responseTime) * 100; const itemWidth = (props.responseTiming[key as keyof ResponseTiming] / props.responseTiming.responseTime) * 100;
arr.push({ arr.push({
key, key,
width: `${itemWidth}%`, width: `${itemWidth}%`,

View File

@ -109,8 +109,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { FormInstance } from '@arco-design/web-vue';
import MsTagsInput from '@/components/pure/ms-tags-input/index.vue'; import MsTagsInput from '@/components/pure/ms-tags-input/index.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue'; import apiStatus from '@/views/api-test/components/apiStatus.vue';
import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue'; import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue';
@ -120,6 +118,8 @@
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
import { RequestDefinitionStatus } from '@/enums/apiEnum'; import { RequestDefinitionStatus } from '@/enums/apiEnum';
import type { FormInstance, TreeNodeData } from '@arco-design/web-vue';
const props = defineProps<{ const props = defineProps<{
selectTree?: ModuleTreeNode[]; selectTree?: ModuleTreeNode[];
}>(); }>();
@ -135,8 +135,8 @@
} }
} }
function filterTreeNode(searchValue, nodeData) { function filterTreeNode(searchValue: string, nodeData: TreeNodeData) {
return nodeData.name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1; return (nodeData as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
} }
defineExpose({ defineExpose({

View File

@ -333,6 +333,7 @@
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import MsTagsInput from '@/components/pure/ms-tags-input/index.vue'; import MsTagsInput from '@/components/pure/ms-tags-input/index.vue';
import { MsTreeNodeData } from '@/components/business/ms-tree/types';
import apiMethodName from '@/views/api-test/components/apiMethodName.vue'; import apiMethodName from '@/views/api-test/components/apiMethodName.vue';
import apiMethodSelect from '@/views/api-test/components/apiMethodSelect.vue'; import apiMethodSelect from '@/views/api-test/components/apiMethodSelect.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue'; import apiStatus from '@/views/api-test/components/apiStatus.vue';
@ -382,7 +383,7 @@
const { openModal } = useModal(); const { openModal } = useModal();
const tableStore = useTableStore(); const tableStore = useTableStore();
const folderTreePathMap = inject('folderTreePathMap'); const folderTreePathMap = inject<MsTreeNodeData[]>('folderTreePathMap');
const refreshModuleTree: (() => Promise<any>) | undefined = inject('refreshModuleTree'); const refreshModuleTree: (() => Promise<any>) | undefined = inject('refreshModuleTree');
const keyword = ref(''); const keyword = ref('');

View File

@ -36,11 +36,11 @@
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const keyword = ref(''); const keyword = ref('');
const quoteLocaleMap = { const quoteLocaleMap: Record<string, any> = {
COPY: 'common.copy', COPY: 'common.copy',
REF: 'apiTestManagement.quote', REF: 'apiTestManagement.quote',
}; };
const resourceLocaleMap = { const resourceLocaleMap: Record<string, any> = {
API: 'case.detail.resource.api', API: 'case.detail.resource.api',
}; };

View File

@ -234,7 +234,7 @@
const reportId = ref(''); const reportId = ref('');
const websocket = ref<WebSocket>(); const websocket = ref<WebSocket>();
const temporaryResponseMap = {}; // websockettab const temporaryResponseMap: Record<string, any> = {}; // websockettab
// websocket // websocket
function debugSocket(executeType?: 'localExec' | 'serverExec') { function debugSocket(executeType?: 'localExec' | 'serverExec') {
websocket.value = getSocket( websocket.value = getSocket(

View File

@ -250,8 +250,8 @@
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
environmentId: environmentId.value as string, environmentId: environmentId.value as string,
apiDefinitionId: apiDefinitionId.value, apiDefinitionId: apiDefinitionId.value,
linkFileIds, linkFileIds: linkFileIds || [],
uploadFileIds, uploadFileIds: uploadFileIds || [],
request, request,
id: id as string, id: id as string,
name, name,
@ -287,7 +287,7 @@
const executeRef = ref<InstanceType<typeof executeButton>>(); const executeRef = ref<InstanceType<typeof executeButton>>();
const reportId = ref(''); const reportId = ref('');
const websocket = ref<WebSocket>(); const websocket = ref<WebSocket>();
const temporaryResponseMap = {}; // websockettab const temporaryResponseMap: Record<string, any> = {}; // websockettab
// websocket // websocket
function debugSocket(executeType?: 'localExec' | 'serverExec') { function debugSocket(executeType?: 'localExec' | 'serverExec') {
websocket.value = getSocket( websocket.value = getSocket(
@ -321,6 +321,7 @@
reportId.value = getGenerateId(); reportId.value = getGenerateId();
detailForm.value.reportId = reportId.value; // ID detailForm.value.reportId = reportId.value; // ID
let res; let res;
if (!makeRequestParams) return;
const params = { const params = {
environmentId: environmentId.value as string, environmentId: environmentId.value as string,
frontendDebug: executeType === 'localExec', frontendDebug: executeType === 'localExec',
@ -337,12 +338,16 @@
id: detailForm.value.id as string, id: detailForm.value.id as string,
projectId: detailForm.value.projectId, projectId: detailForm.value.projectId,
...params, ...params,
uploadFileIds: params.uploadFileIds || [],
linkFileIds: params.linkFileIds || [],
}); });
} else { } else {
res = await debugCase({ res = await debugCase({
id: `case-${Date.now()}`, id: `case-${Date.now()}`,
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
...params, ...params,
uploadFileIds: params.uploadFileIds || [],
linkFileIds: params.linkFileIds || [],
}); });
} }
if (executeType === 'localExec') { if (executeType === 'localExec') {

View File

@ -40,11 +40,11 @@
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const keyword = ref(''); const keyword = ref('');
const quoteLocaleMap = { const quoteLocaleMap: Record<string, any> = {
COPY: 'common.copy', COPY: 'common.copy',
REF: 'apiTestManagement.quote', REF: 'apiTestManagement.quote',
}; };
const resourceLocaleMap = { const resourceLocaleMap: Record<string, any> = {
API: 'case.detail.resource.api', API: 'case.detail.resource.api',
}; };

View File

@ -77,7 +77,7 @@
</a-trigger> </a-trigger>
</template> </template>
<template #triggerMode="{ record }"> <template #triggerMode="{ record }">
<span>{{ t(TriggerModeLabel[record.triggerMode]) }}</span> <span>{{ t(TriggerModeLabel[record.triggerMode as keyof typeof TriggerModeLabel]) }}</span>
</template> </template>
<template #status="{ record }"> <template #status="{ record }">
<ExecutionStatus :status="record.status" :module-type="ReportEnum.API_REPORT" /> <ExecutionStatus :status="record.status" :module-type="ReportEnum.API_REPORT" />

View File

@ -353,7 +353,7 @@
); );
const apiActions = folderMoreActions.filter((action) => action.eventTag !== 'shareModule'); const apiActions = folderMoreActions.filter((action) => action.eventTag !== 'shareModule');
function filterMoreActionFunc(actions, node) { function filterMoreActionFunc(actions: ActionsItem[], node: MsTreeNodeData) {
if (node.type === 'MODULE') { if (node.type === 'MODULE') {
return moduleActions; return moduleActions;
} }

View File

@ -133,6 +133,7 @@
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { BatchActionParams, BatchActionQueryParams, MsTableColumn } from '@/components/pure/ms-table/type'; import type { BatchActionParams, BatchActionQueryParams, MsTableColumn } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import { MsTreeNodeData } from '@/components/business/ms-tree/types';
import apiMethodName from '@/views/api-test/components/apiMethodName.vue'; import apiMethodName from '@/views/api-test/components/apiMethodName.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue'; import apiStatus from '@/views/api-test/components/apiStatus.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue'; import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
@ -171,7 +172,7 @@
const { t } = useI18n(); const { t } = useI18n();
const { openModal } = useModal(); const { openModal } = useModal();
const folderTreePathMap = inject('folderTreePathMap'); const folderTreePathMap = inject<MsTreeNodeData[]>('folderTreePathMap');
const keyword = ref(''); const keyword = ref('');
const refreshModuleTree: (() => Promise<any>) | undefined = inject('refreshModuleTree'); const refreshModuleTree: (() => Promise<any>) | undefined = inject('refreshModuleTree');
const refreshModuleTreeCount: ((data: ApiDefinitionGetModuleParams) => Promise<any>) | undefined = const refreshModuleTreeCount: ((data: ApiDefinitionGetModuleParams) => Promise<any>) | undefined =

View File

@ -95,7 +95,7 @@
const moduleTreeRef = ref<InstanceType<typeof moduleTree>>(); const moduleTreeRef = ref<InstanceType<typeof moduleTree>>();
const managementRef = ref<InstanceType<typeof management>>(); const managementRef = ref<InstanceType<typeof management>>();
function handleModuleInit(tree, _protocol: string, pathMap: Record<string, any>) { function handleModuleInit(tree: ModuleTreeNode[], _protocol: string, pathMap: Record<string, any>) {
folderTree.value = tree; folderTree.value = tree;
protocol.value = _protocol; protocol.value = _protocol;
folderTreePathMap.value = pathMap; folderTreePathMap.value = pathMap;

View File

@ -49,7 +49,7 @@
const moduleTreeRef = ref<InstanceType<typeof moduleTree>>(); const moduleTreeRef = ref<InstanceType<typeof moduleTree>>();
const managementRef = ref<InstanceType<typeof management>>(); const managementRef = ref<InstanceType<typeof management>>();
function handleModuleInit(tree, _protocol: string, pathMap: Record<string, any>) { function handleModuleInit(tree: ModuleTreeNode[], _protocol: string, pathMap: Record<string, any>) {
folderTree.value = tree; folderTree.value = tree;
protocol.value = _protocol; protocol.value = _protocol;
folderTreePathMap.value = pathMap; folderTreePathMap.value = pathMap;

View File

@ -12,7 +12,7 @@
status: string; status: string;
}>(); }>();
// //
const scenarioStepMap = { const scenarioStepMap: Record<string, any> = {
[ScenarioStepType.LOOP_CONTROLLER]: { label: 'apiScenario.loopControl', color: 'rgba(167, 98, 191, 1)' }, [ScenarioStepType.LOOP_CONTROLLER]: { label: 'apiScenario.loopControl', color: 'rgba(167, 98, 191, 1)' },
[ScenarioStepType.IF_CONTROLLER]: { label: 'apiScenario.conditionControl', color: 'rgba(238, 80, 163, 1)' }, [ScenarioStepType.IF_CONTROLLER]: { label: 'apiScenario.conditionControl', color: 'rgba(238, 80, 163, 1)' },
[ScenarioStepType.ONCE_ONLY_CONTROLLER]: { label: 'apiScenario.onlyOnceControl', color: 'rgba(211, 68, 0, 1)' }, [ScenarioStepType.ONCE_ONLY_CONTROLLER]: { label: 'apiScenario.onlyOnceControl', color: 'rgba(211, 68, 0, 1)' },
@ -25,8 +25,8 @@
const getClass = computed(() => { const getClass = computed(() => {
if (props.status) { if (props.status) {
return { return {
color: scenarioStepMap[props.status].color, color: scenarioStepMap[props.status]?.color,
border: `1px solid ${scenarioStepMap[props.status].color}`, border: `1px solid ${scenarioStepMap[props.status]?.color}`,
}; };
} }
}); });

View File

@ -138,7 +138,7 @@
/> />
</template> </template>
<template #triggerMode="{ record }"> <template #triggerMode="{ record }">
<span>{{ t(TriggerModeLabel[record.triggerMode]) }}</span> <span>{{ t(TriggerModeLabel[record.triggerMode as keyof typeof TriggerModeLabel]) }}</span>
</template> </template>
<template #operationTime="{ record }"> <template #operationTime="{ record }">
<span>{{ dayjs(record.operationTime).format('YYYY-MM-DD HH:mm:ss') }}</span> <span>{{ dayjs(record.operationTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
@ -545,7 +545,7 @@
if (match) { if (match) {
const value = parseInt(match[1], 10); const value = parseInt(match[1], 10);
const type = match[2]; const type = match[2];
const translations = { const translations: Record<string, string> = {
M: t('msTimeSelector.month'), M: t('msTimeSelector.month'),
Y: t('msTimeSelector.year'), Y: t('msTimeSelector.year'),
H: t('msTimeSelector.hour'), H: t('msTimeSelector.hour'),

View File

@ -39,7 +39,8 @@
color?: string; color?: string;
} }
const iconTypeStatus = ref({ // TODO: Record<string,any>
const iconTypeStatus: Record<string, any> = {
[ReportEnum.API_REPORT]: { [ReportEnum.API_REPORT]: {
SUCCESS: { SUCCESS: {
icon: 'icon-icon_succeed_colorful', icon: 'icon-icon_succeed_colorful',
@ -113,7 +114,7 @@
color: '!text-[var(--color-text-input-border)]', color: '!text-[var(--color-text-input-border)]',
}, },
}, },
}); };
function getExecutionResult(): IconType { function getExecutionResult(): IconType {
return iconTypeStatus.value[props.moduleType][props.status]; return iconTypeStatus.value[props.moduleType][props.status];

View File

@ -3,8 +3,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue'; import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
@ -14,7 +12,8 @@
status: string; status: string;
}>(); }>();
const statusMap = { // TODO: Record<string,any>
const statusMap: Record<string, any> = {
PENDING: { PENDING: {
label: 'report.detail.pendingCount', label: 'report.detail.pendingCount',
value: 'PENDING', value: 'PENDING',

View File

@ -689,7 +689,7 @@
nextTick(() => { nextTick(() => {
if (fApi.value) { if (fApi.value) {
fApi.value.nextRefresh(() => { fApi.value.nextRefresh(() => {
const form = {}; const form: Record<string, any> = {};
controlPluginFormFields().forEach((key) => { controlPluginFormFields().forEach((key) => {
form[key] = formData[key]; form[key] = formData[key];
}); });
@ -921,12 +921,12 @@
async function execute(executeType?: 'localExec' | 'serverExec') { async function execute(executeType?: 'localExec' | 'serverExec') {
requestVModel.value.executeLoading = true; requestVModel.value.executeLoading = true;
if (isHttpProtocol.value) { if (isHttpProtocol.value) {
emit('execute', makeRequestParams(executeType), executeType); emit('execute', makeRequestParams(executeType) as RequestParam, executeType);
} else { } else {
// //
fApi.value?.validate(async (valid) => { fApi.value?.validate(async (valid) => {
if (valid === true) { if (valid === true) {
emit('execute', makeRequestParams(executeType), executeType); emit('execute', makeRequestParams(executeType) as RequestParam, executeType);
} else { } else {
requestVModel.value.activeTab = RequestComposition.PLUGIN; requestVModel.value.activeTab = RequestComposition.PLUGIN;
nextTick(() => { nextTick(() => {
@ -942,7 +942,7 @@
emit('stopDebug'); emit('stopDebug');
} }
function initErrorMessageInfoItem(key) { function initErrorMessageInfoItem(key: string) {
if (requestVModel.value.errorMessageInfo && !requestVModel.value.errorMessageInfo[key]) { if (requestVModel.value.errorMessageInfo && !requestVModel.value.errorMessageInfo[key]) {
requestVModel.value.errorMessageInfo[key] = {}; requestVModel.value.errorMessageInfo[key] = {};
} }
@ -1026,7 +1026,7 @@
function handleClose() { function handleClose() {
// applyStep case // applyStep case
if (!requestVModel.value.isNew && activeStep.value?.refType === ScenarioStepRefType.COPY) { if (!requestVModel.value.isNew && activeStep.value?.refType === ScenarioStepRefType.COPY) {
emit('applyStep', cloneDeep(makeRequestParams())); emit('applyStep', cloneDeep(makeRequestParams()) as RequestParam);
} }
} }

View File

@ -25,7 +25,7 @@
const { t } = useI18n(); const { t } = useI18n();
// //
const scenarioStepMap = { const scenarioStepMap: Record<string, any> = {
[ScenarioStepType.CONSTANT_TIMER]: { label: 'apiScenario.waitTime', color: 'rgb(var(--warning-6))' }, [ScenarioStepType.CONSTANT_TIMER]: { label: 'apiScenario.waitTime', color: 'rgb(var(--warning-6))' },
[ScenarioStepType.LOOP_CONTROLLER]: { label: 'apiScenario.loopControl', color: 'rgba(167, 98, 191, 1)' }, [ScenarioStepType.LOOP_CONTROLLER]: { label: 'apiScenario.loopControl', color: 'rgba(167, 98, 191, 1)' },
[ScenarioStepType.IF_CONTROLLER]: { label: 'apiScenario.conditionControl', color: 'rgba(238, 80, 163, 1)' }, [ScenarioStepType.IF_CONTROLLER]: { label: 'apiScenario.conditionControl', color: 'rgba(238, 80, 163, 1)' },

View File

@ -69,7 +69,7 @@
</a-trigger> </a-trigger>
</template> </template>
<template #triggerMode="{ record }"> <template #triggerMode="{ record }">
<span>{{ t(TriggerModeLabel[record.triggerMode]) }}</span> <span>{{ t(TriggerModeLabel[record.triggerMode as keyof typeof TriggerModeLabel]) }}</span>
</template> </template>
<template #status="{ record }"> <template #status="{ record }">
<executeStatus :status="record.status" /> <executeStatus :status="record.status" />

View File

@ -68,7 +68,7 @@
createStepAction?: CreateStepAction; createStepAction?: CreateStepAction;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'close'); (e: 'close'): void;
( (
e: 'otherCreate', e: 'otherCreate',
type: type:
@ -76,8 +76,8 @@
| ScenarioAddStepActionType.CUSTOM_API | ScenarioAddStepActionType.CUSTOM_API
| ScenarioAddStepActionType.SCRIPT_OPERATION, | ScenarioAddStepActionType.SCRIPT_OPERATION,
step?: ScenarioStepItem step?: ScenarioStepItem
); ): void;
(e: 'addDone', newStep: ScenarioStepItem); (e: 'addDone', newStep: ScenarioStepItem): void;
}>(); }>();
const appStore = useAppStore(); const appStore = useAppStore();

View File

@ -82,8 +82,8 @@
step: ScenarioStepItem; step: ScenarioStepItem;
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'close'); (e: 'close'): void;
(e: 'click'); (e: 'click'): void;
( (
e: 'otherCreate', e: 'otherCreate',
type: type:
@ -92,8 +92,8 @@
| ScenarioAddStepActionType.SCRIPT_OPERATION, | ScenarioAddStepActionType.SCRIPT_OPERATION,
step?: ScenarioStepItem, step?: ScenarioStepItem,
activeCreateAction?: CreateStepAction activeCreateAction?: CreateStepAction
); ): void;
(e: 'addDone', newStep: ScenarioStepItem); (e: 'addDone', newStep: ScenarioStepItem): void;
}>(); }>();
const { t } = useI18n(); const { t } = useI18n();

View File

@ -146,7 +146,7 @@
import { deleteNodes, filterTree, getGenerateId, mapTree, traverseTree } from '@/utils'; import { deleteNodes, filterTree, getGenerateId, mapTree, traverseTree } from '@/utils';
import { countNodes } from '@/utils/tree'; import { countNodes } from '@/utils/tree';
import { ApiScenarioDebugRequest, Scenario, ScenarioStepItem } from '@/models/apiTest/scenario'; import { ApiScenarioDebugRequest, Scenario, ScenarioStepDetails, ScenarioStepItem } from '@/models/apiTest/scenario';
import { ScenarioExecuteStatus, ScenarioStepRefType, ScenarioStepType } from '@/enums/apiEnum'; import { ScenarioExecuteStatus, ScenarioStepRefType, ScenarioStepType } from '@/enums/apiEnum';
const emit = defineEmits<{ const emit = defineEmits<{
@ -392,14 +392,14 @@
} }
return false; return false;
}); });
const waitingDebugStepDetails = {}; const waitingDebugStepDetails: Record<string, ScenarioStepDetails> = {};
Object.keys(scenario.value.stepDetails).forEach((key) => { Object.keys(scenario.value.stepDetails).forEach((key) => {
if (checkedKeysSet.has(key)) { if (checkedKeysSet.has(key)) {
waitingDebugStepDetails[key] = scenario.value.stepDetails[key]; waitingDebugStepDetails[key] = scenario.value.stepDetails[key];
} }
}); });
emit('batchDebug', { emit('batchDebug', {
steps: waitTingDebugSteps, steps: waitTingDebugSteps as ScenarioStepItem[],
stepDetails: waitingDebugStepDetails, stepDetails: waitingDebugStepDetails,
reportId: getGenerateId(), reportId: getGenerateId(),
}); });

View File

@ -170,7 +170,7 @@
} }
// TODO: // TODO:
function initErrorMessageInfoItem(key) { function initErrorMessageInfoItem(key: string) {
if (scenario.value.errorMessageInfo && !scenario.value.errorMessageInfo[key]) { if (scenario.value.errorMessageInfo && !scenario.value.errorMessageInfo[key]) {
scenario.value.errorMessageInfo[key] = {}; scenario.value.errorMessageInfo[key] = {};
} }

View File

@ -231,7 +231,7 @@
} }
// TODO: // TODO:
function initErrorMessageInfoItem(key) { function initErrorMessageInfoItem(key: string) {
if (scenario.value.errorMessageInfo && !scenario.value.errorMessageInfo[key]) { if (scenario.value.errorMessageInfo && !scenario.value.errorMessageInfo[key]) {
scenario.value.errorMessageInfo[key] = {}; scenario.value.errorMessageInfo[key] = {};
} }

View File

@ -133,15 +133,16 @@
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import { filterTree, getGenerateId, mapTree } from '@/utils'; import { filterTree, getGenerateId, mapTree } from '@/utils';
import { RequestResult } from '@/models/apiTest/common';
import { import {
ApiScenarioDebugRequest, ApiScenarioDebugRequest,
ApiScenarioGetModuleParams, ApiScenarioGetModuleParams,
ApiScenarioTableItem, ApiScenarioTableItem,
Scenario, Scenario,
ScenarioStepDetails,
ScenarioStepItem, ScenarioStepItem,
} from '@/models/apiTest/scenario'; } from '@/models/apiTest/scenario';
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';
import { EnvConfig } from '@/models/projectManagement/environmental';
import { ScenarioExecuteStatus, ScenarioStepRefType, ScenarioStepType } from '@/enums/apiEnum'; import { ScenarioExecuteStatus, ScenarioStepRefType, ScenarioStepType } from '@/enums/apiEnum';
import { ApiTestRouteEnum } from '@/enums/routeEnum'; import { ApiTestRouteEnum } from '@/enums/routeEnum';
@ -189,7 +190,7 @@
if (data.msgType === 'EXEC_RESULT') { if (data.msgType === 'EXEC_RESULT') {
if (scenario.reportId === data.reportId) { if (scenario.reportId === data.reportId) {
// tabtab // tabtab
data.taskResult.requestResults.forEach((result) => { data.taskResult.requestResults.forEach((result: RequestResult) => {
if (result.stepId) { if (result.stepId) {
// id // id
if (scenario.stepResponses[result.stepId] === undefined) { if (scenario.stepResponses[result.stepId] === undefined) {
@ -300,7 +301,7 @@
* @param localExecuteUrl 本地执行地址 * @param localExecuteUrl 本地执行地址
*/ */
function handleExecute(executeType?: 'localExec' | 'serverExec', localExecuteUrl?: string) { function handleExecute(executeType?: 'localExec' | 'serverExec', localExecuteUrl?: string) {
const waitingDebugStepDetails = {}; const waitingDebugStepDetails: Record<string, ScenarioStepDetails> = {};
const waitTingDebugSteps = filterTree(activeScenarioTab.value.steps, (node) => { const waitTingDebugSteps = filterTree(activeScenarioTab.value.steps, (node) => {
if (node.enable) { if (node.enable) {
node.executeStatus = ScenarioExecuteStatus.EXECUTING; node.executeStatus = ScenarioExecuteStatus.EXECUTING;
@ -316,7 +317,7 @@
} }
realExecute( realExecute(
{ {
steps: waitTingDebugSteps, steps: waitTingDebugSteps as ScenarioStepItem[],
stepDetails: waitingDebugStepDetails, stepDetails: waitingDebugStepDetails,
reportId: getGenerateId(), reportId: getGenerateId(),
}, },

View File

@ -359,7 +359,7 @@
} }
return []; return [];
}; };
// TODO:: Record<string, any>
async function loadedBug(detail: BugEditFormObject) { async function loadedBug(detail: BugEditFormObject) {
// //
isPlatformDefaultTemplate.value = detail.platformDefault; isPlatformDefaultTemplate.value = detail.platformDefault;
@ -375,13 +375,15 @@
detailInfo.value = { ...detail }; detailInfo.value = { ...detail };
tags.value = detail.tags || []; tags.value = detail.tags || [];
caseCount.value = detailInfo.value.linkCaseCount; caseCount.value = detailInfo.value.linkCaseCount;
const tmpObj = { status: detailInfo.value.status }; const tmpObj: Record<string, any> = { status: detailInfo.value.status };
platformSystemFields.value = customFieldsRes.customFields.filter((field) => field.platformSystemField); platformSystemFields.value = customFieldsRes.customFields.filter(
(field: Record<string, any>) => field.platformSystemField
);
currentCustomFields.value = customFieldsRes.customFields || []; currentCustomFields.value = customFieldsRes.customFields || [];
if (detailInfo.value.customFields && Array.isArray(detailInfo.value.customFields)) { if (detailInfo.value.customFields && Array.isArray(detailInfo.value.customFields)) {
const MULTIPLE_TYPE = ['MULTIPLE_SELECT', 'MULTIPLE_INPUT', 'CHECKBOX', 'MULTIPLE_MEMBER']; const MULTIPLE_TYPE = ['MULTIPLE_SELECT', 'MULTIPLE_INPUT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
const SINGLE_TYPE = ['RADIO', 'SELECT', 'MEMBER']; const SINGLE_TYPE = ['RADIO', 'SELECT', 'MEMBER'];
detail.customFields.forEach((item) => { detail.customFields.forEach((item: Record<string, any>) => {
if (MULTIPLE_TYPE.includes(item.type)) { if (MULTIPLE_TYPE.includes(item.type)) {
const multipleOptions = getOptionFromTemplate( const multipleOptions = getOptionFromTemplate(
currentCustomFields.value.find((filed: any) => item.id === filed.fieldId) currentCustomFields.value.find((filed: any) => item.id === filed.fieldId)
@ -419,7 +421,7 @@
item.defaultValue = tmpObj[item.fieldId]; item.defaultValue = tmpObj[item.fieldId];
}); });
getFormRules( getFormRules(
customFieldsRes.customFields.filter((field) => !field.platformSystemField), customFieldsRes.customFields.filter((field: Record<string, any>) => !field.platformSystemField),
tmpObj tmpObj
); );
} }

View File

@ -468,7 +468,7 @@
formItem.forEach((item: FormRuleItem) => { formItem.forEach((item: FormRuleItem) => {
let itemVal = item.value; let itemVal = item.value;
if (item.sourceType === 'CASCADER') { if (item.sourceType === 'CASCADER') {
itemVal = findParents(item.options as Option[], item.value as string, []); itemVal = findParents(item.options as Option[], item.value as string, []) || '';
} }
customFields.push({ customFields.push({
id: item.field as string, id: item.field as string,

View File

@ -293,7 +293,7 @@
}); });
// //
const platformSystemFieldMap = {}; const platformSystemFieldMap: Record<string, any> = {};
const getListFunParams = ref<TableQueryParams>({ const getListFunParams = ref<TableQueryParams>({
combine: { combine: {
@ -404,6 +404,7 @@
} }
}; };
const currentCustomFields = ref<CustomFieldItem[]>([]); const currentCustomFields = ref<CustomFieldItem[]>([]);
// TODO:: Record<string, any>
const templateChange = async (v: SelectValue, request?: BugTemplateRequest) => { const templateChange = async (v: SelectValue, request?: BugTemplateRequest) => {
if (v) { if (v) {
try { try {
@ -418,13 +419,13 @@
isLoading.value = false; isLoading.value = false;
isPlatformDefaultTemplate.value = res.platformDefault; isPlatformDefaultTemplate.value = res.platformDefault;
if (isPlatformDefaultTemplate.value) { if (isPlatformDefaultTemplate.value) {
const systemFields = res.customFields.filter((field) => field.platformSystemField); const systemFields = res.customFields.filter((field: Record<string, any>) => field.platformSystemField);
systemFields.forEach((field) => { systemFields.forEach((field: Record<string, any>) => {
form.value.platformSystemFields[field.fieldId] = field.defaultValue; form.value.platformSystemFields[field.fieldId] = field.defaultValue;
platformSystemFieldMap[field.fieldId] = field; platformSystemFieldMap[field.fieldId] = field;
}); });
} }
getFormRules(res.customFields.filter((field) => !field.platformSystemField)); getFormRules(res.customFields.filter((field: Record<string, any>) => !field.platformSystemField));
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(error); console.log(error);
@ -552,7 +553,7 @@
if (formItem.value && formItem.value.length) { if (formItem.value && formItem.value.length) {
formItem.value.forEach((item: FormRuleItem) => { formItem.value.forEach((item: FormRuleItem) => {
if (item.sourceType === 'CASCADER') { if (item.sourceType === 'CASCADER') {
item.value = findParents(item.options as Option[], item.value as string, []); item.value = findParents(item.options as Option[], item.value as string, []) || '';
} }
customFields.push({ customFields.push({
id: item.field as string, id: item.field as string,
@ -702,7 +703,7 @@
}); });
} }
let tmpObj = {}; let tmpObj: Record<string, any> = {};
if (isEdit.value) { if (isEdit.value) {
tmpObj = { status: res.status }; tmpObj = { status: res.status };
} }
@ -828,7 +829,6 @@
font-size: 14px; font-size: 14px;
color: var(--color-text-4); color: var(--color-text-4);
} }
:deep(.arco-form-item-content) { :deep(.arco-form-item-content) {
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }

View File

@ -793,7 +793,7 @@
} }
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
const filterParams = { const filterParams: Record<string, any> = {
status: statusFilterValue.value, status: statusFilterValue.value,
handleUser: handleUserFilterValue.value, handleUser: handleUserFilterValue.value,
updateUser: updateUserFilterValue.value, updateUser: updateUserFilterValue.value,
@ -835,7 +835,7 @@
} }
function initTableParams() { function initTableParams() {
const filterParams = { const filterParams: Record<string, any> = {
status: statusFilterValue.value, status: statusFilterValue.value,
handleUser: handleUserFilterValue.value, handleUser: handleUserFilterValue.value,
updateUser: updateUserFilterValue.value, updateUser: updateUserFilterValue.value,

View File

@ -477,7 +477,7 @@
// //
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
const filterParams = { const filterParams: Record<string, any> = {
status: statusFilterValue.value, status: statusFilterValue.value,
handleUser: handleUserFilterValue.value, handleUser: handleUserFilterValue.value,
updateUser: updateUserFilterValue.value, updateUser: updateUserFilterValue.value,
@ -503,7 +503,7 @@
} }
function initTableParams() { function initTableParams() {
const filterParams = { const filterParams: Record<string, any> = {
status: statusFilterValue.value, status: statusFilterValue.value,
handleUser: handleUserFilterValue.value, handleUser: handleUserFilterValue.value,
updateUser: updateUserFilterValue.value, updateUser: updateUserFilterValue.value,

View File

@ -393,7 +393,7 @@
}); });
function initTableParams() { function initTableParams() {
const filterParams = { const filterParams: Record<string, any> = {
status: statusFilterValue.value, status: statusFilterValue.value,
handleUser: handleUserFilterValue.value, handleUser: handleUserFilterValue.value,
}; };

View File

@ -33,6 +33,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { debounce } from 'lodash-es';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { MsTableColumn } from '@/components/pure/ms-table/type'; import type { MsTableColumn } from '@/components/pure/ms-table/type';
@ -48,7 +49,6 @@
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { statusIconMap } from '../utils'; import { statusIconMap } from '../utils';
import debounce from 'lodash-es/debounce';
const featureCaseStore = useFeatureCaseStore(); const featureCaseStore = useFeatureCaseStore();
const router = useRouter(); const router = useRouter();

View File

@ -1,18 +1,15 @@
import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types'; import type { FormItem } from '@/components/pure/ms-form-create/types';
import { MsTableColumnData } from '@/components/pure/ms-table/type'; import { MsTableColumnData } from '@/components/pure/ms-table/type';
import { getFileEnum } from '@/components/pure/ms-upload/iconMap'; import { getFileEnum } from '@/components/pure/ms-upload/iconMap';
import type { MsFileItem } from '@/components/pure/ms-upload/types'; import type { MsFileItem } from '@/components/pure/ms-upload/types';
import type { CaseLevel } from '@/components/business/ms-case-associate/types'; import type { CaseLevel } from '@/components/business/ms-case-associate/types';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useUserStore from '@/store/modules/user';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import type { AssociatedList, CustomAttributes } from '@/models/caseManagement/featureCase'; import type { AssociatedList, CustomAttributes } from '@/models/caseManagement/featureCase';
import { StatusType } from '@/enums/caseEnum'; import { StatusType } from '@/enums/caseEnum';
const userStore = useUserStore();
const { t } = useI18n(); const { t } = useI18n();
export interface ReviewResult { export interface ReviewResult {
@ -21,8 +18,8 @@ export interface ReviewResult {
statusText: string; statusText: string;
} }
// 图标评审结果 // 图标评审结果 TODO:TS 类型 key
export const statusIconMap = { export const statusIconMap: Record<string, any> = {
UN_REVIEWED: { UN_REVIEWED: {
key: 'UN_REVIEWED', key: 'UN_REVIEWED',
icon: StatusType.UN_REVIEWED, icon: StatusType.UN_REVIEWED,
@ -54,8 +51,8 @@ export const statusIconMap = {
color: 'text-[rgb(var(--warning-6))]', color: 'text-[rgb(var(--warning-6))]',
}, },
}; };
// 图标执行结果 // 图标执行结果 TODO:TS 类型 key
export const executionResultMap = { export const executionResultMap: Record<string, any> = {
UN_EXECUTED: { UN_EXECUTED: {
key: 'UN_EXECUTED', key: 'UN_EXECUTED',
icon: StatusType.UN_EXECUTED, icon: StatusType.UN_EXECUTED,
@ -143,7 +140,7 @@ export function getTableFields(customFields: CustomAttributes[], itemDataIndex:
); );
if (currentColumnData) { if (currentColumnData) {
let selectValue; let selectValue: string;
// 处理多选项 // 处理多选项
if (multipleExcludes.includes(currentColumnData.type) && currentColumnData.defaultValue) { if (multipleExcludes.includes(currentColumnData.type) && currentColumnData.defaultValue) {
selectValue = JSON.parse(currentColumnData.defaultValue); selectValue = JSON.parse(currentColumnData.defaultValue);

View File

@ -431,7 +431,7 @@
function getCustomField(customFields: any) { function getCustomField(customFields: any) {
const multipleExcludes = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER']; const multipleExcludes = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER'];
const selectExcludes = ['MEMBER', 'RADIO', 'SELECT']; const selectExcludes = ['MEMBER', 'RADIO', 'SELECT'];
let selectValue; let selectValue: Record<string, any>;
// //
if (multipleExcludes.includes(customFields.type) && customFields.defaultValue) { if (multipleExcludes.includes(customFields.type) && customFields.defaultValue) {
selectValue = JSON.parse(customFields.defaultValue); selectValue = JSON.parse(customFields.defaultValue);
@ -468,10 +468,8 @@
value: res.moduleName || t('common.root'), value: res.moduleName || t('common.root'),
}, },
// //
...res.customFields.map((e) => { ...res.customFields.map((e: Record<string, any>) => {
try { try {
const val =
typeof e.defaultValue === 'string' && e.defaultValue !== '' ? JSON.parse(e.defaultValue) : e.defaultValue;
return { return {
label: e.fieldName, label: e.fieldName,
value: getCustomField(e), value: getCustomField(e),

View File

@ -49,12 +49,8 @@
<div class="ml-[6px] flex items-center justify-start px-[6px] py-[2px]"> <div class="ml-[6px] flex items-center justify-start px-[6px] py-[2px]">
<a-checkbox-group v-model:model-value="statusFilters" direction="vertical" size="small"> <a-checkbox-group v-model:model-value="statusFilters" direction="vertical" size="small">
<a-checkbox v-for="key of Object.keys(reviewResultMap)" :key="key" :value="key"> <a-checkbox v-for="key of Object.keys(reviewResultMap)" :key="key" :value="key">
<a-tag <a-tag :color="reviewResultMap[key as ReviewResult].color" class="px-[4px]" size="small">
:color="reviewResultMap[key].color" {{ t(reviewResultMap[key as ReviewResult].label) }}
:class="[reviewResultMap[key].class, 'px-[4px]']"
size="small"
>
{{ t(reviewResultMap[key].label) }}
</a-tag> </a-tag>
</a-checkbox> </a-checkbox>
</a-checkbox-group> </a-checkbox-group>
@ -321,7 +317,13 @@
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { ReviewCaseItem, ReviewItem, ReviewPassRule, ReviewResult } from '@/models/caseManagement/caseReview'; import {
ReviewCaseItem,
ReviewItem,
ReviewPassRule,
ReviewResult,
ReviewStatus,
} from '@/models/caseManagement/caseReview';
import { BatchApiParams, ModuleTreeNode } from '@/models/common'; import { BatchApiParams, ModuleTreeNode } from '@/models/common';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
@ -571,12 +573,14 @@
* @param record 关联用例项 * @param record 关联用例项
* @param done 关闭弹窗 * @param done 关闭弹窗
*/ */
async function handleDisassociateReviewCase(record: ReviewCaseItem, done) { async function handleDisassociateReviewCase(record: ReviewCaseItem, done?: () => void) {
try { try {
disassociateLoading.value = true; disassociateLoading.value = true;
await disassociateReviewCase(route.query.id as string, record.caseId); await disassociateReviewCase(route.query.id as string, record.caseId);
emit('refresh'); emit('refresh');
done(); if (done) {
done();
}
Message.success(t('caseManagement.caseReview.disassociateSuccess')); Message.success(t('caseManagement.caseReview.disassociateSuccess'));
loadList(); loadList();
} catch (error) { } catch (error) {

View File

@ -45,11 +45,11 @@
<a-checkbox-group v-model:model-value="statusFilters" direction="vertical" size="small"> <a-checkbox-group v-model:model-value="statusFilters" direction="vertical" size="small">
<a-checkbox v-for="key of Object.keys(reviewStatusMap)" :key="key" :value="key"> <a-checkbox v-for="key of Object.keys(reviewStatusMap)" :key="key" :value="key">
<a-tag <a-tag
:color="reviewStatusMap[key].color" :color="reviewStatusMap[key as ReviewStatus].color"
:class="[reviewStatusMap[key].class, 'px-[4px]']" :class="[reviewStatusMap[key as ReviewStatus].class, 'px-[4px]']"
size="small" size="small"
> >
{{ t(reviewStatusMap[key].label) }} {{ t(reviewStatusMap[key as ReviewStatus].label) }}
</a-tag> </a-tag>
</a-checkbox> </a-checkbox>
</a-checkbox-group> </a-checkbox-group>

View File

@ -309,8 +309,8 @@
const { type, script } = form.value; const { type, script } = form.value;
const parameters = JSON.parse(form.value.params); const parameters = JSON.parse(form.value.params);
parameters parameters
.filter((item: any) => item.key && item.value) .filter((item: Record<string, any>) => item.key && item.value)
.map((item) => { .map((item: Record<string, any>) => {
return { return {
key: item.key, key: item.key,
value: item.value, value: item.value,

View File

@ -54,7 +54,7 @@ export const SCRIPT_MENU: CommonScriptMenu[] = [
]; ];
// 处理groovyCode 请求头 // 处理groovyCode 请求头
function getGroovyHeaders(requestHeaders) { function getGroovyHeaders(requestHeaders: Record<string, any>) {
let headers = '['; let headers = '[';
let index = 1; let index = 1;
// for (const [k, v] of requestHeaders) { // for (const [k, v] of requestHeaders) {
@ -65,7 +65,7 @@ function getGroovyHeaders(requestHeaders) {
// headers += `'${k}':'${v}'`; // headers += `'${k}':'${v}'`;
// index++; // index++;
// } // }
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
if (index !== 1) { if (index !== 1) {
headers += ','; headers += ',';
} }
@ -76,11 +76,11 @@ function getGroovyHeaders(requestHeaders) {
return headers; return headers;
} }
// 解析请求url // 解析请求url
function getRequestPath(requestArgs, requestPath) { function getRequestPath(requestArgs: any, requestPath: string) {
if (requestArgs.size > 0) { if (requestArgs.size > 0) {
requestPath += '?'; requestPath += '?';
let index = 1; let index = 1;
requestArgs.forEach(([k, v]) => { requestArgs.forEach(([k, v]: any[]) => {
if (index !== 1) { if (index !== 1) {
requestPath += '&'; requestPath += '&';
} }
@ -91,7 +91,7 @@ function getRequestPath(requestArgs, requestPath) {
return requestPath; return requestPath;
} }
// 处理mockPath // 处理mockPath
function getMockPath(domain, port, socket) { function getMockPath(domain: string, port: string, socket: string) {
if (domain === socket || !port) { if (domain === socket || !port) {
return ''; return '';
} }
@ -101,11 +101,11 @@ function getMockPath(domain, port, socket) {
} }
// 处理请求参数 // 处理请求参数
function replaceRestParams(path, restMap) { function replaceRestParams(path: string, restMap: Map<string, string>) {
if (!path) { if (!path) {
return path; return path;
} }
let arr = path.match(/{([\w]+)}/g); let arr: any[] | null = path.match(/{([\w]+)}/g);
if (Array.isArray(arr) && arr.length > 0) { if (Array.isArray(arr) && arr.length > 0) {
arr = Array.from(new Set(arr)); arr = Array.from(new Set(arr));
arr.forEach((str) => { arr.forEach((str) => {
@ -113,7 +113,7 @@ function replaceRestParams(path, restMap) {
const temp = str.substr(1); const temp = str.substr(1);
const param = temp.substring(0, temp.length - 1); const param = temp.substring(0, temp.length - 1);
if (str && restMap.has(param)) { if (str && restMap.has(param)) {
path = path.replace(new RegExp(str, 'g'), restMap.get(param)); path = path.replace(new RegExp(str, 'g'), restMap.get(param) || '');
} }
} catch (e) { } catch (e) {
// nothing // nothing
@ -124,7 +124,7 @@ function replaceRestParams(path, restMap) {
} }
// 返回最终groovyCode 代码模板片段 // 返回最终groovyCode 代码模板片段
function _groovyCodeTemplate(obj) { function _groovyCodeTemplate(obj: Record<string, any>) {
const { requestUrl, requestMethod, headers, body } = obj; const { requestUrl, requestMethod, headers, body } = obj;
const params = `[ const params = `[
'url': '${requestUrl}', 'url': '${requestUrl}',
@ -160,7 +160,7 @@ log.info(conn.content.text)
} }
// 处理groovyCode语言 // 处理groovyCode语言
function groovyCode(requestObj) { function groovyCode(requestObj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestBody = '', requestBody = '',
@ -179,7 +179,7 @@ function groovyCode(requestObj) {
let requestUrl = ''; let requestUrl = '';
if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) { if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) {
// 如果是get方法要将kv值加入argument中 // 如果是get方法要将kv值加入argument中
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
requestArguments.set(k, v); requestArguments.set(k, v);
}); });
} }
@ -193,7 +193,7 @@ function groovyCode(requestObj) {
if (requestMethod === 'POST' && bodyType === 'kvs') { if (requestMethod === 'POST' && bodyType === 'kvs') {
body = '"'; body = '"';
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
if (body !== '"') { if (body !== '"') {
body += '&'; body += '&';
} }
@ -211,7 +211,7 @@ function groovyCode(requestObj) {
} }
// 获取请求头 // 获取请求头
function getHeaders(requestHeaders) { function getHeaders(requestHeaders: Map<string, string>) {
let headers = '{'; let headers = '{';
let index = 1; let index = 1;
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]) => {
@ -226,13 +226,13 @@ function getHeaders(requestHeaders) {
return headers; return headers;
} }
// 获取pythonCode 模板 // 获取pythonCode 模板
function _pythonCodeTemplate(obj) { function _pythonCodeTemplate(obj: Record<string, any>) {
const { requestBody, requestBodyKvs, bodyType, requestPath, requestMethod, connType, domain, port } = obj; const { requestBodyKvs, requestPath, requestMethod, connType, domain, port } = obj;
let { headers } = obj; let { headers } = obj;
let reqBody = obj.requestBody; let reqBody = obj.requestBody;
if (requestMethod.toLowerCase() === 'post' && obj.bodyType === 'kvs' && obj.requestBodyKvs) { if (requestMethod.toLowerCase() === 'post' && obj.bodyType === 'kvs' && obj.requestBodyKvs) {
reqBody = 'urllib.urlencode({'; reqBody = 'urllib.urlencode({';
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
reqBody += `'${k}':'${v}'`; reqBody += `'${k}':'${v}'`;
}); });
reqBody += `})`; reqBody += `})`;
@ -259,7 +259,7 @@ log.info(data)
} }
// 处理pythonCode语言 // 处理pythonCode语言
function pythonCode(requestObj) { function pythonCode(requestObj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestMethod = '', requestMethod = '',
@ -280,7 +280,7 @@ function pythonCode(requestObj) {
const headers = getHeaders(requestHeaders); const headers = getHeaders(requestHeaders);
requestBody = requestBody ? JSON.stringify(requestBody) : '{}'; requestBody = requestBody ? JSON.stringify(requestBody) : '{}';
if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) { if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) {
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
requestArguments.set(k, v); requestArguments.set(k, v);
}); });
} }
@ -292,7 +292,7 @@ function pythonCode(requestObj) {
} }
// 获取javaBeanshell代码模板 // 获取javaBeanshell代码模板
function _beanshellTemplate(obj) { function _beanshellTemplate(obj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestBodyKvs = new Map(), requestBodyKvs = new Map(),
@ -315,14 +315,14 @@ function _beanshellTemplate(obj) {
.setPath("${requestPath}") .setPath("${requestPath}")
`; `;
// http 请求类型 // http 请求类型
const method = requestMethod.toLowerCase().replace(/^\S/, (s) => s.toUpperCase()); const method = requestMethod.toLowerCase().replace(/^\S/, (s: string) => s.toUpperCase());
const httpMethodCode = `Http${method} request = new Http${method}(uri);`; const httpMethodCode = `Http${method} request = new Http${method}(uri);`;
// 设置参数 // 设置参数
requestArguments.forEach(([k, v]) => { requestArguments.forEach(([k, v]: any[]) => {
uri += `.setParameter("${k}", "${v}")`; uri += `.setParameter("${k}", "${v}")`;
}); });
if (method === 'Get' && requestBodyKvs) { if (method === 'Get' && requestBodyKvs) {
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
uri += `.setParameter("${k}", "${v}")`; uri += `.setParameter("${k}", "${v}")`;
}); });
} }
@ -330,7 +330,7 @@ function _beanshellTemplate(obj) {
let postKvsParam = ''; let postKvsParam = '';
if (method === 'Post') { if (method === 'Post') {
// 设置post参数 // 设置post参数
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
postKvsParam += `nameValueList.add(new BasicNameValuePair("${k}", "${v}"));\r\n`; postKvsParam += `nameValueList.add(new BasicNameValuePair("${k}", "${v}"));\r\n`;
}); });
if (postKvsParam !== '') { if (postKvsParam !== '') {
@ -349,7 +349,7 @@ function _beanshellTemplate(obj) {
} }
// 设置请求头 // 设置请求头
let setHeader = ''; let setHeader = '';
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
setHeader = `${setHeader}request.setHeader("${k}", "${v}");\n`; setHeader = `${setHeader}request.setHeader("${k}", "${v}");\n`;
}); });
try { try {
@ -407,12 +407,12 @@ if (response.getStatusLine().getStatusCode() == 200) {
} }
// 处理java语言 // 处理java语言
function javaCode(requestObj) { function javaCode(requestObj: Record<string, any>) {
return _beanshellTemplate(requestObj); return _beanshellTemplate(requestObj);
} }
// 获取js语言代码模板 // 获取js语言代码模板
function _jsTemplate(obj) { function _jsTemplate(obj: Record<string, any>) {
const { const {
requestHeaders = new Map(), requestHeaders = new Map(),
requestMethod = 'GET', requestMethod = 'GET',
@ -437,7 +437,7 @@ function _jsTemplate(obj) {
} }
if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) { if (requestMethod.toLowerCase() === 'get' && requestBodyKvs) {
// 如果是get方法要将kv值加入argument中 // 如果是get方法要将kv值加入argument中
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
requestArguments.set(k, v); requestArguments.set(k, v);
}); });
} }
@ -452,13 +452,13 @@ function _jsTemplate(obj) {
if (bodyType && bodyType.toUpperCase() === 'RAW') { if (bodyType && bodyType.toUpperCase() === 'RAW') {
requestHeaders.set('Content-type', 'text/plain'); requestHeaders.set('Content-type', 'text/plain');
} }
requestHeaders.forEach(([k, v]) => { requestHeaders.forEach(([k, v]: any[]) => {
connStr += `conn.setRequestProperty("${k}","${v}");\n`; connStr += `conn.setRequestProperty("${k}","${v}");\n`;
}); });
if (requestMethod === 'POST' && bodyType === 'kvs') { if (requestMethod === 'POST' && bodyType === 'kvs') {
requestBody = '"'; requestBody = '"';
requestBodyKvs.forEach(([k, v]) => { requestBodyKvs.forEach(([k, v]: any[]) => {
if (requestBody !== '"') { if (requestBody !== '"') {
requestBody += '&'; requestBody += '&';
} }
@ -501,7 +501,7 @@ log.info(res);
} }
// 处理js语言 // 处理js语言
function jsCode(requestObj) { function jsCode(requestObj: Record<string, any>) {
return _jsTemplate(requestObj); return _jsTemplate(requestObj);
} }

View File

@ -75,7 +75,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { Message } from '@arco-design/web-vue'; import { FormInstance, Message } from '@arco-design/web-vue';
import { cloneDeep, isEqual } from 'lodash-es'; import { cloneDeep, isEqual } from 'lodash-es';
import MsTab from '@/components/pure/ms-tab/index.vue'; import MsTab from '@/components/pure/ms-tab/index.vue';
@ -116,7 +116,7 @@
}>(); }>();
const activeKey = ref<string>(EnvTabTypeEnum.ENVIRONMENT_PARAM); const activeKey = ref<string>(EnvTabTypeEnum.ENVIRONMENT_PARAM);
const envForm = ref(); const envForm = ref<FormInstance>();
const { t } = useI18n(); const { t } = useI18n();
const loading = ref(false); const loading = ref(false);
const tabSettingVisible = ref(false); const tabSettingVisible = ref(false);

View File

@ -45,7 +45,7 @@
if (store.currentEnvDetailInfo.config.pluginConfigMap[props.pluginId]) { if (store.currentEnvDetailInfo.config.pluginConfigMap[props.pluginId]) {
fApi.value?.reload(currentPluginScript.value); fApi.value?.reload(currentPluginScript.value);
if (fApi.value) { if (fApi.value) {
const form = {}; const form: Record<string, any> = {};
props.fields.forEach((key) => { props.fields.forEach((key) => {
form[key] = tempForm[key]; form[key] = tempForm[key];
}); });

View File

@ -972,7 +972,7 @@
return true; return true;
} }
function onDragStart(e, node: MsTreeNodeData) { function onDragStart(e: DragEvent, node: MsTreeNodeData) {
tempDragNode.value = node; tempDragNode.value = node;
} }
@ -980,7 +980,7 @@
tempDragNode.value = null; tempDragNode.value = null;
} }
const originalTreeData = ref<MsTreeNodeData[]>([]); const originalTreeData = ref<MsTreeNodeData[]>([]);
const { isInitListener, containerStatusClass, setContainer, initScrollListener } = useContainerShadow({ const { isInitListener, setContainer, initScrollListener } = useContainerShadow({
overHeight: 32, overHeight: 32,
containerClassName: 'ms-tree-container', containerClassName: 'ms-tree-container',
}); });

View File

@ -41,7 +41,7 @@
import { getEnvModules } from '@/api/modules/api-test/management'; import { getEnvModules } from '@/api/modules/api-test/management';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore, useTableStore } from '@/store'; import { useAppStore } from '@/store';
import { findNodeNames } from '@/utils'; import { findNodeNames } from '@/utils';
import type { ModuleTreeNode } from '@/models/common'; import type { ModuleTreeNode } from '@/models/common';
@ -56,7 +56,7 @@
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:visible', val: boolean); (e: 'update:visible', val: boolean): void;
}>(); }>();
const innerVisible = useVModel(props, 'visible', emit); const innerVisible = useVModel(props, 'visible', emit);

View File

@ -182,7 +182,7 @@
</a-tooltip> </a-tooltip>
</template> </template>
<template #sourceType="{ record }"> <template #sourceType="{ record }">
{{ t(associateFileSourceLocaleMap[record.sourceType]) }} {{ t(associateFileSourceLocaleMap[record.sourceType as keyof typeof associateFileSourceLocaleMap]) }}
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
<MsButton <MsButton

View File

@ -77,7 +77,7 @@
<MsTagGroup <MsTagGroup
v-else-if="!record.children && hasAnyPermission(['PROJECT_MESSAGE:READ'])" v-else-if="!record.children && hasAnyPermission(['PROJECT_MESSAGE:READ'])"
is-string-tag is-string-tag
:tag-list="record.receivers?.map((e) => e.name) || []" :tag-list="record.receivers?.map((e: Record<string,any>) => e.name) || []"
theme="outline" theme="outline"
/> />
<span v-else></span> <span v-else></span>
@ -330,7 +330,7 @@
})); }));
} }
function getReceiverOptions(options, event: string) { function getReceiverOptions(options: SelectOptionData[], event: string) {
if (event === 'CREATE' || event === 'CASE_CREATE' || event === 'MOCK_CREATE') { if (event === 'CREATE' || event === 'CASE_CREATE' || event === 'MOCK_CREATE') {
// //
options = options.filter((e) => !['OPERATOR', 'CREATE_USER', 'FOLLOW_PEOPLE'].includes(e.id)); options = options.filter((e) => !['OPERATOR', 'CREATE_USER', 'FOLLOW_PEOPLE'].includes(e.id));
@ -444,10 +444,10 @@
:deep(.arco-select-view-multiple.arco-select-view-size-medium .arco-select-view-tag) { :deep(.arco-select-view-multiple.arco-select-view-size-medium .arco-select-view-tag) {
margin-top: 1px; margin-top: 1px;
margin-bottom: 1px; margin-bottom: 1px;
max-width: 80px;
height: auto;
min-height: 24px;
line-height: 22px; line-height: 22px;
vertical-align: middle; vertical-align: middle;
height: auto;
max-width: 80px;
min-height: 24px;
} }
</style> </style>

View File

@ -187,7 +187,7 @@
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'cancel', shouldSearch: boolean): void; (e: 'cancel', shouldSearch: boolean): void;
(e: 'ok'); (e: 'ok'): void;
}>(); }>();
const resetForm = () => { const resetForm = () => {
@ -292,7 +292,7 @@
fApi.value?.setValue({ ...tempObj }); fApi.value?.setValue({ ...tempObj });
} }
function changeHandler(a, b) { function changeHandler(a: any, b: FormRuleItem) {
fApi.value.validateField(b.field); fApi.value.validateField(b.field);
fApi.value.refreshValidate(); fApi.value.refreshValidate();
} }

View File

@ -87,7 +87,7 @@
/> />
</template> </template>
<template #triggerMode="{ record }"> <template #triggerMode="{ record }">
<span>{{ t(ExecutionMethodsLabel[record.triggerMode]) }}</span> <span>{{ t(ExecutionMethodsLabel[record.triggerMode as keyof typeof ExecutionMethodsLabel]) }}</span>
</template> </template>
<template #triggerModeFilter="{ columnConfig }"> <template #triggerModeFilter="{ columnConfig }">
<TableFilter <TableFilter
@ -192,7 +192,6 @@
import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue'; import caseAndScenarioReportDrawer from '@/views/api-test/components/caseAndScenarioReportDrawer.vue';
import ReportDetailDrawer from '@/views/api-test/report/component/reportDetailDrawer.vue'; import ReportDetailDrawer from '@/views/api-test/report/component/reportDetailDrawer.vue';
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue'; import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
import TemplateItem from '@/views/setting/organization/template/components/templateItem.vue';
import { import {
batchStopRealOrdApi, batchStopRealOrdApi,
@ -215,9 +214,10 @@
import { BatchApiParams } from '@/models/common'; import { BatchApiParams } from '@/models/common';
import { RouteEnum } from '@/enums/routeEnum'; import { RouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { ExecutionMethodsLabel, TaskCenterEnum } from '@/enums/taskCenter'; import { ExecutionMethodsLabel } from '@/enums/taskCenter';
import { ordAndProjectColumn, TaskStatus } from './utils'; import type { ResourceTypeMapKey } from './utils';
import { Group, ordAndProjectColumn, TaskStatus } from './utils';
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const tableStore = useTableStore(); const tableStore = useTableStore();
@ -226,14 +226,14 @@
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
group: 'system' | 'organization' | 'project'; group: Group;
moduleType: keyof typeof TaskCenterEnum; moduleType: ResourceTypeMapKey;
name: string; name: string;
}>(); }>();
const keyword = ref<string>(''); const keyword = ref<string>('');
const statusFilterVisible = ref(false); const statusFilterVisible = ref(false);
const permissionsMap = { const permissionsMap: Record<Group, any> = {
organization: { organization: {
API_CASE: { API_CASE: {
stop: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_API_DEFINITION_CASE:READ+EXECUTE'], stop: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_API_DEFINITION_CASE:READ+EXECUTE'],

View File

@ -18,18 +18,18 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue';
import MsTag from '@/components/pure/ms-tag/ms-tag.vue'; import MsTag from '@/components/pure/ms-tag/ms-tag.vue';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { TaskCenterEnum } from '@/enums/taskCenter'; import { TaskCenterEnum } from '@/enums/taskCenter';
import type { ResourceTypeMapKey } from './utils';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
status: string; status: string;
moduleType: keyof typeof TaskCenterEnum; moduleType: ResourceTypeMapKey;
scriptIdentifier?: string; scriptIdentifier?: string;
}>(); }>();
@ -39,7 +39,7 @@
color?: string; color?: string;
} }
const iconTypeStatus = ref({ const iconTypeStatus: Record<ResourceTypeMapKey, any> = {
[TaskCenterEnum.API_CASE]: { [TaskCenterEnum.API_CASE]: {
SUCCESS: { SUCCESS: {
icon: 'icon-icon_succeed_colorful', icon: 'icon-icon_succeed_colorful',
@ -183,10 +183,10 @@
color: '!text-[rgb(var(--link-6))]', color: '!text-[rgb(var(--link-6))]',
}, },
}, },
}); };
function getExecutionResult(): IconType { function getExecutionResult(): IconType {
return iconTypeStatus.value[props.moduleType][props.status]; return iconTypeStatus[props.moduleType][props.status];
} }
const methodColor = 'rgb(var(--warning-7))'; const methodColor = 'rgb(var(--warning-7))';
</script> </script>

View File

@ -46,7 +46,9 @@
</div> </div>
</template> </template>
<template #resourceType="{ record }"> <template #resourceType="{ record }">
<div type="text" class="flex w-full">{{ t(resourceTypeMap[record.resourceType].label) }}</div> <div type="text" class="flex w-full">
{{ t(resourceTypeMap[record.resourceType as ResourceTypeMapKey].label) }}
</div>
</template> </template>
<template #value="{ record }"> <template #value="{ record }">
<a-select <a-select
@ -161,7 +163,7 @@
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
import { TaskCenterEnum } from '@/enums/taskCenter'; import { TaskCenterEnum } from '@/enums/taskCenter';
import { ordAndProjectColumn, resourceTypeMap } from './utils'; import { Group, ordAndProjectColumn, resourceTypeMap, ResourceTypeMapKey } from './utils';
const appStore = useAppStore(); const appStore = useAppStore();
@ -172,7 +174,7 @@
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
group: string; group: Group;
moduleType: keyof typeof TaskCenterEnum; moduleType: keyof typeof TaskCenterEnum;
name: string; name: string;
}>(); }>();
@ -213,7 +215,7 @@
}, },
}); });
const permissionsMap = { const permissionsMap: Record<Group, any> = {
organization: { organization: {
API_IMPORT: { API_IMPORT: {
edit: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_API_DEFINITION:READ+IMPORT'], edit: ['ORGANIZATION_TASK_CENTER:READ+STOP', 'PROJECT_API_DEFINITION:READ+IMPORT'],

View File

@ -30,8 +30,10 @@
import { TaskCenterEnum } from '@/enums/taskCenter'; import { TaskCenterEnum } from '@/enums/taskCenter';
import type { ResourceTypeMapKey } from './utils';
const { t } = useI18n(); const { t } = useI18n();
const activeTab = ref<keyof typeof TaskCenterEnum>(TaskCenterEnum.API_CASE); const activeTab = ref<ResourceTypeMapKey>(TaskCenterEnum.API_CASE);
const props = defineProps<{ const props = defineProps<{
group: 'system' | 'organization' | 'project'; group: 'system' | 'organization' | 'project';

View File

@ -148,7 +148,16 @@ export const TaskStatus = {
}, },
}; };
export const resourceTypeMap = { export type Group = 'system' | 'organization' | 'project';
export type ResourceTypeMapKey =
| TaskCenterEnum.API_CASE
| TaskCenterEnum.API_SCENARIO
| TaskCenterEnum.UI_TEST
| TaskCenterEnum.LOAD_TEST
| TaskCenterEnum.TEST_PLAN;
export const resourceTypeMap: Record<ResourceTypeMapKey, Record<string, any>> = {
[TaskCenterEnum.API_CASE]: { [TaskCenterEnum.API_CASE]: {
value: TaskCenterEnum.API_CASE, value: TaskCenterEnum.API_CASE,
label: 'project.taskCenter.interfaceCase', label: 'project.taskCenter.interfaceCase',

View File

@ -72,7 +72,7 @@
<a-checkbox <a-checkbox
v-model="formItem.required" v-model="formItem.required"
class="mr-1" class="mr-1"
@change="(value) => changeState(value, formItem)" @change="(value) => changeState(value, formItem as DefinedFieldItem)"
>{{ t('system.orgTemplate.required') }}</a-checkbox >{{ t('system.orgTemplate.required') }}</a-checkbox
> >
</span> </span>
@ -545,9 +545,11 @@
selectData.value = [...selectDataValue, ...newData]; selectData.value = [...selectDataValue, ...newData];
}; };
function changeState(value: boolean | (string | number | boolean)[], formItem) { function changeState(value: boolean | (string | number | boolean)[], formItem: DefinedFieldItem) {
formItem.required = value; formItem.required = !!value;
formItem.formRules[0].effect.required = value; if (formItem.formRules) {
formItem.formRules[0].effect.required = value;
}
} }
const systemFieldData = ref<CustomField[]>([]); const systemFieldData = ref<CustomField[]>([]);

View File

@ -33,11 +33,11 @@
<a-checkbox-group v-model:model-value="statusFilters" direction="vertical" size="small"> <a-checkbox-group v-model:model-value="statusFilters" direction="vertical" size="small">
<a-checkbox v-for="key of Object.keys(reviewStatusMap)" :key="key" :value="key"> <a-checkbox v-for="key of Object.keys(reviewStatusMap)" :key="key" :value="key">
<a-tag <a-tag
:color="reviewStatusMap[key].color" :color="reviewStatusMap[key as ReviewStatus].color"
:class="[reviewStatusMap[key].class, 'px-[4px]']" :class="[reviewStatusMap[key as ReviewStatus].class, 'px-[4px]']"
size="small" size="small"
> >
{{ t(reviewStatusMap[key].label) }} {{ t(reviewStatusMap[key as ReviewStatus].label) }}
</a-tag> </a-tag>
</a-checkbox> </a-checkbox>
</a-checkbox-group> </a-checkbox-group>
@ -103,6 +103,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useTableStore } from '@/store'; import { useTableStore } from '@/store';
import { ReviewStatus } from '@/models/caseManagement/caseReview';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum'; import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
const tableStore = useTableStore(); const tableStore = useTableStore();

View File

@ -48,6 +48,5 @@
"types/*" "types/*"
] ]
}, },
"noImplicitAny": false,
} }
} }

View File

@ -39,3 +39,11 @@ export interface GeneralChart {
declare type Recordable<T = any> = Record<string, T>; declare type Recordable<T = any> = Record<string, T>;
export type LocaleType = 'zh-CN' | 'en-US'; export type LocaleType = 'zh-CN' | 'en-US';
declare global {
namespace JSX {
interface IntrinsicElements {
[elemName: string]: any;
}
}
}