完成3月试用问题修改

This commit is contained in:
2026-04-24 16:45:37 +08:00
parent c2521db336
commit 29c921cc46
12 changed files with 525 additions and 396 deletions

View File

@@ -2,7 +2,7 @@
<div class="static-dynamic-table-container">
<a-modal
v-model:visible="visible"
width="50%"
width="60%"
draggable
:on-before-ok="handleSyncOk"
unmount-on-close
@@ -12,7 +12,7 @@
@close="handleOnClose"
>
<template #title>{{ theTitle }}</template>
<WordLikeTable v-model="tableData" v-model:fontnote="fontnote" />
<WordLikeTable v-model="tableData" v-model:fontnote="fontnote" v-model:rowRounds="tableDataRound" />
</a-modal>
</div>
</template>
@@ -41,9 +41,14 @@ const tableInitValue = [
["", "", ""],
["", "", ""]
]
const tableData = ref(tableInitValue)
const fontnote = ref("")
// 新增一个行属性附带到tableData中
const tableDataRoundInitValue = tableInitValue.map((_) => ["0"])
const tableDataRound = ref(tableDataRoundInitValue)
const handleSyncOk = async () => {
// 验证题注是否为空
if (tableData.value?.length <= 0) {
@@ -56,7 +61,8 @@ const handleSyncOk = async () => {
id: route.query.id,
category: theTitle.value,
table: tableData.value,
fontnote: fontnote.value
fontnote: fontnote.value,
rounds: tableDataRound.value
})
Message.success("保存成功")
} catch (e) {
@@ -81,6 +87,11 @@ const open = async (title: string) => {
const data = res.data
tableData.value = data.table
fontnote.value = data.fontnote || ""
if (data.rounds && data.rounds.length === tableData.value.length) {
tableDataRound.value = data.rounds
} else {
tableDataRound.value = (data.table || tableInitValue).map(() => ["0"])
}
}
visible.value = true
} catch (e) {

View File

@@ -5,7 +5,9 @@
<span>题注</span>
<a-input v-model="fontnote" :style="{ width: '500px' }"></a-input>
</a-space>
<a-alert type="warning" class="mt-2">表格第一行为[表头]自定义表格外例如软/硬件环境测评数据环境差异性分析会自动添加[序号]</a-alert>
<a-alert type="warning" class="mt-2"
>表格第一行为[表头]和轮次无关均会渲染自定义表格外例如软/硬件环境测评数据环境差异性分析会自动添加[序号]</a-alert
>
</div>
<div class="arco-table arco-table-size-large arco-table-border arco-table-stripe arco-table-hover">
<div class="arco-table-container">
@@ -37,8 +39,8 @@
</a-tooltip>
</span>
</th>
<th class="arco-table-th" :style="{ textAlign: 'center' }">
<span>操作</span>
<th class="arco-table-th w-25" :style="{ textAlign: 'center' }">
<span>适应轮次/操作</span>
</th>
</tr>
</thead>
@@ -51,6 +53,11 @@
</td>
<td class="arco-table-td">
<span class="arco-table-cell items-center justify-center">
<template v-if="datasRounds && rowIndex !== 0">
<a-select size="mini" multiple :style="{ width: '140px' }" placeholder="渲染轮次" v-model="datasRounds![rowIndex]">
<a-option v-for="item in roundOptions" :key="item.value" :value="item.value">{{ item.label }}</a-option>
</a-select>
</template>
<a-tooltip content="此行后新增行">
<a-button type="text" size="mini" @click="addRow(rowIndex)" class="delete-col-btn">
<template #icon>
@@ -75,14 +82,26 @@
</template>
<script setup lang="ts">
// 从仓库读取有多少轮次
import { computed } from "vue"
import { useTreeDataStore } from "@/store"
// 导入中文轮次数组
import tool from "@/utils/tool"
const treeDataStore = useTreeDataStore()
const treeLength = computed(() => treeDataStore.treeData.length)
const roundOptions = computed(() => Array.from({ length: treeLength.value }, (_, i) => ({ value: String(i), label: tool.chnRoundNameArray[i] })))
// 该组件储存数据
const fontnote = defineModel<string>("fontnote")
const datas = defineModel<string[][]>()
// 这里设置undefined一定要判断了
const datasRounds = defineModel<string[][]>("rowRounds", { default: undefined })
// 行列操作
const deleteRow = (rowIndex: number) => {
datas.value!.splice(rowIndex, 1)
if (datasRounds.value) {
datasRounds.value.splice(rowIndex, 1)
}
}
const deleteColumn = (colIndex: number) => {
datas.value!.forEach((row) => {
@@ -92,6 +111,9 @@ const deleteColumn = (colIndex: number) => {
const addRow = (rowIndex: number) => {
const newRow = new Array(datas.value![0].length).fill("")
datas.value!.splice(rowIndex + 1, 0, newRow)
if (datasRounds.value) {
datasRounds.value.splice(rowIndex + 1, 0, ["0"])
}
}
const addColumn = (colIndex: number) => {
// 处理空表格的特殊情况