瀏覽代碼

采购需求单导出接口

黄梓星 2 年之前
父節點
當前提交
58887bbf07

+ 8 - 0
src/api/purchase/purchaseDemand.js

@@ -62,4 +62,12 @@ export function downLoadDemand(data) {
     data: data,
     responseType: 'blob'
   })
+}
+// 采购需求单导出
+export function exportDemand(data) {
+  return request({
+    url: `/pu/demand/export`,
+    method: 'post',
+    data: data,
+  })
 }

+ 5 - 1
src/views/purchase/PurchaseDemandList/add.vue

@@ -532,10 +532,14 @@ export default {
   },
   methods: {
     copy() {
-
+      this.$modal.msgSuccess("复制成功");
+      this.pageStu = 'add'
+      this.getDetails(this.row)
     },
     save() {
       if(this.pageStu == 'add') {
+        // 复制新增把id置为空
+        this.basicForm.id = ''
         addDemand(this.basicForm).then(res => {
           if (res.code === 200) {
             this.$modal.msgSuccess("保存成功");

+ 22 - 5
src/views/purchase/PurchaseDemandList/index.vue

@@ -178,13 +178,13 @@
             </el-dropdown-menu>
           </el-dropdown>
 
-          <el-dropdown size="small" @command="handleCommand">
+          <el-dropdown size="small" @command="handleExport">
             <el-button size="small" type="primary" style="margin: 0 10px;">
               导出<i class="el-icon-arrow-down el-icon--right"></i>
             </el-button>
             <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item command="Excel导出">Excel导出</el-dropdown-item>
-              <el-dropdown-item command="导出明细">导出明细</el-dropdown-item>
+              <el-dropdown-item command="选中导出">选中导出</el-dropdown-item>
+              <el-dropdown-item command="全部导出">全部导出</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
 
@@ -245,7 +245,7 @@
 <script>
 import Add from './add.vue'
 import CollapseTransition from '@/components/MyCollapse/collapse.vue'
-import {getDemandList, delDemand, downLoadDemand} from '@/api/purchase/purchaseDemand.js'
+import {getDemandList, delDemand, downLoadDemand, exportDemand } from '@/api/purchase/purchaseDemand.js'
 export default {
   name: 'PurchaseDemandList',
   components: {
@@ -326,6 +326,23 @@ export default {
         })
       }
     },
+    handleExport(command) {
+      if(command == '选中导出') {
+        if (this.ids.length == 0) {
+          this.$modal.msgWarning("请选中至少一条数据");
+        } else {
+          let param = {all: false, ids: this.ids}
+          exportDemand(param).then(res => {
+
+          })
+        }
+      } else {
+        let param2 = {all: true}
+        exportDemand(param2).then(res => {
+
+        })
+      }
+    },
     addDivision() {
       this.isList = false
       this.page = 'add'
@@ -346,7 +363,7 @@ export default {
     // 行内删除
     deleteids(row) {
       console.log('row', row)
-      this.$modal.confirm('确认信息').then(() => {
+      this.$modal.confirm('确定删除选择数据?').then(() => {
         delDemand(row.id).then(res => {
           if (res.code === 200) {
             this.$modal.msgSuccess("删除成功");