diff --git a/frontend/src/components/business/ms-edit-comp/edit-comp.tsx b/frontend/src/components/business/ms-edit-comp/edit-comp.tsx new file mode 100644 index 0000000000..4968a8f952 --- /dev/null +++ b/frontend/src/components/business/ms-edit-comp/edit-comp.tsx @@ -0,0 +1,146 @@ +import { PropType } from 'vue'; + +import { useI18n } from '@/hooks/useI18n'; + +import './style.less'; +import { MsUserSelector } from '../ms-user-selector'; +import { UserRequestTypeEnum } from '../ms-user-selector/utils'; +import { ModelValueType } from './types'; +import Message from '@arco-design/web-vue/es/message'; + +type EditStatus = 'null' | 'active' | 'hover'; +export default defineComponent({ + name: 'MsEditComp', + props: { + // 具体绑定的值 + modelValue: { + type: [String, Number, Boolean, Object, Array] as PropType, + default: '', + }, + // 表格默认显示的值 + defaultValue: { + type: [String, Number, Boolean, Object, Array] as PropType, + default: '', + }, + // 组件类型 + mode: { + type: String, + default: 'Input', + }, + // 选择框的选项 + options: { + type: Array as PropType<{ value: string; label: string }[]>, + default: () => [], + }, + // 用户选择器的类型 + userSelectorType: { + type: String as PropType, + default: '', + }, + }, + emits: { + /* eslint-disable @typescript-eslint/no-unused-vars */ + change: (value: ModelValueType, cb: (result: boolean, defaultValue: string) => void) => true, + }, + setup(props, { emit }) { + const { mode, options, modelValue, defaultValue } = toRefs(props); + const oldModelValue = ref(modelValue.value); + const editStatus = ref('null'); + + const { t } = useI18n(); + + const handleChange = (value: ModelValueType) => { + emit('change', value, (result: boolean, v: string) => { + if (result) { + defaultValue.value = v; + Message.success(t('common.updateSuccess')); + } else { + Message.error(t('common.updateFail')); + modelValue.value = oldModelValue.value; + } + }); + }; + + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Enter') { + handleChange(modelValue.value); + } + }; + + const handleClick = () => { + editStatus.value = 'active'; + }; + + const handleReset = () => { + editStatus.value = 'null'; + modelValue.value = oldModelValue.value; + }; + + const handleBlur = () => { + handleReset(); + }; + + const renderDiv = () => { + const _defaultValue = Array.isArray(defaultValue.value) ? defaultValue.value.join(',') : defaultValue.value; + + return ( +
+ {_defaultValue} +
+ ); + }; + + const renderPrivew = () => { + const _defaultValue = Array.isArray(defaultValue.value) ? defaultValue.value.join(',') : defaultValue.value; + + return ( +
{ + if (editStatus.value === 'hover') editStatus.value = 'null'; + }} + class="gap[8px] flex h-[32px] w-[112px] cursor-pointer flex-row items-center justify-between bg-[var(--color-text-n8)] p-[8px]" + > +
{_defaultValue}
+
+ +
+
+ ); + }; + + const renderChild = () => { + if (mode.value === 'input') { + return ; + } + if (mode.value === 'select') { + return ; + } + if (mode.value === 'tagInput') { + return ; + } + if (mode.value === 'userSelect') { + return ( + + ); + } + }; + + return () => ( +
{ + if (editStatus.value === 'null') editStatus.value = 'hover'; + }} + > + {editStatus.value === 'null' && renderDiv()} + {editStatus.value === 'hover' && renderPrivew()} + {editStatus.value === 'active' && renderChild()} +
+ ); + }, +}); diff --git a/frontend/src/components/business/ms-edit-comp/index.ts b/frontend/src/components/business/ms-edit-comp/index.ts new file mode 100644 index 0000000000..7e69947006 --- /dev/null +++ b/frontend/src/components/business/ms-edit-comp/index.ts @@ -0,0 +1,12 @@ +import EditComp from './edit-comp'; +import type { App } from 'vue'; + +const MsEditComp = Object.assign(EditComp, { + install: (app: App) => { + app.component(EditComp.name, EditComp); + }, +}); + +export type CommentInstance = InstanceType; + +export default MsEditComp; diff --git a/frontend/src/components/business/ms-edit-comp/style.less b/frontend/src/components/business/ms-edit-comp/style.less new file mode 100644 index 0000000000..c0f097ed0a --- /dev/null +++ b/frontend/src/components/business/ms-edit-comp/style.less @@ -0,0 +1,3 @@ +.child-bg > :first-child { + background-color: var(--color-text-8); +} diff --git a/frontend/src/components/business/ms-edit-comp/types.ts b/frontend/src/components/business/ms-edit-comp/types.ts new file mode 100644 index 0000000000..b5f91e66a9 --- /dev/null +++ b/frontend/src/components/business/ms-edit-comp/types.ts @@ -0,0 +1,6 @@ +export type ModelValueType = + | string + | number + | boolean + | Record + | (string | number | boolean | Record)[]; diff --git a/frontend/src/components/business/ms-user-selector/index.vue b/frontend/src/components/business/ms-user-selector/index.vue index ba457a94e1..59b692dc61 100644 --- a/frontend/src/components/business/ms-user-selector/index.vue +++ b/frontend/src/components/business/ms-user-selector/index.vue @@ -63,6 +63,7 @@ const emit = defineEmits<{ (e: 'update:modelValue', value: string[]): void; + (e: 'select', value: string[]): void; }>(); const { t } = useI18n(); @@ -135,6 +136,10 @@ 'update:modelValue', tmpArr.map((item) => item[valueKey]) ); + emit( + 'select', + tmpArr.map((item) => item[valueKey]) + ); }; onBeforeMount(async () => { diff --git a/frontend/src/components/pure/ms-table/base-table.vue b/frontend/src/components/pure/ms-table/base-table.vue index da3e6c4e19..48fbdd52b2 100644 --- a/frontend/src/components/pure/ms-table/base-table.vue +++ b/frontend/src/components/pure/ms-table/base-table.vue @@ -403,11 +403,15 @@ // 排序change事件 const handleSortChange = (dataIndex: string, direction: string) => { + let firstIndex = 0; + if (attrs.selectable) { + firstIndex = 1; + } const regex = /^__arco_data_index_(\d+)$/; const match = dataIndex.match(regex); const lastDigit = match && Number(match[1]); - if (lastDigit && !Number.isNaN(lastDigit)) { - dataIndex = currentColumns.value[lastDigit].dataIndex as string; + if (lastDigit !== null && !Number.isNaN(lastDigit)) { + dataIndex = currentColumns.value[lastDigit - firstIndex].dataIndex as string; } let sortOrder = ''; if (direction === 'ascend') { diff --git a/frontend/src/models/bug-management.ts b/frontend/src/models/bug-management.ts index 06d36aea5a..f3e117e336 100644 --- a/frontend/src/models/bug-management.ts +++ b/frontend/src/models/bug-management.ts @@ -7,11 +7,11 @@ export interface BugListItem { handleUser: string; // 缺陷处理人 relationCaseCount: number; // 关联用例数 platform: string; // 所属平台 - tag: string; // 缺陷标签 + tag: string[]; // 缺陷标签 createUser: string; // 创建人 updateUser: string; // 更新人 createTime: string; // 创建时间 updateTime: string; // 更新时间 - deleted: string; // 删除标志 + deleted: boolean; // 删除标志 } export default {}; diff --git a/frontend/src/views/bug-management/components/bug-detail-drawer.vue b/frontend/src/views/bug-management/components/bug-detail-drawer.vue index fad3d2a7ef..61a403c790 100644 --- a/frontend/src/views/bug-management/components/bug-detail-drawer.vue +++ b/frontend/src/views/bug-management/components/bug-detail-drawer.vue @@ -78,7 +78,7 @@ - diff --git a/frontend/src/views/bug-management/locale/zh-CN.ts b/frontend/src/views/bug-management/locale/zh-CN.ts index 88bf98be09..8cd54bab21 100644 --- a/frontend/src/views/bug-management/locale/zh-CN.ts +++ b/frontend/src/views/bug-management/locale/zh-CN.ts @@ -49,5 +49,18 @@ export default { performanceCase: '性能用例', searchCase: '通过名称搜索', }, + severityO: { + fatal: '致命', + serious: '严重', + general: '一般', + reminder: '提醒', + }, + statusO: { + create: '新建', + processing: '处理中', + resolved: '已解决', + closed: '已关闭', + refused: '已拒绝', + }, }, }; diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue index b2a23f4cec..cfc2b70aac 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue @@ -359,6 +359,7 @@ { title: 'caseManagement.featureCase.tableColumnModule', slotName: 'moduleId', + dataIndex: 'moduleId', showInTable: true, width: 300, showDrag: true,