发起变更提交参数修改
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<!-- PSSR检查内容 -->
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } from 'vue';
|
||||
import { Icon } from '@iconify/vue'
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import Footer from './footer.vue';
|
||||
@@ -8,9 +8,41 @@ import { AiError, aiPssr } from "@/service/api/ai";
|
||||
import { uploadFileApi } from "@/service/api/file";
|
||||
|
||||
const themeStore = useThemeStore();
|
||||
const props = defineProps(['type','isAiOpen','title','currentId','formInfo','changeType'])
|
||||
const props = defineProps(['type','isAiOpen','title','currentId','formInfo','changeType','currentForm','confirmed'])
|
||||
const emit = defineEmits(['save','submit','confirmTab']);
|
||||
|
||||
watch(() => props.currentForm, (newVal:any) => {
|
||||
// 1. 按 group_type 分组
|
||||
const map = new Map();
|
||||
newVal?.items?.forEach((item:any) => {
|
||||
const t = item.group_type;
|
||||
if (!map.has(t)) map.set(t, []);
|
||||
map.get(t).push(item);
|
||||
});
|
||||
|
||||
// 2. 生成目标数组
|
||||
const result = list.value.map(({ type, g }:any) => {
|
||||
const items = map.get(type) || [];
|
||||
// na_flag 取该组第一个元素的 na_flag,无数据时默认为 0
|
||||
const na_flag = items.length > 0 ? items[0].na_flag : 0;
|
||||
return {
|
||||
g,
|
||||
type,
|
||||
na_flag,
|
||||
items
|
||||
};
|
||||
});
|
||||
// 3. 过滤掉不需要的字段
|
||||
const omitFields = ['created_at', 'updated_at', 'change_id', 'group_type', 'group_name'];
|
||||
const newResult = result.map((group:any) => ({
|
||||
...group,
|
||||
items: group.items.map((item:any) =>
|
||||
Object.fromEntries(Object.entries(item).filter(([k]) => !omitFields.includes(k)))
|
||||
)
|
||||
}));
|
||||
list.value = newResult;
|
||||
})
|
||||
|
||||
const footerRef = ref<any>(null);
|
||||
const uploadLoading = ref<boolean>(false);
|
||||
const uploadFileRef = ref<any>(null);
|
||||
@@ -211,6 +243,7 @@ defineExpose({list, onRegenerate})
|
||||
:currentId="props.currentId"
|
||||
:title="props.title"
|
||||
:isAiOpen="props.isAiOpen"
|
||||
:confirmed="props.confirmed"
|
||||
@save="saveDraft"
|
||||
@submit="submitConfirm"
|
||||
@confirmTab="confirmTab"
|
||||
|
||||
Reference in New Issue
Block a user