Forráskód Böngészése

采购详情页 已完结单据可导出产品

chenrui 3 éve
szülő
commit
04222c04a4

+ 9 - 1
src/api/purchase.js

@@ -159,7 +159,7 @@ export const purchaseDetailBatchInsert = params => {
     method: 'post'
   })
 }
-// 销售 详情  导出
+// 采购 详情  导出
 export const purchaseDetailExport = params => {
   return axios.request({
     url: `/purchase/excel/${params.sn}`,
@@ -167,3 +167,11 @@ export const purchaseDetailExport = params => {
     responseType: 'blob'
   })
 }
+// 采购 详情 导出产品
+export const purchaseExportDetail = params => {
+  return axios.request({
+    url: `/purchase/exportDetail/${params.sn}`,
+    method: 'get',
+    responseType: 'blob'
+  })
+}

+ 34 - 10
src/views/purchasingManagement/purchaseOrder/detail.vue

@@ -10,20 +10,35 @@
           <a-tag color="orange">{{ detail&&detail.financialStatusDictValue }}</a-tag>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
-        <template slot="extra" v-if="$hasPermissions('B_purchasePrint')">
-          <a-radio-group key="4" v-model="printerType">
+        <template slot="extra">
+          <a-radio-group key="5" v-model="printerType" v-if="$hasPermissions('B_purchasePrint')">
             <a-radio value="NEEDLE">针式</a-radio>
             <a-radio value="INK">喷墨</a-radio>
           </a-radio-group>
-          <a-button key="3" id="purchaseOrderDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
-          <a-button key="2" type="primary" id="purchaseOrderDetail-print-btn" :disabled="localDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
+          <a-button key="4" v-if="$hasPermissions('B_purchasePrint')" id="purchaseOrderDetail-preview-btn" :disabled="localDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
           <a-button
-            key="1"
+            key="3"
+            v-if="$hasPermissions('B_purchasePrint')"
+            type="primary"
+            id="purchaseOrderDetail-print-btn"
+            :disabled="localDataSource.length==0"
+            @click="handlePrint('print')">快捷打印</a-button>
+          <a-button
+            key="2"
+            v-if="$hasPermissions('B_purchasePrint')"
             type="primary"
             class="button-warning"
             id="purchaseOrderDetail-export-btn"
             :disabled="localDataSource.length==0"
             @click="handlePrint('export')">导出Excel</a-button>
+          <a-button
+            key="1"
+            v-if="$hasPermissions('B_purchaseExportProduct') && (detail&&detail.billStatus=='FINISH')"
+            type="primary"
+            class="button-info"
+            id="purchaseOrderDetail-export-btn"
+            :disabled="localDataSource.length==0"
+            @click="handlePrint('exportProduct')">导出产品</a-button>
         </template>
       </a-page-header>
       <!-- 基础信息 -->
@@ -145,7 +160,7 @@
 <script>
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
-import { purchaseDetailBySn, purchaseDetailPrint, purchaseDetailExport } from '@/api/purchase'
+import { purchaseDetailBySn, purchaseDetailPrint, purchaseDetailExport, purchaseExportDetail } from '@/api/purchase'
 import { purchaseDetailList } from '@/api/purchaseDetail'
 export default {
   components: { STable, VSelect },
@@ -209,6 +224,10 @@ export default {
         url = purchaseDetailExport
         params = { sn: this.$route.params.sn }
       }
+      if (type == 'exportProduct') {
+        url = purchaseExportDetail
+        params = { sn: this.$route.params.sn }
+      }
       url(params).then(res => {
         _this.spinning = false
         if (res.type == 'application/json') {
@@ -222,8 +241,8 @@ export default {
           })
           reader.readAsText(res)
         } else {
-          if (type == 'export') { //  导出
-            this.download(res)
+          if (type == 'export' || type == 'exportProduct') { //  导出
+            this.download(res, type)
           } else {
             this.print(res, type)
           }
@@ -243,14 +262,19 @@ export default {
         window.frames['printfpod'].print()
       }
     },
-    download (data) {
+    download (data, type) {
       if (!data) { return }
       const url = window.URL.createObjectURL(new Blob([data]))
       const link = document.createElement('a')
       link.style.display = 'none'
       link.href = url
       const a = moment().format('YYYYMMDDHHmmss')
-      const fname = '采购' + a
+      let fname = ''
+      if (type == 'export') {
+        fname = '采购' + a
+      } else if (type == 'exportProduct') {
+        fname = '采购产品' + a
+      }
       link.setAttribute('download', fname + '.xlsx')
       document.body.appendChild(link)
       link.click()