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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<template>
  <div class="imageData">
    <div class="imageList">
      <div class="images" v-for="(item,index) in imageMenuList" :key="index" ref="images">
        <p>
          <i v-if="item.ismandatory == 1">*</i>
          {{item.imagelistname}}
          <span>{{item.imagenum?`(${item.imagenum}张)`:''}}</span>
        </p>
        <div
          ref="imagesFloat"
          :class="['imagesList',{'danger':activeIndex==index},{'search':searchIndex==index}]"
        >
          <div
            v-for="(child,i) in item.images"
            :key="i"
            v-show="fullScreen>1460?i>2?false:true:i>1?false:true"
          >
            <span
              class="el-icon-error"
              @click="handleRemove(child,index)"
              v-if="child.iseEditor=='02' && item.isedit"
            ></span>
            <div>
              <img
                class="svg"
                src="@assets/PDF.svg"
                v-if="child.imagetype=='PDF'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/excel.svg"
                v-else-if="child.imagetype=='XLSX'||child.imagetype=='XLS'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/word.svg"
                v-else-if="child.imagetype=='DOCX'||child.imagetype=='DOC'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/TXT.svg"
                v-else-if="child.imagetype=='TXT'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/mp4.svg"
                v-else-if="child.imagetype=='MP4'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/rar.svg"
                v-else-if="child.imagetype=='ZIP'||child.imagetype=='RAR'||child.imagetype=='7Z'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                v-else
                :src="child.resizeUrl?`${child.resizeUrl}/60/90`:child.url"
                alt
                @click="previewImage(child,item.isedit)"
              />
            </div>
            <p
              :title="child.fileName.substring(item.imagelistname.length+1)"
            >{{child.fileName.substring(item.imagelistname.length+1)}}</p>
          </div>
          <img
            src="@assets/images/show.png"
            alt
            @click.stop="show(item)"
          />
          <el-upload
            :ref="index"
            multiple
            drag
            name="files"
            :limit="50"
            :action="url"
            :data="item.imagesData"
            list-type="picture-card"
            v-if="item.isedit==1"
            :on-success="function (res,file){return handleAvatarSuccess(res,file,index)}"
            :before-upload="beforeAvatarUpload"
          >
            <i class="el-icon-plus"></i>
            <div class="el-upload__text">本地上传</div>
          </el-upload>
        </div>
        <div
          ref="imagesFloat"
          @click.stop
          :class="['imagesFloat',{'search':searchIndex==index}]"
          v-show="item.isShow&&(fullScreen>1460?item.images.length>3:item.images.length>2)"
        >
          <div v-for="(child,i) in item.images" :key="i">
            <span
              class="el-icon-error"
              @click="handleRemove(child,index)"
              v-if="child.iseEditor=='02' && item.isedit"
            ></span>
            <div>
              <img
                class="svg"
                src="@assets/PDF.svg"
                v-if="child.imagetype=='PDF'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/excel.svg"
                v-else-if="child.imagetype=='XLSX'||child.imagetype=='XLS'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/word.svg"
                v-else-if="child.imagetype=='DOCX'||child.imagetype=='DOC'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/TXT.svg"
                v-else-if="child.imagetype=='TXT'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/mp4.svg"
                v-else-if="child.imagetype=='MP4'"
                alt
                @click="previewImage(child,item.isedit)"
              />
              <img
                class="svg"
                src="@assets/rar.svg"
                v-else-if="child.imagetype=='ZIP'||child.imagetype=='RAR'||child.imagetype=='7Z'"
                @click="previewImage(child,item.isedit)"
                alt
              />
              <img
                v-else
                :src="child.resizeUrl?`${child.resizeUrl}/60/90`:child.url"
                alt
                @click="previewImage(child,item.isedit)"
              />
            </div>
            <p
              :title="child.fileName.substring(item.imagelistname.length+1)"
            >{{child.fileName.substring(item.imagelistname.length+1)}}</p>
          </div>
          <img src="@assets/images/hide.png" alt @click.stop="hide(item,index)" />
          <el-upload
            :ref="index"
            multiple
            drag
            name="files"
            :limit="50"
            :action="url"
            :data="item.imagesData"
            accept=".pdf, image/*, .doc, .docx, .xlsx, .xls,.zip,.rar,.7z"
            list-type="picture-card"
            v-if="item.isedit==1"
            :on-success="function (res,file){return handleAvatarSuccess(res,file,index)}"
            :before-upload="beforeAvatarUpload"
          >
            <i class="el-icon-plus"></i>
            <div class="el-upload__text">本地上传</div>
          </el-upload>
        </div>
      </div>
    </div>
    <div class="default" v-if="!$parent._data.loading&&!imageMenuList.length">
      <img src="@assets/images/default.png" alt />
    </div>
    <Success :visible="success" v-on:closeDialog="closeDialog"></Success>
    <Fail :visible="fail" :reason="reason" v-on:closeDialog="closeDialog"></Fail>
  </div>
</template>
<script>
import "./index.styl";
import common from "@/utils/common";
import {
  qryCustomerInformationMenuList,
  TypeQueryEcmPageList,
  queryCustomerEcmPage,
  deleteFile,
  notOpinionSubmit,
  uploadCustomerImageFile,
  deleteZbdAlterFile,
  zbdAlterSumbit
} from "@/api/product";
import Success from "../../components/Success";
import Fail from "../../components/Fail";
export default {
  data() {
    return {
      applyInfo: this.$store.state.product.applyInfo,
      applyMenu: this.$store.state.product.applyMenu,
      url: "",
      imageMenuList: [],
      success: false,
      fail: false,
      reason: "",
      activeIndex: null,
      searchIndex: null,
      newWindow: null,
      isAddEvent: false,
      fullScreen: document.documentElement.clientWidth,
      search: ""
    };
  },
  created() {
    this.$parent._data.loading = true;
    this.getImageMenuList();
  },
  components: {
    Success,
    Fail
  },
  beforeDestroy() {
    this.removeMessage();
    window.removeEventListener("click", this.handleClose);
  },
 
  mounted() {
    window.onresize = () => {
      return (() => {
        this.fullScreen = document.body.clientWidth;
      })();
    };
    this.$nextTick(() => {
      window.addEventListener("click", this.handleClose);
    });
  },
  methods: {
    handleClose(e) {
      for (let i = 0; i < this.imageMenuList.length; i++) {
        if (
          this.imageMenuList[i].isShow &&
          (this.fullScreen > 1460
            ? this.imageMenuList[i].images.length > 3
            : this.imageMenuList[i].images.length > 2)
        ) {
          if (!this.$refs.imagesFloat[i].contains(e.target)) {
            this.$set(this.imageMenuList[i], "isShow", false);
          }
          break;
        }
      }
    },
    handleSearch() {
      if (!this.search) {
        this.searchIndex = null;
        this.$refs.images[0].scrollIntoView();
        return;
      }
      for (let i = 0; i < this.imageMenuList.length; i++) {
        if (this.imageMenuList[i].imagelistname.indexOf(this.search) != -1) {
          this.searchIndex = i;
          this.$refs.images[i].scrollIntoView();
          break;
        }
      }
    },
    // 订阅预览页消息
    getMessage() {
      const { newWindow } = this;
      // 避免重复绑定
      this.removeMessage();
      this.isAddEvent = true;
      newWindow.addEventListener(
        "message",
        (info = {}) => {
          try {
            let { data } = info;
            data = data || {};
            // data可能为空字符串,对象,或字符串对象
            data = typeof data === "string" ? JSON.parse(data) : data;
            const { type } = data;
            // 如果在预览也删除图片,则刷新当前数据
            if (type === "deleteImg") {
              this.getImageMenuList();
            }
          } catch (e) {
            console.log(e);
          }
        },
        false
      );
    },
    removeMessage() {
      const { newWindow, getMessage } = this;
      if (newWindow) {
        newWindow.removeEventListener("message", getMessage, false);
      }
    },
    // 点击图片进行预览
    previewImage(row, isEdit) {
      let { newWindow } = this;
      const routeStr = location.href.includes("#") ? "#/" : "";
      if (newWindow) {
        newWindow.close();
      }
      const id = this.$route.params.id
      const indInfoPreSerialno = this.$route.query.indInfoPreSerialno
      newWindow = window.open(
        `${location.origin}${process.env.VUE_APP_HOST_PATH}${routeStr}photoViewer?serialno=${row.serialno}&customerId=${id}&indInfoPreSerialno=${indInfoPreSerialno}&typeno=${row.typeno}&businessno=${this.applyInfo.serialNo}&isEdit=${isEdit}`,
        "newwindow",
        "height=700px, width=800px, top=100px,left=400px, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no"
      );
 
      this.newWindow = newWindow;
 
      // 若图片展示页面删除图片,则通知刷新列表图片
      this.getMessage();
    },
    // 查询影像件信息
    async getImageMenuList(i) {
      let response;
      const {
        serialNo,
        objectType,
        phaseNo,
        flowno,
        alterobjecttype,
        alterobjectno
      } = this.applyInfo;
      const id = this.$route.params.id
      const indInfoPreSerialno = this.$route.query.indInfoPreSerialno
      const res = await qryCustomerInformationMenuList({
        objectno: id,
        indInfoPreSerialno
      });
      if (res.code == "00") {
        this.url = "/rlc-cts/server/uploadCustomerInfoImageFile";
        response = await queryCustomerEcmPage({
          customerId: id,
          indInfoPreSerialno
        });
        
        if (response.code == "00") {
          res.result.forEach((value, index) => {
            // value.imagesData作为文件上传需要携带的参数
            value.imagesData = {};
            value.imagesData.customerid = value.customerid;
            value.imagesData.typeno = value.imagelistcode;
            value.imagesData.objectno = serialNo;
            value.imagesData.indInfoPreSerialno = indInfoPreSerialno
            value.imagesData.objectno = indInfoPreSerialno
            value.imagesData.phaseno = phaseNo;
            if (flowno == "ZBDEntInfoAlterFlow") {
              value.imagesData.alterobjecttype = alterobjecttype;
              value.imagesData.alterobjectno = alterobjectno;
            }
            // 获取对应的图片列表信息
            value.images = [];
            if (response.result.length) {
              response.result.forEach(item => {
                if (
                  value.imagelistcode == item.typeno &&
                  value.customerid == item.customerid
                ) {
                  item.imagetype = item.imagetype.toUpperCase()
                  value.images.push(item);
                }
                // 这里后台接口是根据请求头返回的origin添加的ip或者域名,本地调试需要替换(具体可看下后台返回的url地址)
                if (item.resizeUrl.indexOf("http://localhost") != -1) {
                  item.resizeUrl = item.resizeUrl.replace(
                    "http://localhost:8080",
                    "http://10.10.16.114"
                  );
                }
              });
            }
            if (index == i) {
              value.isShow = true;
            } else {
              value.isShow = false;
            }
            if(this.$route.query.isEdit == 'true'){
              value.isedit == true
            }else{
              value.isedit = false
            }
          });
          console.log('imageMenuList',this.imageMenuList)
          this.$parent._data.loading = false;
        }
        this.imageMenuList = res.result;
      }
    },
    // 上传文件前
    beforeAvatarUpload(file) {
      let isfile;
      if (file.type && file.type.split("/")[0] == "image") {
        isfile = true;
      } else {
        const fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
        isfile =
          fileType === "pdf" ||
          fileType === "docx" ||
          fileType === "xls" ||
          fileType === "xlsx" ||
          fileType === "txt" ||
          fileType === "doc" ||
          fileType === "zip"||
          fileType === "rar"||
          fileType === "7z"
          ;
      }
      if (!isfile) {
        this.$message.warning("该上传文件类型暂不支持,请重新上传!");
        return isfile;
      }
      this.$parent._data.loading = true;
    },
    // 上传成功
    handleAvatarSuccess(res, file, index) {
      // this.$message.success('上传成功')
      this.getImageMenuList(index);
    },
    // 删除图片
    handleRemove(row, index) {
      const { flowno } = this.applyInfo;
      const { serialno } = row;
      common.comfirm("提示", "请确认是否需要删除?", async () => {
        this.$parent._data.loading = true;
        const res =
          flowno == "ZBDEntInfoAlterFlow"
            ? await deleteZbdAlterFile({ serialno })
            : await deleteFile({ serialno });
        this.$parent._data.loading = false;
        if (res.code == "00") {
          this.$message.success("删除成功");
          this.getImageMenuList(index);
        }
      });
    },
    // 展开图片
    show(row) {
      this.imageMenuList.forEach(item => {
        this.$set(item, "isShow", false);
      });
      row.isShow = true;
    },
    // 收起图片
    hide(row) {
      row.isShow = false;
    },
    // 上一步
    prevStep() {
      this.applyMenu.forEach((val, index) => {
        if (val.tabname == "影像资料信息") {
          common.tabInfo(
            this.applyMenu[index - 1].tabname,
            this.applyInfo.flowno,
            this
          );
        }
      });
    },
    // 下一页
    nextPage(array) {
      this.applyMenu.forEach((val, index) => {
        if (val.tabname == "影像资料信息") {
          common.tabInfo(
            this.applyMenu[index + 1].tabname,
            this.applyInfo.flowno,
            this
          );
        }
      });
    },
    // 下一步
    async submit(array) {
      this.activeIndex = null;
      for (let i = 0; i < array.length; i++) {
        if (array[i].ismandatory == 1 && !array[i].images.length) {
          this.activeIndex = i;
        }
      }
      if (this.activeIndex !== null) {
        this.$message.warning("当前页面有必填项未上传影像,请重新检查");
        return;
      }
      this.$parent._data.loading = true;
      const { flowno, ftSerialNo, serialNo, alterobjectno } = this.applyInfo;
      const params = {
        ftSerialNo,
        channel: "00",
        objectno: flowno == "ZBDEntInfoAlterFlow" ? alterobjectno : serialNo
      };
      const res =
        flowno == "ZBDEntInfoAlterFlow"
          ? await zbdAlterSumbit({ phasechoice: '01', ...params })
          : await notOpinionSubmit(params);
      this.$parent._data.loading = false;
      if (res.code == "00") {
        // 打开提交成功弹窗
        this.success = true;
      } else {
        // 审批意见提交失败
        this.reason = res.msg;
        this.fail = true;
      }
    },
    closeDialog(data) {
      this.fail = data;
      this.success = data;
    }
  }
};
</script>