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
<!--
 * @Descripttion:
 * @version:
 * @Author: Pengjiantian
 * @Date: 2019-08-26 15:08:09
 * @LastEditors: vann 984797170@qq.com
 * @LastEditTime: 2023-06-06 10:58:54
 -->
<template>
  <div class="imageData">
    <el-row>
      <p class="title">影像资料信息</p>
    </el-row>
    <el-card class="box-card" v-if="state" style="border:none">
      <div
        class="images"
        :style="item.photoDesc ?' width:100%' : ''"
        v-for="(item,index) in items"
        :key="index"
      >
        <p class="title-half" :class="!item.required ? 'not-require':''" :style="item.description === '项目照片'? 'margin-bottom:10px':''">
          <!-- 标题 -->
          <i v-if="item.required">*</i>
          <!-- 是否必填 -->
          {{item.description}}
          <span>{{item.count?`(${item.count}张)`:''}}</span>
          <!-- 当前影像多少张 -->
        </p>
        <p class="title-full" v-if="item.photoDesc">{{item.photoDesc}}</p>
        <!--  -->
        <div class="imagesList" :class="item.photoDesc ? 'imagesList-full': ''">
          <!-- :style="item.photoDesc ? clientWidth === 1202 ? 'width:860px': clientWidth === 1070 ? 'width:780px': clientWidth > 1070 && clientWidth < 1020 ? 'width:780px': ''  : ''" -->
          <!-- 包含所有图片的最外层 -->
          <div
            v-for="(image,i) in item.images"
            :key="i"
            v-show="!item.photoDesc?(item.isShow?true:i>showImageNumber?false:true):(item.isShow?true:i>showImageNumberFull?false:true)"
          >
            <span class="el-icon-error" @click="handleDelete(image.attachmentno)" v-if="imageShow"></span>
            <!-- 删除图片 -->
            <img
              src="@/assets/PDF.svg"
              v-if="image.imagetype=='PDF'"
              alt
              @click="handleImageClick(image,item.objectNo,item.docType)"
            />
            <img
              src="@/assets/rar.svg"
              v-if="image.imagetype=='RAR' || image.imagetype=='ZIP' || image.imagetype=='7Z'"
              alt
              @click="handleImageClick(image,item.objectNo,item.docType)"
            />
            <img
              src="@/assets/excel.svg"
              v-else-if="image.imagetype=='XLSX'"
              alt
              @click="handleImageClick(image,item.objectNo,item.docType)"
            />
            <img
              src="@/assets/ppt.svg"
              v-else-if="image.imagetype=='PPTX'"
              alt
              @click="handleImageClick(image,item.objectNo,item.docType)"
            />
            <img
              src="@/assets/word.svg"
              v-else-if="image.imagetype=='DOCX'"
              alt
              @click="handleImageClick(image,item.objectNo,item.docType)"
            />
            <img
              :src="image.url"
              v-else
              @click="handleImageClick(image,item.objectNo,item.docType)"
            />
          </div>
          <template v-if="!item.photoDesc">
            <img
              src="../../../../assets/images/hide.png"
              alt
              v-show="item.isShow&&item.images.length > showImageIcon"
              @click="hide(item,index)"
            />
            <!-- 多张图右下角的显示图标 -->
            <img
              src="../../../../assets/images/show.png"
              alt
              v-show="!item.isShow&&item.images.length > showImageIcon"
              @click="show(item)"
            />
            <!-- 多张图右下角的显示图标 -->
          </template>
          <template v-else>
            <img
              src="../../../../assets/images/hide.png"
              alt
              v-show="item.isShow&&item.images.length > showImageIconFull"
              @click="hide(item,index)"
            />
            <!-- 多张图右下角的显示图标 -->
            <img
              src="../../../../assets/images/show.png"
              alt
              v-show="!item.isShow&&item.images.length > showImageIconFull"
              @click="show(item)"
            />
            <!-- 多张图右下角的显示图标 -->
          </template>
          <!-- 多张图右下角的显示图标 -->
          <!-- 图片上传 -->
          <div @click="setIndex(index)" style="display: inline-block" v-if="imageShow">
            <el-upload
              action
              :multiple="true"
              list-type="picture-card"
              :headers="uploadHeader"
              :http-request="handleUpload"
              :file-list="fileList"
              :show-file-list="false"
            >
              <i class="el-icon-plus"></i>
            </el-upload>
          </div>
        </div>
      </div>
    </el-card>
  </div>
</template>
 
<script>
import '@/views/area/style/images.styl'
import {
  queryProjectImageInfo,
  addProjectImage,
  deleteProjectImage,
  checkProjectImageInfo
} from '@/api/area'
import { mapState } from 'vuex'
import { updateEnpApproveOpinion } from '../../../../api/area/enterprise'
import { communal } from '@/views/area/mixins'
export default {
  mixins: [communal],
  data: function() {
    return {
      // url: 'http://10.0.23.29:20790/rlc-cts/server/addProjectImage',
      items: '',
      index: '',
      dialogImageUrl: '',
      dialogVisible: false,
      fileData: '',
      fileList: [],
      newWindow: null,
      uploadHeader: {
        'Content-Type': 'multipart/form-data; boundary=ReaquestHeader'
      },
      state: false,
      imageShow: false
    }
  },
  computed: {
    ...mapState({
      detailsParams: state => state.risk.detailsParams
    })
  },
  created() {
    this.getForm()
  },
  methods: {
    getForm(i) {
      let params = {
        // objectType: this.detailsParams.objectType,
        objectType: 'jbo.customer.AUTOTROPHY_INFO',
        dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
        serialno: this.detailsParams.objectNo
      }
      const { exhibitionAllImages, exhibitionAllImagesFull } = this
      queryProjectImageInfo(params).then(res => {
        if (res.code == '00') {
          res.result.forEach((value, index) => {
            if (value.description.includes('项目照片')) {
              value.photoDesc = value.description.slice(4)
              value.description = value.description.slice(0, 4)
            }
            if (value.photoDesc) {
              if (value.images.length < exhibitionAllImagesFull) {
                value.isShow = true
              } else {
                value.isShow = false
              }
              if (value.images.length >= exhibitionAllImagesFull) {
                if (i === index) {
                  this.show(value)
                } else {
                  this.hide(value)
                }
              }
            } else {
              if (value.images.length < exhibitionAllImages) {
                value.isShow = true
              } else {
                value.isShow = false
              }
              if (value.images.length >= exhibitionAllImages) {
                if (i === index) {
                  this.show(value)
                } else {
                  this.hide(value)
                }
              }
            }
            value.images.forEach(item => {
              // item.imagetype = item.filename.split('.')[1].toUpperCase()
              item.imagetype = item.filename
                .split('.')
                .slice(-1)
                .toString()
                .toUpperCase()
            })
          })
          this.items = res.result
          this.state = true
        }
      })
    },
    setIndex(index) {
      this.index = index
    },
    handleDelete(value) {
      // this.$confirm(`请确认是否删除该图片!`, '删除图片确认', {
      //   confirmButtonText: '确定',
      //     cancelButtonText: '取消',
      //     customClass: 'pro_messages_box',
      //     confirmButtonClass: 'pro_messages_box_confirm',
      //     cancelButtonClass: 'pro_messages_box_cancel',
      //   center: true
      // })
      // .then(() => {
      deleteProjectImage(value).then(res => {
        if (res.code === '00') {
          this.$message.success('删除成功!')
          this.getForm()
        }
      })
      // })
      // .catch(() => {})
    },
    handleUpload(file) {
      this.fileData = file.file
      var formData = new FormData()
      formData.append('file', this.fileData)
      formData.append('docNo', this.items[this.index].docNo)
      formData.append('docType', this.items[this.index].docType)
      formData.append('objectNo', this.detailsParams.objectNo)
      // formData.append('objectType', this.detailsParams.objectType)
      formData.append('objectType', 'jbo.customer.AUTOTROPHY_INFO')
      if (this.fileData !== undefined) {
        addProjectImage(formData).then(res => {
          if (res.code === '00') {
            this.getForm(this.index)
          }
        })
      }
    },
    submitForm() {
      let verifyItems = this.items.filter(item => item.required === true)
      let isNull = verifyItems.some(item => this._.isEmpty(item.images))
      if (!isNull) {
        let params = {
          objectType: this.detailsParams.objectType,
          dataType: this.detailsParams.dataType,
          projectFlag: this.detailsParams.projectFlag,
          projectType: this.detailsParams.projectType,
          serialno: this.detailsParams.objectNo,
          isCheck: true
        }
        checkProjectImageInfo(params).then(res => {
          if (res.code === '00') {
            // this.$message.success('提交成功!')
            this.$emit('handleNextPage', true)
          }
        })
      } else {
        this.$message.warning('请检查必填项!')
      }
    },
    handleSave() {
      let verifyItems = this.items.filter(item => item.required === true)
      let isNull = verifyItems.some(item => this._.isEmpty(item.images))
      let params = {
        // objectType: this.detailsParams.objectType,
        objectType: 'jbo.customer.AUTOTROPHY_INFO',
        dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
        serialno: this.detailsParams.objectNo,
        isCheck: true
      }
      checkProjectImageInfo(params).then(res => {
        if (res.code === '00') {
          // this.$message.success('保存成功')
          // this.$emit('handleNextPage', true)
          this.$emit('commitSaveBefore', true)
        } else {
          this.$emit('commitSaveBefore', false)
        }
      })
    },
    handleSaveDraft() {
      let verifyItems = this.items.filter(item => item.required === true)
      // let isNull = verifyItems.some(item => this._.isEmpty(item.images))
      let params = {
        // objectType: this.detailsParams.objectType,
        objectType: 'jbo.customer.AUTOTROPHY_INFO',
        dataType: this.detailsParams.dataType,
        projectFlag: this.detailsParams.projectFlag,
        projectType: this.detailsParams.projectType,
        serialno: this.detailsParams.objectNo,
        isCheck: true
      }
      checkProjectImageInfo(params).then(res => {
        if (res.code === '00') {
          this.$message.success('保存成功')
          // this.$emit('handleNextPage', true)
        }
      })
    },
    handleImageClick(image, objectno, typeno) {
      // console.log(this.detailsParams)
      // 根据路由模式判断路径分割方式
      const routeStr = location.href.includes('#') ? '#/' : ''
      // 图片点击事件
      let attachmentno = image.attachmentno
      let serialno = this.detailsParams.objectNo
      // console.log('image.attachmentno:'+image.attachmentno)
      let objecttype = 'jbo.customer.AUTOTROPHY_INFO'
      let type = '1' // 1-项目 2-企业 3-合作方
      let params = `attachmentno=${attachmentno}&serialno=${serialno}&objectno=${objectno}&objectType=${objecttype}&typeno=${typeno}&type=${type}`
      this.newWindow = window.open(
        `${location.origin}${process.env.VUE_APP_HOST_PATH}${routeStr}photoViewer?${params}`,
        'newwindow',
        'height=700px, width=800px, top=100px,left=400px, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'
      )
    },
    // 展开图片
    show(row) {
      row.isShow = true
    },
    // 收起图片
    hide(row) {
      row.isShow = false
    }
  }
}
</script>
 
<style scoped lang="stylus"></style>