Quellcode durchsuchen

对接散件入库

chenrui vor 4 Jahren
Ursprung
Commit
8b3c792b5a

+ 8 - 0
src/api/spareParts.js

@@ -77,3 +77,11 @@ export const sparePartsSaveDetail = (params) => {
     method: 'post'
     method: 'post'
   })
   })
 }
 }
+// 明细  详情
+export const sparePartsDetailD = (params) => {
+  return axios({
+    url: `/spareParts/queryDetailBySn/${params.sn}`,
+    data: params,
+    method: 'post'
+  })
+}

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

@@ -654,16 +654,6 @@ export const asyncRouterMap = [
                   icon: 'gold',
                   icon: 'gold',
                   hidden: true
                   hidden: true
                 }
                 }
-              },
-              {
-                path: 'detail/:id/:sn',
-                name: 'bulkWarehousingOrderDetail',
-                component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/bulkWarehousingOrder/detail.vue'),
-                meta: {
-                  title: '散件入库单详情',
-                  icon: 'gold',
-                  hidden: true
-                }
               }
               }
             ]
             ]
           }
           }

+ 0 - 183
src/views/purchasingManagement/bulkWarehousingOrder/detail.vue

@@ -1,183 +0,0 @@
-<template>
-  <div class="bulkWarehousingOrderDetail-wrap">
-    <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderDetail-cont" >
-      <!-- 自定义的二级文字标题 -->
-      <template slot="subTitle">
-        <a id="bulkWarehousingOrderDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-        <a-button
-          v-if="isEdit"
-          type="primary"
-          size="small"
-          style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
-          id="bulkWarehousingOrderDetail-edit-btn"
-          @click.stop="handleEdit">编辑</a-button>
-        <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseNo) || '--' }}</p>
-      </template>
-      <template slot="tags">
-        <a-tag color="red" v-if="basicInfoData&&basicInfoData.stateDictValue">{{ basicInfoData.stateDictValue }}</a-tag>
-        <a-tag color="orange" v-if="basicInfoData&&basicInfoData.settleStateDictValue">{{ basicInfoData.settleStateDictValue }}</a-tag>
-      </template>
-      <!-- 操作区,位于 title 行的行尾 -->
-      <template slot="extra">
-        <a-button key="2" id="bulkWarehousingOrderDetail-preview-btn">打印预览</a-button>
-        <a-button key="1" type="primary" id="bulkWarehousingOrderDetail-print-btn">快速打印</a-button>
-      </template>
-    </a-page-header>
-    <!-- 基础信息 -->
-    <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
-      <a-collapse :activeKey="['1']">
-        <a-collapse-panel key="1" header="基础信息">
-          <a-descriptions :column="3">
-            <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="联系人">
-              {{ (basicInfoData&&basicInfoData.supplierContactPerson) || '--' }}
-              <span v-if="basicInfoData&&basicInfoData.supplierContactTel">({{ basicInfoData.supplierContactTel }})</span>
-            </a-descriptions-item>
-            <a-descriptions-item label="联系地址">
-              {{ (basicInfoData&&basicInfoData.supplierProvinceName) || '' }}
-              {{ (basicInfoData&&basicInfoData.supplierCityName) || '' }}
-              {{ (basicInfoData&&basicInfoData.supplierCountyName) || '' }}
-              {{ (basicInfoData&&basicInfoData.supplierAddress) || '' }}
-            </a-descriptions-item>
-          </a-descriptions>
-        </a-collapse-panel>
-      </a-collapse>
-    </a-card>
-    <!-- 产品详情 -->
-    <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
-      <a-collapse :activeKey="['1']">
-        <a-collapse-panel key="1" header="产品详情">
-          <!-- 总计 -->
-          <a-alert type="info" showIcon style="margin-bottom:15px">
-            <div slot="message">总款数 <strong>{{ (productTotal&&productTotal.productTotalCategory) || 0 }}</strong> ,总数量 <strong>{{ (productTotal&&productTotal.productTotalQty) || 0 }}</strong> ,总成本¥<strong>{{ (productTotal&&productTotal.productTotalCost) || 0 }}</strong></div>
-          </a-alert>
-          <!-- 列表 -->
-          <s-table
-            class="sTable"
-            ref="table"
-            size="small"
-            :rowKey="(record) => record.id"
-            :columns="columns"
-            :data="loadData"
-            :scroll="{ x: 1180 }"
-            bordered>
-          </s-table>
-        </a-collapse-panel>
-      </a-collapse>
-    </a-card>
-    <!-- 单据记录  二期 -->
-    <!-- <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
-      <a-collapse :activeKey="['1']">
-        <a-collapse-panel key="1" header="单据记录">
-          <a-timeline class="timeline-box">
-            <a-timeline-item>2021-02-01 15:22:38   王凯   审核通过</a-timeline-item>
-            <a-timeline-item>
-              <p>2021-02-01 15:22:38   王凯   审核通过</p>
-              <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
-              <p class="auxiliary-txt">产品编号JA-11076P的采购数量,由【10】修改为【5】</p>
-            </a-timeline-item>
-            <a-timeline-item>Technical testing 2015-09-01</a-timeline-item>
-            <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
-          </a-timeline>
-        </a-collapse-panel>
-      </a-collapse>
-    </a-card> -->
-  </div>
-</template>
-
-<script>
-import { STable, VSelect } from '@/components'
-import { getOperationalPrecision } from '@/libs/tools.js'
-// import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount } from '@/api/sparePartsPur'
-export default {
-  components: { STable, VSelect },
-  data () {
-    return {
-      // 表头
-      columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购单价', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '采购数量', dataIndex: 'putQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '采购金额', dataIndex: 'purchaseAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '仓库', dataIndex: 'warehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        return sparePartsPurDetailList(Object.assign(parameter, { sparePartsPurchaseSn: 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
-            // 采购金额  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
-            data.list[i].purchaseAmount = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
-          }
-          this.disabled = false
-          return data
-        })
-      },
-      basicInfoData: null, //  基本信息
-      productTotal: null //  合计
-    }
-  },
-  computed: {
-    isEdit () {
-      return this.basicInfoData && this.basicInfoData.state != 'FINISH'
-    }
-  },
-  methods: {
-    //  返回列表
-    handleBack () {
-      this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list' })
-    },
-    // 基本信息
-    getDetail () {
-      sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
-        if (res.status == 200) {
-          this.basicInfoData = res.data
-        } else {
-          this.basicInfoData = null
-        }
-      })
-    },
-    // 合计
-    getDetailCount () {
-      sparePartsPurDetailCount({ sparePartsPurchaseSn: this.$route.params.sn }).then(res => {
-        if (res.status == 200) {
-          this.productTotal = res.data
-        } else {
-          this.productTotal = null
-        }
-      })
-    },
-    //  编辑
-    handleEdit () {
-      this.$router.push({ path: `/bulkManagement/bulkWarehousingOrder/edit/${this.basicInfoData.id}/${this.basicInfoData.sparePartsPurchaseSn}` })
-    }
-  },
-  beforeRouteEnter (to, from, next) {
-    next(vm => {
-      vm.getDetail()
-      vm.getDetailCount()
-    })
-  }
-}
-</script>
-
-<style lang="less">
-  .bulkWarehousingOrderDetail-cont{
-    margin-bottom: 10px;
-    .timeline-box{
-      margin-top: 30px;
-      .auxiliary-txt{
-        color: #808695;
-      }
-    }
-  }
-</style>

+ 145 - 0
src/views/purchasingManagement/bulkWarehousingOrder/detailModal.vue

@@ -0,0 +1,145 @@
+<template>
+  <a-modal
+    centered
+    class="bulkWarehousingOrder-basicInfo-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="详情"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="1000">
+    <div style="padding: 0 12px;text-align: right;">
+      <a-button id="bulkWarehousingOrderDetail-preview-btn" style="margin-right: 15px;">打印预览</a-button>
+      <a-button type="primary" id="bulkWarehousingOrderDetail-print-btn">快速打印</a-button>
+    </div>
+    <!-- 基础信息 -->
+    <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
+      <a-collapse :activeKey="['1']">
+        <a-collapse-panel key="1">
+          <template slot="header">
+            基础信息
+          </template>
+          <a-descriptions :column="3">
+            <a-descriptions-item label="供应商">{{ (productTotal&&productTotal.supplierName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="入库类型">{{ (productTotal&&productTotal.sparePartsTypeDictValue) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="入库单号">{{ (productTotal&&productTotal.sparePartsNo) || '--' }}</a-descriptions-item>
+          </a-descriptions>
+        </a-collapse-panel>
+      </a-collapse>
+    </a-card>
+    <a-card size="small" :bordered="false" class="bulkWarehousingOrderDetail-cont">
+      <!-- 总计 -->
+      <a-alert type="info" showIcon style="margin-bottom:15px">
+        <div slot="message">入库数量 <strong>{{ (productTotal&&productTotal.totalQty) || 0 }}</strong> ,入库金额 <strong>{{ (productTotal&&productTotal.totalPrice) || 0 }}</strong></div>
+      </a-alert>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        bordered>
+      </s-table>
+    </a-card>
+    <div class="btn-cont">
+      <a-button id="bulkWarehousingOrder-basicInfo-modal-back" @click="isShow = false" style="margin-left: 15px;">返回列表</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { getOperationalPrecision } from '@/libs/tools.js'
+import { sparePartsDetailList, sparePartsPageCount } from '@/api/spareParts'
+export default {
+  name: 'BulkWarehousingOrderDetailModal',
+  components: { STable, VSelect },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '入库数量', dataIndex: 'productQty', width: 100, align: 'center' },
+        { title: '入库单价', dataIndex: 'productCost', width: 100, align: 'center' },
+        { title: '小计', dataIndex: 'subtotal', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return sparePartsDetailList(Object.assign(parameter, { sn: this.itemSn })).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+            // 小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
+            data.list[i].subtotal = getOperationalPrecision(data.list[i].productCost, data.list[i].productQty)
+          }
+          this.getDetailCount(Object.assign(parameter, { sn: this.itemSn }))
+          return data
+        })
+      },
+      productTotal: null //  合计
+    }
+  },
+  methods: {
+    //  返回列表
+    handleBack () {
+      this.$router.push({ path: '/purchasingManagement/bulkWarehousingOrder/list' })
+    },
+    // 合计
+    getDetailCount (params) {
+      sparePartsPageCount(params).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+        } else {
+          this.productTotal = null
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    },
+    itemSn (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        this.$refs.table.refresh(true)
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .bulkWarehousingOrder-basicInfo-modal{
+    .ant-modal-body {
+      padding: 10px 10px 20px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 20 - 89
src/views/purchasingManagement/bulkWarehousingOrder/edit.vue

@@ -5,7 +5,6 @@
       <!-- 自定义的二级文字标题 -->
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
       <template slot="subTitle">
         <a id="bulkWarehousingOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
         <a id="bulkWarehousingOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-        <!-- <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseNo) || '' }}</p> -->
       </template>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
       <template slot="extra">
@@ -21,9 +20,9 @@
             基础信息
             基础信息
           </template>
           </template>
           <a-descriptions :column="3">
           <a-descriptions :column="3">
-            <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '--' }}</a-descriptions-item>
-            <a-descriptions-item label="入库单号">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="供应商">{{ (productTotal&&productTotal.supplierName) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="入库类型">{{ (productTotal&&productTotal.sparePartsTypeDictValue) || '--' }}</a-descriptions-item>
+            <a-descriptions-item label="入库单号">{{ (productTotal&&productTotal.sparePartsNo) || '--' }}</a-descriptions-item>
           </a-descriptions>
           </a-descriptions>
         </a-collapse-panel>
         </a-collapse-panel>
       </a-collapse>
       </a-collapse>
@@ -31,7 +30,7 @@
     <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
     <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
       <!-- 操作按钮 -->
       <!-- 操作按钮 -->
       <div class="table-operator">
       <div class="table-operator">
-        <a-button id="bulkWarehousingOrderEdit-add" type="primary" class="button-error" @click="handleAdd">新增产品</a-button>
+        <a-button id="bulkWarehousingOrderEdit-add" type="primary" class="button-error" @click="handleEdit()">新增产品</a-button>
       </div>
       </div>
       <!-- 总计 -->
       <!-- 总计 -->
       <a-alert type="info" showIcon style="margin-bottom:15px">
       <a-alert type="info" showIcon style="margin-bottom:15px">
@@ -70,18 +69,19 @@
           id="bulkWarehousingOrderEdit-submit"
           id="bulkWarehousingOrderEdit-submit"
           size="large"
           size="large"
           class="button-primary"
           class="button-primary"
-          @click="handleSubmit"
+          @click="handleBack"
           style="padding: 0 60px;">保存并返回</a-button>
           style="padding: 0 60px;">保存并返回</a-button>
       </div>
       </div>
     </a-affix>
     </a-affix>
-    <spare-parts-product-modal :openModal="openModal" :itemSn="itemSn" @ok="handleOk" @close="openModal=false" />
+    <spare-parts-product-modal :openModal="openModal" :itemSn="itemSn" :nowData="productTotal" @ok="$refs.table.refresh(true)" @close="openModal=false" />
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
+import { getOperationalPrecision } from '@/libs/tools.js'
 import sparePartsProductModal from './productModal.vue'
 import sparePartsProductModal from './productModal.vue'
-import { sparePartsDetailList, sparePartsPageCount } from '@/api/spareParts'
+import { sparePartsDetailList, sparePartsPageCount, sparePartsDeleteDetail } from '@/api/spareParts'
 export default {
 export default {
   components: { STable, VSelect, sparePartsProductModal },
   components: { STable, VSelect, sparePartsProductModal },
   data () {
   data () {
@@ -89,13 +89,13 @@ export default {
       // 表头
       // 表头
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'code', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品编码', dataIndex: 'productCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '入库数量', dataIndex: 'putQty', width: 140, align: 'center' },
-        { title: '入库单价', dataIndex: 'putCost', width: 140, align: 'center' },
-        { title: '小计', dataIndex: 'origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
+        { title: '入库数量', dataIndex: 'productQty', width: 100, align: 'center' },
+        { title: '入库单价', dataIndex: 'productCost', width: 100, align: 'center' },
+        { title: '小计', dataIndex: 'subtotal', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 120, align: 'center', fixed: 'right' }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
@@ -104,6 +104,8 @@ export default {
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].no = no + i + 1
+            // 小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
+            data.list[i].subtotal = getOperationalPrecision(data.list[i].productCost, data.list[i].productQty)
           }
           }
           this.getDetailCount(Object.assign(parameter, { sn: this.$route.params.sn }))
           this.getDetailCount(Object.assign(parameter, { sn: this.$route.params.sn }))
           return data
           return data
@@ -116,32 +118,11 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
-    // 基本信息
-    getDetail () {
-      sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
-        if (res.status == 200) {
-          this.basicInfoData = res.data
-        } else {
-          this.basicInfoData = null
-        }
-      })
-    },
-    //  添加
-    handleAdd () {
+    //  添加/编辑
+    handleEdit (row) {
+      this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
       this.openModal = true
       this.openModal = true
     },
     },
-    //  保存
-    handleSubmit () {
-      const _this = this
-      sparePartsPurSubmit({ id: this.$route.params.id }).then(res => {
-        if (res.status == 200) {
-          this.$message.success(res.message)
-          setTimeout(() => {
-            _this.handleBack()
-          }, 1000)
-        }
-      })
-    },
     //  删除
     //  删除
     handleDel (row) {
     handleDel (row) {
       const _this = this
       const _this = this
@@ -150,7 +131,7 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         centered: true,
         onOk () {
         onOk () {
-          sparePartsPurDetailDel({ id: row.id }).then(res => {
+          sparePartsDeleteDetail({ sn: row.sparePartsDetailSn }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.$refs.table.refresh()
@@ -159,12 +140,6 @@ export default {
         }
         }
       })
       })
     },
     },
-    //  编辑基本信息
-    handleEditInfo () {
-      this.openModal = true
-    },
-    //  基本信息  保存
-    handleOk () {},
     //  返回列表
     //  返回列表
     handleBack () {
     handleBack () {
       this.$router.push({ path: '/purchasingManagement/bulkWarehousingOrder/list' })
       this.$router.push({ path: '/purchasingManagement/bulkWarehousingOrder/list' })
@@ -178,32 +153,6 @@ export default {
           this.productTotal = null
           this.productTotal = null
         }
         }
       })
       })
-    },
-    // 产品列表数据
-    getProductList (pageNo, sorter) {
-      this.pageNo = pageNo || this.pageNo
-      const params = {
-        pageNo: this.pageNo,
-        pageSize: this.pageSize,
-        sn: this.$route.params.sn
-      }
-      sparePartsDetailList(params).then(res => {
-        if (res.status == 200) {
-          this.getDetailCount(params)
-          const data = res.data
-          this.paginationProps.total = Number(res.data.count) || 0
-          this.paginationProps.current = this.pageNo
-          const no = (data.pageNo - 1) * data.pageSize
-          for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = no + i + 1
-          }
-          this.loadData = data.list
-        } else {
-          this.paginationProps.total = 0
-          this.paginationProps.current = 1
-          this.loadData = []
-        }
-      })
     }
     }
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {
@@ -218,24 +167,6 @@ export default {
   .bulkWarehousingOrderEdit-wrap{
   .bulkWarehousingOrderEdit-wrap{
     .bulkWarehousingOrderEdit-cont{
     .bulkWarehousingOrderEdit-cont{
       margin-bottom: 10px;
       margin-bottom: 10px;
-      .sub-title{
-        font-size: 12px;
-        color: #808695;
-        margin-left: 10px;
-      }
-      .tag-txt{
-        font-size: 12px;
-        color: #ed1c24;
-      }
-      .edit-circle-btn{
-        margin-left: 15px;
-        i{
-          vertical-align: text-bottom;
-        }
-      }
-      .import-btn{
-        margin-left: 15px;
-      }
     }
     }
   }
   }
 </style>
 </style>

+ 47 - 84
src/views/purchasingManagement/bulkWarehousingOrder/list.vue

@@ -6,12 +6,12 @@
         <a-row :gutter="15">
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
           <a-col :md="6" :sm="24">
             <a-form-item label="产品编号">
             <a-form-item label="产品编号">
-              <a-input id="bulkWarehousingOrderList-sparePartsPurchaseNo" v-model.trim="queryParam.sparePartsPurchaseNo" allowClear placeholder="请输入产品编号"/>
+              <a-input id="bulkWarehousingOrderList-productCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编号"/>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :md="6" :sm="24">
           <a-col :md="6" :sm="24">
             <a-form-item label="关联单号">
             <a-form-item label="关联单号">
-              <a-input id="bulkWarehousingOrderList-sparePartsNo" v-model.trim="queryParam.sparePartsNo" allowClear placeholder="请输入关联单号"/>
+              <a-input id="bulkWarehousingOrderList-relationNo" v-model.trim="queryParam.relationNo" allowClear placeholder="请输入关联单号"/>
             </a-form-item>
             </a-form-item>
           </a-col>
           </a-col>
           <a-col :md="6" :sm="24">
           <a-col :md="6" :sm="24">
@@ -42,8 +42,8 @@
       class="sTable"
       class="sTable"
       ref="table"
       ref="table"
       size="default"
       size="default"
-      :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
-      :rowKey="(record) => record.id"
+      :row-selection="rowSelection"
+      :rowKey="(record) => record.sparePartsSn"
       :columns="columns"
       :columns="columns"
       :data="loadData"
       :data="loadData"
       :scroll="{ x: 1960, y: tableHeight }"
       :scroll="{ x: 1960, y: tableHeight }"
@@ -77,31 +77,26 @@
     </s-table>
     </s-table>
     <!-- 选择基本信息弹框 -->
     <!-- 选择基本信息弹框 -->
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
     <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
+    <sparePartsDetailModal :openModal="openDetailModal" :itemSn="itemSn" @close="closeDetailModal" />
   </a-card>
   </a-card>
 </template>
 </template>
 
 
 <script>
 <script>
-import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
 import basicInfoModal from './basicInfoModal.vue'
-import { sparePartsList } from '@/api/spareParts'
+import sparePartsDetailModal from './detailModal.vue'
+import { sparePartsList, sparePartsDelete, sparePartsAudit } from '@/api/spareParts'
 export default {
 export default {
-  components: { STable, VSelect, basicInfoModal },
+  components: { STable, VSelect, basicInfoModal, sparePartsDetailModal },
   data () {
   data () {
     return {
     return {
-      advanced: false, // 高级搜索 展开/关闭
       disabled: false, //  查询、重置按钮是否可操作
       disabled: false, //  查询、重置按钮是否可操作
-      exportLoading: false, // 导出loading
       openModal: false, // 基本信息弹框是否显示
       openModal: false, // 基本信息弹框是否显示
-      createDate: [], //  创建时间
-      dateFormat: 'YYYY-MM-DD',
       tableHeight: 0,
       tableHeight: 0,
       // 查询参数
       // 查询参数
       queryParam: {
       queryParam: {
-        sparePartsNo: '', //  单号
-        supplierSn: undefined, //  供应商
-        state: undefined, //  单据状态
-        settleState: undefined //  结算状态
+        productCode: '',
+        relationNo: ''
       },
       },
       // 表头
       // 表头
       columns: [
       columns: [
@@ -126,14 +121,6 @@ export default {
         if (this.tableHeight == 0) {
         if (this.tableHeight == 0) {
           this.tableHeight = window.innerHeight - 440
           this.tableHeight = window.innerHeight - 440
         }
         }
-        // 创建时间
-        if (this.createDate && this.createDate.length > 0) {
-          this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
-          this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
-        } else {
-          this.queryParam.beginDate = undefined
-          this.queryParam.endDate = undefined
-        }
         return sparePartsList(Object.assign(parameter, this.queryParam)).then(res => {
         return sparePartsList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           const no = (data.pageNo - 1) * data.pageSize
@@ -144,23 +131,30 @@ export default {
           return data
           return data
         })
         })
       },
       },
-      productTotal: { // 合计信息
-        productTotalCost: '',
-        productTotalQty: ''
-      },
-      dataTotalCount: '' //  列表数据总条数
+      openDetailModal: false,
+      itemSn: null
     }
     }
   },
   },
   computed: {
   computed: {
     hasSelected () {
     hasSelected () {
       return this.selectedRowKeys.length > 0
       return this.selectedRowKeys.length > 0
+    },
+    rowSelection () {
+      return {
+        selectedRowKeys: this.selectedRowKeys,
+        onChange: (selectedRowKeys, selectedRows) => {
+          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
+          this.onSelectChange(selectedRowKeys)
+        },
+        getCheckboxProps: record => ({
+          props: {
+            disabled: record.state != 'WAIT_AUDIT'
+          }
+        })
+      }
     }
     }
   },
   },
   methods: {
   methods: {
-    // 不可选日期
-    disabledDate (date, dateStrings) {
-      return date && date.valueOf() > Date.now()
-    },
     onSelectChange (selectedRowKeys, selectedRows) {
     onSelectChange (selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
       this.selectedRows = selectedRows
@@ -179,7 +173,13 @@ export default {
     },
     },
     //  详情
     //  详情
     handleDetail (row) {
     handleDetail (row) {
-      this.$router.push({ path: `/purchasingManagement/bulkWarehousingOrder/detail/${row.id}/${row.sparePartsSn}` })
+      this.itemSn = row.sparePartsSn
+      this.openDetailModal = true
+    },
+    // 关闭弹框
+    closeDetailModal () {
+      this.itemSn = null
+      this.openDetailModal = false
     },
     },
     //  删除
     //  删除
     handleDel (row) {
     handleDel (row) {
@@ -189,7 +189,7 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         centered: true,
         onOk () {
         onOk () {
-          sparePartsPurDel({ id: row.id }).then(res => {
+          sparePartsDelete({ sn: row.sparePartsSn }).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
               _this.$refs.table.refresh()
@@ -200,11 +200,8 @@ export default {
     },
     },
     //  重置
     //  重置
     resetSearchForm () {
     resetSearchForm () {
-      this.queryParam.sparePartsPurchaseNo = ''
-      this.queryParam.supplierSn = undefined
-      this.queryParam.state = undefined
-      this.queryParam.settleState = undefined
-      this.createDate = undefined
+      this.queryParam.productCode = ''
+      this.queryParam.relationNo = ''
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
     // 批量审核
     // 批量审核
@@ -214,62 +211,28 @@ export default {
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         _this.$message.warning('请在列表勾选后再进行批量操作!')
         return
         return
       }
       }
-      let num = 0
-      const obj = []
-      _this.selectedRows.map(item => {
-        if (item.state == 'WAIT') {
-          num++
-          obj.push(item.productSn)
-        }
-      })
-      if (num < 1) {
-        _this.$message.warning('当前数据不可操作!')
-        return
-      }
       this.$confirm({
       this.$confirm({
         title: '提示',
         title: '提示',
-        content: '已选有效数据' + num + '条,确认要批量审核吗?',
+        content: '确认要批量审核吗?',
         centered: true,
         centered: true,
         onOk () {
         onOk () {
-          // productBatchAudit({ snList: obj }).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //   }
-          // })
+          sparePartsAudit(_this.selectedRowKeys).then(res => {
+            if (res.status == 200) {
+              _this.selectedRowKeys = []
+              _this.selectedRows = []
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
         }
         }
       })
       })
-    },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      this.exportLoading = true
-      // customerBundleExportDelay(params).then(res => {
-      //   this.exportLoading = false
-      //   this.download(res)
-      // })
-    },
-    download (data) {
-      if (!data) { return }
-      const url = window.URL.createObjectURL(new Blob([data]))
-      const link = document.createElement('a')
-      link.style.display = 'none'
-      link.href = url
-      const a = moment().format('YYYYMMDDHHmmss')
-      const fname = '散件入库单' + a
-      link.setAttribute('download', fname + '.xlsx')
-      document.body.appendChild(link)
-      link.click()
     }
     }
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {
     next(vm => {
     next(vm => {
       vm.openModal = false
       vm.openModal = false
+      vm.openDetailModal = false
+      vm.itemSn = null
     })
     })
   }
   }
 }
 }

+ 125 - 42
src/views/purchasingManagement/bulkWarehousingOrder/productModal.vue

@@ -15,35 +15,50 @@
       :rules="rules"
       :rules="rules"
       :label-col="formItemLayout.labelCol"
       :label-col="formItemLayout.labelCol"
       :wrapper-col="formItemLayout.wrapperCol" >
       :wrapper-col="formItemLayout.wrapperCol" >
-      <a-form-model-item label="供应商" prop="supplierSn">供应商名称</a-form-model-item>
-      <a-form-model-item label="产品名称" prop="supplierSn">供应商名称</a-form-model-item>
-      <a-form-model-item label="原厂编码" prop="supplierSn">供应商名称</a-form-model-item>
-      <a-form-model-item label="仓库仓位" prop="sparePartsType">
+      <a-form-model-item label="供应商" prop="supplierSn">{{ (nowData&&nowData.supplierName) || '--' }}</a-form-model-item>
+      <a-form-model-item label="产品编码" prop="productSn">
+        <a-select
+          show-search
+          id="bulkWarehousingOrder-product-productSn"
+          v-model="form.productSn"
+          placeholder="请选择"
+          :filter-option="false"
+          :not-found-content="fetching ? undefined : null"
+          @search="fetchUser"
+          @change="handleChange"
+        >
+          <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+          <a-select-option v-for="item in productData" :key="item.product.productSn + item.product.code" :value="item.product.productSn">{{ item.product.code }}</a-select-option>
+        </a-select>
+      </a-form-model-item>
+      <a-form-model-item label="产品名称" prop="productName">{{ form.productName || '--' }}</a-form-model-item>
+      <a-form-model-item label="原厂编码" prop="productOrigCode">{{ form.productOrigCode || '--' }}</a-form-model-item>
+      <a-form-model-item label="仓库仓位" prop="warehouse">
         <a-cascader
         <a-cascader
           @change="changeWarehouseCascade"
           @change="changeWarehouseCascade"
-          v-model="form.warehouseCascade"
+          v-model="form.warehouse"
           expand-trigger="hover"
           expand-trigger="hover"
           :allowClear="false"
           :allowClear="false"
           :options="warehouseCascadeData"
           :options="warehouseCascadeData"
           :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
           :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
-          id="bulkWarehousingOrder-product-warehouseCascade"
+          id="bulkWarehousingOrder-product-warehouse"
           placeholder="请选择仓库仓位"
           placeholder="请选择仓库仓位"
           style="width: 100%;" />
           style="width: 100%;" />
       </a-form-model-item>
       </a-form-model-item>
-      <a-form-model-item label="成本价" prop="relationNo">
+      <a-form-model-item label="成本价" prop="productCost">
         <a-input-number
         <a-input-number
-          id="bulkWarehousingOrder-product-packQty"
-          v-model="form.packQty"
+          id="bulkWarehousingOrder-product-productCost"
+          v-model="form.productCost"
           :precision="2"
           :precision="2"
           :min="0.1"
           :min="0.1"
           :max="999999"
           :max="999999"
           placeholder="请输入"
           placeholder="请输入"
           style="width: 100%;" />
           style="width: 100%;" />
       </a-form-model-item>
       </a-form-model-item>
-      <a-form-model-item label="数量" prop="remark">
+      <a-form-model-item label="数量" prop="productQty">
         <a-input-number
         <a-input-number
-          id="bulkWarehousingOrder-product-packQty"
-          v-model="form.packQty"
+          id="bulkWarehousingOrder-product-productQty"
+          v-model="form.productQty"
           :precision="0"
           :precision="0"
           :min="1"
           :min="1"
           :max="999999"
           :max="999999"
@@ -60,9 +75,10 @@
 
 
 <script>
 <script>
 import { VSelect } from '@/components'
 import { VSelect } from '@/components'
-import { supplierAllList } from '@/api/supplier'
+import debounce from 'lodash/debounce'
+import { supplierProductList } from '@/api/supplier'
 import { warehouseCascadeList } from '@/api/warehouse'
 import { warehouseCascadeList } from '@/api/warehouse'
-import { sparePartsSave } from '@/api/spareParts'
+import { sparePartsSaveDetail, sparePartsDetailD } from '@/api/spareParts'
 export default {
 export default {
   name: 'BulkWarehousingOrderBasicInfoModal',
   name: 'BulkWarehousingOrderBasicInfoModal',
   components: { VSelect },
   components: { VSelect },
@@ -74,9 +90,16 @@ export default {
     itemSn: {
     itemSn: {
       type: [Number, String],
       type: [Number, String],
       default: ''
       default: ''
+    },
+    nowData: {
+      type: Object,
+      default: () => {
+        return null
+      }
     }
     }
   },
   },
   data () {
   data () {
+    this.fetchUser = debounce(this.fetchUser, 800)
     return {
     return {
       isShow: this.openModal, //  是否打开弹框
       isShow: this.openModal, //  是否打开弹框
       formItemLayout: {
       formItemLayout: {
@@ -84,30 +107,83 @@ export default {
         wrapperCol: { span: 16 }
         wrapperCol: { span: 16 }
       },
       },
       form: {
       form: {
-        supplierSn: undefined, // 供应商
-        sparePartsType: undefined, //  散件类型
-        relationNo: '', //  关联单号
-        remark: '' // 备注
+        supplierSn: '', // 供应商
+        productSn: undefined,
+        productName: '',
+        productCode: '',
+        productOrigCode: '',
+        warehouse: [],
+        warehouseSn: '',
+        warehouseLocationSn: '',
+        productCost: '',
+        productQty: ''
       },
       },
       rules: {
       rules: {
-        supplierSn: [
-          { required: true, message: '请选择供应商', trigger: 'change' }
+        productSn: [
+          { required: true, message: '请选择产品编码', trigger: 'change' }
         ],
         ],
-        sparePartsType: [
-          { required: true, message: '请选择入库类型', trigger: 'change' }
+        warehouse: [
+          { required: true, message: '请选择仓库仓位', trigger: 'change' }
+        ],
+        productCost: [
+          { required: true, message: '请输入成本价', trigger: 'blur' }
+        ],
+        productQty: [
+          { required: true, message: '请输入数量', trigger: 'blur' }
         ]
         ]
       },
       },
-      warehouseCascadeData: [] //  仓库仓位  下拉数据
+      fetching: false,
+      productData: [],
+      warehouseCascadeData: [], //  仓库仓位  下拉数据
+      warehouseSnBackups: '', //  仓库备份数据
+      warehouseLocationSnBackups: '' //  仓位备份数据
     }
     }
   },
   },
   methods: {
   methods: {
+    // 搜索经销商
+    fetchUser (value) {
+      console.log('fetching user', value)
+      this.fetching = true
+      supplierProductList({ productCode: value, pageNo: 1, pageSize: 20 }).then(res => {
+        if (res.status == 200) {
+          this.productData = res.data.list
+          this.fetching = false
+        } else {
+          this.productData = []
+          this.fetching = false
+        }
+      })
+    },
+    // 调往对象名称  change
+    handleChange (value) {
+      const ind = this.productData.findIndex(item => item.productSn == value)
+      this.form.productName = this.productData[ind].product.name
+      this.form.productCode = this.productData[ind].product.code
+      this.form.productOrigCode = this.productData[ind].product.origCode
+    },
+    // 详情
+    getDetail () {
+      sparePartsDetailD({ sn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          const data = res.data
+          this.form = Object.assign(this.form, data)
+          this.fetchUser(this.form.productSn)
+          this.form.warehouse = [this.form.warehouseSn, this.form.warehouseLocationSn]
+          this.warehouseSnBackups = this.form.warehouseSn || undefined
+          this.warehouseLocationSnBackups = this.form.warehouseLocationSn || undefined
+        }
+      })
+    },
     //  保存
     //  保存
     handleSave () {
     handleSave () {
       const _this = this
       const _this = this
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           const form = JSON.parse(JSON.stringify(_this.form))
           const form = JSON.parse(JSON.stringify(_this.form))
-          sparePartsSave(form).then(res => {
+          form.sparePartsSn = this.nowData.sparePartsSn
+          form.sparePartsNo = this.nowData.sparePartsNo
+          form.supplierSn = this.nowData.supplierSn
+          sparePartsSaveDetail(form).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
               setTimeout(() => {
               setTimeout(() => {
@@ -123,23 +199,21 @@ export default {
       })
       })
     },
     },
     changeWarehouseCascade (val) {
     changeWarehouseCascade (val) {
-      console.log(val)
-      // if (val.length < 2) {
-      //   this.$message.warning('当前仓库无仓位,请选择其他仓库')
-      //   const warehouseSnBackups = this.loadData[ind].warehouseSnBackups || undefined
-      //   const warehouseLocationSnBackups = this.loadData[ind].warehouseLocationSnBackups || undefined
-      //   this.loadData[ind].warehouseSn = warehouseSnBackups
-      //   this.loadData[ind].warehouseLocationSn = warehouseLocationSnBackups
-      //   if (warehouseSnBackups || warehouseLocationSnBackups) {
-      //     this.loadData[ind].warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
-      //   } else {
-      //     this.loadData[ind].warehouseCascade = undefined
-      //   }
-      // } else {
-      //   this.loadData[ind].warehouseSn = val[0] ? val[0] : ''
-      //   this.loadData[ind].warehouseLocationSn = val[1] ? val[1] : ''
-      //   this.handleAdd(this.loadData[ind])
-      // }
+      if (val.length < 2) {
+        this.$message.warning('当前仓库无仓位,请选择其他仓库')
+        this.form.warehouseSn = this.warehouseSnBackups
+        this.form.warehouseLocationSn = this.warehouseLocationSnBackups
+        if (this.warehouseSnBackups || this.warehouseLocationSnBackups) {
+          this.form.warehouse = [this.warehouseSnBackups, this.warehouseLocationSnBackups]
+        } else {
+          this.form.warehouse = []
+        }
+      } else {
+        this.form.warehouseSn = val[0] ? val[0] : ''
+        this.form.warehouseLocationSn = val[1] ? val[1] : ''
+        this.warehouseSnBackups = this.form.warehouseSn
+        this.warehouseLocationSnBackups = this.form.warehouseLocationSn
+      }
     },
     },
     // 仓库仓位
     // 仓库仓位
     getWarehouseCascade () {
     getWarehouseCascade () {
@@ -170,8 +244,17 @@ export default {
       if (!newValue) {
       if (!newValue) {
         this.$emit('close')
         this.$emit('close')
         this.$refs.ruleForm.resetFields()
         this.$refs.ruleForm.resetFields()
+        this.warehouseSnBackups = ''
+        this.warehouseLocationSnBackups = ''
       } else {
       } else {
-        this.getWarehouseCascade()
+        if (this.warehouseCascadeData.length == 0) {
+          this.getWarehouseCascade()
+        }
+      }
+    },
+    itemSn (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        this.getDetail()
       }
       }
     }
     }
   }
   }