From dae799a8795649862836f85461378b07013dafc3 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期三, 12 四月 2023 17:16:59 +0800
Subject: [PATCH] 修改报案添加

---
 src/views/common/Audit.vue |  343 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 213 insertions(+), 130 deletions(-)

diff --git a/src/views/common/Audit.vue b/src/views/common/Audit.vue
index 77bd9ff..35787c2 100644
--- a/src/views/common/Audit.vue
+++ b/src/views/common/Audit.vue
@@ -89,126 +89,57 @@
       <el-pagination @current-change="handleCurrentChange" :current-page="queryInfo.current" :page-size="queryInfo.size"
         layout="prev, pager, next" :total="total"></el-pagination>
     </el-card>
-    <!--娣诲姞浜哄憳寮圭獥-->
-    <el-dialog title="娣诲姞浜哄憳" :visible.sync="addAduitDialogVisible" width="50%" :before-close="addAduitClose">
-      <el-row :gutter="15">
-        <el-form ref="addAduitForm" :model="auditFrom" :rules="rules" size="medium" label-width="100px">
-          <el-col :span="12">
-            <el-form-item label="澶村儚" prop="pic" required>
-              <el-upload ref="pic" action="/api/minio/upload" :show-file-list="false" :on-success="handleAvatarSuccess"
-                list-type="picture-card" accept="image/*">
-                <img v-if="picShow" :src="picShow" style="width: 145px;height: 145px">
-                <i v-else class="el-icon-plus"></i>
-              </el-upload>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="鎶ユ浜� " prop="reporterName">
-              <el-input v-model="auditFrom.reporterName" placeholder="璇疯緭鍏ユ姤妗堜汉 " clearable :style="{ width: '100%' }">
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="鎵嬫満鍙风爜" prop="mobile">
-              <el-input v-model="auditFrom.mobile" placeholder="璇疯緭鍏ユ墜鏈哄彿鐮�" clearable :style="{ width: '100%' }">
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="韬唤璇佸彿" prop="idcard">
-              <el-input v-model="auditFrom.idcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" clearable :style="{ width: '100%' }">
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="琚獥鏃堕棿" prop="cheatTime">
-              <el-date-picker v-model="auditFrom.cheatTime" type="datetime" placeholder="閫夋嫨鏃ユ湡鏃堕棿"
-                :style="{ width: '100%' }" format="yyyy-MM-dd HH:mm:ss"
-                value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="娑夋閲戦" prop="amountInvolved">
-              <el-input v-model="auditFrom.amountInvolved" placeholder="璇疯緭鍏ユ秹妗堥噾棰�" clearable :style="{ width: '100%' }">
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="妗堜欢鎻忚堪" prop="reportDescription">
-              <el-input v-model="auditFrom.reportDescription" placeholder="璇疯緭鍏ユ浠舵弿杩�" clearable
-                :style="{ width: '100%' }">
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="琛ュ厖淇℃伅" prop="information">
-              <el-input v-model="auditFrom.information" type="textarea" placeholder="璇疯緭鍏ヨˉ鍏呬俊鎭�"
-                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-form-item label="涓婁紶" prop="fileList">
-              <el-upload ref="reportMaterials" :file-list="auditFrom.fileList" action="/api/minio/upload"
-                list-type="picture" :on-success="handleMaterialSuccess">
-                <el-button size="small" type="primary" icon="el-icon-upload">鐐瑰嚮涓婁紶</el-button>
-              </el-upload>
-            </el-form-item>
-          </el-col>
-          <!-- <el-col :span="24">
-            <el-form-item label="鍏宠仈妗堜欢" prop="causeId">
-              <el-select v-model="auditFrom.causeId" placeholder="璇烽�夋嫨涓嬫媺閫夋嫨" clearable :style="{width: '50%'}">
-                <el-option v-for="item in causeOptions" :key="item.id" :label="item.name"
-                           :value="item.id"></el-option>
-              </el-select>
-            </el-form-item>
-          </el-col> -->
-        </el-form>
-      </el-row>
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="addAduitDialogVisible = false">鍙� 娑�</el-button>
-
-        <el-button type="primary" @click="addAduit">纭� 瀹�</el-button>
-      </span>
-    </el-dialog>
 
     <!--瀹℃牳寮圭獥-->
-    <el-dialog title="瀹℃牳" :visible.sync="checkVisible" width="50%" :before-close="infoAduitClose">
+    <el-dialog :title="fromTitle" :visible.sync="checkVisible" width="50%" :before-close="infoAduitClose">
       <el-row :gutter="15">
         <el-form ref="infoAduitForm" :rules="rules2" :model="auditInfo" size="medium" label-width="100px">
           <el-col :span="12">
-            <el-form-item label="澶村儚" prop="pic" required>
-
-                <el-image style="width: 145px; height: 145px" :src="picShow" :preview-src-list="new Array(picShow)">
-                </el-image>
+            <el-form-item label="澶村儚" prop="pic" >
+              <el-upload ref="pic" action="/api/minio/upload" :show-file-list="false" :on-success="handleAvatarSuccess"
+                         list-type="picture-card" accept="image/*">
+                <img v-if="picShow" :src="picShow" style="width: 145px;height: 145px">
+                <i v-else class="el-icon-plus"></i>
+              </el-upload>
+<!--                <el-image style="width: 145px; height: 145px" :src="picShow" :preview-src-list="new Array(picShow)">-->
+<!--                </el-image>-->
 
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="鎶ユ浜� ">
-              <el-input v-model="auditInfo.reporterName" disabled :style="{ width: '100%' }"></el-input>
+              <el-input v-model="auditInfo.reporterName" :disabled="fromDis" :style="{ width: '100%' }"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="鎵嬫満鍙风爜">
-              <el-input v-model="auditInfo.mobile" disabled :style="{ width: '100%' }">
+              <el-input v-model="auditInfo.mobile" :disabled="fromDis" :style="{ width: '100%' }">
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="韬唤璇佸彿">
-              <el-input v-model="auditInfo.idcard" disabled :style="{ width: '100%' }">
+              <el-input v-model="auditInfo.idcard" :disabled="fromDis" :style="{ width: '100%' }">
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="琚獥鏃堕棿">
-              <el-input v-model="auditInfo.cheatTime" placeholder="璇烽�夋嫨鎶ユ鏃堕棿 " clearable disabled :style="{ width: '100%' }">
+              <el-date-picker
+                  v-show="fromTitle=='娣诲姞'"
+                  v-model="auditInfo.cheatTime"
+                  type="date"
+                  placeholder="閫夋嫨鏃ユ湡"
+                  value-format="yyyy-MM-dd 00:00:00"
+              >
+              </el-date-picker>
+              <el-input v-show="fromTitle=='瀹℃牳'" v-model="auditInfo.cheatTime" placeholder="璇烽�夋嫨鎶ユ鏃堕棿 " clearable :disabled="fromDis" :style="{ width: '100%' }">
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="娑夋閲戦">
-              <el-input v-model="auditInfo.amountInvolved" placeholder="璇疯緭鍏ユ秹妗堥噾棰�" :style="{ width: '100%' }" disabled>
+              <el-input v-model="auditInfo.amountInvolved" placeholder="璇疯緭鍏ユ秹妗堥噾棰�" :style="{ width: '100%' }" :disabled="fromDis">
               </el-input>
             </el-form-item>
           </el-col>
@@ -229,7 +160,19 @@
               <div class="metalL">
                 <el-tabs v-model="activeName" @tab-click="handleClickTab">
                   <el-tab-pane label="韬唤璇�" name="a">
-                   <div v-for="item in idCardMaterials">
+                    <el-upload
+                        :limit="2"
+                        v-show="fromTitle=='娣诲姞'"
+                        action="/api/minio/upload"
+                        list-type="picture-card"
+                        :with-credentials="true"
+                        :on-preview="handlePictureCardPreview"
+                        :on-success="handIdCardMaterials"
+                        :on-remove="handleRemove"
+                       >
+                      <i slot="default" class="el-icon-plus"></i>
+                    </el-upload>
+                   <div v-show="fromTitle=='瀹℃牳'" v-for="item in idCardMaterials">
                      <el-image
                          style="width: 100px; height: 100px"
                          :src="item"
@@ -237,7 +180,18 @@
                    </div>
                   </el-tab-pane>
                   <el-tab-pane label="鍚堝悓" name="b">
-                    <div v-for="item in contractMaterials">
+                    <el-upload
+                        v-show="fromTitle=='娣诲姞'"
+                        action="/api/minio/upload"
+                        list-type="picture-card"
+                        :with-credentials="true"
+                        :on-preview="handlePictureCardPreview"
+                        :on-success="handContractMaterials"
+                        :on-remove="handleRemove"
+                       >
+                      <i slot="default" class="el-icon-plus"></i>
+                    </el-upload>
+                    <div v-show="fromTitle=='瀹℃牳'" v-for="item in contractMaterials">
                       <el-image
                           style="width: 100px; height: 100px"
                           :src="item"
@@ -245,15 +199,38 @@
                     </div>
                   </el-tab-pane>
                   <el-tab-pane label="浜ゆ槗鍑瘉" name="c">
-                    <div v-for="item in transactionMaterials">
+
+                    <div v-show="fromTitle=='瀹℃牳'" v-for="item in transactionMaterials">
                       <el-image
                           style="width: 100px; height: 100px"
                           :src="item"
                           fit="fill"></el-image>
                     </div>
+                    <el-upload
+                        v-show="fromTitle=='娣诲姞'"
+                        action="/api/minio/upload"
+                        list-type="picture-card"
+                        :with-credentials="true"
+                        :on-preview="handlePictureCardPreview"
+                        :on-success="handTransactionMaterials"
+                        :on-remove="handleRemove"
+                        >
+                      <i slot="default" class="el-icon-plus"></i>
+                    </el-upload>
                   </el-tab-pane>
                   <el-tab-pane label="鍏朵粬" name="d">
-                    <div v-for="item in elseMaterials">
+                    <el-upload
+                        v-show="fromTitle=='娣诲姞'"
+                        action="/api/minio/upload"
+                        list-type="picture-card"
+                        :with-credentials="true"
+                        :on-preview="handlePictureCardPreview"
+                        :on-success="handTlseMaterials"
+                        :on-remove="handleRemove"
+                       >
+                      <i slot="default" class="el-icon-plus"></i>
+                    </el-upload>
+                    <div v-show="fromTitle=='瀹℃牳'" v-for="item in elseMaterials">
                       <el-image
                           style="width: 100px; height: 100px"
                           :src="item"
@@ -275,10 +252,13 @@
       </el-row>
       <span slot="footer" class="dialog-footer">
         <el-button @click="checkVisible = false">鍙� 娑�</el-button>
-        <el-button type="danger" @click="innerLayerVisible =true">椹� 鍥�</el-button>
+        <el-button v-show="fromTitle=='瀹℃牳'" type="danger" @click="innerLayerVisible =true">椹� 鍥�</el-button>
         <el-button type="primary" @click="checkAdd">纭� 瀹�</el-button>
       </span>
-
+      <!-- 鍥剧墖鏀惧ぇ寮圭獥 -->
+      <el-dialog :visible.sync="dialogVisible">
+        <img width="100%" :src="dialogImageUrl" alt="">
+      </el-dialog>
       <el-dialog
           width="30%"
           title="椹冲洖鍘熷洜"
@@ -408,6 +388,14 @@
   name: "Audit",
   data() {
     return {
+      dialogImageUrl: '',
+      dialogVisible: false,
+      fromDis:false,
+      fromTitle:'娣诲姞',
+      idCardList:[],
+      contractList:[],
+      transacList:[],
+      elseList:[],
       idCardMaterials:[],
       contractMaterials:[],
       transactionMaterials:[],
@@ -440,9 +428,11 @@
         fileList: [],
         tmpTime: '',
       },
-      auditInfo: {},
+      auditInfo: {
 
-      picShow: "",
+      },
+
+      picShow: '',
       reportData: [],
       optionsGroup: [
         {
@@ -525,7 +515,7 @@
       },
       rules2:{
         causeId: [
-          { required: true, message: '璇烽�夋嫨娲诲姩鍖哄煙', trigger: 'change' }
+          { required: true, message: '璇烽�夋嫨鍏宠仈妗堜欢', trigger: 'change' }
         ]
       }
     }
@@ -536,6 +526,58 @@
   },
 
   methods: {
+    handTlseMaterials(res){
+      if (res.code === 200) {
+        this.elseList.push({
+          data: res.data
+        })
+      } else {
+        this.$message.error(res.msg)
+      }
+      console.log(res,this.auditInfo)
+    },
+    handTransactionMaterials(res){
+      if (res.code === 200) {
+        this.transacList.push({
+          data: res.data
+        })
+      } else {
+        this.$message.error(res.msg)
+      }
+      console.log(res,this.auditInfo)
+    },
+    handContractMaterials(res){
+      if (res.code === 200) {
+        this.contractList.push({
+          data: res.data
+        })
+      } else {
+        this.$message.error(res.msg)
+      }
+      console.log(res,this.auditInfo)
+    },
+    handIdCardMaterials(res){
+      if (res.code === 200) {
+        this.idCardList.push({
+          data: res.data
+        })
+      } else {
+        this.$message.error(res.msg)
+      }
+      console.log(res,this.auditInfo,this.idCardList)
+
+    },
+
+    // 姝f枃鍥剧墖涓婁紶,鍒犻櫎鎿嶄綔
+    handleRemove(file, fileList) {
+      // file鏄偣鍑诲垹闄ょ殑鏂囦欢锛宖ileList鏃跺垹闄ゅ悗鍓╀笅鐨勬枃浠跺垪琛�
+      console.log(file,fileList)
+      // this.auditInfo.idCardMaterials = fileList[0].response
+    },
+    handlePictureCardPreview(file) {
+      this.dialogImageUrl = file.url
+      this.dialogVisible = true
+    },
     openInnerLayerVisible(){
 
     },
@@ -568,6 +610,7 @@
       }
     },
     rejectionConfirmation(){
+
       let data={
         id:this.auditInfo.id,
         reason:this.reasonForRejectionInput
@@ -582,25 +625,50 @@
     //瀹℃牳纭畾
     checkAdd() {
       let form = null;
-
       form = this.auditInfo;
-      console.log(form)
-      this.$refs.infoAduitForm.validate((valid)=>{
-        if(valid){
-          checkPass(form).then(res => {
-            this.$message.success('鎻愪氦鎴愬姛')
-            this.getList()
-            this.checkVisible = false;
-          })
-        }else{
-          return false;
-        }
+      console.log(form,this.idCardList)
+      //澶勭悊鍥剧墖韬唤璇�
+      if (this.idCardList.length>0){
+        form.idCardMaterials=this.idCardList.map(item=>item.data).join(',')
+      }else {form.idCardMaterials=''}
+      if (this.contractList.length>0){
+        form.contractMaterials=this.contractList.map(item=>item.data).join(',')
+      }else {form.contractMaterials=''}
+      if (this.transacList.length>0){
+        form.transactionMaterials=this.transacList.map(item=>item.data).join(',')
+      }else {form.transactionMaterials=''}
+      if (this.elseList.length>0){
+        form.elseMaterials=this.elseList.map(item=>item.data).join(',')
+      }else {form.elseMaterials=''}
+      if (this.fromTitle=='娣诲姞'){
+        report(form).then(res=>{
+          this.checkVisible=false
+          console.log(res)
+          this.getList()
+        })
+      }else {
 
-      })
+        console.log(form)
+        this.$refs.infoAduitForm.validate((valid)=>{
+          if(valid){
+            checkPass(form).then(res => {
+              this.$message.success('鎻愪氦鎴愬姛')
+              this.getList()
+              this.checkVisible = false;
+            })
+          }else{
+            return false;
+          }
+
+        })
+      }
+
 
     },
     //瀹℃牳
     check(val) {
+      this.fromDis=true
+      this.fromTitle='瀹℃牳'
       getReportById(val).then(res => {
         this.auditInfo = res
         console.log(this.auditInfo)
@@ -665,27 +733,15 @@
       this.reportData = []
       this.picShow = ""
     },
-    addAduit() {
-      this.$refs.addAduitForm.validate(async (vaild) => {
-        if (!vaild) return this.$message.error('杈撳叆鏈夎')
-        this.auditFrom.reportMaterials = this.auditFrom.fileList.map(i => i.data).join(',')
-        report(this.auditFrom).then(res => {
-          this.$message.success('鎻愪氦鎴愬姛')
-          this.auditFrom = {}
-          this.addAduitDialogVisible = false
-          this.getList()
-        }).catch(err => {
-          this.addAduitClose()
-        })
-      })
-    },
+
     async getCauseOptions() {
       const { data: data } = await this.$http.get('/api/cause/getCauseIdAndName');
       this.causeOptions = data.data;
       console.log(this.causeOptions)
     },
-    handleAvatarSuccess(res, file) {
-      this.auditFrom.pic = res.data
+    handleAvatarSuccess(res, file,e) {
+      console.log(res,file)
+      this.auditInfo.pic = res.data
       getImgUrl(res.data).then(res => {
         this.picShow = res
       })
@@ -731,7 +787,34 @@
       this.getList()
     },
     addAduitDialogOpen() {
-      this.addAduitDialogVisible = true
+      // this.addAduitDialogVisible = true
+      this.idCardMaterials=[]
+      this.contractMaterials=[]
+      this.transactionMaterials=[]
+      this.elseMaterials=[]
+      this.fromDis=false
+      this.picShow= ''
+      this.auditInfo= {
+        pic: '',
+        reporterName: '',
+        mobile: '',
+        idcard: '',
+        cheatTime: '',
+        amountInvolved: '',
+        reportDescription: '',
+        information: '',
+        reportMaterials: "",
+        causeId: '',
+        fileList: [],
+        idCardMaterials:[],
+        elseMaterials:[],
+        transactionMaterials:[],
+        contractMaterials:[],
+        tmpTime: '',
+      }
+      this.checkVisible = true
+      this.fromTitle = '娣诲姞'
+
     },
     exportExcel() {
     },

--
Gitblit v1.8.0