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
<template>
  <div>
    <el-container>
      <el-main style="padding:0px">
        <el-form :label-position="labelPosition" :model="form">
          <el-row>
            <p class="title">申报信息</p>
            <el-col :span="24" v-if="config.remark.visible" class="el-form-textarea">
              <area-text
                :input-type="'textarea'"
                :input-rows="3"
                :config="config.remark"
                :placeholder="applyInfoTip"
                v-model="form.remark"
                :placeholderContent="'地区申请项目准入需严格履行尽调责任,请简要概括含楼盘介绍、开发商股东及历史开发楼盘介绍、本项目优劣势及风险点提示等信息。'"
              ></area-text>
            </el-col>
          </el-row>
                    <el-row v-if="config.changetype.visible">
                        <el-col :span="8">
                            <!-- <el-form-item :label="config.changetype.filedDescription" class="changeType">
                                <el-select  v-model="value" placeholder="请选择" :disabled="config.changetype.writeAble" >
                                    <el-option
                                        v-for="item in options"
                                        :key="item.value"
                                        :label="item.valueDesc"
                                        :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item> -->
                            <area-select :config="config.changetype" v-model="form.changetype" class="changeType"></area-select>
                        </el-col>
                    </el-row>
                    <el-row v-if="config.changeinfo.visible">
            <el-col :span="24" class="el-form-textarea">
                            <!-- <el-input type="textarea" :rows="5" v-model="config.changeinfo.value" :readonly="!config.changeinfo.writeAble" resize="none" ></el-input> -->
                            <area-text
                                :input-type="'textarea'"
                                :input-rows="3"
                                :config="config.changeinfo"
                                v-model="form.changeinfo"
                            ></area-text>
            </el-col>
          </el-row>
        </el-form>
      </el-main>
    </el-container>
  </div>
</template>
 
<script>
import { queryProjectDeclarationInfo, updateProjectDeclarationInfo, projectQrycondition } from '@/api/area'
import { mapState } from 'vuex'
import AreaInput from '../../components/AreaInput'
import AreaText from '../../components/AreaText'
import AreaSelect from '../../components/AreaSelect'
export default {
  // 申报信息
  components: { AreaInput, AreaText, AreaSelect },
  props: ['nextChange'],
  data: function() {
    return {
      labelPosition: 'right',
      form: {
        remark: '',
                changetype: '',
                changeinfo: ''
      },
      oldForm: {},
            options: '',
            value: '',
      config: {},
      applyInfoTip: '地区申请项目准入需严格履行尽调责任,请简要概括含楼盘介绍、开发商股东及历史开发楼盘介绍、本项目优劣势及风险点提示等信息。'
    }
  },
  computed: {
    ...mapState({
      detailsParams: state => state.risk.detailsParams
    })
  },
  created() {
    this.nextChangeCopy = this.nextChange
    this.getForm()
  },
  methods: {
    getForm() {
      // 初始化表单
      const { menuPhaseNo } = this.detailsParams
      this.config = Object.assign({}, this.config, this.form)
      Object.keys(this.config).forEach(key => {
        let params = {
          visible: false,
          required: false,
          writeAble: false
        }
        this.$set(this.config, key, params)
      })
      let params = {
        objectType: this.detailsParams.objectType,
        dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
        serialno: this.detailsParams.objectNo
      }
      queryProjectDeclarationInfo(params).then(res => {
                this.config = this._.merge(this.config, res.result)
                if (res.result.hasOwnProperty('changetype') && res.result.hasOwnProperty('changeinfo')) {
                    this.getChangeType()
                }
        Object.keys(this.form).forEach(key => {
          this.$set(this.form, key, this.config[key].value)
        })
        if (menuPhaseNo === '0040' || menuPhaseNo === '0050') {
          this.config.changeinfo.writeAble = false
        }
        Object.assign(this.oldForm, this.form)
        // console.log(this.oldForm)
      })
    },
    submitForm() {
      let params = {
                remark: this.form.remark,
                changeinfo: this.form.changeinfo,
                changetype: this.form.changetype,
        serialno: this.detailsParams.objectNo,
        objecttype: this.detailsParams.objectType,
                dataType: this.detailsParams.dataType,
        isTempSave: false
      }
            Object.assign(params, this.form)
      updateProjectDeclarationInfo(params).then(res => {
        if (res.code === '00') {
          // this.$message.success(res.result.resultsDesc)
          this.$emit('handleNextPage', true)
        }
      })
    },
    handleSave(saveOpinion) {
      let params = {
                remark: this.form.remark,
                changeinfo: this.form.changeinfo,
                changetype: this.form.changetype,
        serialno: this.detailsParams.objectNo,
        objecttype: this.detailsParams.objectType,
        dataType: this.detailsParams.dataType,
        isTempSave: true
            }
      updateProjectDeclarationInfo(params).then(res => {
        if (res.code === '00') {
                    if (!saveOpinion) {
            this.$message.success('保存成功!')
            this.nextChangeCopy = false
            this.oldForm = Object.assign(this.oldForm, this.form)
                    } else {
            this.$emit('commitSaveBefore', true)
            this.nextChangeCopy = false
            this.oldForm = Object.assign(this.oldForm, this.form)
                    }
                    // this.$message.success(res.result.resultsDesc)
                    // return true
                } else {
                    this.$emit('commitSaveBefore', false)
                }
      })
        },
        handleSaveDraft() {
      let params = {
                remark: this.form.remark,
                changeinfo: this.form.changeinfo,
                changetype: this.form.changetype,
        serialno: this.detailsParams.objectNo,
        objecttype: this.detailsParams.objectType,
                dataType: this.detailsParams.dataType,
        isTempSave: false
      }
            Object.assign(params, this.form)
      updateProjectDeclarationInfo(params).then(res => {
        if (res.code === '00') {
          this.$message.success('保存成功')
          // this.$emit('handleNextPage', true)
          this.oldForm = Object.assign(this.oldForm, this.form)
        }
      })
    },
        getChangeType() {
            let params = { conditionName: this.config.changetype.codeNo }
            projectQrycondition(params).then(res => {
                this.options = res.result
            })
        }
  },
  beforeRouteLeave (to, from, next) {
    // console.log(this.form)
    // console.log(this.oldForm)
    // console.log(this.nextChange)
    if (this.nextChangeCopy) {
      for (const key in this.oldForm) {
        if (this.oldForm.hasOwnProperty(key)) {
          if (this.oldForm[key] != this.form[key]) {
            this.$confirm(`当前页面有未保存的数据,是否放弃保存`, '提示', {
              confirmButtonText: '是',
              cancelButtonText: '否',
              customClass: 'pro_messages_box',
              confirmButtonClass: 'pro_messages_box_confirm',
              cancelButtonClass: 'pro_messages_box_cancel',
              center: true
            })
              .then(() => {
                // this.$emit('realJumpPage',true)
                next()
              })
              .catch(() => {
                // this.$emit('realJumpPage',false)
                this.$emit('notNext')
              })
            return
          }
        }
      }
    }
    next()
  }
}
</script>
 
<style lang="stylus" scoped>
.changeType
    /deep/ .el-form-item__label
        width    145px !important
</style>