sunlupeng 7 meses atrás
pai
commit
811e116b9b

+ 13 - 5
src/api/supplier.js

@@ -1,7 +1,7 @@
 import request from '@/utils/request'
 
 
-export function createItem(data) {
+export function createSupplier(data) {
   return request({
     url: '/supplier-info/add',
     method: 'post',
@@ -9,7 +9,7 @@ export function createItem(data) {
   })
 }
 
-export function updateItem(query) {
+export function updateSupplier(query) {
   return request({
     url: '/supplier-info/edit',
     method: 'post',
@@ -17,7 +17,7 @@ export function updateItem(query) {
   })
 }
 
-export function goodsList(query) {
+export function listSupplier(query) {
   return request({
     url: '/supplier-info/page',
     method: 'get',
@@ -25,7 +25,15 @@ export function goodsList(query) {
   })
 }
 
-export function removeItem(query) {
+export function supplierList(query) {
+  return request({
+    url: '/supplier-info/list',
+    method: 'get',
+    params:query
+  })
+}
+
+export function deleteSupplier(query) {
   return request({
     url: '/supplier-info/remove',
     method: 'post',
@@ -33,7 +41,7 @@ export function removeItem(query) {
   })
 }
 
-export function typeList(query) {
+export function typeListSupplier(query) {
   return request({
     url: '/supplier-info/list/type',
     method: 'get',

+ 8 - 0
src/api/warehouse.js

@@ -8,6 +8,14 @@ export function listWarehouse(query) {
   })
 }
 
+export function warehouseList(query) {
+  return request({
+    url: '/warehouse-info/list',
+    method: 'get',
+    params: query
+  })
+}
+
 export function createWarehouse(data) {
   return request({
     url: '/warehouse-info/add',

+ 49 - 0
src/api/warehousing.js

@@ -0,0 +1,49 @@
+import request from '@/utils/request'
+
+export function listWarehousing(query) {
+  return request({
+    url: '/warehouse-entry/page',
+    method: 'get',
+    params: query
+  })
+}
+
+export function executeWarehousing(query) {
+  return request({
+    url: '/warehouse-entry/execute',
+    method: 'post',
+    params:query
+  })
+}
+
+export function createWarehousing(data) {
+  return request({
+    url: '/warehouse-entry/add',
+    method: 'post',
+    data
+  })
+}
+
+export function readWarehousing(query) {
+  return request({
+    url: '/warehouse-entry/info',
+    method: 'get',
+    params:query
+  })
+}
+
+export function updateWarehousing(data) {
+  return request({
+    url: '/warehouse-entry/edit',
+    method: 'post',
+    data
+  })
+}
+
+export function deleteWarehousing(query) {
+  return request({
+    url: '/warehouse-entry/remove',
+    method: 'post',
+    params:query
+  })
+}

+ 4 - 4
src/ui-components/PickerGoods/src/defaultOptions.js

@@ -50,8 +50,8 @@ export const data = {
 
 // 一般列
 export const generalColumns = [
-  { label: '商品编号', prop: 'id' },
-  { label: '商品名称', prop: 'dictName'},
-  { label: '单价(¥)', prop: 'status' },
-  { label: '商品类别', prop: 'dictType' }
+  { label: '商品编号', prop: 'productCode' },
+  { label: '商品名称', prop: 'productName'},
+  { label: '单价(¥)', prop: 'createPrice' },
+  // { label: '商品类别', prop: 'dictType' }
 ]

+ 1 - 1
src/ui-components/PickerGoods/src/main.js

@@ -14,7 +14,7 @@ const Goods = function(options) {
   return new Promise((resolve, reject) => {
     options = options || {}
     if (!options.goodsApi) {
-      options.goodsApi = process.env.BASE_API +'/system/dict/type/list';
+      options.goodsApi = process.env.BASE_API +'/warehouse-entry/info/inventory';
     }
     let id = 'goods_picker_' + seed++
     options.show = true

+ 6 - 6
src/ui-components/PickerGoods/src/main.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog title="商品选择器" width="60%" :visible.sync="dialogVisible" :append-to-body="false"
+  <el-dialog title="商品/选择器" width="60%" :visible.sync="dialogVisible" :append-to-body="false"
     :modal-append-to-body="false" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="true"
     @closed="handleClose" class="goods-picker">
     <div class="goods-picker__body">
@@ -11,7 +11,7 @@
           <el-button size="small" type="primary" @click="handleSearch">搜索 </el-button>
         </div>
       </div>
-      <el-table size="small" ref="goodsTable" v-loading="loading" :data="purchasePlanData.items" border row-key="id"
+      <el-table size="small" ref="goodsTable" v-loading="loading" :data="goodsListData.items" border row-key="id"
         @selection-change="handleSelectionChange" @row-click="handleRowClick" style="width: 100%; min-height: 400px">
         <el-table-column v-if="limit === 1" label="选择" width="55" align="center">
           <template slot-scope="scope">
@@ -26,8 +26,8 @@
       <div class="goods-picker__tools">
         <div class="tools">
         </div>
-        <el-pagination v-if="purchasePlanData.total" background :page-sizes="[10, 30, 50, 100]"
-          :total="purchasePlanData.total" layout="total, sizes, prev, next, pager, jumper"
+        <el-pagination v-if="goodsListData.total" background :page-sizes="[10, 30, 50, 100]"
+          :total="goodsListData.total" layout="total, sizes, prev, pager, next, jumper"
           @size-change="handleSizeChange" @current-change="handleCurrentChange" />
       </div>
     </div>
@@ -61,7 +61,7 @@ export default {
       searchParams: {
         keyword: ''
       },
-      purchasePlanData: {
+      goodsListData: {
         items: [],
         total: 0
       },
@@ -157,7 +157,7 @@ export default {
         }
       }).then(response => {
         this.loading = false
-        this.purchasePlanData = response.data.data
+        this.goodsListData = response.data.data
       })
     }
   }

+ 6 - 6
src/views/basicSetting/supplier.vue

@@ -210,7 +210,7 @@ categoryOptions<template>
     </div>
 </template>
 <script>
-import { createItem, updateItem, goodsList, removeItem, typeList } from "@/api/supplier";
+import { createSupplier, updateSupplier, listSupplier, deleteSupplier, typeListSupplier } from "@/api/supplier";
 import { listDept } from "@/api/dept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@@ -524,7 +524,7 @@ export default {
             this.$refs["dataForm"].validate((valid) => {
                 if (valid) {
                     console.log(this.dataForm);
-                    createItem(this.dataForm)
+                    createSupplier(this.dataForm)
                         .then((response) => {
                             this.getList();
                             this.dialogFormVisible = false;
@@ -612,7 +612,7 @@ export default {
         updateData() {
             this.$refs['dataForm'].validate((valid) => {
                 if (valid) {
-                    updateItem(this.dataForm).then(() => {
+                    updateSupplier(this.dataForm).then(() => {
                         this.dialogFormVisible = false
                         this.$notify({
                             title: '成功',
@@ -633,7 +633,7 @@ export default {
                 cancelButtonText: '取消',
                 type: 'warning'
             }).then(() => {
-                removeItem({ id: row.id }).then(response => {
+                deleteSupplier({ id: row.id }).then(response => {
                     this.$notify({
                         title: '成功',
                         message: '删除成功',
@@ -649,7 +649,7 @@ export default {
         },
         getTypeList() {
             // 获取供应商类别
-            typeList().then(response => {
+            typeListSupplier().then(response => {
                 this.brandOptions = response.data.data.map((item) => {
                     return { value: item.typeId, label: item.typeName }
                 });
@@ -659,7 +659,7 @@ export default {
         },
         getList() {
             this.listLoading = true
-            goodsList(this.listQuery).then(response => {
+            listSupplier(this.listQuery).then(response => {
                 this.list = response.data.data.items
                 this.total = response.data.data.total
                 this.listLoading = false

+ 124 - 73
src/views/stock/warehousing/warehousing.vue

@@ -2,24 +2,27 @@
   <div class="app-container calendar-list-container">
     <!-- 查询和其他操作 -->
     <div class="filter-container">
-      <el-date-picker clearable class="filter-item" style="display: inline-flex;" v-model="listQuery.dateRange" type="daterange"
-        unlink-panels range-separator="~" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期">
+      <el-date-picker v-model="listQuery.startDate" value-format="yyyy-MM-dd" type="date" placeholder="开始日期"
+        style="width:200px">
       </el-date-picker>
-      <el-select v-model="listQuery.status" clearable placeholder="请选择仓库" class="filter-item" style="width: 200px">
-        <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
+      <el-date-picker v-model="listQuery.endDate" value-format="yyyy-MM-dd" type="date" placeholder="结束日期"
+        style="width:200px">
+      </el-date-picker>
+      <el-select v-model="listQuery.warehouseId" clearable placeholder="请选择仓库" class="filter-item" style="width: 200px">
+        <el-option :key="item.id" v-for="item in warehouseList" :label="item.warehouseName" :value="item.id">
         </el-option>
       </el-select>
-      <el-select v-model="listQuery.status" clearable placeholder="请选择状态" class="filter-item" style="width: 200px">
+      <el-select v-model="listQuery.isRunFinish" clearable placeholder="请选择入库状态" class="filter-item" style="width: 200px">
         <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
         </el-option>
       </el-select>
       <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
       <el-button class="filter-item" v-waves icon="el-icon-refresh" @click="resetQuery">重置</el-button>
       <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-plus">添加</el-button>
-      <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download"
-        @click="handleDownload">导出</el-button>
-      <el-button class="filter-item" type="success" icon="el-icon-takeaway-box" @click="delAll">批量入库</el-button>
-      <!-- <el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button> -->
+      <!-- <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download"
+        @click="handleDownload">导出</el-button> -->
+      <!-- <el-button class="filter-item" type="success" icon="el-icon-takeaway-box" @click="executeAll">批量入库</el-button> -->
+      <el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button>
     </div>
 
     <!-- 查询结果 -->
@@ -30,30 +33,29 @@
       </el-table-column>
       <el-table-column align="center" min-width="150px" label="入库单号">
         <template slot-scope="scope">
-          <router-link :to="{name: 'warehousingDetail', params: { id: scope.row.dictType }}">
-            <div style="color: #337ab7;cursor: pointer;">{{ scope.row.dictType }}</div>
+          <router-link :to="{ name: 'warehousingDetail', params: { id: scope.row.id } }">
+            <div style="color: #337ab7;cursor: pointer;">{{ scope.row.serialCode }}</div>
           </router-link>
         </template>
       </el-table-column>
-      <el-table-column align="center" min-width="100px" label="入库时间" prop="dictName">
+      <el-table-column align="center" min-width="100px" label="入库时间" prop="serialDate">
       </el-table-column>
-      <el-table-column align="center" min-width="100px" label="供应商" prop="dictName">
+      <el-table-column align="center" min-width="100px" label="供应商" prop="supplierName">
       </el-table-column>
-      <el-table-column align="center" min-width="100px" label="仓库" prop="dictName">
+      <el-table-column align="center" min-width="100px" label="仓库" prop="warehouseName">
       </el-table-column>
-      <el-table-column align="center" min-width="100px" label="经手人" prop="dictName">
+      <el-table-column align="center" min-width="100px" label="经手人" prop="addHandlerName">
       </el-table-column>
-      <el-table-column align="center" min-width="100px" label="状态">
-        <template slot-scope="scope">
-          <el-tag v-if="scope.row.status === '1'">停用</el-tag>
-          <el-tag v-else>正常</el-tag>
-        </template>
+      <el-table-column align="center" min-width="100px" label="入库状态">
+        <template slot-scope="props">
+            <span v-if="props.row.isRunFinish == '0'" style="color: #67C23A;font-weight: bold;">已入库</span>
+            <span v-if="props.row.isRunFinish == '1'" style="color: #E6A23C;font-weight: bold;">待入库</span>
+          </template>
       </el-table-column>
       <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button type="success" size="small" @click="handleDelete(scope.row)">入库</el-button>
-          <el-button type="primary" size="small" @click="handleUpdate(scope.row, false)">编辑</el-button>
-
+          <el-button v-if="scope.row.isRunFinish == '1'" type="success" size="small" @click="handleExecute(scope.row)">入库</el-button>
+          <el-button type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
           <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
         </template>
       </el-table-column>
@@ -69,7 +71,8 @@
   </div>
 </template>
 <script>
-import { list, deleteitem } from "@/api/dictManage";
+import { listWarehousing, deleteWarehousing, executeWarehousing } from "@/api/warehousing";
+import { warehouseList } from "@/api/warehouse";
 import waves from "@/directive/waves"; // 水波纹指令
 
 export default {
@@ -77,14 +80,15 @@ export default {
   data() {
     return {
       downloadLoading: false,
+      warehouseList: [],
       typeList: [
         {
-          type: "0",
-          name: "正常",
+          type: '0',
+          name: "已入库",
         },
         {
-          type: "1",
-          name: "停用",
+          type: '1',
+          name: "待入库",
         },
       ],
       list: [
@@ -97,24 +101,33 @@ export default {
       listQuery: {
         page: 1,
         limit: 10,
-        dictName: '',
-        dictType: '',
-        status: '',
+        startDate: '',
+        endDate: '',
+        warehouseId: '',
+        isRunFinish: '',
       },
     }
   },
   created() {
+    this.getStoreList();
     this.getList();
   },
   methods: {
+    /** 获取仓库列表数据 */
+    getStoreList() {
+      warehouseList().then(response => {
+        this.warehouseList = response.data.data;
+      }).catch(() => { });
+    },
     /** 重置按钮操作 */
     resetQuery() {
       this.listQuery = {
         page: 1,
         limit: 10,
-        dictName: '',
-        dictType: '',
-        status: '',
+        startDate: '',
+        endDate: '',
+        warehouseId: '',
+        isRunFinish: '',
       },
         this.getList()
     },
@@ -130,12 +143,12 @@ export default {
     handleCreate() {
       this.$router.push({
         name: 'warehousingAdd',
-        params: { callback: this.getList }
+        // params: { callback: this.getList }
       })
     },
     getList() {
       this.listLoading = true
-      list(this.listQuery).then(response => {
+      listWarehousing(this.listQuery).then(response => {
         this.list = response.data.data.items
         this.total = response.data.data.total
         this.listLoading = false
@@ -164,17 +177,63 @@ export default {
     handleUpdate(row) {
       this.$router.push({
         name: 'warehousingEdit',
-        params: { id: row.dictType }
+        params: { id: row.id }
       })
     },
+    handleExecute(row) {
+      this.$confirm('确认入库吗?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        executeWarehousing({ ids: row.id }).then(response => {
+          this.$notify({
+            title: '成功',
+            message: '入库成功',
+            type: 'success',
+            duration: 2000
+          })
+          this.getList()
+        })
+      }).catch(() => { })
+    },
+    executeAll() {
+      const length = this.multipleSelection.length;
+      if (length > 0) {
+        this.$confirm("确认入库吗?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          for (let i = 0; i < length; i++) {
+            this.delarr.push(this.multipleSelection[i].id);
+          }
+          const ids = this.delarr.join(",");
+          executeWarehousing({ ids: ids }).then(() => {
+            this.$notify({
+              title: "成功",
+              message: "入库成功",
+              type: "success",
+              duration: 2000,
+            });
+            this.getList();
+          })
+        })
+      } else {
+        this.$notify({
+          title: "提示",
+          message: "请选择要入库的信息!",
+          type: "warning",
+        });
+      }
+    },
     handleDelete(row) {
-
       this.$confirm('确认删除吗?', '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        deleteitem({ dictIds: row.dictId }).then(response => {
+        deleteWarehousing({ ids: row.id }).then(response => {
           this.$notify({
             title: '成功',
             message: '删除成功',
@@ -183,45 +242,37 @@ export default {
           })
           this.getList()
         })
-      }).catch(() => {
-
-      })
-
+      }).catch(() => { })
     },
     delAll() {
-      this.$confirm("确认删除吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(() => {
-          const length = this.multipleSelection.length;
-
-          if (length > 0) {
-            for (let i = 0; i < length; i++) {
-              this.delarr.push(this.multipleSelection[i].dictId);
-            }
-            const dictIds = this.delarr.join(",");
-            deleteitem({ dictIds: dictIds })
-              .then(() => {
-                this.$notify({
-                  title: "成功",
-                  message: "删除成功",
-                  type: "success",
-                  duration: 2000,
-                });
-                this.getList();
-              })
-              .catch(() => { });
-          } else {
+      const length = this.multipleSelection.length;
+      if (length > 0) {
+        this.$confirm("确认删除吗?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          for (let i = 0; i < length; i++) {
+            this.delarr.push(this.multipleSelection[i].id);
+          }
+          const ids = this.delarr.join(",");
+          deleteWarehousing({ ids: ids }).then(() => {
             this.$notify({
-              title: "警告提示",
-              message: "请选择要删除的信息!",
-              type: "warning",
+              title: "成功",
+              message: "删除成功",
+              type: "success",
+              duration: 2000,
             });
-          }
+            this.getList();
+          })
         })
-        .catch(() => { });
+      } else {
+        this.$notify({
+          title: "提示",
+          message: "请选择要删除的信息!",
+          type: "warning",
+        });
+      }
     },
     handleSelectionChange(val) {
       this.multipleSelection = val;

+ 135 - 65
src/views/stock/warehousing/warehousingAdd.vue

@@ -1,30 +1,30 @@
 <template>
     <div class="app-container">
-        <el-form ref="dataForm" :model="dataForm" label-width="120px" inline>
+        <el-form ref="dataForm" :model="dataForm" :rules="rules" label-width="120px" inline>
             <h3>通用入库单</h3>
             <!-- <el-form-item label="名称" prop="name">
                 <el-input v-model="dataForm.name" :minlength="2" :maxlength="20" clearable
                     placeholder="请输入名称" style="width:200px" :disabled="type === 'detail'"></el-input>
             </el-form-item> -->
-            <el-form-item label="入库时间" prop="dateTime">
-                <el-date-picker v-model="dataForm.dateTime" value-format="timestamp" type="datetime"
+            <el-form-item label="入库时间" prop="serialDate">
+                <el-date-picker v-model="dataForm.serialDate" value-format="yyyy-MM-dd HH:mm:ss" type="datetime"
                     placeholder="选择日期时间" style="width:200px" :disabled="type === 'detail'">
                 </el-date-picker>
             </el-form-item>
-            <el-form-item label="供应商" prop="type">
-                <el-select v-model="dataForm.type" clearable placeholder="请选择" style="width: 200px;" :disabled="type === 'detail'">
-                    <el-option :key="item.dictValue" v-for="item in allTypeList" :label="item.dictLabel" :value="item.dictValue">
+            <el-form-item label="供应商" prop="supplierId">
+                <el-select v-model="dataForm.supplierId" clearable placeholder="请选择" style="width: 200px;" :disabled="type === 'detail'">
+                    <el-option :key="item.id" v-for="item in supplierList" :label="item.businessName" :value="item.id">
                     </el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item label="仓库" prop="type">
-                <el-select v-model="dataForm.type" clearable placeholder="请选择" style="width: 200px;" :disabled="type === 'detail'">
-                    <el-option :key="item.dictValue" v-for="item in allTypeList" :label="item.dictLabel" :value="item.dictValue">
+            <el-form-item label="仓库" prop="warehouseId">
+                <el-select v-model="dataForm.warehouseId" clearable placeholder="请选择" style="width: 200px;" :disabled="type === 'detail'">
+                    <el-option :key="item.id" v-for="item in warehouseList" :label="item.warehouseName" :value="item.id">
                     </el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item label="经手人" prop="loginId">
-                <el-select v-model="dataForm.loginId" clearable filterable placeholder="请选择" style="width: 200px" :disabled="type === 'detail'">
+            <el-form-item label="经手人" prop="addHandlerId">
+                <el-select v-model="dataForm.addHandlerId" clearable filterable placeholder="请选择" style="width: 200px" :disabled="type === 'detail'">
                     <el-option :key="item.loginId" v-for="item in recipientsList" :label="item.deptName+'_'+item.userName" :value="item.loginId">
                     </el-option>
                 </el-select>
@@ -37,7 +37,7 @@
                     placeholder="请输入采购说明 最大120字"></el-input>
             </el-form-item> -->
             <el-form-item label="附件:" prop="fileIds">
-                <el-upload :limit="1" :action="fileUrl" :file-list="dataForm.files" :on-success="handleFileSuccess"
+                <el-upload :limit="1" :action="fileUrl" :file-list="dataForm.fileList" :on-success="handleFileSuccess"
                     :before-upload="beforeUploadFile" :on-remove="handleRemove">
                     <el-button size="small" type="primary" :disabled="type === 'detail'">点击上传</el-button>
                 </el-upload>
@@ -47,39 +47,39 @@
         <el-button size="small" type="primary" v-if="type !== 'detail'"
           @click="handleSelectGoods" icon="el-icon-plus">商品/物料</el-button>
       </div>
-      <el-table size="small" :data="dataForm.item_list" border :cell-style="{ textAlign: 'center' }"
+      <el-table size="small" :data="dataForm.inventoryEntryInfos" border :cell-style="{ textAlign: 'center' }"
             :header-cell-style="{ textAlign: 'center' }" style="width: 100%">
             <el-table-column label="商品编号">
               <template slot-scope="scope">
-                {{ scope.row.goodCode }}
+                {{ scope.row.productCode }}
               </template>
             </el-table-column>
             <el-table-column label="商品名称">
               <template slot-scope="scope">
-                {{ scope.row.goodName }}
+                {{ scope.row.productName }}
               </template>
             </el-table-column>
             <el-table-column label="单价(¥)">
               <template slot-scope="scope">
-                {{ scope.row.price }}
+                {{ scope.row.createPrice.toFixed(2) }}
               </template>
             </el-table-column>
             <el-table-column label="库存数量">
               <template slot-scope="scope">
-                {{ scope.row.unit }}
+                {{ scope.row.createProductNumber }}
               </template>
             </el-table-column>
             <el-table-column label="入库数量">
               <template slot-scope="scope">
-                <el-form-item v-if="type !== 'detail'" :prop="'item_list.'+scope.$index+'.num'" :rules="{ required: true, message: '入库数量不能为空', trigger: 'blur' }" class="tableFormItem">
-                    <el-input-number v-model="scope.row.num" @change="handleChange(scope.row)" size="small" :min="1" :max="10000" label="入库数量"></el-input-number>
+                <el-form-item v-if="type !== 'detail'" :prop="'inventoryEntryInfos.'+scope.$index+'.updateNumber'" :rules="{ required: true, message: '入库数量不能为空', trigger: 'blur' }" class="tableFormItem">
+                    <el-input-number v-model="scope.row.updateNumber" @change="handleChange(scope.row)" size="small" :min="1" :max="10000" label="入库数量"></el-input-number>
                 </el-form-item>
-                <span v-else>{{ scope.row.num }}</span>
+                <span v-else>{{ scope.row.updateNumber }}</span>
               </template>
             </el-table-column>
             <el-table-column label="合计(¥)">
               <template slot-scope="scope">
-                {{ scope.row.total_price.toFixed(2) }}
+                {{ scope.row.sumPrice.toFixed(2) }}
               </template>
             </el-table-column>
             <!-- <el-table-column label="备注">
@@ -90,7 +90,7 @@
             <el-table-column label="操作" width="150" v-if="type !== 'detail'">
               <template slot-scope="scope">
                 <el-button size="mini" type="danger"
-                  @click="dataForm.item_list.splice(scope.$index, 1)">删除</el-button>
+                  @click="dataForm.inventoryEntryInfos.splice(scope.$index, 1)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -104,8 +104,10 @@
     </div>
 </template>
 <script>
-import { dataAdd, dataEdit } from "@/api/dictManage";
-import { allUserList,dataTypeList } from "@/api/public";
+import { createWarehousing, updateWarehousing, readWarehousing } from "@/api/warehousing";
+import { supplierList } from "@/api/supplier";
+import { warehouseList } from "@/api/warehouse";
+import { allUserList } from "@/api/public";
 import waves from "@/directive/waves"; // 水波纹指令
 
 export default {
@@ -114,13 +116,31 @@ export default {
         return {
             fileUrl:this.upLoadUrl,
             recipientsList:[],
-            allTypeList: [],
+            supplierList: [],
+            warehouseList: [],
             id: '',
             type: '',
             /** 表单*/
             dataForm: {
-                item_list: []
-            }
+                serialDate:'',
+                supplierId:undefined,
+                warehouseId:undefined,
+                addHandlerId:undefined,
+                fileIds:undefined,
+                fileList: [],
+                inventoryEntryInfos: []
+            },
+            rules: {
+                serialDate: [
+                    { required: true, message: '请选择入库时间', trigger: 'blur' }
+                ],
+                warehouseId: [
+                    { required: true, message: '请选择仓库', trigger: 'blur' }
+                ],
+                addHandlerId: [
+                    { required: true, message: '请选择经手人', trigger: 'blur' }
+                ],
+            },
         }
     },
     watch: {
@@ -129,7 +149,13 @@ export default {
             handler(newVal) {
                 if (this.$route.name === 'warehousingAdd') {
                     this.dataForm = {
-                        item_list: []
+                        serialDate:undefined,
+                        supplierId:undefined,
+                        warehouseId:undefined,
+                        addHandlerId:undefined,
+                        fileIds:undefined,
+                        fileList: [],
+                        inventoryEntryInfos: []
                     }
                 } else if (this.$route.name === 'warehousingDetail') {
                     this.type = 'detail'
@@ -142,45 +168,101 @@ export default {
         }
     },
     mounted() {
+        this.getSupplierList();
+        this.getStoreList(); 
         this.getAllUserList(); 
-        this.getPointRulesType(); 
     },
     methods: {
+        /** 获取供应商列表数据 */
+        getSupplierList(){
+            supplierList().then(response => {
+                this.supplierList = response.data.data;
+            }).catch(() => { });
+        },
+        /** 获取仓库列表数据 */
+        getStoreList() {
+            warehouseList().then(response => {
+                this.warehouseList = response.data.data;
+            }).catch(() => {});
+        },
+        /** 获取人员列表数据 */
+        getAllUserList() {
+            allUserList().then(response => {
+                this.recipientsList = response.data.data;
+            }).catch(() => { });
+        },
         /** 获取详情页面数据 */
         getDataFormDetail() {
-            
+            readWarehousing({ id: this.id }).then(response => {
+                let dataForm = response.data.data;
+                dataForm.inventoryEntryInfos = dataForm.inventoryEntryInfos == null ? [] : dataForm.inventoryEntryInfos
+                dataForm.inventoryOutInfos = dataForm.inventoryOutInfos == null ? [] : dataForm.inventoryOutInfos
+                this.dataForm = dataForm;
+            }).catch(() => {})
         },
          // 选择商品
         async handleSelectGoods() {
-            let selectedIds = this.dataForm.item_list.map(item => item.id);
-            const Goods = await this.$EnPickerGoods({
-                goodsApi: '/admin/list',
-                selectedIds: selectedIds,
-                // goodsApiParams: { warehouse_id: 12 }
-            })
-            if (!Goods.length) return
-            const item_list = Goods.map(item => {
-                item.id = item.id
-                item.goodCode = item.goodCode
-                item.goodName = item.goodName
-                item.unit = item.unit
-                item.unit = item.num
-                item.total_price = 0
-                return item
-            })
-            this.dataForm.item_list = this.dataForm.item_list && this.dataForm.item_list.length ? this.dataForm.item_list.concat(item_list) : this.dataForm.item_list = item_list
+            if (!this.dataForm.warehouseId) {
+                this.$message.error('请先选择仓库!')
+                return
+            }else{
+                console.log(this.dataForm.inventoryEntryInfos)
+                let selectedIds = this.dataForm.inventoryEntryInfos.map(item => item.id);
+                const Goods = await this.$EnPickerGoods({
+                    // goodsApi: '/warehouse-entry/info/inventory',
+                    selectedIds: selectedIds,
+                    goodsApiParams: { warehouseId: this.dataForm.warehouseId }
+                })
+                if (!Goods.length) return
+                const inventoryEntryInfos = Goods.map(item => {
+                    item.updateNumber = 1
+                    item.sumPrice = item.createPrice * 1
+                    return item
+                })
+                this.dataForm.inventoryEntryInfos = this.dataForm.inventoryEntryInfos && this.dataForm.inventoryEntryInfos.length ? this.dataForm.inventoryEntryInfos.concat(inventoryEntryInfos) : this.dataForm.inventoryEntryInfos = inventoryEntryInfos
+            }
+            
         },
         submitForm(){
-
+            this.$refs["dataForm"].validate((valid) => {
+                if (valid) {
+                    if(this.dataForm.inventoryEntryInfos.length == 0){
+                        this.$message.error('请选择商品/物料!')
+                        return
+                    }else{
+                        if(this.id){
+                            updateWarehousing(this.dataForm).then(() => {
+                                this.$notify({
+                                    title: '成功',
+                                    message: '更新成功',
+                                    type: 'success',
+                                    duration: 2000
+                                })
+                                this.roBack();
+                            })
+                        }else{
+                            createWarehousing(this.dataForm).then(() => {
+                                this.$notify({
+                                    title: "成功",
+                                    message: "创建成功",
+                                    type: "success",
+                                    duration: 2000,
+                                });
+                                this.roBack();
+                            })
+                        }
+                    }   
+                }
+            });
         },
         handleChange(row) {
-            if (row.price && row.num) {
-                row.total_price = row.price * row.num
+            if (row.createPrice && row.updateNumber) {
+                row.sumPrice = row.createPrice * row.updateNumber
             }
         },
         roBack() {
-            const { callback } = this.$route.params
-            if (typeof callback === 'function') callback()
+            // const { callback } = this.$route.params
+            // if (typeof callback === 'function') callback()
             this.$store.dispatch('delVisitedViews', this.$route).then((views) => {
                 const latestView = views.slice(-1)[0]
                 if (latestView) {
@@ -189,7 +271,7 @@ export default {
                     this.$router.push('/')
                 }
             })
-            this.$router.push({ name: 'warehousing' })
+            // this.$router.push({ name: 'warehousing' })
         },
         handleRemove(file, fileList) {
         console.log(file, fileList);
@@ -228,18 +310,6 @@ export default {
         }
         this.dataForm.fileIds = fileIds.join(",");
         },
-        getPointRulesType() {
-            dataTypeList({dictType:'integral_rule_type'}).then(response => {
-                this.allTypeList = response.data.data;
-            }).catch(() => {
-                
-            });
-        },
-        getAllUserList() {
-            allUserList().then(response => {
-                this.recipientsList = response.data.data;
-            }).catch(() => { });
-        },
     }
 }
 </script>