xiangpei
2025-06-05 1fa6ac40e2ce16e1174cec9ca538d45eeb660fdc
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<template>
  <div class="basic-info">
    <el-form ref="demoFormRef" :disabled="disabled" :model="investmentForm" class="dialog_form">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="建设地点是否跨域" label-width="120px" prop="fundsType" style="width: 100%">
            <el-select
              v-model="investmentForm.beCrossRegion"
              clearable
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_cross_domain" :key="item.value" :label="item.label"
                         :value="parseInt(item.value)"/>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目建设地点" label-width="120px" prop="investmentType" style="width: 100%">
            <el-select
              v-model="investmentForm.constructionLocation"
              clearable
              disabled
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_administrative_divisions" :key="item.value" :label="item.label"
                         :value="item.value"/>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="建设详细地址" label-width="120px" prop="fundsType" style="width: 100%">
            <el-input v-model.trim="investmentForm.detailedAddress" class="item" clearable disabled maxlength="255"
                      placeholder="请输入"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="是否是补码项目" label-width="120px" prop="projectType" style="width: 100%">
            <el-select
              v-model="investmentForm.beCompensationProject"
              clearable
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_whether_project" :key="item.value" :label="item.label"
                         :value="parseInt(item.value)"/>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="补码原因" label-width="120px" prop="projectstatus" style="width: 100%">
            <el-input v-model.trim="investmentForm.compensationReason" class="item" clearable maxlength="255"
                      placeholder="请输入"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="计划开工时间" label-width="120px" prop="plannedStartDate" style="width: 100%">
            <el-date-picker v-model="investmentForm.plannedStartDate"
                            placeholder="选择时间"
                            style="width: 100%"
                            disabled
                            type="date"
                            value-format="yyyy-MM-dd HH:mm:ss"/>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="拟建成时间" label-width="120px" prop="expectedCompletionDate" style="width: 100%">
            <el-date-picker
              v-model="investmentForm.expectedCompletionDate"
              placeholder="选择时间"
              disabled
              style="width: 100%"
              type="date"
              value-format="yyyy-MM-dd HH:mm:ss"/>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="国际行业分类" label-width="120px" prop="engineering" style="width: 100%">
            <el-select
              v-model="investmentForm.nationalIndustryClassification"
              clearable
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_industry_classification" :key="item.value" :label="item.label"
                         :value="item.value"/>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="所属行业分类" label-width="120px" prop="department" style="width: 100%">
            <el-input v-model.trim="investmentForm.industryClassification" class="item" clearable maxlength="255"
                      placeholder="请输入"/>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目建成性质" label-width="120px" prop="design" style="width: 100%">
            <el-select
              v-model="investmentForm.projectNature"
              clearable
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_industry_belong" :key="item.value" :label="item.label"
                         :value="item.value"/>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目属性" label-width="120px" prop="putUnder" style="width: 100%">
            <el-select
              v-model="investmentForm.projectAttribute"
              clearable
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_project_attributes" :key="item.value" :label="item.label"
                         :value="item.value"/>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="18">
          <el-form-item label="是否使用土地" label-width="120px" prop="approvalType" style="width: 100%">
            <el-select
              v-model="investmentForm.useEarth"
              clearable
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option v-for="item in dict.type.sys_whether_project" :key="item.value" :label="item.label"
                         :value="parseInt(item.value)"/>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="18">
          <el-form-item class="item" label="主要建设内容及规模" label-width="120px" prop="content">
            <el-input v-model.trim="investmentForm.contentScale" class="item" clearable maxlength="255"
                      placeholder="请输入"
                      type="textarea"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="18">
          <el-form-item class="item" label="建管平台代码" label-width="120px" prop="content">
            <el-input v-model.trim="investmentForm.code" class="item" clearable maxlength="255" placeholder="请输入"
                      type="textarea"/>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
 
<script>
import {
  addProjectInvestmentInfo,
  editProjectInvestmentInfo,
  getProjectInvestmentInfoById
} from "@/api/projectEngineering/projectInvestmentInfo";
 
export default {
  dicts: ['sys_cross_domain', 'sys_industry_classification', 'sys_administrative_divisions', 'sys_whether_project', 'sys_industry_belong', 'sys_project_attributes'],
  name: 'InvestmentForm',
  props: {
    disabled: {
      type: Boolean,
      default: false,
      required: true
    },
  },
  data() {
    return {
      projectForm: {},
      investmentForm: {
        // id: '',
        // beCrossRegion: '',
        // constructionLocation: '',
        // detailedAddress: '',
        // beCompensationProject: '',
        // compensationReason: '',
        // plannedStartDate: '',
        // expectedCompletionDate: '',
        // nationalIndustryClassification: '',
        // industryClassification: '',
        // projectNature: '',
        // projectAttribute: '',
        // useEarth: '',
        // contentScale: '',
        // code: '',
        // projectId: '',
      },
      plannedStartDate: '',
      expectedCompletionDate: '',
      sys_cross_domain: [],
      sys_industry_classification: [],
      sys_industry_belong: [],
      sys_project_attributes: [],
      sys_whether_project: [],
      sys_administrative_divisions: []
    };
  },
  mounted() {
    // 从Cookies中获取缓存数据
    const investmentForm = localStorage.getItem("investmentForm");
    const projectForm = localStorage.getItem("projectForm");
 
    // 尝试解析JSON数据
    const parsedInvestmentForm = investmentForm ? JSON.parse(investmentForm) : null;
    const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
    // 设置investment和projectForm对象
    if(parsedInvestmentForm) {
      this.investmentForm = parsedInvestmentForm;
    }
    if(parsedProjectForm) {
      this.projectForm = parsedProjectForm;
    }
    // 如果路由存在id且没有缓存,视为编辑或查看,调用api
    if (this.$route.query.projectId && !investmentForm) {
      this.getInvestment();
    }else {
      this.investmentForm.constructionLocation = this.projectForm.area;
      this.investmentForm.detailedAddress = this.projectForm.projectAddress;
      this.investmentForm.plannedStartDate = this.projectForm.planStartTime;
      this.investmentForm.expectedCompletionDate = this.projectForm.planCompleteTime;
    }
 
    this.investmentForm.projectId = this.projectForm.id;
  },
  beforeDestroy() {
    if(Object.keys(this.investmentForm).length !==0) localStorage.setItem("investmentForm", JSON.stringify(this.investmentForm));
  },
  methods: {
    getInvestment() {
      getProjectInvestmentInfoById(this.$route.query.projectId).then(res => {
        this.investmentForm = res.data;
          this.$nextTick(() => {
            this.investmentForm.constructionLocation = this.projectForm.area;
            this.investmentForm.detailedAddress = this.projectForm.projectAddress;
            this.investmentForm.plannedStartDate = this.projectForm.planStartTime;
            this.investmentForm.expectedCompletionDate = this.projectForm.planCompleteTime;
          })
      });
    },
    submit() {
      if (!this.projectForm.id) {
        this.$message.error("请先保存投资管理基本信息")
      } else {
        this.investmentForm.projectId = this.projectForm.id;
        if (this.investmentForm.id) {
          editProjectInvestmentInfo(this.investmentForm).then(response => {
            this.$modal.msgSuccess("修改成功");
            //跳转到下个组件
            this.$emit('toNext', 2);
          });
        } else {
          addProjectInvestmentInfo(this.investmentForm).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.investmentForm.id = response.data
            //跳转到下个组件
            this.$emit('toNext', 2);
          });
        }
      }
    },
  },
  watch: {
    investmentForm: {
      deep: true,
      handler(newVal) {
        this.$emit('investInfoForm', newVal)
      }
    }
  }
 
};
</script>
 
<style lang="scss" scoped>
.item {
  width: 100%;
}
 
.input-row {
  display: flex;
  width: 100%;
 
  .input-item {
    width: 100%;
  }
}
 
.map-btn {
  width: 32px;
  height: 32px;
  background: #c6d6ff;
  border: 1px solid #3369ff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
 
  img {
    width: 20px;
  }
}
</style>