From 0ddbef100ef7627d50803c729092472012f9f717 Mon Sep 17 00:00:00 2001
From: luoyb <412940104@qq.com>
Date: 星期六, 27 二月 2021 19:33:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/user/archivesEdit.vue |  104 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/src/views/user/archivesEdit.vue b/src/views/user/archivesEdit.vue
index 15bebf1..c820109 100644
--- a/src/views/user/archivesEdit.vue
+++ b/src/views/user/archivesEdit.vue
@@ -12,7 +12,17 @@
     <div class="conDetails">
       <div class="menu dadetails">
         <div>
-          <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1333074204,3035391839&fm=26&gp=0.jpg" class="jbxxImg">
+          <el-upload
+            class="avatar-uploader"
+            action="#"
+            :show-file-list="false"
+            :on-change="handlePictureCardPreview"
+            :auto-upload="false"
+          >
+            <img v-if="empBaseInfoImageUrl" :src="empBaseInfoImageUrl" class="avatar">
+            <i v-else class="el-icon-plus avatar-uploader-icon" />
+          </el-upload>
+          <!-- <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1333074204,3035391839&fm=26&gp=0.jpg" class="jbxxImg">-->
           <div class="title-da">
             {{ this.empBaseInfoForm.empNumb }}
           </div>
@@ -1047,8 +1057,39 @@
           </div>
         </div>
 
+        <div ref="jljt" class="jljt">
+          <div class="jbxxTitle">
+            记录截图
+          </div>
+          <el-button
+            class="filter-item"
+            type="primary"
+            @click.native.prevent="dialogShow"
+          >
+            查看并上传
+          </el-button>
+          <div class="jbxxCon" />
+        </div>
+
+        <div ref="xgfj" class="xgfj">
+          <div class="jbxxTitle">
+            相关附件
+          </div>
+          <el-button
+            class="filter-item"
+            type="primary"
+            @click.native.prevent="dialogShow"
+          >
+            查看并上传
+          </el-button>
+          <div class="jbxxCon" />
+        </div>
+
       </div>
     </div>
+    <el-dialog title="附件管理" append-to-body="true" :visible.sync="dialogShowUploadfj" width="80%" class="fjgl-class" top="10px" @close="closeDialog()">
+      <uploadfj v-if="dialogShowUploadfj" :rowitem="rowitem" />
+    </el-dialog>
     <el-dialog title="工作经历" append-to-body="true" :visible.sync="dialogshowArr[1].show" width="50%">
       <el-form ref="workExperienceForm" :model="workExperienceForm" :rules="workExperienceRules" label-position="right" label-width="120px">
         <el-row>
@@ -2190,6 +2231,8 @@
   },
   data() {
     return {
+      rowitem: {},
+      dialogShowUploadfj: false,
       queryParams: {}, // 查询参数
       sort: {}, // 排序
       pagination: { // 分页参数
@@ -2241,6 +2284,7 @@
           show: false
         }
       ],
+      empBaseInfoImageUrl: '',
       rules: {
         archivesNumb: [{ required: true, message: '请输入档案号', trigger: 'blur' }, {
           max: 20,
@@ -2845,6 +2889,7 @@
       },
       empBaseInfoForm: {
         empId: '',
+        imagePath: '',
         customerId: '',
         archivesNumb: '',
         deptId: '',
@@ -2923,7 +2968,7 @@
       depts: [],
       sysConfig: this.initSysConfig(),
       listType: ['jbxx', 'gzjl', 'tjxx', 'htxx', 'tgjl', 'qjjl', 'czsq', 'lzdykq', 'rlzjl', 'syjlq', 'sbsq', 'ywxaj', 'gsaj', 'lzaj',
-        'bz', 'jljt', 'xgfj', 'bljl'],
+        'bz', 'jljt', 'xgfj', 'bljl', 'jljt', 'xgfj'],
       form: {},
       isAdd: false,
       thisShowIndex: '',
@@ -3187,6 +3232,10 @@
         this.badRecordDatatotal = data.total
         this.badRecordData = data.rows
       })
+    },
+    dialogShow() {
+      this.rowitem = this.empBaseInfoForm
+      this.dialogShowUploadfj = true
     },
     initaccidentCasesData(params = {}) {
       params.pageSize = this.pagination.size
@@ -3528,6 +3577,49 @@
       this.unemploymentForm.modifier = ''
       this.unemploymentForm.delFlag = ''
       this.unemploymentForm.version = ''
+    },
+    handlePictureCardPreview(file) {
+      this.empBaseInfoImageUrl = URL.createObjectURL(file.raw) // 获取URL
+      // 判断图片大小
+      if (file.size < 4400000) {
+        // 判断图片格式是否为jpg,png,jepg,gif
+        var fileName = file.name
+        // var suffixIndex=fileName.lastIndexOf(".")
+        // var suffix=fileName.substring(suffixIndex+1).toUpperCase()
+        var suffix = fileName.substring(fileName.lastIndexOf('.') + 1).toUpperCase()
+        if (suffix === 'JPG' || suffix === 'JPEG' || suffix === 'PNG') {
+          this.preView(this.empBaseInfoImageUrl)
+        } else {
+          this.$message.error('文件类型不正确,请重新上传!')
+        }
+      } else {
+        this.$message.error('图片大小超过4M,请重新上传')
+      }
+    },
+    preView(url) {
+      var this_ = this
+      const reader = new FileReader()
+      this.getImageBlob(url, function(blob) {
+        reader.readAsDataURL(blob)
+      })
+      reader.onload = function(e) {
+        // 获取bolb里面数据时,生成预览
+        var img = document.createElement('img')
+        img.src = e.target.result
+        this_.empBaseInfoForm.imagePath = e.target.result
+      }
+    },
+    // 获取图片的Blob值
+    getImageBlob(url, cb) {
+      var xhr = new XMLHttpRequest()
+      xhr.open('get', url, true)
+      xhr.responseType = 'blob'
+      xhr.onload = function() {
+        if (this.status === 200) {
+          if (cb) cb(this.response)
+        }
+      }
+      xhr.send()
     },
     putInsurance(formName) {
       this.$refs[formName].validate((valid) => {
@@ -4572,6 +4664,14 @@
         case 'bljl':
           item = 17
           break
+        // eslint-disable-next-line no-duplicate-case
+        case 'jljt':
+          item = 18
+          break
+        // eslint-disable-next-line no-duplicate-case
+        case 'xgfj':
+          item = 19
+          break
       }
       this.$nextTick(() => {
         this.$refs.boxDetails.scrollTop = item ? this.$refs[this.listType[item]].offsetTop - 100 : 0

--
Gitblit v1.8.0