chenrui 3 anni fa
parent
commit
2305e89f24

+ 47 - 0
src/config/router.config.js

@@ -365,6 +365,53 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/purchasingManagement/signWarehousing',
+            redirect: '/purchasingManagement/signWarehousing/list',
+            name: 'signWarehousing',
+            component: BlankLayout,
+            meta: {
+              title: '签收入库',
+              icon: 'money-collect'
+              // permission: 'M_signWarehousingList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'signWarehousingList',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/signWarehousing/list.vue'),
+                meta: {
+                  title: '签收入库列表',
+                  icon: 'money-collect',
+                  hidden: true
+                  // permission: 'M_signWarehousingList'
+                }
+              },
+              {
+                path: 'edit/:sn',
+                name: 'signWarehousingEdit',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/signWarehousing/edit.vue'),
+                meta: {
+                  title: '签收入库',
+                  icon: 'money-collect',
+                  hidden: true
+                  // permission: 'B_signWarehousingDetail'
+                }
+              },
+              {
+                path: 'stockOrderDetail/:sn',
+                name: 'signWarehousingStockOrderDetail',
+                component: () => import(/* webpackChunkName: "purchasingManagement" */ '@/views/purchasingManagement/signWarehousing/stockOrderDetail.vue'),
+                meta: {
+                  title: '备货单详情',
+                  icon: 'money-collect',
+                  hidden: true
+                  // permission: 'B_signWarehousingStockOrderDetail'
+                }
+              }
+            ]
+          },
           {
             path: '/purchasingManagement/purchaseReturn',
             redirect: '/purchasingManagement/purchaseReturn/list',

+ 5 - 1
src/views/purchasingManagement/purchaseOrder/detail.vue

@@ -185,7 +185,11 @@ export default {
   methods: {
     //  返回列表
     handleBack () {
-      this.$router.push({ path: '/purchasingManagement/purchaseOrder/list', query: { closeLastOldTab: true } })
+      if (this.$route.query.pageType) {
+        this.$router.push({ name: this.$route.query.pageType })
+      } else {
+        this.$router.push({ name: 'purchaseOrderList' })
+      }
     },
     //  详情
     getDetail () {

+ 322 - 0
src/views/purchasingManagement/signWarehousing/edit.vue

@@ -0,0 +1,322 @@
+<template>
+  <div class="purchaseOrderWarehousing-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" @back="handleBack" >
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="purchaseOrderWarehousing-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <span class="billno">单号:{{ (detail&&detail[0]&&detail[0].purchaseBillNo) ? detail[0].purchaseBillNo : '--' }}</span>
+        </template>
+      </a-page-header>
+      <!-- 内容 -->
+      <a-card size="small" v-for="(item,bindex) in detail" :key="item.id" :bordered="false" class="purchaseOrderWarehousing-cont">
+        <!-- 总计 -->
+        <a-alert type="info" style="margin-bottom:10px">
+          <div slot="message" >
+            <div>产品款数 <strong>{{ item.totalPutCategory }}</strong> ,本次发货数量合计 <strong>{{ item.totalPutQty }}</strong> ,本次发货金额合计¥<strong>{{ item.totalPutAmount }}</strong></div>
+          </div>
+        </a-alert>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          :ref="'table-'+bindex"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :tableId="item.receivingBillSn"
+          :index="bindex"
+          bordered>
+          <!-- 采购数量 -->
+          <template slot="origqty" slot-scope="text, record, index">
+            <div>{{ text }}</div>
+            <div v-if="record.origqty">原采购数量:{{ record.origqty }}</div>
+          </template>
+          <!-- 仓库仓位 -->
+          <template slot="warehousePosition" slot-scope="text, record, index">
+            <a-cascader
+              size="small"
+              @change="e => changeWarehouseCascade(e, record, index, bindex)"
+              v-model="record.warehouseCascade"
+              :disabled="!(item.auditState=='WAIT_PUT_WAREHOUSE' || item.auditState == 'PUT_WAREHOUSE_AUDIT_REJECT')"
+              expand-trigger="hover"
+              :options="warehouseCascadeData"
+              :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
+              id="purchaseOrderWarehousing-warehouseCascade"
+              placeholder="请选择仓库仓位"
+              :allowClear="false"
+              style="width: 100%;" />
+          </template>
+        </s-table>
+        <div style="text-align: center;">
+          <a-button
+            type="primary"
+            class="button-warning"
+            :id="'purchaseOrderWarehousing-warehousing-'+bindex"
+            @click="handleWarehousing(item,bindex)"
+            v-if="item.auditState=='WAIT_PUT_WAREHOUSE' || item.auditState == 'PUT_WAREHOUSE_AUDIT_REJECT'"
+          >确认入库</a-button>
+        </div>
+      </a-card>
+    </a-spin>
+  </div>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { purchaseWriteStockIn, receivingQuery, receivingDetail } from '@/api/purchase'
+import { purchaseUpdateWarehouse } from '@/api/purchaseDetail'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import { warehouseCascadeList } from '@/api/warehouse'
+export default {
+  components: { STable, VSelect, ProductType, ProductBrand },
+  data () {
+    return {
+      spinning: false,
+      detail: null, //  详情数据
+      productType: [],
+      queryParam: {
+        productBrandSn: undefined,
+        queryWord: '',
+        brand: '',
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      warehouseCascadeData: [], //  仓库仓位
+      defaultWarehouseCascade: [], //  默认仓库仓位
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'qty', width: '6%', align: 'center', scopedSlots: { customRender: 'origqty' } },
+        { title: '本次发货数量', dataIndex: 'shippedQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '本次入库数量', dataIndex: 'putQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓库仓位', scopedSlots: { customRender: 'warehousePosition' }, width: '13%', align: 'center' }
+      ],
+      chooseLoadData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.queryParam.receivingBillSn = parameter.tableId
+        return receivingDetail(Object.assign(parameter, this.queryParam)).then(res => {
+          const 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
+            data.list[i].shippedQty = data.list[i].putQty
+            const warehouseSn = data.list[i].warehouseSn || undefined
+            const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
+            if (warehouseSn || warehouseLocationSn) {
+              data.list[i].warehouseSnBackups = warehouseSn
+              data.list[i].warehouseLocationSnBackups = warehouseLocationSn
+              data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
+            } else {
+              //  设置默认仓库
+              if (this.defaultWarehouseCascade.length > 0) {
+                data.list[i].warehouseCascade = this.defaultWarehouseCascade
+                data.list[i].warehouseSn = this.defaultWarehouseCascade[0]
+                data.list[i].warehouseLocationSn = this.defaultWarehouseCascade[1]
+              } else {
+                data.list[i].warehouseCascade = undefined
+              }
+            }
+          }
+          this.disabled = false
+          this.chooseLoadData[parameter.index] = data.list
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  重置产品库
+    resetSearchForm () {
+      this.queryParam = {
+        productBrandSn: undefined,
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        queryWord: '',
+        brand: ''
+      }
+      this.productType = []
+      this.$refs.table.refresh(true)
+    },
+    // 判断是否选择了仓库
+    hasChoseWarehousing (data) {
+      return data.find(item => !item.warehouseCascade || item.warehouseCascade.length == 0)
+    },
+    //  确认入库
+    handleWarehousing (row, index) {
+      const list = this.chooseLoadData[index]
+      if (this.hasChoseWarehousing(list)) {
+        this.$message.warning('请选择仓库仓位!')
+        return
+      }
+      this.spinning = true
+      purchaseWriteStockIn({ id: row.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.getDetail()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+      })
+    },
+    //  返回列表
+    handleBack () {
+      this.$router.push({ path: '/purchasingManagement/signWarehousing/list', query: { closeLastOldTab: true } })
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    //  详情
+    getDetail () {
+      this.spinning = true
+      receivingQuery({ purchaseBillSn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.detail = res.data
+        } else {
+          this.detail = null
+        }
+        this.spinning = false
+      })
+    },
+    //  仓库仓位  级联  列表
+    getWarehouseCascade () {
+      const _this = this
+      warehouseCascadeList({}).then(res => {
+        if (res.status == 200) {
+          res.data.filter(item => {
+            // 过滤默认仓库
+            if (item.defaultFlag == 1 && item.wasteFlag == 0) { //  defaultFlag为1,且不是废品仓
+              _this.defaultWarehouseCascade[0] = item.warehouseSn
+              // 过滤默认仓位
+              item.warehouseLocationList.filter(subItem => {
+                if (subItem.defaultFlag == 1 && subItem.wasteFlag == 0) {
+                  _this.defaultWarehouseCascade[1] = subItem.warehouseLocationSn
+                  if (_this.detail && _this.detail.length > 0) {
+                    _this.detail.map((k, i) => {
+                      _this.$refs['table-' + i][0].refresh(true)
+                    })
+                  }
+                }
+              })
+            }
+          })
+          res.data.map(item => {
+            item.sn = item.warehouseSn
+            if (item.warehouseLocationList) {
+              item.warehouseLocationList.map(subItem => {
+                subItem.sn = subItem.warehouseLocationSn
+              })
+            }
+          })
+          this.warehouseCascadeData = res.data
+        } else {
+          this.warehouseCascadeData = []
+        }
+      })
+    },
+    // 修改仓库仓位
+    changeWarehouseCascade (val, opt, ind, bindex) {
+      let loadData = this.chooseLoadData[bindex][ind]
+      if (val.length == 1) {
+        this.$message.warning('当前仓库无仓位,请选择其他仓库')
+        const warehouseSnBackups = loadData.warehouseSnBackups || undefined
+        const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
+        loadData.warehouseSn = warehouseSnBackups
+        loadData.warehouseLocationSn = warehouseLocationSnBackups
+        if (warehouseSnBackups || warehouseLocationSnBackups) {
+          loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
+        } else {
+          loadData.warehouseCascade = undefined
+        }
+      } else {
+        loadData.warehouseSn = val[0] ? val[0] : ''
+        loadData.warehouseLocationSn = val[1] ? val[1] : ''
+        loadData.warehouseSnBackups = val[0] ? val[0] : ''
+        loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
+        loadData = this.chooseLoadData[bindex][ind]
+        this.updateWarehouse(loadData, bindex)
+      }
+    },
+    // 修改仓库
+    updateWarehouse (row, bindex) {
+      this.spinning = true
+      purchaseUpdateWarehouse({
+        id: row.id,
+        warehouseSn: row.warehouseSn,
+        warehouseLocationSn: row.warehouseLocationSn
+      }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          console.log(bindex, this.$refs)
+          this.$refs['table-' + bindex][0].refresh()
+          this.spinning = false
+        } else {
+          this.spinning = false
+        }
+      })
+    },
+    pageInit () {
+      this.getDetail()
+      this.getWarehouseCascade()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+    }
+  },
+  activated () {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.pageInit()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .purchaseOrderWarehousing-wrap{
+    position: relative;
+    height: 100%;
+    >.ant-spin-nested-loading{
+      overflow-y: scroll;
+      height: 100%;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+    .billno{
+      font-size: 14px;
+      font-weight: bold;
+      margin: 0 15px;
+    }
+    .purchaseOrderWarehousing-cont{
+      margin-top: 10px;
+    }
+  }
+</style>

+ 210 - 0
src/views/purchasingManagement/signWarehousing/list.vue

@@ -0,0 +1,210 @@
+<template>
+  <a-card size="small" :bordered="false" class="signWarehousingList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="创建时间">
+                <rangeDateTime ref="rangeDate" :value="time" @change="dateChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="采购单号">
+                <a-input id="signWarehousingList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="备货单号">
+                <a-input id="signWarehousingList-sendBillNo" v-model.trim="queryParam.sendBillNo" allowClear placeholder="请输入备货单号"/>
+              </a-form-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="业务状态">
+                  <v-select
+                    v-model="queryParam.auditState"
+                    ref="auditState"
+                    id="chainTransferOutList-auditState"
+                    code="RECEIVING_BILL_STATUS"
+                    placeholder="请选择业务状态"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="signWarehousingList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="signWarehousingList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+        <!-- 单号 -->
+        <template slot="purchaseBillNo" slot-scope="text, record">
+          <!-- <span style="color: #ed1c24;cursor: pointer;" v-if="$hasPermissions('B_purchaseReturnDetail')" @click="handleDetail(record)">{{ record.purchaseBillNo || '--' }}</span> -->
+          <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.purchaseBillNo || '--' }}</span>
+          <!-- <span v-else>{{ record.purchaseBillNo || '--' }}</span> -->
+        </template>
+        <!-- 单号 -->
+        <template slot="sendBillNo" slot-scope="text, record">
+          <span style="color: #ed1c24;cursor: pointer;" @click="handleStockDetail(record)">{{ record.sendBillNo || '--' }}</span>
+          <!-- <span v-else>{{ record.sendBillNo || '--' }}</span> -->
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            class="button-warning"
+            v-if="record.auditState == 'WAIT_PUT_WAREHOUSE'&&$hasPermissions('B_purchaseReceiving')"
+            @click="handleWarehouse(record)"
+          >签收入库</a-button>
+          <span v-if="!(record.auditState == 'WAIT_PUT_WAREHOUSE'&&$hasPermissions('B_purchaseReceiving'))">--</span>
+        </template>
+      </s-table>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import rangeDateTime from '@/views/common/rangeDateTime.vue'
+import getDate from '@/libs/getDate.js'
+import { receivingList } from '@/api/receiving'
+export default {
+  components: { STable, VSelect, rangeDateTime },
+  data () {
+    return {
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      time: [
+        getDate.getCurrMonthDays().starttime + ' 00:00:00',
+        getDate.getCurrMonthDays().endtime + ' 23:59:59'
+      ],
+      queryParam: { //  查询条件
+        // beginDate: getDate.getCurrMonthDays().starttime + ' 00:00:00',
+        // endDate: getDate.getCurrMonthDays().endtime + ' 23:59:59',
+        // purchaseBillNo: '', //  采购单号
+        // sendBillNo: '', //  备货单号
+        auditState: 'WAIT_PUT_WAREHOUSE_AUDIT'
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      tableHeight: 0,
+      columns: [
+        { title: '采购单号', scopedSlots: { customRender: 'purchaseBillNo' }, width: '18%', align: 'center' },
+        { title: '备货单号', scopedSlots: { customRender: 'sendBillNo' }, width: '18%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购金额', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '入库时间', dataIndex: 'stockPutTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '12%', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return receivingList(Object.assign(parameter, this.queryParam)).then(res => {
+          const 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
+        })
+      },
+      purchaseTragetType: []
+    }
+  },
+  methods: {
+    //  时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate(this.time)
+      // this.queryParam.beginDate = getDate.getCurrMonthDays().starttime + ' 00:00:00'
+      // this.queryParam.endDate = getDate.getCurrMonthDays().endtime + ' 23:59:59'
+      // this.queryParam.purchaseBillNo = ''
+      // this.queryParam.sendBillNo = ''
+      this.queryParam.auditState = 'WAIT_PUT_WAREHOUSE_AUDIT'
+      this.$refs.table.refresh(true)
+    },
+    //  详情
+    handleDetail (row) {
+      this.$router.push({ path: `/purchasingManagement/purchaseOrder/detail/${row.purchaseBillSn}`, query: { pageType: 'signWarehousingList' } })
+    },
+    // 备货单详情
+    handleStockDetail (row) {
+      this.$router.push({ path: `/purchasingManagement/signWarehousing/stockOrderDetail/${row.receivingBillSn}` })
+    },
+    //  签收入库
+    handleWarehouse (row) {
+      this.$router.push({ path: `/purchasingManagement/signWarehousing/edit/${row.purchaseBillSn}` })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 235
+    }
+  },
+  watch: {
+    advanced (newValue, oldValue) {
+      const _this = this
+      setTimeout(() => {
+        _this.setTableH()
+      }, 400)
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 仅刷新列表,不重置页面
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>

+ 202 - 0
src/views/purchasingManagement/signWarehousing/stockOrderDetail.vue

@@ -0,0 +1,202 @@
+<template>
+  <div class="signWarehousingDetail-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-page-header :ghost="false" :backIcon="false" @back="handleBack" class="signWarehousingDetail-cont" >
+        <!-- 自定义的二级文字标题 -->
+        <template slot="subTitle">
+          <a id="signWarehousingDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+          <span class="billno">
+            单号:{{ detail&&detail.purchaseBillNo }}
+            <span v-if="detail&&detail.sendBillNo">(备货单号:{{ detail&&detail.sendBillNo || '--' }})</span>
+          </span>
+        </template>
+        <!-- 操作区,位于 title 行的行尾 -->
+        <template slot="extra">
+          <!-- <Print v-if="$hasPermissions('B_purchasePrint')" :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print> -->
+          <a-button
+            key="1"
+            v-if="$hasPermissions('B_purchaseExportProduct') && (detail&&(detail.billStatus=='WAIT_PUT_WAREHOUSE' || detail.billStatus=='WAIT_PUT_WAREHOUSE_AUDIT' || detail.billStatus=='FINISH'))"
+            type="primary"
+            class="button-info"
+            id="signWarehousingDetail-export-btn"
+            :disabled="localDataSource.length==0"
+            @click="handleExportProduct()">导出Excel</a-button>
+        </template>
+      </a-page-header>
+      <!-- 基础信息 -->
+      <a-card size="small" :bordered="false" class="purchaseOrderDetail-cont">
+        <a-collapse :activeKey="['1']">
+          <a-collapse-panel key="1" header="基础信息">
+            <a-descriptions :column="3">
+              <a-descriptions-item label="供应商">{{ (detail&&detail.purchaseTargetName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="支付方式">{{ (detail&&detail.settleStyleEntity&&detail.settleStyleEntity.name) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="采购员工" v-if="detail&&detail.purchaseBillSource=='PURCHASE'">{{ detail&&detail.operatorName || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName || '--' }}<span v-if="detail&&detail.consigneeTel">({{ detail&&detail.consigneeTel }})</span></a-descriptions-item>
+              <a-descriptions-item label="收货地址">
+                <div v-if="detail&&(detail.shippingAddressProvinceName || detail.shippingAddressCityName || detail.shippingAddressCountyName || detail.shippingAddress)">
+                  {{ detail&&detail.shippingAddressProvinceName || '' }}
+                  {{ detail&&detail.shippingAddressCityName || '' }}
+                  {{ detail&&detail.shippingAddressCountyName || '' }}
+                  {{ detail&&detail.shippingAddress || '' }}
+                </div>
+                <span v-else>--</span>
+              </a-descriptions-item>
+            </a-descriptions>
+          </a-collapse-panel>
+        </a-collapse>
+      </a-card>
+      <a-card size="small" :bordered="false" class="signWarehousingDetail-cont">
+        <!-- 总计 -->
+        <a-alert type="info" style="margin-bottom:10px">
+          <div slot="message">
+            产品款数:<strong>{{ detail && (detail.totalCategory || detail.totalCategory==0) ? detail.totalCategory : '--' }}</strong>,
+            本次发货数量合计:<strong>{{ detail && (detail.totalQty || detail.totalQty==0) ? detail.totalQty : '--' }}</strong>,
+            本次发货金额合计:<strong>{{ detail && (detail.discountedAmount || detail.discountedAmount==0) ? '¥'+detail.discountedAmount : '--' }}</strong>,
+          </div>
+        </a-alert>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          bordered>
+          <!-- 采购数量 -->
+          <template slot="origqty" slot-scope="text, record">
+            <div>{{ text }}</div>
+            <div v-if="record.origqty">原采购数量:{{ record.origqty }}</div>
+          </template>
+          <!-- 缺货数量 -->
+          <template slot="outOfStockNum" slot-scope="text, record">
+            <span>{{ record.outOfStockNum }}</span>
+          </template>
+        </s-table>
+      </a-card>
+    </a-spin>
+  </div>
+</template>
+
+<script>
+import moment from 'moment'
+import { STable, VSelect } from '@/components'
+import { purchaseDetailPrint, purchaseDetailExport, purchaseExportDetail } from '@/api/purchase'
+import { receivingDetailSn, receivingDetailList } from '@/api/receiving'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
+export default {
+  components: { STable, VSelect, Print },
+  data () {
+    return {
+      spinning: false,
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '17%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '采购单价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '采购数量', dataIndex: 'qty', width: '6%', align: 'center', scopedSlots: { customRender: 'origqty' } },
+        { title: '本次发货数量', dataIndex: 'shippedQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '本次发货金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '本次入库数量', dataIndex: 'putQty', width: '9%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        return receivingDetailList(Object.assign(parameter, { receivingBillSn: this.$route.params.sn })).then(res => {
+          const 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.localDataSource = data.list
+          this.disabled = false
+          return data
+        })
+      },
+      detail: null, //  详情数据
+      localDataSource: [],
+      printerType: 'NEEDLE' //  打印机类型
+    }
+  },
+  methods: {
+    //  返回列表
+    handleBack () {
+      this.$router.push({ path: '/purchasingManagement/signWarehousing/list', query: { closeLastOldTab: true } })
+    },
+    //  详情
+    getDetail () {
+      receivingDetailSn({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.detail = res.data
+        } else {
+          this.detail = null
+        }
+      })
+    },
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = purchaseDetailPrint
+      let params = { sn: this.$route.params.sn, type: printerType }
+      if (type == 'export') { //  导出
+        url = purchaseExportDetail
+        params = { sn: this.$route.params.sn }
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '备货单', function () {
+        _this.spinning = false
+      })
+    },
+    // 导出产品
+    handleExportProduct () {
+      const _this = this
+      _this.spinning = true
+      // 打印或导出
+      hdPrint('', 'export', purchaseExportDetail, { sn: this.$route.params.sn }, '备货单', function () {
+        _this.spinning = false
+      })
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.$refs.table.refresh(true)
+      this.getDetail()
+    }
+  },
+  activated () {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.$refs.table.refresh(true)
+      this.getDetail()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .signWarehousingDetail-cont{
+    margin-bottom: 10px;
+    .timeline-box{
+      margin-top: 30px;
+      .auxiliary-txt{
+        color: #808695;
+      }
+    }
+  }
+  .signWarehousingDetail-wrap{
+    .billno{
+      font-size: 16px;
+      font-weight: bold;
+      margin: 0 15px;
+    }
+  }
+</style>