fix(xispeak): 修复BPM表单输入被刷掉和新增表单带入旧数据
- BPM表单:processInstanceId变化时仅刷新反馈列表,不再全量重载主表数据 - 编辑表单:新增时同步重置为默认值,弹窗强制重建组件避免数据残留 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -497,7 +497,16 @@
|
||||
initFormData();
|
||||
});
|
||||
|
||||
watch([() => props.formData?.dataId, () => processInfo.value.processInstanceId], () => initFormData());
|
||||
watch(
|
||||
() => props.formData?.dataId,
|
||||
() => initFormData()
|
||||
);
|
||||
watch(
|
||||
() => processInfo.value.processInstanceId,
|
||||
(newVal) => {
|
||||
if (newVal) loadFeedbackList();
|
||||
}
|
||||
);
|
||||
|
||||
watch(showDeptFeedback, () => {
|
||||
loadFeedbackList();
|
||||
|
||||
@@ -161,35 +161,39 @@
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
let model: Nullable<Recordable> = null;
|
||||
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
pid: '',
|
||||
speakStatus: '',
|
||||
time: '',
|
||||
elmComment: '经单位主要负责同时签批同意,由xx部做好贯彻落实',
|
||||
status: 'x月x日召开xxxx年第x次党委会议',
|
||||
secretLevel: '',
|
||||
responsiblePerson: '',
|
||||
needSdwApproval: 0,
|
||||
sdwLeaderList: '',
|
||||
implPlan: '',
|
||||
implMeasures: '',
|
||||
numberOfResolutions: undefined,
|
||||
implStatus: '',
|
||||
implCount: undefined,
|
||||
closedCount: undefined,
|
||||
reportFeedbackStatus: '',
|
||||
isCompletionRisk: undefined,
|
||||
delayRiskMitigation: '',
|
||||
completionStatus: undefined,
|
||||
deadline: '',
|
||||
implDept: '',
|
||||
treeDepth: undefined,
|
||||
sortOrder: undefined,
|
||||
delFlag: undefined,
|
||||
bpmStatus: undefined,
|
||||
supervisionCount: undefined,
|
||||
});
|
||||
function getDefaultFormData(): Record<string, any> {
|
||||
return {
|
||||
id: '',
|
||||
pid: '',
|
||||
speakStatus: '',
|
||||
time: '',
|
||||
elmComment: '经单位主要负责同时签批同意,由xx部做好贯彻落实',
|
||||
status: 'x月x日召开xxxx年第x次党委会议',
|
||||
secretLevel: '',
|
||||
responsiblePerson: '',
|
||||
needSdwApproval: 0,
|
||||
sdwLeaderList: '',
|
||||
implPlan: '',
|
||||
implMeasures: '',
|
||||
numberOfResolutions: undefined,
|
||||
implStatus: '',
|
||||
implCount: undefined,
|
||||
closedCount: undefined,
|
||||
reportFeedbackStatus: '',
|
||||
isCompletionRisk: undefined,
|
||||
delayRiskMitigation: '',
|
||||
completionStatus: undefined,
|
||||
deadline: '',
|
||||
implDept: '',
|
||||
treeDepth: undefined,
|
||||
sortOrder: undefined,
|
||||
delFlag: undefined,
|
||||
bpmStatus: undefined,
|
||||
supervisionCount: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
const formData = reactive<Record<string, any>>(getDefaultFormData());
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
|
||||
@@ -289,13 +293,24 @@
|
||||
}
|
||||
|
||||
function edit(record) {
|
||||
// 新增:同步重置,不带入任何旧数据
|
||||
if (!record.id) {
|
||||
const defaults = getDefaultFormData();
|
||||
for (const key of Object.keys(formData)) {
|
||||
formData[key] = defaults[key];
|
||||
}
|
||||
sdwLeaderNames.value = '';
|
||||
model = {};
|
||||
return;
|
||||
}
|
||||
|
||||
// 编辑/详情
|
||||
nextTick(async () => {
|
||||
resetFields();
|
||||
expandedRowKeys.value = [];
|
||||
|
||||
// 非BPM模式且有ID时,从API查询完整数据,避免列表行数据不完整导致字段不显示
|
||||
let data = record;
|
||||
if (record.id && !props.formBpm) {
|
||||
if (!props.formBpm) {
|
||||
try {
|
||||
const res = await defHttp.get({ url: queryByIdUrl, params: { id: record.id } });
|
||||
data = res || record;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||
<BgXiSpeakForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></BgXiSpeakForm>
|
||||
<BgXiSpeakForm ref="registerForm" :key="formKey" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></BgXiSpeakForm>
|
||||
<template #footer>
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认</a-button>
|
||||
@@ -20,24 +20,27 @@
|
||||
const visible = ref<boolean>(false);
|
||||
const disableSubmit = ref<boolean>(false);
|
||||
const registerForm = ref();
|
||||
const formKey = ref(0);
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add(obj={}) {
|
||||
formKey.value++;
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add(obj);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param record
|
||||
*/
|
||||
function edit(record) {
|
||||
formKey.value++;
|
||||
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
|
||||
Reference in New Issue
Block a user