xiangpei
2025-01-07 8779375b26e23113ebfa5940e4e5dbe696980f53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<template>
  <el-card class="card-container">
    <div class="flex-container mb-4">
      <el-tabs v-model="currentTab" @tab-click="handleClick" v-show="isShow">
        <el-tab-pane
          v-for="item in TABS_DATA"
          :key="item.value"
          :label="item.label"
          :name="item.value"
        >
          <template slot-scope="item">
            <div class="tab-label">{{ item.label }}</div>
          </template>
        </el-tab-pane>
      </el-tabs>
    </div>
    <component
      :is="componentName"
      ref="childRef"
      :disabled="disabled"
      @toNext="changeTable"
      @updateIsShow="updateIsShow"
      @basicInfoForm="basicInfoForm"
      @investInfoForm="investInfoForm"
      @investmentFundsForm="investmentFundsForm"
      @legalPersonForm="legalPersonForm"
      @policyInfoForm="policyInfoForm"
      @documentsInfoForm="documentsInfoForm"
      :isShow="isShow"
      class="full-width custom-height"
    />
    <div v-if="!disabled" class="button-container">
      <el-button
        v-if="componentName.name == 'BasicInfo'"
        class="save-button"
        type="primary"
        @click="saveProject(0)"
        >草稿</el-button
      >
<!--      <el-button class="save-button" type="primary" @click="submit(1)"-->
<!--        >保存</el-button>-->
      <el-button class="save-button" type="primary" @click="saveProject(1)"
      >保存</el-button>
      <el-button class="reset-button" @click="reset">重置</el-button>
      <!-- <el-button v-else class="cancel-button" @click="cancel">取消</el-button> -->
    </div>
  </el-card>
</template>
 
<script>
import BasicInfo from "@/views/projectEngineering/projectLibrary/component/BasicInfo";
import InvestInfo from "@/views/projectEngineering/projectLibrary/component/InvestInfo";
import InvestmentFunds from "@/views/projectEngineering/projectLibrary/component/investmentFunds";
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 { editProject } from "@/api/projectEngineering/projectInfo";
 
export default {
  name: "ProjectDetails",
  data() {
    return {
      isShow: false,
      currentTab: "项目管理基础信息",
      disabled: false,
      projectForm: {},
      componentName: BasicInfo,
      projectId: null,
      TABS_DATA: [
        {
          label: "项目管理基础信息",
          value: "项目管理基础信息",
          componentName: BasicInfo,
        },
        {
          label: "投资管理基础信息",
          value: "投资管理基础信息",
          componentName: InvestInfo,
        },
        {
          label: "项目投资及资金来源",
          value: "项目投资及资金来源",
          componentName: InvestmentFunds,
        },
        {
          label: "项目(法人)单位登记信息",
          value: "项目(法人)单位登记信息",
          componentName: LegalPerson,
        },
        {
          label: "投资项目产业政策符合情况",
          value: "投资项目产业政策符合情况",
          componentName: PolicyInfo,
        },
        {
          label: "相关文书",
          value: "相关文书",
          componentName: DocumentsInfo,
        },
      ],
      childRef: null,
    };
  },
  methods: {
    updateIsShow(newValue) {
      this.isShow = newValue;
    },
    basicInfoForm(data) {
      this.projectForm.projectInfoForm = data;
      this.projectId = data.id;
    },
    investInfoForm(data) {
      this.projectForm.projectInvestmentInfoForm = data;
      this.projectForm.projectInvestmentInfoForm.projectId = this.projectId;
    },
    investmentFundsForm(data) {
      this.projectForm.projectInvestmentFundingForm = data;
      this.projectForm.projectInvestmentFundingForm.projectId = this.projectId;
    },
    documentsInfoForm(data){
      this.projectForm.documentInfoForm = data;
      this.projectForm.documentInfoForm.projectId = this.projectId;
    },
    legalPersonForm(data) {
      this.projectForm.projectUnitRegistrationInfoForm = data;
      this.projectForm.projectUnitRegistrationInfoForm.projectId = this.projectId;
    },
    policyInfoForm(data) {
      this.projectForm.projectInvestmentPolicyComplianceForm = data;
      this.projectForm.projectInvestmentPolicyComplianceForm.projectId = this.projectId;
    },
    handleClick(tabTarget) {
      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(usedStatus) {
      this.$refs.childRef.submit(usedStatus);
    },
    reset() {
      this.$refs.childRef.reset();
    },
    saveProject(num) {
      this.projectForm.projectInfoForm.usedStatus = num;
      editProject(this.projectForm).then((res) => {
        this.$message.success("保存成功");
      })
      this.$router.push('/projectEngineering/project/projectLibrary')
    }
  },
  mounted() {
    if (this.$route.query.disabled) {
      this.disabled = true;
    }
  },
};
</script>
 
<style scoped>
::v-deep .el-tabs__nav-wrap::after {
  background-color: rgba(0, 0, 0, 0) !important;
}
.flex-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}
 
.tab-label {
  font-size: 14px;
}
 
.full-width {
  width: 100%;
}
 
.custom-height {
  height: calc(100% - 55px);
}
 
.button-container {
  margin-top: 3%;
  margin-left: 3%;
  display: flex;
}
 
.save-button,
.reset-button {
  width: 72px;
}
</style>