Prechádzať zdrojové kódy

修改pdf导出方向

gongwencan 4 mesiacov pred
rodič
commit
4861efc13b

+ 5 - 0
src/api/TagApplyApi.js

@@ -45,6 +45,11 @@ class TagApplyApi extends BaseCurdApi {
     data: data
   })
 
+  exportDetail = (id) => this.api({
+    url: `${this.basePath}/order/${id}`,
+    method: 'GET'
+  })
+
   constructor () {
     super('/tag/apply')
   }

+ 10 - 11
src/components/DialogTagApplyOrderExport.vue

@@ -30,8 +30,8 @@
               <th><div class="cell">申领人员</div></th>
               <th><div class="cell">标签类型</div></th>
               <th><div class="cell">创建日期</div></th>
-              <th><div class="cell">需求数量</div></th>
               <th><div class="cell">单价(元)</div></th>
+              <th><div class="cell">需求数量</div></th>
               <th><div class="cell">小计(元)</div></th>
             </tr>
           </thead>
@@ -42,18 +42,13 @@
               <td align="center"><div class="cell">{{ applicantName }}</div></td>
               <td align="center"><div class="cell">{{ item.tagTypeName}}</div></td>
               <td align="center"><div class="cell">{{ formatDataTime }}</div></td>
-              <td align="center"><div class="cell">{{ item.number }}</div></td>
               <td align="center"><div class="cell">{{ item.unitPrice }}</div></td>
+              <td align="center"><div class="cell">{{ item.number }}</div></td>
               <td align="center"><div class="cell">{{ item.amount }}</div></td>
             </tr>
             <tr>
-              <td align="center"><div class="cell">总计</div></td>
-              <td><div class="cell"></div></td>
-              <td><div class="cell"></div></td>
-              <td><div class="cell"></div></td>
-              <td><div class="cell"></div></td>
+              <td align="center" colspan="6"><div class="cell">总计</div></td>
               <td align="center"><div class="cell">{{number}}</div></td>
-              <td><div class="cell"></div></td>
               <td align="center"><div class="cell">{{amount}}</div></td>
             </tr>
           </tbody>
@@ -62,11 +57,11 @@
       <div class="flex layout-gap" style="padding-top:30px;">
         <div class="flex flex-1" style="gap:5px">
           <label>制单人:</label>
-          <div class="flex-1 fit-size"></div>
+          <div class="flex-1 fit-size">{{ this.data && this.data.operatorName ? this.data.operatorName : '' }}</div>
         </div>
         <div class="flex flex-1" style="gap:5px">
           <label>日期:</label>
-          <div class="flex-1 fit-size"></div>
+          <div class="flex-1 fit-size">{{ this.data && this.data.dataTime ? formatDate(data.dataTime) : '' }}</div>
         </div>
         <div class="flex flex-1" style="gap:5px">
           <label>需求单位(签章):</label>
@@ -74,7 +69,7 @@
         </div>
         <div class="flex" style="gap:5px">
           <label>日期:</label>
-          <div style="width:100px"></div>
+          <div style="width:100px">{{ this.data && this.data.dataTime ? formatDate(data.dataTime) : ''}}</div>
         </div>
       </div>
     </pdf-exporter>
@@ -153,6 +148,10 @@ export default {
     },
     delay (ms) {
       return new Promise(resolve => setTimeout(resolve, ms))
+    },
+    formatDate (date) {
+      if (!date) return ''
+      return new Date(date).format('yyyy-MM-dd')
     }
   }
 }

+ 1 - 1
src/components/PdfExporter.vue

@@ -24,7 +24,7 @@ export default {
     async getPDFDoc () {
       const imgData = await this.getImgData()
       const doc = new JsPDF({
-        orientation: 'l',
+        orientation: 'p',
         unit: 'px',
         format: 'a4'
       })

+ 1 - 1
src/views/TagApply.vue

@@ -246,7 +246,7 @@ export default {
     async onExportOrderBtnClick () {
       const dataList = []
       const promises = this.selectedList.map(item => {
-        return this.$$request(TagApply.$$api.getDetail, item, this)
+        return this.$$request(TagApply.$$api.exportDetail, item.id, this)
           .then(data => {
             dataList.push(data)
           })