zhaoxiaoqiang1
2026-01-04 f1d30d03186c79ca2cbcfe60d6d2ce7d73fba97b
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
<!--
 * @Author: your name
 * @Date: 2019-10-21 15:40:58
 * @LastEditTime: 2019-11-22 15:16:20
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /e:\Demo\cts-web\src\views\area\projectManagement\add\ProjectReg.vue
 -->
<template>
  <el-container>
    <el-main style="padding:0px">
      <el-form :label-position="labelPosition" :model="form">
        <!-- <el-row>
          <p class="title">基本信息</p>
          <el-col :md="12" :lg="8">
            <el-form-item label="申请编号">
              <el-input v-model="form.serNo" readonly></el-input>
            </el-form-item>
          </el-col>
          <el-col :md="12" :lg="8">
            <el-form-item label="申请人姓名">
              <el-input v-model="form.applyName" readonly></el-input>
            </el-form-item>
          </el-col>
          <el-col :md="12" :lg="8">
            <el-form-item label="申请人工号">
              <el-input v-model="form.applyUserId" readonly></el-input>
            </el-form-item>
          </el-col>
          <el-col :md="12" :lg="8">
            <el-form-item label="申请人直属机构">
              <el-input v-model="form.applyOrgName" readonly></el-input>
            </el-form-item>
          </el-col>
          <el-col :md="12" :lg="8">
            <el-form-item label="申请人所属一级内部机构">
              <el-input v-model="form.applyFirstLevelOrgName" readonly></el-input>
            </el-form-item>
          </el-col>
          <el-col :md="12" :lg="8">
            <el-form-item label="申请时间">
              <el-input v-model="form.applyDate" readonly></el-input>
            </el-form-item>
          </el-col>
        </el-row> -->
        <el-row>
          <p class="title">开通产品信息</p>
          <project-reg-table></project-reg-table>
        </el-row>
      </el-form>
      <div v-if="detailsParams.projectType !== '3'">
        <el-form :label-position="labelPosition" :model="creditForm" :rules="rules">
          <el-row>
            <p
              class="title message"
              v-if="creditForm.creditAmount.visible && detailsParams.opertion !== '02'"
            >授信信息</p>
            <el-col :md="12" :lg="8" v-if="creditForm.creditAmount.visible && detailsParams.opertion !== '02'">
              <el-form-item label="授信额度(元):" prop="creditAmount">
                <el-input v-model="creditForm.creditAmount.value" :readonly="!creditForm.creditAmount.writeAble"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <!-- 申报信息 -->
        <!-- <el-form ref="form" :label-position="labelPosition" :model="reportForm">
          <el-row>
            <p class="title">申报信息</p>
            <el-col :span="24" v-if="reportConfig.remark.visible" class="el-form-textarea">
              <area-text
                :input-type="'textarea'"
                :input-rows="3"
                :config="reportConfig.remark"
                :placeholder="applyInfoTip"
                v-model="reportForm.remark"
                :placeholderContent="'地区申请项目准入需严格履行尽调责任,请简要概括含楼盘介绍、开发商股东及历史开发楼盘介绍、本项目优劣势及风险点提示等信息。'"
              ></area-text>
            </el-col>
          </el-row>
          <el-row v-if="reportConfig.changetype.visible">
            <el-col :span="8">
              <area-select
                :config="reportConfig.changetype"
                v-model="reportForm.changetype"
                class="changeType"
              ></area-select>
            </el-col>
          </el-row>
          <el-row v-if="reportConfig.changeinfo.visible">
            <el-col :span="24" class="el-form-textarea">
              <area-text
                :input-type="'textarea'"
                :input-rows="3"
                :config="reportConfig.changeinfo"
                v-model="reportForm.changeinfo"
              ></area-text>
            </el-col>
          </el-row>
        </el-form> -->
      </div>
    </el-main>
  </el-container>
</template>
 
<script>
import {
  queryApprovalBaseInfo,
  queryApplyCreditAmountInfo,
  insertOrUpdateProductInfo,
  queryProjectProductInfos,
  queryProjectDeclarationInfo,
  updateProjectDeclarationInfo
} from '@/api/area'
import { mapState } from 'vuex'
import ProjectRegTable from './components/ProjectRegTable'
import AreaInput from '../../components/AreaInput'
import AreaText from '../../components/AreaText'
import AreaSelect from '../../components/AreaSelect'
export default {
  components: { ProjectRegTable, AreaInput, AreaText, AreaSelect },
  props: ['nextChange'],
  data: function() {
    return {
      labelPosition: 'right',
      form: {
        serNo: '',
        applyName: '',
        applyUserId: '',
        applyOrgId: '',
        applyOrgName: '',
        applyFirstLevelOrgId: '',
        applyFirstLevelOrgName: '',
        applyDate: ''
      },
      config: {},
      creditForm: {
        creditAmount: ''
      },
      oldForm: {
        creditAmount: ''
      },
      creditAmount: {
        visible: false,
        required: false,
        writeAble: false
      },
      rules: {
        creditAmount: {
          required: true,
          message: '请输入授信信息',
          trigger: 'blur'
        }
      },
      reportForm: {
        remark: '',
        changetype: '',
        changeinfo: ''
      },
      oldReportForm:{
        remark:'',
        changeinfo:''
      },
      reportConfig: {},
      isReportSubmit: true, // 是否需要再次调用reportSubmit方法
      applyInfoTip:
        '地区申请项目准入需严格履行尽调责任,请简要概括含楼盘介绍、开发商股东及历史开发楼盘介绍、本项目优劣势及风险点提示等信息。'
    }
  },
  computed: {
    ...mapState({
      detailsParams: state => state.risk.detailsParams
    })
  },
  created() {
    this.initForm()
  },
  methods: {
    initForm() {
      // 初始化表单
      const { menuPhaseNo } = this.detailsParams
      this.reportConfig = Object.assign({}, this.reportConfig, this.reportForm)
      Object.keys(this.reportConfig).forEach(key => {
        let params = {
          visible: false,
          required: false,
          writeAble: false
        }
        this.$set(this.reportConfig, key, params)
      })
      let params = {
        objectType: this.detailsParams.objectType,
        dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
        serialno: this.detailsParams.objectNo
      }
      // 查看基本信息
      queryApprovalBaseInfo(params).then(res => {
        this.form = res.result
      })
      if (this.detailsParams.projectType !== 3) {
        // 查询授信额度
        queryApplyCreditAmountInfo(params).then(res => {
          this.creditForm.creditAmount = res.result.position
          this.oldForm.creditAmount = this.creditForm.creditAmount.value
          // this.creditAmount = res.result.position
          // this.oldForm = res.result.position
        })        
      }
      // 查看申报信息
      queryProjectDeclarationInfo(params).then(res => {
        this.reportConfig = this._.merge(this.reportConfig, res.result)
        Object.keys(this.reportForm).forEach(key => {
          this.$set(this.reportForm, key, this.reportConfig[key].value)
        })
        this.oldReportForm.changeinfo = res.result.changeinfo ? res.result.changeinfo.value :''
        this.oldReportForm.remark = res.result.remark.value
        if (menuPhaseNo === '0040' || menuPhaseNo === '0050') {
          this.reportConfig.changeinfo.writeAble = false
        }
      })
    },
    submitForm() {
      this.$emit('handleNextPage', true)
      return
      if (this.detailsParams.projectType !== '3') {
        let params = {
          objecttype: this.detailsParams.objectType,
          position: Number(this.creditForm.creditAmount.value),
          serialno: this.detailsParams.objectNo
        }
        insertOrUpdateProductInfo(params).then(res => {
          if (res.code === '00') {
            // this.$message.success('提交成功!')
            // this.$emit('handleNextPage', true)
            if (this.isReportSubmit) {
              this.reportSubmit()
            } else {
              this.$emit('handleNextPage', true)
            }
          }
        })
      } else {
        this.$emit('handleNextPage', true)
      }
      /* // 前端对表格有无数据校验。现由后台校验返回
            let params = {
                objectType: this.detailsParams.objectType,
                dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
                serialno: this.detailsParams.objectNo
            }
            queryProjectProductInfos(params).then(res => {
                if(res.result.total > 0){
                    let params = {
                        objecttype: this.detailsParams.objectType,
                        position: Number(this.creditForm.creditAmount),
                        serialno: this.detailsParams.objectNo
                    }
                    insertOrUpdateProductInfo(params).then(res => {
                        if (res.code === '00') {
                            // this.$message.success('提交成功!')
                            this.$emit('handleNextPage', true)
                        }
                    })
                }else{
                    this.$message.warning('请先录入产品信息!')
                }
            }) */
    },
    reportSubmit() {
      this.$refs['form'].validate(async valid => {
        if (valid) {
          let params = {
            remark: this.reportForm.remark,
            changeinfo: this.reportForm.changeinfo,
            changetype: this.reportForm.changetype,
            serialno: this.detailsParams.objectNo,
            objecttype: this.detailsParams.objectType,
            dataType: this.detailsParams.dataType,
            isTempSave: false
          }
          const { code } = await updateProjectDeclarationInfo(params)
          if (code === '00') {
            this.$emit('handleNextPage', true)
          }
        } else {
          this.$message.warning(
            '当前页面存在必填项未录入或数据录入错误,请检查!'
          )
        }
      })
    },
    handleSave(saveOpinion) {
      // console.log(saveOpinion)
      this.$refs['form'].validate(valid => {
        if (valid) {
          let params = {
            objecttype: this.detailsParams.objectType,
            position: Number(this.creditForm.creditAmount.value),
            serialno: this.detailsParams.objectNo
          }
          if (this.detailsParams.projectType !== '3') {
            this.reportSave()
          }
          insertOrUpdateProductInfo(params).then(res => {
            if (res.code === '00') {
              if (!saveOpinion) {
                this.oldForm.creditAmount = this.creditForm.creditAmount.value
              } else {
                if (this.detailsParams.projectType === '3') {
                  this.$message.success('保存成功')
                }
                this.$emit('commitSaveBefore', true)
              }
            } else {
              this.$emit('commitSaveBefore', false)
            }
          })
          
        } else {
          this.$message.warning(
            '当前页面存在必填项未录入或数据录入错误,请检查!'
          )
        }
      })
    },
    handleSaveDraft() {
      // this.$message.success('保存成功!')
      this.isReportSubmit = false
      if (this.detailsParams.projectType === '3') {
        this.$message.success('保存成功')
      } else {
        this.reportSave()
        this.oldForm.creditAmount = this.creditForm.creditAmount.value
      }
    },
    reportSave() {
      let params = {
        remark: this.reportForm.remark,
        changeinfo: this.reportForm.changeinfo,
        changetype: this.reportForm.changetype,
        serialno: this.detailsParams.objectNo,
        objecttype: this.detailsParams.objectType,
        position: Number(this.creditForm.creditAmount),
        serialno: this.detailsParams.objectNo
            }
            insertOrUpdateProductInfo(params).then(res => {
                if (res.code === '00') {
                    if (!saveOpinion) {
            this.$message.success('保存成功')
            this.oldForm.creditAmount = this.creditForm.creditAmount
                    } else {
                        this.$emit('commitSaveBefore', true)
                    }
                } else {
                    this.$emit('commitSaveBefore', false)
                }
            })
        },
        handleSaveDraft () {
            // console.log(saveOpinion)
            // let params = {
      //   objecttype: this.detailsParams.objectType,
      //   position: Number(this.creditForm.creditAmount),
      //   serialno: this.detailsParams.objectNo
            // }
            // insertOrUpdateProductInfo(params).then(res => {
            //     if (res.code === '00') {
            //             this.$message.success('保存成功!')
            //     }else{
            //         this.$emit('commitSaveBefore',false)
            //     }
      // })
      // 申请信息页面。基本信息都是只读的
      this.$message.success('保存成功!')
      this.creditForm.creditAmount = this.oldForm.creditAmount
    }
  },
  beforeRouteLeave(to, from, next) {
    if (this.detailsParams.menuPhaseNo === '0040' || this.detailsParams.menuPhaseNo === '0050') {
      this.reportForm.changeinfo = this.oldReportForm.changeinfo
    }
    if (this.nextChange && this.detailsParams.projectType !== '3') {
      if (this.creditForm.creditAmount.value != this.oldForm.creditAmount || this.reportForm.changeinfo && (this.reportForm.changeinfo != this.oldReportForm.changeinfo )|| this.reportForm.remark != this.oldReportForm.remark) {
        this.$confirm(`当前页面有未保存的数据,是否放弃保存`, '提示', {
          confirmButtonText: '是',
          cancelButtonText: '否',
          customClass: 'pro_messages_box',
          confirmButtonClass: 'pro_messages_box_confirm',
          cancelButtonClass: 'pro_messages_box_cancel',
          center: true
        })
          .then(() => {
            next()
          })
          .catch(() => {})
        return
      }
    }
    next()
  }
}
</script>
 
<style lang="stylus" scoped>
.title.message {
  margin-top: 22px;
}
 
.changeType {
  /deep/ .el-form-item__label {
    width: 145px !important;
  }
}
</style>