Browse Source

入库确认

chenrui 4 years ago
parent
commit
370ff2b965

+ 3 - 3
src/api/stockPut.js

@@ -11,10 +11,10 @@ export const stockPutList = (params) => {
     method: 'post'
   })
 }
-//  入库确认  添加
-export const stockPutSave = (params) => {
+//  入库确认
+export const stockPutConfirm = (params) => {
   return axios({
-    url: '/stockPut/save',
+    url: '/stockPut/confirm',
     data: params,
     method: 'post'
   })

+ 10 - 15
src/views/financialManagement/warehousingConfirmation/detailModal.vue

@@ -21,6 +21,7 @@
         :rowKey="(record) => record.stockPutSn"
         :columns="columns"
         :data="loadData"
+        :defaultLoadData="false"
         bordered>
       </s-table>
       <div class="btn-cont"><a-button id="confirmationDetail-modal-back" @click="isShow = false">返回列表</a-button></div>
@@ -56,14 +57,14 @@ export default {
       detailsData: null, //  详情数据
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'putTime', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'providerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '入库数量(个)', dataIndex: 'productTotalQty', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '入库成本(¥)', dataIndex: 'productTotalCost', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '入库数量(个)', dataIndex: 'putQty', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '入库成本(¥)', dataIndex: 'putCost', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return stockPutDetailList(Object.assign(parameter, { stockPutSn: this.itemSn })).then(res => {
+        return stockPutDetailList(Object.assign(parameter, { sn: this.itemSn })).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
@@ -89,7 +90,10 @@ export default {
     },
     itemSn (newValue, oldValue) {
       if (this.isShow && newValue) {
-        this.$refs.table.refresh(true)
+        const _this = this
+        setTimeout(() => {
+          _this.$refs.table.refresh(true)
+        }, 200)
       }
     }
   }
@@ -101,18 +105,9 @@ export default {
     .ant-modal-body {
       padding: 40px 40px 24px;
     }
-    .productPic{
-      cursor: pointer;
-      max-width: 100px;
-      max-height: 100px;
-      margin-right: 10px;
-    }
     .btn-cont {
       text-align: center;
       margin: 35px 0 10px;
     }
-    .ant-descriptions-item-label.ant-descriptions-item-colon{
-      width: 120px;
-    }
   }
 </style>

+ 41 - 21
src/views/financialManagement/warehousingConfirmation/list.vue

@@ -68,7 +68,7 @@
 <script>
 import { STable, VSelect } from '@/components'
 import confirmationDetailModal from './detailModal.vue'
-import { stockPutList, stockPutSave } from '@/api/stockPut'
+import { stockPutList, stockPutConfirm } from '@/api/stockPut'
 export default {
   components: { STable, VSelect, confirmationDetailModal },
   data () {
@@ -138,6 +138,7 @@ export default {
     },
     // 详情
     handleDetail (row) {
+      console.log(row)
       this.itemSn = row.stockPutSn
       this.nowData = row
       this.openModal = true
@@ -149,17 +150,40 @@ export default {
     },
     // 单个审核
     handleAudit (row) {
+      const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要上线审核吗?',
+        content: '请点击下方按钮确认操作',
         centered: true,
+        okText: '通过',
+        cancelText: '不通过',
         onOk () {
-          productOnlineAudit({ sn: row.productSn }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-            }
-          })
+          _this.auditOrder([row.stockPutSn], true)
+        },
+        onCancel (e) {
+          if (!e.triggerCancel) {
+            _this.auditOrder([row.stockPutSn], false)
+          }
+          _this.$destroyAll()
+        }
+      })
+    },
+    auditOrder (snList, flag, isBatch) {
+      const _this = this
+      if (isBatch) {
+        _this.loading = true
+      }
+      stockPutConfirm({ stockPutSnList: snList, confirm: flag }).then(res => {
+        if (isBatch) {
+          _this.loading = false
+        }
+        if (res.status == 200) {
+          if (isBatch) {
+            _this.selectedRowKeys = []
+            _this.selectedRows = []
+          }
+          _this.$message.success(res.message)
+          _this.$refs.table.refresh()
         }
       })
     },
@@ -172,22 +196,18 @@ export default {
       }
       this.$confirm({
         title: '提示',
-        content: '确认要批量上线审核吗?',
+        content: '请点击下方按钮批量确认操作',
         centered: true,
+        okText: '通过',
+        cancelText: '不通过',
         onOk () {
-          _this.loading = true
-          productBatchOnlineAudit(_this.selectedRowKeys).then(res => {
-            _this.loading = false
-            if (res.status == 200) {
-              _this.selectedRowKeys = []
-              _this.selectedRows = []
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-            }
-          })
+          _this.auditOrder(_this.selectedRowKeys, true, 'isBatch')
         },
-        onCancel () {
-          console.log('Cancel')
+        onCancel (e) {
+          if (!e.triggerCancel) {
+            _this.auditOrder(_this.selectedRowKeys, false, 'isBatch')
+          }
+          _this.$destroyAll()
         }
       })
     },