From 4e4339857a02878fef71b62cf17f39e1b6aa14ab Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 29 十一月 2024 17:43:27 +0800
Subject: [PATCH] 加loading
---
src/views/projectEngineering/projectLibrary/projectDetails.vue | 138 ++++++++--------------------------------------
1 files changed, 24 insertions(+), 114 deletions(-)
diff --git a/src/views/projectEngineering/projectLibrary/projectDetails.vue b/src/views/projectEngineering/projectLibrary/projectDetails.vue
index 39a6a44..6494775 100644
--- a/src/views/projectEngineering/projectLibrary/projectDetails.vue
+++ b/src/views/projectEngineering/projectLibrary/projectDetails.vue
@@ -1,7 +1,7 @@
<template>
- <el-card class="card-container">
+ <el-card class="card-container" >
<div class="flex-container mb-4">
- <el-tabs v-model="currentTab" @tab-click="handleClick">
+ <el-tabs v-model="currentTab" @tab-click="handleClick" v-show="isShow">
<el-tab-pane
v-for="item in TABS_DATA"
:key="item.value"
@@ -18,6 +18,9 @@
:is="componentName"
ref="childRef"
:disabled="disabled"
+ @toNext="changeTable"
+ @updateIsShow="updateIsShow"
+ :isShow="isShow"
class="full-width custom-height"
/>
<div v-if="!disabled" class="button-container">
@@ -35,14 +38,15 @@
import LegalPerson from '@/views/projectEngineering/projectLibrary/component/legalPerson';
import PolicyInfo from '@/views/projectEngineering/projectLibrary/component/PolicyInfo';
import DocumentsInfo from '@/views/projectEngineering/projectLibrary/component/DocumentsInfo';
-import { addProject, getProject, updateProject, getProjectCode } from '@/api/projectInfo';
export default {
+ name: 'ProjectDetails',
data() {
return {
+ isShow: false,
currentTab: '椤圭洰绠$悊鍩虹淇℃伅',
- id: this.$route.query.id || '',
disabled: false,
+ projectForm:{},
componentName: BasicInfo,
TABS_DATA: [
{
@@ -52,11 +56,11 @@
},
{
label: '鎶曡祫绠$悊鍩虹淇℃伅',
- value: '浠诲姟涓嬪彂',
+ value: '鎶曡祫绠$悊鍩虹淇℃伅',
componentName: InvestInfo
},
{
- label: ' 椤圭洰鎶曡祫鍙婅祫閲戞潵婧�',
+ label: '椤圭洰鎶曡祫鍙婅祫閲戞潵婧�',
value: '椤圭洰鎶曡祫鍙婅祫閲戞潵婧�',
componentName: InvestmentFunds
},
@@ -80,122 +84,28 @@
};
},
methods: {
+ updateIsShow(newValue) {
+ this.isShow = newValue;
+ },
handleClick(tabTarget) {
- this.componentName = this.TABS_DATA[tabTarget.index].componentName;
+ this.componentName = this.TABS_DATA[tabTarget.index].componentName;
+ },
+ changeTable(index) {
+ this.componentName = this.TABS_DATA[index].componentName;
+ this.currentTab = this.TABS_DATA[index].value;
},
submit() {
- if (!this.projectForm.projectName) {
- this.$message.error('璇疯緭鍏ラ」鐩悕绉�');
- return;
- }
- if (this.projectForm.contact) {
- const phoneRegex = /^1[3-9]\d{9}$/;
- if (!phoneRegex.test(this.projectForm.contact)) {
- this.$message.error('璇疯緭鍏ユ纭殑鎵嬫満鍙风爜');
- return;
- }
- }
- if (this.$refs.childRef) {
- this.$refs.childRef.$refs.demoFormRef.validate((valid) => {
- if (valid) {
- const payload = {
- projectInfoInsertDTO: this.projectForm,
- projectInvestmentInfo: this.investment,
- projectInvestmentFunding: this.investmentFunds,
- projectUnitRegistrationInfo: this.legalPerson,
- investmentProjectPolicyComplianceDTO: this.investmentProjectPolicyComplianceDTO,
- fileIdList: this.fileIdList
- };
- if (this.id) {
- updateProject(payload).then(res => {
- if (res.code === 200) {
- this.$message.success(res.msg);
- this.$router.push({ path: '/projectEngineering/project/projectLibrary' });
- } else {
- this.$message.error(res.msg);
- }
- });
- } else {
- addProject(payload).then(res => {
- if (res.code === 200) {
- this.$message.success(res.msg);
- this.$router.push({ path: '/projectEngineering/project/projectLibrary' });
- } else {
- this.$message.error(res.msg);
- }
- });
- }
- }
- });
- }
- },
- getProjectInfo(id) {
- getProject(id, 0).then(res => {
- if (res.data) {
- this.investment = res.data.projectInvestmentInfo || {};
- this.investmentFunds = res.data.projectInvestmentFunding || {};
- this.legalPerson = res.data.projectUnitRegistrationInfo || {};
- this.investmentProjectPolicyComplianceDTO = res.data.investmentProjectPolicyComplianceDTO || {};
- if (res.data.investmentProjectPolicyComplianceDTO && res.data.investmentProjectPolicyComplianceDTO.sysOssVos.length > 0) {
- this.fileList = res.data.investmentProjectPolicyComplianceDTO.sysOssVos.map(item => ({
- fileId: item.ossId,
- name: item.originalName,
- url: item.url
- }));
- } else {
- this.fileList = [];
- }
-
- if (res.data.fileIdList) {
- this.fileIdList = res.data.fileIdList;
- this.documentsInfoList = res.data.sysOssVos.map(item => ({
- fileId: item.ossId,
- name: item.originalName,
- url: item.url
- }));
- }
- this.projectForm = res.data.projectInfoInsertDTO || {};
- this.projectList = res.data.projectInfoInsertDTO.sysOssVos.map(item => ({
- fileId: item.ossId,
- name: item.originalName,
- url: item.url
- }));
- }
- });
+ this.$refs.childRef.submit();
},
reset() {
- if (this.id) {
- this.getProjectInfo(this.id);
- } else {
- this.getProjectCodeApi();
- this.resetPlanLibrary();
- this.fileList = [];
- this.fileIdList = [];
- this.projectList = [];
- this.documentsInfoList = [];
- }
- },
- cancel() {
- this.$router.push({ path: '/projectEngineering/project/reserveProjects', query: { projectCategory: '1' } });
- localStorage.removeItem('fileIdList');
- },
- getProjectCodeApi() {
- getProjectCode().then(res => {
- if (res.code === 200) {
- this.projectForm.projectCode = res.msg;
- }
- });
+ this.$refs.childRef.reset();
},
},
- created() {
- // 鍦ㄧ粍浠跺垱寤烘椂鑾峰彇椤圭洰淇℃伅锛屽鏋� id 瀛樺湪
- if (this.id) {
- this.getProjectInfo(this.id);
- } else {
- this.getProjectCodeApi();
+ mounted() {
+ if(this.$route.query.disabled){
+ this.disabled = true
}
- },
-
+ }
};
</script>
--
Gitblit v1.8.0