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,10 +7,10 @@
<el-button type="primary" icon="Check" :loading="submitLoading" @click="handleInitiateApproval">
{{ t('progressReport.actions.initiateApproval') }}
</el-button>
<el-button icon="Document" @click="handleSaveDraft">
<el-button icon="Document" @click="handleSaveDraft" :loading="saveLoading">
{{ t('progressReport.actions.saveDraft') }}
</el-button>
<el-button icon="FolderOpened" @click="handleLoadTemplate">
<el-button icon="FolderOpened" @click="handleLoadTemplate" :loading="templateLoading">
{{ t('progressReport.actions.loadTemplate') }}
</el-button>
<el-button icon="FolderAdd" @click="handleSaveTemplate">
@@ -45,26 +45,34 @@
</el-row>
<ProjectProgressReportForm v-model="formData" :rules="formDataRef" ref="formRef" />
<templateTable/>
</div>
</div>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import templateTable from "/@/components/templetTableComom/index.vue"
import {computed, reactive, ref, watch} from 'vue';
import { useI18n } from 'vue-i18n';
import { useMessage } from '/@/hooks/message';
import ProjectProgressReportForm from '/@/components/investment/common/ProjectProgressReportForm.vue';
import { InvestmentProjectProgress } from '/@/views/invMid/progressReport/interface/type';
import { FormRules } from 'element-plus';
import {
addInvestmentProjectsProgressAPI,
addInvestmentProjectsProgressAPI, getInvestmentProjectsProgressByTemplateIdAPI,
getInvestmentProjectsProgressUserDeptBelongAPI
} from '/@/api/investment/progressOfInvestmentProjects';
import UploadFile from "/@/components/Upload/index.vue";
import { flowFn } from "/@/utils/flowFn";
import { addFlowForm } from "/@/api/flow/flow";
import { flowNameOptions } from "/@/hooks/enums";
import {templateStore} from "/@/stores/template"
import {useRouter} from "vue-router";
import {addTemplate} from "/@/api/common";
import {getPropertyRightsByIdAPI} from "/@/api/workbench/miOwLibr/ownershipCreate";
const router = useRouter();
const temp = templateStore();
const { t } = useI18n();
const message = useMessage();
@@ -171,6 +179,7 @@ const handleInitiateApproval = async () => {
valid.processInstanceId = processInstanceId;
valid.supportingDocuments = JSON.stringify(valid.supportingDocuments);
valid.status = 1;
valid.flowType = flowNameObj.value
await addInvestmentProjectsProgressAPI(valid).then(() => {
message.success(t('common.success'));
}).finally(() => {
@@ -183,17 +192,94 @@ const handleInitiateApproval = async () => {
submitLoading.value = false;
}
};
const handleSaveDraft = () => {
message.info(t('progressReport.messages.saveDraft'));
const saveLoading = ref(false)
const handleSaveDraft = async () => {
try {
const headerValid = await headerFormRef.value?.validate().catch(() => false);
if (!headerValid) {
return;
}
const valid = await formRef.value?.validate();
submitLoading.value = true;
headerForm.attachments = JSON.stringify(headerForm.attachments);
const processInstanceId = '';
const flowNameObj = flowNameOptions.filter(item => item.label === 'projectProgressDeclaration')[0]
await addFlowForm({
title: headerForm.title,
description: headerForm.description,
attachments: headerForm.attachments,
processInstanceId,
flowType: flowNameObj.value
})
valid.processInstanceId = processInstanceId;
valid.supportingDocuments = JSON.stringify(valid.supportingDocuments);
valid.status = 0;
valid.flowType = flowNameObj.value
valid.temporaryStorage={
businessType:flowNameObj.value,
title: headerForm.title,
}
await addInvestmentProjectsProgressAPI(valid).then(() => {
message.success(t('common.success'));
}).finally(() => {
saveLoading.value = false;
}).catch((err: any) => {
saveLoading.value = false;
message.error(err.msg);
});
} catch (error) {
saveLoading.value = false;
}
};
const handleLoadTemplate = () => {
message.info(t('progressReport.messages.loadTemplate'));
const templateLoading = ref(false)
const tempId = computed(()=>temp.temp_id)
const handleLoadTemplate = async () => {
const flowNameObj = flowNameOptions.filter(item => item.label === 'projectProgressDeclaration')[0]
temp.changeTempShow(true,flowNameObj.value)
};
const handleSaveTemplate = () => {
message.info(t('progressReport.messages.saveTemplate'));
watch(()=>tempId.value,()=>{
getInvestmentProjectsProgressByTemplateIdAPI(tempId.value).then(data => {
Object.assign(formData, data.data);
})
})
const handleSaveTemplate = () => async () => {
try {
const headerValid = await headerFormRef.value?.validate().catch(() => false);
if (!headerValid) {
return;
}
const valid = await formRef.value?.validate();
templateLoading.value = true;
headerForm.attachments = JSON.stringify(headerForm.attachments);
const processInstanceId = '';
const flowNameObj = flowNameOptions.filter(item => item.label === 'projectProgressDeclaration')[0]
await addFlowForm({
title: headerForm.title,
description: headerForm.description,
attachments: headerForm.attachments,
processInstanceId,
flowType: flowNameObj.value
})
const {data: templateId} = await addTemplate({
templateName:headerForm.title,
templateType:flowNameObj.value,
})
valid.processInstanceId = processInstanceId;
valid.supportingDocuments = JSON.stringify(valid.supportingDocuments);
valid.status = 0;
valid.flowType = flowNameObj.value
valid.templateId = templateId
await addInvestmentProjectsProgressAPI(valid).then(() => {
message.success(t('common.success'));
}).finally(() => {
templateLoading.value = false;
}).catch((err: any) => {
templateLoading.value = false;
message.error(err.msg);
});
} catch (error) {
templateLoading.value = false;
}
};
const handleViewWorkflow = () => {