Explorar el Código

Assets copy 2 是原来的表格

wsx hace 1 año
padre
commit
c117689d67

+ 10 - 0
src/api/warehouseManagement/statisticalReports.js

@@ -58,3 +58,13 @@ export async function sendReceiveGatherExcel(params) {
   console.log('res', res);
   return res.data.data;
 }
+
+// 收发明细表-详情
+export async function outintwoPage(params) {
+  const res = await request.post(`/wms/statement/sendReceiveDetail`, 
+    params
+  );
+  console.log(res);
+
+  return res.data;
+}

+ 700 - 0
src/views/warehouseManagement/components/AssetsDialog copy 2.vue

@@ -0,0 +1,700 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    title="物品信息"
+    width="80vw"
+    :maxable="true"
+  >
+    <el-form :model="searchForm" label-width="100px">
+      <el-row :gutter="20">
+        <el-col :span="6">
+          <el-form-item label="列表维度:" prop="dimension">
+            <template>
+              <el-select
+                style="width: 100%"
+                @change="changeDimensionHandler"
+                v-model="dimension"
+                placeholder="请选择"
+              >
+                <!-- <el-option label="物料维度" value="4"> </el-option> -->
+                <el-option label="包装维度" value="3"> </el-option>
+                <el-option label="批次维度" value="2"> </el-option>
+                <el-option label="物品维度" value="1"> </el-option>
+              </el-select>
+            </template>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="物品编码:">
+            <el-input
+              type="text"
+              placeholder="搜索物品编码"
+              v-model="searchForm.categoryCode"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="物品名称:">
+            <el-input
+              type="text"
+              placeholder="搜索物品名称"
+              v-model="searchForm.categoryName"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="批次号:">
+            <el-input
+              type="text"
+              placeholder="搜索批次号"
+              v-model="searchForm.batchNo"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="刻码">
+            <el-input
+              type="text"
+              placeholder="搜索物品刻码"
+              v-model="searchForm.engrave"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="物料代号">
+            <el-input
+              type="text"
+              placeholder="搜索物料代号"
+              v-model="searchForm.materielDesignation"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="发货码">
+            <el-input
+              type="text"
+              placeholder="搜索发货码"
+              v-model="searchForm.barcodes"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="牌号">
+            <el-input
+              type="text"
+              placeholder="搜索牌号"
+              v-model="searchForm.brandNum"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="仓库">
+            <el-select
+              clearable
+              style="width: 100%"
+              v-model="searchForm.warehouseId"
+              placeholder="请选择"
+            >
+              <el-option
+                v-for="item in warehouseList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="所属工厂" prop="factoryId">
+            <el-select
+              filterable
+              placeholder="请选择"
+              v-model="searchForm.factoryId"
+              clearable
+              class="w100"
+            >
+              <el-option
+                v-for="item in factoryList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="6">
+          <el-form-item label="关键字">
+            <el-input
+              clearable
+              type="text"
+              placeholder="请输入"
+              v-model="searchForm.keyWord"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col>
+          <div style="float: right">
+            <el-button type="primary" @click="doSearch">搜索</el-button>
+            <el-button icon="el-icon-refresh-left" @click="reset"
+              >重置</el-button
+            >
+          </div>
+        </el-col>
+      </el-row>
+    </el-form>
+    <el-container class="assets-dialog">
+      <el-aside width="200px" class="wrapper-assets">
+        <AssetTree
+          ref="treeList"
+          :treeIds="treeIds"
+          @handleNodeClick="handleNodeClick"
+        />
+      </el-aside>
+      <el-main>
+        
+        <el-table
+          ref="multipleTable"
+          :data="tableData"
+          tooltip-effect="dark"
+          height="50vh"
+          border
+          row-key="id"
+          style="width: 100%"
+          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+          @selection-change="handleSelectionChange"
+        >
+          <el-table-column
+            v-if="dimension == 1"
+            type="selection"
+            :reserve-selection="true"
+            width="55"
+            align="center"
+            fixed="left"
+            :selectable="
+              (row) => {
+                return !this.productLists.some(
+                  (it) => it.categoryId == row.categoryId
+                );
+              }
+            "
+          >
+          </el-table-column>
+          <el-table-column
+            v-else-if="dimension != 1"
+            type="selection"
+            :reserve-selection="true"
+            width="55"
+            align="center"
+            fixed="left"
+            :selectable="
+              (row) => {
+                return !this.productLists.some((it) => it.id == row.id);
+              }
+            "
+          >
+          </el-table-column>
+          <el-table-column label="序号" type="index" width="50" fixed="left">
+          </el-table-column>
+          <el-table-column
+            v-if="dimension != 4"
+            label="出库数量"
+            type="index"
+            width="100"
+          >
+            <template slot-scope="{ row }">
+              <el-input
+                type="text"
+                placeholder="请输入"
+                v-model="row.outboundNum"
+                @input="handleInput(row, $event)"
+                :disabled="dimension == '3'"
+              ></el-input>
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="categoryCode"
+            label="物品编码"
+            min-width="120"
+            fixed="left"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="categoryName"
+            width="200"
+            label="物品名称"
+            fixed="left"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="brandNum"
+            label="牌号"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="categoryModel"
+            label="型号"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="specification"
+            label="规格"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <template v-if="dimension == 1">
+            <el-table-column
+              v-for="(item, index) in newColumns"
+              :label="item.label"
+              :align="item.align"
+              :prop="item.prop"
+              :show-overflow-tooltip="item.showOverflowTooltip"
+            ></el-table-column>
+          </template>
+          <el-table-column
+            v-else
+            prop="batchNo"
+            label="批次号"
+            key="batchNo"
+            min-width="80"
+          ></el-table-column>
+          <el-table-column prop="level" label="级别"></el-table-column>
+          <el-table-column
+            prop="measureQuantity"
+            label="计量数量"
+            width="120"
+          ></el-table-column>
+          <el-table-column
+            prop="measureUnit"
+            label="计量单位"
+            width="90"
+          ></el-table-column>
+          <el-table-column
+            prop="weight"
+            label="重量"
+            min-width="120"
+          ></el-table-column>
+          <el-table-column
+            prop="weightUnit"
+            label="重量单位"
+            min-width="120"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3"
+            prop="packageNo"
+            label="包装编码"
+            min-width="120"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3"
+            prop="packingQuantity"
+            label="包装数量"
+            min-width="120"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3"
+            prop="packingUnit"
+            label="包装单位"
+            min-width="120"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3 || dimension == 4"
+            label="发货条码"
+            prop="barcodes"
+            width="80"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 4"
+            prop="no"
+            label="物料编码"
+            min-width="120"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3 || dimension == 4"
+            prop="materielDesignation"
+            label="物料代号"
+            min-width="100"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3 || dimension == 4"
+            prop="clientCode"
+            label="客户代号"
+            min-width="100"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3 || dimension == 4"
+            prop="engrave"
+            label="刻码"
+            min-width="120"
+          ></el-table-column>
+          <el-table-column
+            v-if="dimension == 3 || dimension == 4"
+            prop="warehouseName"
+            label="仓库"
+            min-width="200"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="supplierName"
+            label="供应商"
+            min-width="200"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+          <el-table-column
+            prop="supplierCode"
+            label="供应商代号"
+            min-width="200"
+            :show-overflow-tooltip="true"
+          ></el-table-column>
+        </el-table>
+        <div style="text-align: right; padding: 10px">
+          <el-pagination
+            background
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total"
+            :page-sizes="[5, 10, 20, 50]"
+            :page-size.sync="searchForm.size"
+            :current-page.sync="searchForm.pageNum"
+            @current-change="handleCurrentChange"
+            @size-change="handleSizeChange"
+          >
+          </el-pagination>
+        </div>
+      </el-main>
+    </el-container>
+
+    <div slot="footer">
+      <el-button type="primary" @click="confirm">确定</el-button>
+      <el-button @click="cancel">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import storageApi from '@/api/warehouseManagement';
+  import AssetTree from '../stockManagement/components/assetTree.vue';
+  import { getWarehouseList } from '@/api/classifyManage/itemInformation';
+  import { getDetailById, quantityDelivery } from '@/api/classifyManage';
+  export default {
+    components: { AssetTree },
+    props: {
+      treeIds: { type: Array, default: () => [] }
+    },
+    data() {
+      return {
+        factoryList: [],
+        newColumns: [], // 动态表头
+        isShowTable: true,
+        qualityResultOption: [
+          {
+            value: 0,
+            label: '合格'
+          },
+          {
+            value: 1,
+            label: '不合格'
+          }
+        ],
+        qualityStatusOption: [
+          {
+            value: 1,
+            label: '已质检'
+          },
+          {
+            value: 0,
+            label: '未质检'
+          }
+        ],
+        visible: false,
+        tableData: [],
+        total: 0,
+        categoryLevelId: '',
+        searchForm: {
+          categoryCode: '',
+          categoryName: '',
+          batchNo: '',
+          factoryId: '',
+          brandNum: '',
+          engrave: '',
+          barcodes: '',
+          categoryLevelId: '',
+          warehouseId: '',
+          pageNum: 1,
+          size: 20
+        },
+        selectionList: [],
+        materialType: '',
+        warehouseList: [],
+        dimension: '1',
+        productLists: []
+      };
+    },
+    created() {
+      this.getFieldModel();
+      this.getWarehouse();
+      this.getFactoryList();
+    },
+    watch: {
+      tableData(val) {
+        this.doLayout();
+      }
+    },
+    methods: {
+      //获取工厂列表
+      async getFactoryList() {
+        const res = await warehouseDefinition.getFactoryarea({
+          pageNum: 1,
+          size: 9999,
+          type: 1
+        });
+        this.factoryList = res.list;
+      },
+      async getWarehouse() {
+        const { data } = await getWarehouseList();
+        this.warehouseList = data;
+      },
+      doLayout() {
+        let that = this;
+        this.$nextTick(() => {
+          that.$refs.multipleTable.doLayout();
+        });
+      },
+      // 获取动态表头
+      getFieldModel() {
+        storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
+          let newRes = res.map((m) => {
+            return {
+              prop: 'extField.' + m.prop,
+              label: m.label,
+              align: 'center',
+              showOverflowTooltip: true
+            };
+          });
+          this.newColumns = [...newRes];
+        });
+      },
+      getRowKeys(row) {
+        return row.id;
+      },
+      // 出库数量限制
+      handleInput(row, value) {
+        if (row.outboundNum <= row.measureQuantity) {
+          // return (row.outboundNum = value.replace(/^(0+)|[^\d]+/g, ''));
+
+          // 过滤掉非数字和小数点的字符
+          const filteredValue = value.replace(/[^0-9.]/g, '');
+          // 限制只能有一个小数点
+          const singleDotValue = filteredValue.replace(/(\..*)\./g, '$1');
+
+          let finalValue = '';
+          const dotIndex = singleDotValue.indexOf('.');
+          if (dotIndex !== -1) {
+            // 截取小数点后最多两位
+            finalValue = singleDotValue.slice(0, dotIndex + 3);
+          } else {
+            finalValue = singleDotValue;
+          }
+          return (row.outboundNum = finalValue);
+        } else {
+          row.outboundNum = row.measureQuantity;
+        }
+      },
+      // 切换维度
+      changeDimensionHandler(e) {
+        this.searchForm.pageNum = 1;
+        this.selectionList = [];
+        this.$refs.multipleTable.clearSelection();
+        this.changeDimension(e);
+      },
+      async changeDimension(e) {
+        this.dimension = e;
+        if (this.dimension == 1) {
+          // 物品维度
+          const data = await storageApi.getProductList(this.searchForm);
+          this.tableData = data.list;
+          this.total = data.count;
+        } else if (this.dimension == 2) {
+          // 批次维度
+          const data = await storageApi.getBatchList(this.searchForm);
+          for (let i = 0; i < data.list.length; i++) {
+            data.list[i].outboundNum = data.list[i].measureQuantity;
+          }
+          this.tableData = data.list;
+          this.total = data.count;
+        } else if (this.dimension == 4) {
+          // 物料维度
+          const data = await storageApi.getMaterialList(this.searchForm);
+          this.tableData = data.list;
+          this.total = data.count;
+        } else {
+          // 包装维度
+          const data = await storageApi.getPackingList(this.searchForm);
+          for (let i = 0; i < data.list.length; i++) {
+            data.list[i].outboundNum = data.list[i].packingQuantity;
+          }
+          this.tableData = data.list;
+          this.total = data.count;
+        }
+        console.log(this.tableData);
+        this.updateProductOutboundNums(this.tableData);
+      },
+      updateProductOutboundNums(list) {
+        console.log(this.productLists, 'this.productLists');
+
+        if (this.dimension == 1) {
+          //物品层
+          for (let i = 0; i < list.length; i++) {
+            const item = list[i];
+            const matchedProduct = this.productLists.find(
+              (product) => product.categoryId === item.categoryId
+            );
+
+            if (matchedProduct) {
+              this.$set(item, 'outboundNum', matchedProduct.measureQuantity);
+            }
+            const isSelection = this.selectionList.find(
+              (product) => product.categoryId === item.categoryId
+            );
+            if (isSelection) {
+              this.$set(item, 'outboundNum', isSelection.outboundNum);
+            }
+          }
+        } else {
+          for (let i = 0; i < list.length; i++) {
+            const item = list[i];
+            const matchedProduct = this.productLists.find(
+              (product) => product.id === item.id
+            );
+
+            if (matchedProduct) {
+              this.$set(item, 'outboundNum', matchedProduct.measureQuantity);
+            }
+            const isSelection = this.selectionList.find(
+              (product) => product.id === item.id
+            );
+            if (isSelection) {
+              this.$set(item, 'outboundNum', isSelection.outboundNum);
+            }
+          }
+        }
+      },
+      open(val) {
+        this.productLists = val || [];
+        this.visible = true;
+        this.$nextTick(() => {
+          this.$refs.treeList.getTreeData().then((data) => {
+            this.handleNodeClick(data);
+          });
+        });
+      },
+      async confirm() {
+        if (!this.selectionList.length) {
+          this.$message.error('请至少选择一条数据!');
+          return;
+        }
+        if (this.dimension == 1) {
+          let boolen = this.selectionList.every((item) => item.outboundNum > 0);
+          if (!boolen) {
+            this.$message.error('请输入出库数量!');
+            return;
+          }
+        }
+        console.log(this.selectionList);
+        let data = null;
+        if (this.dimension == 3) {
+          data = await storageApi.getHierarchyList({
+            ids: this.selectionList.map((item) => item.id).join(','),
+            type: this.dimension
+          });
+        } else if (this.dimension == 2) {
+          data = await storageApi.getHierarchyFifo({
+            type: this.dimension,
+            ids: this.selectionList.map((item) => item.id),
+            builders: this.selectionList.map((item) => {
+              return {
+                categoryId: item.categoryId,
+                num: item.outboundNum,
+                id: item.id
+              };
+            })
+          });
+        } else if (this.dimension == 1) {
+          data = await storageApi.getHierarchyFifo({
+            type: this.dimension,
+            builders: this.selectionList.map((item) => {
+              return {
+                categoryId: item.categoryId,
+                num: item.outboundNum
+              };
+            })
+          });
+        }
+        console.log('data-------------------', data);
+        this.$emit('detailData', data, this.dimension);
+        this.cancel();
+      },
+      cancel() {
+        this.selectionList = [];
+        this.$refs.multipleTable.clearSelection();
+        this.visible = false;
+      },
+      handleSelectionChange(val) {
+        this.selectionList = val;
+      },
+      handleNodeClick(data) {
+        console.log(data);
+        this.categoryLevelId = data.id;
+        this.searchForm.categoryLevelId = data.id;
+        this.doSearch();
+      },
+      handleCurrentChange() {
+        this.changeDimension(this.dimension);
+      },
+      reset() {
+        this.searchForm = {
+          categoryCode: '',
+          categoryName: '',
+          batchNo: '',
+          brandNum: '',
+          engrave: '',
+          barcodes: '',
+          warehouseId: '',
+          factoryId: '',
+          categoryLevelId: this.categoryLevelId,
+          pageNum: 1,
+          size: 20
+        };
+        this.doSearch();
+      },
+      doSearch() {
+        this.searchForm.pageNum = 1;
+        this.changeDimension(this.dimension);
+      },
+      handleSizeChange() {
+        this.searchForm.pageNum = 1;
+        this.changeDimension(this.dimension, 'page');
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .el-dialog__wrapper {
+    ::v-deep .el-aside {
+      background-color: #fff !important;
+      border: 1px solid #ccc;
+    }
+  }
+
+  .wrapper-assets {
+    max-height: 53vh;
+    overflow: auto;
+  }
+</style>

+ 355 - 229
src/views/warehouseManagement/components/AssetsDialog.vue

@@ -154,217 +154,30 @@
         />
       </el-aside>
       <el-main>
-        <el-table
-          ref="multipleTable"
-          :data="tableData"
-          tooltip-effect="dark"
-          height="50vh"
-          border
+        <ele-pro-table
           row-key="id"
-          style="width: 100%"
-          :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
-          @selection-change="handleSelectionChange"
+          :selection.sync="selectionList"
+          ref="table"
+          class="table"
+          :columns="columns"
+          :datasource="datasource"
+          height="calc(100vh - 550px)"
+          full-height="calc(100vh - 116px)"
+          tool-class="ele-toolbar-form"
+          :pageSize="20"
+          @columns-change="handleColumnChange"
+          :cache-key="cacheKeyUrl"
         >
-          <el-table-column
-            v-if="dimension == 1"
-            type="selection"
-            :reserve-selection="true"
-            width="55"
-            align="center"
-            fixed="left"
-            :selectable="
-              (row) => {
-                return !this.productLists.some(
-                  (it) => it.categoryId == row.categoryId
-                );
-              }
-            "
-          >
-          </el-table-column>
-          <el-table-column
-            v-else-if="dimension != 1"
-            type="selection"
-            :reserve-selection="true"
-            width="55"
-            align="center"
-            fixed="left"
-            :selectable="
-              (row) => {
-                return !this.productLists.some((it) => it.id == row.id);
-              }
-            "
-          >
-          </el-table-column>
-          <el-table-column label="序号" type="index" width="50" fixed="left">
-          </el-table-column>
-          <el-table-column
-            v-if="dimension != 4"
-            label="出库数量"
-            type="index"
-            width="100"
-          >
-            <template slot-scope="{ row }">
-              <el-input
-                type="text"
-                placeholder="请输入"
-                v-model="row.outboundNum"
-                @input="handleInput(row, $event)"
-                :disabled="dimension == '3'"
-              ></el-input>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="categoryCode"
-            label="物品编码"
-            min-width="120"
-            fixed="left"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            prop="categoryName"
-            width="200"
-            label="物品名称"
-            fixed="left"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            prop="brandNum"
-            label="牌号"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            prop="categoryModel"
-            label="型号"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            prop="specification"
-            label="规格"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <template v-if="dimension == 1">
-            <el-table-column
-              v-for="(item, index) in newColumns"
-              :label="item.label"
-              :align="item.align"
-              :prop="item.prop"
-              :show-overflow-tooltip="item.showOverflowTooltip"
-            ></el-table-column>
+          <template v-slot:outboundNum="{ row }">
+            <el-input
+              type="text"
+              placeholder="请输入"
+              v-model="row.outboundNum"
+              @input="handleInput(row, $event)"
+              :disabled="inputDisabled(row)"
+            ></el-input>
           </template>
-          <el-table-column
-            v-else
-            prop="batchNo"
-            label="批次号"
-            key="batchNo"
-            min-width="80"
-          ></el-table-column>
-          <el-table-column prop="level" label="级别"></el-table-column>
-          <el-table-column
-            prop="measureQuantity"
-            label="计量数量"
-            width="120"
-          ></el-table-column>
-          <el-table-column
-            prop="measureUnit"
-            label="计量单位"
-            width="90"
-          ></el-table-column>
-          <el-table-column
-            prop="weight"
-            label="重量"
-            min-width="120"
-          ></el-table-column>
-          <el-table-column
-            prop="weightUnit"
-            label="重量单位"
-            min-width="120"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3"
-            prop="packageNo"
-            label="包装编码"
-            min-width="120"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3"
-            prop="packingQuantity"
-            label="包装数量"
-            min-width="120"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3"
-            prop="packingUnit"
-            label="包装单位"
-            min-width="120"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3 || dimension == 4"
-            label="发货条码"
-            prop="barcodes"
-            width="80"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 4"
-            prop="no"
-            label="物料编码"
-            min-width="120"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3 || dimension == 4"
-            prop="materielDesignation"
-            label="物料代号"
-            min-width="100"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3 || dimension == 4"
-            prop="clientCode"
-            label="客户代号"
-            min-width="100"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3 || dimension == 4"
-            prop="engrave"
-            label="刻码"
-            min-width="120"
-          ></el-table-column>
-          <el-table-column
-            v-if="dimension == 3 || dimension == 4"
-            prop="warehouseName"
-            label="仓库"
-            min-width="200"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            prop="supplierName"
-            label="供应商"
-            min-width="200"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-          <el-table-column
-            prop="supplierCode"
-            label="供应商代号"
-            min-width="200"
-            :show-overflow-tooltip="true"
-          ></el-table-column>
-        </el-table>
-        <div style="text-align: right; padding: 10px">
-          <el-pagination
-            background
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="total"
-            :page-sizes="[5, 10, 20, 50]"
-            :page-size.sync="searchForm.size"
-            :current-page.sync="searchForm.pageNum"
-            @current-change="handleCurrentChange"
-            @size-change="handleSizeChange"
-          >
-          </el-pagination>
-        </div>
+        </ele-pro-table>
       </el-main>
     </el-container>
 
@@ -381,7 +194,10 @@
   import AssetTree from '../stockManagement/components/assetTree.vue';
   import { getWarehouseList } from '@/api/classifyManage/itemInformation';
   import { getDetailById, quantityDelivery } from '@/api/classifyManage';
+
+  import tabMixins from '@/mixins/tableColumnsMixin';
   export default {
+    mixins: [tabMixins],
     components: { AssetTree },
     props: {
       treeIds: { type: Array, default: () => [] }
@@ -432,19 +248,242 @@
         materialType: '',
         warehouseList: [],
         dimension: '1',
-        productLists: []
+        productLists: [],
+        columnsVersion: 1,
+        diffCacheKeyUrl: 'wms-warehouseManagement-components-AssetsDialog',
+        cacheKeyUrl: 'wms-warehouseManagement-components-AssetsDialog1',
+        selection: []
       };
     },
     created() {
+      console.log('created');
+
       this.getFieldModel();
       this.getWarehouse();
       this.getFactoryList();
     },
-    watch: {
-      tableData(val) {
-        this.doLayout();
+    mounted() {
+      // this.$nextTick(() => {
+      //   this.$refs.table.reload();
+      // });
+    },
+    computed: {
+      inputDisabled() {
+        let _this = this;
+        return (row) => {
+          // console.log(row);
+          return (
+            _this.productLists.some((it) => it.categoryId == row.categoryId) ||
+            _this.dimension == '3'
+          );
+        };
+      },
+      columns() {
+        const _this = this;
+        const version = this.columnsVersion;
+
+        let kk = [];
+        let jj = [];
+
+        if (this.dimension == 1) {
+          kk = this.newColumns.map((item) => {
+            return {
+              label: item.label,
+              align: item.align,
+              prop: item.prop,
+              showOverflowTooltip: item.showOverflowTooltip
+            };
+          });
+        } else {
+          kk = [
+            {
+              label: '批次号',
+              prop: 'batchNo',
+              showOverflowTooltip: true
+            }
+          ];
+        }
+
+        if (this.dimension == 3) {
+          jj = [
+            {
+              label: '包装编码',
+              prop: 'packageNo',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '包装数量',
+              prop: 'packingQuantity',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '包装单位',
+              prop: 'packingUnit',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '发货条码',
+              prop: 'barcodes',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '物料代号',
+              prop: 'materielDesignation',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '客户代号',
+              prop: 'clientCode',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '刻码',
+              prop: 'engrave',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              label: '仓库',
+              prop: 'warehouseName',
+              align: 'center',
+              showOverflowTooltip: true
+            }
+          ];
+        }
+
+        let arr = [
+          this.dimension == 1
+            ? {
+                width: 55,
+                type: 'selection',
+                columnKey: 'selection',
+                fixed: 'left',
+                align: 'center',
+                reserveSelection: true,
+                selectable: (row) => {
+                  return !_this.productLists.some(
+                    (it) => it.categoryId == row.categoryId
+                  );
+                }
+              }
+            : {
+                width: 55,
+                type: 'selection',
+                columnKey: 'selection',
+                fixed: 'left',
+                align: 'center',
+                reserveSelection: true,
+                selectable: (row) => {
+                  return !_this.productLists.some(
+                    (it) => it.categoryId == row.categoryId
+                  );
+                }
+              },
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 50,
+            align: 'center',
+            label: '序号',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            fixed: 'left',
+            prop: 'categoryCode',
+            label: '物品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            fixed: 'left',
+            prop: 'categoryName',
+            label: '物品名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'outboundNum',
+            label: '出库数量',
+            align: 'center',
+            minWidth: '100',
+            showOverflowTooltip: true,
+            slot: 'outboundNum'
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryModel',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          ...kk,
+          {
+            prop: 'level',
+            label: '级别',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureQuantity',
+            label: '计量数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measureUnit',
+            label: '计量单位',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weight',
+            label: '重量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          ...jj,
+          {
+            prop: 'supplierName',
+            label: '供应商',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'supplierCode',
+            label: '供应商代号',
+            align: 'center',
+            showOverflowTooltip: true
+          }
+        ];
+        return arr;
       }
     },
+
+    watch: {},
     methods: {
       //获取工厂列表
       async getFactoryList() {
@@ -455,16 +494,12 @@
         });
         this.factoryList = res.list;
       },
+
       async getWarehouse() {
         const { data } = await getWarehouseList();
         this.warehouseList = data;
       },
-      doLayout() {
-        let that = this;
-        this.$nextTick(() => {
-          that.$refs.multipleTable.doLayout();
-        });
-      },
+
       // 获取动态表头
       getFieldModel() {
         storageApi.fieldModel({ fieldModel: 't_main_category' }).then((res) => {
@@ -479,9 +514,7 @@
           this.newColumns = [...newRes];
         });
       },
-      getRowKeys(row) {
-        return row.id;
-      },
+
       // 出库数量限制
       handleInput(row, value) {
         if (row.outboundNum <= row.measureQuantity) {
@@ -505,12 +538,15 @@
           row.outboundNum = row.measureQuantity;
         }
       },
+
       // 切换维度
       changeDimensionHandler(e) {
         this.searchForm.pageNum = 1;
+
         this.selectionList = [];
-        this.$refs.multipleTable.clearSelection();
-        this.changeDimension(e);
+        this.cacheKeyUrl = this.diffCacheKeyUrl + e;
+        this.getTabColumns();
+        this.reload();
       },
       async changeDimension(e) {
         this.dimension = e;
@@ -546,17 +582,24 @@
       },
       updateProductOutboundNums(list) {
         console.log(this.productLists, 'this.productLists');
+        console.log(this.dimension);
 
+        // 物品时有bug,可能有多条,不用find,用filter
         if (this.dimension == 1) {
           //物品层
           for (let i = 0; i < list.length; i++) {
             const item = list[i];
-            const matchedProduct = this.productLists.find(
+            const matchedProduct = this.productLists.filter(
               (product) => product.categoryId === item.categoryId
             );
+            let num = matchedProduct.reduce(
+              (pre, cur) => pre + cur.measureQuantity,
+              0
+            );
+            // console.log(matchedProduct);
 
-            if (matchedProduct) {
-              this.$set(item, 'outboundNum', matchedProduct.measureQuantity);
+            if (matchedProduct.length) {
+              this.$set(item, 'outboundNum', num);
             }
             const isSelection = this.selectionList.find(
               (product) => product.categoryId === item.categoryId
@@ -585,15 +628,24 @@
         }
       },
       open(val) {
+        let that = this;
         this.productLists = val || [];
         this.visible = true;
         this.$nextTick(() => {
           this.$refs.treeList.getTreeData().then((data) => {
+            // that.$nextTick(() => {
+            //   that.categoryLevelId = data.id;
+            //   that.searchForm.categoryLevelId = data.id;
+            //   that.doSearch();
+            // });
+
             this.handleNodeClick(data);
           });
         });
       },
       async confirm() {
+        console.log(this.selectionList);
+
         if (!this.selectionList.length) {
           this.$message.error('请至少选择一条数据!');
           return;
@@ -641,14 +693,14 @@
       },
       cancel() {
         this.selectionList = [];
-        this.$refs.multipleTable.clearSelection();
+        // this.$refs.multipleTable.clearSelection();
         this.visible = false;
       },
       handleSelectionChange(val) {
         this.selectionList = val;
       },
       handleNodeClick(data) {
-        console.log(data);
+        // console.log(data);
         this.categoryLevelId = data.id;
         this.searchForm.categoryLevelId = data.id;
         this.doSearch();
@@ -674,11 +726,85 @@
       },
       doSearch() {
         this.searchForm.pageNum = 1;
-        this.changeDimension(this.dimension);
+        this.$refs.table.reload();
+        this.$refs.table.reRenderTable();
       },
       handleSizeChange() {
         this.searchForm.pageNum = 1;
         this.changeDimension(this.dimension, 'page');
+      },
+      // 翻页时,输入的数量会重置
+      updateSelect(data) {
+        if (!this.selectionList.length) {
+          return data;
+        }
+        let ids = this.selectionList.map((item) => item.id);
+        data.list.forEach((item) => {
+          let id = ids.find((id) => item.id === id);
+          if (id) {
+            item.outboundNum = this.selectionList.find(
+              (item) => item.id === id
+            ).outboundNum;
+          }
+        });
+        return data;
+      },
+
+      async datasource({ page, limit, where, order }) {
+        const dimension = this.dimension;
+        let data;
+        // console.log(this.searchForm);
+        // console.log(dimension);
+
+        if (dimension == 1) {
+          data = await storageApi.getProductList({
+            ...where,
+            ...order,
+            ...this.searchForm,
+            pageNum: page,
+            size: limit
+          });
+
+          // console.log(data);
+          // let result = this.updateSelect(data);
+          // return result;
+          this.updateProductOutboundNums(data.list);
+          return data;
+        }
+
+        if (dimension == 2) {
+          data = await storageApi.getBatchList({
+            ...where,
+            ...order,
+            ...this.searchForm,
+            pageNum: page,
+            size: limit
+          });
+          data.list.forEach((item) => {
+            item.outboundNum = item.measureQuantity;
+          });
+          return data;
+        }
+
+        if (dimension == 3) {
+          data = await storageApi.getPackingList({
+            ...where,
+            ...order,
+            ...this.searchForm,
+            pageNum: page,
+            size: limit
+          });
+          data.list.forEach((item) => {
+            item.outboundNum = item.packingQuantity;
+          });
+          this.updateProductOutboundNums(data.list);
+          return data;
+        }
+      },
+      reload(where) {
+        this.$refs.table.reload({
+          pageNum: 1
+        });
       }
     }
   };

+ 12 - 8
src/views/warehouseManagement/outgoingManagement/add.vue

@@ -1062,15 +1062,19 @@
         this.formData.extInfo.createUserName = info.name;
         this.formData.createUserId = info.userId;
 
-        // 默认领料人部门
-        this.$set(this.formData.extInfo, 'verifyDeptCode', info?.groupId);
-        this.$set(this.formData.extInfo, 'verifyDeptName', info?.groupName);
+        console.log(this.$route.query.detailId);
 
-        // 领料人
-        await this.getStaffList({ id: info?.groupId });
-        this.$set(this.formData, 'fromId', info.userId);
-        this.$set(this.formData, 'fromUser', info.name);
-        this.$set(this.formData, 'fromUserPhone', info.phone);
+        if (!this.$route.query.detailId) {
+          // 默认领料人部门
+          this.$set(this.formData.extInfo, 'verifyDeptCode', info?.groupId);
+          this.$set(this.formData.extInfo, 'verifyDeptName', info?.groupName);
+
+          // 领料人
+          await this.getStaffList({ id: info?.groupId });
+          this.$set(this.formData, 'fromId', info.userId);
+          this.$set(this.formData, 'fromUser', info.name);
+          this.$set(this.formData, 'fromUserPhone', info.phone);
+        }
       },
       // 初始化部门数据
       async initDeptData() {

+ 187 - 10
src/views/warehouseManagement/statisticalReports/transceiverDetails/add.vue

@@ -7,7 +7,7 @@
   >
     <el-card shadow="never" style="height: 70vh">
       <!-- 数据表格 -->
-      <div >
+      <div>
         <el-form
           label-position="left"
           class="ele-form-search"
@@ -104,8 +104,9 @@
         <template v-slot:bizType="{ row }">
           {{ handleBizType(row.bizType, row.type) }}
         </template>
+
         <template v-slot:assetType="{ row }">
-          {{ handleAssetType(row.extInfo.assetType) }}
+          {{ handleAssetType(row?.extInfo?.assetType) }}
         </template>
       </ele-pro-table>
     </el-card>
@@ -129,7 +130,10 @@
 <script>
   import { getCode } from '@/api/codeManagement/index.js';
   import ItemSearch from './components/item-search.vue';
-  import { sendReceiveExcel } from '@/api/warehouseManagement/statisticalReports';
+  import {
+    sendReceiveExcel,
+    outintwoPage
+  } from '@/api/warehouseManagement/statisticalReports';
   import storageApi from '@/api/warehouseManagement';
   import { allCategoryLevel } from '@/api/classifyManage';
   import {
@@ -217,6 +221,8 @@
     computed: {
       // 表格列配置
       columns() {
+        console.log(this.isView);
+
         let arr = [
           {
             type: 'index',
@@ -297,7 +303,154 @@
           //   width: 100
           // }
         ];
-        return arr.filter((item) => item != '');
+
+        if (!this.isView) {
+          return arr.filter((item) => item != '');
+        }
+
+        if (this.isView) {
+          return [
+            {
+              type: 'index',
+              label: '序号',
+              width: 50,
+              align: 'center'
+            },
+            {
+              prop: 'categoryCode',
+              label: '物品编码',
+              align: 'center',
+              showOverflowTooltip: true,
+              width: 150
+            },
+            {
+              prop: 'categoryName',
+              label: '物品名称',
+              align: 'center',
+              showOverflowTooltip: true,
+              width: 150
+            },
+            {
+              prop: 'categoryLevelPath',
+              label: '物品类型',
+              align: 'center',
+              showOverflowTooltip: true,
+              width: 150
+            },
+            {
+              prop: 'specification',
+              label: '规格',
+              align: 'center',
+              showOverflowTooltip: true,
+              width: 150
+            },
+            {
+              width: 160,
+              prop: 'inStorageTime',
+              label: '出入库时间',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+
+            {
+              prop: 'bizNo',
+              label: '单号',
+              align: 'center',
+              slot: 'bizNo',
+              showOverflowTooltip: true,
+              width: 150
+            },
+            {
+              prop: 'inBizType',
+              slot: 'inBizType',
+              label: '出入库类型',
+              align: 'center',
+              showOverflowTooltip: true,
+              width: 150,
+              formatter: (row) => {
+                return (
+                  sceneState.find((item) => item.code == row.inBizType).label ??
+                  ''
+                );
+              }
+            },
+
+            {
+              prop: 'supplierName',
+              label: '往来单位',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'warehouseName',
+              label: '仓库名称',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+             {
+              prop: 'remark',
+              label: '备注',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+
+            {
+              prop: 'inQuantity',
+              label: '入库数量',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+
+            {
+              prop: 'inUnitPrice',
+              label: '入库单价',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'inPrice',
+              label: '入库成本小计',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'outQuantity',
+              label: '出库数量',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'outUnitPrice',
+              label: '出库单价',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'outPrice',
+              label: '出库成本小计',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'totalQuantity',
+              label: '结存数量',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'totalUnitPrice',
+              label: '结存单位成本',
+              align: 'center',
+              showOverflowTooltip: true
+            },
+            {
+              prop: 'totalPrice',
+              label: '结存成本',
+              align: 'center',
+              showOverflowTooltip: true
+            }
+          ];
+        }
       },
       clientEnvironmentId() {
         return this.$store.state.user.info.clientEnvironmentId;
@@ -318,6 +471,9 @@
         return code?.dictValue;
       },
       handleBizType(code, type) {
+        console.log(this.sceneState);
+        console.log(code, type);
+
         if (type == 1) {
           // 入库
           for (const key in this.sceneState) {
@@ -383,15 +539,36 @@
           }
         });
       },
+
+      async getList(row) {
+        const res = await outintwoPage({
+          type: 1,
+          code: row.code,
+          name: row.name,
+          startTime: row.startTime,
+          endTime: row.endTime,
+          pageNum: 1,
+          size: -1
+        });
+
+        this.tableList = res.data;
+
+        console.log(this.tableList);
+      },
+
       async open(isView, row) {
         console.log(row);
         if (isView) {
-          this.tableList = row.info.map((item) => {
-            return {
-              ...item,
-              startTime: this.getDate(new Date(Number(item.startTime)))
-            };
-          });
+          await this.getList(row);
+
+          // this.tableList = row.info.map((item) => {
+          //   return {
+          //     ...item,
+          //     startTime: this.getDate(new Date(Number(item.startTime)))
+          //   };
+          // });
+          console.log(this.tableList);
+
           this.formData.code = row.code;
           this.formData.name = row.name;
           this.formData.status = 2;