소스 검색

feat:销售订单,采购订单,发货单新建增加库存台账查询,每页条数缓存

liujt 1 주 전
부모
커밋
7ae3f822ce

+ 5 - 1
src/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue

@@ -76,7 +76,7 @@
     </el-card>
 
     <div slot="footer">
-      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button v-if="!isView" type="primary" size="small" @click="selected">选择</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
     </div>
   </ele-modal>
@@ -115,6 +115,10 @@
       cacheKeyUrl: {
         type: String,
         default: 'eom-sales-selectStockLedgerDialog-202605131603'
+      },
+      isView: {
+        type: Boolean,
+        default: false
       }
     },
 

+ 38 - 2
src/mixins/tableColumnsMixin.js

@@ -7,10 +7,15 @@ export default {
       newColumns: [],
       tabMixinsInit: true, //进入页面是否默认请求列配置
       // 列宽映射(prop/columnKey -> 宽度),用于 computed columns 应用拖拽/缓存后的宽度
-      columnWidthMap: {}
+      columnWidthMap: {},
+      // 每页条数(页面可在自身 data 覆盖默认值)
+      pageSize: 10
     };
   },
   created() {
+    // 同步读取本地保存的每页条数,保证 ele-pro-table 首次加载即用正确值
+    this.initPageSize();
+
     //从服务器获取缓存列表配置
     if (this.tabMixinsInit) {
       this.getTabColumns();
@@ -71,6 +76,11 @@ export default {
     // 获取table-column配置
     async getTabColumns() {
       const res = await this.getByTableId(this.cacheKeyUrl);
+      // 从服务端配置恢复每页条数(优先服务端,同步本地缓存)
+      if (res?.pageSize) {
+        this.pageSize = res.pageSize;
+        this.setStorage(this.cacheKeyUrl + 'PageSize', res.pageSize);
+      }
       if (res?.columnConfig?.length > 0) {
         //对比接口返回和本地columns
         let { nlist, type } = this.columnsContrast(res.columnConfig);
@@ -94,6 +104,31 @@ export default {
         return this.columns;
       }
     },
+    // 同步读取本地保存的每页条数(localStorage),用于首次加载
+    initPageSize() {
+      const local = this.getStorage(this.cacheKeyUrl + 'PageSize');
+      if (local) {
+        this.pageSize = local;
+      }
+    },
+    // 每页条数变化处理:在 datasource({ limit }) 中调用,变化时保存
+    handlePageSize(limit) {
+      if (limit && limit !== this.pageSize) {
+        this.pageSize = limit;
+        this.savePageSize(limit);
+      }
+    },
+    // 保存每页条数到 localStorage + 服务端 table-config(同时带上当前列配置)
+    savePageSize(size) {
+      this.setStorage(this.cacheKeyUrl + 'PageSize', size);
+      // 服务端持久化:tableId + pageSize + columnConfig 三参数齐全
+      const columnConfig = this.getStorage(this.cacheKeyUrl + 'Cols') || [];
+      this.saveTableConfig({
+        tableId: this.cacheKeyUrl,
+        pageSize: size,
+        columnConfig
+      });
+    },
     // 根据 prop / columnKey / label 查找本地列(支持 children 递归)
     findColumnByKey(key, label) {
       let result = null;
@@ -247,10 +282,11 @@ export default {
       return { nlist: [...updated, ...added], type: updateType };
     },
 
-    // 提交columns配置
+    // 提交columns配置(tableId + pageSize + columnConfig 三参数齐全)
     async saveColumns(e) {
       const data = {
         tableId: this.cacheKeyUrl,
+        pageSize: this.pageSize,
         columnConfig: e
       };
       const msg = await this.saveTableConfig(data);

+ 14 - 1
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -506,6 +506,12 @@
         title="物品清单"
         style="margin-top: 30px"
       >
+        <el-button
+          type="primary"
+          size="mini"
+          style="margin-bottom: 5px"
+          @click="stockShow"
+          >库存台账</el-button>
         <el-button
           type="primary"
           size="mini"
@@ -623,6 +629,8 @@
       <el-button @click="cancel">返回</el-button>
     </div>
 
+    <selectStockLedgerDialog ref="selectStockLedgerDialogRef" :isSupplier="true" :isView="true" :cacheKeyUrl="cacheKeyUrl+'saleOrderss'"></selectStockLedgerDialog>
+
     <parentList
       ref="parentRef"
       @changeParent="changeParent"
@@ -800,6 +808,7 @@
   import { formatPrice } from '@/BIZComponents/setProduct.js';
   import { parameterGetByCode } from '@/api/main/index.js';
   import orderListDialog from '@/views/purchasingManage/purchaseOrder/invoice/components/orderListDialog.vue';
+  import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
 
   export default {
     mixins: [dictMixins],
@@ -829,7 +838,8 @@
       returnOrderDealDialog,
       purchaseReturnOrderDialog,
       PaymentCollectionPlan,
-      orderListDialog
+      orderListDialog,
+      selectStockLedgerDialog
     },
     data() {
       let formDef = {
@@ -1071,6 +1081,9 @@
       });
     },
     methods: {
+      stockShow() {
+        this.$refs.selectStockLedgerDialogRef.open('', -1);
+      },
       orderListShow() {
         if (!this.form.partbName) {
           this.$message.warning('请先选择供应商');

+ 15 - 4
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -539,15 +539,20 @@
         style="margin-top: 30px"
         v-if="form.needProduce != 4"
       >
+        <el-button
+          type="primary"
+          size="mini"
+          style="margin-bottom: 5px"
+          @click="stockShow"
+          >库存台账</el-button>
         <el-button
           type="primary"
           size="mini"
           style="margin-bottom: 5px"
           @click="orderListShow"
           v-if="!form.id"
-          >历史记录</el-button
-        ></headerTitle
-      >
+          >历史记录</el-button>
+      </headerTitle>
       <inventoryTable
         v-if="form.needProduce != 4"
         :isSuspend="form.isSuspend"
@@ -696,6 +701,7 @@
 
       <el-button @click="cancel">返回</el-button>
     </div>
+    <selectStockLedgerDialog ref="selectStockLedgerDialogRef" :isSupplier="true" :isView="true" :cacheKeyUrl="cacheKeyUrl+'saleOrderss'"></selectStockLedgerDialog>
     <quotationList
       ref="quotationListRef"
       @changeParent="changeQuotationList"
@@ -806,6 +812,7 @@
   import PaymentCollectionPlan from '@/BIZComponents/paymentCollectionPlan/Index.vue';
   import { shippingModeOp, transactionMethodsOp } from '@/enum/dict.js';
   import { formatPrice } from '@/BIZComponents/setProduct.js';
+  import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
   export default {
     mixins: [dictMixins],
     components: {
@@ -825,7 +832,8 @@
       saleOrderListDialog,
       opportunityDialog,
       personSelect,
-      PaymentCollectionPlan
+      PaymentCollectionPlan,
+      selectStockLedgerDialog
     },
     props: {
       contactData: {
@@ -1119,6 +1127,9 @@
       });
     },
     methods: {
+      stockShow() {
+        this.$refs.selectStockLedgerDialogRef.open('', -1);
+      },
       setIssueNumber(len) {
         this.form.issueNumber = len;
       },

+ 4 - 1
src/views/saleManage/saleOrder/index.vue

@@ -44,7 +44,7 @@
                 full-height="calc(100vh - 116px)"
                 tool-class="ele-toolbar-form"
                 :selection.sync="selection"
-                :page-size="20"
+                :page-size="pageSize"
                 @columns-change="handleColumnChange"
                 :cache-key="cacheKeyUrl"
                 show-summary
@@ -573,6 +573,7 @@ export default {
       isRequired: true,
       isTotalCount: '0',
       columnsVersion: 1,
+      pageSize: 20,
       timeR: null,
       toDoReminder: {},
       groupName: '',
@@ -1168,6 +1169,8 @@ export default {
     /* 表格数据源 */
     datasource({ page, limit, where, order }) {
       console.log('where~~~', where, limit);
+      // 捕获并持久化每页条数变化
+      this.handlePageSize(limit);
       if(where?.needProduces?.length){
         where['needProduces'] = where.needProduces.join(',');
       }

+ 20 - 2
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -175,6 +175,18 @@
         </el-col>
       </el-row>
     </el-form>
+    <headerTitle
+        title="物品清单"
+        style="margin-top: 30px"
+        v-if="form.needProduce != 4"
+      >
+        <el-button
+          type="primary"
+          size="mini"
+          style="margin-bottom: 5px"
+          @click="stockShow"
+          >库存台账</el-button>
+      </headerTitle>
     <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
       <el-tab-pane label="物品清单" name="first">
         <inventoryTable
@@ -231,6 +243,8 @@
 
       <el-button @click="cancel">返回</el-button>
     </div>
+
+    <selectStockLedgerDialog ref="selectStockLedgerDialogRef" :isSupplier="true" :isView="true" :cacheKeyUrl="cacheKeyUrl+'saleOrderss'"></selectStockLedgerDialog>
     <orderListDialog
       ref="orderListDialogRef"
       @changeParent="changeOrder"
@@ -298,7 +312,7 @@
   import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
   import returnOrderDialog from '@/views/saleManage/saleOrder/customerReturnOrder/returnOrderDialog.vue';
   import { getReturnSaleOrderrecordDetail } from '@/api/saleManage/returnGoods';
-
+  import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
   export default {
     mixins: [dictMixins],
     components: {
@@ -314,7 +328,8 @@
       entrustedReceiveDialog,
       stowageTable,
       replaceTable,
-      returnOrderDialog
+      returnOrderDialog,
+      selectStockLedgerDialog
     },
 
     //客户管理数据
@@ -447,6 +462,9 @@
     },
 
     methods: {
+      stockShow() {
+        this.$refs.selectStockLedgerDialogRef.open('', -1);
+      },
       //销售发货数量是否限制不能大于采购总数//0否 1是
       parameterGetByCode() {
         parameterGetByCode({