Browse Source

装箱单详情附件下载

jbb 2 years ago
parent
commit
5f851eae89

+ 2 - 1
src/views/packing-list/clothes-list.vue

@@ -170,7 +170,7 @@
 
         <!-- 操作 -->
         <span slot="operationSlot" slot-scope="text, record">
-          <a-upload  name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="enclosureUrl"  @change="handleImportExcel" :data="{id:record.id}" >
+          <a-upload  name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"  :action="enclosureUrl"  @change="handleImportExcel" :data="{id:record.id}" >
             <a  style="color:green;" >附件上传</a>
         </a-upload>
           <a-divider type="vertical" />
@@ -699,6 +699,7 @@ export default {
                 depositaryReceiptNo:editData.depositaryReceiptNo,
                 total:editData.total,
             };
+             this.$refs.detailsClothesDrawer.accessory = editData.accessory.split(",")
             this.$refs.detailsClothesDrawer.clothesAddData = editData.syPackingListTailoringItemList
              for (var i=0; i<res.result.syPackingListTailoringItemList.length;i++){
                  var row = res.result.syPackingListTailoringItemList[i];

+ 33 - 0
src/views/packing-list/packinglist-clothes/detailsClothesDrawer.vue

@@ -138,6 +138,16 @@
             </j-vxe-table>
           </a-form-model>
         </a-spin>
+        <a-col :span="12">
+            <a-form-model-item label="附件"  prop="accessory">
+              <ul v-for="(item, index) in accessory" :key="index" >
+                <li>
+                  <a @click="accessoryDownload(item)">{{item}}</a>
+                </li>
+                
+              </ul>
+            </a-form-model-item>
+          </a-col>
       </a-card>
     </a-drawer>
   </div>
@@ -147,6 +157,7 @@
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import { JVXETypes } from '@/components/jeecg/JVxeTable'
 import JEllipsis from '@/components/jeecg/JEllipsis'
+import { downFile } from '@/api/manage'
 
 
 export default {
@@ -163,6 +174,7 @@ export default {
           // // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
           // btn: []
         },
+        accessory:[],
       // 表头
       clothesAddColumns: [
        {
@@ -585,6 +597,27 @@ export default {
         },
       ]
     },
+    accessoryDownload(name){
+       downFile(`/sys/common/static/${name}`).then(data => {
+        if (!data) {
+          this.$message.warning('文件下载失败')
+          return
+        }
+        if (typeof window.navigator.msSaveBlob !== 'undefined') {
+          window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
+        } else {
+          let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
+          let link = document.createElement('a')
+          link.style.display = 'none'
+          link.href = url
+          link.setAttribute('download', name + '.xls')
+          document.body.appendChild(link)
+          link.click()
+          document.body.removeChild(link) // 下载完成移除元素
+          window.URL.revokeObjectURL(url) // 释放掉blob对象
+        }
+      })
+    },
     // - father------------------------------------
     aa() {},
     modalFormOk() {},