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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<!--/*
 * @Author: Pengjiantian 
 * @Date: 2020-04-17 10:29:00 
 * @Last Modified by:   Pengjiantian 
 * @Last Modified time: 2020-04-17 10:29:00 
 */ -->
<template>
  <el-container class="dataBack" v-loading="loading">
    <el-main style="padding:0">
      <el-form
        :label-position="labelPosition"
        :model="form"
        ref="form"
        :rules="rules"
        v-show="!loading"
      >
        <el-row>
          <p class="title">开发商信息</p>
          <!-- 开发商名称 -->
          <el-col :md="12" :lg="8" v-if="config.developer.visible">
            <area-input :config="config.developer" v-model="form.developer"></area-input>
          </el-col>
          <!-- 开发商社会信用代码 -->
          <el-col :md="12" :lg="8" v-if="config.prosocialcreditcode.visible">
            <area-input :config="config.prosocialcreditcode" v-model="form.prosocialcreditcode"></area-input>
          </el-col>
          <!-- 开发商品牌 -->
          <el-col :md="12" :lg="8" v-if="config.developbrand.visible">
            <area-input :config="config.developbrand" v-model="form.developbrand"></area-input>
          </el-col>
          <!-- 开发商类型 -->
          <el-col :md="12" :lg="8" v-if="config.protype.visible">
            <area-select :config="config.protype" v-model="form.protype"></area-select>
          </el-col>
        </el-row>
 
        <el-row>
          <p class="title">项目信息</p>
          <!-- 与开发商合作模式 -->
          <el-col :md="12" :lg="8" v-if="config.cooperationmodel.visible">
            <area-select :config="config.cooperationmodel" v-model="form.cooperationmodel"></area-select>
          </el-col>
          <!-- 项目名称 -->
          <el-col :md="12" :lg="8" v-if="config.productname.visible">
            <area-input :config="config.productname" v-model="form.productname"></area-input>
          </el-col>
          <!-- 项目编码 -->
          <el-col :md="12" :lg="8" v-if="config.productnumber.visible">
            <area-input :config="config.productnumber" v-model="form.productnumber"></area-input>
          </el-col>
          <!-- 项目所在省 -->
          <el-col :md="12" :lg="8" v-if="config.registerprovince.visible">
            <el-form-item label="项目所在省" prop="registerprovince" :rules="rules">
              <el-select
                v-model="form.registerprovince"
                filterable
                clearable
                placeholder="请选择"
                :disabled="!config.registerprovince.writeAble"
              >
                <el-option
                  v-for="item in registerprovinceOptions"
                  :key="item.itemno"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 项目所在市  -->
          <el-col :md="12" :lg="8" v-if="config.registercitys.visible">
            <el-form-item label="项目所在市 " prop="registercitys" :rules="rules">
              <el-select
                v-model="form.registercitys"
                filterable
                placeholder="请选择"
                clearable
                :disabled="!config.registercitys.writeAble"
              >
                <el-option
                  v-for="item in registercitysOptions"
                  :key="item.itemno"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 项目所在区 -->
          <el-col :md="12" :lg="8" v-if="config.registercounty.visible">
            <el-form-item label="项目所在区" prop="registercounty" :rules="rules">
              <el-select
                v-model="form.registercounty"
                filterable
                placeholder="请选择"
                clearable
                :disabled="!config.registercounty.writeAble"
              >
                <el-option
                  v-for="item in registercountyOptions"
                  :key="item.itemno"
                  :label="item.itemname"
                  :value="item.itemno"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 项目所在省 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.registerprovince.visible">
            <area-select :config="config.registerprovince" v-model="form.registerprovince"></area-select>
          </el-col>-->
          <!-- 项目所在市 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.registercitys.visible">
            <area-select :config="config.registercitys" v-model="form.registercitys"></area-select>
          </el-col>-->
          <!-- 项目所在区 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.registercounty.visible">
            <area-select :config="config.registercounty" v-model="form.registercounty"></area-select>
          </el-col>-->
          <!-- 物业类型 -->
          <el-col :md="12" :lg="8" v-if="config.property.visible">
            <area-select :config="config.property" v-model="form.property"></area-select>
          </el-col>
          <!-- 预售许可证楼栋号 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.presalelicensebuildnum.visible">
            <area-input
              :config="config.presalelicensebuildnum"
              v-model="form.presalelicensebuildnum"
            ></area-input>
          </el-col> -->
          <el-col :lg="24" v-if="config.presalelicensebuildnum.visible">
            <area-text :config="config.presalelicensebuildnum" v-model="form.presalelicensebuildnum"></area-text>
          </el-col>
        </el-row>
 
        <el-row>
          <p class="title">开发商合同</p>
          <!-- 签约主体 -->
          <el-col :md="12" :lg="8" v-if="config.signcontractentity.visible">
            <area-input :config="config.signcontractentity" v-model="form.signcontractentity"></area-input>
          </el-col>
          <!-- 合同名称 -->
          <el-col :md="12" :lg="8" v-if="config.contractname.visible">
            <area-input :config="config.contractname" v-model="form.contractname"></area-input>
          </el-col>
          <!-- 合同编号 -->
          <el-col :md="12" :lg="8" v-if="config.contractno.visible">
            <area-input :config="config.contractno" v-model="form.contractno"></area-input>
          </el-col>
          <!-- 合同执行生效日期 -->
          <el-col :md="12" :lg="8" v-if="config.effectivedate.visible">
            <area-date :config="config.effectivedate" v-model="form.effectivedate" :remove="true"></area-date>
          </el-col>
          <!-- 合同执行失效日期 -->
          <el-col :md="12" :lg="8" v-if="config.expirationdate.visible">
            <area-date :config="config.expirationdate" v-model="form.expirationdate" :remove="true"></area-date>
          </el-col>
          <!-- 成功销售条件 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.salesucconditions.visible">
            <area-input :config="config.salesucconditions" v-model="form.salesucconditions"></area-input>
          </el-col> -->
          <el-col :lg="24" v-if="config.salesucconditions.visible">
            <area-text :config="config.salesucconditions" v-model="form.salesucconditions"></area-text>
          </el-col>
          <!-- 结算条件 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.settleconditions.visible">
            <area-input :config="config.settleconditions" v-model="form.settleconditions"></area-input>
          </el-col> -->
          <el-col :lg="24" v-if="config.settleconditions.visible">
            <area-text :config="config.settleconditions" v-model="form.settleconditions"></area-text>
          </el-col>
          <!-- 佣金条件 -->
          <!-- <el-col :md="12" :lg="8" v-if="config.commissionconditions.visible">
            <area-input :config="config.commissionconditions" v-model="form.commissionconditions"></area-input>
          </el-col> -->
          <el-col :lg="24" v-if="config.commissionconditions.visible">
            <area-text :config="config.commissionconditions" v-model="form.commissionconditions"></area-text>
          </el-col>
          <!-- 期限单位 -->
          <el-col :md="12" :lg="8" v-if="config.termunit.visible">
            <area-select :config="config.termunit" v-model="form.termunit"></area-select>
          </el-col>
          <!-- 佣金回款周期(天) -->
          <el-col :md="12" :lg="8" v-if="config.rebateterm.visible">
            <area-input-init :config="config.rebateterm" v-model="form.rebateterm" @changeValue="changeValue"></area-input-init>
          </el-col>
        </el-row>
      </el-form>
    </el-main>
  </el-container>
</template>
 
<script>
import AreaInput from '@/views/area/components/AreaInput'
import AreaInputInit from '@/views/area/components/AreaInputInit'
import AreaText from '@/views/area/components/AreaText'
import AreaSelect from '@/views/area/components/AreaSelect'
import AreaDate from '@/views/area/components/AreaDate'
import {
  queryDeveloperProjectInformation,
  updateDeveloperProjectInformation,
  getProvinceCodeList,
  getCityCodeList,
  getAreaCodeList
} from '@/api/area'
import { mapState } from 'vuex'
export default {
  components: { AreaInput, AreaInputInit, AreaText, AreaSelect, AreaDate },
  props: ['nextChange'],
  data: function() {
    return {
      loading: true,
      labelPosition: 'right',
      writeAble: false,
      rules: {},
      form: {
        developer: '', // 开发商名称
        prosocialcreditcode: '', // 开发商社会信用代码
        developbrand: '', // 开发商品牌
        protype: '', // 开发商类型
        cooperationmodel: '', // 与开发商合作模式
        productname: '', // 项目名称
        productnumber: '', // 项目编码
        registerprovince: '', // 项目所在省
        registercitys: '', // 项目所在市
        registercounty: '', // 项目所在区
        property: '', // 物业类型
        presalelicensebuildnum: '', // 预售许可证楼栋号
        signcontractentity: '', // 签约主体
        contractname: '', // 合同名称
        contractno: '', // 合同编号
        effectivedate: '', // 合同执行生效日期
        expirationdate: '', // 合同执行失效日期
        salesucconditions: '', // 成功销售条件
        settleconditions: '', // 结算条件
        commissionconditions: '', // 佣金条件
        termunit: '', // 期限单位
        rebateterm: '' // 佣金回款周期(天)
      },
      oldForm: {},
      config: {},
      // 省市区
      registerprovinceOptions: [],
      registercitysOptions: [],
      registercountyOptions: []
    }
  },
  computed: {
    ...mapState({
      detailsParams: state => state.risk.detailsParams
    }),
    /* negativeMessages(){
      const { balanceblacklist, cashflow, courtinvolved, cashflowexplain, courtinvolvedexplain } = this.config
      if (balanceblacklist.visible && cashflow.visible && courtinvolved.visible && cashflowexplain.visible && courtinvolvedexplain.visible){
        return true
      } else {
        return false
      }
        } */
    badMsgTitle() {
      if (
        this.config.balanceblacklist.visible ||
        this.config.cashflow.visible ||
        this.config.courtinvolved.visible ||
        this.config.cashflowexplain.visible ||
        this.config.courtinvolvedexplain.visible
      ) {
        return true
      } else {
        return false
      }
    }
  },
  watch: {
    'form.cashflow': function(newVal) {
      this.config.cashflowexplain.required = Boolean(
        newVal === '01' || newVal === '02'
      )
      this.config.cashflowexplain.visible = Boolean(
        newVal === '01' || newVal === '02'
      )
      this.config.cashflowexplain.writeAble = Boolean(
        newVal === '01' || newVal === '02'
      )
      if (!this.config.cashflowexplain.visible) {
        this.form.cashflowexplain = ''
      }
    },
    'form.courtinvolved': function(newVal) {
      // 失信信息/法院涉诉情况说明,有:显示,无:隐藏
      this.config.courtinvolvedexplain.visible = Boolean(newVal === '1')
      if (!this.config.courtinvolvedexplain.visible) {
        this.form.courtinvolvedexplain = ''
      }
    },
    // 省市区联动
    'form.registerprovince': function(value, oldValue) {
      if (value) {
        this.getCityCodeList(value)
      }
      if (value !== oldValue && oldValue) {
        this.form.registercitys = ''
      }
      // getCityCodeList(params).then(res => {
      //   this.registercitysOptions = res.result
      // })
      // this.form.registercitys = ''
      // this.form.registercounty = ''
    },
    'form.registercitys': function(value, oldValue) {
      if (value) {
        this.getAreaCodeList(value)
      }
      if (value !== oldValue && oldValue) {
        this.form.registercounty = ''
      }
    }
  },
  created() {
    this.initForm()
    this.getForm()
    this.getProvinceCodeList()
  },
  methods: {
    changeValue(val, name) {
      this.form[`${name}`] = val
    },
    getForm() {
      let params = {
        objectType: this.detailsParams.objectType,
        dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
        serialno: this.detailsParams.objectNo
      }
      queryDeveloperProjectInformation(params).then(res => {
        // console.log(res.result)
        this.config = this._.merge({}, this.config, res.result)
        Object.keys(this.form).forEach(key => {
          this.$set(this.form, key, this.config[key].value)
        })
        Object.assign(this.oldForm, this.form)
        this.loading = false
      })
    },
    initForm() {
      Object.keys(this.form).forEach(key => {
        let params = {
          visible: false,
          required: false,
          writeAble: false
        }
        this.config[key] = Object.assign({}, this.config[key], params)
      })
    },
    getProvinceCodeList() {
      // 查询省
      getProvinceCodeList({}).then(res => {
        this.registerprovinceOptions = res.result
      })
    },
    getCityCodeList(value) {
      let params = {
        codeNo: 'AreaCode',
        itmeNo: value
      }
      getCityCodeList(params).then(res => {
        this.registercitysOptions = res.result
      })
    },
    getAreaCodeList(value) {
      let params = {
        codeNo: 'AreaCode',
        itmeNo: value
      }
      getAreaCodeList(params).then(res => {
        this.registercountyOptions = res.result
      })
    },
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          let params = {
            serialno: this.detailsParams.objectNo,
            objecttype: this.detailsParams.objectType,
            dataType: this.detailsParams.dataType,
            isTempSave: false
          }
          params = Object.assign({}, params, this.form)
          updateDeveloperProjectInformation(params).then(res => {
            if (res.code === '00') {
              /* this.$message({
                message: res.result.resultsDesc,
                type: 'success'
              }) */
              this.$emit('handleNextPage', true)
            }
          })
        } else {
          this.$message.warning(
            '当前页面存在必填项未录入或数据录入错误,请检查!'
          )
          return false
        }
      })
    },
    handleSaveDraft() {
      let params = {
        serialno: this.detailsParams.objectNo,
        objecttype: this.detailsParams.objectType,
        dataType: this.detailsParams.dataType,
        isTempSave: true
      }
      Object.assign(params, this.form)
      updateDeveloperProjectInformation(params).then(res => {
        if (res.code === '00') {
          this.$message.success('保存成功')
          this.oldForm = Object.assign(this.oldForm, this.form)
        }
      })
    },
    handleSave() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          let params = {
            serialno: this.detailsParams.objectNo,
            objecttype: this.detailsParams.objectType,
            dataType: this.detailsParams.dataType,
            isTempSave: true
          }
          Object.assign(params, this.form)
          updateDeveloperProjectInformation(params).then(res => {
            if (res.code === '00') {
              this.$message.success('保存成功')
              this.oldForm = Object.assign(this.oldForm, this.form)
            }
          })
        } else {
          this.$message.warning(
            '当前页面存在必填项未录入或数据录入错误,请检查!'
          )
        }
      })
    },
    // 有无失信
    hasTure(val) {
      if (val === '1') {
        this.config.courtinvolvedexplain.required = true
      }
    }
  },
  beforeRouteLeave(to, from, next) {
    // console.log(this.form)
    // console.log(this.oldForm)
    // console.log(this.nextChange)
    if (this.nextChange) {
      for (const key in this.oldForm) {
        if (this.oldForm.hasOwnProperty(key)) {
          if (this.oldForm[key] && this.form[key]) {
            // 不比较空值和undefined
            if (this.oldForm[key] != this.form[key]) {
              // console.log(this.form[key])
              // console.log(this.oldForm[key])
              this.$confirm(`当前页面有未保存的数据,是否放弃保存`, '提示', {
                confirmButtonText: '是',
                cancelButtonText: '否',
                customClass: 'pro_messages_box',
                confirmButtonClass: 'pro_messages_box_confirm',
                cancelButtonClass: 'pro_messages_box_cancel',
                center: true
              })
                .then(() => {
                  next()
                })
                .catch(() => {
                  this.$emit('notNext')
                })
              return
            }
          }
        }
      }
    }
    next()
  }
}
</script>
 
<style lang="stylus" scoped>
#el-form-textarea {
  >>> .el-form-item__label {
    margin-bottom: 48px;
  }
}
</style>