瀏覽代碼

7.29 恢复 7.27日pdf替换代码

dqcalymail 2 年之前
父節點
當前提交
3ecb572510
共有 1 個文件被更改,包括 73 次插入36 次删除
  1. 73 36
      src/views/contracts/detail.vue

+ 73 - 36
src/views/contracts/detail.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -16,7 +16,19 @@
             <span class="titlename">合同附件</span>
             <div style="display: flex">
               <div class="imgbox">
-                <el-image
+                <template v-for="(item, index) in picList">
+                  <el-image
+                    v-if="isPDF(item)"
+                    :key="index"
+                    style="width: 100px; height: 100px"
+                    :src="item"
+                    :preview-src-list="picList"
+                  />
+                  <a v-else :key="index" :href="item" target="_blank">
+                    <img style="width: 100px; height: 100px" :src="pdf">
+                  </a>
+                </template>
+                <!-- <el-image
                   v-for="(item) in picList"
                   :key="item.id"
                   style="width: 100px; height: 100px"
@@ -27,7 +39,7 @@
                   :key="item.id"
                   style="width: 100px; height: 100px"
                   :src="item"
-                />
+                /> -->
               </div>
             </div>
           </div>
@@ -35,13 +47,24 @@
             <span class="titlename">发票附件</span>
             <div style="display: flex">
               <div class="imgbox">
-                <el-image
+                <template v-for="(item, index) in invoicePicList">
+                  <el-image
+                    v-if="isPDF(item)"
+                    :key="index"
+                    style="width: 100px; height: 100px"
+                    :src="item"
+                    :preview-src-list="invoicePicList"
+                  />
+                  <a v-else :key="index" :href="item" target="_blank">
+                    <img style="width: 100px; height: 100px" :src="pdf">
+                  </a>
+                </template>
+                <!-- <el-image
                   v-for="(item) in invoicePicList"
                   :key="item.id"
                   style="width: 100px; height: 100px"
                   :src="item"
-                />
-
+                /> -->
               </div>
             </div>
           </div>
@@ -53,13 +76,24 @@
             <span class="titlename">贸易合同</span>
             <div style="display: flex">
               <div class="imgbox">
-                <el-image
+                <template v-for="(item, index) in tradePicList">
+                  <el-image
+                    v-if="isPDF(item)"
+                    :key="index"
+                    style="width: 100px; height: 100px"
+                    :src="item"
+                    :preview-src-list="tradePicList"
+                  />
+                  <a v-else :key="index" :href="item" target="_blank">
+                    <img style="width: 100px; height: 100px" :src="pdf">
+                  </a>
+                </template>
+                <!-- <el-image
                   v-for="(item) in tradePicList"
                   :key="item.id"
                   style="width: 100px; height: 100px"
                   :src="item"
-                />
-
+                /> -->
               </div>
             </div>
           </div>
@@ -70,7 +104,9 @@
                 contract.contractStatusText
               }}</span>
             </div>
-            <span class="aoiisp">审核结果:
+            <span
+              class="aoiisp"
+            >审核结果:
               <p style="color: #d8ab5a">{{ contract.statusText }}</p></span>
           </div>
 
@@ -93,7 +129,7 @@
                     list-type="picture-card"
                     :on-success="handleFeedbackPicList"
                   >
-                  <!-- <img v-if="feed.feedbackPicList" :src="feed.feedbackPicList" class="avatar"> -->
+                    <!-- <img v-if="feed.feedbackPicList" :src="feed.feedbackPicList" class="avatar"> -->
                     <i class="el-icon-plus" />
                   </el-upload>
                   <el-dialog :visible.sync="dialogVisible">
@@ -297,11 +333,9 @@ export default {
   },
 
   mounted() {
-
-    this.role = this.$store.state.user.userInfo.type;
-    this.checked = this.$store.state.user.checked;
-    this.getData();
-
+    this.role = this.$store.state.user.userInfo.type
+    this.checked = this.$store.state.user.checked
+    this.getData()
   },
   methods: {
     getData() {
@@ -310,25 +344,30 @@ export default {
         url: '/api/Contract/' + id,
         method: 'get'
       }).then((res) => {
-        this.contract = res.data;
-        this.invoicePicList = this.contract.invoicePicList;
-        this.picList = this.contract.picList;
-        this.list = res.data.contractDraft.result;
-        this.feed.feedbackPicList = this.contract.feedbackPics;
-        this.tradePicList = this.contract.tradePicList;
-        this.feed.id = this.$route.query.id;
-        this.feed.feedback = this.contract.feedback;
-        this.getPageData();
-      });
-
+        this.contract = res.data
+        this.invoicePicList = this.contract.invoicePicList
+        this.picList = this.contract.picList
+        this.list = res.data.contractDraft.result
+        this.feed.feedbackPicList = this.contract.feedbackPics
+        this.tradePicList = this.contract.tradePicList
+        this.feed.id = this.$route.query.id
+        this.feed.feedback = this.contract.feedback
+        this.getPageData()
+      })
+    },
+    isPDF(url) {
+      const fileType = ['pdf']
+      const index = url.lastIndexOf('.')
+      const type = url.substr(index + 1)
+      return fileType.indexOf(type) === -1
     },
     addNewBill() {
-	  const id = this.$route.query.id
+      const id = this.$route.query.id
       this.$router.push({
         name: 'addnewbill',
-		query:{
-				id:id
-				}
+        query: {
+          id: id
+        }
       })
     },
     tapDetail(id) {
@@ -367,7 +406,6 @@ export default {
       this.temporaryList = this.srcList
     },
 
-
     /* 导出 */
     ExportsContractDraft() {
       if (this.multipleSelection === '') {
@@ -408,12 +446,11 @@ export default {
 
     /* 反馈图片图片上传成功 */
 
-    handleFeedbackPicList(res){
-      //解构
-      const { file } = res.data;
+    handleFeedbackPicList(res) {
+      // 解构
+      const { file } = res.data
       this.feedbackPicListArray.push(file)
-      this.feed.feedbackPicList = this.feedbackPicListArray;
-
+      this.feed.feedbackPicList = this.feedbackPicListArray
     },
 
     /* 审核成功发送请求  */