Parcourir la source

仓库调拨对接

1004749546@qq.com il y a 4 ans
Parent
commit
0aaca5f0d0

+ 8 - 0
src/api/allocWarehouse.js

@@ -101,3 +101,11 @@ export const allocWarehouseFind = params => {
     method: 'post'
   })
 }
+// 提交
+export const allocWarehouseSubmit = params => {
+  return axios({
+    url: '/allocWarehouse/submit',
+    data: params,
+    method: 'post'
+  })
+}

+ 18 - 10
src/views/allocationManagement/warehouseAllocation/basicInfoModal.vue

@@ -16,7 +16,7 @@
       :label-col="formItemLayout.labelCol"
       :wrapper-col="formItemLayout.wrapperCol"
     >
-      <a-form-model-item label="调出仓库" prop="sort">
+      <a-form-model-item required label="调出仓库" prop="outWarehouseSn">
         <a-select
           id="warehouseAllocation-basicInfo-outWarehouseSn"
           allowClear
@@ -28,7 +28,7 @@
           </a-select-option>
         </a-select>
       </a-form-model-item>
-      <a-form-model-item label="调入仓库" prop="sort">
+      <a-form-model-item required label="调入仓库" prop="putWarehouseSn">
         <a-select
           id="warehouseAllocation-basicInfo-putWarehouseSn"
           allowClear
@@ -41,10 +41,10 @@
         </a-select>
       </a-form-model-item>
       <a-form-model-item label="关联单号" prop="relevanceNo">
-        <a-input id="warehouseAllocation-basicInfo-relevanceNo" :maxLength="30" v-model="form.relevanceNo" placeholder="请输入关联单号(最多30个字符)" allowClear />
+        <a-input id="warehouseAllocation-basicInfo-relevanceNo" :maxLength="120" v-model="form.relevanceNo" placeholder="请输入关联单号(最多120个字符)" allowClear />
       </a-form-model-item>
       <a-form-model-item label="备注" prop="remark">
-        <a-textarea id="warehouseAllocation-basicInfo-remark" :maxLength="500" v-model="form.remark" placeholder="请输入备注(最多500个字符)" allowClear />
+        <a-textarea id="warehouseAllocation-basicInfo-remark" :maxLength="120" v-model="form.remark" placeholder="请输入备注(最多120个字符)" allowClear />
       </a-form-model-item>
     </a-form-model>
     <div class="btn-cont">
@@ -96,7 +96,8 @@ export default {
         remark: '' // 备注
       },
       rules: {
-        name: [{ required: true, message: '请输入仓库名称', trigger: 'blur' }]
+        putWarehouseSn: [{ required: true, message: '请选择调入仓库', trigger: 'blur' }],
+        outWarehouseSn: [{ required: true, message: '请选择调出仓库', trigger: 'blur' }]
       },
 	  warehouseList: [], // 仓库列表
       brandData: [] //  供应商  下拉数据
@@ -116,12 +117,19 @@ export default {
     },
     //  保存
     handleSave () {
-      allocWarehouseSave(this.form).then(res => {
-        if (res.status == 200) {
-          this.isShow = false
-          this.$emit('ok', res.data)
+	  this.$refs['ruleForm'].validate(valid => {
+        if (valid) {
+		  allocWarehouseSave(this.form).then(res => {
+		    if (res.status == 200) {
+		      this.isShow = false
+		      this.$emit('ok', res.data)
+		    }
+		  })
+        } else {
+		  console.log('error submit!!')
+		  return false
         }
-      })
+	  })
     },
     filterOption (input, option) {
       return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0

+ 72 - 13
src/views/allocationManagement/warehouseAllocation/detail.vue

@@ -4,6 +4,16 @@
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
         <a id="warehouseAllocationDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a-button
+          v-if="warehouse&&warehouse.stateDictValue!='已完结'"
+          type="primary"
+          size="small"
+          style="background-color: #1890ff;margin-left: 20px;border: #1890ff;"
+          id="warehouseAllocationEdit-btn"
+          @click.stop="handleEdit">
+          编辑
+        </a-button>
+        <!-- <a id="warehouseAllocationDetail-back-edit" style="color: #1890ff;margin-left: 20px;" href="javascript:;" @click="handleBack">编辑</a> -->
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -17,13 +27,12 @@
       <a-collapse :activeKey="['1']">
         <a-collapse-panel key="1" header="基础信息">
           <a-descriptions :column="3">
-            <a-descriptions-item label="调出仓库">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="调入仓库">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="调拨单号">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="关联单号">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="审核状态">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="完结状态">箭冠营销中心</a-descriptions-item>
-            <a-descriptions-item label="备注">箭冠营销中心</a-descriptions-item>
+            <a-descriptions-item label="调出仓库">{{ warehouse?warehouse.outWarehouseName:'--' }}</a-descriptions-item>
+            <a-descriptions-item label="调入仓库">{{ warehouse?warehouse.putWarehouseName:'--' }}</a-descriptions-item>
+            <a-descriptions-item label="调拨单号">{{ warehouse?warehouse.allocationWarehouseNo:'--' }}</a-descriptions-item>
+            <a-descriptions-item label="关联单号">{{ warehouse?warehouse.relevanceNo ||'--':'--' }}</a-descriptions-item>
+            <a-descriptions-item label="单据状态">{{ warehouse?warehouse.stateDictValue ||'--':'--' }}</a-descriptions-item>
+            <a-descriptions-item label="备注">{{ warehouse?warehouse.remark ||'--':'--' }}</a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -31,7 +40,7 @@
     <a-card size="small" :bordered="false" class="warehouseAllocationDetail-cont">
       <!-- 总计 -->
       <a-alert type="info" showIcon style="margin-bottom:15px">
-        <div slot="message">总款数: <strong>6</strong> ,总数量: <strong>6</strong> ,总成本:¥<strong>6.33</strong></div>
+        <div slot="message">总款数: <strong>{{ productTotalCategory }}</strong> ,总数量: <strong>{{ productTotalQty }}</strong> ,总成本:¥<strong>{{ productTotalCost }}</strong></div>
       </a-alert>
       <!-- 列表 -->
       <s-table
@@ -64,6 +73,12 @@
 <script>
 import { allocWarehouseDetailList } from '@/api/allocWarehouse'
 import { STable, VSelect } from '@/components'
+import {
+  productQuery,
+  allocWarehouseFind,
+  allocWarehouseDetailTotal,
+  allocWarehouseDetailQuery
+} from '@/api/allocWarehouse.js'
 export default {
   components: { STable, VSelect },
   data () {
@@ -72,6 +87,11 @@ export default {
       queryParam: {
         allocationWarehouseSn: this.$route.params.sn
       },
+	  id: this.$route.params.id, // 单据id
+      productTotalCost: 0, // 总成本
+      productTotalQty: 0, // 总数量
+      productTotalCategory: 0, // 总款项
+      warehouse: null, // 基础信息
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
@@ -88,16 +108,13 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        return allocWarehouseDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        return allocWarehouseDetailQuery(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
-            const productTypeName1 = data.list[i].productTypeName1 ? data.list[i].productTypeName1 : ''
-            const productTypeName2 = data.list[i].productTypeName2 ? ' > ' + data.list[i].productTypeName2 : ''
-            const productTypeName3 = data.list[i].productTypeName3 ? ' > ' + data.list[i].productTypeName3 : ''
-            data.list[i].productTypeName = productTypeName1 + productTypeName2 + productTypeName3
           }
+          this.getProduceTotal()
           this.disabled = false
           return data
         })
@@ -109,6 +126,40 @@ export default {
     handleBack () {
       this.$router.push({ path: '/allocationManagement/warehouseAllocation/list' })
     },
+    //  新增/编辑
+    handleEdit () {
+		  this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${this.warehouse.id}/${this.warehouse.allocationWarehouseSn}` })
+    },
+    // 查询基础信息
+    getHouse () {
+		  allocWarehouseFind({
+		    id: this.id
+		  }).then(res => {
+		    if (res.status == 200) {
+		      this.warehouse = res.data
+		      this.queryParam.outWarehouseSn = res.data.outWarehouseSn
+		      // this.getWarehouseLoc(this.warehouse.putWarehouseSn, 'put')
+		      // this.getWarehouseLoc(this.warehouse.outWarehouseSn, 'out')
+		    } else {
+		      this.warehouse = null
+		    }
+		  })
+    },
+    // 已选产品总计查询
+    getProduceTotal () {
+	  allocWarehouseDetailTotal(this.queryParam).then(res => {
+	    console.log(res, '-----总计----')
+	    if (res.status == 200) {
+	      this.productTotalCost = res.data.productTotalCost || 0
+	      this.productTotalQty = res.data.productTotalQty || 0
+	      this.productTotalCategory = res.data.productTotalCategory || 0
+	    } else {
+	      this.productTotalCost = 0
+	      this.productTotalQty = 0
+	      this.productTotalCategory = 0
+	    }
+	  })
+    },
     //  导出
     handleExport () {
       const params = this.queryParam
@@ -130,6 +181,14 @@ export default {
       document.body.appendChild(link)
       link.click()
     }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      // vm.getProductBrand()
+      // vm.getProductType()
+      vm.getHouse()
+      console.log(vm.id, vm.$route.params, 'vm.id')
+    })
   }
 }
 </script>

+ 563 - 168
src/views/allocationManagement/warehouseAllocation/edit.vue

@@ -27,8 +27,10 @@
               @click.stop="handleEditInfo" /> -->
           </template>
           <a-descriptions :column="3">
-            <a-descriptions-item label="调出仓库">{{ warehouse?warehouse.outWarehouseName:'' }}</a-descriptions-item>
-            <a-descriptions-item label="调入仓库">{{ warehouse?warehouse.putWarehouseName:'' }}</a-descriptions-item>
+            <a-descriptions-item label="调出仓库">{{ warehouse?warehouse.outWarehouseName:'' }}
+            </a-descriptions-item>
+            <a-descriptions-item label="调入仓库">{{ warehouse?warehouse.putWarehouseName:'' }}
+            </a-descriptions-item>
           </a-descriptions>
         </a-collapse-panel>
       </a-collapse>
@@ -39,21 +41,33 @@
         <a-collapse-panel key="1" header="选择产品">
           <!-- 筛选条件 -->
           <div class="table-page-search-wrapper">
-            <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-form layout="inline" @keyup.enter.native="getProductList">
               <a-row :gutter="15">
                 <a-col :md="6" :sm="24">
                   <a-form-item label="产品编码" prop="productCode">
-                    <a-input id="warehouseAllocationEdit-productCode" v-model="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                    <a-input
+                      id="warehouseAllocationEdit-productCode"
+                      v-model="queryParam.productCode"
+                      placeholder="请输入产品编码"
+                      allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="产品名称" prop="productName">
-                    <a-input id="warehouseAllocationEdit-productName" v-model="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                    <a-input
+                      id="warehouseAllocationEdit-productName"
+                      v-model="queryParam.productName"
+                      placeholder="请输入产品名称"
+                      allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="原厂编码" prop="productOrigCode">
-                    <a-input id="warehouseAllocationEdit-productOrigCode" v-model="queryParam.productOrigCode" placeholder="请输入原厂编码" allowClear />
+                    <a-input
+                      id="warehouseAllocationEdit-productOrigCode"
+                      v-model="queryParam.productOrigCode"
+                      placeholder="请输入原厂编码"
+                      allowClear />
                   </a-form-item>
                 </a-col>
                 <template v-if="advanced">
@@ -67,7 +81,10 @@
                         :showSearch="true"
                         option-filter-prop="children"
                         :filter-option="filterOption">
-                        <a-select-option v-for="item in brandData" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+                        <a-select-option
+                          v-for="item in brandData"
+                          :key="item.brandSn"
+                          :value="item.brandSn">{{ item.brandName }}</a-select-option>
                       </a-select>
                     </a-form-item>
                   </a-col>
@@ -83,60 +100,92 @@
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="调出仓位" prop="brandSn">
-                      <a-select id="warehouseAllocationEdit-warehouse" placeholder="请选择" allowClear v-model="queryParam.warehouse" style="width: 100%;">
-                        <a-select-option v-for="item in warehouseOutLocData" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
+                    <a-form-item label="调出仓位" prop="outWarehouseLocationName">
+                      <a-select
+                        id="warehouseAllocationEdit-outWarehouseLocationName"
+                        placeholder="请选择"
+                        allowClear
+                        v-model="queryParam.outWarehouseLocationName"
+                        style="width: 100%;">
+                        <a-select-option
+                          v-for="item in warehouseOutLocData"
+                          :key="item.warehouseLocationSn"
+                          :value="item.warehouseLocationSn">
+                          {{ item.name }}</a-select-option>
                       </a-select>
                     </a-form-item>
                   </a-col>
                 </template>
                 <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
-                  <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"
+                    @click="getProductList"
+                    :disabled="disabled"
+                    id="warehouseAllocationList-refresh">查询</a-button>
+                  <a-button
+                    style="margin-left: 8px"
+                    @click="resetSearchForm"
+                    :disabled="disabled"
+                    id="warehouseAllocationList-reset">重置</a-button>
                   <a @click="advanced=!advanced" style="margin-left: 8px">
                     {{ advanced ? '收起' : '展开' }}
-                    <a-icon :type="advanced ? 'up' : 'down'"/>
+                    <a-icon :type="advanced ? 'up' : 'down'" />
                   </a>
                 </a-col>
               </a-row>
             </a-form>
           </div>
           <!-- 列表 -->
-          <s-table
+          <a-table
             class="sTable"
             ref="table"
             size="default"
             :rowKey="(record) => record.id"
             :columns="columns"
-            :data="loadData"
+            :loading="loading"
+            :dataSource="loadData"
+            :pagination="pagination"
+            @change="getProductList"
             :scroll="{ x: 1560 }"
             bordered>
             <!-- 类别 -->
             <template slot="type" slot-scope="text, record">
-              <span>{{ record.productTypeName2||'' }}</span><span v-if="record.productTypeName3"><strong>-</strong>{{ record.productTypeName3||'' }}</span>
-              <!-- {{ record.productTypeName2+(record.productTypeName3?('-'+record.productTypeName3):'') }} -->
+              <span>{{ record.dealerProduct.productTypeName2||'--' }}</span>
+              <span v-if="record.dealerProduct.productTypeName3">-{{ record.dealerProduct.productTypeName3||'' }}</span>
             </template>
             <!-- 调入仓位 -->
             <template slot="storageQuantity" slot-scope="text, record">
-              <a-select id="warehouseAllocationEdit-warehouse" placeholder="请选择" allowClear v-model="record.putWarehouseLocationSn" style="width: 100%;">
-                <a-select-option v-for="item in warehousePutLocData" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
+              <a-select
+                id="warehouseAllocationEdit-warehouse"
+                placeholder="请选择"
+                allowClear
+                v-model="record.putWarehouseLocationSn"
+                style="width: 100%;">
+                <a-select-option
+                  v-for="item in warehousePutLocData"
+                  :key="item.warehouseLocationSn"
+                  :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
               </a-select>
             </template>
             <!-- 调出数量 -->
             <template slot="transferOutQuantity" slot-scope="text, record">
               <a-input-number
                 id="warehouseAllocationEdit-allocationQty"
-                :value="record.allocationQty"
-                :precision="0"
+                v-model="record.allocationQty"
                 :min="0"
-                :max="999999"
+                :max="record.currentQty"
                 placeholder="请输入" />
             </template>
             <!-- 操作 -->
-            <template slot="action" slot-scope="text, record">
-              <a-button size="small" type="link" @click="handleAdd(record)" id="warehouseAllocationEdit-add-btn">添加</a-button>
+            <template slot="action" slot-scope="text,record">
+              <a-button
+                :loading="record.addLoading"
+                size="small"
+                type="link"
+                @click="handleAdd(record)"
+                id="warehouseAllocationEdit-add-btn">添加</a-button>
             </template>
-          </s-table>
+          </a-table>
         </a-collapse-panel>
       </a-collapse>
     </a-card>
@@ -146,7 +195,9 @@
         <a-collapse-panel key="1" header="已选产品">
           <!-- 总计 -->
           <a-alert type="info" showIcon style="margin-bottom:15px">
-            <div slot="message">总成本:¥<strong>{{ productTotalCost }}</strong>,总数量: <strong>{{ productTotalQty }}</strong> ,总款数: <strong>{{ productTotalCategory }}</strong> </div>
+            <div slot="message">总成本:¥<strong>{{ productTotalCost }}</strong>,总数量:
+              <strong>{{ productTotalQty }}</strong> ,总款数: <strong>{{ productTotalCategory }}</strong>
+            </div>
           </a-alert>
           <!-- 筛选条件 -->
           <a-row :gutter="15" justify="space-between">
@@ -156,17 +207,31 @@
                   <a-row :gutter="15">
                     <a-col :md="9" :sm="24">
                       <a-form-item label="产品编码" prop="productCode">
-                        <a-input id="warehouseAllocationEdit-productCode" v-model="chooseParam.productCode" placeholder="请输入产品编码" allowClear />
+                        <a-input
+                          id="warehouseAllocationEdit-productCode"
+                          v-model="chooseParam.productCode"
+                          placeholder="请输入产品编码"
+                          allowClear />
                       </a-form-item>
                     </a-col>
                     <a-col :md="9" :sm="24">
                       <a-form-item label="产品名称" prop="productName">
-                        <a-input id="warehouseAllocationEdit-productName" v-model="chooseParam.productName" placeholder="请输入产品名称" allowClear />
+                        <a-input
+                          id="warehouseAllocationEdit-productName"
+                          v-model="chooseParam.productName"
+                          placeholder="请输入产品名称"
+                          allowClear />
                       </a-form-item>
                     </a-col>
                     <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
-                      <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="disabled" id="warehouseAllocationList-refresh">查询</a-button>
-                      <a-button style="margin-left: 8px" @click="resetChooseSearchForm" :disabled="disabled" id="warehouseAllocationList-reset">重置</a-button>
+                      <a-button
+                        type="primary"
+                        @click="$refs.chooseTable.refresh(true)"
+                        id="warehouseAllocationList-refresh">查询</a-button>
+                      <a-button
+                        style="margin-left: 8px"
+                        @click="resetChooseSearchForm"
+                        id="warehouseAllocationList-reset">重置</a-button>
                     </a-col>
                   </a-row>
                 </a-form>
@@ -175,8 +240,15 @@
             <a-col :span="7">
               <!-- 暂不做 -->
               <!-- <a-button size="small" type="primary" id="warehouseAllocationEdit-pladd-btn" style="margin-bottom: 8px;">批量添加</a-button> -->
-              <a-button size="small" id="warehouseAllocationEdit-import-btn" style="margin-left: 8px">导入明细</a-button>
-              <a-button size="small" type="danger" id="warehouseAllocationEdit-del-all-btn" style="margin: 0 0 8px 8px;">整单删除</a-button>
+              <a-button size="small" id="warehouseAllocationEdit-import-btn" style="margin-left: 8px">导入明细
+              </a-button>
+              <a-button
+                size="small"
+                :loading="delLoading"
+                @click="handleDel(record,0)"
+                type="danger"
+                id="warehouseAllocationEdit-del-all-btn"
+                style="margin: 0 0 8px 8px;">整单删除</a-button>
             </a-col>
           </a-row>
           <!-- 列表 -->
@@ -191,35 +263,57 @@
             bordered>
             <!-- 类别 -->
             <template slot="type" slot-scope="text, record">
-              {{ record.productTypeName2+(record.productTypeName3?('-'+record.productTypeName3):'') }}
+              <span>{{ record.productTypeName2||'--' }}</span><span
+                v-if="record.productTypeName3">-{{ record.productTypeName3||'' }}</span>
             </template>
             <!-- 调入仓位 -->
             <template slot="storageQuantity" slot-scope="text, record">
-              <a-select id="warehouseAllocationEdit-warehouse" placeholder="请选择" allowClear v-model="record.putWarehouseLocationSn" style="width: 100%;">
-                <a-select-option v-for="item in warehousePutLocData" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
+              <a-select
+                @change="handleAdd(record)"
+                id="warehouseAllocationEdit-warehouse"
+                placeholder="请选择"
+                allowClear
+                v-model="record.putWarehouseLocationSn"
+                style="width: 100%;">
+                <a-select-option
+                  v-for="item in warehousePutLocData"
+                  :key="item.warehouseLocationSn"
+                  :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
               </a-select>
             </template>
             <!-- 调出数量 -->
             <template slot="transferOutQuantity" slot-scope="text, record">
               <a-input-number
                 id="warehouseAllocationEdit-allocationQty"
-                :value="record.allocationQty"
+                v-model="record.allocationQty"
                 :precision="0"
                 :min="0"
-                :max="999999"
+                @change="handleAdd(record)"
+                :max="record.currentQty"
                 placeholder="请输入" />
             </template>
             <!-- 操作 -->
             <template slot="action" slot-scope="text, record">
-              <a-button size="small" type="link" @click="handleDel(record)" id="warehouseAllocationEdit-del-btn">删除</a-button>
+              <a-button
+                size="small"
+                type="link"
+                @click="handleDel(record,1)"
+                id="warehouseAllocationEdit-del-btn">删除</a-button>
             </template>
           </s-table>
         </a-collapse-panel>
       </a-collapse>
     </a-card>
     <a-affix :offset-bottom="0">
-      <div style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
-        <a-button type="primary" id="warehouseAllocationEdit-submit" size="large" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
+      <div
+        style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
+        <a-button
+          type="primary"
+          id="warehouseAllocationEdit-submit"
+          size="large"
+          :loading="submitLoading"
+          @click="handleSubmit"
+          style="padding: 0 60px;">提交</a-button>
       </div>
     </a-affix>
     <!-- 选择基本信息弹框 -->
@@ -228,81 +322,274 @@
 </template>
 
 <script>
-import { STable, VSelect } from '@/components'
+import {
+  STable,
+  VSelect
+} from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import { dealerProductBrandQuery } from '@/api/dealerProductBrand.js'
-import { dealerProductTypeList } from '@/api/dealerProductType.js'
-import { warehouseLocAllList } from '@/api/warehouse.js'
-import { productQuery, allocWarehouseFind, allocWarehouseDetailTotal, allocWarehouseDetailQuery, allocWarehouseDetailSave, allocWarehouseDetailDelete } from '@/api/allocWarehouse.js'
+import {
+  dealerProductBrandQuery
+} from '@/api/dealerProductBrand.js'
+import {
+  dealerProductTypeList
+} from '@/api/dealerProductType.js'
+import {
+  warehouseLocAllList
+} from '@/api/warehouse.js'
+import {
+  productQuery,
+  allocWarehouseFind,
+  allocWarehouseDetailTotal,
+  allocWarehouseDetailQuery,
+  allocWarehouseDetailSave,
+  allocWarehouseDetailDelete,
+  allocWarehouseSubmit
+} from '@/api/allocWarehouse.js'
 export default {
-  components: { STable, VSelect, basicInfoModal },
+  components: {
+    STable,
+    VSelect,
+    basicInfoModal
+  },
   data () {
     return {
-      id: '', // 单据id
+      id: this.$route.params.id, // 单据id
       queryParam: {
         outWarehouseSn: '', // 调出仓库sn
         productCode: '', // 产品编码
         productName: '', // 产品名称
         productOrigCode: '', // 原厂编码
-        brandName: '', // 品牌
-        typeName: '' // 类别
+        brandSn: undefined, // 品牌
+        typeName: '', // 类别
+        outWarehouseLocationName: undefined // 调出仓位
       },
-	  chooseParam: {
-        allocationWarehouseSn: '', // 单据sn
-	    productCode: '', // 产品编码
-	    productName: '' // 产品名称
-	  },
-	  productTotalCost: 0, // 总成本
-	  productTotalQty: 0, // 总数量
-	  productTotalCategory: 0, // 总款项
-	  warehouse: null, // 基础信息
+      chooseParam: {
+        allocationWarehouseSn: this.$route.params.sn, // 单据sn
+        productCode: '', // 产品编码
+        productName: '' // 产品名称
+      },
+      productTotalCost: 0, // 总成本
+      productTotalQty: 0, // 总数量
+      productTotalCategory: 0, // 总款项
+      warehouse: null, // 基础信息
       brandData: [], //  产品品牌  下拉数据
       typeData: [], //  产品类别  下拉数据
       warehousePutLocData: [], //  调入仓库仓位  下拉数据
       warehouseOutLocData: [], //  调出仓库仓位  下拉数据
       disabled: false, //  查询、重置按钮是否可操作
       advanced: false, // 高级搜索 展开/关闭
-      // 表头
-      columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'brandName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '类别', width: 160, align: 'center', scopedSlots: { customRender: 'type' } },
-        { title: '调出仓位', dataIndex: 'outWarehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调入仓位', scopedSlots: { customRender: 'storageQuantity' }, width: 140, align: 'center' },
-        { title: '库存数量', dataIndex: 'currentQty', 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: '调出数量', scopedSlots: { customRender: 'transferOutQuantity' }, width: 140, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
-      ],
+      delLoading: false, // 整单删除loading
+	  submitLoading: false, // 提交按钮loading
       // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        return productQuery(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
-          return data
-        })
+      loadData: [],
+      pageNo: 1,
+      pageSize: 10,
+      pagination: {
+        current: 1,
+        pageSize: 10,
+        pageSizeOptions: ['10', '20', '30', '40'],
+        total: 0
       },
+      loading: false, // 表格加载圈
       // 表头
-      chooseColumns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'brandName', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '类别', width: 160, align: 'center', scopedSlots: { customRender: 'type' } },
-        { title: '调出仓位', dataIndex: 'outWarehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调入仓位', dataIndex: 'custsNakme', width: 140, align: 'center', scopedSlots: { customRender: 'storageQuantity' } },
-        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '调出数量', scopedSlots: { customRender: 'transferOutQuantity' }, width: 140, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 80,
+        align: 'center'
+      },
+      {
+        title: '产品编码',
+        dataIndex: 'productCode',
+        width: 140,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '产品名称',
+        dataIndex: 'productName',
+        width: 200,
+        align: 'center',
+        ellipsis: true
+      },
+      {
+        title: '原厂编码',
+        dataIndex: 'productOrigCode',
+        width: 140,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '品牌',
+        dataIndex: 'brandName',
+        width: 160,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '类别',
+        width: 160,
+        align: 'center',
+        scopedSlots: {
+          customRender: 'type'
+        }
+      },
+      {
+        title: '调出仓位',
+        dataIndex: 'warehouseLocationName',
+        width: 140,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '调入仓位',
+        scopedSlots: {
+          customRender: 'storageQuantity'
+        },
+        width: 140,
+        align: 'center'
+      },
+      {
+        title: '库存数量',
+        dataIndex: 'currentQty',
+        width: 100,
+        align: 'center',
+        customRender: function (text) {
+          return ((text || text == 0) ? text : '--')
+        }
+      },
+      {
+        title: '单位',
+        dataIndex: 'unit',
+        width: 100,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '调出数量',
+        scopedSlots: {
+          customRender: 'transferOutQuantity'
+        },
+        width: 140,
+        align: 'center'
+      },
+      {
+        title: '操作',
+        scopedSlots: {
+          customRender: 'action'
+        },
+        width: 100,
+        align: 'center',
+        fixed: 'right'
+      }
+      ],
+
+      // 表头
+      chooseColumns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 80,
+        align: 'center'
+      },
+      {
+        title: '产品编码',
+        dataIndex: 'productCode',
+        width: 140,
+        align: 'center',
+        sorter: true,
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '产品名称',
+        dataIndex: 'productName',
+        width: 200,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '原厂编码',
+        dataIndex: 'productOrigCode',
+        width: 140,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '品牌',
+        dataIndex: 'brandName',
+        width: 160,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '类别',
+        width: 160,
+        align: 'center',
+        scopedSlots: {
+          customRender: 'type'
+        }
+      },
+      {
+        title: '调出仓位',
+        dataIndex: 'outWarehouseLocationName',
+        width: 140,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '调入仓位',
+        dataIndex: 'putWarehouseLocationSn',
+        width: 140,
+        align: 'center',
+        scopedSlots: {
+          customRender: 'storageQuantity'
+        }
+      },
+      {
+        title: '单位',
+        dataIndex: 'productUnit',
+        width: 100,
+        align: 'center',
+        customRender: function (text) {
+          return text || '--'
+        }
+      },
+      {
+        title: '调出数量',
+        scopedSlots: {
+          customRender: 'transferOutQuantity'
+        },
+        width: 140,
+        align: 'center'
+      },
+      {
+        title: '操作',
+        scopedSlots: {
+          customRender: 'action'
+        },
+        width: 100,
+        align: 'center',
+        fixed: 'right'
+      }
       ],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
@@ -313,7 +600,7 @@ export default {
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
           }
-		  this.getProduceTotal()
+          this.getProduceTotal()
           this.disabled = false
           return data
         })
@@ -322,16 +609,29 @@ export default {
     }
   },
   methods: {
+	  pageInit () {
+		 this.queryParam.productCode = '' // 产品编码
+		 this.queryParam.productName = '' // 产品名称
+		 this.queryParam.productOrigCode = '' // 原厂编码
+		 this.queryParam.brandName = undefined // 品牌
+		 this.queryParam.typeName = '' // 类别
+		 this.queryParam.outWarehouseLocationName = undefined // 调出仓位
+		 this.chooseParam.productCode = ''
+		 this.chooseParam.productName = ''
+		 this.pageNo = 1
+		 this.pageSize = 10
+	  },
     //  重置
     resetSearchForm () {
-      this.queryParam.orderBundleNo = ''
-      this.queryParam.orderBundle.custMobile = ''
-      this.queryParam.bundleName = ''
-      this.queryParam.itemName = ''
-      this.oldTime = undefined
-      this.newTime = undefined
-      this.$refs.table.refresh(true)
+      this.queryParam.productCode = '' // 产品编码
+      this.queryParam.productName = '' // 产品名称
+      this.queryParam.productOrigCode = '' // 原厂编码
+      this.queryParam.brandName = undefined // 品牌
+      this.queryParam.typeName = '' // 类别
+      this.queryParam.outWarehouseLocationName = undefined // 调出仓位
+      this.getProductList()
     },
+
     // 已选产品重置查询
     resetChooseSearchForm () {
       this.chooseParam.productCode = ''
@@ -346,57 +646,137 @@ export default {
     },
     // 获取产品分类
     getProductType () {
-	  dealerProductTypeList({}).then(res => {
-	    this.typeData = res.data || []
+      dealerProductTypeList({}).then(res => {
+        this.typeData = res.data || []
         console.log(res, this.typeData, '--------获取产品分类')
-	  })
+      })
     },
     // 获取仓库仓位
     getWarehouseLoc (sn, type) {
-      warehouseLocAllList({ warehouseSn: sn }).then(res => {
-		  if (type == 'put') {
-			  this.warehousePutLocData = res.data || []
-		  } else {
-			  this.warehouseOutLocData = res.data || []
-		  }
+      warehouseLocAllList({
+        warehouseSn: sn
+      }).then(res => {
+        if (type == 'put') {
+          this.warehousePutLocData = res.data || []
+        } else {
+          this.warehouseOutLocData = res.data || []
+        }
         // return res.data || []
       })
     },
     // 查询基础信息
     getHouse () {
-      allocWarehouseFind({ id: this.id }).then(res => {
+      allocWarehouseFind({
+        id: this.id
+      }).then(res => {
         if (res.status == 200) {
           this.warehouse = res.data
-		  this.getWarehouseLoc(this.warehouse.putWarehouseSn, 'put')
-		  this.getWarehouseLoc(this.warehouse.outWarehouseSn, 'out')
+          this.queryParam.outWarehouseSn = res.data.outWarehouseSn
+          this.getProductList()
+          this.getWarehouseLoc(this.warehouse.putWarehouseSn, 'put')
+          this.getWarehouseLoc(this.warehouse.outWarehouseSn, 'out')
         } else {
           this.warehouse = null
         }
       })
     },
-    // 已选产品总计查询
-    getProduceTotal () {
-      allocWarehouseDetailTotal(this.chooseParam).then(res => {
-		  console.log(res, '-----总计----')
+    // 产品查询
+    getProductList (pagination) {
+      console.log(pagination, 'pagination-------')
+      this.disabled = true
+      this.loading = true
+      this.pageNo = pagination && pagination.current ? pagination.current : this.pageNo
+      this.pageSize = pagination && pagination.pageSize ? pagination.pageSize : this.pageSize
+      this.pagination.current = this.pageNo
+      productQuery(Object.assign({
+        pageNo: this.pageNo,
+        pageSize: this.pageSize
+      }, this.queryParam)).then(res => {
 		  if (res.status == 200) {
-			  this.productTotalCost = this.data.productTotalCost
-			  this.productTotalQty = this.data.productTotalQty
-			  this.productTotalCategory = this.data.productTotalCategory
+			 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].addLoading = false
+			 }
+			 this.pagination.total = Number(data.count)
+			 this.loadData = data.list
 		  } else {
-			  this.productTotalCost = 0
-			  this.productTotalQty = 0
-			  this.productTotalCategory = 0
+			  this.pagination.total = 0
+			  this.loadData = []
 		  }
-	  })
+        this.loading = false
+        this.disabled = false
+        console.log(this.loadData, '-----产品查询')
+      })
+    },
+    // 已选产品总计查询
+    getProduceTotal () {
+      allocWarehouseDetailTotal(this.chooseParam).then(res => {
+        console.log(res, '-----总计----')
+        if (res.status == 200) {
+          this.productTotalCost = res.data.productTotalCost || 0
+          this.productTotalQty = res.data.productTotalQty || 0
+          this.productTotalCategory = res.data.productTotalCategory || 0
+        } else {
+          this.productTotalCost = 0
+          this.productTotalQty = 0
+          this.productTotalCategory = 0
+        }
+      })
     },
     //  添加
     handleAdd (row) {
-      const params = {
-
+      console.log(row, '-------row')
+      if (!row.putWarehouseLocationSn) {
+        return this.$message.error('请选择调入仓位!')
+      }
+      if (!row.allocationQty) {
+        return this.$message.error('请输入调出数量!')
       }
+      row.addLoading = true
+      const params = Object.assign(row, {
+        allocationWarehouseSn: this.chooseParam.allocationWarehouseSn
+      })
+	  params.allocationCost = params.putCost
+      allocWarehouseDetailSave(params).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.$refs.chooseTable.refresh(true)
+        }
+        row.addLoading = false
+      })
+    },
+    //  删除 type:0 整单删除 1:单个删除
+    handleDel (row, type) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          let params = {}
+          if (type == 0) {
+            params = {
+              allocationWarehouseSn: this.chooseParam.allocationWarehouseSn
+            }
+            _this.delLoading = true
+          } else {
+            params = {
+              id: row.id
+            }
+          }
+          allocWarehouseDetailDelete(params).then(res => {
+            console.log(res, 'res1111')
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.chooseTable.refresh()
+            }
+            _this.delLoading = false
+          })
+        }
+      })
     },
-    //  删除
-    handleDel (row) {},
     //  编辑基本信息
     handleEditInfo () {
       this.openModal = true
@@ -406,60 +786,75 @@ export default {
 
     },
     //  提交
-    handleSubmit () {},
+    handleSubmit () {
+      this.submitLoading = true
+      allocWarehouseSubmit({ id: this.id }).then(res => {
+        if (res.status == 200) {
+          this.$message.success(res.message)
+          this.handleBack()
+        }
+      })
+    },
     //  导入明细
     handleImport () {
       console.log(333)
     },
     //  返回列表
     handleBack () {
-      this.$router.push({ path: '/allocationManagement/warehouseAllocation/list' })
+      this.$router.push({
+        path: '/allocationManagement/warehouseAllocation/list'
+      })
     },
     filterOption (input, option) {
-      	return (
-      		option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      	)
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
     }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.openModal = false
-	  vm.id = vm.$route.params.id
-	  vm.chooseParam.allocationWarehouseSn = vm.$route.params.sn
-	  vm.getProductBrand()
-	  vm.getProductType()
-	  vm.getHouse()
-	  console.log(vm.id, vm.$route.params, 'vm.id')
+	  vm.pageInit()
+      vm.getProductBrand()
+      vm.getProductType()
+      vm.getHouse()
+      console.log(vm.id, vm.$route.params, 'vm.id')
     })
   }
 }
 </script>
 
 <style lang="less">
-  .warehouseAllocationEdit-wrap{
-    .warehouseAllocationEdit-back{
-      margin-bottom: 15px;
-    }
-    .warehouseAllocationEdit-cont{
-      margin-bottom: 15px;
-      .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;
-      }
-    }
-  }
+	.warehouseAllocationEdit-wrap {
+		.warehouseAllocationEdit-back {
+			margin-bottom: 15px;
+		}
+
+		.warehouseAllocationEdit-cont {
+			margin-bottom: 15px;
+
+			.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>

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

@@ -2,7 +2,11 @@
   <a-card size="small" :bordered="false" class="warehouseAllocationList-wrap">
     <!-- 搜索条件 -->
     <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+      <a-form
+        layout="inline"
+        ref="searchForm"
+        :model="queryParam"
+        @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="创建时间">
@@ -14,28 +18,33 @@
                 :format="dateFormat"
                 :placeholder="['开始时间', '结束时间']" />
             </a-form-item>
-            </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="调出仓库">
-              <v-select
-                v-model="queryParam.outWarehouseName"
-                ref="outWarehouseName"
-                id="warehouseAllocationList-outWarehouseName"
-                code="PAYMENT_TYPE"
+              <a-select
+                id="warehouseAllocation-basicInfo-outWarehouseSn"
+                allowClear
                 placeholder="请选择调出仓库"
-                allowClear></v-select>
+                v-model="queryParam.outWarehouseSn"
+              >
+                <a-select-option v-for="item in warehouseList" :value="item.warehouseSn">
+                  {{ item.name }}
+                </a-select-option>
+              </a-select>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="调入仓库">
-              <v-select
-                v-model="queryParam.putWarehouseName"
-                ref="putWarehouseName"
-                id="warehouseAllocationList-putWarehouseName"
-                code="PAYMENT_TYPE"
+              <a-select
+                id="warehouseAllocation-basicInfo-putWarehouseSn"
+                allowClear
                 placeholder="请选择调入仓库"
-                allowClear></v-select>
+                v-model="queryParam.putWarehouseSn"
+              >
+                <a-select-option v-for="item in warehouseList" :value="item.warehouseSn">
+                  {{ item.name }}
+                </a-select-option>
+              </a-select>
             </a-form-item>
           </a-col>
           <template v-if="advanced">
@@ -82,13 +91,13 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" @click="handleExamine(record)" id="warehouseAllocationList-examine-btn">审核</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleEdit(record)" id="warehouseAllocationList-edit-btn">编辑</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
+        <a-button v-if="record.stateDictValue=='待审核'" size="small" type="link" @click="handleExamine(record)" id="warehouseAllocationList-examine-btn">审核</a-button>
+        <a-divider v-if="record.stateDictValue=='待审核'" type="vertical" style="margin: 0;" />
+        <a-button v-if="record.stateDictValue!='已完结'" size="small" type="link" @click="handleEdit(record)" id="warehouseAllocationList-edit-btn">编辑</a-button>
+        <a-divider v-if="record.stateDictValue!='已完结'" type="vertical" style="margin: 0;" />
         <a-button size="small" type="link" @click="handleDetail(record)" id="warehouseAllocationList-detail-btn">详情</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDel(record)" id="warehouseAllocationList-del-btn">删除</a-button>
+        <a-divider v-if="record.stateDictValue!='已完结'" type="vertical" style="margin: 0;" />
+        <a-button v-if="record.stateDictValue!='已完结'" size="small" type="link" @click="handleDel(record)" id="warehouseAllocationList-del-btn">删除</a-button>
       </template>
     </s-table>
     <!-- 新增/编辑 -->
@@ -98,17 +107,20 @@
 
 <script>
 import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDelete } from '@/api/allocWarehouse'
+import { warehouseAllList } from '@/api/warehouse.js'
 import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
+import moment from 'moment'
 export default {
   components: { STable, VSelect, basicInfoModal },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
       creatDate: undefined, //  创建时间
+	  warehouseList: [], // 仓库列表
       queryParam: { //  查询条件
-        outWarehouseName: undefined, //  调出仓库
-        putWarehouseName: undefined, //  调入仓库
+        outWarehouseSn: undefined, //  调出仓库
+        putWarehouseSn: undefined, //  调入仓库
         state: undefined //  审核状态
       },
       disabled: false, //  查询、重置按钮是否可操作
@@ -129,7 +141,14 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        this.queryParam = {}
+        // 创建时间
+        if (this.creatDate && this.creatDate.length > 0) {
+          this.queryParam.beginDate = moment(this.creatDate[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.creatDate[1]).format(this.dateFormat)
+        } else {
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
+        }
         return allocWarehouseList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -149,10 +168,21 @@ export default {
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
     },
+    // 获取仓库列表
+    getWarehouseList () {
+	  warehouseAllList({}).then(res => {
+		  console.log(res, '-----仓库----')
+	    if (res.status == 200) {
+	      this.warehouseList = res.data || []
+	    } else {
+	      this.warehouseList = []
+	    }
+	  })
+    },
     //  重置
     resetSearchForm () {
-      this.queryParam.outWarehouseName = undefined
-      this.queryParam.putWarehouseName = undefined
+      this.queryParam.outWarehouseSn = undefined
+      this.queryParam.putWarehouseSn = undefined
       this.queryParam.state = undefined
       this.creatDate = undefined
       this.$refs.table.refresh(true)
@@ -209,6 +239,15 @@ export default {
     handleEdit (row) {
 		  this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${row.id}/${row.allocationWarehouseSn}` })
     }
+  },
+  beforeRouteEnter (to, from, next) {
+  	next(vm => {
+      vm.queryParam.outWarehouseSn = undefined
+      vm.queryParam.putWarehouseSn = undefined
+      vm.queryParam.state = undefined
+      vm.creatDate = undefined
+      vm.getWarehouseList()
+    })
   }
 }
 </script>