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/vue-3": "^2.1.13",
"@types/color": "^3.0.4",
"@types/node": "^20.11.16",
"@types/node": "^20.11.19",
"@vueuse/core": "^10.9.0",
"@xmldom/xmldom": "^0.8.10",
"ace-builds": "^1.24.2",
@ -93,6 +93,9 @@
"@types/lodash": "^4.14.198",
"@types/lodash-es": "^4.17.9",
"@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",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
@ -144,7 +147,7 @@
"stylelint-less": "^1.0.8",
"stylelint-order": "^5.0.0",
"tailwindcss": "^3.3.3",
"typescript": "^5.4.2",
"typescript": "^5.4.5",
"unplugin-auto-import": "^0.16.7",
"unplugin-vue-components": "^0.24.1",
"vite": "^3.2.7",

View File

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

View File

@ -399,6 +399,7 @@
const { t } = useI18n();
// TODO: Param
interface Param {
[key: string]: any;
}
@ -713,7 +714,7 @@
function applyMoreSetting(record: ExpressionConfig) {
switch (condition.value.assertionBodyType) {
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) {
record.moreSettingPopoverVisible = false;
return {
@ -725,7 +726,7 @@
});
break;
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) {
record.moreSettingPopoverVisible = false;
return {
@ -737,7 +738,7 @@
});
break;
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) {
record.moreSettingPopoverVisible = false;
return {
@ -761,7 +762,7 @@
config: RegexExtract | JSONPathExtract | XPathExtract,
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) {
return {
...e,
@ -771,7 +772,7 @@
}
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) {
return {
...e,
@ -780,7 +781,7 @@
}
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) {
return {
...e,
@ -794,17 +795,17 @@
nextTick(() => {
if (condition.value.assertionBodyType === ResponseBodyAssertionType.JSON_PATH) {
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) {
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) {
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>) {
switch (condition.value.assertionBodyType) {
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) {
condition.value.jsonPathAssertion.assertions.splice(jsonIndex, 0, {
...record,
@ -826,7 +829,7 @@
}
break;
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) {
condition.value.xpathAssertion.assertions.splice(xpathIndex, 0, {
...record,
@ -846,7 +849,7 @@
});
break;
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) {
condition.value.regexAssertion.assertions.splice(regIndex, 0, {
...record,

View File

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

View File

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

View File

@ -259,7 +259,7 @@
});
// 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
v-model:popup-visible={visible.value}
trigger="click"
@ -385,16 +385,16 @@
return (
<MsPersonInfoDrawer
visible={personalDrawerVisible.value}
onUpdate:visible={(e) => {
onUpdate:visible={(e: boolean) => {
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 ? (
<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">

View File

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

View File

@ -23,12 +23,12 @@
</a-tooltip>
<MsTag
theme="light"
:type="tagMap[config.status].type"
:self-style="tagMap[config.status].style"
:type="tagMap[config.status as Status].type"
:self-style="tagMap[config.status as Status].style"
size="small"
class="px-[4px]"
>
{{ tagMap[config.status].text }}
{{ tagMap[config.status as Status].text }}
</MsTag>
</div>
<MsFormCreate
@ -47,7 +47,7 @@
</template>
<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 MsTag, { TagType } from '@/components/pure/ms-tag/ms-tag.vue';
@ -117,7 +117,7 @@
},
});
const currentOrg = ref(appStore.currentOrgId);
const orgOptions = ref([]);
const orgOptions = ref<SelectOptionData[]>([]);
const orgLoading = ref(false);
async function initOrgOptions() {
@ -128,7 +128,6 @@
label: e.name,
value: e.id,
}));
console.log(orgOptions.value);
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);

View File

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

View File

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

View File

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

View File

@ -75,7 +75,9 @@
'pick',
jsonPath.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);

View File

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

View File

@ -9,3 +9,9 @@ declare module '*.vue' {
interface ImportMetaEnv {
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;
reviewers: string[];
reviewNames: string[];
status: string;
myStatus: string;
status: ReviewResult;
myStatus: ReviewResult;
moduleId: string;
moduleName: string;
}

View File

@ -122,3 +122,8 @@ export interface UpdateBaseInfo {
email: 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 { BatchActionQueryParams, MsTableColumnData } from '@/components/pure/ms-table/type';
import { BugEditCustomField, CustomFieldItem } from '@/models/bug-management';
import type { CustomAttributes } from '@/models/caseManagement/featureCase';
import { isObject } from './is';
@ -206,7 +205,7 @@ export function traverseTree<T>(
tree = [tree];
}
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
const node = (tree as TreeNode<T>[])[i];
if (typeof customNodeFn === 'function') {
customNodeFn(node);
}
@ -280,18 +279,18 @@ export function mapTree<T>(
*/
export function filterTree<T>(
tree: TreeNode<T> | TreeNode<T>[] | T | T[],
filterFn: (node: T) => boolean,
filterFn: (node: TreeNode<T>) => boolean,
customChildrenKey = 'children'
): T[] {
): TreeNode<T>[] {
if (!Array.isArray(tree)) {
tree = [tree];
}
const filteredTree: T[] = [];
const filteredTree: TreeNode<T>[] = [];
for (let i = 0; i < tree.length; i++) {
const node: T = tree[i];
const node = (tree as TreeNode<T>[])[i];
// 如果节点满足过滤条件,则保留该节点,并递归过滤子节点
if (filterFn(node)) {
const newNode: T = cloneDeep(node);
const newNode = cloneDeep(node);
if (node[customChildrenKey] && node[customChildrenKey].length > 0) {
// 递归过滤子节点,并将过滤后的子节点添加到当前节点中
newNode[customChildrenKey] = filterTree(node[customChildrenKey], filterFn, customChildrenKey);
@ -683,7 +682,7 @@ export const downloadByteFile = (byte: BlobPart, fileName: string) => {
* @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 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++) {
const current = data[i];
if (current.value === targetId) {

View File

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

View File

@ -33,7 +33,9 @@
{{ `${t('apiTestDebug.wait')}${item.delay}` }} ms
</div>
<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
v-if="item.processorType === RequestConditionProcessor.REQUEST_SCRIPT"
class="ml-1 mt-[2px] min-w-[48px]"

View File

@ -255,7 +255,7 @@
JSONPath({
json: parseJson.value,
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) {
matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }) || [];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -95,7 +95,7 @@
const moduleTreeRef = ref<InstanceType<typeof moduleTree>>();
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;
protocol.value = _protocol;
folderTreePathMap.value = pathMap;

View File

@ -49,7 +49,7 @@
const moduleTreeRef = ref<InstanceType<typeof moduleTree>>();
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;
protocol.value = _protocol;
folderTreePathMap.value = pathMap;

View File

@ -12,7 +12,7 @@
status: string;
}>();
//
const scenarioStepMap = {
const scenarioStepMap: Record<string, any> = {
[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.ONCE_ONLY_CONTROLLER]: { label: 'apiScenario.onlyOnceControl', color: 'rgba(211, 68, 0, 1)' },
@ -25,8 +25,8 @@
const getClass = computed(() => {
if (props.status) {
return {
color: scenarioStepMap[props.status].color,
border: `1px solid ${scenarioStepMap[props.status].color}`,
color: scenarioStepMap[props.status]?.color,
border: `1px solid ${scenarioStepMap[props.status]?.color}`,
};
}
});

View File

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

View File

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

View File

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

View File

@ -689,7 +689,7 @@
nextTick(() => {
if (fApi.value) {
fApi.value.nextRefresh(() => {
const form = {};
const form: Record<string, any> = {};
controlPluginFormFields().forEach((key) => {
form[key] = formData[key];
});
@ -921,12 +921,12 @@
async function execute(executeType?: 'localExec' | 'serverExec') {
requestVModel.value.executeLoading = true;
if (isHttpProtocol.value) {
emit('execute', makeRequestParams(executeType), executeType);
emit('execute', makeRequestParams(executeType) as RequestParam, executeType);
} else {
//
fApi.value?.validate(async (valid) => {
if (valid === true) {
emit('execute', makeRequestParams(executeType), executeType);
emit('execute', makeRequestParams(executeType) as RequestParam, executeType);
} else {
requestVModel.value.activeTab = RequestComposition.PLUGIN;
nextTick(() => {
@ -942,7 +942,7 @@
emit('stopDebug');
}
function initErrorMessageInfoItem(key) {
function initErrorMessageInfoItem(key: string) {
if (requestVModel.value.errorMessageInfo && !requestVModel.value.errorMessageInfo[key]) {
requestVModel.value.errorMessageInfo[key] = {};
}
@ -1026,7 +1026,7 @@
function handleClose() {
// applyStep case
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 scenarioStepMap = {
const scenarioStepMap: Record<string, any> = {
[ScenarioStepType.CONSTANT_TIMER]: { label: 'apiScenario.waitTime', color: 'rgb(var(--warning-6))' },
[ScenarioStepType.LOOP_CONTROLLER]: { label: 'apiScenario.loopControl', color: 'rgba(167, 98, 191, 1)' },
[ScenarioStepType.IF_CONTROLLER]: { label: 'apiScenario.conditionControl', color: 'rgba(238, 80, 163, 1)' },

View File

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

View File

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

View File

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

View File

@ -146,7 +146,7 @@
import { deleteNodes, filterTree, getGenerateId, mapTree, traverseTree } from '@/utils';
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';
const emit = defineEmits<{
@ -392,14 +392,14 @@
}
return false;
});
const waitingDebugStepDetails = {};
const waitingDebugStepDetails: Record<string, ScenarioStepDetails> = {};
Object.keys(scenario.value.stepDetails).forEach((key) => {
if (checkedKeysSet.has(key)) {
waitingDebugStepDetails[key] = scenario.value.stepDetails[key];
}
});
emit('batchDebug', {
steps: waitTingDebugSteps,
steps: waitTingDebugSteps as ScenarioStepItem[],
stepDetails: waitingDebugStepDetails,
reportId: getGenerateId(),
});

View File

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

View File

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

View File

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

View File

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

View File

@ -468,7 +468,7 @@
formItem.forEach((item: FormRuleItem) => {
let itemVal = item.value;
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({
id: item.field as string,

View File

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

View File

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

View File

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

View File

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

View File

@ -33,6 +33,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { debounce } from 'lodash-es';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { MsTableColumn } from '@/components/pure/ms-table/type';
@ -48,7 +49,6 @@
import { TableKeyEnum } from '@/enums/tableEnum';
import { statusIconMap } from '../utils';
import debounce from 'lodash-es/debounce';
const featureCaseStore = useFeatureCaseStore();
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 { getFileEnum } from '@/components/pure/ms-upload/iconMap';
import type { MsFileItem } from '@/components/pure/ms-upload/types';
import type { CaseLevel } from '@/components/business/ms-case-associate/types';
import { useI18n } from '@/hooks/useI18n';
import useUserStore from '@/store/modules/user';
import { hasAnyPermission } from '@/utils/permission';
import type { AssociatedList, CustomAttributes } from '@/models/caseManagement/featureCase';
import { StatusType } from '@/enums/caseEnum';
const userStore = useUserStore();
const { t } = useI18n();
export interface ReviewResult {
@ -21,8 +18,8 @@ export interface ReviewResult {
statusText: string;
}
// 图标评审结果
export const statusIconMap = {
// 图标评审结果 TODO:TS 类型 key
export const statusIconMap: Record<string, any> = {
UN_REVIEWED: {
key: 'UN_REVIEWED',
icon: StatusType.UN_REVIEWED,
@ -54,8 +51,8 @@ export const statusIconMap = {
color: 'text-[rgb(var(--warning-6))]',
},
};
// 图标执行结果
export const executionResultMap = {
// 图标执行结果 TODO:TS 类型 key
export const executionResultMap: Record<string, any> = {
UN_EXECUTED: {
key: 'UN_EXECUTED',
icon: StatusType.UN_EXECUTED,
@ -143,7 +140,7 @@ export function getTableFields(customFields: CustomAttributes[], itemDataIndex:
);
if (currentColumnData) {
let selectValue;
let selectValue: string;
// 处理多选项
if (multipleExcludes.includes(currentColumnData.type) && currentColumnData.defaultValue) {
selectValue = JSON.parse(currentColumnData.defaultValue);

View File

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

View File

@ -49,12 +49,8 @@
<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 v-for="key of Object.keys(reviewResultMap)" :key="key" :value="key">
<a-tag
:color="reviewResultMap[key].color"
:class="[reviewResultMap[key].class, 'px-[4px]']"
size="small"
>
{{ t(reviewResultMap[key].label) }}
<a-tag :color="reviewResultMap[key as ReviewResult].color" class="px-[4px]" size="small">
{{ t(reviewResultMap[key as ReviewResult].label) }}
</a-tag>
</a-checkbox>
</a-checkbox-group>
@ -321,7 +317,13 @@
import useUserStore from '@/store/modules/user';
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 { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum';
@ -571,12 +573,14 @@
* @param record 关联用例项
* @param done 关闭弹窗
*/
async function handleDisassociateReviewCase(record: ReviewCaseItem, done) {
async function handleDisassociateReviewCase(record: ReviewCaseItem, done?: () => void) {
try {
disassociateLoading.value = true;
await disassociateReviewCase(route.query.id as string, record.caseId);
emit('refresh');
done();
if (done) {
done();
}
Message.success(t('caseManagement.caseReview.disassociateSuccess'));
loadList();
} catch (error) {

View File

@ -45,11 +45,11 @@
<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-tag
:color="reviewStatusMap[key].color"
:class="[reviewStatusMap[key].class, 'px-[4px]']"
:color="reviewStatusMap[key as ReviewStatus].color"
:class="[reviewStatusMap[key as ReviewStatus].class, 'px-[4px]']"
size="small"
>
{{ t(reviewStatusMap[key].label) }}
{{ t(reviewStatusMap[key as ReviewStatus].label) }}
</a-tag>
</a-checkbox>
</a-checkbox-group>

View File

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

View File

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

View File

@ -75,7 +75,7 @@
<script lang="ts" setup>
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 MsTab from '@/components/pure/ms-tab/index.vue';
@ -116,7 +116,7 @@
}>();
const activeKey = ref<string>(EnvTabTypeEnum.ENVIRONMENT_PARAM);
const envForm = ref();
const envForm = ref<FormInstance>();
const { t } = useI18n();
const loading = ref(false);
const tabSettingVisible = ref(false);

View File

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

View File

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

View File

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

View File

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

View File

@ -77,7 +77,7 @@
<MsTagGroup
v-else-if="!record.children && hasAnyPermission(['PROJECT_MESSAGE:READ'])"
is-string-tag
:tag-list="record.receivers?.map((e) => e.name) || []"
:tag-list="record.receivers?.map((e: Record<string,any>) => e.name) || []"
theme="outline"
/>
<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') {
//
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) {
margin-top: 1px;
margin-bottom: 1px;
max-width: 80px;
height: auto;
min-height: 24px;
line-height: 22px;
vertical-align: middle;
height: auto;
max-width: 80px;
min-height: 24px;
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

@ -30,8 +30,10 @@
import { TaskCenterEnum } from '@/enums/taskCenter';
import type { ResourceTypeMapKey } from './utils';
const { t } = useI18n();
const activeTab = ref<keyof typeof TaskCenterEnum>(TaskCenterEnum.API_CASE);
const activeTab = ref<ResourceTypeMapKey>(TaskCenterEnum.API_CASE);
const props = defineProps<{
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]: {
value: TaskCenterEnum.API_CASE,
label: 'project.taskCenter.interfaceCase',

View File

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

View File

@ -33,11 +33,11 @@
<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-tag
:color="reviewStatusMap[key].color"
:class="[reviewStatusMap[key].class, 'px-[4px]']"
:color="reviewStatusMap[key as ReviewStatus].color"
:class="[reviewStatusMap[key as ReviewStatus].class, 'px-[4px]']"
size="small"
>
{{ t(reviewStatusMap[key].label) }}
{{ t(reviewStatusMap[key as ReviewStatus].label) }}
</a-tag>
</a-checkbox>
</a-checkbox-group>
@ -103,6 +103,7 @@
import { useI18n } from '@/hooks/useI18n';
import { useTableStore } from '@/store';
import { ReviewStatus } from '@/models/caseManagement/caseReview';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
const tableStore = useTableStore();

View File

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

View File

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