fix: 用例&模板三方插件bug修复
This commit is contained in:
parent
b86f722afe
commit
13adc882ea
|
@ -1,8 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<FormCreate
|
<FormCreate
|
||||||
v-model:api="formApi"
|
v-model:api="innerApi"
|
||||||
:rule="formRules"
|
:rule="formRules"
|
||||||
:option="props.option"
|
:option="props.option || options"
|
||||||
@mounted="handleMounted"
|
@mounted="handleMounted"
|
||||||
@reload="handleReload"
|
@reload="handleReload"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
|
@ -32,23 +32,31 @@
|
||||||
api?: Api; // 收集表单的值
|
api?: Api; // 收集表单的值
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const innerApi = ref<any>();
|
||||||
|
|
||||||
const emits = defineEmits(['update:api', 'update:rule', 'mounted', 'reload', 'change']);
|
const emits = defineEmits(['update:api', 'update:rule', 'mounted', 'reload', 'change']);
|
||||||
|
|
||||||
const formApi = ref<Api>();
|
const formApi = computed({
|
||||||
|
get() {
|
||||||
watchEffect(() => {
|
return props.api;
|
||||||
formApi.value = props.api;
|
},
|
||||||
|
set(val) {
|
||||||
|
emits('update:api', val);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => formApi.value,
|
() => formApi.value,
|
||||||
(val) => {
|
(val) => {
|
||||||
emits('update:api', val);
|
emits('update:api', val);
|
||||||
}
|
},
|
||||||
|
{ deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const formRules = ref<FormRule | undefined>([]);
|
const formRules = ref<FormRule | undefined>([]);
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
formRules.value = props.rule;
|
formRules.value = props.rule;
|
||||||
|
formApi.value = props.api || innerApi.value;
|
||||||
});
|
});
|
||||||
watch(
|
watch(
|
||||||
() => props.rule,
|
() => props.rule,
|
||||||
|
@ -62,6 +70,9 @@
|
||||||
() => formRules.value,
|
() => formRules.value,
|
||||||
(val) => {
|
(val) => {
|
||||||
emits('update:rule', val);
|
emits('update:rule', val);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -75,8 +86,26 @@
|
||||||
|
|
||||||
function handleChange(value: any) {
|
function handleChange(value: any) {
|
||||||
formApi.value?.validateField(value);
|
formApi.value?.validateField(value);
|
||||||
emits('change');
|
emits('update:api', formApi.value);
|
||||||
|
emits('change', value, formApi.value);
|
||||||
}
|
}
|
||||||
|
const options = {
|
||||||
|
resetBtn: false, // 不展示默认配置的重置和提交
|
||||||
|
submitBtn: false,
|
||||||
|
on: false, // 取消绑定on事件
|
||||||
|
form: {
|
||||||
|
layout: 'vertical',
|
||||||
|
labelAlign: 'left',
|
||||||
|
},
|
||||||
|
// 暂时默认
|
||||||
|
row: {
|
||||||
|
gutter: 0,
|
||||||
|
},
|
||||||
|
wrap: {
|
||||||
|
'asterisk-position': 'end',
|
||||||
|
'validate-trigger': ['change'],
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="props.direction === 'horizontal' && props.expandDirection === 'right' && !props.disabled"
|
v-if="props.direction === 'horizontal' && props.expandDirection === 'right' && !props.disabled"
|
||||||
class="absolute right-0 h-full w-[12px]"
|
class="absolute right-0 z-40 h-full w-[12px]"
|
||||||
>
|
>
|
||||||
<div class="expand-icon expand-icon--left" @click="() => changeExpand()">
|
<div class="expand-icon expand-icon--left" @click="() => changeExpand()">
|
||||||
<MsIcon
|
<MsIcon
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</div>
|
</div>
|
||||||
<keep-alive>
|
<keep-alive>
|
||||||
<div class="leftContent mt-4 px-4">
|
<div class="leftContent mt-4 p-[24px]">
|
||||||
<template v-if="activeTab === 'detail'">
|
<template v-if="activeTab === 'detail'">
|
||||||
<TabDetail
|
<TabDetail
|
||||||
ref="tabDetailRef"
|
ref="tabDetailRef"
|
||||||
|
|
|
@ -272,6 +272,7 @@
|
||||||
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
import { downloadByteFile, getGenerateId } from '@/utils';
|
import { downloadByteFile, getGenerateId } from '@/utils';
|
||||||
|
import { scrollIntoView } from '@/utils/dom';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
@ -763,6 +764,16 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// onMounted(() => {
|
||||||
|
// nextTick(() => {
|
||||||
|
// console.log(document.querySelector('.preview-left'));
|
||||||
|
|
||||||
|
// scrollIntoView(document.querySelector('.preview-left'), { block: 'center' });
|
||||||
|
// console.log(caseFormRef.value?.$el.querySelector('.arco-form-item-message'));
|
||||||
|
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
caseFormRef,
|
caseFormRef,
|
||||||
formRef,
|
formRef,
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div id="magnifier"></div>
|
|
||||||
<!-- 用例评论 -->
|
<!-- 用例评论 -->
|
||||||
<div v-show="activeComment === 'caseComment'">
|
<div v-show="activeComment === 'caseComment'">
|
||||||
<MsComment
|
<MsComment
|
||||||
|
|
|
@ -78,10 +78,10 @@
|
||||||
</div>
|
</div>
|
||||||
<ms-base-table ref="tableRef" v-bind="propsRes" v-on="propsEvent">
|
<ms-base-table ref="tableRef" v-bind="propsRes" v-on="propsEvent">
|
||||||
<template #demandName="{ record }">
|
<template #demandName="{ record }">
|
||||||
<span class="ml-1 text-[rgb(var(--primary-5))]">
|
<span class="ml-1 text-[rgb(var(--primary-5))]">
|
||||||
{{ record.demandName }}
|
{{ record.demandName }}
|
||||||
<span>({{ (record.children || []).length || 0 }})</span></span
|
<span>({{ (record.children || []).length || 0 }})</span></span
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
<template v-for="item in customFields" :key="item.slotName" #[item.dataIndex]="{ record }">
|
<template v-for="item in customFields" :key="item.slotName" #[item.dataIndex]="{ record }">
|
||||||
<span> {{ getSlotName(record, item) }} </span>
|
<span> {{ getSlotName(record, item) }} </span>
|
||||||
|
@ -188,11 +188,11 @@
|
||||||
// ellipsis: true,
|
// ellipsis: true,
|
||||||
// },
|
// },
|
||||||
];
|
];
|
||||||
const fullColumns = ref<MsTableColumn>([...columns]);
|
let fullColumns: MsTableColumn = [...columns];
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(getThirdDemandList, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(getThirdDemandList, {
|
||||||
tableKey: TableKeyEnum.CASE_MANAGEMENT_TAB_DEMAND_PLATFORM,
|
tableKey: TableKeyEnum.CASE_MANAGEMENT_TAB_DEMAND_PLATFORM,
|
||||||
columns: fullColumns.value,
|
columns: fullColumns,
|
||||||
rowKey: 'demandId',
|
rowKey: 'demandId',
|
||||||
scroll: { x: '100%' },
|
scroll: { x: '100%' },
|
||||||
heightUsed: 290,
|
heightUsed: 290,
|
||||||
|
@ -221,12 +221,6 @@
|
||||||
return filteredData;
|
return filteredData;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 关联需求
|
|
||||||
const linkDemandDrawer = ref<boolean>(false);
|
|
||||||
function associatedDemand() {
|
|
||||||
linkDemandDrawer.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const platformKeyword = ref<string>('');
|
const platformKeyword = ref<string>('');
|
||||||
|
|
||||||
const initData = async () => {
|
const initData = async () => {
|
||||||
|
@ -242,7 +236,7 @@
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const customFields = ref<any[]>([]);
|
const customFields = ref<any[]>([]);
|
||||||
async function initColumn() {
|
async function initColumn() {
|
||||||
fullColumns.value = [...columns];
|
fullColumns = [...columns];
|
||||||
try {
|
try {
|
||||||
const res = await getThirdDemandList({
|
const res = await getThirdDemandList({
|
||||||
current: 1,
|
current: 1,
|
||||||
|
@ -258,12 +252,19 @@
|
||||||
options: item.options,
|
options: item.options,
|
||||||
};
|
};
|
||||||
}) as any;
|
}) as any;
|
||||||
fullColumns.value = [...columns, ...customFields.value];
|
fullColumns = [...columns, ...customFields.value];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 关联需求
|
||||||
|
const linkDemandDrawer = ref<boolean>(false);
|
||||||
|
function associatedDemand() {
|
||||||
|
linkDemandDrawer.value = true;
|
||||||
|
initData();
|
||||||
|
}
|
||||||
|
|
||||||
function getSlotName(record: any, item: MsTableColumnData) {
|
function getSlotName(record: any, item: MsTableColumnData) {
|
||||||
if (item?.options) {
|
if (item?.options) {
|
||||||
const currentRecord = {
|
const currentRecord = {
|
||||||
|
@ -332,12 +333,27 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function initPlatform() {
|
||||||
|
try {
|
||||||
|
const result = await getCaseRelatedInfo(currentProjectId.value);
|
||||||
|
if (result && result.platform_key) {
|
||||||
|
platformInfo.value = { ...result };
|
||||||
|
initColumn();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => linkDemandDrawer.value,
|
() => linkDemandDrawer.value,
|
||||||
async (val) => {
|
(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
resetSelector();
|
resetSelector();
|
||||||
initData();
|
nextTick(() => {
|
||||||
|
tableRef.value?.initColumn(fullColumns);
|
||||||
|
initData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -373,15 +389,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
initPlatform();
|
||||||
const result = await getCaseRelatedInfo(currentProjectId.value);
|
|
||||||
if (result && result.platform_key) {
|
|
||||||
platformInfo.value = { ...result };
|
|
||||||
initColumn();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// watch(
|
// watch(
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useVModel } from '@vueuse/core';
|
import { useVModel } from '@vueuse/core';
|
||||||
import { Message } from '@arco-design/web-vue';
|
|
||||||
|
|
||||||
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
|
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
|
||||||
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
|
||||||
|
@ -107,12 +106,12 @@
|
||||||
// },
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
const fullColumns = ref<MsTableColumn>([...columns]);
|
let fullColumns: MsTableColumn = [...columns];
|
||||||
const customFields = ref<Record<string, any>[]>([]);
|
const customFields = ref<Record<string, any>[]>([]);
|
||||||
|
|
||||||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(getThirdDemandList, {
|
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(getThirdDemandList, {
|
||||||
tableKey: TableKeyEnum.CASE_MANAGEMENT_TAB_DEMAND_PLATFORM,
|
tableKey: TableKeyEnum.CASE_MANAGEMENT_TAB_DEMAND_PLATFORM,
|
||||||
columns: fullColumns.value,
|
columns: fullColumns,
|
||||||
rowKey: 'demandId',
|
rowKey: 'demandId',
|
||||||
scroll: { x: '100%' },
|
scroll: { x: '100%' },
|
||||||
selectable: true,
|
selectable: true,
|
||||||
|
@ -138,7 +137,6 @@
|
||||||
return filteredData;
|
return filteredData;
|
||||||
});
|
});
|
||||||
|
|
||||||
// const platformInfo = ref<Record<string, any>>({});
|
|
||||||
function getPlatName() {
|
function getPlatName() {
|
||||||
switch (props.platformInfo.platform_key) {
|
switch (props.platformInfo.platform_key) {
|
||||||
case 'zentao':
|
case 'zentao':
|
||||||
|
@ -205,7 +203,7 @@
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
async function initColumn() {
|
async function initColumn() {
|
||||||
fullColumns.value = [...columns];
|
fullColumns = [...columns];
|
||||||
try {
|
try {
|
||||||
const res = await getThirdDemandList({
|
const res = await getThirdDemandList({
|
||||||
current: 1,
|
current: 1,
|
||||||
|
@ -224,23 +222,17 @@
|
||||||
}) as any;
|
}) as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
fullColumns.value.push(...customFields.value);
|
fullColumns = [...columns, ...customFields.value];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// onBeforeMount(async () => {
|
watchEffect(() => {
|
||||||
// try {
|
if (props.platformInfo.demand_platform_config) {
|
||||||
// const result = await getCaseRelatedInfo(currentProjectId.value);
|
initColumn();
|
||||||
// if (result && result.platform_key) {
|
}
|
||||||
// platformInfo.value = { ...result };
|
});
|
||||||
// initColumn();
|
|
||||||
// }
|
|
||||||
// } catch (error) {
|
|
||||||
// console.log(error);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => innerLinkDemandVisible.value,
|
() => innerLinkDemandVisible.value,
|
||||||
|
@ -248,7 +240,10 @@
|
||||||
if (val) {
|
if (val) {
|
||||||
resetSelector();
|
resetSelector();
|
||||||
if (props.platformInfo.demand_platform_config) {
|
if (props.platformInfo.demand_platform_config) {
|
||||||
initData();
|
nextTick(() => {
|
||||||
|
tableRef.value?.initColumn(fullColumns);
|
||||||
|
initData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,20 @@
|
||||||
}}</a-button
|
}}</a-button
|
||||||
></span
|
></span
|
||||||
>
|
>
|
||||||
<MsRichText
|
<div v-if="isEditPreposition" class="px-2">
|
||||||
v-if="isEditPreposition"
|
<MsRichText
|
||||||
v-model:raw="detailForm.prerequisite"
|
v-model:raw="detailForm.prerequisite"
|
||||||
v-model:filed-ids="prerequisiteFileIds"
|
v-model:filed-ids="prerequisiteFileIds"
|
||||||
:upload-image="handleUploadImage"
|
:upload-image="handleUploadImage"
|
||||||
class="mt-2"
|
class="mt-2"
|
||||||
/>
|
/>
|
||||||
<div v-else v-dompurify-html="detailForm?.prerequisite || '-'" class="markdown-body"></div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
v-dompurify-html="detailForm?.prerequisite || '-'"
|
||||||
|
class="markdown-body !break-words break-all"
|
||||||
|
></div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
field="step"
|
field="step"
|
||||||
|
@ -69,6 +75,7 @@
|
||||||
<div
|
<div
|
||||||
v-if="detailForm.caseEditType === 'TEXT' && !isEditPreposition"
|
v-if="detailForm.caseEditType === 'TEXT' && !isEditPreposition"
|
||||||
v-dompurify-html="detailForm.textDescription || '-'"
|
v-dompurify-html="detailForm.textDescription || '-'"
|
||||||
|
class="markdown-body !break-words break-all"
|
||||||
></div>
|
></div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item
|
<a-form-item
|
||||||
|
@ -82,7 +89,11 @@
|
||||||
v-model:filed-ids="expectedResultFileIds"
|
v-model:filed-ids="expectedResultFileIds"
|
||||||
:upload-image="handleUploadImage"
|
:upload-image="handleUploadImage"
|
||||||
/>
|
/>
|
||||||
<div v-else v-dompurify-html="detailForm.expectedResult || '-'" class="markdown-body"></div>
|
<div
|
||||||
|
v-else
|
||||||
|
v-dompurify-html="detailForm.expectedResult || '-'"
|
||||||
|
class="markdown-body !break-words break-all"
|
||||||
|
></div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item field="description" :label="t('caseManagement.featureCase.remark')">
|
<a-form-item field="description" :label="t('caseManagement.featureCase.remark')">
|
||||||
<MsRichText
|
<MsRichText
|
||||||
|
@ -91,7 +102,7 @@
|
||||||
v-model:raw="detailForm.description"
|
v-model:raw="detailForm.description"
|
||||||
:upload-image="handleUploadImage"
|
:upload-image="handleUploadImage"
|
||||||
/>
|
/>
|
||||||
<div v-else v-dompurify-html="detailForm.description || '-'" class="markdown-body"></div>
|
<div v-else v-dompurify-html="detailForm.description || '-'" class="markdown-body !break-words break-all"></div>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<div v-if="isEditPreposition" class="flex justify-end">
|
<div v-if="isEditPreposition" class="flex justify-end">
|
||||||
<a-button type="secondary" @click="handleCancel">{{ t('common.cancel') }}</a-button>
|
<a-button type="secondary" @click="handleCancel">{{ t('common.cancel') }}</a-button>
|
||||||
|
|
|
@ -124,10 +124,11 @@
|
||||||
>
|
>
|
||||||
<!-- 表单 -->
|
<!-- 表单 -->
|
||||||
<MsFormCreate
|
<MsFormCreate
|
||||||
v-model:api="formItem.api"
|
v-model:api="formItem.fApi"
|
||||||
v-model:rule="formItem.formRules"
|
v-model:rule="formItem.formRules"
|
||||||
:option="configOptions"
|
:option="configOptions"
|
||||||
@click="activeHandler(index)"
|
@click="activeHandler(index)"
|
||||||
|
@change="(value, formApi) => changeHandler(value, formApi)"
|
||||||
/>
|
/>
|
||||||
<a-form
|
<a-form
|
||||||
v-if="templateForm.enableThirdPart && route.query.type === 'BUG'"
|
v-if="templateForm.enableThirdPart && route.query.type === 'BUG'"
|
||||||
|
@ -354,6 +355,10 @@
|
||||||
isError.value = false;
|
isError.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeHandler(value: string, api: any) {
|
||||||
|
api.validateField(value);
|
||||||
|
}
|
||||||
|
|
||||||
// 保存回调
|
// 保存回调
|
||||||
async function save() {
|
async function save() {
|
||||||
try {
|
try {
|
||||||
|
@ -565,6 +570,7 @@
|
||||||
{
|
{
|
||||||
...currentFormRules,
|
...currentFormRules,
|
||||||
title: item.fieldName,
|
title: item.fieldName,
|
||||||
|
field: item.fieldId,
|
||||||
effect: {
|
effect: {
|
||||||
required: item.required,
|
required: item.required,
|
||||||
},
|
},
|
||||||
|
|
|
@ -282,6 +282,7 @@ export const getTotalFieldOptionList = (totalData: DefinedFieldItem[]) => {
|
||||||
{
|
{
|
||||||
...currentFormRules,
|
...currentFormRules,
|
||||||
title: item.name,
|
title: item.name,
|
||||||
|
field: item.id,
|
||||||
effect: {
|
effect: {
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue