Browse Source

Merge commit 'e339444973261601bef7ef6d9b4cd8025294015d' into HEAD

gitadmin 2 years ago
parent
commit
cdc50f3992

+ 10 - 0
src/api/allocLinkagePut.js

@@ -88,3 +88,13 @@ export const allocLinkagePutDetailPrint = params => {
   }
   return axios.request(data)
 }
+
+// 连锁调入列表  导出
+export const allocLinkagePutExport = (params) => {
+  return axios({
+    url: '/allocLinkagePut/detail/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 10 - 0
src/api/allocWarehouse.js

@@ -149,3 +149,13 @@ export const importProductInsertBatch = (params) => {
     method: 'post'
   })
 }
+
+// 仓库调拨列表  导出
+export const allocWarehouseExport = (params) => {
+  return axios({
+    url: '/allocWarehouse/detail/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 11 - 1
src/api/purchaseDetail.js

@@ -79,4 +79,14 @@ export const purchaseDetailDownloadFail = params => {
     data: params,
     responseType: 'blob'
   })
-}
+}
+// 采购单明细导入缺货列表
+export const importOosDetail = (params) => {
+  const url = `/purchaseDetail/importOosDetail/${params.purchaseBillSn}`
+  delete params.purchaseBillSn
+  return axios({
+    url,
+    data: params.arr,
+    method: 'post'
+  })
+}

+ 25 - 1
src/views/allocationManagement/chainTransferIn/list.vue

@@ -58,6 +58,15 @@
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="chainTransferInList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chainTransferInList-reset">重置</a-button>
+              <a-button
+                type="primary"
+                style="margin-left: 5px"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                class="button-warning"
+                v-if="$hasPermissions('B_allocLinkagePutExport')"
+                id="chainTransferInList-export-btn">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -140,9 +149,10 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import { formatDecimal } from '@/libs/tools'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { allocLinkagePutList, allocLinkagePutAudit, allocLinkagePutQueryCount } from '@/api/allocLinkagePut'
+import { allocLinkagePutList, allocLinkagePutAudit, allocLinkagePutQueryCount, allocLinkagePutExport } from '@/api/allocLinkagePut'
 import getTenantList from '@/views/common/getTenantList.js'
 import stateIcon from '@/views/common/stateIcon'
+import { downloadExcel } from '@/libs/JGPrint.js'
 export default {
   name: 'AllocLinkagePutList',
   components: { STable, VSelect, rangeDate, stateIcon, getTenantList },
@@ -162,6 +172,7 @@ export default {
         settleState: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false, // 导出
       countData: null, // 统计
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -271,6 +282,19 @@ export default {
         }
       })
     },
+    // 导出
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      params.showCost = _this.$hasPermissions('M_ShowAllCost') ? 1 : 0
+      _this.exportLoading = true
+      _this.spinning = true
+      allocLinkagePutExport(params).then(res => {
+        downloadExcel(res, '连锁调入列表')
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 1 - 0
src/views/allocationManagement/chainTransferOut/list.vue

@@ -285,6 +285,7 @@ export default {
     handleExport () {
       const _this = this
       const params = this.queryParam
+      params.showCost = _this.$hasPermissions('M_ShowAllCost') ? 1 : 0
       _this.exportLoading = true
       _this.spinning = true
       allocLinkageOutExport(params).then(res => {

+ 25 - 1
src/views/allocationManagement/warehouseAllocation/list.vue

@@ -46,6 +46,15 @@
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
               <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="warehouseAllocationList-refresh">查询</a-button>
               <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="warehouseAllocationList-reset">重置</a-button>
+              <a-button
+                type="primary"
+                style="margin-left: 5px"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                class="button-warning"
+                v-if="$hasPermissions('B_allocWarehouseExport')"
+                id="warehouseAllocation-export-btn">导出</a-button>
               <a @click="advanced = !advanced" style="margin-left: 8px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'" />
@@ -127,12 +136,13 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDel, allocWarehouseQueryCount } from '@/api/allocWarehouse'
+import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDel, allocWarehouseQueryCount, allocWarehouseExport } from '@/api/allocWarehouse'
 import { warehouseAllList } from '@/api/warehouse.js'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import rangeDate from '@/views/common/rangeDate.vue'
 import stateIcon from '@/views/common/stateIcon'
+import { downloadExcel } from '@/libs/JGPrint.js'
 import getDate from '@/libs/getDate.js'
 export default {
   name: 'AllocWarehouseList',
@@ -157,6 +167,7 @@ export default {
         allocationWarehouseNo: undefined// 单号
       },
       disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false, // 导出
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -301,6 +312,19 @@ export default {
       }
       this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${row.id}/${row.allocationWarehouseSn}` })
     },
+    // 导出
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      params.showCost = _this.$hasPermissions('M_ShowAllCost') ? 1 : 0
+      _this.exportLoading = true
+      _this.spinning = true
+      allocWarehouseExport(params).then(res => {
+        downloadExcel(res, '仓库调拨列表')
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 21 - 3
src/views/chainReportData/chainSalesDetailsCountReport/list.vue

@@ -108,14 +108,13 @@ export default {
             { title: '雨刮片', dataIndex: 'ygpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '刹车制动系统', dataIndex: 'scpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '蓄电池', dataIndex: 'xdcAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-            { title: '火花塞', dataIndex: 'hhsAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: 'LED灯', dataIndex: 'ledAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         {
           title: '稳升',
           children: [
-            { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         {
@@ -123,7 +122,26 @@ export default {
           children: [
             { title: '润滑油', dataIndex: 'rhyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '变速箱油', dataIndex: 'bsxyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-            { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '火花塞',
+          children: [
+            { title: 'NGK', dataIndex: 'hhsNgkAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '中冠', dataIndex: 'hhsZgAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '轮胎',
+          children: [
+            { title: 'RUNTEK', dataIndex: 'ltAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '防冻液',
+          children: [
+            { title: '酷兰德', dataIndex: 'fdyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         { title: '皮带', dataIndex: 'pdAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },

+ 21 - 3
src/views/chainReportData/chainSalesReturnDetailReport/list.vue

@@ -102,14 +102,13 @@ export default {
             { title: '雨刮片', dataIndex: 'ygpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '刹车制动系统', dataIndex: 'scpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '蓄电池', dataIndex: 'xdcAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-            { title: '火花塞', dataIndex: 'hhsAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: 'LED灯', dataIndex: 'ledAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         {
           title: '稳升',
           children: [
-            { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         {
@@ -117,7 +116,26 @@ export default {
           children: [
             { title: '润滑油', dataIndex: 'rhyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '变速箱油', dataIndex: 'bsxyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-            { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '火花塞',
+          children: [
+            { title: 'NGK', dataIndex: 'hhsNgkAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '中冠', dataIndex: 'hhsZgAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '轮胎',
+          children: [
+            { title: 'RUNTEK', dataIndex: 'ltAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '防冻液',
+          children: [
+            { title: '酷兰德', dataIndex: 'fdyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         { title: '皮带', dataIndex: 'pdAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },

+ 32 - 17
src/views/purchasingManagement/purchaseOrder/edit.vue

@@ -205,7 +205,7 @@
                   </a-col>
                   <a-col :span="6">
                     <div style="float:right;overflow: hidden;">
-                      <a-button v-if="!isDealerUp" type="primary" class="button-primary" id="purchaseOrderEdit-import-btn" @click="handleOutStock">上次缺货</a-button>
+                      <a-button v-if="!isDealerUp" type="primary" class="button-primary" id="purchaseOrderEdit-import-btn" @click="handleOutStock">导入缺货</a-button>
                       <a-button id="purchaseOrderEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
                     </div>
                   </a-col>
@@ -265,9 +265,17 @@
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{purchaseBillSn: $route.params.sn}" @close="openGuideModal=false" @ok="hanldeOks" />
     <!-- 上次缺货 -->
-    <outStockModal :openModal="openOutStockModal" :paramsData="paramsData" @close="openOutStockModal=false" @ok="hanldeOkOutStock" />
+    <outStockModal
+      ref="outStock"
+      :paramsSn="$route.params.sn"
+      :openModal="openOutStockModal"
+      :chooseData="chooseData"
+      @close="openOutStockModal=false"
+      @ok="hanldeOkOutStock" />
     <!-- 选择地址 -->
     <choose-address-modal :openModal="openAddrModal" @ok="handleAddrOk" @close="openAddrModal=false" />
+    <!-- 导入缺货 -->
+    <outStockListModal ref="outStockList" :openModal="openOutStockListModal" @close="openOutStockListModal=false" @ok="hanldeOkOutStockList"></outStockListModal>
   </div>
 </template>
 
@@ -276,18 +284,19 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import outStockModal from './outStockModal.vue'
+import outStockListModal from './outStockListModal.vue'
 import chooseAddressModal from '@/views/common/receivingAddress/chooseAddressModal.vue'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'
-import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel, purchaseDetailCount, purchaseDetailCancelList } from '@/api/purchaseDetail'
+import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel, purchaseDetailCancelList } from '@/api/purchaseDetail'
 import { productListPurchase } from '@/api/product'
 import defImg from '@/assets/def_img@2x.png'
 import Print from '@/views/common/print.vue'
 import { hdPrint } from '@/libs/JGPrint'
 export default {
   name: 'PurchaseEdit',
-  components: { STable, VSelect, ProductType, ProductBrand, ImportGuideModal, outStockModal, Print, chooseAddressModal },
+  components: { STable, VSelect, ProductType, ProductBrand, ImportGuideModal, outStockModal, Print, chooseAddressModal, outStockListModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -352,10 +361,12 @@ export default {
         })
       },
       localDataSource: [],
+      chooseData: [],
       openGuideModal: false, //  导入产品引导
       openOutStockModal: false,
       paramsData: null,
-      openAddrModal: false // 选择地址弹框是否显示
+      openAddrModal: false, // 选择地址弹框是否显示
+      openOutStockListModal: false
     }
   },
   computed: {
@@ -543,17 +554,20 @@ export default {
       this.$refs.purchaseTable.refresh(true)
       this.getOrderDetail()
     },
-    // 上次缺货
+    // 导入缺货
     handleOutStock () {
-      // 校验是否存在历史采购单,且上次采购存在缺货产品
-      purchaseDetailCancelList({ pageNo: 1, pageSize: 5 }).then(res => {
-        if (res.status == 200) {
-          this.paramsData = {
-            purchaseBillSn: this.$route.params.sn,
-            purchaseBillNo: this.detail && this.detail.purchaseBillNo ? this.detail.purchaseBillNo : undefined
-          }
-          this.openOutStockModal = true
-        }
+      this.openOutStockListModal = true
+      const _this = this
+      _this.$nextTick(() => {
+        _this.$refs.outStockList.resetSearchForm()
+      })
+    },
+    hanldeOkOutStockList (con) {
+      const _this = this
+      _this.openOutStockModal = true
+      _this.chooseData = con
+      _this.$nextTick(() => {
+        _this.$refs.outStock.resetSearchForm()
       })
     },
     //  地址保存
@@ -578,11 +592,12 @@ export default {
     handlePicDetail (row) {
       this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
     },
-    // 上次缺货 导入成功
+    // 导入缺货 导入成功
     hanldeOkOutStock () {
       this.$refs.purchaseTable.refresh(true)
-      this.paramsData = null
+      this.chooseData = null
       this.openOutStockModal = false
+      this.openOutStockListModal = false
     },
     // 打印预览/快捷打印
     handlePrint (type, printerType) {

+ 207 - 0
src/views/purchasingManagement/purchaseOrder/outStockListModal.vue

@@ -0,0 +1,207 @@
+<template>
+  <a-modal
+    centered
+    class="outStock-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="导入缺货"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="860">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="outStock-con">
+        <div>
+          <div ref="tableSearch" class="table-page-search-wrapper">
+            <a-form layout="inline" @keyup.enter.native="searchForm">
+              <a-row type="flex" :gutter="12" justify="start">
+                <a-col :md="10" :sm="24">
+                  <a-form-model-item label="创建时间" prop="time">
+                    <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="8" :sm="24">
+                  <a-form-item label="采购单号">
+                    <a-input id="outStockList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col flex="auto">
+                  <a-button type="primary" @click="searchForm" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="productInfoList-reset">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form>
+          </div>
+          <!-- <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys?rowSelectionInfo.selectedRowKeys.length:0 }}个</p> -->
+          <!-- 列表 -->
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.purchaseBillSn"
+            rowKeyName="purchaseBillSn"
+            :row-selection="{ columnWidth: 40 }"
+            @rowSelection="rowSelectionFun"
+            :data="loadData"
+            :columns="columns"
+            :scroll="{ y: 450 }"
+            bordered>
+          </s-table>
+        </div>
+        <!-- 按钮 -->
+        <div class="btn-con">
+          <a-button
+            id="outStock-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 30px;margin-right: 30px;">取消</a-button>
+          <a-button
+            type="primary"
+            id="outStock-save"
+            size="large"
+            class="button-primary"
+            @click="handleSave"
+            style="padding: 0 30px;">确定</a-button>
+        </div>
+      </div>
+      </div></a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import { outOfStockList } from '@/api/oos'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import rangeDate from '@/views/common/rangeDate.vue'
+import getDate from '@/libs/getDate.js'
+export default {
+  name: 'OutStockModal',
+  components: { STable, ProductType, ProductBrand, rangeDate, getDate },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    chooseData: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '缺货款数', dataIndex: 'totalCategory', width: '16%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '缺货数量', dataIndex: 'totalQty', width: '16%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '缺货金额', dataIndex: 'totalAmount', width: '16%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return outOfStockList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      spinning: false,
+      rowSelectionInfo: null,
+      time: [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        purchaseBillNo: '',
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime
+      }
+    }
+  },
+  methods: {
+    //  时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    // 保存
+    handleSave () {
+      const _this = this
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        this.$message.warning('请在列表勾选后再进行操作!')
+        return
+      }
+      _this.$emit('ok', this.rowSelectionInfo.selectedRowKeys)
+    },
+    searchForm () {
+      this.$refs.table.refresh(true)
+    },
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.purchaseBillNo = ''
+      this.$refs.table.refresh(true)
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$refs.table.clearSelected() // 清空表格选中项
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .outStock-modal{
+    .outStock-con{
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 57 - 93
src/views/purchasingManagement/purchaseOrder/outStockModal.vue

@@ -4,24 +4,29 @@
     class="outStock-modal"
     :footer="null"
     :maskClosable="false"
-    :title="title"
+    title="采购缺货产品明细"
     v-model="isShow"
     @cancel="isShow=false"
-    :width="800">
+    :width="900">
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="outStock-con">
         <div>
           <div ref="tableSearch" class="table-page-search-wrapper">
             <a-form layout="inline" @keyup.enter.native="searchForm">
               <a-row :gutter="15">
+                <a-col :md="8" :sm="24">
+                  <a-form-item label="采购单号">
+                    <a-input id="productInfoList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
+                  </a-form-item>
+                </a-col>
                 <a-col :md="8" :sm="24">
                   <a-form-item label="产品编码">
-                    <a-input id="productInfoList-code" v-model.trim="queryParam.dealerProductEntity.code" allowClear placeholder="请输入产品编码"/>
+                    <a-input id="productInfoList-code" v-model.trim="queryParam.dealerProduct.code" allowClear placeholder="请输入产品编码"/>
                   </a-form-item>
                 </a-col>
                 <a-col :md="8" :sm="24">
                   <a-form-item label="产品名称">
-                    <a-input id="productInfoList-name" v-model.trim="queryParam.dealerProductEntity.name" allowClear placeholder="请输入产品名称"/>
+                    <a-input id="productInfoList-name" v-model.trim="queryParam.dealerProduct.name" allowClear placeholder="请输入产品名称"/>
                   </a-form-item>
                 </a-col>
                 <a-col :md="8" :sm="24">
@@ -31,7 +36,7 @@
                 </a-col>
                 <a-col :md="8" :sm="24">
                   <a-form-item label="产品品牌">
-                    <ProductBrand id="productInfoList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.dealerProductEntity.productBrandSn"></ProductBrand>
+                    <ProductBrand id="productInfoList-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.dealerProduct.productBrandSn"></ProductBrand>
                     </a-select>
                   </a-form-item>
                 </a-col>
@@ -48,18 +53,24 @@
             class="sTable"
             ref="table"
             size="small"
-            :rowKey="(record) => record.productSn"
-            rowKeyName="productSn"
+            :rowKey="(record) => record.id"
             :row-selection="{ columnWidth: 40 }"
             @rowSelection="rowSelectionFun"
             :data="loadData"
             :columns="columns"
             :scroll="{ y: 450 }"
+            :defaultLoadData="false"
             bordered>
           </s-table>
         </div>
         <!-- 按钮 -->
         <div class="btn-con">
+          <a-button
+            id="outStock-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 60px;margin-right: 15px;">取消</a-button>
           <a-button
             type="primary"
             id="outStock-save"
@@ -67,12 +78,6 @@
             class="button-primary"
             @click="handleSave"
             style="padding: 0 36px;">批量添加</a-button>
-          <a-button
-            id="outStock-cancel"
-            size="large"
-            class="button-cancel"
-            @click="isShow=false"
-            style="padding: 0 60px;margin-left: 15px;">取消</a-button>
         </div>
       </div>
       </div></a-spin>
@@ -82,7 +87,8 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
-import { purchaseDetailCancelList, purchaseDetailCancelSave } from '@/api/purchaseDetail'
+import { outOfStockDetailList } from '@/api/oos'
+import { importOosDetail } from '@/api/purchaseDetail'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 export default {
@@ -94,57 +100,61 @@ export default {
       type: Boolean,
       default: false
     },
+    paramsSn: {
+      type: String,
+      default: ''
+    },
     chooseData: {
       type: Array,
       default: () => {
         return []
       }
-    },
-    paramsData: {
-      type: Object,
-      default: () => {
-        return {}
-      }
     }
   },
   data () {
+    const _this = this
     return {
-      isShow: this.openModal, //  是否打开弹框
+      isShow: _this.openModal, //  是否打开弹框
       formItemLayout: {
         labelCol: { span: 4 },
         wrapperCol: { span: 20 }
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '32%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '上次采购数量', dataIndex: 'qty', width: '18%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '上次缺货数量', dataIndex: 'cancelQty', width: '18%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '缺货数量', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '缺货金额', dataIndex: 'totalAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
-      title: '',
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return purchaseDetailCancelList(Object.assign(parameter, this.queryParam)).then(res => {
+        this.queryParam.purchaseBillSnList = this.chooseData
+        return outOfStockDetailList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
             this.disabled = false
           }
           this.spinning = false
-          const purchaseBillNo = data && data.list.length > 0 ? data.list[0].purchaseBillNo : '--'
-          this.title = '上次采购缺货产品明细(采购单号:' + purchaseBillNo + ')'
           return data
         })
       },
       spinning: false,
       rowSelectionInfo: null,
       productType: [],
-      dataList: [],
       queryParam: { //  查询条件
-        dealerProductEntity: {
+        purchaseBillSnList: undefined,
+        purchaseBillNo: '',
+        dealerProduct: {
           code: '', //  产品编码
           name: '', //  产品名称
           productBrandSn: undefined, //  产品品牌
@@ -158,9 +168,9 @@ export default {
   methods: {
     //  产品分类  change
     changeProductType (val, opt) {
-      this.queryParam.dealerProductEntity.productTypeSn1 = val[0] ? val[0] : ''
-      this.queryParam.dealerProductEntity.productTypeSn2 = val[1] ? val[1] : ''
-      this.queryParam.dealerProductEntity.productTypeSn3 = val[2] ? val[2] : ''
+      this.queryParam.dealerProduct.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.dealerProduct.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.dealerProduct.productTypeSn3 = val[2] ? val[2] : ''
     },
     // 表格选中项
     rowSelectionFun (obj) {
@@ -173,65 +183,18 @@ export default {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
-      const params = {
-        confirm: false,
-        purchaseBillSn: this.paramsData.purchaseBillSn,
-        purchaseBillNo: this.paramsData.purchaseBillNo,
-        purchaseBillDetailEntityList: this.rowSelectionInfo && this.rowSelectionInfo.selectedRows
-      }
-      purchaseDetailCancelSave(params).then(res => {
-        if (res.status == 200 && res.data) {
-          let content = ''
-          if ((res.data.productSizeRepeat != res.data.productSize) && (res.data.productSizeRepeat != 0)) {
-            content = `您已经选择 ${res.data.productSize} 个产品,其中 ${res.data.productSizeRepeat} 个产品已经存在于采购单中。本次只会加入不重复的产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
-            this.confirmFun(content)
-          } else if (res.data.productSizeRepeat == res.data.productSize) {
-            content = `抱歉,您选择的 ${res.data.productSize} 个产品,采购单中已经全部存在,无需加入!`
-            this.$info({
-              title: '提示',
-              content: content,
-              okText: '好的',
-              centered: true,
-              onOk () {
-                _this.$refs.table.clearSelected() // 清空表格选中项
-              }
-            })
-          } else {
-            content = `您已经选择 ${res.data.productSize} 个产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
-            this.confirmFun(content)
-          }
+      const arr = []
+      _this.rowSelectionInfo.selectedRows.forEach(item => {
+        const obj = {
+          productSn: item.productSn,
+          productCode: item.productCode,
+          qty: item.qty
         }
+        arr.push(obj)
       })
-    },
-    confirmFun (content) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: content,
-        okText: '确认加入',
-        cancelText: '重新选择',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.spinning = true
-          const params = {
-            confirm: true,
-            purchaseBillSn: _this.paramsData.purchaseBillSn,
-            purchaseBillNo: _this.paramsData.purchaseBillNo,
-            purchaseBillDetailEntityList: _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows
-          }
-          purchaseDetailCancelSave(params).then(res => {
-            if (res.status == 200) {
-              _this.$emit('ok')
-              _this.isShow = false
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        },
-        onCancel () {
-          _this.$refs.table.clearSelected() // 清空表格选中项
+      importOosDetail({ purchaseBillSn: _this.paramsSn, arr }).then(res => {
+        if (res.status == 200) {
+          _this.$emit('ok')
         }
       })
     },
@@ -239,6 +202,7 @@ export default {
       this.$refs.table.refresh(true)
     },
     resetSearchForm () {
+      this.queryParam.purchaseBillNo = ''
       const info = {
         productBrandSn: undefined,
         code: '', //  产品编码
@@ -247,8 +211,8 @@ export default {
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '' //  产品三级分类
       }
-      Object.assign(this.queryParam.dealerProductEntity, info)
       this.productType = []
+      Object.assign(this.queryParam.dealerProduct, info)
       this.$refs.table.refresh(true)
     }
   },

+ 33 - 18
src/views/purchasingManagement/purchaseOrderNew/edit.vue

@@ -25,7 +25,7 @@
                 <a-icon type="shopping" /> 购物车
               </a-menu-item>
               <a-menu-item key="2" v-if="!isDealerUp">
-                <a-icon type="funnel-plot" />上次缺货
+                <a-icon type="funnel-plot" />导入缺货
               </a-menu-item>
               <a-menu-item key="1">
                 <a-icon type="import" />导入产品
@@ -117,7 +117,7 @@
                 height: '60px',
               }"
             >
-              <span slot="description"> 暂无产品 </span>
+              <span slot="description">暂无产品</span>
               <a-button type="primary" class="button-error" @click="openChooseProduct=true"><a-icon type="plus" />立即添加产品</a-button>
             </a-empty>
           </div>
@@ -163,8 +163,16 @@
       @close="openChooseProduct=false"
       @add="handleAdd"
     ></chooseProductModal>
+    <!-- 导入缺货 -->
+    <outStockListModal ref="outStockList" :openModal="openOutStockListModal" @close="openOutStockListModal=false" @ok="hanldeOkOutStockList"></outStockListModal>
     <!-- 上次缺货 -->
-    <outStockModal :openModal="openOutStockModal" :paramsData="paramsData" @close="openOutStockModal=false" @ok="hanldeOkOutStock" />
+    <outStockModal
+      ref="outStock"
+      :paramsSn="$route.params.sn"
+      :chooseData="chooseData"
+      :openModal="openOutStockModal"
+      @close="openOutStockModal=false"
+      @ok="hanldeOkOutStock" />
     <!-- 购物车 -->
     <shopingCatModal :showModal="openShopCatModal" :paramsData="paramsData" @close="openShopCatModal=false" @ok="getOrderDetail(false, true)"></shopingCatModal>
 
@@ -177,9 +185,10 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import outStockModal from './outStockModal.vue'
+import outStockListModal from './outStockListModal.vue'
 import chooseAddressModal from '@/views/common/receivingAddress/chooseAddressModal.vue'
 import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'
-import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel, purchaseDetailCount, purchaseDetailCancelList } from '@/api/purchaseDetail'
+import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel } from '@/api/purchaseDetail'
 // 选择产品
 import chooseProductModal from './chooseProductModal.vue'
 // 打印
@@ -227,7 +236,7 @@ const actionComp = {
 
 export default {
   name: 'PurchaseEdit',
-  components: { STable, VSelect, ImportGuideModal, outStockModal, PrintPanel, chooseAddressModal, chooseProductModal, shopingCatModal },
+  components: { STable, VSelect, ImportGuideModal, outStockModal, PrintPanel, chooseAddressModal, chooseProductModal, shopingCatModal, outStockListModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -251,10 +260,12 @@ export default {
       },
       purchaseDisabled: false, //  查询、重置按钮是否可操作
       localDataSource: [],
+      chooseData: [],
       openGuideModal: false, //  导入产品引导
       openOutStockModal: false,
       paramsData: null,
-      openAddrModal: false // 选择地址弹框是否显示
+      openAddrModal: false, // 选择地址弹框是否显示
+      openOutStockListModal: false // 导入缺货
     }
   },
   computed: {
@@ -267,7 +278,7 @@ export default {
         { title: '序号', key: 'a', field: 'no', width: '5%', align: 'center', operationColumn: false },
         { title: '产品编码', key: 'b', field: 'productCode', width: '10%', align: 'center', operationColumn: false },
         { title: '产品名称', key: 'c', field: 'productName', width: '25%', align: 'center', operationColumn: false, ellipsis: { showTitle: true } },
-        { title: '原厂编码', key: 'q', field: 'productOrgCode', width: '15%', align: 'center',operationColumn: false },
+        { title: '原厂编码', key: 'q', field: 'productOrgCode', width: '15%', align: 'center', operationColumn: false },
         { title: '可用库存', key: 'j', field: 'currentStockQty', width: '10%', align: 'center', operationColumn: false },
         { title: '采购数量',
           key: 'd',
@@ -463,16 +474,10 @@ export default {
     },
     // 上次缺货
     handleOutStock () {
-      // 校验是否存在历史采购单,且上次采购存在缺货产品
-      purchaseDetailCancelList({ pageNo: 1, pageSize: 5 }).then(res => {
-        if (res.status == 200) {
-          const purchaseBillNo = res.data && res.data.list && res.data.list[0].purchaseBillNo || '--'
-          this.paramsData = {
-            purchaseBillSn: this.$route.params.sn,
-            purchaseBillNo: purchaseBillNo
-          }
-          this.openOutStockModal = true
-        }
+      this.openOutStockListModal = true
+      const _this = this
+      _this.$nextTick(() => {
+        _this.$refs.outStockList.resetSearchForm()
       })
     },
     //  地址保存
@@ -493,11 +498,21 @@ export default {
         }
       })
     },
+    // 选择缺货列表  打开上次缺货列表
+    hanldeOkOutStockList (con) {
+      const _this = this
+      _this.openOutStockModal = true
+      _this.chooseData = con
+      _this.$nextTick(() => {
+        _this.$refs.outStock.resetSearchForm()
+      })
+    },
     // 上次缺货 导入成功
     hanldeOkOutStock () {
       this.getOrderDetail(false, true, true)
-      this.paramsData = null
+      this.chooseData = null
       this.openOutStockModal = false
+      this.openOutStockListModal = false
     },
     // 打印预览/快捷打印
     handlePrint (type, printerType) {

+ 2 - 3
src/views/purchasingManagement/purchaseOrderNew/list.vue

@@ -133,11 +133,10 @@
           </template>
         </s-table>
       </a-spin>
-  </a-card>
       <!-- 选择基本信息弹框 -->
       <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
-  </div>
- 
+  </a-card>
+  </div> 
 </template>
 
 <script>

+ 228 - 0
src/views/purchasingManagement/purchaseOrderNew/outStockListModal.vue

@@ -0,0 +1,228 @@
+<template>
+  <a-drawer
+    :zIndex="zIndex"
+    title="导入缺货"
+    placement="right"
+    :visible="isShow"
+    :width="width"
+    :get-container="false"
+    :wrap-style="{ position: 'absolute' }"
+    @close="isShow=false"
+    wrapClassName="outStock-modal"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="outStock-con">
+        <div>
+          <div ref="tableSearch" class="table-page-search-wrapper">
+            <a-form layout="inline" @keyup.enter.native="searchForm">
+              <a-row type="flex" :gutter="12" justify="start">
+                <a-col :md="10" :sm="24">
+                  <a-form-model-item label="创建时间" prop="time">
+                    <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+                  </a-form-model-item>
+                </a-col>
+                <a-col :md="8" :sm="24">
+                  <a-form-item label="采购单号">
+                    <a-input id="outStockList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col flex="auto">
+                  <a-button type="primary" @click="searchForm" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
+                  <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="productInfoList-reset">重置</a-button>
+                </a-col>
+              </a-row>
+            </a-form>
+          </div>
+          <!-- <p style="font-weight: bold;">当前已选:{{ rowSelectionInfo&&rowSelectionInfo.selectedRowKeys?rowSelectionInfo.selectedRowKeys.length:0 }}个</p> -->
+          <!-- 列表 -->
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.purchaseBillSn"
+            rowKeyName="purchaseBillSn"
+            :row-selection="{ columnWidth: 40 }"
+            @rowSelection="rowSelectionFun"
+            :data="loadData"
+            :columns="columns"
+            :style="{ height: tableHeight+84.5+'px' }"
+            :scroll="{ y:tableHeight, x: 1000 }"
+            bordered>
+          </s-table>
+        </div>
+        <!-- 按钮 -->
+        <div class="btn-con" ref="btnBox">
+          <a-button
+            id="outStock-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 30px;margin-right: 30px;">取消</a-button>
+          <a-button
+            type="primary"
+            id="outStock-save"
+            size="large"
+            class="button-primary"
+            @click="handleSave"
+            style="padding: 0 30px;">确定</a-button>
+        </div>
+      </div>
+    </a-spin>
+  </a-drawer>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable } from '@/components'
+import { outOfStockList } from '@/api/oos'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import rangeDate from '@/views/common/rangeDate.vue'
+import getDate from '@/libs/getDate.js'
+export default {
+  name: 'OutStockModal',
+  components: { STable, ProductType, ProductBrand, rangeDate, getDate },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    chooseData: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    paramsData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    }
+  },
+  data () {
+    const _this = this
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      zIndex: 90,
+      width: '70%',
+      tableHeight: 0,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '缺货款数', dataIndex: 'totalCategory', width: '16%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '缺货数量', dataIndex: 'totalQty', width: '16%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '缺货金额', dataIndex: 'totalAmount', width: '16%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return outOfStockList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      spinning: false,
+      rowSelectionInfo: null,
+      time: [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        purchaseBillNo: '',
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime
+      }
+    }
+  },
+  methods: {
+    //  时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 表格选中项
+    rowSelectionFun (obj) {
+      this.rowSelectionInfo = obj || null
+    },
+    // 保存
+    handleSave () {
+      const _this = this
+      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+        this.$message.warning('请在列表勾选后再进行操作!')
+        return
+      }
+      _this.$emit('ok', this.rowSelectionInfo.selectedRowKeys)
+    },
+    searchForm () {
+      this.$refs.table.refresh(true)
+    },
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.purchaseBillNo = ''
+      this.$refs.table.refresh(true)
+    },
+    setTableH () {
+      this.$nextTick(() => {
+        const searchBoxH = this.$refs.tableSearch.offsetHeight
+        const tabBoxH = this.$refs.btnBox.offsetHeight
+        this.tableHeight = window.innerHeight - searchBoxH - tabBoxH - 300
+      })
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    },
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$refs.table.clearSelected() // 清空表格选中项
+        this.$emit('close')
+      } else {
+        setTimeout(() => {
+          this.setTableH()
+        }, 200)
+        this.resetSearchForm()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .outStock-modal{
+    .outStock-con{
+      .btn-con{
+        text-align: center;
+        margin: 30px 0 20px;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>

+ 37 - 83
src/views/purchasingManagement/purchaseOrderNew/outStockModal.vue

@@ -1,7 +1,7 @@
 <template>
   <a-drawer
     :zIndex="zIndex"
-    :title="title"
+    title="采购缺货产品明细"
     placement="right"
     :visible="isShow"
     :width="width"
@@ -16,6 +16,11 @@
           <div ref="searchBox" class="table-page-search-wrapper">
             <a-form layout="inline" @keyup.enter.native="searchForm">
               <a-row type="flex" :gutter="12" justify="start">
+                <a-col flex="auto">
+                  <a-form-item label="采购单号">
+                    <a-input id="productInfoList-purchaseBillNo" v-model.trim="purchaseBillNo" placeholder="请输入采购单号" allowClear />
+                  </a-form-item>
+                </a-col>
                 <a-col flex="auto">
                   <a-form-item label="产品编码">
                     <a-input id="productInfoList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
@@ -57,8 +62,7 @@
             class="sTable"
             ref="table"
             size="small"
-            :rowKey="(record) => record.productSn"
-            rowKeyName="productSn"
+            :rowKey="(record) => record.id"
             :row-selection="{ columnWidth: 40 }"
             :scroll="{ y:tableHeight, x: 1000 }"
             @rowSelection="rowSelectionFun"
@@ -77,7 +81,8 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable } from '@/components'
-import { purchaseDetailCancelList, purchaseDetailCancelSave } from '@/api/purchaseDetail'
+import { outOfStockDetailList } from '@/api/oos'
+import { importOosDetail } from '@/api/purchaseDetail'
 import ProductType from '../../common/productType.js'
 import ProductBrand from '../../common/productBrand.js'
 export default {
@@ -89,18 +94,16 @@ export default {
       type: Boolean,
       default: false
     },
+    paramsSn: {
+      type: String,
+      default: ''
+    },
     chooseData: {
       type: Array,
       default: () => {
         return []
       }
     },
-    paramsData: {
-      type: Object,
-      default: () => {
-        return {}
-      }
-    },
     width: {
       type: [String, Number],
       default: '70%'
@@ -111,6 +114,7 @@ export default {
     }
   },
   data () {
+    const _this = this
     return {
       isShow: this.openModal, //  是否打开弹框
       tableHeight: 0,
@@ -120,21 +124,26 @@ export default {
       },
       disabled: false, //  查询、重置按钮是否可操作
       columns: [
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '240px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '上次采购数量', dataIndex: 'qty', width: '180px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '上次缺货数量', dataIndex: 'cancelQty', width: '180px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '80px', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '序号', dataIndex: 'no', width: '8%', align: 'center' },
+        { title: '采购单号', dataIndex: 'purchaseBillNo', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productCode', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '30%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '缺货数量', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '缺货金额', dataIndex: 'totalAmount', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+        { title: '单位', dataIndex: 'unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
-      title: '',
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return purchaseDetailCancelList(Object.assign(parameter, { dealerProductEntity: this.queryParam })).then(res => {
+        return outOfStockDetailList(Object.assign(parameter, { purchaseBillSnList: this.chooseData, purchaseBillNo: this.purchaseBillNo, dealerProduct: this.queryParam })).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
             this.disabled = false
           }
           this.spinning = false
@@ -178,73 +187,18 @@ export default {
         this.$message.warning('请在列表勾选后再进行操作!')
         return
       }
-      const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRows || []
-      const list = []
-      rows.map(item => {
-        list.push({
-          cancelQty: item.cancelQty,
-          qty: item.qty,
+      const arr = []
+      _this.rowSelectionInfo.selectedRows.forEach(item => {
+        const obj = {
           productSn: item.productSn,
-          price: item.price
-        })
-      })
-
-      const params = {
-        confirm: false,
-        purchaseBillSn: this.paramsData.purchaseBillSn,
-        purchaseBillNo: this.paramsData.purchaseBillNo,
-        purchaseBillDetailEntityList: list
-      }
-      purchaseDetailCancelSave(params).then(res => {
-        if (res.status == 200 && res.data) {
-          let content = ''
-          if ((res.data.productSizeRepeat != res.data.productSize) && (res.data.productSizeRepeat != 0)) {
-            content = `您已经选择 ${res.data.productSize} 个产品,其中 ${res.data.productSizeRepeat} 个产品已经存在于采购单中。本次只会加入不重复的产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
-            this.confirmFun(content, params)
-          } else if (res.data.productSizeRepeat == res.data.productSize) {
-            content = `抱歉,您选择的 ${res.data.productSize} 个产品,采购单中已经全部存在,无需加入!`
-            this.$info({
-              title: '提示',
-              content: content,
-              okText: '好的',
-              centered: true,
-              zIndex: 1100,
-              onOk () {
-                _this.$refs.table.clearSelected() // 清空表格选中项
-              }
-            })
-          } else {
-            content = `您已经选择 ${res.data.productSize} 个产品,上次缺货数量将作为本次采购数量。确认加入本次采购吗?`
-            this.confirmFun(content, params)
-          }
+          productCode: item.productCode,
+          qty: item.qty
         }
+        arr.push(obj)
       })
-    },
-    confirmFun (content, params) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: content,
-        okText: '确认加入',
-        cancelText: '重新选择',
-        centered: true,
-        closable: true,
-        zIndex: 1100,
-        onOk () {
-          _this.spinning = true
-          params.confirm = true
-          purchaseDetailCancelSave(params).then(res => {
-            if (res.status == 200) {
-              _this.$emit('ok')
-              _this.isShow = false
-              _this.spinning = false
-            } else {
-              _this.spinning = false
-            }
-          })
-        },
-        onCancel () {
-          _this.$refs.table.clearSelected() // 清空表格选中项
+      importOosDetail({ purchaseBillSn: _this.paramsSn, arr }).then(res => {
+        if (res.status == 200) {
+          _this.$emit('ok')
         }
       })
     },
@@ -264,6 +218,7 @@ export default {
         productTypeSn2: '', //  产品二级分类
         productTypeSn3: '' //  产品三级分类
       }
+      this.purchaseBillNo = ''
       this.productType = []
       this.$refs.table.refresh(true)
     }
@@ -285,7 +240,6 @@ export default {
           this.setTableH()
         }, 200)
         this.resetSearchForm()
-        this.title = '上次采购缺货产品明细(采购单号:' + this.paramsData.purchaseBillNo + ')'
       }
     }
   }
@@ -306,6 +260,6 @@ export default {
         padding: 10px 0;
       }
     }
-   
+
   }
 </style>

+ 25 - 3
src/views/reportData/customerSalesDetailsReport/list.vue

@@ -62,12 +62,14 @@
                 <a-col span="4">蓄电池:{{ (totalData && (totalData.xdcAmount || totalData.xdcAmount==0)) ? toThousands(totalData.xdcAmount) : '--' }}</a-col>
                 <a-col span="4">火花塞:{{ (totalData && (totalData.hhsAmount || totalData.hhsAmount==0)) ? toThousands(totalData.hhsAmount) : '--' }}</a-col>
                 <a-col span="4">LED灯:{{ (totalData && (totalData.ledAmount || totalData.ledAmount==0)) ? toThousands(totalData.ledAmount) : '--' }}</a-col>
+                <a-col span="4">防冻液:{{ (totalData && (totalData.fdyAmount || totalData.fdyAmount==0)) ? toThousands(totalData.fdyAmount) : '--' }}</a-col>
                 <a-col span="4">点火线圈:{{ (totalData && (totalData.dhxqAmount || totalData.dhxqAmount==0)) ? toThousands(totalData.dhxqAmount) : '--' }}</a-col>
                 <a-col span="4">润滑油:{{ (totalData && (totalData.rhyAmount || totalData.rhyAmount==0)) ? toThousands(totalData.rhyAmount) : '--' }}</a-col>
                 <a-col span="4">变速箱油:{{ (totalData && (totalData.bsxyAmount || totalData.bsxyAmount==0)) ? toThousands(totalData.bsxyAmount) : '--' }}</a-col>
                 <a-col span="4">刹车油:{{ (totalData && (totalData.scyAmount || totalData.scyAmount==0)) ? toThousands(totalData.scyAmount) : '--' }}</a-col>
                 <a-col span="4">皮带:{{ (totalData && (totalData.pdAmount || totalData.pdAmount==0)) ? toThousands(totalData.pdAmount) : '--' }}</a-col>
                 <a-col span="4">轮子:{{ (totalData && (totalData.lzAmount || totalData.lzAmount==0)) ? toThousands(totalData.lzAmount) : '--' }}</a-col>
+                <a-col span="4">轮胎:{{ (totalData && (totalData.ltAmount || totalData.ltAmount==0)) ? toThousands(totalData.ltAmount) : '--' }}</a-col>
                 <a-col span="4">其他:{{ (totalData && (totalData.otherAmount || totalData.otherAmount==0)) ? toThousands(totalData.otherAmount) : '--' }}</a-col>
                 <a-col span="4">合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
               </a-row>
@@ -117,14 +119,14 @@ export default {
             { title: '雨刮片', dataIndex: 'ygpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '刹车制动系统', dataIndex: 'scpAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '蓄电池', dataIndex: 'xdcAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-            { title: '火花塞', dataIndex: 'hhsAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            // { title: '火花塞', dataIndex: 'hhsAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: 'LED灯', dataIndex: 'ledAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         {
           title: '稳升',
           children: [
-            { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '点火线圈', dataIndex: 'dhxqAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         {
@@ -132,7 +134,26 @@ export default {
           children: [
             { title: '润滑油', dataIndex: 'rhyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
             { title: '变速箱油', dataIndex: 'bsxyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-            { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '刹车油', dataIndex: 'scyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '火花塞',
+          children: [
+            { title: 'NGK', dataIndex: 'hhsNgkAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
+            { title: '中冠', dataIndex: 'hhsZgAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '轮胎',
+          children: [
+            { title: 'RUNTEK', dataIndex: 'ltAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
+          ]
+        },
+        {
+          title: '防冻液',
+          children: [
+            { title: '酷兰德', dataIndex: 'fdyAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
           ]
         },
         { title: '皮带', dataIndex: 'pdAmount', width: '8.4%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
@@ -184,6 +205,7 @@ export default {
     getCount (params) {
       reportCustomerSalesBillDetailCount(params).then(res => {
         if (res.status == 200 && res.data) {
+          res.data.hhsAmount = res.data.hhsNgkAmount * 1 + res.data.hhsZgAmount * 1
           this.totalData = res.data
         } else {
           this.totalData = null