Просмотр исходного кода

Merge branch 'dev' into dev-mlchen-eom-index

mlchen 2 недель назад
Родитель
Сommit
4c177ff1a5

+ 6 - 0
AGENTS.md

@@ -10,6 +10,7 @@
 - 客户银行和联系人信息的编辑弹窗、详情抽屉使用 Vue 2,`data` 中的列定义使用普通字段名(如 `bankColumnsDef`、`linkColumnsDef`),不能用 `_`、`$` 开头的字段再通过 `this` 读取:Vue 2 不代理这些字段,会使计算列为 `undefined`,即使添加方法已增加数据,表格也没有输入列。回归需用真实 Vue 实例验证新增后的渲染,不能只直接调用方法检查数组长度。详情抽屉银行户名来自 `base.name`,保存后重新读取详情版本;已指派客户的保存限制沿用服务端规则。
 - 2026-10-21 本地页面回归:客户 `KH20261021001` 的编辑弹窗、详情抽屉两个银行信息入口均完成“添加→输入→删除”验证,输入框数量均为 `4→8→4`,新增户名正确带出客户名称;未提交保存,此证据仅覆盖页面交互,不代表保存接口回归通过。
 - 2026-10-21 本地页面回归:客户 `KH20261021001` 的详情抽屉联系人信息完成“添加→输入→删除”验证;未提交保存,此证据仅覆盖页面交互,不代表保存接口回归通过。
+<<<<<<< HEAD
 
 - 2026-11-02 企业运营看板首页下钻契约:首页 4 处下钻入口(KPI「下钻 →」、分析汇总逐项、营收结构扇区/图例、预警「预警明细」弹窗内的「查看业务单据」)统一用 `this.$router.push({ path: 菜单path, query })` 跳**已有菜单页**,不新建明细页/明细接口。query 键固定为 `drill=1`、`drillScope`、`drillStart`/`drillEnd`(`yyyy-MM-dd`)、`drillStatus`(`INVOICED`/`APPROVED`)、`drillTip`;发射侧必须先用 `this.$router.resolve(path).route.matched` 判断可见性(vue-router 3 的 `resolve()` 没有顶层 `matched`),无权限只 warning 不跳转,并做 600ms 防重复。
 - 2026-11-02 下钻消费侧规则:目标列表页在 `created()` 里 `drill !== '1'` 早返回,组 `drillWhere` 通过 `:where` 让首屏只查一次,`mounted()` 用搜索组件的 `setDrillDate`/`setDrillStatus` 回填可见控件(控件 key 从 `seekList.find(item => item.value === 'createTime' | 'orderStatus')` 取,不硬编码),随后移除 `drill*` 参数。下钻值只补空键、手动筛选优先;无日期入参的列表(如发票管理 `FinInvoiceApplyPagePO`)只展示 `drillTip` + 提示,不得改成后端 SQL。
@@ -18,3 +19,8 @@
 - 2026-11-04 应收应付资金趋势(M09~M11)卡片契约:`arAp` 节点在 `months/receivable/payable/cashSafetyLine/cashLineLabel` 之外新增 `dataReason`(中文口径披露)与 `cashLineSource`(`PARAM`/`DEFAULT`,阈值来源)。双轴:左轴万元承载绿线应收、黄线应付、红虚线阈值,右轴 `name:'占比%'` 只服务第 4 条 series「应付占阈值比」= `payable/safetyLine*100`(1 位小数);`safetyLine` 为 null 或 ≤0 时**整条不画**(0 做分母会得 Infinity/NaN 并撑坏右轴刻度),`payable[i]` 为 null 时该点保持 null 断线而不是落 0%;右轴**不设 max**,写死 100 会把 >100% 的点静默截断。tooltip 必须自定义 formatter(金额「x.x 万元」、占比「xx.x%」、null「无数据」),echarts 默认格式会丢单位并把 null 显示成 `-`。口径说明用独立的 `arReasonOpen`(与第一张卡的 `reasonOpen` 分开,否则点一张卡会把另一张一起展开)。排查日志统一前缀 `[eos-trend]`:`watch arAp`(immediate)打印月份数/两序列长度与空值数/阈值/来源,无数据时按「缺节点 / months 为空 / 两序列全空」三档 `warn`。
 
 
+=======
+- 报价单(`saleManage/quotation`)物品清单不展示「生产要求」列:EOM 报价单产品表的请求模型(`报价单产品表新增请求`/`报价单产品表修改请求`/`报价单产品表请求结果`)没有 `productionRequirements` 字段,前端提交的值会被服务端当未知字段丢弃,详情接口也不返回——所以这一列一旦显示,用户填的内容必然“保存了却查不到”。报价单通过 `:isHideProductionRequirements="true"` 强制隐藏(`quotation/components/addDialog.vue`、`quotation/components/detailDialog.vue`)。
+- 要让报价单支持生产要求:后端先在报价单产品表加 `production_requirements` 并补齐上述三个请求/结果模型,前端再把报价单的 `:isHideProductionRequirements="true"` 换成 `:isProductionRequirements="true"` 即可恢复该列(前端提交字段名已经对得上)。注意报价单产品表同样没有 `cuttingLength`(裁线米段)、`productionCodes`(生产编号),这两个字段在报价单物品清单里也属于提交即丢弃。
+- 共享物品清单组件 `BIZComponents/inventoryTable.vue`、`inventoryTableDetails.vue` 必须声明 `isProductionRequirements` prop:Vue 2 不代理未声明的属性,漏声明会让父组件传入的值落到 `$attrs`,该列显隐退化成只由 `quoteType` 决定(报价单 type=2 生产加工反被误隐藏)。该 prop 只声明、不改变任何现有单据的显隐;「生产要求」列是否显示由 `isProductionRequirements`(显式开启)与 `isHideProductionRequirements`(强制隐藏)共同决定,新增单据接入时先确认后端明细表是否持久化该字段。
+>>>>>>> dev

+ 16 - 1
src/BIZComponents/inventoryTable.vue

@@ -1231,6 +1231,19 @@
         type: Number,
         default: 1
       },
+      // 是否显示「生产要求」列:只有后端明细表会持久化该字段的单据才需要传 true。
+      // 必须在这里声明:Vue 2 不代理未声明的属性,漏声明会让父组件传入的值落到 $attrs,
+      // 列的显隐退化成只由 quoteType 决定。仅补声明,不改变任何现有单据的显隐。
+      isProductionRequirements: {
+        type: Boolean,
+        default: false
+      },
+      // 强制隐藏「生产要求」列:用于后端明细表没有该字段、填了也会被服务端丢弃的单据(如报价单)。
+      // 与 isProductionRequirements 分开,避免改动其它单据当前的显隐行为。
+      isHideProductionRequirements: {
+        type: Boolean,
+        default: false
+      },
       isGuaranteePeriod: {
         default: true,
         type: Boolean
@@ -1694,7 +1707,9 @@
             label: '生产要求',
             align: 'center',
             slot: 'productionRequirements',
-            isNone: !this.isProductionRequirements && this.quoteType === 2
+            isNone:
+              this.isHideProductionRequirements ||
+              (!this.isProductionRequirements && this.quoteType === 2)
           },
           {
             minWidth: 280,

+ 8 - 1
src/BIZComponents/inventoryTableDetails.vue

@@ -272,6 +272,11 @@
         type: Boolean,
         default: false
       },
+      // 强制隐藏生产要求列:用于后端明细表没有该字段的单据(如报价单)
+      isHideProductionRequirements: {
+        type: Boolean,
+        default: false
+      },
       // 是否勾选
       isSelected: {
         type: Boolean,
@@ -534,7 +539,9 @@
             prop: 'productionRequirements',
             label: '生产要求',
             align: 'center',
-            isNone: !this.isProductionRequirements && this.quoteType === 2
+            isNone:
+              this.isHideProductionRequirements ||
+              (!this.isProductionRequirements && this.quoteType === 2)
           },
           {
             minWidth: 280,

+ 34 - 5
src/BIZComponents/paymentCollectionPlan/Index.vue

@@ -486,6 +486,32 @@
         // 立即更新价格,无需设置isLoadingFromApi为true
         this.refreshprice();
       },
+      // 获取比例换算金额的基准(优惠后总金额)
+      // 取值顺序:
+      // 1. 父组件通过 setDiscountAmount() 传入的 discountAmount(由合同/订单的
+      //    「优惠后总金额」驱动,是首选来源);
+      // 2. info.payAmount(销售订单/采购订单用这个字段);
+      // 3. info.discountTotalPrice(合同用这个字段);
+      // 4. info.totalAmount / info.totalPrice(只剩总金额时的最后兜底)。
+      // 逐级回退是为了防住两类坏情况:
+      // a) 来源单据不含 payAmount 时 Number(undefined)=NaN,会把计划金额写成 "NaN";
+      // b) 父组件在物品清单异步回显期间广播了 0,把基准清零,比例算出来的金额变成 0。
+      getBaseAmount() {
+        const candidates = [
+          this.discountAmount,
+          this.info && this.info.payAmount,
+          this.info && this.info.discountTotalPrice,
+          this.info && this.info.totalAmount,
+          this.info && this.info.totalPrice
+        ];
+        for (const value of candidates) {
+          const amount = Number(value);
+          if (!Number.isNaN(amount) && amount > 0) {
+            return amount;
+          }
+        }
+        return 0;
+      },
       typeChange(val, index = null) {
         // console.log(val, index, '55555');
         if (val) {
@@ -514,7 +540,10 @@
       async ratioInput(val, index = null) {
         val = Number(val);
         if (isNaN(val)) val = 0;
-        this.discountAmount = Number(this.info.payAmount);
+        // 换算基准为优惠后总金额,不能直接取 info.payAmount:
+        // 报价单/核价单/商机等来源的表单不带该字段,Number(undefined) 为 NaN
+        const discountAmount = this.getBaseAmount();
+        this.discountAmount = discountAmount;
         try {
           if (index != null) {
             // 计算含本次新输入值的累计比例
@@ -534,7 +563,7 @@
 
             // 计算当前行计划金额
             let newval = (val / 100).toFixed(2);
-            let price = formatPrice(this.discountAmount * newval);
+            let price = formatPrice(discountAmount * newval);
             this.$set(this.form.datasource[index], 'price', price);
 
             // 计算累计金额(含当前行),单位换算为元(避免浮点精度问题)
@@ -547,7 +576,7 @@
                 ) / 100;
 
             // 多期时累计金额不能超过 discountAmount,使用 0.01 容差避免精度问题
-            const discountAmt = Number(this.discountAmount);
+            const discountAmt = discountAmount;
             if (totalAmount - discountAmt > 0.01) {
               this.$message.error('总金额不能超过优惠后总金额');
               this.$set(this.form.datasource[index], 'ratio', null);
@@ -562,7 +591,7 @@
             }
           } else {
             let newval = (val / 100).toFixed(2);
-            let price = formatPrice(this.discountAmount * newval);
+            let price = formatPrice(discountAmount * newval);
             return price;
           }
         } catch (error) {
@@ -742,7 +771,7 @@
               item.typeName = '交货款';
               item.ratio = 100;
               // 比例 100% 时金额等于优惠后总金额;同步算出避免切回"是"时 price 留空
-              this.discountAmount = Number(this.info.payAmount);
+              this.discountAmount = this.getBaseAmount();
               item.price = formatPrice(this.discountAmount);
               item.key = i + 1;
               item.issueNumber = i + 1;

+ 24 - 7
src/views/contractManage/contractBook/components/addDialog.vue

@@ -1855,28 +1855,45 @@
 
         this.form = contractVO;
         this.form.HJQD = this.form.partbName;
+        // 先同步优惠后总金额,再生成收款计划,保证首期 100% 比例时金额按新总额计算
+        this.$refs.paymentCollectionPlanRef &&
+          this.$refs.paymentCollectionPlanRef.setDiscountAmount(
+            contractVO.discountTotalPrice
+          );
         this.issueNumberChange(this.form.issueNumber);
-        this.$refs.inventoryTable &&
-          this.$refs.inventoryTable.putTableValue(row);
+        // 物品清单回显是异步的,先启动回显,稍后等它结束再收口金额
+        const tableReady = this.$refs.inventoryTable
+          ? this.$refs.inventoryTable.putTableValue(row)
+          : Promise.resolve();
         // const receiptData = {
         //     receiptPaymentList: row.receiptPaymentList,
         //     payAmount: contractVO.discountTotalPrice
         //   }
         // this.$refs.paymentCollectionPlanRef &&
         //   this.$refs.paymentCollectionPlanRef.putTableValue(receiptData);
-        this.$refs.paymentCollectionPlanRef &&
-          this.$refs.paymentCollectionPlanRef.setDiscountAmount(
-            contractVO.discountTotalPrice
-          );
         this.getEnterprise();
         await this.getLinkInfo(
           contractVO.type == '2' ? contractVO.partbId : contractVO.partaId
         );
-        if (contractVO.discountTotalPrice) {
+        // 等物品清单回显结束:回显过程中 inventoryTable 会按行数据汇总「优惠后总金额」
+        // 并广播给收款计划,行数据缺折让字段时汇总为 0,会把收款计划的换算基准清零
+        //(比例有值、计划金额却算成 0)。回显结束后按合同上的优惠后总金额重算各行折让
+        // 并同步基准,保证基准最终等于合同总额。
+        await tableReady;
+        if (this.$refs.inventoryTable && contractVO.discountTotalPrice) {
           this.$refs.inventoryTable.allPrice = contractVO.totalPrice;
           this.$refs.inventoryTable.discountInputByOrder(
             contractVO.discountTotalPrice
           );
+          this.$set(
+            this.form,
+            'discountTotalPrice',
+            contractVO.discountTotalPrice
+          );
+          this.$refs.paymentCollectionPlanRef &&
+            this.$refs.paymentCollectionPlanRef.setDiscountAmount(
+              contractVO.discountTotalPrice
+            );
         }
         this.$nextTick(() => {
           this.getrequireUser(contractVO.requireDeptId);

+ 8 - 4
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -1774,10 +1774,14 @@
         this.$refs.paymentCollectionPlanRef?.setDiscountAmount(this.form.payAmount);
       },
       //产品清单修改单价或者数量重置优惠金额
-      orderDiscountAmount(val = 0) {
-        console.log('orderDiscountAmount~~~~', val);
-        this.form.payAmount = val;
-        this.$refs.paymentCollectionPlanRef.setDiscountAmount(val);
+      orderDiscountAmount(val = 0, totalPrice = 0) {
+        console.log('orderDiscountAmount~~~~', val, totalPrice);
+        // 与销售订单的 setCountAmount 保持一致:折让后金额汇总为 0 时回退到总金额。
+        // 否则物品清单回显/新增行期间的一次 0 汇总会把付款计划的换算基准清零,
+        // 表现为「输入比例但计划付款金额算不出来」。
+        const amount = Number(val) > 0 ? Number(val) : Number(totalPrice);
+        this.form.payAmount = amount;
+        this.$refs.paymentCollectionPlanRef.setDiscountAmount(amount);
         //this.form.payAmount = undefined
       },
 

+ 5 - 1
src/views/purchasingManage/purchaseOrder/components/inventoryTableNew.vue

@@ -1491,7 +1491,11 @@
         this.form.discountTotalPrice = getAllDiscountPrice(this.form.datasource) || 0;
         this.$store.commit('concact/setDiscountAmount', this.form.discountTotalPrice);
         this.$store.commit('order/setAllcountAmount', this.allPrice);
-        this.$emit('orderDiscountAmount', this.form.discountTotalPrice);
+        this.$emit(
+          'orderDiscountAmount',
+          this.form.discountTotalPrice,
+          this.allPrice
+        );
       },
 
       goodsPriceTypeChange(row, index) {

+ 1 - 0
src/views/saleManage/quotation/components/addDialog.vue

@@ -228,6 +228,7 @@
         :isDiscount="false"
         :cacheKeyUrl="cacheKeyUrl"
         :quoteType="form.type"
+        :isHideProductionRequirements="true"
       ></inventoryTable>
 
       <!-- <el-row style="margin-top: 20px">

+ 1 - 0
src/views/saleManage/quotation/components/detailDialog.vue

@@ -154,6 +154,7 @@
           :isDiscount="false"
           :cacheKeyUrl="cacheKeyUrl"
           :quoteType="detailData.type"
+          :isHideProductionRequirements="true"
         ></inventoryTabledetail>
       </el-form>
     </div>

+ 7 - 0
src/views/saleManage/quotation/index.vue

@@ -535,6 +535,13 @@ export default {
       //获取详情
       const data = await getDetail(row.id);
       const contact = await contactDetail(data.contactId);
+      // 与合同台账「选择报价单」入口保持一致:物品行必须带上折让字段。
+      // 缺少折让字段时,物品清单回显后按行汇总出的「优惠后总金额」是 0,
+      // 并把这个 0 广播给收款计划,导致收款计划里输入比例算不出计划金额。
+      (data.quoteProductList || []).forEach((item) => {
+        this.$set(item, 'discountTotalPrice', Number(item.totalPrice));
+        this.$set(item, 'discountSinglePrice', Number(item.singlePrice));
+      });
       let obj = {
         contractVO: {
           categoryId: '',

+ 23 - 2
src/views/saleManage/saleOrder/invoice/index.vue

@@ -114,11 +114,18 @@
                 apiUrl="/eom/saleordersendrecord/export"
                 :params="exportParams"
               ></exportButton>
+              <!-- exportType 契约:同一明细导出接口 /eom/saleordersendrecord/exportDetail 靠该入参区分,1=拆分单明细(缺省),2=总单明细 -->
               <exportButton
-                btnName="明细导出"
+                btnName="拆分单明细"
                 fileName="明细导出"
                 apiUrl="/eom/saleordersendrecord/exportDetail"
-                :params="exportParams"
+                :params="splitDetailExportParams"
+              ></exportButton>
+              <exportButton
+                btnName="总单明细导出"
+                fileName="总单明细导出"
+                apiUrl="/eom/saleordersendrecord/exportDetail"
+                :params="totalDetailExportParams"
               ></exportButton>
             </template>
 
@@ -609,6 +616,20 @@
           ...temp,
           sendRecordIds: this.selection.map(item => item.id)
         }
+      },
+      // 拆分单明细导出:沿用原明细导出口径,显式传 exportType: 1
+      splitDetailExportParams() {
+        return {
+          ...this.exportParams,
+          exportType: 1
+        }
+      },
+      // 总单明细导出:与拆分单明细同一接口,靠 exportType: 2 取总单明细
+      totalDetailExportParams() {
+        return {
+          ...this.exportParams,
+          exportType: 2
+        }
       }
     },
     created() {

+ 1 - 1
vue.config.js

@@ -2,7 +2,7 @@
  * @Author: mlchen 374826075@qq.com
  * @Date: 2026-07-22 15:43:30
  * @LastEditors: mlchen 374826075@qq.com
- * @LastEditTime: 2026-11-02 10:47:20
+ * @LastEditTime: 2026-11-05 10:43:30
  * @FilePath: /kd-aiot-frontend-eom/vue.config.js
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  */