This commit is contained in:
2025-12-28 19:55:42 +08:00
parent a8cb979339
commit a8ab4382a2
40 changed files with 792 additions and 286 deletions

View File

@@ -7,13 +7,13 @@
<el-button type="primary" icon="Check" :loading="submitLoading" @click="handleInitiateApproval">
{{ t('projectExitPlan.actions.initiateApproval') }}
</el-button>
<el-button icon="Document" @click="handleSaveDraft">
<el-button icon="Document" @click="handleSaveDraft" :loading="saveLoading">
{{ t('projectExitPlan.actions.saveDraft') }}
</el-button>
<el-button icon="FolderOpened" @click="handleLoadTemplate">
{{ t('projectExitPlan.actions.loadTemplate') }}
</el-button>
<el-button icon="FolderAdd" @click="handleSaveTemplate">
<el-button icon="FolderAdd" @click="handleSaveTemplate" :loading="saveTemplateLoading">
{{ t('projectExitPlan.actions.saveTemplate') }}
</el-button>
</div>
@@ -45,26 +45,35 @@
<ProjectExitPlanForm v-model="formData" :rules="rules" ref="formDataRef" />
</div>
<templateTable/>
</div>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import {computed, reactive, ref, watch} from 'vue';
import { useI18n } from 'vue-i18n';
import { useMessage } from '/@/hooks/message';
import type { ProjectTask } from '/@/views/invMid/projectExitPlan/interface/type';
import ProjectExitPlanForm from '/@/components/investment/common/ProjectExitPlanForm.vue';
import { FormRules } from 'element-plus';
import { addProjectExitPlan } from '/@/api/investment/projectExitPlan';
import {addProjectExitPlan, getProjectExitPlanByTemplateId} from '/@/api/investment/projectExitPlan';
import UploadFile from "/@/components/Upload/index.vue";
import { flowFn } from "/@/utils/flowFn";
import { addFlowForm } from "/@/api/flow/flow";
import { flowNameOptions } from "/@/hooks/enums";
import {addTemplate} from "/@/api/common";
import {getPropertyRightsByIdAPI} from "/@/api/workbench/miOwLibr/ownershipCreate";
const formDataRef = ref<HTMLFormElement | null>()
import templateTable from "/@/components/templetTableComom/index.vue"
import {templateStore} from "/@/stores/template"
import {useRouter} from "vue-router";
const { t } = useI18n();
const message = useMessage();
const temp = templateStore()
const router = useRouter()
const headerFormRef = ref<any>();
const headerFormRules = {
title: [{ required: true, message: '标题必填', trigger: ['blur', 'change'] }]
@@ -131,6 +140,7 @@ const handleInitiateApproval = async () => {
formData.value.processInstanceId = processInstanceId;
addProjectExitPlan(formData.value).then((res: any) => {
useMessage().success(t('common.success'));
router.push('/flow/task/started')
}).catch((err: any) => {
useMessage().error(err.msg);
}).finally(() => {
@@ -142,17 +152,90 @@ const handleInitiateApproval = async () => {
}
};
const saveLoading = ref<boolean>(false);
const handleSaveDraft = async () => {
try {
const headerValid = await headerFormRef.value?.validate().catch(() => false);
if (!headerValid) {
return;
}
const valid = await formDataRef?.value?.validateRef();
if (!valid) return;
saveLoading.value = true;
const attachments = JSON.stringify(headerForm.attachments);
const flowNameObj = flowNameOptions.filter(item => item.label === 'exitPlan')[0]
await addFlowForm({
title: headerForm.title,
description: headerForm.description,
attachments,
processInstanceId:'',
flowType: flowNameObj.value
})
formData.value.processInstanceId = '';
Object.assign(formData.value,{status:0,temporaryStorage:{
businessType:flowNameObj.value,
title: headerForm.title,
}})
addProjectExitPlan(formData.value).then(() => {
useMessage().success(t('common.success'));
}).catch((err: any) => {
useMessage().error(err.msg);
}).finally(() => {
saveLoading.value = false;
});
} catch (e) {
console.log(e);
saveLoading.value = false;
}
const handleSaveDraft = () => {
message.info(t('projectExitPlan.messages.saveDraft'));
};
const tempId = computed(()=>temp.temp_id)
watch(()=>tempId.value,()=>{
getProjectExitPlanByTemplateId(tempId.value).then(data => {
Object.assign(formData, data.data);
})
})
const handleLoadTemplate = () => {
message.info(t('projectExitPlan.messages.loadTemplate'));
const flowNameObj = flowNameOptions.filter(item => item.label === 'exitPlan')[0]
temp.changeTempShow(true,flowNameObj.value)
};
const saveTemplateLoading = ref<boolean>(false);
const handleSaveTemplate = async () => {
try {
const headerValid = await headerFormRef.value?.validate().catch(() => false);
if (!headerValid) {
return;
}
const valid = await formDataRef?.value?.validateRef();
if (!valid) return;
saveTemplateLoading.value = true;
const attachments = JSON.stringify(headerForm.attachments);
const flowNameObj = flowNameOptions.filter(item => item.label === 'exitPlan')[0]
await addFlowForm({
title: headerForm.title,
description: headerForm.description,
attachments,
processInstanceId:'',
flowType: flowNameObj.value
})
const {data: templateId} = await addTemplate({
templateName:headerForm.title,
templateType:flowNameObj.value,
})
formData.value.processInstanceId = '';
Object.assign(formData.value,{status:0,templateId})
addProjectExitPlan(formData.value).then(() => {
useMessage().success(t('common.success'));
}).catch((err: any) => {
useMessage().error(err.msg);
}).finally(() => {
saveTemplateLoading.value = false;
});
} catch (e) {
console.log(e);
saveTemplateLoading.value = false;
}
const handleSaveTemplate = () => {
message.info(t('projectExitPlan.messages.saveTemplate'));
};
const handleViewWorkflow = () => {