Browse Source

出入库申请(撤回)

chris 3 years ago
parent
commit
ed78667f2f
2 changed files with 39 additions and 3 deletions
  1. 8 0
      src/api/warehouse.js
  2. 31 3
      src/views/modules/warehouse/stock-order.vue

+ 8 - 0
src/api/warehouse.js

@@ -66,3 +66,11 @@ export function getBoundDetails (id) {
     method: 'get'
   })
 }
+// 撤回
+export function revokeInOutBound (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/in-out-bound-ctl/revoke`),
+    method: 'post',
+    data
+  })
+}

+ 31 - 3
src/views/modules/warehouse/stock-order.vue

@@ -111,7 +111,7 @@
         <template slot-scope="scope">
           <el-button v-if="isAuth('wh:inbound-record-ctl:info')" type="text" size="small" @click="inBound(scope.row.id, true)">查看</el-button>
           <el-button type="text" size="small" @click="exportItem(scope.row.id)">导出</el-button>
-          <el-button type="text" size="small" @click="cancelItem(scope.row.id)">撤回</el-button>
+          <el-button type="text" size="small" @click="cancelItem(scope.row)">撤回</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -134,6 +134,8 @@
   import UserComponent from '../common/user-component'
   import StockOrderInbound from './stock-order-inbound'
   import StockOrderOutbound from './stock-order-outbound'
+  import { revokeInOutBound } from '@/api/warehouse'
+
   export default {
     name: 'stock-order',
     components: {StockOrderInbound, UserComponent, StockOrderOutbound},
@@ -258,9 +260,35 @@
       },
       // 转换属性“状态”
       formatState (row) {
-        if (!row.purchaseState) return ''
-        const item1 = this.optionsState.find((item) => item.code === row.purchaseState.toString())
+        if (!row.state) return ''
+        const item1 = this.optionsState.find((item) => item.code === row.state.toString())
         return item1 ? item1.value : ''
+      },
+      // 导出
+      exportItem (id) {
+        // todo
+        this.$message.warning('功能暂未开放')
+      },
+      // 撤回
+      async cancelItem (row) {
+        if (row.state === '0') {
+          this.$message.warning('不允许撤回,请先提交!')
+          return
+        }
+        await revokeInOutBound({'id': row.id}).then(({data}) => {
+          if (data && data.code === '200') {
+            this.$message({
+              message: '操作成功',
+              type: 'success',
+              duration: 1500,
+              onClose: () => {
+                this.getDataList()
+              }
+            })
+          } else {
+            this.$message.error(data.msg)
+          }
+        })
       }
     }
   }