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
<!--
 * @Author: your name
 * @Date: 2019-10-21 15:40:58
 * @LastEditTime: 2023-03-03 10:04:09
 * @LastEditors: vann 984797170@qq.com
 * @Description: In User Settings Edit
 * @FilePath: /e:\Demo\cts-web\src\views\area\enterprise\update\EnterpriseBaseInfo.vue
 -->
<template>
  <div class="dataBack" v-loading="loading">
    <el-form label-position="right" :model="form" v-show="!loading" ref="form">
      <el-row>
        <p class="title">基本信息</p>
        <enp-input :config.sync="form.channelareaname"></enp-input>
        <enp-select :config="form.enterprisetype"></enp-select>
        <enp-input :config.sync="form.enterprisename"></enp-input>
        <enp-input :config.sync="form.reditcode"></enp-input>
        <enp-input :config.sync="form.organizationcode"></enp-input>
        <enp-date :config="form.registerdate"></enp-date>
        <!-- 注册资本 -->
        <enp-input :config.sync="form.registeredcapital" @changMoney="changMoney"></enp-input>
        <enp-input :config.sync="form.companytel"  @changMoney="changMoney"></enp-input>
        <enp-select :config="form.industrytype"></enp-select>
        <enp-select :config="form.enterprisecategory"></enp-select>
        <city-select
          :province.sync="form.registerprovince"
          :citys.sync="form.registercitys"
          :county.sync="form.registercounty"
        ></city-select>
        <enp-input :config.sync="form.registeraddress" isTextArea="textarea"></enp-input>
        <enp-input :config.sync="form.scope"></enp-input>
        <city-select
          :province.sync="form.companyprovince"
          :citys.sync="form.companycity"
          :county.sync="form.companycounty"
        ></city-select>
        <enp-input :config.sync="form.companytualaddress"></enp-input>
        <!-- 公司组织机构代码 -->
        <head-office-input
        :name.sync="form.headenterprisename"
        :code.sync="form.headorganizationcode"
        :reditcode.sync="form.headreditcode"
        ></head-office-input>
<!--        <enp-input :config="form.headenterprisename"></enp-input>-->
<!--        <enp-input :config.sync="form.headorganizationcode"></enp-input>-->
<!--        <enp-input :config.sync="form.headreditcode"></enp-input>-->
 
        <enp-input :config.sync="form.balanceaccount"></enp-input>
        <enp-input :config.sync="form.balancefictitiousaccount"></enp-input>
      </el-row>
      <el-row>
        <p class="title">联系人信息</p>
        <enp-input :config.sync="form.contactname"></enp-input>
        <enp-input :config.sync="form.contactcertid"></enp-input>
        <enp-input :config.sync="form.contactphone"></enp-input>
      </el-row>
      <el-row>
        <p class="title" v-show="manageForm">经营信息</p>
        <div ref="manageForm">
          <enp-input :config.sync="form.stockname"></enp-input>
          <enp-input :config.sync="form.stockcode"></enp-input>
          <!-- 前年营业利润(万) -->
          <enp-input :config.sync="form.lastbeforeyearprofit"></enp-input>
          <!-- 上年营业利润(万) -->
          <enp-input :config.sync="form.lastyearprofit"></enp-input>
          <enp-select :config="form.criterion"></enp-select>
          <!-- 标准详细计算公式及结果(万) -->
          <enp-input :config.sync="form.standardtailedresult"></enp-input>
          <!-- 增长率 -->
          <!-- <enp-input :config.sync="rateofrise"></enp-input> -->
          <enp-input :config.sync="form.rateofrise"></enp-input>
          <enp-input :config.sync="form.totalassets"></enp-input>  <!-- 企业总资产 -->
          <enp-input :config.sync="form.sliabilities"></enp-input> <!-- 企业总负债 -->
          <!-- 企业净资产 -->
          <!-- <enp-input :config.sync="netasset"></enp-input> -->
          <enp-input :config.sync="form.netasset"></enp-input> 
          <!-- 企业负债率 -->
          <!-- <enp-input :config.sync="debtratio"></enp-input> -->
          <enp-input :config.sync="form.debtratio"></enp-input> 
          <enp-input :config.sync="form.singleloanlimit"></enp-input>
          <enp-input :config.sync="form.platformurl"></enp-input>
          <enp-select :config="form.locationcity"></enp-select>
          <enp-select :config="form.registercity"></enp-select>
          <enp-input :config.sync="form.otherexplain"></enp-input>
        </div>
      </el-row>
      <el-row v-if="form.ShareholderInfo.visible">
        <p class="title">股东信息</p>
        <shareholder-info-table :object-no="enterpriseParams.tempSerialNo" :object-type="enterpriseParams.objectType"></shareholder-info-table>
      </el-row>
      <el-row>
        <!-- <p class="title" style="margin-top:22px">负面信息</p> -->
        <enp-input :config.sync="form.gative"></enp-input> <!-- 有无负面信息 -->
        <enp-select :config="form.lostinformation"></enp-select> <!-- 失信情况 -->
        <enp-select :config="form.majorlitigation"></enp-select> <!-- 重大诉讼 -->
        <enp-select :config="form.majorissues"></enp-select> <!-- 重大事项 -->
        <enp-select :config="form.somethingelse"></enp-select> <!-- 其他事项 -->
        <enp-input :config.sync="form.badrecord"></enp-input> <!-- 负面信息说明 -->
        <enp-input :config.sync="form.remarka"></enp-input> <!-- 失信情况说明 -->
        <enp-input :config.sync="form.remarkb"></enp-input> <!-- 重大诉讼说明 -->
        <enp-input :config.sync="form.remarkc"></enp-input> <!-- 重大事项说明 -->
        <enp-input :config.sync="form.remarkd"></enp-input> <!-- 其他事项说明 -->
      </el-row>
      <el-row v-if="form.EnpFinancialData.visible">
        <p class="title">财务数据</p>
        <financial-data-table :object-no="enterpriseParams.tempSerialNo" :object-type="enterpriseParams.objectType"></financial-data-table>
      </el-row>
      <el-row>
        <p class="title" style="margin-top:22px"  v-show="expandForm">拓展人信息</p>
        <div ref="expandForm">
        <enp-input :config.sync="form.expanduserid"></enp-input>
        <enp-input :config.sync="form.expandjobnumber"></enp-input>
        <enp-input :config.sync="form.objectno"></enp-input>
        <enp-input :config.sync="form.objecttype"></enp-input>
        <enp-input :config.sync="form.expandphonenumber"></enp-input>
        </div>
      </el-row>
      <el-row v-if="form.DockingInfo.visible">
        <p class="title">对接人信息</p>
        <docking-info-table :object-no="enterpriseParams.tempSerialNo" :object-type="enterpriseParams.objectType"></docking-info-table>
      </el-row>
    </el-form>
  </div>
</template>
 
<script>
import { qryEnpBasicInfo, updateEnterpriseBaseInfo } from '@/api/area/enterprise'
import EnpInput from '../components/EnpInput'
import EnpSelect from '../components/EnpSelect'
import EnpDate from '../components/EnpDate'
import CitySelect from '../components/CitySelect'
import ShareholderInfoTable from './components/ShareholderInfoTable'
import FinancialDataTable from './components/FinancialDataTable'
import DockingInfoTable from './components/DockingInfoTable'
import HeadOfficeInput from './components/HeadOfficeInput'
import { mapState } from 'vuex'
 
import { communal } from '@/views/area/mixins'
export default {
  components: { EnpInput, EnpSelect, EnpDate, CitySelect, ShareholderInfoTable, FinancialDataTable, DockingInfoTable, HeadOfficeInput },
  props: {
    nextChange: {
      type: Boolean,
      default: false
    },
  },
  mixins: [communal],
  data: function() {
    return {
      loading: true,
      manageForm: true,
      expandForm: true,
      form: {
        channelareaname: '',
        enterprisetype: '',
        enterprisename: '',
        reditcode: '',
        organizationcode: '',
        registerdate: '',
        registeredcapital: '',
        companytel: '',
        industrytype: '',
        enterprisecategory: '',
        registerprovince: '',
        registercitys: '',
        registercounty: '',
        registeraddress: '',
        scope: '',
        companyprovince: '',
        companycity: '',
        companycounty: '',
        companytualaddress: '',
        headenterprisename: '',
        headorganizationcode: '',
        headreditcode: '',
        balanceaccount: '',
        balancefictitiousaccount: '',
        corporatename: '',
        corporatecerttype: '',
        corporatecertid: '',
        stockname: '',
        stockcode: '',
        lastbeforeyearprofit: '',
        lastyearprofit: '',
        criterion: '',
        standardtailedresult: '',
        rateofrise: '',
        totalassets: '',
        sliabilities: '',
        netasset: '',
        debtratio: '',
        singleloanlimit: '',
        platformurl: '',
        locationcity: '',
        registercity: '',
        otherexplain: '',
        gative: '',
        lostinformation: '',
        majorlitigation: '',
        majorissues: '',
        somethingelse: '',
        badrecord: '',
        remarka: '',
        remarkb: '',
        remarkc: '',
        remarkd: '',
        expanduserid: '',
        expandjobnumber: '',
        objectno: '',
        objecttype: '',
        expandphonenumber: '',
        serialno: '',
        //
        ShareholderInfo: '',
        EnpFinancialData: '',
        DockingInfo: '',
        contactname: '', //企业联系人姓名
        contactcertid: '', //企业联系人证件号
        contactphone: '', //企业联系人电话
      },
      oldForm: {}
    }
  },
  created() {
    this.initForm()
  },
  watch: {
    // 前年
    'form.lastbeforeyearprofit.value': function(val) {
      let { value } = this.form.lastyearprofit
      val = val.trim()
      value = value.trim()
      if (val && value) {
        let result = (Number(value) - Number(val)) / Number(val) * 100
        this.form.rateofrise.value = Math.round(result * 100) / 100
      } else {
         this.form.rateofrise.value = ''
      }
    },
    // 上年
    'form.lastyearprofit.value': function(val) {
      let { value } = this.form.lastbeforeyearprofit
      val = val.trim()
      value = value.trim()
      if (val && value) {
        let result = (Number(val) - Number(value)) / Number(value) * 100
        this.form.rateofrise.value = Math.round(result * 100) / 100
        let rateofriseValue = this.form.rateofrise.value
        if (rateofriseValue) {
          // 上年营业利润*(1+增长率)*(1+增长率)
          let res = (+val) * (1 + rateofriseValue / 100) * (1 + rateofriseValue / 100)
          this.form.standardtailedresult.value = Math.round(res * 100) / 100
        }
      } else {
        this.form.rateofrise.value = ''
        this.form.standardtailedresult.value = ''
      }
    },
    // 增长率
    // 'form.rateofrise.value':function(val){
    //   // console.log(val)
    //   const { value } = this.form.lastyearprofit
    //   value = value.trim()
    //   if (val && value) {
    //     this.form.standardtailedresult.value = (+value) * (1+val) * (1+val)
    //   } else {
    //     this.form.standardtailedresult.value = ''
    //   }
    // },
    // 企业总资产
    'form.totalassets.value': function(val) {
      let { value } = this.form.sliabilities
      val = val.trim()
      value = value.trim()
      if (val && value) {
        this.form.netasset.value = (+val) - (value * 1)
        // 企业资产负债率 = 企业总负债/企业总资产
        this.form.debtratio.value = Math.round(((value * 1) / (+val)) * 100)
      } else {
        this.form.netasset.value = ''
        this.form.debtratio.value = ''
      }
    },
    // 企业总负债
    'form.sliabilities.value': function(val) {
      let { value } = this.form.totalassets
      val = val.trim()
      value = value.trim()
      if (val && value) {
        this.form.netasset.value = (+value) - (val * 1)
        this.form.debtratio.value = Math.round(((val * 1) / (+value)) * 100)
      } else {
        this.form.netasset.value = ''
        this.form.debtratio.value = ''
      }
    }
  },
  computed: {
    ...mapState({
      enterpriseParams: state => state.risk.enterpriseParams
    }),
    // 实时计算 增长率 = (上年营业利润-前年营业利润)/前年营业利润
    // rateofrise(){
    //   // console.log(this.form.lastbeforeyearprofit)
    //   const { lastbeforeyearprofit,lastyearprofit } = this.form
    //   let tempRateofrise = this.form.rateofrise
    //   if (lastbeforeyearprofit.value && lastyearprofit.value ) {
    //     tempRateofrise.value = ((Number(lastbeforeyearprofit.value) - Number(lastyearprofit.value)) /  Number(lastyearprofit.value)) * 100
    //     if (String(tempRateofrise.value).indexOf('.') > -1) {
    //      tempRateofrise.value = Number(tempRateofrise.value).toFixed(2)
    //     }
    //   } else {
    //     tempRateofrise.value = ''
    //   }
    //   return tempRateofrise
    // },
    // // 实时计算 企业净资产 = 企业总资产 - 企业总负债
    // netasset(){
    //   const { totalassets,sliabilities } = this.form
    //   let tempNetasset = this.form.netasset
    //   if (totalassets.value && sliabilities.value ) {
    //     tempNetasset.value = Number(totalassets.value) - Number(sliabilities.value)
    //   } else {
    //     tempNetasset.value = ''
    //   }
    //   return tempNetasset
    // },
    // // 实时计算 企业资产负债率 = 企业总负债/企业总资产
    // debtratio(){
    //   const { totalassets,sliabilities } = this.form
    //   let tempDebtratio = this.form.debtratio
    //   if (totalassets.value && sliabilities.value ) {
    //     tempDebtratio.value = Number(totalassets.value) / Number(sliabilities.value)
    //     if (String(tempDebtratio.value).indexOf('.') > -1) {
    //      tempDebtratio.value = Number(tempDebtratio.value).toFixed(2)
    //     }
    //   } else {
    //     tempDebtratio.value = ''
    //   }
    //   return tempDebtratio
    // }
  },
  methods: {
    // 初始化表单
    async initForm() {
      let params = {
        serialno: this.enterpriseParams.tempSerialNo
      }
      let res = await qryEnpBasicInfo(params)
      this._.merge(this.form, res.result)
      Object.assign(this.oldForm, this.form)
      // console.log(this.form)
      // console.log(this.oldForm)
      this.$nextTick(() => {
        this.manageForm = Boolean(this.$refs['manageForm'].getElementsByClassName('el-col').length > 0)
        this.expandForm = Boolean(this.$refs['expandForm'].getElementsByClassName('el-col').length > 0)
      })
      this.loading = false
    },
    // 表单提交
    handleSubmit() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          let params = {}
          Object.keys(this.form).forEach(key => {
            params[key] = this.form[key].value
          })
          params.checkFlag = true
          updateEnterpriseBaseInfo(params).then(res => {
            if (res.code === '00') {
              // this.$message.success('提交成功!')
              this.$emit('handleNextPage', true)
            }
          })
        } else {
          this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
          return false
        }
      })
    },
    // 保存草稿
    handleSaveDraft() {
      let params = {}
      Object.keys(this.form).forEach(key => {
        params[key] = this.form[key].value
      })
      params.checkFlag = false
      updateEnterpriseBaseInfo(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 = {}
          Object.keys(this.form).forEach(key => {
            params[key] = this.form[key].value
          })
          params.checkFlag = true
          updateEnterpriseBaseInfo(params).then(res => {
            if (res.code === '00') {
              this.$message.success('保存成功')
              // this.$emit('handleNextPage', true)
              this.oldForm = Object.assign(this.oldForm, this.form)
            }
          })
        } else {
          this.$message.warning('当前页面存在必填项未录入或数据录入错误,请检查!')
          return false
        }
      })
    },
    // 只能输入设置数字
    changMoney(value, config) {
      // console.log(isNaN(value), value, config)
      // 数字
      if (!isNaN(value)) {
        if (config.name === 'registeredcapital') {
          this.form[`${config.name}`].value = this.formatMoney(value)
        }
        // console.log(config.name)
      } else {
        this.form[`${config.name}`].value = ''
        this.$message.warning(`${config.filedDescription}输入有误,请重新输入!`)
      }
    },
  },
  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].value != this.form[key].value) {
            // console.log(this.oldForm[key].value)
            // console.log(this.form[key].value)
            this.$confirm(`当前页面有未保存的数据,是否放弃保存`, '提示', {
              confirmButtonText: '是',
              cancelButtonText: '否',
              customClass: 'enp_messages_box',
              confirmButtonClass: 'enp_messages_box_confirm',
              cancelButtonClass: 'enp_messages_box_cancel',
              center: true
            })
              .then(() => {
                next()
              })
              .catch(() => {
                this.$emit('notNext')
              })
            return
          }
        }
      }
    }
    next()
  }
}
</script>
 
<style scoped></style>