Commit 54b22571 by Neo Turing

完善比对测试功能:更新TestDataItem接口、实现点击编辑模式、优化删除按钮样式

parent 8cbb38c2
...@@ -78,6 +78,7 @@ declare module 'vue' { ...@@ -78,6 +78,7 @@ declare module 'vue' {
NTag: typeof import('naive-ui')['NTag'] NTag: typeof import('naive-ui')['NTag']
NText: typeof import('naive-ui')['NText'] NText: typeof import('naive-ui')['NText']
NTooltip: typeof import('naive-ui')['NTooltip'] NTooltip: typeof import('naive-ui')['NTooltip']
NTree: typeof import('naive-ui')['NTree']
NUpload: typeof import('naive-ui')['NUpload'] NUpload: typeof import('naive-ui')['NUpload']
NWatermark: typeof import('naive-ui')['NWatermark'] NWatermark: typeof import('naive-ui')['NWatermark']
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default'] PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
......
...@@ -119,7 +119,6 @@ ...@@ -119,7 +119,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { h, ref, computed, resolveComponent, watch, withDefaults, onBeforeUnmount } from 'vue'; import { h, ref, computed, resolveComponent, watch, withDefaults, onBeforeUnmount } from 'vue';
// import type { DataTableColumns } from 'naive-ui';
interface FileItem { interface FileItem {
Kvid: string; Kvid: string;
......
...@@ -203,11 +203,19 @@ const isCurrentRowReadonly = computed(() => { ...@@ -203,11 +203,19 @@ const isCurrentRowReadonly = computed(() => {
* @usage 在组件初始化和激活时调用,用于填充文件类型下拉选择器 * @usage 在组件初始化和激活时调用,用于填充文件类型下拉选择器
*/ */
async function fetchTitleOptions() { async function fetchTitleOptions() {
// 如果已有数据则不重复加载
if (titleOptions.value.length > 0) {
return;
}
try { try {
loading.value = true; loading.value = true;
const response = await axios.post('/Restful/Kivii.Standards.Entities.Standard/Query.json?Type=文件审核'); const response = await axios.get('/Restful/Kivii.Standards.Entities.Standard/Query.json', {
params: {
Type:'文件审核'
}
});
if (response.data && response.data.Results) { if (response.data && response.data.Results) {
titleOptions.value = response.data.Results.map((item: any, index: number) => ({ titleOptions.value = response.data.Results.map((item: any, index: number) => ({
label: item.Title, label: item.Title,
...@@ -354,8 +362,6 @@ watch( ...@@ -354,8 +362,6 @@ watch(
onMounted(() => { onMounted(() => {
if (props.active) { if (props.active) {
fetchTitleOptions();
if (props.item && props.item.Kvid && props.item.Kvid !== detailedData.Kvid) { if (props.item && props.item.Kvid && props.item.Kvid !== detailedData.Kvid) {
fetchDataByReportKvid(props.item.Kvid); fetchDataByReportKvid(props.item.Kvid);
} }
...@@ -365,9 +371,7 @@ onMounted(() => { ...@@ -365,9 +371,7 @@ onMounted(() => {
watch( watch(
() => props.active, () => props.active,
(newActive) => { (newActive) => {
if (newActive && titleOptions.value.length === 0) { if (newActive) {
fetchTitleOptions();
if (props.item && props.item.Kvid && props.item.Kvid !== detailedData.Kvid) { if (props.item && props.item.Kvid && props.item.Kvid !== detailedData.Kvid) {
fetchDataByReportKvid(props.item.Kvid); fetchDataByReportKvid(props.item.Kvid);
} }
...@@ -719,6 +723,7 @@ async function handleFileListClosed(files: any[]) { ...@@ -719,6 +723,7 @@ async function handleFileListClosed(files: any[]) {
label-field="label" label-field="label"
value-field="value" value-field="value"
@update:value="handleTitleChange" @update:value="handleTitleChange"
@focus="fetchTitleOptions"
class="selector-input" class="selector-input"
></NSelect> ></NSelect>
......
...@@ -347,8 +347,7 @@ function saveApplication(submit = true) { ...@@ -347,8 +347,7 @@ function saveApplication(submit = true) {
<!-- 步骤3: 比对测试选择 --> <!-- 步骤3: 比对测试选择 -->
<ComparisonTest <ComparisonTest
v-if="visitedSteps.has(2) && currentStep === 2" v-if="visitedSteps.has(2) && currentStep === 2"
:test-items="testItems" :item="formModel"
:save-as-draft="false"
:active="currentStep === 2" :active="currentStep === 2"
@update:test-items="newItems => (testItems = newItems)" @update:test-items="newItems => (testItems = newItems)"
></ComparisonTest> ></ComparisonTest>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment