Compare commits

..

80 Commits

Author SHA1 Message Date
b2894lxlx 74988c0b5e Merge pull request '项目+合同对接合同系统' (#8) from feature/hcs-api-p0-web into master
Reviewed-on: #8
2026-10-27 14:47:14 +08:00
b2894lxlx 4c117d87a5 ✨ 角色数据权限配置并移除用户侧数据权限
角色权限弹窗支持按菜单批量设置数据范围;用户管理去掉组织/客商权限配置;角色别名改为角色标识。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-27 04:05:02 +08:00
b2894lxlx d6bcb12c20 Merge remote-tracking branch 'websoft/dev'
# Conflicts:
#	src/views/transportCapacity/vehicle.vue
2026-10-26 10:51:35 +08:00
b2894lxlx e1d87f5788 ✨ 结算汇率反算、开票合计填报、配载承运商交集与车辆组织悬停
外币结算按本位币/汇率反算;开票改填合计金额并反算不含税单价;配载展示承运商合同并按乙方交集限选;评分加减分封顶15分;车辆所有组织/使用部门悬停显示完整路径。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-26 10:50:58 +08:00
weicw 56b8f68449 ✨ 过程配置回单「内部人员」改为只读并按是否确认自动勾选 2026-10-25 23:10:24 +08:00
weicw 0ac17dea0b 🐛 fix(运单管理): 打卡记录里程回显按正整数归一
后端若仍下发 "200.00",编辑打卡记录时原样保存会被正整数校验拒掉。
2026-10-25 21:57:33 +08:00
weicw 39e3115fbe 🔀 合并「所属组织不是小程序注册与司机建档门槛」 2026-10-25 20:24:41 +08:00
weicw 9c0f7cb3f4 📝 所属组织可为空的注释改为事实句 2026-10-25 20:21:16 +08:00
weicw 7b478bdbf2 📝 修正未分配组织筛选的注释与接入步骤 2026-10-25 20:21:16 +08:00
weicw 87d6ff97a3 🔀 合并票 06 前端未分配组织筛选 2026-10-25 19:50:08 +08:00
weicw e3bd44e8fc 🔀 合并票 05 前端取消所属组织必填 2026-10-25 19:49:54 +08:00
weicw 324daf9d4d ✨ 司机与车辆列表支持按未分配组织筛选 2026-10-25 19:48:08 +08:00
weicw 37ac683fb4 🐛 前端取消所属组织必填 2026-10-25 19:46:42 +08:00
weicw c402d68aea 🔥 管理端打卡照片去掉主图角标
主图角标按分组下标标在第一张上,既没有独立字段也不能切换,与司机端一致删除;v-for 不再需要下标。
2026-10-24 22:19:23 +08:00
weicw e8f6311477 ✨ 编辑打卡记录支持里程采集与结算后冻结 2026-10-24 21:29:21 +08:00
b2894lxlx fa78a68df6 🐛 过程配置项目下拉兼容变更已通过状态
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-24 14:56:10 +08:00
b2894lxlx 320422856c 🔀 合并 websoft/dev,统一待回单确认与公路配载校验
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-24 14:55:04 +08:00
weicw-dshsa 0add4c5cdc ♻️ 派单候选司机不再按承运商组织过滤
- 新增 fetchDriverCandidates:按租户与岗位取司机,不再解析承运商联系人组织
- driverOptionText 只做展示(姓名+手机尾号后四位),写回表单的仍是姓名
- 删除 fetchDriversByCarrierOrganizations 与无调用者的 clearCarrierOrganizationCache
- 运单管理、总单派车、运输计划、装卸管理四页同步;去掉「请先选择承运商」前置
2026-10-23 20:03:49 +08:00
刘泉佳 f6621392b1 Merge remote-tracking branch 'origin/master' into feature/hcs-api-p0-web
# Conflicts:
#	src/views/business/contract-manage-change.vue
2026-10-23 19:20:12 +08:00
b2894lxlx 2a5eca8393 ✨ 评分减分累计与最高扣分、用户部门标签联动树,并修复对账导入与结算调整等
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 04:28:22 +08:00
刘泉佳 e4ae1d3c77 fix: 推送合规失败提示与拦截器重复弹出,合并为单条 2026-10-22 20:20:41 +08:00
刘泉佳 96783fcd7b feat: 推送合规按钮增加加载遮罩防重复操作 2026-10-22 20:08:02 +08:00
weicw-dshsa 372e8826a2 🔀 合并待回单确认功能 2026-10-22 16:51:06 +08:00
b2894lxlx 8d9fe998c0 ✨ 进行中配载可编辑、汇票选择与收款方展示优化,并支持业务部门与待确认回单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-22 15:41:01 +08:00
weicw-dshsa 92a8d4aab1 🔀 合并待回单确认审查修整 2026-10-22 14:53:04 +08:00
weicw-dshsa 59a1ca8a0d ♻️ 删除待回单确认标签色死分支并订正注释 2026-10-22 14:39:50 +08:00
刘泉佳 b9de34aa0e feat: 审批通过按钮增加防重复点击,避免重复提示 2026-10-22 14:06:50 +08:00
weicw-dshsa 5544cfb3ca 🔀 合并待回单确认禁止补录打卡入口 2026-10-22 13:48:56 +08:00
weicw-dshsa fcd5ef7df9 🔀 合并待回单确认主分支 2026-10-22 13:44:19 +08:00
weicw-dshsa 489b406214 🔀 合并待回单确认管理端动作门禁 2026-10-22 13:44:10 +08:00
weicw-dshsa 353148eb7f 🐛 待回单确认下拒绝补录打卡 2026-10-22 13:44:06 +08:00
weicw-dshsa 293b4fc6ce 🔀 合并待回单确认前端状态名称 2026-10-22 13:44:03 +08:00
weicw-dshsa 53b588063e 🐛 待回单确认运单支持管理端完成与取消 2026-10-22 13:42:43 +08:00
weicw-dshsa 0889f29c59 🐛 待回单确认补齐前端状态名称与标签色 2026-10-22 13:40:46 +08:00
weicw-dshsa f1c004813e 🔀 合并待回单确认 web 状态与确认按钮 2026-10-22 13:36:32 +08:00
weicw-dshsa d67cf55491 ✨ 运单列表支持待回单确认状态 2026-10-22 13:32:35 +08:00
b2894lxlx d7969c191a ✨ 客商档案表单重构,合同流水号-1列表显示为空
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-22 12:56:50 +08:00
刘泉佳 2f64abfc83 feat: 审核按钮统一30秒超时并加遮罩 2026-10-22 12:06:27 +08:00
b2894lxlx a657b9d0ef ✨ 小程序用户管理支持所属组织与数据权限配置
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-22 10:59:22 +08:00
刘泉佳 9558426da1 Merge remote-tracking branch 'origin/master' into feature/hcs-api-p0-web 2026-10-22 09:43:02 +08:00
weicw-dshsa 6384e80758 🐛 司机档案住址与出生年月口径对齐小程序
- 住址只读态直接显示区划名称串,不再用级联反解(改名后会退化成灰字 placeholder)
- 身份证号联动改为失焦触发,且只在出生年月/性别为空时补,不覆盖手填值
- 认证审核页标签改为「住址」「详细地址」
- 详细地址 placeholder 补明采集范围,空住址提示改为「请选择省/市/区」
2026-10-22 00:17:55 +08:00
刘泉佳 3f019c9ac5 feat: 客商档案列表风险列与表单客商名称风险提示
列表新增客商风险列(批量查询,标签按后端 riskLevelName 转义,悬浮显示风险项明细);客商档案表单名称框下高风险/黑名单红字提示(失焦/回显/OCR/金蝶回填触发,查询失败静默)
2026-10-21 17:37:48 +08:00
b2894lxlx e7c76c803f ✨ 结算单业务模式运输方式与编辑体验优化
预结算/收付款结算支持业务模式与运输方式展示导出;完善结算调整、对账导入与变更记录;组织合同初始流水号未填不再显示-1。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-21 16:42:02 +08:00
刘泉佳 90edc4b864 fix: 特批附件归口佐证材料区上传并修复类型被重置为其他文件 2026-10-21 15:48:51 +08:00
b2894lxlx 6a21b4ac8d ✨ 人员同步提示改为按工号入库并展示删除人数
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-21 15:36:34 +08:00
刘泉佳 d05f8fd636 feat: 提交审核流统一超时30秒 2026-10-21 12:08:00 +08:00
刘泉佳 d968c418a8 feat: 放宽审批通过接口超时以等待合规推送 2026-10-21 12:07:55 +08:00
刘泉佳 d100e7a271 fix: 复制合同剔除特批附件并主动查询客商风险 2026-10-21 12:07:28 +08:00
b2894lxlx 1c798046fd 🐛 修复收票付款与结算费用选择框长文本展示
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-21 11:53:56 +08:00
b2894lxlx 8d25e186b1 ⚡ 调度剩余数量按本次填写联动,公路运输司机手机号必填
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-21 11:53:56 +08:00
b2894lxlx c1863d0b6a ✨ 再次点击组织取消人员筛选
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-21 11:53:55 +08:00
b2894lxlx 4a0af452e8 ✨ 合同编号支持手工填写,组织可配置初始流水号
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-21 11:53:55 +08:00
刘泉佳 447b2d9d76 fix: 推送合规失败不再重复弹出提示 2026-10-20 22:08:57 +08:00
刘泉佳 603038d5ff fix: 合同详情展示附件类型并在变更页提示风险客商 2026-10-20 22:06:50 +08:00
刘泉佳 673c47771b :feat: 项目立项审批通过展示HCS推送失败原因并增加遮罩 2026-10-20 21:46:03 +08:00
刘泉佳 3168d365d0 :feat: 合同审批通过展示HCS推送失败原因并增加遮罩 2026-10-20 21:45:59 +08:00
gxwebsoft 5c97d3b5c5 Merge remote-tracking branch 'origin/master' 2026-10-20 19:08:26 +08:00
gxwebsoft 09ce6472b0 refactor(settlement): 全面重构结算相关页面为 avue-crud 组件
- formal-settlement.vue 中移除旧搜索区,移除多余样式,实现结算表格面板按激活标签条件渲染
- 替换 formal-settlement-table-panel.vue 为基于 avue-crud,简化表格和操作,优化分页和搜索事件处理
- 新版 formal-settlement 中统一使用 onLoad 替代 loadTable 方法,简化数据加载逻辑
- 删除不必要的样式代码,统一表格奇偶行背景颜色,调整整体样式提升视觉一致性
- 结算导入页面 settlement-import.vue 同样迁移至 avue-crud 组件实现,实现搜索、分页、刷新等功能事件解耦
- 优化分页数据结构,统一使用 currentPage 和 pageSize 命名,支持多页容量选择
- 调整部分接口调用及事件回调,保障新组件兼容已有业务流程及权限控制
- 移除废弃的内部变量与混入,针对权限控制和字段渲染进行明确封装和暴露
- 保持功能行为不变的前提下提升代码可维护性和复用性,增强组件封装与状态同步能力
2026-10-20 18:57:28 +08:00
b2894lxlx 5b435bef04 ✨ 导入运单支持未结算整批删除,结算导入运输方式取业务字典
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-20 14:43:52 +08:00
weicw-dshsa d3af455374 📝 修正配载候选运单组织范围注释 2026-10-20 11:54:49 +08:00
刘泉佳 0c4bb7cd82 :feat: 项目立项与合同列表展示金蝶ID并支持同步状态搜索
- 项目立项列表新增金蝶项目ID/金蝶项目编号列
- 合同列表新增金蝶合同ID列
- 两个列表新增是否同步金蝶、是否同步合规搜索条件
2026-10-20 11:05:26 +08:00
b2894lxlx 4c9bbf1eb7 🐛 修复预付驳回重提、预结算变更记录与收票多选结算单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-20 01:50:54 +08:00
b2894lxlx 31794bf26a 🐛 结算导入去掉模板结算金额依赖并取消编辑回算
导入后按运输费与费用项自动合计结算金额,编辑费用项时不再覆盖结算金额。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 23:28:51 +08:00
weicw-dshsa 1622015724 🔀 合并 origin/master 到 dev
# Conflicts:
#	src/views/business/components/business-crud-page.vue
2026-10-19 19:06:34 +08:00
b2894lxlx 0e57de5c71 🐛 修复收款流水继续认领预填与付款申请预结算引用提交
部分认领打开时预填历史关联结算单,可认领上限按公告未认领与收款金额取小;付款申请提交前清理误存正式结算单引用。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 17:12:24 +08:00
b2894lxlx 5cb7eb16d5 ⚡ 修复运输计划/发货模板列表缓存不刷新,并优化结算导入查看与费用弹窗
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 16:56:03 +08:00
weicw-dshsa f7d8fbf16b 🐛 配载候选列表不再按运输方式过滤并订正可配载注释 2026-10-18 15:49:38 +08:00
weicw-dshsa 847f09b14d ♻️ 运单管理公路配载改用可配载查询回查并清理自造判据 2026-10-18 14:51:33 +08:00
weicw-dshsa 2ae817ec38 ✨ 运单管理新增「确认回单」行操作
回单节点配成「需业务员确认」时,运单会一直停在进行中等人确认,此前后台没有这个入口。
在与「完成」并列的位置加一个「确认回单」行操作:只在进行中的运单上出现,沿用「完成」的
权限码(它比完成更严——后端还要校验司机打卡节点齐全且无未了结异常,故不会多开出任何权限)。
确认后不可撤销,提示里写明。
2026-10-18 12:15:07 +08:00
weicw-dshsa 6d80ffde6c ✨ 认证审核对比补充出生年月与住址字段
审核对比的字段元数据加上 birthday / addressRegion / address:司机端本次新提交
的这几项若不登记,审核页既不展示也 diff 不出改动,审核员等于在不知情下通过。
2026-10-17 12:38:17 +08:00
weicw-dshsa 44809ad303 Merge remote-tracking branch 'origin/master' into dev 2026-10-17 01:12:09 +08:00
weicw-dshsa 91cb3ee8c2 🐛 修复运输计划调度确认生成仍强制校验司机 2026-10-16 12:57:14 +08:00
weicw-dshsa b2a6d73bac 🐛 修复导入运单明细重载后实际/预计时间列为空
明细接口返回运单实体字段 startDate/endDate/estimatedStartTime/estimatedEndTime,
明细表与编辑回填按导入列字段名 actualStartDate 等读取,重载后统一在 normalizeDetailRow 对齐。
2026-10-16 12:10:47 +08:00
刘泉佳 fb91768585 :fix: 客商审核通过后推送金蝶失败原因以警告提示展示 2026-10-15 21:03:30 +08:00
刘泉佳 411fdd2425 :feat: 项目立项与合同列表新增批量推送合规按钮 2026-10-15 19:42:02 +08:00
刘泉佳 7ea96bcdc0 Merge branch 'refs/heads/feature/bfi-api-rate' into feature/hcs-api-p0-web
# Conflicts:
#	src/option/business/contract-manage.js
2026-10-15 04:13:05 +08:00
刘泉佳 b7af496a43 feat: 付款申请收款方风险客商提示条与特批附件提交校验(C101-1 风险查询联动) 2026-10-14 10:03:18 +08:00
刘泉佳 9e5f53702f feat: 合同客商风险管控前端接入——风险提示条与特批说明附件类型
1. 合同表单甲乙方选择后风险提示移至基本信息备注后(橙黄提示条+红色风险客商提示文案,按设计稿),改用后端 risky 统一判定(修复原 fdRiskLevel 等级值匹配不中的问题),展示后端 riskTip 完整风险明细
2. 合同详情基本信息备注后新增风险客商提示行(按推送留痕 hcs_risk_level/hcs_black_status 判定)
3. 附件类型兜底选项增加特批说明(高风险/黑名单客商合同必传,与后端 fileType 校验对齐;正式选项需在业务字典 contract_attachment_type 配置)
2026-10-11 18:08:27 +08:00
刘泉佳 8640238cbe 🔥 移除合规对账功能 2026-10-11 16:27:09 +08:00
刘泉佳 ef1a43f947 feat: 立项与合同HCS前端接入——列表合规状态列/推送合规/合规对账弹窗、合同详情合规信息面板与特批发起、甲乙方客商风险提示、合规主数据页 2026-10-09 19:46:56 +08:00
90 changed files with 6279 additions and 18961 deletions
+31
View File
@@ -0,0 +1,31 @@
# 2026-10-20
## settlement-import 列表页工具栏对齐 receipt-settlement
- `src/views/settlement/settlement-import.vue`:
- 左侧只保留「新增」(`type="primary"`),删掉原来的 `plain` 文字「刷新」按钮(刷新统一收进右侧图标组,与 receipt-settlement / settlement-adjustment 一致)。
- 右侧接入 `<settlement-table-tools>`(`./components/settlement-table-tools.vue`,即 `table-header-tools` 包装):刷新 / 列设置 / 搜索显隐 / 表格尺寸 4 键,`@refresh="refreshTable"`。
- 表格列改为配置化,新增 `src/option/settlement/settlementImportTable.js`(`settlementImportTableColumns`),页面加 `tableColumns / visibleColumnKeys / tableSize / columnSettingOptions / visibleTableColumns`,`el-table` 加 `:size="tableSize"`。
- 列渲染标志:`link / status / enum / billType / count`(注意**不能用 `type` 作 key**,`type` 是 el-table-column 真实 prop,会把列变成 selection/index 列)。
- 新增 `displayValue()`;`settlementBillTypeLabel('')` 返回 `-`。
- 序号列改 `fixed="left"`;数据列与操作列统一 `align: 'center'`,操作链接 `justify-content: center`。
- 校验方式(无 dev server 时):项目根目录临时 `sfc-check.mjs` 用 `vue/compiler-sfc` 的 `parse + compileTemplate + compileScript`;SCSS 用 `sass.compileString`。用完即删。
## 追加:用户要求「列显隐 + 显示方式」→ 两个页面改 avue-crud
用户反馈上面那版不对:右侧工具按钮必须是 **avue-crud 原生**的 4 键,第 2 键是「列显隐」抽屉(不是「列设置」勾选弹窗),第 4 键是「显示方式」(表格↔卡片),不是表格尺寸循环。确认后范围:`settlement-import` + `formal-settlement`(receipt/payment 共用)都改 avue-crud。
- 关键结论:**「列显隐 + 显示方式」只有 avue-crud 原生才有**,avue 的 `dialog-column` 依赖 `inject: ['crud']`,脱离 avue-crud 拿不出来;`table-header-tools` 只是仿制件,做不到。所以目标页只能整页改 avue-crud。
- avue 右侧按钮源码:`node_modules/@smallwei/avue/lib/packages/element-plus/crud/menu/header-menu3.js`(refreshBtn/columnBtn/searchBtn/gridBtn,`gridBtn` → `handleGridShow()` 切 `gridShow` 表格↔卡片);图标默认配置在同目录 `config.js`。
- 新增 `src/option/settlement/settlementImport.js`(`settlementImportOption`)、`src/option/settlement/formalSettlement.js`(`formalSettlementOption`,表格列复用 `formalSettlementTable.js` 的 `formalSettlementTableColumns` + `COLUMN_EXTRA` 增量配置,避免两处维护)。
- `settlement-import.vue` 整页改 avue-crud(删除手写的搜索区/表格/分页);`formal-settlement-table-panel.vue` 由 el-table 改成包一层 `<avue-crud>`,父页面保留数据加载与全部业务动作。
- ⚠️ **avue 的搜索自定义控件要用 `column.renderSearch`(`h()` 渲染),不能用 `searchslot`** —— avue 3.9.2 根本不读 `searchslot`(全库无此字段),而 `searchslot: true` 还会被 `header-search2.js` 的 `searchXxx → xxx` 映射成 `slot: true`。真正的搜索插槽是 avue-crud 上 `${prop}-search`(`crud.searchSlot`,见 `index2.js` `getSlotList(["-search"])`),但其作用域**没有 `row`**(只有 value/column/label/size/readonly/disabled/dic),`mileage-record.vue` 用 `{ row }` 是错的。已用于批次号下拉(filterable + allowCreate)。
- avue `formatter` 签名确认:`detail.js` → `column.formatter(row, row[column.prop], result, column)`。
- `on-load` 由 `table-page2.js` 在 created / 翻页 / 改页容量时触发,参数是内部 `defaultPage`(已 `Object.assign` 合并外部 page)。
- 分页透传写法(父持 page、子包 avue-crud):子组件用 computed `crudPage{get/set}`,setter 里 `Object.assign(this.page, value)` 原地回写,避免 prop 直接赋值告警。
- ⚠️ `src/option/settlement/formalSettlementTable.js` **不能删** —— `formal-settlement-editor.vue` 还从它导入 `candidateColumns/candidateDetailColumns/detailColumns/sourceColumns/summaryColumns`(我一度删掉,Vite 转换报错后从 HEAD 恢复)。
- 校验方式升级:沙箱里 curl 不通 dev server(502),改用 `vite.createServer({ middlewareMode:true })` + `server.transformRequest(path)` 就地转换,能同时暴露依赖解析失败(如上面误删文件)。脚本用完即删。
## 遗留未改(仍用 table-header-tools 仿制件)
pre-settlement、settlement-adjustment、receivable-payable-detail、transport-reconciliation-table-panel、business/{master-order,loading-manage,voucher-manage}、payment/* 手写页。若用户要全站一致,需逐页改 avue-crud。
+12
View File
@@ -69,6 +69,18 @@
- 自检:`curl "localhost:2888/src/xxx.vue"` 与 `"...?vue&type=style&index=0&scoped=true&lang.scss"`(200 / 500)。`vite build` 在 `facelogin.vue` 被沙箱中断,不能作唯一校验。dev `VITE_APP_API=/api` 代理 `172.16.203.228:8000`。
- 导出:前端 `exportColumns` 后端未用,以 `XxxExportExcel.java` 为准;BladeX `BeanUtil` 类型不兼容静默跳过(`Date` → `LocalDateTime` 丢值,用 `DateUtil.fromDate`)。
## avue-crud 才是「右侧 4 键」的唯一来源(2026-10-20 定论)
用户要的右侧工具栏是 **avue-crud 原生**:刷新 / **列显隐**(el-drawer,含 隐藏/冻结/过滤/排序 + 行拖拽)/ 搜索显隐 / **显示方式**(表格↔卡片)。
- 源码:`node_modules/@smallwei/avue/lib/packages/element-plus/crud/menu/header-menu3.js`(refreshBtn/columnBtn/searchBtn/gridBtn),`gridBtn` → `handleGridShow()` 切 `gridShow`;图标默认在同目录 `config.js`。「列显隐」文案来自 avue 语言包 `crud.showTitle`(项目 `src/lang/zh.js` 已覆盖)。
- **列显隐抽屉依赖 `inject: ['crud']`,脱离 avue-crud 拿不出来**;`components/table-header-tools` 的「列设置勾选弹窗 + 表格尺寸循环」是仿制件,**做不到这两点**。所以「要和 avue 一致」= 整页改用 avue-crud,没有中间方案。
- ⚠️ 搜索自定义控件用 `column.renderSearch = scope => h(...)`(`scope.row` 可用,同 `mixins/organization-search.js`)。**不要用 `searchslot`**:avue 3.9.2 全库无此字段,且 `header-search2.js` 的 `searchXxx → xxx` 映射会把 `searchslot` 变成 `slot: true`。
- avue-crud 上的 `${prop}-search` 插槽确实存在(`index2.js` 的 `getSlotList(["-search"])`),但**作用域没有 `row`**(只有 value/column/label/size/readonly/disabled/dic)——`mileage-record.vue` 里 `{ row }` 是错的写法,别照抄。
- `formatter` 签名:`detail.js` → `column.formatter(row, row[column.prop], result, column)`。
- `on-load` 由 `table-page2.js` 在 created / 翻页 / 改页容量时触发,参数是内部 `defaultPage`(已合并外部 page)。分页若由父组件持有、子组件包一层 avue-crud,用 computed `crudPage{get/set}` + setter 里 `Object.assign(this.page, value)` 原地回写。
- 已改:settlement-import.vue、formal-settlement.vue + components/formal-settlement-table-panel.vue(receipt/payment 共用)。未改:pre-settlement、settlement-adjustment、receivable-payable-detail、transport-reconciliation-table-panel、business 与 payment 的手写页。
- ⚠️ `src/option/settlement/formalSettlementTable.js` 别删:`formal-settlement-editor.vue` 还依赖它的 candidate/detail/source/summary 列。
- 沙箱里 curl 打不通本地 dev server(一律 502)。改用 `vite.createServer({middlewareMode:true})` + `server.transformRequest(path)` 就地转换校验,还能暴露依赖解析失败。
## Element Plus 图标两种用法的机制差异(易误判)
`main.js` 里 `for (...ElementPlusIconsVue) app.component(key, component)` 全局注册了全部图标,因此模板里可以写标签形式 `<Location />`(靠全局注册解析)。
但 `:icon="OfficeBuilding"` 是**表达式**,编译成 `_ctx.OfficeBuilding`,只会从 data / props / computed / setup 返回值里取 —— **组件对象必须放进 `data()`**;放进 `components: {}` 注册里模板取不到,会静默渲染不出图标(不报错,只是空白)。
+2
View File
@@ -36,6 +36,8 @@ export const approve = id =>
url: `${baseUrl}/approve`,
method: 'post',
params: { id },
// 审批通过后同步推送合规(附件转传可达 20s+),覆盖全局 10s 超时
timeout: 120000,
});
export const reject = id =>
+96
View File
@@ -0,0 +1,96 @@
import request from '@/axios';
const baseUrl = '/blade-transport/hcs';
// 合规推送涉及 HCS 远程多次调用(风险校验+附件转传+起草),可达 20s+,覆盖全局 10s 超时
export const repush = (bizType, id) =>
request({
url: `${baseUrl}/sync/${bizType}/${id}`,
method: 'post',
timeout: 60000,
});
// 批量推送为逐条同步推送,耗时随勾选行数线性增长,进一步放宽超时
export const repushBatch = (bizType, ids) =>
request({
url: `${baseUrl}/sync/${bizType}/batch`,
method: 'post',
data: ids,
timeout: 300000,
});
export const getTemplates = () =>
request({
url: `${baseUrl}/master-data/template`,
method: 'get',
});
export const refreshMasterData = () =>
request({
url: `${baseUrl}/master-data/refresh`,
method: 'post',
timeout: 60000,
});
export const getRisk = customerCode =>
request({
url: `${baseUrl}/risk`,
method: 'get',
params: { customerCode },
timeout: 30000,
});
// 客商风险批量查询(客商列表页展示用):入参编号数组,后端逐个查 C101-1,单个失败跳过
export const getRiskBatch = customerCodes =>
request({
url: `${baseUrl}/risk/batch`,
method: 'get',
params: { customerCodes: (customerCodes || []).join(',') },
timeout: 60000,
});
// 客商风险按名称查询(客商档案表单展示用):名称反查编号后口径同编号查询
export const getRiskByName = customerName =>
request({
url: `${baseUrl}/risk/by-name`,
method: 'get',
params: { customerName },
timeout: 30000,
});
export const uploadAttachment = formData =>
request({
url: `${baseUrl}/attachment/upload`,
method: 'post',
data: formData,
timeout: 60000,
});
export const downloadAttachment = (fdId, name) =>
request({
url: `${baseUrl}/attachment/download`,
method: 'get',
params: { fdId, name },
responseType: 'blob',
timeout: 120000,
});
export const applyContractSpec = data =>
request({
url: `${baseUrl}/contract/spec-apply`,
method: 'post',
data,
timeout: 60000,
});
export const confirmContractSpec = (id, result) =>
request({
url: `${baseUrl}/contract/spec/confirm`,
method: 'post',
params: { id, result },
});
export const unwrapData = response => {
const data = response?.data?.data ?? response?.data;
return data && typeof data === 'object' && 'data' in data ? data.data : data;
};
+7 -2
View File
@@ -24,11 +24,16 @@ export const getDetail = id =>
},
});
export const getCarrierContracts = projectIds =>
export const getCarrierContracts = (projectIds, waybillIds = []) =>
request({
url: `${baseUrl}/carrier-contracts`,
method: 'get',
params: { projectIds: (projectIds || []).join(',') },
params: {
projectIds: (projectIds || []).join(','),
...(waybillIds || []).filter(Boolean).length
? { waybillIds: (waybillIds || []).filter(Boolean).join(',') }
: {},
},
});
export const saveDraft = row =>
+2
View File
@@ -43,6 +43,8 @@ export const approve = id =>
url: `${baseUrl}/approve`,
method: 'post',
params: { id },
// 审批通过后同步推送合规(远程多次调用),覆盖全局 10s 超时
timeout: 60000,
});
export const reject = id =>
+7
View File
@@ -14,6 +14,13 @@ export const cancel = api.cancel;
export const reassign = api.reassign;
export const complete = api.complete;
export const batchComplete = api.batchComplete;
/** 确认回单:回单节点配成「需业务员确认」时用;后端校验司机打卡节点齐全且无未了结异常后才置完成 */
export const confirmReturn = id =>
request({
url: `${baseUrl}/confirm-return`,
method: 'post',
params: { id },
});
export const changeRoute = data =>
request({
url: `${baseUrl}/change-route`,
+3
View File
@@ -1,6 +1,9 @@
import request from '@/axios';
import { ElLoading, ElMessage } from 'element-plus';
/** 审核按钮统一超时:审批通过后可能同步推送金蝶等耗时操作,覆盖全局 10s */
export const APPROVE_TIMEOUT = 30000;
/**
* 文件流返回
* @param url 接口地址
+4 -4
View File
@@ -6,17 +6,17 @@ export const getList = (current, size, params) =>
request({ url: `${baseUrl}/list`, method: 'get', params: { current, size, ...params } });
export const getDetail = id => request({ url: `${baseUrl}/detail`, method: 'get', params: { id } });
export const getExpiryCounts = () => request({ url: `${baseUrl}/expiry-counts`, method: 'get' });
export const getAvailableOptions = (keyword, deptId, selectedId) =>
export const getAvailableOptions = (keyword, deptId, selectedId, payerName, payeeName) =>
request({
url: `${baseUrl}/available-options`,
method: 'get',
params: { keyword, deptId, selectedId },
params: { keyword, deptId, selectedId, payerName, payeeName },
});
export const getAvailablePage = (current, size, keyword, deptId, selectedId) =>
export const getAvailablePage = (current, size, keyword, deptId, selectedId, payerName, payeeName) =>
request({
url: `${baseUrl}/available-page`,
method: 'get',
params: { current, size, keyword, deptId, selectedId },
params: { current, size, keyword, deptId, selectedId, payerName, payeeName },
});
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
+3 -1
View File
@@ -1,4 +1,5 @@
import request from '@/axios';
import { APPROVE_TIMEOUT } from '@/api/common';
const baseUrl = '/blade-transport/invoice-application';
@@ -18,7 +19,8 @@ export const getReceiverInformation = settlementIds =>
export const save = data => request({ url: `${baseUrl}/save`, method: 'post', data });
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const approve = data =>
request({ url: `${baseUrl}/approve`, method: 'post', data, timeout: APPROVE_TIMEOUT });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
export const syncKingdee = id =>
+3 -1
View File
@@ -1,4 +1,5 @@
import request from '@/axios';
import { APPROVE_TIMEOUT } from '@/api/common';
const baseUrl = '/blade-transport/invoice-receipt';
@@ -31,7 +32,8 @@ export const getReferenceInformation = settlementIds =>
export const save = data => request({ url: `${baseUrl}/save`, method: 'post', data });
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const approve = data =>
request({ url: `${baseUrl}/approve`, method: 'post', data, timeout: APPROVE_TIMEOUT });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
export const pushKingdee = ids =>
+3 -1
View File
@@ -1,4 +1,5 @@
import request from '@/axios';
import { APPROVE_TIMEOUT } from '@/api/common';
const baseUrl = '/blade-transport/payment-application';
export const getList = (current, size, params) =>
@@ -20,7 +21,8 @@ export const getProjectAdvanceWriteOffOptions = params =>
export const save = data => request({ url: `${baseUrl}/save`, method: 'post', data });
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const approve = data =>
request({ url: `${baseUrl}/approve`, method: 'post', data, timeout: APPROVE_TIMEOUT });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
// 同步金蝶涉及多次金蝶远程接口调用(A103-2 预检 + A103-1/A103-3 推送),单笔可达 20s+,覆盖全局 10s 超时
+3 -1
View File
@@ -1,4 +1,5 @@
import request from '@/axios';
import { APPROVE_TIMEOUT } from '@/api/common';
const baseUrl = '/blade-transport/formal-settlement';
@@ -27,7 +28,8 @@ export const getCandidateDetails = (current, size, params) =>
export const save = data => request({ url: `${baseUrl}/save`, method: 'post', data });
export const remove = id => request({ url: `${baseUrl}/remove`, method: 'post', params: { id } });
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const approve = data =>
request({ url: `${baseUrl}/approve`, method: 'post', data, timeout: APPROVE_TIMEOUT });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
// 同步金蝶涉及多次金蝶远程接口调用(A102-4 预检 + A102-2 保存),可达 20s+,覆盖全局 10s 超时
+3 -1
View File
@@ -1,4 +1,5 @@
import request from '@/axios';
import { APPROVE_TIMEOUT } from '@/api/common';
const baseUrl = '/blade-transport/pre-settlement';
@@ -42,7 +43,8 @@ export const removeDetail = (id, detailId) =>
export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post', data });
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const approve = data =>
request({ url: `${baseUrl}/approve`, method: 'post', data, timeout: APPROVE_TIMEOUT });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
+5
View File
@@ -1,5 +1,8 @@
import request from '@/axios';
/** 提交审核流(MK)统一超时:客商/项目/合同/预结算/正式结算/付款/开票/收票/汇票付款 */
export const MK_SUBMIT_TIMEOUT = 30000;
/**
* 调用 MK processSubmit 提交审核流
* @param {Object} data
@@ -15,6 +18,7 @@ export const processSubmit = data => {
url: '/blade-system/businessProcess/processSubmit',
method: 'post',
data,
timeout: MK_SUBMIT_TIMEOUT,
});
};
@@ -28,6 +32,7 @@ export const processDelete = data => {
url: '/blade-system/businessProcess/processDelete',
method: 'post',
data,
timeout: MK_SUBMIT_TIMEOUT,
});
};
+7
View File
@@ -139,3 +139,10 @@ export const getPlatformCompanySelect = () => {
method: 'get',
});
};
export const getBusinessDeptSelect = () => {
return request({
url: '/blade-system/dept/business-dept-select',
method: 'get',
});
};
+19
View File
@@ -0,0 +1,19 @@
import request from '@/axios';
export const getRoleMenuDataScopeTree = roleId => {
return request({
url: '/blade-system/role-menu-data-scope/tree',
method: 'get',
params: {
roleId,
},
});
};
export const submitRoleMenuDataScope = data => {
return request({
url: '/blade-system/role-menu-data-scope/submit',
method: 'post',
data,
});
};
+31 -10
View File
@@ -105,12 +105,27 @@ const isJsonContentType = res => {
return contentType.includes('application/json') || contentType.includes('text/json');
};
/**
* 是否为可按文本读取的 Blob / Blob-like(含跨 realm)。
* 禁止对普通业务 JSON 对象调用 .text()。
*/
const isBlobLikeData = value =>
value != null &&
typeof value === 'object' &&
typeof value.size === 'number' &&
typeof value.type === 'string' &&
typeof value.text === 'function';
/**
* 判断响应体是否已是解析好的对象(无需再解析)。
* 注意 Blob 也是 object,必须排除,否则会把待解析的文件流误判为已完成。
*/
const isPlainObject = value =>
value !== null && typeof value === 'object' && !(value instanceof Blob);
value !== null &&
typeof value === 'object' &&
!(value instanceof Blob) &&
!isBlobLikeData(value) &&
!(value instanceof ArrayBuffer);
//跨域请求,允许保存cookie
axios.defaults.withCredentials = true;
// NProgress Configuration
@@ -190,15 +205,20 @@ axios.interceptors.response.use(
// 用户就会以为系统崩了——而后端其实返回了明确的业务提示(如「未读取到数据行…」)。
// 这里按 Content-Type 判断:JSON 才解析回对象;真·文件流(Excel 等)保持原样不动。
// 兼容 Blob(浏览器 responseType='blob')与 string(非浏览器环境)两种形态。
// 仅对真正的 Blob/Blob-like 调 .text(),避免业务 JSON 已解析后出现
// 「e.data.text is not a function」。
if (isJsonContentType(res) && !isPlainObject(res.data)) {
try {
let text = '';
if (typeof res.data?.text === 'function') {
text = await res.data.text();
} else if (typeof res.data === 'string') {
text = res.data;
} else if (typeof res.data?.arrayBuffer === 'function') {
text = new TextDecoder().decode(await res.data.arrayBuffer());
const raw = res.data;
if (isBlobLikeData(raw) || (typeof Blob !== 'undefined' && raw instanceof Blob)) {
text = await raw.text();
} else if (typeof raw === 'string') {
text = raw;
} else if (raw && typeof raw.arrayBuffer === 'function') {
text = new TextDecoder().decode(await raw.arrayBuffer());
} else if (raw instanceof ArrayBuffer) {
text = new TextDecoder().decode(raw);
}
const parsed = typeof text === 'string' && text ? JSON.parse(text) : null;
if (parsed && typeof parsed === 'object') {
@@ -208,10 +228,11 @@ axios.interceptors.response.use(
// 声明是 JSON 却解析失败:保持原样,交给下游按文件处理
}
}
//获取状态信息
const status = res.data.error_code || res.data.code || res.status;
// 获取状态信息:文件流没有 code/msg,必须退回 HTTP status,禁止读 Blob 上的幽灵字段
const payload = isPlainObject(res.data) ? res.data : {};
const status = Number(payload.error_code || payload.code || res.status);
const statusWhiteList = website.statusWhiteList || [];
const message = res.data.msg || res.data.error_description || '系统错误';
const message = payload.msg || payload.error_description || '系统错误';
//如果在白名单里则自行catch逻辑处理
if (statusWhiteList.includes(status)) return Promise.reject(res);
+27 -2
View File
@@ -12,6 +12,8 @@ import { h } from 'vue';
* 1. 混入本 mixin:mixins: [organizationSearch]
* 2. option 中「所属组织」列加上 searchslot: true(prop 为 organizationName 或 deptName 均可)
* 3. 在 created / 初始化时调用 this.loadOrganizationOptions()
* 4. 需要「未分配组织」筛选项的页面在 data 里置 enableUnassignedOrgFilter: true;
* 该项只追加进搜索树 organizationSearchTreeOptions,表单级联 organizationTreeOptions 不含哨兵
*
* 说明:
* - 自动识别 organizationName / deptName 两种 prop,并挂载 column.renderSearch
@@ -26,6 +28,12 @@ import { h } from 'vue';
*/
const ORG_PROPS = ['organizationName', 'deptName'];
// 「未分配组织」筛选项的哨兵值:不是真实组织名,选中后提交给后端的就是这串字面量。
// 后端 TransportBusiConstant.UNASSIGNED_ORG_FILTER、DriverMapper.xml / TransportVehicleMapper.xml
// 的 organizationName 分支以及司机、车辆导出查询都按它改判为 organization_name = '';
// 后端换成空串会让整段组织条件不生效,筛选静默失效。前端与后端这几处必须同步修改。
const UNASSIGNED_ORG_FILTER = '__UNASSIGNED_ORG__';
export default {
data() {
return {
@@ -34,9 +42,18 @@ export default {
organizationTreeOptions: [],
organizationTreeFlatOptions: [],
organizationLoading: false,
// 组织筛选是否追加「未分配组织」一项;页面在 data 里覆盖为 true 才生效
enableUnassignedOrgFilter: false,
};
},
computed: {
// 搜索栏级联的选项:开关打开时在真实组织最前面追加「未分配组织」。
// 不能直接改 organizationTreeOptions——司机/车辆页的编辑表单也用这棵树选组织。
organizationSearchTreeOptions() {
return this.enableUnassignedOrgFilter
? [this.unassignedOrgOption(), ...this.organizationTreeOptions]
: this.organizationTreeOptions;
},
// 所属组织级联配置:checkStrictly 允许选中任意层级,不必选到末级
organizationCascaderProps() {
return {
@@ -61,7 +78,7 @@ export default {
? this.excludeExternalOrganization(source)
: source;
this.organizationTreeOptions = this.normalizeOrgTree(tree);
this.organizationTreeFlatOptions = this.flattenOrgTree(this.organizationTreeOptions);
this.organizationTreeFlatOptions = this.flattenOrgTree(this.organizationSearchTreeOptions);
const option = this.tableOption || this.option;
if (!option) return;
ORG_PROPS.forEach(prop => {
@@ -100,12 +117,20 @@ export default {
};
});
},
// 哨兵节点的 id 与 rawLabel 都取哨兵值,resolveOrgName 取到的仍是哨兵而不是某个真实组织名
unassignedOrgOption() {
return { id: UNASSIGNED_ORG_FILTER, label: '未分配组织', rawLabel: UNASSIGNED_ORG_FILTER };
},
flattenOrgTree(tree = []) {
return (tree || []).flatMap(item => [
{ id: String(item.id), label: item.label, rawLabel: item.rawLabel },
...this.flattenOrgTree(item.children || []),
]);
},
// 组织列渲染用:空串或纯空白即「未分配组织」(组织列 NOT NULL,无组织存空串)
isBlankOrganizationName(value) {
return String(value ?? '').trim() === '';
},
// 兼容两种入参:级联路径数组(取末级)或单个部门 id
findOrgById(id) {
const value = Array.isArray(id) ? id.at(-1) : id;
@@ -155,7 +180,7 @@ export default {
// 级联单选:modelValue 必须是 id 路径数组,否则控件内部状态会错乱导致无法再次选中
if (scope.row) scope.row[prop] = Array.isArray(value) ? value : [];
},
options: this.organizationTreeOptions,
options: this.organizationSearchTreeOptions,
props: {
label: 'label',
value: 'id',
+13 -1
View File
@@ -1,4 +1,4 @@
export const transportTypeOptions = [
export const transportTypeOptions = [
{ label: '公路运输', value: '公路运输' },
{ label: '铁路运输', value: '铁路运输' },
{ label: '水路运输', value: '水路运输' },
@@ -42,6 +42,7 @@ export const waybillStatusOptions = [
{ label: '草稿', value: 'draft' },
{ label: '待执行', value: 'pending' },
{ label: '进行中', value: 'running' },
{ label: '待回单确认', value: 'pending_return_confirm' },
{ label: '已完成', value: 'completed' },
{ label: '已取消', value: 'cancelled' },
];
@@ -143,6 +144,17 @@ export const contractArchiveStatusOptions = [
{ label: '已归档', value: '已归档' },
];
export const hcsSyncStatusOptions = [
{ label: '待推送', value: 'unsynced' },
{ label: '已推送', value: 'synced' },
{ label: '推送失败', value: 'failed' },
];
export const yesNoOptions = [
{ label: '是', value: true },
{ label: '否', value: false },
];
export const nodeOptions = [
{ label: '接单', value: '接单' },
{ label: '到场', value: '到场' },
+48 -2
View File
@@ -7,9 +7,11 @@ import {
createCrudOption,
effectiveTypeOptions,
nonNegativeRule,
hcsSyncStatusOptions,
selectRule,
signTypeOptions,
textRule,
yesNoOptions,
} from './common';
const contractSettlementModeOptions = [
@@ -252,8 +254,8 @@ export const option = createCrudOption([
searchOrder: 6,
searchPlaceholder: '请输入',
order: 185,
disabled: true,
placeholder: '不填写,则系统自动生成',
maxlength: 100,
placeholder: '不填写则按部门规则自动生成',
minWidth: 200,
},
{
@@ -606,6 +608,50 @@ export const option = createCrudOption([
addDisplay: false,
editDisplay: false,
},
{
label: '合规状态',
prop: 'hcsSyncStatus',
type: 'select',
search: true,
searchOrder: 6,
searchPlaceholder: '请选择',
slot: true,
dicData: hcsSyncStatusOptions,
minWidth: 110,
addDisplay: false,
editDisplay: false,
},
{
label: '金蝶合同ID',
prop: 'kingdeeId',
minWidth: 130,
addDisplay: false,
editDisplay: false,
},
{
label: '是否同步金蝶',
prop: 'kingdeeSynced',
type: 'select',
search: true,
searchPlaceholder: '请选择',
searchOrder: 7,
dicData: yesNoOptions,
hide: true,
addDisplay: false,
editDisplay: false,
},
{
label: '是否同步合规',
prop: 'hcsSynced',
type: 'select',
search: true,
searchPlaceholder: '请选择',
searchOrder: 8,
dicData: yesNoOptions,
hide: true,
addDisplay: false,
editDisplay: false,
},
{
label: '当前节点',
prop: 'currentNode',
+53
View File
@@ -3,6 +3,7 @@ import {
businessModeOptions,
businessTypeOptions,
createCrudOption,
hcsSyncStatusOptions,
nonNegativeRule,
projectApprovalStatusOptions,
projectSourceOptions,
@@ -10,6 +11,7 @@ import {
selectRule,
settlementModeOptions,
textRule,
yesNoOptions,
} from './common';
const projectEffectiveTypeOptions = [
@@ -406,6 +408,57 @@ export const option = createCrudOption([
addDisplay: false,
editDisplay: false,
},
{
label: '合规状态',
prop: 'hcsSyncStatus',
type: 'select',
search: true,
searchPlaceholder: '请选择',
searchOrder: 1,
slot: true,
dicData: hcsSyncStatusOptions,
minWidth: 110,
addDisplay: false,
editDisplay: false,
},
{
label: '金蝶项目ID',
prop: 'kingdeeId',
minWidth: 130,
addDisplay: false,
editDisplay: false,
},
{
label: '金蝶项目编号',
prop: 'kingdeeNumber',
minWidth: 130,
addDisplay: false,
editDisplay: false,
},
{
label: '是否同步金蝶',
prop: 'kingdeeSynced',
type: 'select',
search: true,
searchPlaceholder: '请选择',
searchOrder: 2,
dicData: yesNoOptions,
hide: true,
addDisplay: false,
editDisplay: false,
},
{
label: '是否同步合规',
prop: 'hcsSynced',
type: 'select',
search: true,
searchPlaceholder: '请选择',
searchOrder: 3,
dicData: yesNoOptions,
hide: true,
addDisplay: false,
editDisplay: false,
},
{
label: '生效类型',
prop: 'effectiveType',
+4 -2
View File
@@ -471,7 +471,7 @@ export const config = {
endDateRange: ['endDateStart', 'endDateEnd'],
createTimeRange: ['createTimeStart', 'createTimeEnd'],
},
actions: ['copy', 'cancel', 'reassign', 'complete', 'batchComplete'],
actions: ['copy', 'cancel', 'reassign', 'complete', 'batchComplete', 'confirmReturn'],
detailButton: true,
statusProp: 'businessStatus',
statusTextProp: 'businessStatusName',
@@ -483,6 +483,8 @@ export const config = {
row.requireAccept === true ||
row.requireAccept === 1 ||
requiresDriverAcceptConfirmation(row);
// 待回单确认由末位打卡产生,司机必然已接单
if (status === 'pending_return_confirm') return '待回单确认';
// 需司机接单且尚未接单 → 待执行(含库中仍为 running 的历史数据展示校正)
if (needAccept && !hasDriverAcceptRecord(row) && !terminalStatuses.includes(status)) {
return '待执行';
@@ -504,7 +506,7 @@ export const config = {
return !isDriverRejectedWaybill(row);
},
canCancel(row) {
// 进行中的运单不允许取消
// 进行中的运单不允许取消;待回单确认仍可取消(与页面 canCancel 一致)
return !isInProgressStatus(row, row.businessStatusName);
},
deleteStatus: ['draft'],
+173
View File
@@ -0,0 +1,173 @@
/**
* 正式结算单列表(avue-crud)配置
* ------------------------------------------------------------------
* 列表页与其它模块统一使用 avue-crud,头部 4 个按钮(刷新 / 列显隐 / 搜索显隐 /
* 显示方式)由 avue-crud 自带,不做二次封装。
*
* 表格列复用 formalSettlementTable.js 的 formalSettlementTableColumns(与弹窗内
* 明细表共用同一份列定义),此处只补充 avue 需要的展示/搜索属性,避免两处维护。
*
* ⚠️ searchOrder 为降序排序,值越大越靠前。
* ⚠️ 仅用于搜索的列必须 hide + showColumn: false,否则会混进「列显隐」抽屉。
* ⚠️ column 数组顺序 = 表格列顺序,搜索专用列统一放在数组最前面。
*/
import {
approvalStatusOptions,
invoiceStatusOptions,
kingdeeSyncStatusOptions,
paymentStatusOptions,
} from './formalSettlementSearch';
import { formalSettlementTableColumns } from './formalSettlementTable';
const textFormatter = (row, value) =>
value === null || value === undefined || value === '' ? '-' : value;
/** 金额统一展示:两位小数 + 币种 */
const moneyFormatter = (row, value) =>
`${Number(value || 0).toFixed(2)} ${row?.currency || 'RMB'}`;
const pickLabel = (options, value) =>
options.find(item => item.value === value)?.label || value || '-';
const searchOnlyColumn = ({ label, prop, searchOrder, type = 'input', dicData }) => {
const column = {
label,
prop,
search: true,
searchOrder,
searchSpan: 5,
hide: true,
showColumn: false,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
};
if (type === 'select') {
column.type = 'select';
column.searchPlaceholder = '请选择';
column.dicData = dicData || [];
} else if (type === 'daterange') {
column.type = 'daterange';
column.searchType = 'daterange';
column.searchPlaceholder = '请选择';
} else {
column.searchPlaceholder = '请输入';
}
return column;
};
/** 表格列的 avue 增量配置:搜索项、插槽、覆盖宽度等 */
const COLUMN_EXTRA = {
formalSettlementNo: {
slot: true,
search: true,
searchSpan: 5,
searchOrder: 12,
searchPlaceholder: '请输入',
},
payerName: { search: true, searchSpan: 5, searchOrder: 7, searchPlaceholder: '请输入' },
payeeName: { search: true, searchSpan: 5, searchOrder: 6, searchPlaceholder: '请输入' },
projectName: { search: true, searchSpan: 5, searchOrder: 11, searchPlaceholder: '请输入' },
deptName: { search: true, searchslot: true, searchSpan: 5, searchOrder: 10 },
contractNo: { search: true, searchSpan: 5, searchOrder: 9, searchPlaceholder: '请输入' },
invoiceStatusName: { slot: true },
paymentStatusName: { slot: true },
approvalStatusName: { slot: true },
adjustFlag: {
formatter: row => row.adjustStatusName || (row.originFormalSettlementNo ? '调整后单' : '-'),
},
kingdeeSyncStatus: {
slot: true,
search: true,
type: 'select',
dicData: kingdeeSyncStatusOptions,
searchSpan: 5,
searchOrder: 2,
searchPlaceholder: '请选择',
},
kingdeeLockStatus: { slot: true },
createTime: { width: 180 },
};
const buildTableColumns = () =>
formalSettlementTableColumns.map(column => {
const extra = { ...(COLUMN_EXTRA[column.prop] || {}) };
if (column.money) {
extra.formatter = moneyFormatter;
extra.align = 'right';
}
// link / status 标记的列统一走单元格插槽
if (column.link || column.status) extra.slot = true;
if (!extra.formatter) extra.formatter = textFormatter;
return { ...column, ...extra };
});
export const formalSettlementOption = () => ({
height: 'auto',
calcHeight: 32,
tip: false,
searchBtnText: '查询',
emptyBtnText: '重置',
searchShow: true,
searchIcon: true,
searchLabelWidth: 88,
// 查询/重置紧跟首行 4 个条件(4×5 + 菜单 4 = 24),不再独占下一整行
searchMenuSpan: 4,
searchIndex: 4,
searchMenuPosition: 'right',
border: true,
index: true,
indexLabel: '序号',
indexWidth: 64,
indexFixed: 'left',
selection: true,
selectionWidth: 52,
selectionFixed: 'left',
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false,
menuWidth: 320,
menuFixed: 'right',
column: [
// ---------- 仅搜索列 ----------
searchOnlyColumn({
label: '预付结算单号',
prop: 'preSettlementNo',
searchOrder: 8,
}),
searchOnlyColumn({
label: '发票状态',
prop: 'invoiceStatus',
searchOrder: 5,
type: 'select',
dicData: invoiceStatusOptions,
}),
searchOnlyColumn({
label: '收付款状态',
prop: 'paymentStatus',
searchOrder: 4,
type: 'select',
dicData: paymentStatusOptions,
}),
searchOnlyColumn({
label: '审核状态',
prop: 'approvalStatus',
searchOrder: 3,
type: 'select',
dicData: approvalStatusOptions,
}),
searchOnlyColumn({
label: '生成日期',
prop: 'createDateRange',
searchOrder: 1,
type: 'daterange',
}),
// ---------- 表格列(部分兼搜索项) ----------
...buildTableColumns(),
],
});
export const kingdeeSyncName = value => pickLabel(kingdeeSyncStatusOptions, value);
export const paymentStatusName = value => pickLabel(paymentStatusOptions, value);
@@ -8,6 +8,8 @@ export const formalSettlementFormFields = [
{ label: '收款方', prop: 'payeeName', readonly: true },
{ label: '结算类型', prop: 'settlementTypeName', readonly: true },
{ label: '结算金额', prop: 'settlementAmount', readonly: true, money: true },
{ label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' },
{ label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' },
{ label: '汇率日期', prop: 'exchangeRateDate', type: 'date', required: true },
{ label: '结算汇率', prop: 'exchangeRate', type: 'number', required: true },
{ label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true },
@@ -25,6 +27,8 @@ export const createFormalSettlementForm = () => ({
settlementType: '',
sourcePreSettlementIds: [],
sourceDetailIds: [],
businessModel: '',
transportType: '',
exchangeRateDate: '',
exchangeRate: 1,
createUserName: '',
@@ -8,6 +8,8 @@ export const formalSettlementTableColumns = [
{ label: '合同编号', prop: 'contractNo', minWidth: 150 },
{ label: '合同名称', prop: 'contractName', minWidth: 170 },
{ label: '原币结算金额', prop: 'settlementAmount', minWidth: 145, money: true },
{ label: '业务模式', prop: 'businessModelName', minWidth: 120 },
{ label: '运输方式', prop: 'transportTypeName', minWidth: 120 },
{ label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 155, money: true },
{ label: '结算汇率', prop: 'exchangeRate', minWidth: 110 },
{ label: '申请付款金额(含预付)', prop: 'appliedPaymentAmount', minWidth: 185, money: true },
@@ -55,7 +57,6 @@ export const detailColumns = [
{ label: '运费', prop: 'freightAmount', minWidth: 120, money: true },
{ label: '调整金额', prop: 'adjustAmount', minWidth: 120, money: true },
{ label: '结算金额(含税)', prop: 'settlementAmountTax', minWidth: 155, money: true },
{ label: '结算金额(不含税)', prop: 'settlementAmountNoTax', minWidth: 170, money: true },
{ label: '备注', prop: 'remark', minWidth: 180 },
];
@@ -12,6 +12,8 @@ export const preSettlementFormFields = [
{ label: '付款方', prop: 'payerName', readonly: true },
{ label: '结算类型', prop: 'settlementType', readonly: true },
{ label: '结算金额', prop: 'settlementAmount', readonly: true, money: true },
{ label: '业务模式', prop: 'businessModel', type: 'select', optionsKey: 'businessModelOptions' },
{ label: '运输方式', prop: 'transportType', type: 'select', optionsKey: 'transportTypeOptions' },
{ label: '汇率日期', prop: 'exchangeRateDate', type: 'date' },
{ label: '结算汇率', prop: 'exchangeRate', type: 'number', class: 'exchange-rate-input' },
{ label: '本位币合计', prop: 'localSettlementAmount', readonly: true, money: true },
@@ -64,6 +66,8 @@ export const emptyPreSettlementForm = () => ({
settlementType: 'payable',
currency: 'RMB',
settlementAmount: 0,
businessModel: '',
transportType: '',
localCurrency: 'RMB',
localSettlementAmount: 0,
exchangeRateDate: '',
@@ -8,6 +8,8 @@ export const preSettlementTableColumns = [
{ label: '合同编号', prop: 'contractNo', minWidth: 140 },
{ label: '合同名称', prop: 'contractName', minWidth: 160 },
{ label: '原币结算金额', prop: 'settlementAmount', minWidth: 140, money: true, precision: 2 },
{ label: '业务模式', prop: 'businessModelName', minWidth: 120 },
{ label: '运输方式', prop: 'transportTypeName', minWidth: 120 },
{ label: '本位币结算金额', prop: 'localSettlementAmount', minWidth: 150, money: true, precision: 2 },
{ label: '结算汇率', prop: 'exchangeRate', minWidth: 110, precision: 2 },
{
+157
View File
@@ -0,0 +1,157 @@
/**
* 导入结算单列表(avue-crud)配置
* ------------------------------------------------------------------
* 列表页与其它模块统一使用 avue-crud,头部 4 个按钮(刷新 / 列显隐 / 搜索显隐 /
* 显示方式)由 avue-crud 自带,不做二次封装。
*
* ⚠️ searchOrder 为降序排序,值越大越靠前。
* ⚠️ 仅用于搜索的列必须 hide + showColumn: false,否则会混进「列显隐」抽屉。
*/
const IMPORT_STATUS_OPTIONS = [
{ label: '草稿', value: 'draft' },
{ label: '已完成', value: 'completed' },
{ label: '已作废', value: 'voided' },
];
const SETTLEMENT_TYPE_OPTIONS = [
{ label: '应收', value: 'receivable' },
{ label: '应付', value: 'payable' },
];
const textFormatter = (row, value) =>
value === null || value === undefined || value === '' ? '-' : value;
const pickLabel = (options, value) =>
options.find(item => item.value === value)?.label || value || '-';
const settlementTypeLabel = value => pickLabel(SETTLEMENT_TYPE_OPTIONS, value);
const billTypeLabel = value => (value === 'pre' ? '预结算单' : value ? '正式结算单' : '-');
export const importStatusLabel = value => pickLabel(IMPORT_STATUS_OPTIONS, value);
export const settlementImportOption = () => ({
height: 'auto',
calcHeight: 32,
tip: false,
searchBtnText: '查询',
emptyBtnText: '重置',
searchShow: true,
searchIcon: true,
searchLabelWidth: 88,
// 查询/重置紧跟首行 4 个条件(4×5 + 菜单 4 = 24),不再独占下一整行
searchMenuSpan: 4,
searchIndex: 4,
searchMenuPosition: 'right',
border: true,
index: true,
indexLabel: '序号',
indexWidth: 64,
indexFixed: 'left',
selection: false,
addBtn: false,
viewBtn: false,
delBtn: false,
editBtn: false,
menuWidth: 220,
menuFixed: 'right',
column: [
// ---------- 搜索项(前 4 项默认展示,其余折叠;searchOrder 越大越靠前) ----------
{
label: '状态',
prop: 'importStatus',
type: 'select',
search: true,
searchSpan: 5,
searchOrder: 6,
searchPlaceholder: '请选择',
dicData: IMPORT_STATUS_OPTIONS,
hide: true,
showColumn: false,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
},
{
label: '导入类型',
prop: 'settlementType',
type: 'select',
search: true,
searchSpan: 5,
searchOrder: 5,
searchPlaceholder: '请选择',
dicData: SETTLEMENT_TYPE_OPTIONS,
hide: true,
showColumn: false,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
},
// ---------- 表格列 ----------
{
label: '导入批次号',
prop: 'batchNo',
slot: true,
search: true,
searchSpan: 5,
searchOrder: 7,
searchPlaceholder: '请选择',
minWidth: 160,
},
{ label: '状态', prop: 'importStatusName', slot: true, width: 100, align: 'center' },
{
label: '导入类型',
prop: 'settlementTypeName',
minWidth: 100,
align: 'center',
formatter: (row, value) => value || settlementTypeLabel(row.settlementType),
},
{
label: '结算单',
prop: 'settlementBillTypeName',
minWidth: 110,
align: 'center',
formatter: (row, value) => value || billTypeLabel(row.settlementBillType),
},
{
label: '项目',
prop: 'projectName',
search: true,
searchSpan: 5,
searchOrder: 4,
searchPlaceholder: '请输入',
minWidth: 140,
formatter: textFormatter,
},
{
label: '客户',
prop: 'customerName',
search: true,
searchSpan: 5,
searchOrder: 3,
searchPlaceholder: '请输入',
minWidth: 140,
formatter: textFormatter,
},
{
label: '承运商',
prop: 'carrierName',
search: true,
searchSpan: 5,
searchOrder: 2,
searchPlaceholder: '请输入',
minWidth: 140,
formatter: textFormatter,
},
{
label: '明细行数',
prop: 'detailCount',
width: 100,
align: 'center',
formatter: row => row.detailCount ?? row.waybillCount ?? 0,
},
{ label: '创建时间', prop: 'createTime', width: 180, align: 'center', formatter: textFormatter },
{ label: '创建人', prop: 'createUserName', minWidth: 110, formatter: textFormatter },
],
});
+61
View File
@@ -14,6 +14,11 @@ const validatePhone = (rule, value, callback) => {
callback(new Error('请输入手机号'));
return;
}
// 详情回显为脱敏手机号(含 *)时放行,未修改则提交时剔除该字段
if (phone.includes('*')) {
callback();
return;
}
if (!/^1\d{10}$/.test(phone)) {
callback(new Error('请输入正确的手机号'));
return;
@@ -121,6 +126,62 @@ export default {
order: 60,
rules: [{ required: true, message: '请选择小程序身份', trigger: 'change' }],
},
{
label: '所属组织',
prop: 'deptId',
formslot: true,
hide: true,
span: 24,
order: 55,
// 所属组织可为空:为空表示未分配组织,账号的数据权限为空集
},
{
label: '所属组织',
prop: 'deptName',
minWidth: 180,
overHidden: true,
addDisplay: false,
editDisplay: false,
viewDisplay: false,
order: 54,
},
{
label: '数据权限范围',
prop: 'dataScopeRange',
type: 'radio',
span: 24,
hide: true,
order: 53,
value: 1,
dicData: [
{ label: '仅所属组织', value: 1 },
{ label: '全部组织', value: 2 },
{ label: '自定义', value: 3 },
],
rules: [{ required: true, message: '请选择数据权限范围', trigger: 'change' }],
},
{
label: '数据层级范围',
prop: 'dataLevelRange',
type: 'radio',
span: 24,
hide: true,
order: 52,
value: 1,
dicData: [
{ label: '包含下级', value: 1 },
{ label: '仅本级', value: 2 },
],
rules: [{ required: true, message: '请选择数据层级范围', trigger: 'change' }],
},
{
label: '数据权限',
prop: 'dataScopeDeptIds',
formslot: true,
span: 24,
hide: true,
order: 51,
},
{
label: '性别',
prop: 'sex',
+1 -23
View File
@@ -72,6 +72,7 @@ export const userOption = safe => {
},
{ label: '岗位', prop: 'postName', overHidden: true, display: false },
{ label: '性别', prop: 'sexName', width: 80, display: false },
{ label: 'OA登录名', prop: 'oaLoginId', minWidth: 140, overHidden: true, display: false },
{ label: 'OA人员id', prop: 'oaPersonId', minWidth: 120, overHidden: true, display: false },
{ label: '备注', prop: 'remark', minWidth: 160, overHidden: true, display: false },
{
@@ -314,29 +315,6 @@ export const userOption = safe => {
{ label: '承运商', value: 2 },
],
},
{
label: '数据权限范围',
prop: 'dataScopeRange',
type: 'radio',
span: 24,
value: 1,
dicData: [
{ label: '仅所属组织', value: 1 },
{ label: '全部组织', value: 2 },
{ label: '自定义', value: 3 },
],
},
{
label: '数据层级范围',
prop: 'dataLevelRange',
type: 'radio',
span: 24,
value: 1,
dicData: [
{ label: '包含下级', value: 1 },
{ label: '仅本级', value: 2 },
],
},
{
label: '备注',
prop: 'remark',
@@ -48,6 +48,7 @@ export const option = {
searchOrder: 1,
searchslot: true,
slot: true,
overHidden: true,
minWidth: 150,
},
{
@@ -55,6 +56,8 @@ export const option = {
prop: 'useDepartment',
search: true,
searchOrder: 3,
slot: true,
overHidden: true,
minWidth: 140,
},
{
+1 -1
View File
@@ -622,7 +622,7 @@
background: #fff;
}
// 合同管理新增/编辑弹窗(business-crud-page 封装 → avue-crud,弹窗带 avue-crud__dialog class)
// 合同管理新增/编辑弹窗(avue-crud,弹窗带 avue-crud__dialog class)
// 复刻 waybill-manage 方案:接近全屏、压过库内置 .avue-dialog 的 calc(100% - 200px),
// 并解开 body 的 200px 上限、抵消全局 footer 的 -30px 上移
.contract-manage-dialog.el-dialog {
+30 -33
View File
@@ -26,6 +26,35 @@ const uniqueOrgNames = (values = []) => {
return result;
};
// 候选司机取数上限:超出后只能靠关键字缩小范围
const DRIVER_CANDIDATE_MAX_SIZE = 200;
/**
* 派单候选司机:租户内的司机档案,按岗位等条件过滤。
*
* 与组织、承运商都无关——司机档案与组织树、承运商之间没有外键,`organization_name`
* 只是自由文本,用它做匹配会让小程序自动建档的司机永远进不了候选。
*/
export const fetchDriverCandidates = async (query = {}) => {
const params = { ...query };
const size = Math.min(Math.max(Number(params.size) || 50, 50), DRIVER_CANDIDATE_MAX_SIZE);
delete params.size;
const res = await getDriverList(1, size, params);
return extractRecords(res).slice(0, size);
};
/**
* 司机候选项的展示文本:姓名(手机尾号后 4 位)。
*
* 只用于下拉渲染。写回表单的仍是姓名本身,别把带尾号的文本当值用。
*/
export const driverOptionText = (item = {}) => {
const name = normalizeOrgName(item.driverName || item.name);
const mobile = String(item.mobile || item.phone || item.driverPhone || '').trim();
if (!name) return '';
return mobile.length >= 4 ? `${name}(${mobile.slice(-4)})` : name;
};
/**
* 解析承运商客商档案上联系人的所属组织(branchName),无联系人时回退客商所属组织。
*/
@@ -72,13 +101,6 @@ export const resolveCarrierOrganizationNames = async ({ carrierId, carrierName }
return orgNames;
};
export const clearCarrierOrganizationCache = (carrier = {}) => {
const id = String(carrier.carrierId || '').trim();
const name = normalizeOrgName(carrier.carrierName);
if (id) orgNameCache.delete(id);
if (name) orgNameCache.delete(name);
};
export const matchOrganizationName = (value, orgNames = []) => {
const text = normalizeOrgName(value);
if (!text || !orgNames.length) return false;
@@ -90,34 +112,9 @@ const filterByOrganizations = (records = [], orgNames = []) => {
return records.filter(item => matchOrganizationName(item.organizationName, orgNames));
};
/**
* 按承运商联系人所属组织筛选司机。
* 未选择承运商时返回空列表(需先选承运商)。
*/
export const fetchDriversByCarrierOrganizations = async (
query = {},
{ carrierId, carrierName } = {}
) => {
if (!String(carrierId || '').trim() && !normalizeOrgName(carrierName)) {
return [];
}
const orgNames = await resolveCarrierOrganizationNames({ carrierId, carrierName });
if (!orgNames.length) return [];
const size = Math.max(Number(query.size) || 50, 50);
const params = { ...query };
delete params.size;
// 单组织时用后端模糊条件缩小范围;多组织再前端精确过滤
if (orgNames.length === 1) {
params.organizationName = orgNames[0];
}
const res = await getDriverList(1, Math.min(size * 5, 200), params);
return filterByOrganizations(extractRecords(res), orgNames).slice(0, size);
};
/**
* 按承运商联系人所属组织筛选车辆。
* 未选择承运商时返回空列表。
* 未选择承运商时返回空列表(需先选承运商)。
*/
export const fetchVehiclesByCarrierOrganizations = async (
query = {},
+3
View File
@@ -106,6 +106,9 @@ const CERT_SNAPSHOT_GROUPS = {
fields: [
{ key: 'realName', label: '真实姓名' },
{ key: 'idCardNo', label: '身份证号' },
{ key: 'birthday', label: '出生年月', type: TYPE_DATE },
{ key: 'addressRegion', label: '住址' },
{ key: 'address', label: '详细地址' },
{ key: 'idCardFrontUrl', label: '身份证正面照', type: TYPE_IMAGE },
{ key: 'idCardBackUrl', label: '身份证反面照', type: TYPE_IMAGE },
{ key: 'idCardValidStart', label: '身份证有效期起', type: TYPE_DATE },
+26 -6
View File
@@ -7,7 +7,7 @@ import 'nprogress/nprogress.css';
const excelPattern = /\.(xls|xlsx)$/;
/** 是否为浏览器 Blob(含跨 realm 的 Blob-like) */
const isBlobLike = value =>
export const isBlobLike = value =>
value != null &&
typeof value === 'object' &&
typeof value.size === 'number' &&
@@ -15,14 +15,14 @@ const isBlobLike = value =>
(typeof value.text === 'function' || typeof value.arrayBuffer === 'function');
/** axios 拦截器已把 JSON Blob 解析成的业务对象 */
const isBusinessJson = value =>
export const isBusinessJson = value =>
value != null &&
typeof value === 'object' &&
!isBlobLike(value) &&
!(value instanceof ArrayBuffer) &&
('code' in value || 'success' in value || 'msg' in value);
const isExcelResponse = res => {
export const isExcelResponse = res => {
// 已是业务 JSON(导入成功/失败提示)时,绝不能当失败明细 Excel 处理
if (isBusinessJson(res?.data)) {
return false;
@@ -54,7 +54,7 @@ const isExcelResponse = res => {
* 提前解析成普通对象;此处需同时兼容 Blob / 字符串 / 已解析对象,避免再调
* `blob.text()` 时出现「blob.text is not a function」。
*/
const parseBlobJson = async data => {
export const parseBlobJson = async data => {
if (data == null) {
return {};
}
@@ -88,7 +88,7 @@ const parseBlobJson = async data => {
*
* 这里补上这一步:从错误响应的 Blob 里取出后端 `msg`,取不到再退回通用文案。
*/
const resolveErrorMessage = async error => {
export const resolveImportErrorMessage = async error => {
const payload = error?.response?.data ?? error?.data;
if (isBusinessJson(payload) && payload.msg) {
return payload.msg;
@@ -109,6 +109,26 @@ const resolveErrorMessage = async error => {
return fallback;
};
/**
* 统一消费导入接口响应:成功 JSON / 失败 Excel 流。
* 兼容 axios 已把 JSON Blob 解析成对象的情况,禁止再对普通对象调 .text()。
*/
export const consumeImportResponse = async (res, options = {}) => {
const { businessName = '导入', dayjsFormat } = options;
if (isExcelResponse(res)) {
return {
kind: 'excel',
blob: res?.data,
fileName: `${businessName}导入失败明细${dayjsFormat || ''}.xlsx`,
};
}
const result = isBusinessJson(res?.data) ? res.data : await parseBlobJson(res?.data);
if (Number(result?.code) !== 200) {
throw new Error(result?.msg || '导入失败');
}
return { kind: 'success', result };
};
/**
* 加工后端返回的导入失败明细 Excel。
* 若传入 failDetailDecorator(函数),则动态加载 exceljs 读取 blob 流,
@@ -235,7 +255,7 @@ export const handleImportExcel = async (vm, option, column, businessName, onSucc
// 拦截器已提示过的错误(如后端 400 返回的业务提示)不再重复弹一次,
// 只保留一次清晰的中文提示。
if (!error?._notified) {
vm.$message.error(await resolveErrorMessage(error));
vm.$message.error(await resolveImportErrorMessage(error));
}
notifyUploadError(option, error);
} finally {
+18 -1
View File
@@ -3,10 +3,27 @@ export function isFreightFeeName(name) {
return text.includes('运费') || text.includes('运输费');
}
function parseBillingRules(row = {}) {
const rule = row.billingRule || {};
const nested = Array.isArray(rule.rules) ? rule.rules : [];
if (nested.length) return nested;
const raw = row.billingRulesJson ?? row.billingRules;
if (Array.isArray(raw)) return raw.filter(item => item && typeof item === 'object');
if (typeof raw === 'string' && raw.trim()) {
try {
const parsed = JSON.parse(raw);
return Array.isArray(parsed) ? parsed.filter(item => item && typeof item === 'object') : [];
} catch (error) {
return [];
}
}
return [];
}
/** 运输单价对应的运费计费类型。 */
export function freightBillingType(row = {}) {
const rule = row.billingRule || {};
const rules = Array.isArray(rule.rules) ? rule.rules : [];
const rules = parseBillingRules(row);
const freightRule = rules.find(
item => isFreightFeeName(item?.feeItem) || isFreightFeeName(item?.feeType)
);
+6
View File
@@ -0,0 +1,6 @@
/** 审批通过、驳回等审批流转类变更内容,不在结算单变更记录中展示。 */
export function isApprovalSettlementChange(content) {
const text = String(content || '').trim();
if (!text) return false;
return text.includes('审批通过') || text.includes('审批驳回') || text === '已驳回';
}
+190 -100
View File
@@ -50,7 +50,7 @@
title="角色权限配置"
append-to-body
v-model="box"
width="345px"
width="960px"
@close="handleDialogClose"
>
<el-tabs type="border-card">
@@ -100,41 +100,26 @@
align="middle"
style="margin-bottom: 12px; background: #f5f7fa; padding: 6px 10px; border-radius: 4px"
>
<span style="display: inline-flex; align-items: center">
<el-switch
v-model="dataScopeLinked"
active-text="节点联动"
size="small"
@change="handleLinkedChange('treeDataScope')"
/>
<el-tooltip content="开启后勾选父节点会自动勾选所有子节点,关闭则可独立勾选任意节点" placement="top">
<el-icon style="margin-left: 4px; color: #909399; cursor: pointer"><el-icon-question-filled /></el-icon>
</el-tooltip>
</span>
<el-button-group>
<el-button
size="small"
plain
@click="handleSelectAll('treeDataScope', dataScopeGrantList)"
>全选</el-button
>
<el-button
size="small"
plain
@click="handleInvertSelect('treeDataScope', dataScopeGrantList, dataScopeLinked)"
>反选</el-button
>
</el-button-group>
<span style="color: #606266; font-size: 13px"
>勾选多个菜单后点击「设置」,可批量配置数据权限;设置后菜单旁展示当前范围</span
>
<el-button type="primary" size="small" @click="openDataScopeSetting">设置</el-button>
</el-row>
<el-tree
:data="dataScopeGrantList"
:data="roleDataScopeMenuTree"
show-checkbox
:check-strictly="!dataScopeLinked"
node-key="id"
ref="treeDataScope"
:default-checked-keys="dataScopeTreeObj"
ref="treeRoleDataScope"
:props="props"
>
<template #default="{ data }">
<span class="role-data-scope-node">
<span>{{ data.title }}</span>
<span v-if="getMenuScopeLabel(data.id)" class="role-data-scope-tag"
>【{{ getMenuScopeLabel(data.id) }}】</span
>
</span>
</template>
</el-tree>
</el-tab-pane>
<el-tab-pane label="接口权限">
@@ -188,6 +173,45 @@
</span>
</template>
</el-dialog>
<el-dialog
title="数据权限设置"
append-to-body
v-model="dataScopeSettingBox"
width="560px"
class="role-data-scope-setting-dialog"
>
<el-form label-position="right" label-width="auto">
<el-form-item label="角色名称">
<el-input v-model="dataScopeSetting.roleName" disabled />
</el-form-item>
<el-form-item label="数据权限">
<el-radio-group v-model="dataScopeSetting.scopeType">
<el-radio :value="1">所在部门及下级</el-radio>
<el-radio :value="2">全部组织</el-radio>
<el-radio :value="3">本人创建</el-radio>
<el-radio :value="4">自定义组织</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="Number(dataScopeSetting.scopeType) === 4" label="组织">
<el-tree
ref="treeCustomDept"
:data="deptTree"
show-checkbox
node-key="id"
default-expand-all
:props="{ label: 'title', children: 'children' }"
style="width: 100%; max-height: 320px; overflow: auto; border: 1px solid #ebeef5; padding: 8px"
/>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dataScopeSettingBox = false">取消</el-button>
<el-button type="primary" @click="submitDataScopeSetting">保存</el-button>
</span>
</template>
</el-dialog>
</basic-container>
</template>
@@ -196,37 +220,44 @@ import {
add,
getList,
getRole,
getRoleAlias,
getRoleTreeById,
grant,
grantTree,
remove,
update,
} from '@/api/system/role';
import { getRoleMenuDataScopeTree, submitRoleMenuDataScope } from '@/api/system/roleDataScope';
import { getDeptTree } from '@/api/system/dept';
import { mapGetters } from 'vuex';
import website from '@/config/website';
import { validatenull } from '@/utils/validate';
export default {
data() {
return {
form: {},
box: false,
dataScopeSettingBox: false,
props: {
label: 'title',
value: 'key',
},
menuGrantList: [],
dataScopeGrantList: [],
apiScopeGrantList: [],
apiGrantList: [],
menuTreeObj: [],
dataScopeTreeObj: [],
apiScopeTreeObj: [],
menuLinked: false,
dataScopeLinked: false,
apiScopeLinked: false,
currentRoleIds: [],
currentRoleName: '',
roleDataScopeMenuTree: [],
roleDataScopeMap: {},
deptTree: [],
dataScopeSetting: {
roleName: '',
scopeType: 2,
menuIds: [],
},
selectionList: [],
query: {},
loading: true,
@@ -309,32 +340,19 @@ export default {
],
},
{
label: '角色别名',
labelTip: '用于权限校验与标注的属性,可手动录入也可点击现有别名快速录入',
label: '角色标识',
labelTip: '用于权限校验与标注的属性',
prop: 'roleAlias',
search: true,
span: 24,
rules: [
{
required: true,
message: '请输入角色别名',
message: '请输入角色标识',
trigger: 'blur',
},
],
},
{
label: '现有别名',
labelTip: '当前系统已存在的角色别名,点击可快速录入',
prop: 'currentAlias',
type: 'radio',
dicData: [],
props: {
label: 'roleName',
value: 'roleAlias',
},
hide: true,
span: 24,
},
{
label: '角色排序',
prop: 'sort',
@@ -378,14 +396,6 @@ export default {
return ids;
},
},
watch: {
'form.currentAlias'() {
const alias = this.form.currentAlias;
if (!validatenull(alias)) {
this.form.roleAlias = alias;
}
},
},
methods: {
initData(roleId) {
getRoleTreeById(roleId).then(res => {
@@ -452,9 +462,9 @@ export default {
},
submit() {
const menuList = this.$refs.treeMenu.getCheckedKeys();
const dataScopeList = this.$refs.treeDataScope.getCheckedKeys();
const apiScopeList = this.$refs.treeApiScope.getCheckedKeys();
grant(this.currentRoleIds, menuList, dataScopeList, apiScopeList).then(() => {
// 数据权限已改为角色菜单配置;传 null 跳过原生 dataScope 更新,避免误清历史配置
grant(this.currentRoleIds, menuList, null, apiScopeList).then(() => {
this.box = false;
this.$message({
type: 'success',
@@ -465,6 +475,84 @@ export default {
this.onLoad(this.page);
});
},
getMenuScopeLabel(menuId) {
const scope = this.roleDataScopeMap[String(menuId)];
return scope ? scope.scopeTypeName : '';
},
loadRoleDataScopeTree(roleId) {
return getRoleMenuDataScopeTree(roleId).then(res => {
const data = res.data.data || {};
this.currentRoleName = data.roleName || '';
this.roleDataScopeMenuTree = data.menuTree || [];
const scopeMap = {};
(data.scopes || []).forEach(item => {
scopeMap[String(item.menuId)] = item;
});
this.roleDataScopeMap = scopeMap;
});
},
openDataScopeSetting() {
const tree = this.$refs.treeRoleDataScope;
if (!tree) {
return;
}
const menuIds = tree.getCheckedKeys();
if (!menuIds || menuIds.length === 0) {
this.$message.warning('请先勾选要设置的菜单');
return;
}
this.dataScopeSetting = {
roleName: this.currentRoleName,
scopeType: 2,
menuIds,
};
const loadDept =
this.deptTree && this.deptTree.length
? Promise.resolve()
: getDeptTree(this.userInfo.tenantId).then(res => {
this.deptTree = res.data.data || [];
});
loadDept.then(() => {
this.dataScopeSettingBox = true;
this.$nextTick(() => {
if (this.$refs.treeCustomDept) {
this.$refs.treeCustomDept.setCheckedKeys([]);
}
});
});
},
submitDataScopeSetting() {
const roleId = this.currentRoleIds && this.currentRoleIds[0];
if (!roleId) {
this.$message.warning('角色信息异常,请重新打开权限配置');
return;
}
const scopeType = Number(this.dataScopeSetting.scopeType || 2);
let deptIds = [];
if (scopeType === 4) {
deptIds = this.$refs.treeCustomDept ? this.$refs.treeCustomDept.getCheckedKeys() : [];
if (!deptIds.length) {
this.$message.warning('自定义组织时请勾选组织');
return;
}
}
submitRoleMenuDataScope({
roleId,
menuIds: this.dataScopeSetting.menuIds,
scopeType,
deptIds,
}).then(() => {
this.$message.success('数据权限设置成功');
this.dataScopeSettingBox = false;
this.loadRoleDataScopeTree(roleId).then(() => {
this.$nextTick(() => {
if (this.$refs.treeRoleDataScope) {
this.$refs.treeRoleDataScope.setCheckedKeys([]);
}
});
});
});
},
rowSave(row, done, loading) {
add(this.withTenantId(row)).then(
() => {
@@ -547,10 +635,6 @@ export default {
this.form.parentId = '';
}
}
getRoleAlias().then(res => {
const column = this.findColumn(this.option.column, 'currentAlias');
column.dicData = res.data.data;
});
done();
},
handleRole() {
@@ -563,58 +647,52 @@ export default {
return;
}
this.menuTreeObj = [];
this.dataScopeTreeObj = [];
this.apiScopeTreeObj = [];
// 保存当前要配置权限的角色ID
this.currentRoleIds = this.idsArray;
grantTree().then(res => {
this.menuGrantList = res.data.data.menu;
this.dataScopeGrantList = res.data.data.dataScope;
this.apiScopeGrantList = res.data.data.apiScope;
getRole(this.ids).then(res => {
this.menuTreeObj = res.data.data.menu;
this.dataScopeTreeObj = res.data.data.dataScope;
this.apiScopeTreeObj = res.data.data.apiScope;
this.box = true;
this.$nextTick(() => {
this.applyCheckedKeys('treeMenu', this.menuTreeObj);
this.applyCheckedKeys('treeDataScope', this.dataScopeTreeObj);
this.applyCheckedKeys('treeApiScope', this.apiScopeTreeObj);
});
this.currentRoleName = (this.selectionList[0] && this.selectionList[0].roleName) || '';
const roleId = this.currentRoleIds[0];
Promise.all([grantTree(), getRole(this.ids), this.loadRoleDataScopeTree(roleId)]).then(results => {
const grantRes = results[0];
const roleRes = results[1];
this.menuGrantList = grantRes.data.data.menu;
this.apiScopeGrantList = grantRes.data.data.apiScope;
this.menuTreeObj = roleRes.data.data.menu;
this.apiScopeTreeObj = roleRes.data.data.apiScope;
this.box = true;
this.$nextTick(() => {
this.applyCheckedKeys('treeMenu', this.menuTreeObj);
this.applyCheckedKeys('treeApiScope', this.apiScopeTreeObj);
});
});
},
handleRowRole(row) {
this.menuTreeObj = [];
this.dataScopeTreeObj = [];
this.apiScopeTreeObj = [];
// 保存当前要配置权限的角色ID(单个行操作)
this.currentRoleIds = [row.id];
grantTree().then(res => {
this.menuGrantList = res.data.data.menu;
this.dataScopeGrantList = res.data.data.dataScope;
this.apiScopeGrantList = res.data.data.apiScope;
getRole(row.id).then(res => {
this.menuTreeObj = res.data.data.menu;
this.dataScopeTreeObj = res.data.data.dataScope;
this.apiScopeTreeObj = res.data.data.apiScope;
this.box = true;
this.$nextTick(() => {
this.applyCheckedKeys('treeMenu', this.menuTreeObj);
this.applyCheckedKeys('treeDataScope', this.dataScopeTreeObj);
this.applyCheckedKeys('treeApiScope', this.apiScopeTreeObj);
});
this.currentRoleName = row.roleName || '';
Promise.all([grantTree(), getRole(row.id), this.loadRoleDataScopeTree(row.id)]).then(results => {
const grantRes = results[0];
const roleRes = results[1];
this.menuGrantList = grantRes.data.data.menu;
this.apiScopeGrantList = grantRes.data.data.apiScope;
this.menuTreeObj = roleRes.data.data.menu;
this.apiScopeTreeObj = roleRes.data.data.apiScope;
this.box = true;
this.$nextTick(() => {
this.applyCheckedKeys('treeMenu', this.menuTreeObj);
this.applyCheckedKeys('treeApiScope', this.apiScopeTreeObj);
});
});
},
handleDialogClose() {
// 对话框关闭时清空选择状态和权限树数据
this.menuTreeObj = [];
this.dataScopeTreeObj = [];
this.apiScopeTreeObj = [];
this.menuLinked = false;
this.dataScopeLinked = false;
this.apiScopeLinked = false;
this.roleDataScopeMenuTree = [];
this.roleDataScopeMap = {};
this.currentRoleName = '';
this.dataScopeSettingBox = false;
this.selectionClear();
},
handleDelete() {
@@ -659,3 +737,15 @@ export default {
},
};
</script>
<style scoped>
.role-data-scope-node {
display: inline-flex;
align-items: center;
gap: 4px;
}
.role-data-scope-tag {
color: #409eff;
font-size: 12px;
}
</style>
File diff suppressed because it is too large Load Diff
@@ -205,7 +205,9 @@ export const defaultContractAttachmentTypeOptions = [
{ label: '双章归档文件', value: '双章归档文件' },
{ label: '其他文件', value: CONTRACT_ATTACHMENT_TYPE_OTHER },
];
// 特批附件归口附件(佐证材料等)区上传:高风险/黑名单客商合同必传,后端按 fileType=特批附件 校验并挂特批面板(与后端 HcsSyncConstant.ATTACHMENT_TYPE_SPEC_EXPLANATION 对齐)
export const defaultContractSupportingAttachmentTypeOptions = [
{ label: '特批附件', value: '特批附件' },
{ label: '其他文件', value: CONTRACT_ATTACHMENT_TYPE_OTHER },
];
/** @deprecated 兼容旧引用,实际选项由业务字典动态加载 */
@@ -299,6 +301,8 @@ export const resolveContractAttachmentType = (
item => String(item.label) === aliasedFileType || String(item.label) === rawFileType
);
if (matchedByLabel) return matchedByLabel.value;
// 行已带类型但字典未命中(如历史保存值、字典缺失)时保留原值,避免重开页面时被降级为其他文件
if (rawFileType) return aliasedFileType;
const fileName = normalizeAttachmentTypeText(attachmentName(row));
if (!fileName) return otherType;
const matched = list
@@ -641,7 +645,7 @@ export default {
this.contractAttachmentTypeOptions
);
} else {
this.uploadDialogType = this.defaultAttachmentType;
this.uploadDialogType = this.uploadDialogType || this.defaultAttachmentType;
}
this.$message.success('上传成功');
},
@@ -0,0 +1,271 @@
<template>
<section class="contract-manage-form__section contract-manage-form__section--panel hcs-contract-panel">
<div class="contract-manage-form__attachment-head">
<div class="dialog-section-title">合规信息</div>
<div>
<el-button
v-if="canApplySpec"
type="warning"
plain
:loading="specApplying"
@click="openSpecDialog"
>
发起特批
</el-button>
<el-button
v-if="isSpecProcessing"
type="primary"
plain
@click="confirmSpecResult"
>
确认特批结果
</el-button>
</div>
</div>
<el-descriptions :column="3" class="contract-manage-detail__descriptions">
<el-descriptions-item label="合规同步状态">
<el-tooltip
v-if="hcsSyncMsg"
placement="top"
:content="hcsSyncMsg"
>
<el-tag :type="syncTagType" class="status-text">{{ syncLabel }}</el-tag>
</el-tooltip>
<el-tag v-else :type="syncTagType" class="status-text">{{ syncLabel }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="合规合同ID">{{
contract.hcsFdId || '-'
}}</el-descriptions-item>
<el-descriptions-item label="客商风险">
<template v-if="contract.hcsRiskLevel || contract.hcsBlackStatus">
<el-tag
v-if="isBlacklist"
type="danger"
class="status-text"
>黑名单</el-tag
>
<span v-if="contract.hcsRiskLevel" class="hcs-contract-panel__risk">{{
`风险等级:${contract.hcsRiskLevel}`
}}</span>
<span v-if="!contract.hcsRiskLevel && !isBlacklist">-</span>
</template>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="特批状态">
<el-tag v-if="specLabel" :type="specTagType" class="status-text">{{ specLabel }}</el-tag>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="特批说明" :span="2">{{
contract.hcsSpecMsg || '-'
}}</el-descriptions-item>
</el-descriptions>
<el-dialog
v-model="specDialogVisible"
title="发起合同特批"
width="640px"
append-to-body
destroy-on-close
class="hcs-contract-panel__spec-dialog"
@closed="resetSpecDialog"
>
<el-alert
title="高风险客商合同需经集团特批后方可签约推送;请上传特批申请材料及内部审批流程附件。"
type="warning"
:closable="false"
class="hcs-contract-panel__spec-alert"
/>
<el-upload
drag
multiple
:show-file-list="false"
:http-request="uploadMaterial"
:on-error="() => uploadFailed()"
class="hcs-contract-panel__spec-upload"
>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">将特批材料拖到此处,或<em>点击上传到合同系统</em></div>
</el-upload>
<el-table :data="materials" border class="hcs-contract-panel__spec-table">
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="name" label="文件名" min-width="220" show-overflow-tooltip />
<el-table-column prop="fdId" label="合规附件ID" min-width="240" show-overflow-tooltip />
<el-table-column label="操作" width="90" align="center" fixed="right">
<template #default="{ $index }">
<el-link type="danger" @click="materials.splice($index, 1)">删除</el-link>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button type="primary" :loading="specApplying" @click="submitSpec">确认发起</el-button>
<el-button @click="specDialogVisible = false">取消</el-button>
</template>
</el-dialog>
</section>
</template>
<script>
import { UploadFilled } from '@element-plus/icons-vue';
import {
applyContractSpec,
confirmContractSpec,
uploadAttachment,
} from '@/api/business/hcs';
const SYNC_STATUS_OPTIONS = [
{ label: '待推送', value: 'unsynced', type: 'info' },
{ label: '已推送', value: 'synced', type: 'success' },
{ label: '推送失败', value: 'failed', type: 'danger' },
];
const SPEC_STATUS_OPTIONS = [
{ label: '待特批', value: 'need', type: 'warning' },
{ label: '特批中', value: 'processing', type: 'warning' },
{ label: '特批通过', value: 'approved', type: 'success' },
{ label: '特批驳回', value: 'rejected', type: 'danger' },
];
export default {
name: 'HcsContractPanel',
components: { UploadFilled },
props: {
// 合同详情行(须含 id/hcsSyncStatus/hcsFdId/hcsRiskLevel/hcsBlackStatus/hcsSpecStatus 等)
contract: { type: Object, required: true },
},
emits: ['refresh'],
data() {
return {
specDialogVisible: false,
specApplying: false,
materials: [],
};
},
computed: {
syncLabel() {
return SYNC_STATUS_OPTIONS.find(item => item.value === this.contract.hcsSyncStatus)?.label || '-';
},
syncTagType() {
return SYNC_STATUS_OPTIONS.find(item => item.value === this.contract.hcsSyncStatus)?.type || 'info';
},
hcsSyncMsg() {
return this.contract.hcsSyncMsg || '';
},
isBlacklist() {
return String(this.contract.hcsBlackStatus || '').toLowerCase() === 'yes';
},
specLabel() {
return SPEC_STATUS_OPTIONS.find(item => item.value === this.contract.hcsSpecStatus)?.label || '';
},
specTagType() {
return SPEC_STATUS_OPTIONS.find(item => item.value === this.contract.hcsSpecStatus)?.type || 'info';
},
isSpecProcessing() {
return this.contract.hcsSpecStatus === 'processing';
},
canApplySpec() {
return ['need', 'rejected'].includes(this.contract.hcsSpecStatus);
},
},
methods: {
openSpecDialog() {
this.specDialogVisible = true;
},
resetSpecDialog() {
this.materials = [];
},
// 自定义上传:直传合同合规系统(C103-2),成功记录合规附件ID
uploadMaterial(options) {
const file = options.file;
if (file.size / 1024 / 1024 > 50) {
this.$message.warning('单文件大小不能超过 50MB');
return;
}
const formData = new FormData();
formData.append('fdFile', file);
uploadAttachment(formData)
.then(response => {
const fdId = response?.data?.data || response?.data;
if (!fdId || typeof fdId !== 'string') {
this.$message.error(response?.data?.msg || '上传合同系统失败');
return;
}
this.materials.push({ fdId, name: file.name });
this.$message.success(`已上传合同系统:${file.name}`);
})
.catch(error => {
this.$message.error(error?.response?.data?.msg || '上传合同系统失败');
});
},
uploadFailed() {
this.$message.error('上传合同系统失败');
},
submitSpec() {
if (!this.materials.length) {
this.$message.warning('请先上传特批申请材料');
return;
}
this.specApplying = true;
applyContractSpec({
contractId: this.contract.id,
attachments: this.materials.map(item => ({ fdId: item.fdId, name: item.name })),
})
.then(response => {
if (response?.data?.success === false) {
this.$message.error(response?.data?.msg || '特批发起失败');
return;
}
this.$message.success(response?.data?.data || '特批发起成功,等待集团审批');
this.specDialogVisible = false;
this.$emit('refresh');
})
.catch(error => {
this.$message.error(error?.response?.data?.msg || '特批发起失败');
})
.finally(() => {
this.specApplying = false;
});
},
confirmSpecResult() {
this.$prompt('请输入集团特批结果(approved=通过 / rejected=驳回)', '确认特批结果', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^(approved|rejected)$/,
inputErrorMessage: '请输入 approved 或 rejected',
}).then(({ value }) => {
confirmContractSpec(this.contract.id, value).then(() => {
this.$message.success('特批结果已确认');
this.$emit('refresh');
});
});
},
},
};
</script>
<style lang="scss" scoped>
.hcs-contract-panel__risk {
margin-left: 8px;
color: #606266;
}
.hcs-contract-panel__spec-alert {
margin-bottom: 12px;
}
.hcs-contract-panel__spec-upload {
margin-bottom: 12px;
:deep(.el-upload) {
width: 100%;
}
:deep(.el-upload-dragger) {
width: 100%;
}
}
.hcs-contract-panel__spec-table {
margin-bottom: 4px;
}
</style>
@@ -294,8 +294,8 @@ export default {
query: { id: String(customerId), name: '查看客商档案', view: '1' },
});
},
waybillStatusName(value) { return ({ pending: '待执行', waiting: '待执行', running: '进行中', processing: '进行中', completed: '已完成', cancelled: '已取消' })[value] || value || '-'; },
waybillStatusType(value) { return ({ pending: 'info', waiting: 'info', running: 'warning', processing: 'warning', completed: 'success', cancelled: 'danger' })[value] || 'info'; },
waybillStatusName(value) { return ({ pending: '待执行', waiting: '待执行', running: '进行中', processing: '进行中', pending_return_confirm: '待回单确认', completed: '已完成', cancelled: '已取消' })[value] || value || '-'; },
waybillStatusType(value) { return ({ pending: 'info', waiting: 'info', running: 'warning', processing: 'warning', pending_return_confirm: 'warning', completed: 'success', cancelled: 'danger' })[value] || 'info'; },
statusName(value) { return ({ waiting_dispatch: '待调度', dispatching: '调度中', completed: '调度完成', closed: '调度关闭' })[value] || value || '-'; },
statusType(value) { return ({ waiting_dispatch: 'warning', dispatching: 'success', completed: 'primary', closed: 'danger' })[value] || 'info'; },
},
@@ -210,7 +210,11 @@
@mousedown="() => handleDriverFocus(route)"
@focus="() => handleDriverFocus(route)"
@select="handleDriverSuggestionSelect"
/></el-form-item
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete></el-form-item
></el-col>
<el-col :span="6"
><el-form-item
@@ -239,7 +243,11 @@
@mousedown="() => handleDriverFocus(route)"
@focus="() => handleDriverFocus(route)"
@select="handleEscortSuggestionSelect"
/></el-form-item
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete></el-form-item
></el-col>
<el-col v-if="route.carrierType !== '承运商'" :span="6"
><el-form-item label="押运人手机号"
@@ -316,7 +324,7 @@
<script>
import * as api from '@/api/business/master-order';
import { fetchDriversByCarrierOrganizations } from '@/utils/carrier-org-resource';
import { fetchDriverCandidates, driverOptionText } from '@/utils/carrier-org-resource';
import { formatContractOptionLabel } from '@/utils/contract';
import {
currencyUnit,
@@ -403,6 +411,7 @@ export default {
this.applySelfOperatedCarrierDefaults();
},
methods: {
driverOptionText,
loadQuantityUnitOptions() {
if (this.quantityUnitLoading) return this.quantityUnitLoadPromise;
this.quantityUnitLoading = true;
@@ -944,12 +953,6 @@ export default {
route.escortPhone = '';
this.driverOptions = [];
},
getRouteCarrierFilter(route = {}) {
return {
carrierId: route.carrierId || '',
carrierName: route.carrierName || '',
};
},
carrierOptionValue(item = {}) {
return item.contractId || item.id || item.value || item.carrierName || '';
},
@@ -1026,36 +1029,22 @@ export default {
this.activeSuggestRoute = route;
},
async loadDriverOptions(route = {}, keyword = '') {
const carrier = this.getRouteCarrierFilter(route);
if (!carrier.carrierId && !carrier.carrierName) {
this.driverOptions = [];
return [];
}
this.driverLoading = true;
try {
this.driverOptions = await fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
);
this.driverOptions = await fetchDriverCandidates({
size: 20,
...(keyword ? { driverName: keyword } : {}),
posts: '司机',
});
return this.driverOptions;
} finally {
this.driverLoading = false;
}
},
fetchDriverSuggestions(queryString, callback) {
const route = this.activeSuggestRoute || {};
const carrier = this.getRouteCarrierFilter(route);
const keyword = String(queryString || '').trim();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
if (!keyword) this.$message.warning('请先选择承运商');
return;
}
this.driverLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
)
fetchDriverCandidates({ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' })
.then(records => {
this.driverOptions = records;
callback(
@@ -1080,19 +1069,13 @@ export default {
if (drivingVehicle) route.vehicleNo = drivingVehicle;
},
fetchEscortSuggestions(queryString, callback) {
const route = this.activeSuggestRoute || {};
const keyword = String(queryString || '').trim();
const carrier = this.getRouteCarrierFilter(route);
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
if (!keyword) this.$message.warning('请先选择承运商');
return;
}
this.escortLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '押运员' },
carrier
)
fetchDriverCandidates({
size: 20,
...(keyword ? { driverName: keyword } : {}),
posts: '押运员',
})
.then(records => {
callback(
records.map(item => ({
@@ -94,7 +94,7 @@
<div class="route-node-form">
<el-form-item label="途经地" required class="route-address-form-item"
><div class="route-address-inputs"
><el-input v-if="isNonRoadAddress(`route-${index}`)" v-model="route.departureName" class="route-address-name" readonly :disabled="isBasicRouteReadonly || !route.transportType" placeholder="请先选择运输方式" /><el-cascader v-else v-model="addressRegionPaths[`route-${index}`]" class="route-address-name" :options="regionOptions" :props="regionCascaderProps" :loading="regionLoading" :disabled="isBasicRouteReadonly || !route.transportType" placeholder="请选择省市区" clearable filterable @visible-change="visible => visible && loadRegionOptions()" @change="value => handleAddressRegionChange(`route-${index}`, value)" /><el-input v-model="route.departureAddress" class="route-address-detail" readonly :disabled="isBasicRouteReadonly || !route.transportType" placeholder="请先选择运输方式" @click="handleAddressDetailClick(`route-${index}`)" /><el-tooltip content="选择常用地址" placement="top"><el-button class="address-picker-button" type="primary" link :icon="OfficeBuilding" :disabled="isBasicRouteReadonly || !route.transportType" @click="openCommonAddress(`route-${index}`)" /></el-tooltip></div
><el-input v-if="isNonRoadAddress(`route-${index}`)" v-model="route.departureName" class="route-address-name" readonly :disabled="isBasicRouteReadonly" placeholder="请选择站点" /><el-cascader v-else v-model="addressRegionPaths[`route-${index}`]" class="route-address-name" :options="regionOptions" :props="regionCascaderProps" :loading="regionLoading" :disabled="isBasicRouteReadonly" placeholder="请选择省市区" clearable filterable @visible-change="visible => visible && loadRegionOptions()" @change="value => handleAddressRegionChange(`route-${index}`, value)" /><el-input v-model="route.departureAddress" class="route-address-detail" readonly :disabled="isBasicRouteReadonly" placeholder="请输入详细地址" @click="handleAddressDetailClick(`route-${index}`)" /><el-tooltip content="选择常用地址" placement="top"><el-button class="address-picker-button" type="primary" link :icon="OfficeBuilding" :disabled="isBasicRouteReadonly" @click="openCommonAddress(`route-${index}`)" /></el-tooltip></div
></el-form-item>
<el-form-item label="联系人" class="route-contact-form-item"><el-input v-model="route.departureContact" :disabled="isBasicRouteReadonly" placeholder="请输入" /></el-form-item>
<el-form-item label="联系方式" class="route-phone-form-item"><div class="route-contact-actions"><el-input v-model="route.departurePhone" :disabled="isBasicRouteReadonly" placeholder="请输入" /><template v-if="!isBasicRouteReadonly"><el-tooltip v-if="index === form.routes.length - 1" content="新增途经点" placement="top"><el-button class="route-action-button" type="primary" link @click="addRoute"><el-icon><CirclePlus /></el-icon></el-button></el-tooltip><el-tooltip content="删除途经点" placement="top"><el-button class="route-action-button" type="danger" link @click="removeRoute(index)"><el-icon><Remove /></el-icon></el-button></el-tooltip></template></div></el-form-item>
@@ -111,7 +111,7 @@
<div class="route-node-form">
<el-form-item label="收货地" required class="route-address-form-item"
><div class="route-address-inputs"
><el-input v-if="isNonRoadAddress('arrival')" v-model="form.arrivalName" class="route-address-name" readonly :disabled="isBasicRouteReadonly || !form.finalTransportType" placeholder="请先选择运输方式" /><el-cascader v-else v-model="addressRegionPaths.arrival" class="route-address-name" :options="regionOptions" :props="regionCascaderProps" :loading="regionLoading" :disabled="isBasicRouteReadonly || !form.finalTransportType" placeholder="请选择省市区" clearable filterable @visible-change="visible => visible && loadRegionOptions()" @change="value => handleAddressRegionChange('arrival', value)" /><el-input v-model="form.arrivalAddress" class="route-address-detail" readonly :disabled="isBasicRouteReadonly || !form.finalTransportType" placeholder="请先选择运输方式" @click="handleAddressDetailClick('arrival')" /><el-tooltip content="选择常用地址" placement="top"><el-button class="address-picker-button" type="primary" link :icon="OfficeBuilding" :disabled="isBasicRouteReadonly || !form.finalTransportType" @click="openCommonAddress('arrival')" /></el-tooltip></div
><el-input v-if="isNonRoadAddress('arrival')" v-model="form.arrivalName" class="route-address-name" readonly :disabled="isBasicRouteReadonly" placeholder="请选择站点" /><el-cascader v-else v-model="addressRegionPaths.arrival" class="route-address-name" :options="regionOptions" :props="regionCascaderProps" :loading="regionLoading" :disabled="isBasicRouteReadonly" placeholder="请选择省市区" clearable filterable @visible-change="visible => visible && loadRegionOptions()" @change="value => handleAddressRegionChange('arrival', value)" /><el-input v-model="form.arrivalAddress" class="route-address-detail" readonly :disabled="isBasicRouteReadonly" placeholder="请输入详细地址" @click="handleAddressDetailClick('arrival')" /><el-tooltip content="选择常用地址" placement="top"><el-button class="address-picker-button" type="primary" link :icon="OfficeBuilding" :disabled="isBasicRouteReadonly" @click="openCommonAddress('arrival')" /></el-tooltip></div
></el-form-item>
<el-form-item label="联系人" class="route-contact-form-item"
><el-input v-model="form.arrivalContact" :disabled="isBasicRouteReadonly" placeholder="请输入" /></el-form-item>
@@ -714,7 +714,7 @@ export default {
'msg',
'zip',
],
transports: ['公路运输', '铁路运输', '水路运输', '航空运输'],
transports: ['铁路运输', '水路运输', '航空运输', '公路运输'],
quantityUnitOptions: [],
quantityUnitLoading: false,
form: {
@@ -798,6 +798,7 @@ export default {
methods: {
formatContractOptionLabel,
defaultQuantityUnit() {
if (this.quantityUnitOptions.includes('吨')) return '吨';
return this.quantityUnitOptions[0] || '吨';
},
loadQuantityUnitOptions() {
@@ -1164,22 +1165,30 @@ export default {
const field = this.addressModel(target);
if (!field) return false;
const siteCode = String(field.model[field.siteCode] || '').trim();
// 地址展示模式由实际选择的数据决定:有站点编码表示非公路站点名称,
// 没有站点编码则保留省市区级联,避免切换运输方式时改写已有地址。
// 展示模式由已选数据决定:有站点编码则显示站点名,否则省市区;暂不按运输方式强制站点限制。
return Boolean(siteCode && siteCode !== '/');
},
hasAddressValue(target) {
const field = this.addressModel(target);
if (!field) return false;
return Boolean(
String(field.model[field.address] || '').trim() || String(field.model[field.name] || '').trim()
);
},
tipEmptyAddressDetail(target) {
// 替代原「请先选择运输方式」placeholder:空地址点击时 toast,已有值不再提示。
if (!this.hasAddressValue(target)) {
this.$message.warning('请输入详细地址');
}
},
resolveAddressRegionCode(row = {}) {
return row.regionCode || row.districtCode || row.areaCode || row.adcode || '';
},
openCommonAddress(target) {
if (this.isBasicRouteReadonly) return;
this.tipEmptyAddressDetail(target);
this.addressTarget = target;
if (this.addressTransportMode(target) !== 'road') {
this.stationQuery = {};
this.stationPage.current = 1;
this.stationDialogVisible = true;
return;
}
// 暂不按运输方式限制站点:统一走常用地址选择。
this.addressQuery = {};
this.addressPage.current = 1;
this.addressDialogVisible = true;
@@ -1279,18 +1288,11 @@ export default {
},
handleAddressDetailClick(target) {
if (this.isBasicRouteReadonly) return;
if (this.addressTransportMode(target) !== 'road') {
this.openCommonAddress(target);
return;
}
this.tipEmptyAddressDetail(target);
this.openAddressMap(target);
},
openAddressMap(target) {
if (this.isBasicRouteReadonly) return;
if (this.addressTransportMode(target) !== 'road') {
this.$message.info('非公路运输地址不能使用地图选择');
return;
}
const field = this.addressModel(target);
if (!field) return;
this.mapTarget = target;
@@ -1690,7 +1692,11 @@ export default {
'',
cargoTypePath,
quantity: row.quantity || '',
quantityUnit: row.quantityUnit || this.defaultQuantityUnit(),
// 常用货物单位若为空或「个」,新建总单统一默认「吨」
quantityUnit:
!row.quantityUnit || String(row.quantityUnit).trim() === '个'
? this.defaultQuantityUnit()
: row.quantityUnit,
packageType: row.packageType || row.package || '',
brand: row.brand || '',
specification: row.specification || row.spec || '',
@@ -1775,17 +1781,21 @@ export default {
return formatUpdateUserName(row);
},
selectRoute(route) {
// 先写入运输方式(会触发地点清空),再回填线路地址,避免被清空逻辑覆盖。
this.form.finalTransportType = '公路运输';
if (!this.form.routes.length) this.addRoute();
if (this.form.routes[0]) this.form.routes[0].transportType = '公路运输';
this.form.departureName = route.departureName || '';
this.form.departureAddress = route.departureAddress || '';
this.form.departureContact = route.departureContact || '';
this.form.departurePhone = route.departurePhone || '';
this.form.departureSiteCode = '';
this.form.arrivalName = route.arrivalName || '';
this.form.arrivalAddress = route.arrivalAddress || '';
this.form.arrivalContact = route.arrivalContact || '';
this.form.arrivalPhone = route.arrivalPhone || '';
this.form.arrivalSiteCode = '';
this.syncAddressRegionPaths();
this.form.finalTransportType = '公路运输';
if (!this.form.routes.length) this.addRoute();
this.routeDialogVisible = false;
},
createRoute(index = this.form.routes.length) {
@@ -10,7 +10,7 @@
:class="{ 'punch-record-photos__grid--edit': editable }"
>
<div
v-for="(item, groupIndex) in group.items"
v-for="item in group.items"
:key="`${item.photo.url}-${item.index}`"
class="punch-record-photos__item"
@click="handlePreview(item.index)"
@@ -23,8 +23,6 @@
:lazy="lazy"
fit="cover"
/>
<!-- 主图 = 该类型的第一张,按上传顺序取;没有独立字段,也不可切换 -->
<div v-if="groupIndex === 0" class="punch-record-photos__badge">主图</div>
<el-link
v-if="editable"
class="punch-record-photos__remove"
@@ -59,7 +57,7 @@
import { computed } from 'vue';
// 打卡照片是每个打卡节点必有的一个照片类型,不由过程配置的凭证类型决定;
// 它与各凭证类型各自最多 9 张,同一类型下第一张即界面上的「主图」。
// 它与各凭证类型各自最多 9 张。
const PUNCH_PHOTO_TYPE = '打卡照片';
// 照片没带类型时的兜底名称,与后端落库时的兜底口径一致
const PHOTO_TYPE_FALLBACK = '凭证';
@@ -252,18 +250,6 @@ const countText = group =>
}
}
&__badge {
position: absolute;
top: 0;
left: 0;
padding: 0 6px;
border-radius: 4px 0 4px 0;
background: rgba(64, 158, 255, 0.9);
font-size: 12px;
line-height: 18px;
color: #fff;
}
&__remove {
align-self: center;
font-size: 12px;
@@ -388,7 +388,7 @@
:disabled="dialogReadonly"
@visible-change="visible => visible && loadFeeUnitOptions()"
><el-option
v-for="unit in feeUnitOptions"
v-for="unit in feeUnitSelectOptions"
:key="unit.value"
:label="unit.label"
:value="unit.value" /></el-select
@@ -1124,6 +1124,10 @@ import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary } from '@/api/system/dictbiz';
import { packageOptions } from '@/option/business/common';
import { formatContractOptionLabel } from '@/utils/contract';
import {
mapFeeUnitOptions,
resolvePriceUnitByQuantityUnit,
} from '@/utils/currency';
import { loadMeasurementUnitOptions } from '@/utils/measurement-unit';
import { normalizeMapSearchResults, searchAmapPlaceText } from '@/utils/map-search';
import { downloadFileByUrl, downloadXls } from '@/utils/util';
@@ -1264,6 +1268,10 @@ const PageAvueForm = {
},
};
const shippingTemplateListRoute = '/business/shipping-template';
const shippingTemplateFormRoute = '/business/shipping-template/form';
const shippingTemplateListRefreshKey = 'shipping-template-list-refresh';
export default {
name: 'ShippingTemplatePage',
components: { PageAvueForm, ElImageViewer, OpenFileViewer },
@@ -1280,6 +1288,9 @@ export default {
return {
Location,
OfficeBuilding,
// 实例所属路由快照,避免 keep-alive 列表实例被全局 $route 误判成表单页。
routePathLocked: this.$route.path,
isFormPageInstance: this.$route.path === shippingTemplateFormRoute,
form: {},
query: {},
loading: true,
@@ -1401,13 +1412,18 @@ export default {
isStandaloneBusinessPage() {
return (
this.standaloneFormPage &&
['/business/shipping-template', '/business/shipping-template/form'].includes(
this.$route.path
)
(this.isFormPageInstance ||
[shippingTemplateListRoute, shippingTemplateFormRoute].includes(this.routePathLocked) ||
[shippingTemplateListRoute, shippingTemplateFormRoute].includes(this.$route.path))
);
},
isStandaloneFormPage() {
return this.isStandaloneBusinessPage && ['add', 'edit'].includes(this.$route.query.mode);
// 用实例锁定标志,避免列表 keep-alive 实例被全局路由误判成表单页。
return (
this.standaloneFormPage &&
this.isFormPageInstance &&
['add', 'edit'].includes(this.$route.query.mode)
);
},
formPageTitle() {
return this.isStandaloneFormPage
@@ -1464,6 +1480,12 @@ export default {
);
return this.currencyUnit(option?.label || this.shippingTemplateFreight.currency);
},
feeUnitSelectOptions() {
return mapFeeUnitOptions(
this.feeUnitOptions,
this.shippingTemplateFreight.currency || 'RMB'
);
},
roadFreightTotal() {
const total = this.shippingTemplateFreight.freightItems.reduce(
(sum, item) => sum + Number(this.freightAmount(item) || 0),
@@ -1530,6 +1552,18 @@ export default {
},
watch: {
$route(to, from) {
// 列表实例:从其他页进入列表时刷新(activated 负责标签切回)。
if (!this.isFormPageInstance) {
const enteringList =
(to.path === this.routePathLocked || to.path === shippingTemplateListRoute) &&
from?.path &&
from.path !== to.path;
if (enteringList) {
sessionStorage.removeItem(shippingTemplateListRefreshKey);
this.$nextTick(() => this.onLoad(this.page, this.query));
}
return;
}
if (
this.isStandaloneFormPage &&
(to.query.mode !== from?.query?.mode ||
@@ -1550,6 +1584,10 @@ export default {
this.handleTransportTypeChange(value);
this.syncFreightItems();
},
'form.templateType'() {
// 切换到运单模板时立即按货物数量单位生成公路运费明细。
this.$nextTick(() => this.syncFreightItems());
},
},
created() {
this.loadProjectOptions();
@@ -1559,8 +1597,16 @@ export default {
this.loadCurrencyOptions();
if (this.isStandaloneFormPage) this.$nextTick(() => this.initStandaloneFormPage());
},
activated() {
if (this.isFormPageInstance) return;
sessionStorage.removeItem(shippingTemplateListRefreshKey);
this.$nextTick(() => this.onLoad(this.page, this.query));
},
methods: {
formatContractOptionLabel,
markShippingTemplateListNeedRefresh() {
sessionStorage.setItem(shippingTemplateListRefreshKey, '1');
},
loadQuantityUnitOptions() {
if (this.quantityUnitLoading) return this.quantityUnitLoadPromise;
this.quantityUnitLoading = true;
@@ -1591,12 +1637,8 @@ export default {
});
}
if (this.menuWidth != null) next.menuWidth = this.menuWidth;
if (
this.standaloneFormPage &&
['/business/shipping-template', '/business/shipping-template/form'].includes(
this.$route.path
)
) {
// 仅表单页实例套用全屏表单弹窗样式,避免列表页误用后表格区域异常。
if (this.standaloneFormPage && this.$route.path === shippingTemplateFormRoute) {
next.dialogAppendToBody = false;
next.dialogModal = false;
next.dialogCustomClass = 'shipping-template-form-page-dialog';
@@ -1776,13 +1818,22 @@ export default {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
if (this.isFormPageInstance) return;
this.loading = true;
const currentPage = page?.currentPage || this.page.currentPage || 1;
const pageSize = page?.pageSize || this.page.pageSize || 10;
this.api
.getList(page.currentPage, page.pageSize, { ...this.query, ...params })
.getList(currentPage, pageSize, { ...this.query, ...params })
.then(res => {
const data = res?.data?.data || {};
this.data = extractRecords(res);
this.page.total = data.total || this.data.length;
const data = res?.data?.data || res?.data || {};
const records = extractRecords(res);
this.data = records;
this.page.total = Number(data.total ?? records.length) || 0;
})
.catch(error => {
window.console.error(error);
this.data = [];
this.page.total = 0;
})
.finally(() => {
this.loading = false;
@@ -1821,9 +1872,10 @@ export default {
.submit(submit)
.then(() => {
this.$message.success('操作成功');
this.markShippingTemplateListNeedRefresh();
done?.();
this.closeCrudDialog();
this.onLoad(this.page, this.query);
if (!this.isFormPageInstance) this.onLoad(this.page, this.query);
})
.catch(() => loading?.());
},
@@ -1837,9 +1889,10 @@ export default {
.submit(submit)
.then(() => {
this.$message.success('操作成功');
this.markShippingTemplateListNeedRefresh();
done?.();
this.closeCrudDialog();
this.onLoad(this.page, this.query);
if (!this.isFormPageInstance) this.onLoad(this.page, this.query);
})
.catch(() => loading?.());
},
@@ -1883,6 +1936,8 @@ export default {
this.attachmentRows = [];
this.shippingTemplateFreight = defaultFreight();
this.loadCurrencyOptions();
this.loadFeeUnitOptions();
this.$nextTick(() => this.syncFreightItems());
if (typeof this.api.nextCode === 'function')
this.api
.nextCode()
@@ -2005,20 +2060,47 @@ export default {
return false;
}
if (this.transportMode === 'road') {
const invalid = this.shippingTemplateFreight.freightItems.findIndex(
item =>
Number(item.unitPrice || 0) < 0 ||
!item.priceUnit ||
(!this.isFreightAutoCalculable(item) &&
(item.freightAmount === '' ||
item.freightAmount === null ||
item.freightAmount === undefined)) ||
Number(item.freightAmount || 0) < 0
);
if (invalid > -1) {
this.$message.warning(`第${invalid + 1}条货物的单价、计价单位或运费无效`);
if (!this.shippingTemplateFreight.freightItems.length) {
this.$message.warning('请先完善货物数量单位,以便生成运费明细');
return false;
}
for (const [index, item] of this.shippingTemplateFreight.freightItems.entries()) {
const label = `第${index + 1}条运费明细`;
if (
item.unitPrice === '' ||
item.unitPrice === null ||
item.unitPrice === undefined
) {
this.$message.warning(`请填写${label}的单价`);
return false;
}
if (Number(item.unitPrice) < 0) {
this.$message.warning(`${label}的单价不能小于0`);
return false;
}
if (!String(item.priceUnit || '').trim()) {
this.$message.warning(`请选择${label}的计价单位`);
return false;
}
if (this.isFreightAutoCalculable(item)) {
if (!item.freightAmountManual) {
item.freightAmount = this.freightAmount(item);
}
} else if (
item.freightAmount === '' ||
item.freightAmount === null ||
item.freightAmount === undefined
) {
this.$message.warning(
`${label}的计价单位与货物数量单位不匹配,无法自动计算运费,请手动填写运费`
);
return false;
}
if (Number(item.freightAmount || 0) < 0) {
this.$message.warning(`${label}的运费不能小于0`);
return false;
}
}
} else if (Number(this.shippingTemplateFreight.freightAmount || 0) < 0) {
this.$message.warning('运费不能小于0');
return false;
@@ -2033,8 +2115,11 @@ export default {
return true;
},
closeCrudDialog() {
if (this.isStandaloneBusinessPage) {
this.$router.push({ path: '/business/shipping-template', query: {} });
if (this.isStandaloneBusinessPage || this.isFormPageInstance) {
// 关闭独立表单页时标记列表需刷新(含直接点关闭未保存的场景)
this.markShippingTemplateListNeedRefresh();
this.$router.$avueRouter?.closeTag?.();
this.$router.push({ path: shippingTemplateListRoute, query: {} });
return;
}
this.$refs.crud?.closeDialog?.();
@@ -2294,7 +2379,16 @@ export default {
},
loadFeeUnitOptions() {
getDictionary({ code: 'unit_fee' }).then(res => {
this.feeUnitOptions = this.normalizeDictOptions(res?.data?.data || []);
// 计价单位必须保存可读文案(如 元/吨),才能与货物数量单位匹配并自动计算运费。
this.feeUnitOptions = (res?.data?.data || []).map(item => {
const label = String(item.dictValue || item.label || item.value || '').trim();
const key = String(item.dictKey || item.value || '').trim();
return {
label: label || key,
value: label.includes('/') ? label : key || label,
remark: item.remark || '',
};
});
});
},
loadCurrencyOptions() {
@@ -3098,24 +3192,53 @@ export default {
: [];
const quantityUnits = [];
this.transportCargoRows.forEach(row => {
const quantityUnit = row.quantityUnit || '';
const quantityUnit = String(row.quantityUnit || '').trim();
if (!quantityUnit) return;
if (!quantityUnits.some(unit => unit === quantityUnit)) quantityUnits.push(quantityUnit);
});
const currency = this.shippingTemplateFreight.currency || 'RMB';
this.shippingTemplateFreight.freightItems = quantityUnits.map((quantityUnit, index) => {
const matched =
previousItems.find(item => String(item.quantityUnit || '') === String(quantityUnit)) ||
previousItems[index] ||
{};
const defaultPriceUnit = resolvePriceUnitByQuantityUnit(quantityUnit, currency);
const priceUnit = this.normalizeFreightPriceUnit(
matched.priceUnit || defaultPriceUnit || '',
quantityUnit,
currency
);
return {
quantityUnit,
unitPrice: matched.unitPrice || '',
priceUnit: matched.priceUnit || '',
priceUnit,
freightAmount: matched.freightAmount ?? '',
freightAmountManual:
matched.freightAmountManual === true || matched.manualFreightAmount === true,
};
});
},
normalizeFreightPriceUnit(priceUnit, quantityUnit, currency = 'RMB') {
const text = this.resolvePriceUnitText(priceUnit);
if (text && this.priceUnitMatchesQuantity(text, quantityUnit)) return text;
return (
resolvePriceUnitByQuantityUnit(quantityUnit, currency) ||
text ||
String(priceUnit || '').trim()
);
},
resolvePriceUnitText(priceUnit) {
const raw = String(priceUnit || '').trim();
if (!raw) return '';
if (raw.includes('/')) return raw;
const options = this.feeUnitSelectOptions.length
? this.feeUnitSelectOptions
: this.feeUnitOptions;
const matched = options.find(
item => String(item.value) === raw || String(item.label) === raw
);
return matched?.label || raw;
},
quantityUnits() {
return [
...new Set(
@@ -3131,7 +3254,7 @@ export default {
.replace(/\s+/g, '')
.replace(/立方米|立方公尺|方/g, '立方');
const unit = normalizeUnit(quantityUnit).replace(/[·*.]/g, '');
const value = String(priceUnit || '')
const value = String(this.resolvePriceUnitText(priceUnit) || '')
.trim()
.toLowerCase()
.replace(/\s+/g, '');
@@ -3163,6 +3286,10 @@ export default {
return this.formatFreightNumber(item.freightAmount);
}
if (!this.isFreightAutoCalculable(item)) {
// 无法自动计算且未手工填写时返回空,避免把空值显示成 0 造成“已填写”的错觉。
if (item.freightAmount === '' || item.freightAmount === null || item.freightAmount === undefined) {
return '';
}
return this.formatFreightNumber(item.freightAmount);
}
return this.formatFreightNumber(
@@ -1677,7 +1677,7 @@
{{
isDispatchPlanQuantityUnlimited(row)
? '-'
: formatDispatchQuantity(dispatchItemRemainingQuantity(row))
: formatDispatchQuantity(dispatchItemDisplayRemainingQuantity(row))
}}
</template>
</el-table-column>
@@ -1861,7 +1861,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="司机" :required="dispatchItemForm.carrierType !== '承运商'">
<el-form-item label="司机" required>
<el-autocomplete
v-model="dispatchItemForm.driverName"
placeholder="请输入"
@@ -1870,11 +1870,15 @@
:fetch-suggestions="fetchTaskDriverSuggestions"
:loading="taskDriverLoading"
@select="item => handleTaskDriverSelect('dispatch', item)"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item
:label="dispatchItemForm.carrierType === '承运商' ? '手机号' : '司机手机号'"
:required="dispatchItemForm.carrierType !== '承运商'"
required
>
<el-input v-model="dispatchItemForm.driverPhone" placeholder="请输入" />
</el-form-item>
@@ -1893,7 +1897,11 @@
:fetch-suggestions="fetchTaskEscortSuggestions"
:loading="taskEscortLoading"
@select="handleTaskEscortSelect"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item v-if="dispatchItemForm.carrierType !== '承运商'" label="押运人手机号">
<el-input v-model="dispatchItemForm.escortPhone" placeholder="请输入" />
@@ -1955,7 +1963,7 @@
class="transport-plan-page__dispatch-quantity-hint"
>
剩余数量:{{
formatDispatchQuantity(dispatchItemHintRemainingQuantity(dispatchItemForm))
formatDispatchQuantity(dispatchItemDisplayRemainingQuantity(dispatchItemForm))
}}
{{ dispatchItemForm.quantityUnit || '吨' }}
</div>
@@ -2096,11 +2104,7 @@
/>
</el-select>
</el-form-item>
<el-form-item
v-if="dispatchIsRoadTransport"
label="司机"
:required="dispatchItemForm.carrierType === '自运'"
>
<el-form-item v-if="dispatchIsRoadTransport" label="司机" required>
<el-autocomplete
v-model="dispatchItemForm.driverName"
placeholder="请输入"
@@ -2111,11 +2115,7 @@
@select="item => handleTaskDriverSelect('dispatch', item)"
/>
</el-form-item>
<el-form-item
v-if="dispatchIsRoadTransport"
label="手机号"
:required="dispatchItemForm.carrierType === '自运'"
>
<el-form-item v-if="dispatchIsRoadTransport" label="手机号" required>
<el-input v-model="dispatchItemForm.driverPhone" placeholder="请输入" />
</el-form-item>
<el-form-item
@@ -2768,7 +2768,7 @@ import {
getList as getProjectList,
} from '@/api/business/project-apply';
import { getList as getCommonRouteList } from '@/api/business/common-route';
import { fetchDriversByCarrierOrganizations } from '@/utils/carrier-org-resource';
import { fetchDriverCandidates, driverOptionText } from '@/utils/carrier-org-resource';
import { getDictionary } from '@/api/system/dictbiz';
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { addressTypeOptions } from '@/option/base/common-address';
@@ -2807,8 +2807,11 @@ import 'nprogress/nprogress.css';
const AMAP_KEY = '653b7cf105ad7fb8ec9b2f5198ade315';
const AMAP_SECURITY_CODE = '5aab65c632e48ebae0d0e28f5b28e21a';
let amapLoader;
const transportPlanListRoute = '/business/transport-plan';
const transportPlanFormRoute = '/business/transport-plan/form';
const transportPlanListRefreshKey = 'transport-plan-list-refresh';
const standaloneTransportPlanFormRoutes = {
'/business/transport-plan': '/business/transport-plan/form',
[transportPlanListRoute]: transportPlanFormRoute,
};
const standaloneTransportPlanFormPaths = [
...Object.keys(standaloneTransportPlanFormRoutes),
@@ -3072,6 +3075,10 @@ export default {
// 必须放 data:Options API 的顺序是 data → computed → watch(immediate) → created,
// 放 created 的话首个 immediate watcher 会读到空值,把首次加载也挡掉。
routePathLocked: this.$route.path,
// 表单页实例在创建时锁定,避免 keep-alive 列表实例随全局 $route 误切到表单态。
isFormPageInstance: Object.values(standaloneTransportPlanFormRoutes).includes(
this.$route.path
),
form: {},
suppressTransportTypeClear: false,
query: {},
@@ -3112,10 +3119,11 @@ export default {
option: (() => {
const opt = this.cloneOption(this.crudOption, estimateMenuButtonCount(this.config));
if (this.menuWidth != null) opt.menuWidth = this.menuWidth;
if (
this.standaloneFormPage &&
standaloneTransportPlanFormPaths.includes(this.$route.path)
) {
// 仅表单页实例套用全屏表单弹窗样式,避免列表页误用后表格区域异常。
const isFormInstance = Object.values(standaloneTransportPlanFormRoutes).includes(
this.$route.path
);
if (this.standaloneFormPage && isFormInstance) {
opt.dialogAppendToBody = false;
opt.dialogModal = false;
opt.dialogCustomClass = 'transport-plan-form-page-dialog';
@@ -3150,6 +3158,8 @@ export default {
dispatchItemIndex: -1,
dispatchItemForm: defaultDispatchRow(),
dispatchItemCargoRows: [],
// 本次数量变更版本号:驱动同表其他行「剩余数量」同步重算
dispatchCargoQuantityVersion: 0,
dispatchItemAttachmentRows: [],
selectedDispatchItemAttachmentRows: [],
attachmentRows: [],
@@ -3289,6 +3299,12 @@ export default {
}
this.loadTaskQuantityUnitOptions();
},
// keep-alive 重新激活列表时强制刷新,避免缓存脏数据;标记位用于兼容旧跳转逻辑。
activated() {
if (this.isFormPageInstance) return;
sessionStorage.removeItem(transportPlanListRefreshKey);
this.$nextTick(() => this.onLoad(this.page, this.query));
},
computed: {
...mapGetters(['permission', 'userInfo']),
permissionList() {
@@ -3300,10 +3316,20 @@ export default {
return this.config.detailSections || [];
},
isStandaloneBusinessPage() {
return this.standaloneFormPage && standaloneTransportPlanFormPaths.includes(this.$route.path);
return (
this.standaloneFormPage &&
(this.isFormPageInstance ||
standaloneTransportPlanFormPaths.includes(this.routePathLocked) ||
standaloneTransportPlanFormPaths.includes(this.$route.path))
);
},
isStandaloneFormPage() {
return this.isStandaloneBusinessPage && ['add', 'edit'].includes(this.$route.query.mode);
// 用实例锁定标志,避免列表 keep-alive 实例被全局路由误判成表单页。
return (
this.standaloneFormPage &&
this.isFormPageInstance &&
['add', 'edit'].includes(this.$route.query.mode)
);
},
formPageTitle() {
if (this.isStandaloneFormPage) {
@@ -3752,6 +3778,18 @@ export default {
},
watch: {
$route(to, from) {
// 列表实例:从其他页进入列表时刷新(activated 负责标签切回)。
if (!this.isFormPageInstance) {
const enteringList =
(to.path === this.routePathLocked || to.path === transportPlanListRoute) &&
from?.path &&
from.path !== to.path;
if (enteringList) {
sessionStorage.removeItem(transportPlanListRefreshKey);
this.$nextTick(() => this.onLoad(this.page, this.query));
}
return;
}
if (!this.isStandaloneFormPage) return;
if (
to.query.mode !== from?.query?.mode ||
@@ -3779,6 +3817,7 @@ export default {
},
methods: {
formatContractOptionLabel,
driverOptionText,
initStandaloneFormPage() {
if (!this.isStandaloneFormPage) return;
const mode = this.$route.query.mode === 'edit' ? 'edit' : 'add';
@@ -4148,6 +4187,7 @@ export default {
waiting: ['待执行', 'is-pending'],
processing: ['进行中', 'is-processing'],
running: ['进行中', 'is-processing'],
pending_return_confirm: ['待回单确认', 'is-pending'],
completed: ['已完成', 'is-completed'],
cancelled: ['已取消', 'is-cancelled'],
};
@@ -4484,6 +4524,9 @@ export default {
loading();
}
},
markTransportPlanListNeedRefresh() {
sessionStorage.setItem(transportPlanListRefreshKey, '1');
},
rowSave(row, done, loading) {
const submitRow = this.normalizeRow(row);
if (!submitRow) {
@@ -4492,6 +4535,7 @@ export default {
}
this.getSaveRequest()(submitRow).then(
() => {
this.markTransportPlanListNeedRefresh();
this.onLoad(this.page);
this.$message({ type: 'success', message: '操作成功!' });
done();
@@ -4511,6 +4555,7 @@ export default {
}
this.getSaveRequest()(submitRow).then(
() => {
this.markTransportPlanListNeedRefresh();
this.onLoad(this.page);
this.$message({ type: 'success', message: '操作成功!' });
done();
@@ -4540,7 +4585,7 @@ export default {
.submit(submitRow)
.then(() => {
this.$message.success(action === 'draft' ? '暂存成功' : '创建成功');
this.onLoad(this.page, this.query);
this.markTransportPlanListNeedRefresh();
this.closeCrudDialog();
})
.finally(() => {
@@ -4548,12 +4593,14 @@ export default {
});
},
closeCrudDialog() {
if (this.isStandaloneBusinessPage) {
if (this.isStandaloneBusinessPage || this.isFormPageInstance) {
// 关闭独立表单页时标记列表需刷新(含直接点关闭未保存的场景)
this.markTransportPlanListNeedRefresh();
this.$router.$avueRouter?.closeTag?.();
const listPath =
Object.entries(standaloneTransportPlanFormRoutes).find(
([, formPath]) => formPath === this.$route.path
)?.[0] || this.$route.path;
([, formPath]) => formPath === this.$route.path || formPath === this.routePathLocked
)?.[0] || transportPlanListRoute;
this.$router.push({ path: listPath, query: {} });
return;
}
@@ -4951,16 +4998,8 @@ export default {
},
fetchTaskDriverSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getDispatchCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.taskDriverLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
)
fetchDriverCandidates({ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' })
.then(records => {
this.taskDriverOptions = records;
callback(
@@ -4980,16 +5019,12 @@ export default {
},
fetchTaskEscortSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getDispatchCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.taskEscortLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '押运员' },
carrier
)
fetchDriverCandidates({
size: 20,
...(keyword ? { driverName: keyword } : {}),
posts: '押运员',
})
.then(records => {
this.taskEscortOptions = records;
callback(records.map(item => ({ ...item, value: item.driverName || item.name || '' })));
@@ -6634,20 +6669,33 @@ export default {
return query;
},
onLoad(page, params = {}) {
if (this.isFormPageInstance) return;
this.loading = true;
const currentPage = page?.currentPage || this.page.currentPage || 1;
const pageSize = page?.pageSize || this.page.pageSize || 10;
const query = this.normalizeQueryParams({
...params,
...this.query,
allDept: 0,
});
this.api
.getList(page.currentPage, page.pageSize, query)
.getList(currentPage, pageSize, query)
.then(res => {
const result = res.data.data;
this.page.total = result.total;
this.data = result.records;
const result = res?.data?.data || res?.data || {};
const records = Array.isArray(result.records)
? result.records
: Array.isArray(result)
? result
: [];
this.page.total = Number(result.total ?? records.length) || 0;
this.data = records;
this.selectionClear();
})
.catch(error => {
window.console.error(error);
this.data = [];
this.page.total = 0;
})
.finally(() => {
this.loading = false;
});
@@ -7652,6 +7700,7 @@ export default {
row.cargoName = '';
row.specification = '';
row.model = '';
this.dispatchCargoQuantityVersion += 1;
},
handleDispatchConfiguredCargoNameChange(row, value) {
const nextValue = String(value ?? row.cargoName ?? '').trim();
@@ -7660,6 +7709,7 @@ export default {
);
if (!option) {
row.cargoName = nextValue;
this.dispatchCargoQuantityVersion += 1;
return;
}
const previousType = String(row.cargoType || '').trim();
@@ -7674,6 +7724,7 @@ export default {
}
row.specification = option.specification || row.specification || '';
row.model = option.model || row.model || '';
this.dispatchCargoQuantityVersion += 1;
},
openDispatchItemDialog(index = -1, row = defaultDispatchRow()) {
const defaultSummaryItem =
@@ -7991,17 +8042,12 @@ export default {
this.taskDriverOptions = [];
this.taskEscortOptions = [];
},
getDispatchCarrierFilter() {
return {
carrierId: this.dispatchItemForm.carrierId || '',
carrierName: this.dispatchItemForm.carrierName || '',
};
},
handleDispatchCargoQuantityInput(row, value) {
const text = String(value || '').replace(/[^\d.]/g, '');
const parts = text.split('.');
row.quantity =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 3)}` : parts[0];
this.dispatchCargoQuantityVersion += 1;
},
handleDispatchCargoNumberInput(row, prop, value) {
this.handleFreightNumberInput(row, prop, value);
@@ -8021,12 +8067,14 @@ export default {
const nextRow = this.normalizeTransportCargoRow({ priceUnit: this.defaultPriceUnit });
if (index > -1) this.dispatchItemCargoRows.splice(index + 1, 0, nextRow);
else this.dispatchItemCargoRows.push(nextRow);
this.dispatchCargoQuantityVersion += 1;
},
removeDispatchCargoRow(index) {
this.dispatchItemCargoRows.splice(index, 1);
if (!this.dispatchItemCargoRows.length) {
this.dispatchItemCargoRows.push(this.normalizeTransportCargoRow());
}
this.dispatchCargoQuantityVersion += 1;
},
dispatchCargoFreightAmount(cargo = {}) {
if (cargo.freightAmount !== undefined && cargo.freightAmount !== null) {
@@ -8176,11 +8224,50 @@ export default {
}, 0)
);
},
/** 精简录入提示:可调度余量扣减当前本次数量后的剩余 */
dispatchItemHintRemainingQuantity(row = {}) {
/**
* 当前编辑表单中,与指定行同货物(有身份)或同单位(无身份)已占用的本次数量合计。
* 用于剩余数量展示联动,不参与提交校验(校验仍按整单合计对比计划余量)。
*/
getDispatchFormOccupiedQuantity(row = {}) {
const goodsRows =
this.dispatchItemForm?.taskEntryMode === 'full'
? this.dispatchItemCargoRows || []
: [this.dispatchItemForm || row];
const hasCargoIdentity = Boolean(
String(row.cargoName || row.goodsName || row.name || '').trim() ||
String(row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || '').trim()
);
const unit = this.getDispatchQuantityUnit(row);
const cargoKey = this.getDispatchCargoIdentity(row);
return goodsRows.reduce((sum, goods) => {
if (!goods) return sum;
if (hasCargoIdentity) {
const goodsHasIdentity = Boolean(
String(goods.cargoName || goods.goodsName || goods.name || '').trim() ||
String(
goods.cargoType || goods.secondCargoTypeName || goods.goodsType || goods.type || ''
).trim()
);
if (!goodsHasIdentity || this.getDispatchCargoIdentity(goods) !== cargoKey) {
return sum;
}
} else if (this.getDispatchQuantityUnit(goods) !== unit) {
return sum;
}
return sum + this.parseDispatchQuantity(goods.quantity);
}, 0);
},
/** 展示用剩余数量:计划可调度余量扣减本单已填本次数量(含当前行) */
dispatchItemDisplayRemainingQuantity(row = {}) {
// 依赖版本号,确保一行本次数量变化后其他行剩余数量一并刷新
void this.dispatchCargoQuantityVersion;
const available = this.dispatchItemRemainingQuantity(row);
const current = this.parseDispatchQuantity(row.quantity);
return Math.max(available - current, 0);
const occupied = this.getDispatchFormOccupiedQuantity(row);
return Math.max(available - occupied, 0);
},
/** 精简录入提示:与完整录入剩余数量展示规则一致 */
dispatchItemHintRemainingQuantity(row = {}) {
return this.dispatchItemDisplayRemainingQuantity(row);
},
pruneDispatchPendingRows(rows = []) {
const planQuantities = new Map();
@@ -8278,13 +8365,17 @@ export default {
const fullEntry = row.taskEntryMode === 'full';
const roadTransport = this.resolveTransportMode(row.transportType) === 'road';
if (fullEntry) {
if (roadTransport && row.carrierType === '自运') {
// 公路运输时司机/手机号一律必填(含承运类型为承运商)
if (roadTransport && row.carrierType) {
requiredFields.push(['driverName', '司机']);
requiredFields.push(['driverPhone', '手机号']);
}
} else if (row.carrierType && row.carrierType !== '承运商') {
} else if (row.carrierType) {
requiredFields.push(['driverName', '司机']);
requiredFields.push(['driverPhone', '司机手机号']);
requiredFields.push([
'driverPhone',
row.carrierType === '承运商' ? '手机号' : '司机手机号',
]);
}
const emptyField = requiredFields.find(([prop]) => this.isBillingFieldEmpty(row[prop]));
if (emptyField) return requiredMessage(emptyField[1]);
@@ -96,22 +96,12 @@
prop="carrierName"
label="承运商"
min-width="140"
/><el-table-column
v-if="columnVisible.carrierType"
prop="carrierType"
label="承运类型"
min-width="120"
/>
<el-table-column
v-if="columnVisible.waybillCount"
prop="waybillCount"
label="运单数"
width="90"
/> <el-table-column
v-if="columnVisible.importTypeName"
prop="importTypeName"
label="导入方式"
width="100"
/>
<el-table-column
v-if="columnVisible.statusName"
@@ -119,6 +109,12 @@
label="状态"
width="100"
/>
<el-table-column
v-if="columnVisible.settlementStatusName"
prop="settlementStatusName"
label="结算状态"
width="110"
/>
<el-table-column
v-if="columnVisible.createUserName"
prop="createUserName"
@@ -159,7 +155,7 @@
>编辑</el-link
>
<el-link
v-if="row.importStatus === 'draft'"
v-if="canRemoveBatch(row)"
type="danger"
@click="removeBatch(row)"
>删除</el-link
@@ -641,10 +637,9 @@ const columnOptions = [
{ prop: 'batchNo', label: '运单批次号' },
{ prop: 'projectName', label: '项目名称' },
{ prop: 'carrierName', label: '承运商' },
{ prop: 'carrierType', label: '承运类型' },
{ prop: 'waybillCount', label: '运单数' },
{ prop: 'importTypeName', label: '导入方式' },
{ prop: 'statusName', label: '状态' },
{ prop: 'settlementStatusName', label: '结算状态' },
{ prop: 'createUserName', label: '创建人' },
{ prop: 'createTime', label: '创建时间' },
{ prop: 'updateTime', label: '更新时间' },
@@ -1266,26 +1261,46 @@ const fillEditForm = async row => {
if (carrierValue) carrierChange(carrierValue);
await loadBatchRows(snapshot.id);
};
/** 与行操作一致:仅草稿可删除 */
const canRemoveBatch = row => String(row?.importStatus || '') === 'draft';
const removeBatches = () => {
/** 与后端一致:仅未结算批次可整批删除 */
const canRemoveBatch = row => String(row?.settlementStatus || 'unsettled') === 'unsettled';
const removeBatches = async () => {
if (!selected.value.length) {
ElMessage.warning('请选择至少一条数据');
return;
}
// 选中含不可删条目时整批拦截(含已完成/进行中),不静默跳过
// 选中含部分结算/已结算时整批拦截,不静默跳过
if (selected.value.some(row => !canRemoveBatch(row))) {
ElMessage.warning('已完成运单不可删除');
ElMessage.warning('仅未结算的运单批次可以删除');
return;
}
return api.removeImportBatches(selected.value.map(item => item.id).join(',')).then(loadBatches);
try {
await ElMessageBox.confirm('确认删除选中的运单批次?删除后不可恢复。', '提示', {
type: 'warning',
});
} catch {
return;
}
await api.removeImportBatches(selected.value.map(item => item.id).join(','));
ElMessage.success('删除成功');
return loadBatches();
};
const removeBatch = row => {
const removeBatch = async row => {
if (!canRemoveBatch(row)) {
ElMessage.warning('已完成运单不可删除');
ElMessage.warning('仅未结算的运单批次可以删除');
return;
}
return api.removeImportBatches(row.id).then(loadBatches);
try {
await ElMessageBox.confirm(
`确认删除运单批次「${row.batchNo || ''}」?删除后不可恢复。`,
'提示',
{ type: 'warning' }
);
} catch {
return;
}
await api.removeImportBatches(row.id);
ElMessage.success('删除成功');
return loadBatches();
};
const projectChange = async id => {
const requestId = ++projectRequestId;
@@ -1366,11 +1381,23 @@ const formatOptionalNumber = value => {
const normalized = normalizeOptionalImportNumber(value);
return normalized === null || normalized === undefined ? '' : normalized;
};
// 明细接口返回运单实体字段 startDate/endDate/estimatedStartTime/estimatedEndTime,
// 而明细表与编辑回填按导入列字段名 actualStartDate 等读取,重载后在此对齐,否则实际/预计时间列为空。
const detailDateAliases = {
actualStartDate: 'startDate',
actualEndDate: 'endDate',
planStartDate: 'estimatedStartTime',
planEndDate: 'estimatedEndTime',
};
const normalizeDetailRow = row => {
const next = { ...(row || {}) };
OPTIONAL_NUMBER_PROPS.forEach(prop => {
next[prop] = formatOptionalNumber(next[prop]);
});
Object.entries(detailDateAliases).forEach(([prop, source]) => {
if (String(next[prop] ?? '').trim()) return;
if (String(next[source] ?? '').trim()) next[prop] = next[source];
});
return next;
};
const normalizeImportRow = row => ({
@@ -1200,7 +1200,11 @@
:loading="taskDriverLoading"
:disabled="dialogReadonly"
@select="handleTaskDriverSelect"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item
v-if="isRoadTransport"
@@ -1279,7 +1283,11 @@
:loading="taskEscortLoading"
:disabled="dialogReadonly"
@select="handleTaskEscortSelect"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item v-if="showRoadEscortFields" label="押运人手机号">
<el-input
@@ -1594,6 +1602,13 @@
<el-link type="primary" v-if="canComplete(row)" @click="handleAction('complete', row)">
{{ completeActionLabel }}
</el-link>
<el-link
type="primary"
v-if="canConfirmReturn(row)"
@click="handleAction('confirmReturn', row)"
>
确认回单
</el-link>
<el-link type="primary" v-if="canMaintainMileage(row)" @click="openMileageDialog(row)">
维护里程
</el-link>
@@ -1653,7 +1668,11 @@
style="width: 100%"
@select="handleReassignDriverSelect"
@change="handleReassignDriverChange"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item
label="手机号"
@@ -2252,6 +2271,13 @@
<span v-if="record.volume">体积 {{ record.volume }}方</span>
<span v-if="record.quantity">数量 {{ record.quantity }}</span>
</div>
<!-- 里程只挂在末位节点上(needMileage 由后端下发),显示的是运单里程 -->
<div
v-if="record.needMileage && Number(record.mileage) > 0"
class="waybill-manage-page__punch-record-line"
>
里程 {{ record.mileage }} 公里
</div>
<div
v-if="record.remark"
class="waybill-manage-page__punch-record-line"
@@ -2848,6 +2874,20 @@
/>
</el-form-item>
</el-col>
<!-- 里程只在末位打卡节点出现:后端按「末位 + 计费规则含里程」下发 needMileage,前端不自己推 -->
<el-col v-if="waybillPunchEditMileageVisible" :span="8">
<el-form-item label="里程">
<el-input
v-model="waybillPunchEditForm.mileage"
maxlength="10"
:disabled="waybillPunchEditMileageLocked"
placeholder="请输入"
@input="handleWaybillPunchMileageInput"
>
<template #append>公里</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注">
<el-input
@@ -3683,6 +3723,7 @@ import {
getVoucherImages as getProcessConfigVoucherImages,
} from '@/api/business/process-config';
import {
getList as getWaybillList,
getPunchRecords as getWaybillPunchRecords,
locateVehicle,
savePunchRecord,
@@ -3692,9 +3733,7 @@ import VoucherExecutionDetail from './voucher-execution-detail.vue';
import PunchRecordPhotos from './punch-record-photos.vue';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import { getList as getDriverList } from '@/api/transportCapacity/driver';
import {
fetchDriversByCarrierOrganizations,
} from '@/utils/carrier-org-resource';
import { fetchDriverCandidates, driverOptionText } from '@/utils/carrier-org-resource';
import { getDictionary } from '@/api/system/dictbiz';
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { addressTypeOptions } from '@/option/base/common-address';
@@ -4011,6 +4050,7 @@ export default {
weight: '',
volume: '',
quantity: '',
mileage: '',
remark: '',
photos: [],
},
@@ -4370,9 +4410,15 @@ export default {
addBtn: this.canCreate,
};
},
// 打卡记录编辑入口与运单编辑同权限:能改运单的人才能订正它的打卡流水
// 打卡记录编辑入口与运单编辑同权限:能改运单的人才能订正它的打卡流水。
// 时间轴的「编辑打卡 / 补卡」链接是本页唯一写入入口,提交固定 punched=true。
// 取消打卡不在本页;待回单确认的运单不显示该链接。
canEditWaybillPunchRecord() {
return this.hasPermission(`${this.config.permission}_edit`) && !this.readonlyScope;
return (
this.hasPermission(`${this.config.permission}_edit`) &&
!this.readonlyScope &&
this.statusValue(this.detailRow) !== 'pending_return_confirm'
);
},
waybillPunchEditNode() {
return this.findWaybillPunchEditNodeConfig(this.waybillPunchEditRecord);
@@ -4407,6 +4453,15 @@ export default {
waybillPunchEditPunchDisabled() {
return this.waybillPunchEditNode?.punch === false;
},
// 里程:后端下发 needMileage 才出现(末位打卡节点 + 计费规则含里程);在途打卡不采集里程
waybillPunchEditMileageVisible() {
const record = this.waybillPunchEditRecord || {};
return record.needMileage === true && record.type !== 'enroute';
},
// 已生成结算单的运单里程冻结:输入框置灰,改动由后端拒绝
waybillPunchEditMileageLocked() {
return this.waybillPunchEditRecord?.mileageLocked === true;
},
waybillPunchEditRules() {
return { punchTime: [{ required: true, message: '请选择打卡时间', trigger: 'change' }] };
},
@@ -4800,6 +4855,7 @@ export default {
},
methods: {
formatContractOptionLabel,
driverOptionText,
parseRouteChangeContent,
// 页面被 keep-alive 缓存/卸载时调用,关闭本页所有 append-to-body 的弹窗,
// 避免 Teleport 出去的 DOM 残留在 body 上盖住后续页面(详见 data 里的说明)。
@@ -5099,7 +5155,8 @@ export default {
return false;
}
const status = this.statusValue(row);
return status === 'pending';
// 待回单确认可取消,取消不生成应收应付
return status === 'pending' || status === 'pending_return_confirm';
},
canComplete(row) {
if (
@@ -5111,7 +5168,17 @@ export default {
return false;
}
const status = this.statusValue(row);
return status === 'processing' || status === 'running';
// 待回单确认也可直接完成,不经确认回单
return status === 'processing' || status === 'running' || status === 'pending_return_confirm';
},
canConfirmReturn(row) {
return (
this.hasAction('confirmReturn') &&
this.hasPermission(`${this.config.permission}_complete`) &&
!this.readonlyScope &&
!row.readonly &&
this.statusValue(row) === 'pending_return_confirm'
);
},
canMaintainMileage(row) {
return (
@@ -5926,6 +5993,8 @@ export default {
weight: record.weight || '',
volume: record.volume || '',
quantity: record.quantity || '',
// 里程只有正整数口径,后端若仍下发 "200.00" 会过不了提交时的正整数校验
mileage: Number(record.mileage) > 0 ? String(Number(record.mileage)) : '',
remark: record.remark || '',
photos: (record.photos || [])
.filter(photo => photo?.url)
@@ -6001,10 +6070,22 @@ export default {
photos.splice(index, 1);
this.waybillPunchEditForm.photos = photos;
},
// 里程只收整数:非数字直接丢掉,长度与「维护里程」一致(≤10 位)
handleWaybillPunchMileageInput(value) {
this.waybillPunchEditForm.mileage = String(value || '')
.replace(/\D/g, '')
.slice(0, 10);
},
async submitWaybillPunchRecordEdit() {
await this.$refs.waybillPunchRecordEditFormRef.validate();
const record = this.waybillPunchEditRecord;
const form = this.waybillPunchEditForm;
// 管理端里程选填:留空表示不改动运单里程,所以只校验填了值的情况
const mileageText = String(form.mileage || '').trim();
if (this.waybillPunchEditMileageVisible && mileageText && !/^[1-9]\d{0,9}$/.test(mileageText)) {
this.$message.warning('里程必须为不超过10位的正整数');
return;
}
const submit =
typeof this.api?.savePunchRecord === 'function' ? this.api.savePunchRecord : savePunchRecord;
this.waybillPunchRecordEditDialog.submitting = true;
@@ -6023,6 +6104,8 @@ export default {
weight: form.weight,
volume: form.volume,
quantity: form.quantity,
// 不传代表不改;后端按 null 处理
mileage: mileageText ? Number(mileageText) : undefined,
remark: form.remark,
photos: form.photos.map(photo => ({ url: photo.url, type: photo.type })),
});
@@ -6543,6 +6626,9 @@ export default {
if (status === 'completed') {
return 'primary';
}
if (status === 'pending_return_confirm') {
return 'warning';
}
return 'warning';
},
normalizeRow(row, saveAsDraft = false) {
@@ -7942,19 +8028,10 @@ export default {
this.taskDriverOptions = [];
this.taskEscortOptions = [];
},
getTaskCarrierFilter() {
return {
carrierId: this.form.carrierId || '',
carrierName: this.form.carrierName || '',
};
},
loadTaskDriverOptions() {
if (!this.taskInfoFormEnabled || this.taskDriverLoading) return Promise.resolve([]);
this.taskDriverLoading = true;
return fetchDriversByCarrierOrganizations(
{ size: 9999, posts: '司机' },
this.getTaskCarrierFilter()
)
return fetchDriverCandidates({ size: 9999, posts: '司机' })
.then(records => {
this.taskDriverOptions = records;
return this.taskDriverOptions;
@@ -7965,16 +8042,8 @@ export default {
},
fetchTaskDriverSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getTaskCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.taskDriverLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
)
fetchDriverCandidates({ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' })
.then(records => {
this.taskDriverOptions = records;
callback(
@@ -7994,16 +8063,12 @@ export default {
},
fetchTaskEscortSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getTaskCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.taskEscortLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '押运员' },
carrier
)
fetchDriverCandidates({
size: 20,
...(keyword ? { driverName: keyword } : {}),
posts: '押运员',
})
.then(records => {
this.taskEscortOptions = records;
callback(records.map(item => ({ ...item, value: item.driverName || item.name || '' })));
@@ -10150,8 +10215,14 @@ export default {
cancel: '取消',
complete: this.completeActionLabel,
reassign: '重新派单',
confirmReturn: '确认回单',
}[action];
this.$confirm(`确定${actionName}该${this.config.title}?`, '提示', {
// 确认回单是终态动作(本轮不做撤销),把后果写在提示里,别让人以为还能退回
const confirmText =
action === 'confirmReturn'
? '确认回单后该运单将置为已完成,且不可撤销。是否继续?'
: `确定${actionName}该${this.config.title}?`;
this.$confirm(confirmText, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@@ -10204,20 +10275,8 @@ export default {
},
fetchReassignDriverSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const row = this.reassignDrawer.row || {};
const carrier = {
carrierId: row.carrierId || '',
carrierName: row.carrierName || '',
};
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.reassignDrawer.driverLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
)
fetchDriverCandidates({ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' })
.then(records => {
this.reassignDriverOptions = records;
callback(
@@ -10356,7 +10415,14 @@ export default {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确定完成选中的运单?', '提示', {
const pendingReturnCount = this.selectionList.filter(
row => this.statusValue(row) === 'pending_return_confirm'
).length;
const tip =
pendingReturnCount > 0
? `确定完成选中的运单?其中 ${pendingReturnCount} 条为待回单确认,确认后将转为已完成。`
: '确定完成选中的运单?';
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@@ -10370,25 +10436,38 @@ export default {
this.onLoad(this.page, this.query);
});
},
handleRoadLoading() {
async handleRoadLoading() {
if (!this.selectionList.length) {
this.$message.warning('请选择至少一条数据');
return;
}
const nonRoadWaybills = this.selectionList.filter(row => !this.waybillIsRoadTransport(row));
if (nonRoadWaybills.length) {
this.$message.warning('公路配载仅支持运输方式为“公路运输”的运单');
const selectedIds = this.selectionList.map(row => row.id).filter(Boolean);
if (!selectedIds.length) {
this.$message.warning('请选择至少一条数据');
return;
}
const unavailableWaybills = this.selectionList.filter(
row =>
!['processing', 'running'].includes(this.statusValue(row)) ||
row.loadingId ||
row.loadingManageId ||
row.loadingNo
);
if (unavailableWaybills.length) {
this.$message.warning('公路配载仅支持进行中且未配载的运单');
// 可配载与否只看后端查询结果
let loadableIds;
try {
const res = await getWaybillList(1, selectedIds.length, {
loadableOnly: 1,
ids: selectedIds.join(','),
});
loadableIds = new Set(extractRecords(res).map(row => String(row.id)));
} catch (error) {
this.$message.error('校验运单可配载状态失败,请重试');
return;
}
const rejectedRows = this.selectionList.filter(row => !loadableIds.has(String(row.id)));
if (rejectedRows.length) {
const rejectedText = rejectedRows
.map(row => {
const reason = this.roadLoadingRejectReasonText(row);
const no = row.waybillNo || row.id || '';
return `${no}(${reason})`;
})
.join('、');
this.$message.warning(`${rejectedText};公路配载仅支持公路、待执行且未配载的运单`);
return;
}
try {
@@ -10411,6 +10490,13 @@ export default {
},
});
},
// 只给后端判定为不可配载的运单生成可读原因,本身不参与准入判定
roadLoadingRejectReasonText(row = {}) {
if (!this.waybillIsRoadTransport(row)) return '非公路运输';
if (String(row.businessStatus || '') !== 'pending') return '状态不是待执行';
if (row.loadingNo) return '已关联配载单';
return '运单数据可能已变化,请刷新后重试';
},
},
};
</script>
+362 -30
View File
@@ -8,11 +8,17 @@
<el-form-item label="变更类型" class="contract-basic-section__change-type">
<el-radio-group v-model="form.changeType">
<el-radio label="合同信息变更" />
<el-radio label="结算规则变更" />
<el-radio label="终止合同" />
</el-radio-group>
</el-form-item>
<el-form-item label="签约类型" prop="signType">
<el-select v-model="form.signType" placeholder="请选择签约类型" clearable>
<el-select
v-model="form.signType"
placeholder="请选择签约类型"
clearable
:disabled="isSettlementRuleChange"
>
<el-option
v-for="item in signTypeOptions"
:key="item.value"
@@ -21,8 +27,14 @@
/>
</el-select>
</el-form-item>
<el-form-item label="合同编号">
<el-input v-model="form.contractNo" disabled />
<el-form-item label="合同编号" prop="contractNo">
<el-input
v-model="form.contractNo"
maxlength="100"
clearable
placeholder="请输入合同编号"
:disabled="isSettlementRuleChange"
/>
</el-form-item>
<el-form-item label="合同名称" prop="contractName">
<el-input
@@ -30,6 +42,7 @@
maxlength="100"
show-word-limit
placeholder="请输入合同名称"
:disabled="isSettlementRuleChange"
/>
</el-form-item>
<el-form-item label="合同类型">
@@ -80,6 +93,7 @@
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="请输入"
:disabled="isSettlementRuleChange"
/>
<span>至</span>
<el-date-picker
@@ -88,6 +102,7 @@
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="请输入"
:disabled="isSettlementRuleChange"
/>
</div>
</el-form-item>
@@ -95,6 +110,7 @@
<el-input
v-model="form.paymentDays"
placeholder="请输入"
:disabled="isSettlementRuleChange"
@input="value => positiveIntegerInput('paymentDays', value)"
>
<template #suffix>天</template>
@@ -105,22 +121,36 @@
:model-value="contractAmountDisplay"
placeholder="请输入"
clearable
:disabled="isSettlementRuleChange"
@input="handleContractAmountInput"
@blur="formatContractAmountField"
@clear="form.contractAmount = null"
/>
</el-form-item>
<el-form-item label="是否范本">
<el-select v-model="form.templateFlag" placeholder="请选择">
<el-select
v-model="form.templateFlag"
placeholder="请选择"
:disabled="isSettlementRuleChange"
>
<el-option label="否" :value="0" />
<el-option label="是" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="原件合同编号">
<el-input v-model="form.originalContractNo" maxlength="100" placeholder="请输入" />
<el-input
v-model="form.originalContractNo"
maxlength="100"
placeholder="请输入"
:disabled="isSettlementRuleChange"
/>
</el-form-item>
<el-form-item label="是否电子章">
<el-select v-model="form.electronicSealFlag" placeholder="请选择">
<el-select
v-model="form.electronicSealFlag"
placeholder="请选择"
:disabled="isSettlementRuleChange"
>
<el-option label="否" :value="0" />
<el-option label="是" :value="1" />
</el-select>
@@ -129,13 +159,19 @@
<el-input
v-model="form.invoiceCycle"
placeholder="请输入"
:disabled="isSettlementRuleChange"
@input="value => positiveIntegerInput('invoiceCycle', value)"
>
<template #suffix>天</template>
</el-input>
</el-form-item>
<el-form-item label="结算币种" prop="settlementCurrency">
<el-select v-model="form.settlementCurrency" placeholder="请选择结算币种" clearable>
<el-select
v-model="form.settlementCurrency"
placeholder="请选择结算币种"
clearable
:disabled="isSettlementRuleChange"
>
<el-option
v-for="item in settlementCurrencyOptions"
:key="item.value"
@@ -145,7 +181,12 @@
</el-select>
</el-form-item>
<el-form-item label="合同格式">
<el-select v-model="form.contractFormat" placeholder="请选择合同格式" clearable>
<el-select
v-model="form.contractFormat"
placeholder="请选择合同格式"
clearable
:disabled="isSettlementRuleChange"
>
<el-option
v-for="item in contractFormatOptions"
:key="item.value"
@@ -158,19 +199,30 @@
<el-input
v-model="form.copyCount"
placeholder="请输入"
:disabled="isSettlementRuleChange"
@input="value => positiveIntegerInput('copyCount', value)"
>
<template #suffix>份</template>
</el-input>
</el-form-item>
<el-form-item label="是否需要加盖法人章">
<el-select v-model="form.legalSealFlag" placeholder="请选择" clearable>
<el-select
v-model="form.legalSealFlag"
placeholder="请选择"
clearable
:disabled="isSettlementRuleChange"
>
<el-option label="否" :value="0" />
<el-option label="是" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="结算方式">
<el-select v-model="form.settlementMode" placeholder="请选择结算方式" clearable>
<el-select
v-model="form.settlementMode"
placeholder="请选择结算方式"
clearable
:disabled="isSettlementRuleChange"
>
<el-option
v-for="item in settlementModeOptions"
:key="item.value"
@@ -191,6 +243,7 @@
maxlength="1000"
show-word-limit
placeholder="请输入合同主要内容"
:disabled="isSettlementRuleChange"
/>
</el-form-item>
<el-form-item label="其他事项说明" class="contract-basic-section__remark">
@@ -201,14 +254,21 @@
maxlength="200"
show-word-limit
placeholder="请输入其他事项说明"
:disabled="isSettlementRuleChange"
/>
</el-form-item>
<!-- 风险客商提示:合同已推送合规并留痕高风险/黑名单时展示,变更提交同样要求特批附件 -->
<div v-if="riskTipText" class="contract-manage-form__risk-tip">
<div class="contract-manage-form__risk-tip-title">风险客商提示:</div>
<div class="contract-manage-form__risk-tip-content">{{ riskTipText }}</div>
</div>
</section>
<contract-attachment-section
title="用印材料"
description
attachment-type
:readonly="isSettlementRuleChange"
:attachment-location-options="changeAttachmentLocationOptions"
:rows="contractFileRows"
:preview="previewAttachment"
@@ -219,12 +279,36 @@
<section class="change-section">
<div class="section-head">
<div class="dialog-section-title">计费信息</div>
<el-button v-if="feeGenerationMode !== 'manual'" type="primary" plain @click="addPlan"
<el-button
v-if="feeGenerationMode !== 'manual'"
type="primary"
plain
@click="addPlan"
>添加</el-button
>
</div>
<el-radio-group v-model="feeGenerationMode"><el-radio label="system">系统生成</el-radio><el-radio label="manual">账单导入生成</el-radio></el-radio-group>
<el-table :data="plans" border class="change-table"><el-table-column type="index" label="序号" width="70" /><el-table-column prop="planName" label="方案名称" min-width="220" /><el-table-column label="默认方案" min-width="120"><template #default="{ row }">{{ row.defaultPlan ? '是' : '否' }}</template></el-table-column><el-table-column prop="remark" label="备注" min-width="260" /><el-table-column label="操作" width="180"><template #default="{ row, $index }"><el-link type="primary" @click="editPlan(row, $index)">编辑</el-link><el-link type="danger" @click="plans.splice($index, 1)">删除</el-link></template></el-table-column></el-table>
<el-radio-group v-model="feeGenerationMode"
><el-radio label="system">系统生成</el-radio
><el-radio label="manual">账单导入生成</el-radio></el-radio-group
>
<el-table :data="plans" border class="change-table"
><el-table-column type="index" label="序号" width="70" /><el-table-column
prop="planName"
label="方案名称"
min-width="220"
/><el-table-column label="默认方案" min-width="120"
><template #default="{ row }">{{
row.defaultPlan ? '是' : '否'
}}</template></el-table-column
><el-table-column prop="remark" label="备注" min-width="260" /><el-table-column
label="操作"
width="180"
><template #default="{ row, $index }"
><el-link type="primary" @click="editPlan(row, $index)">编辑</el-link
><el-link type="danger" @click="plans.splice($index, 1)">删除</el-link></template
></el-table-column
></el-table
>
</section>
<section class="change-section">
@@ -243,19 +327,106 @@
<el-radio :label="0">关闭</el-radio>
</el-radio-group>
</div>
<el-form v-if="settlementRule.autoGenerate === 1" :model="settlementRule" label-position="right" label-width="auto" class="settlement-form">
<el-form-item label="账单起始日" required><el-date-picker v-model="settlementRule.billStartDate" type="date" placeholder="请选择账单起始日" format="YYYY-MM-DD" value-format="YYYY-MM-DD" /></el-form-item>
<el-form-item label="结算类型" required><el-select v-model="settlementRule.settlementType" placeholder="请选择结算类型" @change="handleSettlementTypeChange"><el-option v-for="item in settlementTypeOptions" :key="item" :label="item" :value="item" /></el-select></el-form-item>
<el-form-item v-if="showSettlementBillCycleType" label="结算周期" required><el-select v-model="settlementRule.billCycleType" placeholder="请选择结算周期" @change="handleCycleTypeChange"><el-option v-for="item in billCycleTypeOptions" :key="item" :label="item" :value="item" /></el-select></el-form-item>
<el-form-item v-if="showSettlementBillCutoffDay" label="账单截单日" required><el-select v-model="settlementRule.billCutoffDay" placeholder="请选择账单截单日"><el-option v-for="item in billCutoffDayOptions" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item>
<el-form-item v-if="showSettlementCycleDays" label="周期天数" required><el-select v-model="settlementRule.cycleDays" placeholder="请选择周期天数"><el-option v-for="item in cycleDayOptions" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item>
<el-form
v-if="settlementRule.autoGenerate === 1"
:model="settlementRule"
label-position="right"
label-width="auto"
class="settlement-form"
>
<el-form-item label="账单起始日" required
><el-date-picker
v-model="settlementRule.billStartDate"
type="date"
placeholder="请选择账单起始日"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
/></el-form-item>
<el-form-item label="结算类型" required
><el-select
v-model="settlementRule.settlementType"
placeholder="请选择结算类型"
@change="handleSettlementTypeChange"
><el-option
v-for="item in settlementTypeOptions"
:key="item"
:label="item"
:value="item"
/></el-select></el-form-item>
<el-form-item v-if="showSettlementBillCycleType" label="结算周期" required
><el-select
v-model="settlementRule.billCycleType"
placeholder="请选择结算周期"
@change="handleCycleTypeChange"
><el-option
v-for="item in billCycleTypeOptions"
:key="item"
:label="item"
:value="item"
/></el-select></el-form-item>
<el-form-item v-if="showSettlementBillCutoffDay" label="账单截单日" required
><el-select v-model="settlementRule.billCutoffDay" placeholder="请选择账单截单日"
><el-option
v-for="item in billCutoffDayOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/></el-select></el-form-item>
<el-form-item v-if="showSettlementCycleDays" label="周期天数" required
><el-select v-model="settlementRule.cycleDays" placeholder="请选择周期天数"
><el-option
v-for="item in cycleDayOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/></el-select></el-form-item>
</el-form>
<el-table v-if="settlementRule.autoGenerate === 1 && showSettlementCustomPeriods" :data="settlementRule.customPeriods || []" border class="change-table custom-periods-table">
<el-table
v-if="settlementRule.autoGenerate === 1 && showSettlementCustomPeriods"
:data="settlementRule.customPeriods || []"
border
class="change-table custom-periods-table"
>
<el-table-column type="index" label="序号" width="70" />
<el-table-column label="运单区间-开始日" min-width="180"><template #default="{ row, $index }"><el-select :model-value="row.startDay" placeholder="请选择" clearable @update:model-value="value => handleCustomPeriodStartDayChange($index, value)"><el-option v-for="item in billCutoffDayOptions" :key="`start-${item.value}`" :label="item.label" :value="item.value" /></el-select></template></el-table-column>
<el-table-column label="运单区间-结束日" min-width="200"><template #default="{ row, $index }"><el-select :model-value="row.endDay" placeholder="请选择" clearable @update:model-value="value => handleCustomPeriodEndDayChange($index, value)"><el-option v-for="item in customPeriodEndDayOptions(row)" :key="item.value" :label="item.label" :value="item.value" /></el-select></template></el-table-column>
<el-table-column label="操作" width="100"><template #default="{ $index }"><el-link v-if="$index === 0" type="primary" @click="addCustomPeriodRow">添加</el-link><el-link v-else type="danger" @click="removeCustomPeriodRow($index)">删除</el-link></template></el-table-column>
<template #empty><el-link type="primary" @click="addCustomPeriodRow">添加</el-link></template>
<el-table-column label="运单区间-开始日" min-width="180"
><template #default="{ row, $index }"
><el-select
:model-value="row.startDay"
placeholder="请选择"
clearable
@update:model-value="value => handleCustomPeriodStartDayChange($index, value)"
><el-option
v-for="item in billCutoffDayOptions"
:key="`start-${item.value}`"
:label="item.label"
:value="item.value"
/></el-select></template
></el-table-column>
<el-table-column label="运单区间-结束日" min-width="200"
><template #default="{ row, $index }"
><el-select
:model-value="row.endDay"
placeholder="请选择"
clearable
@update:model-value="value => handleCustomPeriodEndDayChange($index, value)"
><el-option
v-for="item in customPeriodEndDayOptions(row)"
:key="item.value"
:label="item.label"
:value="item.value"
/></el-select></template
></el-table-column>
<el-table-column label="操作" width="100"
><template #default="{ $index }"
><el-link v-if="$index === 0" type="primary" @click="addCustomPeriodRow">添加</el-link
><el-link v-else type="danger" @click="removeCustomPeriodRow($index)"
>删除</el-link
></template
></el-table-column
>
<template #empty
><el-link type="primary" @click="addCustomPeriodRow">添加</el-link></template
>
</el-table>
</section>
@@ -263,17 +434,48 @@
<div class="dialog-section-title">
付款比例设置
<el-tooltip content="非必填;配置付款比例时,合计必须等于100%。" placement="top">
<el-icon style="margin-left: 4px; color: #909399; cursor: pointer"><el-icon-question-filled /></el-icon>
<el-icon style="margin-left: 4px; color: #909399; cursor: pointer"
><el-icon-question-filled
/></el-icon>
</el-tooltip>
</div>
<el-table :data="paymentRatioRows" border class="change-table">
<el-table-column type="index" label="序号" width="70" />
<el-table-column prop="paymentTerm" label="付款笔数" min-width="180" />
<el-table-column label="付款比例上限(%)" min-width="220"><template #default="{ row }"><el-input-number v-model="row.ratioLimit" :min="0" :max="100" :precision="2" controls-position="right" /></template></el-table-column>
<el-table-column label="备注" min-width="220"><template #default="{ row }"><el-input v-model="row.remark" maxlength="200" /></template></el-table-column>
<el-table-column label="操作" width="100"><template #default="{ $index }"><el-link type="danger" @click="paymentRatioRows.splice($index, 1)">删除</el-link></template></el-table-column>
<el-table-column label="付款比例上限(%)" min-width="220"
><template #default="{ row }"
><el-input-number
v-model="row.ratioLimit"
:min="0"
:max="100"
:precision="2"
controls-position="right"
:disabled="isSettlementRuleChange"
/></template
></el-table-column>
<el-table-column label="备注" min-width="220"
><template #default="{ row }"
><el-input
v-model="row.remark"
maxlength="200"
:disabled="isSettlementRuleChange"
/></template
></el-table-column>
<el-table-column v-if="!isSettlementRuleChange" label="操作" width="100"
><template #default="{ $index }"
><el-link type="danger" @click="paymentRatioRows.splice($index, 1)"
>删除</el-link
></template
></el-table-column
>
</el-table>
<el-button type="primary" plain @click="addPaymentRatioRow">添加</el-button>
<el-button
v-if="!isSettlementRuleChange"
type="primary"
plain
@click="addPaymentRatioRow"
>添加</el-button
>
</section>
<billing-plan-editor
@@ -290,6 +492,7 @@
attachment-type
attachment-location="附件(佐证材料等)"
attachment-type-dict-code="contract_supporting_attachment_type"
:readonly="isSettlementRuleChange"
:attachment-location-options="changeAttachmentLocationOptions"
:rows="attachments"
:preview="previewAttachment"
@@ -470,6 +673,24 @@ export default {
'按数量',
],
rules: {
contractNo: [
{
validator: (rule, value, callback) => {
if (this.isSettlementRuleChange) {
return callback();
}
const contractNo = String(value || '').trim();
if (!contractNo) {
return callback(new Error('请输入合同编号'));
}
if (contractNo.length > 100) {
return callback(new Error('合同编号不能超过100个字符'));
}
callback();
},
trigger: 'blur',
},
],
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
contractAmount: [
{ required: true, message: '请输入合同金额', trigger: 'blur' },
@@ -494,7 +715,24 @@ export default {
pageTitle() {
return this.$route.query.name || '合同变更';
},
// 高风险/黑名单客商提示:按合同推送合规留痕 hcs_risk_level/hcs_black_status 判定(与合同详情口径一致)
riskTipText() {
const riskLevel = String(this.form.hcsRiskLevel || '').trim();
const blacklist = String(this.form.hcsBlackStatus || '').toLowerCase() === 'yes';
if (riskLevel !== '2' && !blacklist) return '';
const parties = [this.form.partyA, this.form.partyB]
.map(name => String(name || '').trim())
.filter(Boolean)
.join('、');
return `【${parties || '相对方'}】:被列入外部黑名单;涉贪污受贿裁判相关提及方(3年以上及其他);被执行人信息;买卖合同纠纷;劳动纠纷;重大纠纷。提交变更前须上传「特批附件」类型附件`;
},
isSettlementRuleChange() {
return this.form.changeType === '结算规则变更';
},
changeAttachmentLocationOptions() {
if (this.isSettlementRuleChange) {
return ['变更材料'];
}
return ['用印材料', '附件(佐证材料等)', '变更材料'];
},
contractAmountDisplay() {
@@ -720,6 +958,12 @@ export default {
previewAttachment(row, rows = this.attachments) { const url = this.attachmentUrl(row); if (!url) { this.$message.warning('附件地址为空,无法预览'); return; } if (this.isAttachmentImage(row)) { this.imagePreviewUrls = (rows || []).filter(item => this.isAttachmentImage(item) && this.attachmentUrl(item)).map(item => this.attachmentUrl(item)); this.imagePreviewIndex = Math.max(this.imagePreviewUrls.indexOf(url), 0); this.imagePreviewVisible = true; return; } this.previewFile = { name: this.attachmentName(row), url, mimeType: row.mimeType || row.contentType || '' }; this.documentPreviewVisible = true; },
handleAttachmentUploadToLocation({ location, rows = [] }) {
if (!rows.length) return;
if (this.isSettlementRuleChange) {
if (location === '变更材料') {
this.changeMaterials = [...(this.changeMaterials || []), ...rows];
}
return;
}
if (isContractSealMaterialLocation(location)) {
this.contractFileRows = [...(this.contractFileRows || []), ...rows];
return;
@@ -743,7 +987,91 @@ export default {
removeCustomPeriodRow(index) { if (index <= 0) return; const periods = [...(this.settlementRule.customPeriods || [])]; periods.splice(index, 1); this.settlementRule.customPeriods = normalizeCustomPeriods(periods); },
validateCustomPeriods(periods = [], label) { const rows = normalizeCustomPeriods(periods); if (!rows.length) { this.$message.warning(`${label}:请至少配置一段自定义周期`); return false; } for (let index = 0; index < rows.length; index += 1) { const row = rows[index]; const startDay = Number(row.startDay); const endDay = Number(row.endDay); if (!Number.isFinite(startDay) || startDay < 1 || startDay > 31) { this.$message.warning(`${label}:请选择第${index + 1}行运单区间开始日`); return false; } if (!Number.isFinite(endDay) || endDay < 1 || endDay > 31) { this.$message.warning(`${label}:请选择第${index + 1}行运单区间结束日`); return false; } if (endDay < startDay) { this.$message.warning(`${label}:第${index + 1}行结束日不能早于开始日`); return false; } if (index > 0 && startDay !== Number(rows[index - 1].endDay) + 1) { this.$message.warning(`${label}:自定义多周期区间必须连续,不允许重叠或存在日期缺口`); return false; } } return true; },
validateSettlementRule(rule, label) { if (Number(rule.autoGenerate) !== 1) return true; if (!rule.billStartDate || !rule.settlementType) { this.$message.warning(`${label}:请完整填写账单起始日和结算类型`); return false; } if (rule.settlementType === '月结' && !rule.billCycleType) { this.$message.warning(`${label}:请选择结算周期`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '固定截单日' && !rule.billCutoffDay) { this.$message.warning(`${label}:请选择账单截单日`); return false; } if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') return this.validateCustomPeriods(rule.customPeriods, label); if (rule.settlementType === '固定天数周期结算' && !rule.cycleDays) { this.$message.warning(`${label}:请选择周期天数`); return false; } return true; },
async submit() { await this.$refs.formRef.validate(); const total = this.paymentRatioRows.reduce((sum, row) => sum + Number(row.ratioLimit || 0), 0); if (this.paymentRatioRows.length && Math.abs(total - 100) > 0.0001) { this.$message.warning('付款比例上限合计必须等于100%'); return; } if (this.settlementConfigTab === 'pre') this.preSettlementConfig = { ...this.settlementRule }; else this.formalSettlementConfig = { ...this.settlementRule }; if (!this.validateSettlementRule(this.preSettlementConfig, '预结算配置') || !this.validateSettlementRule(this.formalSettlementConfig, '正式结算配置')) return; const settlementRule = { preSettlementConfig: this.preSettlementConfig, formalSettlementConfig: this.formalSettlementConfig }; await api.submitChange({ ...this.form, settlementCurrency: String(this.form.settlementCurrency || '').trim() || 'RMB', copyCount: normalizeOptionalPositiveInteger(this.form.copyCount), invoiceCycle: normalizeOptionalPositiveInteger(this.form.invoiceCycle), paymentDays: normalizeOptionalPositiveInteger(this.form.paymentDays), contractAmount: normalizeOptionalAmount(this.form.contractAmount), startDate: this.period[0], endDate: this.period[1], feeGenerationMode: this.feeGenerationMode, billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0, billingPlanJson: JSON.stringify(this.plans), settlementRuleJson: JSON.stringify(settlementRule), preSettlementConfigJson: JSON.stringify(this.preSettlementConfig), formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig), paymentRatioJson: JSON.stringify(this.paymentRatioRows), contractFileJson: JSON.stringify(this.contractFileRows), attachmentsJson: JSON.stringify(this.attachments), changeContent: this.form.changeContent, changeReason: this.form.changeReason, changeAttachmentsJson: JSON.stringify(this.changeMaterials) }); await submitMkApprovalFlow({ bizType: 'contract-manage', bizId: this.form.id, subjectName: this.form.contractName || '', approvalStatus: this.form.approvalStatus || 'change_rejected', mkEnabled: await loadMkEnabled().catch(() => false) }); this.$message.success('变更已提交'); this.$router.back(); },
async submit() {
if (this.form.changeType === '终止合同') {
await api.terminate(this.form.id, this.form.changeReason);
this.$message.success('合同已终止');
this.$router.back();
return;
}
await this.$refs.formRef.validate();
if (!this.isSettlementRuleChange) {
const contractNo = String(this.form.contractNo || '').trim();
if (!contractNo) {
this.$message.warning('请输入合同编号');
return;
}
if (contractNo.length > 100) {
this.$message.warning('合同编号不能超过100个字符');
return;
}
this.form.contractNo = contractNo;
const total = this.paymentRatioRows.reduce((sum, row) => sum + Number(row.ratioLimit || 0), 0);
if (this.paymentRatioRows.length && Math.abs(total - 100) > 0.0001) {
this.$message.warning('付款比例上限合计必须等于100%');
return;
}
}
if (this.settlementConfigTab === 'pre') this.preSettlementConfig = { ...this.settlementRule };
else this.formalSettlementConfig = { ...this.settlementRule };
if (
!this.validateSettlementRule(this.preSettlementConfig, '预结算配置') ||
!this.validateSettlementRule(this.formalSettlementConfig, '正式结算配置')
) {
return;
}
const settlementRule = {
preSettlementConfig: this.preSettlementConfig,
formalSettlementConfig: this.formalSettlementConfig,
};
const payload = this.isSettlementRuleChange
? {
id: this.form.id,
changeType: this.form.changeType,
changeContent: this.form.changeContent,
changeReason: this.form.changeReason,
feeGenerationMode: this.feeGenerationMode,
billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0,
billingPlanJson: JSON.stringify(this.plans),
settlementRuleJson: JSON.stringify(settlementRule),
preSettlementConfigJson: JSON.stringify(this.preSettlementConfig),
formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig),
changeAttachmentsJson: JSON.stringify(this.changeMaterials),
}
: {
...this.form,
changeType: this.form.changeType || '合同信息变更',
settlementCurrency: String(this.form.settlementCurrency || '').trim() || 'RMB',
copyCount: normalizeOptionalPositiveInteger(this.form.copyCount),
invoiceCycle: normalizeOptionalPositiveInteger(this.form.invoiceCycle),
paymentDays: normalizeOptionalPositiveInteger(this.form.paymentDays),
contractAmount: normalizeOptionalAmount(this.form.contractAmount),
startDate: this.period[0],
endDate: this.period[1],
feeGenerationMode: this.feeGenerationMode,
billingEnabled: this.feeGenerationMode === 'system' ? 1 : 0,
billingPlanJson: JSON.stringify(this.plans),
settlementRuleJson: JSON.stringify(settlementRule),
preSettlementConfigJson: JSON.stringify(this.preSettlementConfig),
formalSettlementConfigJson: JSON.stringify(this.formalSettlementConfig),
paymentRatioJson: JSON.stringify(this.paymentRatioRows),
contractFileJson: JSON.stringify(this.contractFileRows),
attachmentsJson: JSON.stringify(this.attachments),
changeContent: this.form.changeContent,
changeReason: this.form.changeReason,
changeAttachmentsJson: JSON.stringify(this.changeMaterials),
};
await api.submitChange(payload);
await submitMkApprovalFlow({
bizType: 'contract-manage',
bizId: this.form.id,
subjectName: this.form.contractName || '',
approvalStatus: this.form.approvalStatus || 'change_rejected',
mkEnabled: await loadMkEnabled().catch(() => false),
});
this.$message.success('变更已提交');
this.$router.back();
},
},
};
</script>
@@ -767,6 +1095,10 @@ export default {
}
.contract-basic-section__date-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; width: 360px; max-width: 100%; }
.contract-basic-section__date-range span { color: #606266; }
// 风险客商提示条(基本信息备注后):橙黄背景 + 红色文字,与合同新增页一致
.contract-manage-form__risk-tip { margin: 0 0 18px; padding: 10px 16px; background: #faecd8; border-radius: 4px; }
.contract-manage-form__risk-tip-title { color: #f56c6c; font-weight: 600; line-height: 22px; }
.contract-manage-form__risk-tip-content { color: #f56c6c; line-height: 22px; }
.contract-basic-section__date-range :deep(.el-date-editor) { width: auto; min-width: 0; }
.contract-basic-section :deep(.el-form-item) { align-items: center; }
.contract-basic-section :deep(.el-form-item__label) { flex: 0 0 96px !important; width: 96px !important; height: auto; padding-right: 12px; white-space: normal; word-break: break-all; line-height: 18px; }
+299 -18
View File
@@ -32,6 +32,14 @@
>
批量导出
</el-button>
<el-button
type="warning"
plain
:loading="hcsRepushingId === 'batch'"
@click="handleHcsBatchRepush"
>
<el-icon class="el-icon--left"><Position /></el-icon>批量推送合规
</el-button>
</template>
<template #header>
@@ -72,6 +80,18 @@
</el-tag>
</template>
<template #hcsSyncStatus="{ row }">
<el-tooltip v-if="row.hcsSyncMsg" placement="top" :content="row.hcsSyncMsg">
<el-tag :type="hcsSyncTagType(row.hcsSyncStatus)" class="status-text">
{{ hcsSyncLabel(row.hcsSyncStatus) }}
</el-tag>
</el-tooltip>
<el-tag v-else-if="row.hcsSyncStatus" :type="hcsSyncTagType(row.hcsSyncStatus)" class="status-text">
{{ hcsSyncLabel(row.hcsSyncStatus) }}
</el-tag>
<span v-else>-</span>
</template>
<template #menu="{ row }">
<el-link
v-if="hasPermission(`${config.permission}_view`)"
@@ -92,6 +112,9 @@
>
{{ operation.label }}
</el-link>
<el-link v-if="canHcsRepush(row)" type="warning" @click="handleHcsRepush(row)">
{{ hcsRepushingId === row.id ? '推送中…' : '推送合规' }}
</el-link>
<el-link v-if="canDelete(row)" type="danger" @click="removeRow(row)">删除</el-link>
</template>
</avue-crud>
@@ -180,9 +203,18 @@
<el-descriptions-item label="其他事项说明" :span="3">{{
detailValue('remark')
}}</el-descriptions-item>
<el-descriptions-item v-if="detailRiskTipText" label="风险客商提示" :span="3">
<span style="color: #f56c6c">{{ detailRiskTipText }}</span>
</el-descriptions-item>
</el-descriptions>
</section>
<hcs-contract-panel
v-if="!isPublicViewPage"
:contract="detailRow"
@refresh="initDetailPage"
/>
<contract-attachment-section
title="用印材料"
description
@@ -302,6 +334,7 @@
<contract-attachment-section
title="附件(佐证材料等)"
description
attachment-type
readonly
:rows="detailAttachmentRows"
:preview="previewAttachment"
@@ -380,17 +413,15 @@
/>
</el-select>
</el-form-item>
<el-form-item label="合同编号">
<el-form-item label="合同编号" prop="contractNo">
<el-input
v-model="form.contractNo"
disabled
maxlength="100"
clearable
:placeholder="
formMode === 'add'
? form.organizationId
? '系统按部门规则自动生成'
: '请先选择合同负责部门'
: ''
formMode === 'add' ? '不填写则按部门规则自动生成' : '请输入合同编号'
"
@input="handleContractNoInput"
/>
</el-form-item>
<el-form-item label="合同名称" prop="contractName">
@@ -448,6 +479,7 @@
clearable
:loading="contractPartyLoading"
@visible-change="visible => visible && loadContractPartyOptions()"
@change="queryPartyRisk('partyA')"
>
<el-option
v-for="item in contractPartyAOptions"
@@ -465,6 +497,7 @@
clearable
:loading="contractPartyLoading"
@visible-change="visible => visible && loadContractPartyOptions()"
@change="queryPartyRisk('partyB')"
>
<el-option
v-for="item in contractPartyBOptions"
@@ -619,6 +652,11 @@
placeholder="请输入其他事项说明"
/>
</el-form-item>
<!-- 风险客商提示(基本信息备注后):外部客商高风险/黑名单时展示,文案由后端 riskTip 拼装 -->
<div v-if="partyRiskText" class="contract-manage-form__risk-tip">
<div class="contract-manage-form__risk-tip-title">风险客商提示:</div>
<div class="contract-manage-form__risk-tip-content">{{ partyRiskText }}</div>
</div>
</section>
<contract-attachment-section
@@ -1051,6 +1089,8 @@ import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { exportBlob } from '@/api/common';
import * as api from '@/api/business/contract-manage';
import { repush as hcsRepush, repushBatch as hcsRepushBatch, getRisk } from '@/api/business/hcs';
import { Position } from '@element-plus/icons-vue';
import { getMkPublicDetail } from '@/api/mk-process';
import { getList as getProjectList } from '@/api/business/project-apply';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
@@ -1071,6 +1111,7 @@ import ContractAttachmentSection, {
isContractSupportingAttachmentLocation,
normalizeContractFileRows,
} from './components/contract-attachment-section.vue';
import HcsContractPanel from './components/hcs-contract-panel.vue';
import PdfPreview from '@/components/pdf-preview/main.vue';
import { ElImageViewer, ElCascader } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue';
@@ -1176,6 +1217,11 @@ const createCopiedDetail = (detail = {}) => {
Object.keys(form).forEach(prop => {
if (Object.prototype.hasOwnProperty.call(detail, prop)) form[prop] = detail[prop];
});
// 特批附件属于原合同的特批佐证,复制后须对新合同重新上传,否则会绕过高风险/黑名单校验
const stripSpecAttachments = value => {
const rows = parseArray(value).filter(item => item?.fileType !== '特批附件');
return rows.length ? JSON.stringify(rows) : '';
};
return {
...form,
contractNo: '',
@@ -1183,8 +1229,8 @@ const createCopiedDetail = (detail = {}) => {
archiveStatus: '未归档',
feeGenerationMode: detail.feeGenerationMode || '',
billingEnabled: detail.billingEnabled,
contractFileJson: detail.contractFileJson || '',
attachmentsJson: detail.attachmentsJson || '',
contractFileJson: stripSpecAttachments(detail.contractFileJson),
attachmentsJson: stripSpecAttachments(detail.attachmentsJson),
billingPlanJson: detail.billingPlanJson || '',
paymentRatioJson: detail.paymentRatioJson || '',
settlementRuleJson: detail.settlementRuleJson || '',
@@ -1243,9 +1289,11 @@ export default {
ContractAttachmentSection,
BillingPlanEditor,
ChangeRecordDetailDialog,
HcsContractPanel,
ElImageViewer,
OpenFileViewer,
PdfPreview,
Position,
},
data() {
return {
@@ -1268,7 +1316,23 @@ export default {
{ label: '已到期', value: 'expired', statKey: 'expired' },
],
form: defaultForm(),
contractNoManual: false,
formRules: {
contractNo: [
{
validator: (rule, value, callback) => {
const contractNo = String(value || '').trim();
if (this.formMode === 'edit' && !contractNo) {
return callback(new Error('请输入合同编号'));
}
if (contractNo.length > 100) {
return callback(new Error('合同编号不能超过100个字符'));
}
callback();
},
trigger: 'blur',
},
],
contractName: [{ required: true, message: '请输入合同名称', trigger: 'blur' }],
contractCategory: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
signType: [{ required: true, message: '请选择签约类型', trigger: 'change' }],
@@ -1321,6 +1385,9 @@ export default {
contractCategoryDictOptions: [],
contractPartyAOptions: [],
contractPartyBOptions: [],
// 合规客商风险(C101-1 展示用):甲方/乙方选择后即时查询
contractPartyCodeMap: {},
partyRisk: {},
contractPartyLoading: false,
contractPartyRequestId: 0,
organizationOptions: [],
@@ -1359,6 +1426,8 @@ export default {
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
detailLoading: false,
detailRow: {},
// 合规(HCS)推送/对账状态
hcsRepushingId: null,
detailContractFileRows: [],
detailAttachmentRows: [],
detailBillingPlanRows: [],
@@ -1535,6 +1604,32 @@ export default {
const endDate = this.detailRow.endDate || '-';
return `${startDate} 至 ${endDate}`;
},
// 高风险/黑名单客商签约提示(C101-1,签约前提示;强制拦截在后端提交校验与推送链路)
partyRiskText() {
const parts = [];
['partyA', 'partyB'].forEach(prop => {
const risk = this.partyRisk[prop];
if (!risk?.risky) return;
// riskTip 由后端按风险项拼装(【公司名称】:黑名单;涉诉;被执行人等),缺失时兜底通用提示
parts.push(
risk.riskTip ||
`${prop === 'partyA' ? '甲方' : '乙方'}[${this.form[prop] || ''}]为高风险/黑名单客商`
);
});
if (!parts.length) return '';
return `${parts.join(';')},按集团规定不可直接签约,提交前须上传「特批附件」类型附件,审批通过后将自动发起合同特批`;
},
// 详情风险客商提示(基本信息备注后展示):按推送留痕 hcs_risk_level/hcs_black_status 判定(甲乙取高/任一),文案与后端 riskTip 一致
detailRiskTipText() {
const riskLevel = String(this.detailRow.hcsRiskLevel || '').trim();
const blacklist = String(this.detailRow.hcsBlackStatus || '').toLowerCase() === 'yes';
if (riskLevel !== '2' && !blacklist) return '';
const parties = [this.detailRow.partyA, this.detailRow.partyB]
.map(name => String(name || '').trim())
.filter(Boolean)
.join('、');
return `【${parties || '相对方'}】:被列入外部黑名单;涉贪污受贿裁判相关提及方(3年以上及其他);被执行人信息;买卖合同纠纷;劳动纠纷;重大纠纷`;
},
detailLegalSealText() {
const value = this.detailRow.legalSealFlag;
if (value === undefined || value === null || value === '') return '-';
@@ -1656,6 +1751,92 @@ export default {
if (stage === 'terminated') return 'danger';
return 'info';
},
// ==================== 合规(HCS)推送/对账(照“同步金蝶”按钮模式) ====================
hcsSyncLabel(value) {
return { unsynced: '待推送', synced: '已推送', failed: '推送失败' }[value] || value;
},
hcsSyncTagType(value) {
return { unsynced: 'info', synced: 'success', failed: 'danger' }[value] || 'info';
},
canHcsRepush(row) {
return (
['approved', 'change_approved'].includes(row.approvalStatus) &&
row.hcsSyncStatus !== 'synced'
);
},
handleHcsRepush(row) {
if (this.hcsRepushingId) return;
this.$confirm('确定推送该数据到合同合规系统?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// 同步推送合规耗时较长,加遮罩防重复操作(照审批通过遮罩)
const loading = this.$loading({
lock: true,
text: '正在推送合规,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
this.hcsRepushingId = row.id;
hcsRepush('contract', row.id)
.then(res => {
if (res.data?.success === false) {
this.$message.error(res.data?.msg || '推送合规失败');
return;
}
this.$message.success(res.data?.data || '推送合规成功');
this.onLoad(this.page, this.query);
})
.catch(() => {
// 失败原因由 axios 拦截器统一弹出后端 msg,此处不再重复提示
})
.finally(() => {
this.hcsRepushingId = null;
loading.close();
});
});
},
handleHcsBatchRepush() {
if (this.hcsRepushingId) return;
if (!this.selectionList.length) {
this.$message.warning('请选择至少一条数据');
return;
}
const invalidCount = this.selectionList.filter(item => !this.canHcsRepush(item)).length;
if (invalidCount) {
this.$message.warning(`选中数据中有${invalidCount}条不符合推送条件(仅审批通过且未同步的可推送),请重新选择`);
return;
}
this.$confirm(`确定将选中的${this.selectionList.length}条数据推送到合同合规系统?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// 同步推送合规耗时较长,加遮罩防重复操作(照审批通过遮罩)
const loading = this.$loading({
lock: true,
text: '正在批量推送合规,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
this.hcsRepushingId = 'batch';
hcsRepushBatch('contract', this.selectionList.map(item => item.id))
.then(res => {
if (res.data?.success === false) {
this.$message.error(res.data?.msg || '批量推送合规失败');
return;
}
this.$message.success(res.data?.data || '批量推送合规完成');
this.onLoad(this.page, this.query);
})
.catch(() => {
// 失败原因由 axios 拦截器统一弹出后端 msg,此处不再重复提示
})
.finally(() => {
this.hcsRepushingId = null;
loading.close();
});
});
},
canEdit(row) {
return (
this.hasPermission(`${this.config.permission}_edit`) &&
@@ -1782,6 +1963,7 @@ export default {
this.api.getDetail(id).then(res => this.applyDetail(res.data?.data || {}));
},
resetFormState() {
this.contractNoManual = false;
this.form = {
...defaultForm(),
handlerUserName:
@@ -1857,7 +2039,20 @@ export default {
this.$router.$avueRouter?.closeTag?.();
this.$router.push(contractManageListRoute);
},
validateContractNo() {
const contractNo = String(this.form.contractNo || '').trim();
if (this.formMode === 'edit' && !contractNo) {
this.$message.warning('请输入合同编号');
return false;
}
if (contractNo.length > 100) {
this.$message.warning('合同编号不能超过100个字符');
return false;
}
return true;
},
validateBase(action) {
if (!this.validateContractNo()) return false;
if (action === 'temporary') {
const required = [
['signType', '签约类型'],
@@ -1943,6 +2138,7 @@ export default {
const projectName = projectId ? normalizeProjectValue(this.form.projectName) : '';
return {
...this.form,
contractNo: String(this.form.contractNo || '').trim(),
projectId,
projectName,
copyCount: normalizeOptionalInteger(this.form.copyCount),
@@ -2217,8 +2413,21 @@ export default {
])
.then(responses => {
if (requestId !== this.contractPartyRequestId) return;
const names = responses
.flatMap(extractRecords)
const records = responses.flatMap(extractRecords);
// 名称→客商编码映射,供 C101-1 风险查询使用(§9-U6 编码体系联调确认)
const codeMap = {};
records.forEach(item => {
const code = item.customerCode;
if (!code) return;
[item.fullName, item.shortName, item.customerName]
.map(name => String(name || '').trim())
.filter(Boolean)
.forEach(name => {
codeMap[name] = code;
});
});
this.contractPartyCodeMap = codeMap;
const names = records
.map(item => item.fullName || item.shortName || item.customerName || item.customerCode)
.map(name => String(name || '').trim())
.filter(Boolean);
@@ -2226,11 +2435,40 @@ export default {
const options = [...new Set(names)].map(name => ({ label: name, value: name }));
this.contractPartyAOptions = options;
this.contractPartyBOptions = options;
// 复制/编辑回填的甲乙方不会触发下拉 change,加载选项后主动查一次 C101-1 风险
['partyA', 'partyB'].forEach(prop => {
if (this.form[prop]) this.queryPartyRisk(prop);
});
})
.finally(() => {
if (requestId === this.contractPartyRequestId) this.contractPartyLoading = false;
});
},
// C101-1 客商风险查询(展示用,强校验在后端提交/推送链路):失败静默不阻塞填写
queryPartyRisk(prop) {
const name = this.form[prop];
const code = name ? this.contractPartyCodeMap[name] : null;
if (!code) {
this.partyRisk = { ...this.partyRisk, [prop]: null };
return;
}
getRisk(code)
.then(res => {
const risk = res?.data?.data ?? res?.data ?? {};
this.partyRisk = {
...this.partyRisk,
[prop]: {
customerKind: risk.customerKind || '',
// risky 由后端统一判定:外部客商高风险(等级=2)或黑名单;内部组织客商默认无风险恒为 false
risky: risk.risky === true,
riskTip: risk.riskTip || '',
},
};
})
.catch(() => {
this.partyRisk = { ...this.partyRisk, [prop]: null };
});
},
loadOrganizationOptions() {
if (this.organizationLoading) return;
this.organizationLoading = true;
@@ -2314,11 +2552,14 @@ export default {
this.refreshPreviewContractNo();
}
},
handleContractNoInput(value) {
this.contractNoManual = String(value || '').trim() !== '';
},
refreshPreviewContractNo() {
if (this.formMode !== 'add') return;
const organizationId = this.form.organizationId;
if (!organizationId) {
this.form.contractNo = '';
if (!this.contractNoManual) this.form.contractNo = '';
return;
}
const requestId = (this.contractNoPreviewRequestId =
@@ -2326,11 +2567,11 @@ export default {
api
.nextContractNo(organizationId)
.then(res => {
if (requestId !== this.contractNoPreviewRequestId) return;
if (requestId !== this.contractNoPreviewRequestId || this.contractNoManual) return;
this.form.contractNo = res.data?.data || '';
})
.catch(() => {
if (requestId !== this.contractNoPreviewRequestId) return;
if (requestId !== this.contractNoPreviewRequestId || this.contractNoManual) return;
this.form.contractNo = '';
});
},
@@ -2763,6 +3004,7 @@ export default {
},
getContractChangeFieldLabel(field) {
const labels = {
contractNo: '合同编号',
contractName: '合同名称',
partyB: '乙方',
startDate: '开始日期',
@@ -3013,10 +3255,26 @@ export default {
})
)
: request();
afterMk.then(() => {
this.$message.success(operation.successMessage || `${operation.label}成功`);
this.onLoad(this.page, this.query);
});
// 合同通过会同步等待附件转传 + 合规推送,加遮罩防重复点击
const loading =
operation.action === 'approve'
? this.$loading({
lock: true,
text: '正在推送合规,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
})
: null;
afterMk
.then(res => {
// data=false 表示审批已通过但合规推送失败,msg 带具体原因(照正式结算单审批)
if (operation.action === 'approve' && res?.data?.data === false) {
this.$message.warning(res.data.msg);
} else {
this.$message.success(operation.successMessage || `${operation.label}成功`);
}
this.onLoad(this.page, this.query);
})
.finally(() => loading && loading.close());
};
if (operation.prompt) {
this.$prompt(operation.prompt, operation.label, {
@@ -3113,6 +3371,29 @@ export default {
vertical-align: bottom;
}
.contract-manage-form__risk-alert {
width: 100%;
}
// 风险客商提示条(基本信息备注后):橙黄背景 + 红色文字(设计稿 2026-10)
.contract-manage-form__risk-tip {
margin: 0 0 18px;
padding: 10px 16px;
background: #faecd8;
border-radius: 4px;
.contract-manage-form__risk-tip-title {
color: #f56c6c;
font-weight: 600;
line-height: 22px;
}
.contract-manage-form__risk-tip-content {
color: #f56c6c;
line-height: 22px;
}
}
.contract-manage-page {
&__expiry-search {
display: flex;
+100
View File
@@ -0,0 +1,100 @@
<template>
<basic-container class="hcs-master-data-page">
<div class="hcs-master-data-page__head">
<div class="dialog-section-title">合规主数据(HCS)</div>
<el-button type="primary" :loading="refreshing" @click="handleRefresh">刷新缓存</el-button>
</div>
<el-tabs v-model="activeTab">
<el-tab-pane label="合同模板" name="template" />
</el-tabs>
<el-table v-loading="loading" :data="templates" border>
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="fdId" label="模板ID(fdTemplateId)" min-width="320" show-overflow-tooltip />
<el-table-column prop="fdName" label="模板名称" min-width="220" show-overflow-tooltip />
<el-table-column prop="fdStatus" label="状态" width="100" align="center" />
<el-table-column prop="fdContractCharacter" label="合同性质" min-width="140" align="center" />
<el-table-column label="创建时间" min-width="170" align="center">
<template #default="{ row }">{{ formatTime(row.fdCreateTime) }}</template>
</el-table-column>
</el-table>
<el-alert
class="hcs-master-data-page__tip"
title="合同类别与合规模板的对应关系由 Nacos 配置 thirdParty.hcs.contract.template-mapping 维护;此列表用于核对映射的模板ID 是否存在。"
type="info"
:closable="false"
/>
</basic-container>
</template>
<script>
import { getTemplates, refreshMasterData } from '@/api/business/hcs';
export default {
name: 'HcsMasterData',
data() {
return {
activeTab: 'template',
loading: false,
refreshing: false,
templates: [],
};
},
created() {
this.loadTemplates();
},
methods: {
loadTemplates() {
this.loading = true;
getTemplates()
.then(response => {
const data = response?.data?.data ?? response?.data;
this.templates = Array.isArray(data) ? data : [];
})
.catch(() => {
this.$message.error('合规模板列表加载失败');
})
.finally(() => {
this.loading = false;
});
},
handleRefresh() {
this.refreshing = true;
refreshMasterData()
.then(response => {
this.$message.success(response?.data?.data || '合规主数据缓存已刷新');
this.loadTemplates();
})
.catch(error => {
this.$message.error(error?.response?.data?.msg || '刷新失败');
})
.finally(() => {
this.refreshing = false;
});
},
formatTime(value) {
if (!value) return '-';
return this.$dayjs(Number(value)).format('YYYY-MM-DD HH:mm:ss');
},
},
};
</script>
<style lang="scss" scoped>
.hcs-master-data-page__head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
.dialog-section-title {
margin-bottom: 0;
}
}
.hcs-master-data-page__tip {
margin-top: 12px;
}
</style>
+453 -104
View File
@@ -635,10 +635,11 @@
min-width="100" /><el-table-column
prop="quantity"
label="数量"
min-width="90" /><el-table-column
prop="quantityUnit"
label="数量单位"
min-width="100" /><el-table-column
min-width="120"
><template #default="{ row }">{{
formatCargoQuantityDisplay(row)
}}</template></el-table-column
><el-table-column
prop="materialCode"
label="物料编码"
min-width="120" /><el-table-column
@@ -897,6 +898,16 @@
>
<div title="配载信息" class="loading-manage-dialog__load-info-card">
<section-card>
<div class="loading-manage-dialog__admission-tip">
<div class="loading-manage-dialog__admission-title">可配载条件</div>
<div class="loading-manage-dialog__admission-text">
同时满足以下条件的运单可被配载:运输方式为「公路」;运单状态为「待执行」或「进行中」;未关联其他有效配载单;同一配载单的子运单须属同一项目,且承运商合同乙方须存在共同可选值(按各子单客户合同甲方匹配后取交集)。
</div>
<div class="loading-manage-dialog__admission-title">配载后状态说明</div>
<div class="loading-manage-dialog__admission-text">
子运单:按项目过程配置是否需司机接单,无需接单则为进行中,需接单则为待执行。配载单:按所选运单所属项目的过程配置,需接单则为待执行,无需接单则为进行中。
</div>
</div>
<div class="loading-manage-dialog__candidate-search">
<el-row :gutter="16">
<el-col :span="6">
@@ -1068,31 +1079,12 @@
<el-option
v-for="item in driverOptions"
:key="item.id || item.driverName || item.name"
:label="item.driverName || item.name"
:label="driverOptionText(item)"
:value="item.driverName || item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运输方式">
<el-select
v-model="candidateQuery.transportType"
clearable
filterable
placeholder="请选择"
:disabled="dialogMode === 'add'"
@visible-change="visible => visible && loadTransportTypeOptions()"
>
<el-option
v-for="item in transportTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</template>
<el-col
:span="candidateSearchVisible ? 24 : 6"
@@ -1201,6 +1193,16 @@
min-width="160"
show-overflow-tooltip
/>
<el-table-column
prop="carrierContractName"
label="承运商合同"
min-width="160"
show-overflow-tooltip
>
<template #default="{ row }">
{{ row.carrierContractName || '-' }}
</template>
</el-table-column>
<el-table-column
prop="planName"
label="计划名称"
@@ -1357,19 +1359,29 @@
</template>
</el-table-column>
<el-table-column label="操作" width="110" fixed="right">
<template #default="{ $index }">
<template #default="{ row, $index }">
<el-link
v-if="!dialogReadonly"
v-if="!dialogReadonly && !isSelectedWaybillRemoveLocked(row)"
type="danger"
@click="removeSelectedWaybill($index)"
>删除</el-link
>
<span
v-else-if="!dialogReadonly && isSelectedWaybillRemoveLocked(row)"
class="loading-manage-dialog__locked-tip"
>已打卡</span
>
</template>
</el-table-column>
</el-table>
</section-card>
<section-card title="线路编辑">
<template v-if="isRunningEdit" #extra>
<span class="loading-manage-dialog__route-hint"
>已打卡地点置灰不可拖拽,新增地址仅可在未打卡节点间调整</span
>
</template>
<div class="loading-manage-dialog__route-list" v-if="routeNodes.length">
<div
v-for="(node, index) in routeNodes"
@@ -1415,8 +1427,9 @@
<el-table-column prop="cargoName" label="货物名称" min-width="140" />
<el-table-column prop="cargoType" label="货物类型" min-width="140" />
<el-table-column prop="packageType" label="包装" min-width="100" />
<el-table-column prop="quantity" label="数量" min-width="100" />
<el-table-column prop="quantityUnit" label="数量单位" min-width="100" />
<el-table-column prop="quantity" label="数量" min-width="120">
<template #default="{ row }">{{ formatCargoQuantityDisplay(row) }}</template>
</el-table-column>
<el-table-column prop="materialCode" label="物料编码" min-width="130" />
<el-table-column prop="equipmentCode" label="设备编码" min-width="130" />
<el-table-column prop="brand" label="品牌" min-width="120" />
@@ -1436,7 +1449,7 @@
<el-segmented
v-model="dialogForm.carrierType"
:options="carrierTypeOptions"
:disabled="dialogReadonly"
:disabled="dialogReadonly || isRunningTaskRequiredLocked"
@change="handleCarrierTypeChange"
/>
</div>
@@ -1450,7 +1463,11 @@
"
clearable
filterable
:disabled="dialogReadonly || !selectedWaybillRows.length"
:disabled="
dialogReadonly ||
isRunningTaskRequiredLocked ||
!selectedWaybillRows.length
"
:loading="taskCarrierLoading"
:placeholder="taskCarrierPlaceholder"
@change="handleTaskCarrierChange"
@@ -1483,20 +1500,40 @@
:fetch-suggestions="fetchDriverSuggestions"
:loading="driverLoading"
placeholder="请输入"
:disabled="dialogReadonly || isRunningSelfDriverLocked"
@select="item => handleDriverSuggestionSelect('dialog', item)"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item
label="手机号"
:required="dialogForm.carrierType === '自运'"
>
<el-input v-model="dialogForm.driverPhone" clearable placeholder="请输入" />
<el-input
v-model="dialogForm.driverPhone"
clearable
placeholder="请输入"
:disabled="dialogReadonly || isRunningSelfDriverLocked"
/>
</el-form-item>
<el-form-item label="车牌号" required>
<el-input v-model="dialogForm.vehicleNo" clearable placeholder="请输入" />
<el-input
v-model="dialogForm.vehicleNo"
clearable
placeholder="请输入"
:disabled="dialogReadonly || isRunningTaskRequiredLocked"
/>
</el-form-item>
<el-form-item v-if="dialogForm.carrierType !== '承运商'" label="挂车车牌号">
<el-input v-model="dialogForm.trailerVehicleNo" clearable placeholder="请输入" />
<el-input
v-model="dialogForm.trailerVehicleNo"
clearable
placeholder="请输入"
:disabled="dialogReadonly"
/>
</el-form-item>
<el-form-item v-if="dialogForm.carrierType !== '承运商'" label="押运人">
<el-autocomplete
@@ -1506,11 +1543,21 @@
:fetch-suggestions="fetchEscortSuggestions"
:loading="escortLoading"
placeholder="请输入"
:disabled="dialogReadonly"
@select="item => handleEscortSuggestionSelect('dialog', item)"
/>
>
<template #default="{ item }">
<span>{{ driverOptionText(item) }}</span>
</template>
</el-autocomplete>
</el-form-item>
<el-form-item v-if="dialogForm.carrierType !== '承运商'" label="押运人手机号">
<el-input v-model="dialogForm.escortPhone" clearable placeholder="请输入" />
<el-input
v-model="dialogForm.escortPhone"
clearable
placeholder="请输入"
:disabled="dialogReadonly"
/>
</el-form-item>
<el-form-item label="里程(km)">
<el-input
@@ -1528,6 +1575,7 @@
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="请选择"
:disabled="dialogReadonly"
/>
</el-form-item>
<el-form-item label="预计完成日期">
@@ -1537,6 +1585,7 @@
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
placeholder="请选择"
:disabled="dialogReadonly"
/>
</el-form-item>
<el-form-item label="备注" class="loading-manage-dialog__span-2">
@@ -1547,6 +1596,7 @@
maxlength="500"
show-word-limit
placeholder="请输入,500字以内"
:disabled="dialogReadonly"
/>
</el-form-item>
</div>
@@ -1561,11 +1611,17 @@
</template>
<template v-else>
<el-button @click="closeLoadingDialog">关闭</el-button>
<el-button type="primary" plain :loading="dialogSaving === 'draft'" @click="saveDraft">
<el-button
v-if="!isRunningEdit"
type="primary"
plain
:loading="dialogSaving === 'draft'"
@click="saveDraft"
>
暂存
</el-button>
<el-button type="primary" :loading="dialogSaving === 'submit'" @click="submitLoading">
{{ dialogMode === 'reassign' ? '确认派单' : '确认' }}
{{ dialogMode === 'reassign' ? '确认派单' : isRunningEdit ? '保存' : '确认' }}
</el-button>
</template>
</div>
@@ -1823,7 +1879,7 @@ import { getList as getContractList } from '@/api/business/contract-manage';
import { getParentOptions as getCargoTypeOptions } from '@/api/base/cargo-type';
import { getList as getCustomerList } from '@/api/vehicle/customer-archive';
import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { fetchDriversByCarrierOrganizations } from '@/utils/carrier-org-resource';
import { fetchDriverCandidates, driverOptionText } from '@/utils/carrier-org-resource';
import { formatContractOptionLabel } from '@/utils/contract';
import {
getList as getProcessConfigList,
@@ -1848,7 +1904,6 @@ import { normalizeMapSearchResults, searchAmapPlaceText } from '@/utils/map-sear
import { parseRouteChangeContent } from '@/utils/route-change';
const defaultTransportType = '';
const defaultCandidateTransportType = '';
const AMAP_KEY = '653b7cf105ad7fb8ec9b2f5198ade315';
const AMAP_SECURITY_CODE = '5aab65c632e48ebae0d0e28f5b28e21a';
const loadingCreateWaybillsStorageKey = 'loading-manage-create-waybills';
@@ -1889,7 +1944,6 @@ const createCandidateSearchForm = () => ({
vehicleNo: '',
carrierName: '',
driverName: '',
transportType: defaultCandidateTransportType,
});
const createDialogForm = () => ({
@@ -2107,6 +2161,8 @@ export default {
routeNodes: [],
cargoRows: [],
routeDragIndex: -1,
/** 进行中编辑:子运单打卡记录映射 waybillId -> records[] */
waybillPunchMap: {},
transportTypeOptions: [],
projectOptions: [],
customerOptions: [],
@@ -2170,6 +2226,23 @@ export default {
dialogReadonly() {
return this.dialogMode === 'view';
},
/** 进行中配载编辑:可加子单/调未打卡路线,但任务必填字段锁定 */
isRunningEdit() {
return (
this.dialogMode === 'edit' &&
String(this.dialogForm.businessStatus || '') === 'running'
);
},
/** 进行中任务必填字段(已派车)不可改 */
isRunningTaskRequiredLocked() {
return this.isRunningEdit;
},
/** 自运进行中:司机/手机号同属必填派车信息,不可改 */
isRunningSelfDriverLocked() {
return (
this.isRunningEdit && String(this.dialogForm.carrierType || '').trim() === '自运'
);
},
// 打卡时间轴:已打卡按时间升序,未打卡保持原节点顺序排在其后
orderedPunchRecords() {
const records = Array.isArray(this.punchRecords) ? this.punchRecords : [];
@@ -2325,6 +2398,7 @@ export default {
},
methods: {
parseRouteChangeContent,
driverOptionText,
formatTaskCarrierContractLabel(item = {}) {
const carrierName = item.carrierName || item.partyB || '';
const contractLabel = formatContractOptionLabel(item);
@@ -2913,6 +2987,7 @@ export default {
if (status === 'running') {
return [
{ type: 'view', label: '详情' },
{ type: 'edit', label: '编辑' },
{ type: 'complete', label: '完成' },
];
}
@@ -3014,7 +3089,12 @@ export default {
query: {
mode,
...(mode === 'edit' && row?.id ? { id: row.id } : {}),
name: mode === 'edit' ? '编辑配载管理' : '新增配载管理',
name:
mode === 'edit'
? row?.businessStatus === 'running'
? '编辑进行中配载'
: '编辑配载管理'
: '新增配载管理',
},
});
return;
@@ -3022,7 +3102,6 @@ export default {
this.dialogMode = mode;
this.dialogLoading = true;
this.resetDialogData();
if (mode === 'add') this.candidateQuery.transportType = 'road';
try {
if (row?.id) {
const res = await loadingApi.getDetail(row.id);
@@ -3037,6 +3116,9 @@ export default {
this.dialogForm.loadingSubNos
);
this.syncProcessWaybillOptions();
if (this.isRunningEdit) {
await this.refreshWaybillPunchMap();
}
this.restoreRouteAndCargo();
this.restoreRouteChangeRecords();
this.loadPunchRecords();
@@ -3046,7 +3128,6 @@ export default {
} else {
this.dialogForm = createDialogForm();
this.candidateQuery = createCandidateSearchForm();
this.candidateQuery.transportType = 'road';
await this.loadCandidateWaybills();
}
} finally {
@@ -3071,6 +3152,8 @@ export default {
this.taskCarrierLoading = false;
this.routeNodes = [];
this.cargoRows = [];
this.routeDragIndex = -1;
this.waybillPunchMap = {};
this.candidatePage.currentPage = 1;
this.candidatePage.total = 0;
this.candidateSearchVisible = false;
@@ -3435,20 +3518,144 @@ export default {
const statusName = String(row.businessStatusName || row.statusName || '');
return statusName.includes('已完成');
},
isPunchRecordDone(record = {}) {
if (record.punched === false || record.statusName === '未打卡') return false;
return Boolean(record.punched || record.punchTime || record.punchAt || record.punchDateTime);
},
isLoadPunchRecord(record = {}) {
if (!this.isPunchRecordDone(record)) return false;
const code = String(record.nodeCode || '')
.trim()
.toLowerCase();
const name = String(record.nodeName || '').trim();
return code === 'load' || name.includes('装货');
},
isUnloadPunchRecord(record = {}) {
if (!this.isPunchRecordDone(record)) return false;
const code = String(record.nodeCode || '')
.trim()
.toLowerCase();
const name = String(record.nodeName || '').trim();
return (
code === 'unload' ||
name.includes('卸货') ||
code === 'arrival' ||
name.includes('到货') ||
code === 'sign' ||
name.includes('签收')
);
},
waybillPunchRecords(row = {}) {
const key = String(row?.id || '');
if (!key) return [];
const records = this.waybillPunchMap[key];
return Array.isArray(records) ? records : [];
},
isWaybillLoadPunched(row = {}) {
return this.waybillPunchRecords(row).some(record => this.isLoadPunchRecord(record));
},
isWaybillUnloadPunched(row = {}) {
return this.waybillPunchRecords(row).some(record => this.isUnloadPunchRecord(record));
},
isWaybillPunchLocked(row = {}) {
return this.isWaybillLoadPunched(row) || this.isWaybillUnloadPunched(row);
},
isSelectedWaybillRemoveLocked(row = {}) {
if (this.isWaybillCompleted(row)) return true;
return this.isRunningEdit && this.isWaybillPunchLocked(row);
},
isRouteNodeTagLocked(tag, rows = this.selectedWaybillRows) {
const match = String(tag || '').match(/^(装|卸)(\d+)$/);
if (!match) return false;
const row = rows[Number(match[2]) - 1];
if (!row) return false;
if (this.isRunningEdit) {
return match[1] === '装' ? this.isWaybillLoadPunched(row) : this.isWaybillUnloadPunched(row);
}
return this.isWaybillCompleted(row);
},
isRouteChangeNodeLocked(node = {}) {
return Boolean(node?.locked);
},
syncRouteNodeLockedFlags(nodes = [], rows = this.selectedWaybillRows) {
return (nodes || []).map(node => {
const locked = (node.tags || []).some(tag => {
const match = String(tag).match(/^(装|卸)(\d+)$/);
if (!match) return false;
const row = rows[Number(match[2]) - 1];
return row ? this.isWaybillCompleted(row) : false;
});
const locked = (node.tags || []).some(tag => this.isRouteNodeTagLocked(tag, rows));
return { ...node, locked };
});
},
async refreshWaybillPunchMap() {
const rows = (this.selectedWaybillRows || []).filter(row => row?.id);
if (!rows.length) {
this.waybillPunchMap = {};
return;
}
const entries = await Promise.all(
rows.map(async row => {
try {
const res = await getWaybillPunchRecords(row.id);
const data = res?.data?.data || res?.data || {};
return [String(row.id), Array.isArray(data.records) ? data.records : []];
} catch (error) {
return [String(row.id), []];
}
})
);
this.waybillPunchMap = Object.fromEntries(entries);
},
/**
* 进行中编辑:已打卡地点保持在前且不可插入,新增地址只能排在已打卡节点之后。
*/
mergeRouteNodesKeepingPunched(prevNodes = [], builtNodes = []) {
const prev = Array.isArray(prevNodes) ? prevNodes : [];
const built = Array.isArray(builtNodes) ? builtNodes : [];
if (!this.isRunningEdit) {
return built;
}
const builtByAddress = new Map();
built.forEach(node => {
if (node?.address && !builtByAddress.has(node.address)) {
builtByAddress.set(node.address, node);
}
});
const lockedAddresses = new Set(
built.filter(node => node?.locked && node.address).map(node => node.address)
);
const used = new Set();
const lockedResult = [];
prev.forEach(node => {
if (!node?.address || !lockedAddresses.has(node.address) || used.has(node.address)) {
return;
}
const latest = builtByAddress.get(node.address);
if (!latest) return;
lockedResult.push({ ...latest, locked: true });
used.add(node.address);
});
built.forEach(node => {
if (!node?.locked || !node.address || used.has(node.address)) return;
lockedResult.push({ ...node, locked: true });
used.add(node.address);
});
const unlockedResult = [];
prev.forEach(node => {
if (!node?.address || lockedAddresses.has(node.address) || used.has(node.address)) {
return;
}
const latest = builtByAddress.get(node.address);
if (!latest) return;
unlockedResult.push({ ...latest, locked: false });
used.add(node.address);
});
built.forEach(node => {
if (node?.locked || !node?.address || used.has(node.address)) return;
unlockedResult.push({ ...node, locked: false });
used.add(node.address);
});
return [...lockedResult, ...unlockedResult].map((node, index) => ({
...node,
key: `${node.address}-${index}`,
}));
},
openRouteChangeMapDialog(row, field) {
if (this.isWaybillCompleted(row)) return;
this.routeChangeMapTarget = { row, field };
@@ -3699,20 +3906,24 @@ export default {
async loadCandidateWaybills() {
this.candidateLoading = true;
try {
const selectedProjectId = this.selectedWaybillRows.map(row => row.projectId).find(Boolean);
const query = {
...this.buildQueryParams(this.candidateQuery),
// 待执行(需接单未接)与进行中(无需接单或已接单)均可配载
businessStatus: 'pending,running',
onlyUnassignedLoading: 1,
// 仅查当前账户所属组织及子组织下的运单
// 公路、待执行、未配载的判定都在后端可配载开关内
// 该开关已把候选限定为公路,再按精确运输方式取值筛会漏掉「公路运输」这类历史写法
loadableOnly: 1,
// allDept=0 表示不指定组织:超管与「数据权限范围=全部组织」的账户后端不过滤组织,
// 其余账户限定本组织(不展开下级)
allDept: 0,
...(this.dialogMode === 'add' ? { transportType: 'road' } : {}),
};
const transportType = this.getCandidateTransportTypeQuery(query.transportType);
// 已选运单后,候选列表优先限定同一项目,便于再按承运商合同乙方交集筛选
if (selectedProjectId && !query.projectId && !query.projectName) {
query.projectId = selectedProjectId;
}
const res = await getWaybillList(
this.candidatePage.currentPage,
this.candidatePage.pageSize,
{ ...query, transportType }
query
);
const page = unwrapPage(res);
this.candidateRows = page.records;
@@ -3721,20 +3932,12 @@ export default {
this.candidateLoading = false;
}
},
getCandidateTransportTypeQuery(value) {
const normalized = String(value || '')
.trim()
.toLowerCase();
if (['road', '公路运输'].includes(normalized)) return 'road,公路运输';
return value || '';
},
handleCandidateSearch() {
this.candidatePage.currentPage = 1;
this.loadCandidateWaybills();
},
handleCandidateReset() {
this.candidateQuery = createCandidateSearchForm();
if (this.dialogMode === 'add') this.candidateQuery.transportType = 'road';
this.candidatePage.currentPage = 1;
this.loadCandidateWaybills();
},
@@ -3766,19 +3969,89 @@ export default {
}
})
);
if (this.isRunningEdit && String(this.dialogForm.carrierType || '').trim() === '承运商') {
const contractId = this.dialogForm.carrierContractId;
if (contractId) {
const projectIds = [
...new Set(
[...this.selectedWaybillRows, ...selectedRows]
.map(row => row.projectId)
.filter(Boolean)
),
];
if (projectIds.length) {
try {
const waybillIds = [...this.selectedWaybillRows, ...selectedRows]
.map(row => row.id)
.filter(Boolean);
const response = await loadingApi.getCarrierContracts(projectIds, waybillIds);
const contracts = response?.data?.data || response?.data || [];
const stillAllowed = (Array.isArray(contracts) ? contracts : []).some(
item => String(item.id) === String(contractId)
);
if (!stillAllowed) {
ElMessage.warning('新增子运单须兼容当前配载单已选定的承运商合同');
return;
}
} catch (error) {
// 合同校验失败时仍允许添加,最终由后端确认拦截
}
}
}
}
const exists = new Set(
this.selectedWaybillRows.map(row => String(row.id || row.waybillNo))
);
// 一张配载单的全部子运单必须同项目:以已选运单(无已选时以本批首张)的项目为准
const anchorRow = [...this.selectedWaybillRows, ...selectedRows].find(row =>
this.waybillProjectKey(row)
);
const anchorKey = anchorRow ? this.waybillProjectKey(anchorRow) : '';
const mismatchedRows = anchorKey
? selectedRows.filter(
row => this.waybillProjectKey(row) && this.waybillProjectKey(row) !== anchorKey
)
: [];
if (mismatchedRows.length) {
const anchorName = anchorRow.projectName || anchorRow.projectId;
const mismatchedText = mismatchedRows
.map(
row =>
`${row.waybillNo || row.id}(项目:${row.projectName || row.projectId || '未知'})`
)
.join('、');
this.$message.warning(
`运单 ${mismatchedText} 与已选运单项目「${anchorName}」不一致,不能加入同一配载单`
);
}
const nextRows = [...this.selectedWaybillRows];
selectedRows.forEach(row => {
if (mismatchedRows.includes(row)) return;
const key = String(row.id || row.waybillNo);
if (!exists.has(key)) {
nextRows.push(row);
exists.add(key);
}
});
// 承运商类型:新增后须仍存在共同的承运商合同乙方(按客户合同甲方匹配后取交集)
if (
String(this.dialogForm.carrierType || '').trim() === '承运商' &&
nextRows.length > this.selectedWaybillRows.length
) {
const compatible = await this.hasCompatibleCarrierContracts(nextRows);
if (!compatible) {
this.$message.warning(
'所选运单在同一项目下没有共同的承运商合同乙方,不能加入同一配载单'
);
return;
}
}
const prevRouteNodes = [...this.routeNodes];
this.selectedWaybillRows = nextRows;
this.rebuildSummaryFromWaybills();
if (this.isRunningEdit) {
await this.refreshWaybillPunchMap();
}
this.rebuildSummaryFromWaybills(true, prevRouteNodes);
await this.loadTaskCarrierOptions();
this.$refs.candidateTableRef?.clearSelection?.();
this.candidateSelection = [];
@@ -3786,15 +4059,42 @@ export default {
this.candidateAdding = false;
}
},
async hasCompatibleCarrierContracts(rows = []) {
const projectId = (rows || []).map(row => row.projectId).find(Boolean);
const waybillIds = (rows || []).map(row => row.id).filter(Boolean);
if (!projectId || waybillIds.length < 2) return true;
try {
const response = await loadingApi.getCarrierContracts([projectId], waybillIds);
const contracts = response?.data?.data || response?.data || [];
return (Array.isArray(contracts) ? contracts : []).length > 0;
} catch (error) {
return true;
}
},
async addSelectedWaybills() {
await this.addWaybillRows(this.candidateSelection);
},
waybillProjectKey(row = {}) {
return String(row.projectId || row.projectName || '').trim();
},
removeSelectedWaybill(index) {
const row = this.selectedWaybillRows[index];
if (this.isSelectedWaybillRemoveLocked(row)) {
ElMessage.warning('已打卡的子运单不可移除');
return;
}
this.selectedWaybillRows.splice(index, 1);
if (this.isRunningEdit) {
this.refreshWaybillPunchMap().then(() => {
this.rebuildSummaryFromWaybills();
this.loadTaskCarrierOptions();
});
return;
}
this.rebuildSummaryFromWaybills();
this.loadTaskCarrierOptions();
},
rebuildSummaryFromWaybills(rebuildRoute = true) {
rebuildSummaryFromWaybills(rebuildRoute = true, prevRouteNodes = null) {
const rows = this.selectedWaybillRows;
this.dialogForm.loadingSubNos = rows
.map(row => row.waybillNo)
@@ -3819,7 +4119,13 @@ export default {
this.dialogForm.transportType = rows.find(row => row.transportType)?.transportType || '';
}
if (rebuildRoute) {
this.routeNodes = this.buildRouteNodes(rows);
const builtNodes = this.buildRouteNodes(rows);
this.routeNodes = this.isRunningEdit
? this.mergeRouteNodesKeepingPunched(
prevRouteNodes || this.routeNodes,
builtNodes
)
: builtNodes;
}
this.cargoRows = this.buildCargoRows(rows);
// 编辑回填阶段 routeNodes 尚未恢复时跳过,避免清空已有发到货地
@@ -3839,7 +4145,9 @@ export default {
if (locked) node.locked = true;
};
rows.forEach((row, rowIndex) => {
const locked = this.isWaybillCompleted(row);
const locked = this.isRunningEdit
? this.isWaybillLoadPunched(row)
: this.isWaybillCompleted(row);
const departure = row.departureAddress || row.departureName;
appendNode(
departure,
@@ -3849,7 +4157,9 @@ export default {
);
});
rows.forEach((row, rowIndex) => {
const locked = this.isWaybillCompleted(row);
const locked = this.isRunningEdit
? this.isWaybillUnloadPunched(row)
: this.isWaybillCompleted(row);
const arrival = row.arrivalAddress || row.arrivalName;
appendNode(
arrival,
@@ -3901,7 +4211,9 @@ export default {
if (
originalLockedKeys.some((key, lockedIndex) => key && key !== nextLockedKeys[lockedIndex])
) {
ElMessage.warning('已完成运单对应的路线不可调整');
ElMessage.warning(
this.isRunningEdit ? '已打卡地点不可调整,新地址只能在未打卡节点间拖拽' : '已完成运单对应的路线不可调整'
);
this.routeDragIndex = -1;
return;
}
@@ -3941,14 +4253,28 @@ export default {
return [this.normalizeCargoRow(row, row)];
});
},
formatCargoQuantityDisplay(row = {}) {
const quantity = blankCargoSentinel(row.quantity ?? row.cargoQuantity ?? '');
const unit = String(
blankCargoSentinel(
row.quantityUnit ||
row.goodsQuantityUnit ||
row.cargoUnit ||
row.unit ||
''
) || ''
).trim();
if (quantity === '' || quantity === undefined || quantity === null) {
return unit || '';
}
return unit ? `${quantity} ${unit}` : String(quantity);
},
normalizeCargoRow(waybill, item = {}) {
return sanitizeCargoRow({
projectName: item.projectName || waybill.projectName || '',
cargoName: item.cargoName || item.goodsName || waybill.cargoName || '',
cargoType: item.cargoType || item.goodsType || waybill.cargoType || '',
packageType: item.packageType || item.package || '',
weight: item.weight || item.cargoWeight || '',
volume: item.volume || item.cargoVolume || '',
quantity: item.quantity || item.cargoQuantity || waybill.quantity || '',
quantityUnit:
item.quantityUnit ||
@@ -4145,15 +4471,15 @@ export default {
try {
const payload = {
...this.normalizePayload(),
// 确认生成正式配载单(待执行),覆盖草稿状态
businessStatus: 'pending',
// 进行中编辑保持 running;新建/草稿确认由后端按项目是否需接单写入 pending/running
...(this.isRunningEdit ? { businessStatus: 'running' } : {}),
};
if (this.dialogMode === 'reassign') {
await loadingApi.reassign(payload);
ElMessage.success('派单成功');
} else {
await loadingApi.submit(payload);
ElMessage.success('确认成功');
ElMessage.success(this.isRunningEdit ? '保存成功' : '确认成功');
}
sessionStorage.setItem(loadingManageListRefreshKey, '1');
this.closeLoadingDialog();
@@ -4273,12 +4599,6 @@ export default {
this.dialogForm.escortPhone = '';
this.driverOptions = [];
},
getDialogCarrierFilter() {
return {
carrierId: this.dialogForm.carrierId || '',
carrierName: this.dialogForm.carrierName || '',
};
},
handleDriverChange(value) {
const driver = this.driverOptions.find(item => (item.driverName || item.name) === value);
if (driver && !this.dialogForm.driverPhone) {
@@ -4312,16 +4632,12 @@ export default {
},
fetchEscortSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim();
const carrier = this.getDialogCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
callback([]);
return;
}
this.escortLoading = true;
fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '押运员' },
carrier
)
fetchDriverCandidates({
size: 20,
...(keyword ? { driverName: keyword } : {}),
posts: '押运员',
})
.then(records => {
callback(
records.map(item => ({
@@ -4401,17 +4717,13 @@ export default {
}
},
async loadDialogDriverOptions(keyword = '') {
const carrier = this.getDialogCarrierFilter();
if (!carrier.carrierId && !carrier.carrierName) {
this.driverOptions = [];
return [];
}
this.driverLoading = true;
try {
this.driverOptions = await fetchDriversByCarrierOrganizations(
{ size: 20, ...(keyword ? { driverName: keyword } : {}), posts: '司机' },
carrier
);
this.driverOptions = await fetchDriverCandidates({
size: 20,
...(keyword ? { driverName: keyword } : {}),
posts: '司机',
});
return this.driverOptions;
} finally {
this.driverLoading = false;
@@ -4442,10 +4754,13 @@ export default {
}
this.taskCarrierLoading = true;
try {
const projectIds = [
...new Set(this.selectedWaybillRows.map(row => row.projectId).filter(Boolean)),
];
const response = await loadingApi.getCarrierContracts(projectIds);
// 配载单只有一个项目;传入子运单后按客户合同甲方匹配并取承运商合同乙方交集
const projectId = this.selectedWaybillRows.map(row => row.projectId).find(Boolean);
const waybillIds = this.selectedWaybillRows.map(row => row.id).filter(Boolean);
const response = await loadingApi.getCarrierContracts(
projectId ? [projectId] : [],
waybillIds
);
if (requestId !== this.taskCarrierRequestId) return [];
const contracts = response.data?.data || response.data || [];
if (this.dialogForm.carrierType !== '自运') {
@@ -4715,6 +5030,30 @@ export default {
justify-content: space-between;
}
.loading-manage-dialog__admission-tip {
margin-bottom: 12px;
padding: 12px 14px;
background: #f5f9ff;
border: 1px solid #d9ecff;
border-radius: 4px;
line-height: 1.6;
color: #606266;
}
.loading-manage-dialog__admission-title {
margin-bottom: 4px;
color: #303133;
font-weight: 600;
}
.loading-manage-dialog__admission-title + .loading-manage-dialog__admission-text + .loading-manage-dialog__admission-title {
margin-top: 8px;
}
.loading-manage-dialog__admission-text {
font-size: 13px;
}
.loading-manage-dialog__candidate-search {
padding: 0;
margin-bottom: 0;
@@ -4787,6 +5126,16 @@ export default {
color: #909399;
}
.loading-manage-dialog__route-hint {
color: #909399;
font-size: 12px;
}
.loading-manage-dialog__locked-tip {
color: #909399;
font-size: 12px;
}
.loading-manage-dialog__route-type {
width: 28px;
height: 28px;
+14 -11
View File
@@ -245,7 +245,7 @@
<el-radio-group
v-model="row.confirmMode"
:disabled="dialogReadonly || !row.enabled"
@change="handleReturnConfirmChange(row)"
@change="syncNodeFields"
>
<el-radio label="yes">是</el-radio>
<el-radio label="no_confirm_complete">无需确认完成</el-radio>
@@ -253,10 +253,7 @@
</div>
<div class="process-config-form__require-line">
<span class="process-config-form__require-label">确认完成</span>
<el-checkbox
v-model="row.confirmInternal"
:disabled="dialogReadonly || !row.enabled || row.confirmMode !== 'yes'"
@change="syncNodeFields"
<el-checkbox v-model="row.confirmInternal" :disabled="true"
>内部人员</el-checkbox
>
</div>
@@ -549,15 +546,18 @@ export default {
row.confirmDriver = row.confirmMode === 'yes';
this.syncNodeFields();
},
handleReturnConfirmChange(row) {
row.confirmInternal = row.confirmMode === 'yes';
this.syncNodeFields();
},
enforceAcceptDriver(node) {
if (!node || (node.key !== 'accept' && node.name !== '接单')) return node;
node.confirmDriver = node.confirmMode === 'yes';
return node;
},
// 回单「确认完成」只有内部人员一种角色,是否确认为「是」时即由内部人员确认,
// 界面上只读展示,值始终由 confirmMode 推导
enforceReturnInternal(node) {
if (!node || (node.key !== 'return' && node.name !== '回单')) return node;
node.confirmInternal = node.confirmMode === 'yes';
return node;
},
initDeptOptions() {
getDeptTree(this.userInfo.tenantId).then(res => {
const deptColumn = this.findColumn(this.option.column, 'searchDeptId');
@@ -724,7 +724,7 @@ export default {
this.projectLoading = true;
return getProjectList(1, 50, {
projectName: keyword,
approvalStatus: 'approved',
approvalStatuses: 'approved,change_approved',
allDept: this.isAdmin ? 1 : 0,
})
.then(res => {
@@ -808,7 +808,10 @@ export default {
this.syncNodeFields();
},
syncNodeFields() {
this.nodeRows.forEach(item => this.enforceAcceptDriver(item));
this.nodeRows.forEach(item => {
this.enforceAcceptDriver(item);
this.enforceReturnInternal(item);
});
const enabledNodes = this.nodeRows.filter(item => item.enabled);
this.form.includedNodes = enabledNodes.map(item => item.name).join(',');
this.form.nodeConfigJson = JSON.stringify(
+240 -24
View File
@@ -52,12 +52,37 @@
>
批量删除
</el-button>
<el-button
type="warning"
plain
v-if="!readonlyScope"
:loading="hcsRepushingId === 'batch'"
@click="handleHcsBatchRepush"
>
<el-icon class="el-icon--left"><Position /></el-icon>批量推送合规
</el-button>
</template>
<template #approvalStatus="{ row }">
{{ displayStatus(row, 'approvalStatus') }}
</template>
<template #hcsSyncStatus="{ row }">
<el-tooltip v-if="row.hcsSyncMsg" placement="top" :content="row.hcsSyncMsg">
<el-tag :type="hcsSyncTagType(row.hcsSyncStatus)" class="status-text">
{{ hcsSyncLabel(row.hcsSyncStatus) }}
</el-tag>
</el-tooltip>
<el-tag
v-else-if="row.hcsSyncStatus"
:type="hcsSyncTagType(row.hcsSyncStatus)"
class="status-text"
>
{{ hcsSyncLabel(row.hcsSyncStatus) }}
</el-tag>
<span v-else>-</span>
</template>
<template #header>
<div class="project-apply-page__risk-search">
<span class="project-apply-page__risk-label">
@@ -128,6 +153,13 @@
>
{{ operation.label }}
</el-link>
<el-link
v-if="canHcsRepush(row)"
type="warning"
@click="handleHcsRepush(row)"
>
{{ hcsRepushingId === row.id ? '推送中…' : '推送合规' }}
</el-link>
<el-link type="danger" v-if="canDelete(row)" @click="rowDel(row)"> 删除 </el-link>
</template>
</avue-crud>
@@ -916,12 +948,14 @@
import { exportBlob } from '@/api/common';
import { defineAsyncComponent } from 'vue';
import * as api from '@/api/business/project-apply';
import { repush as hcsRepush, repushBatch as hcsRepushBatch } from '@/api/business/hcs';
import { Position } from '@element-plus/icons-vue';
import { getMkPublicDetail } from '@/api/mk-process';
import {
getList as getCustomerArchiveList,
getDetail as getCustomerArchiveDetail,
} from '@/api/vehicle/customer-archive';
import { getDeptTree, getPlatformCompanySelect } from '@/api/system/dept';
import { getBusinessDeptSelect, getDeptTree, getPlatformCompanySelect } from '@/api/system/dept';
import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { getList as getUserList } from '@/api/system/user';
@@ -1060,6 +1094,7 @@ export default {
ElImageViewer,
OpenFileViewer,
PdfPreview,
Position,
},
data() {
const validateAmount = (rule, value, callback) => {
@@ -1121,6 +1156,8 @@ export default {
{ label: '高风险', value: 'high', statKey: 'high' },
{ label: '中风险', value: 'medium', statKey: 'medium' },
],
// 合规(HCS)推送状态
hcsRepushingId: null,
page: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
@@ -1559,6 +1596,7 @@ export default {
projectType: type === 'majorSupplement' ? '重大项目' : '普通项目',
});
this.fillDefaultUsers();
this.fillDefaultBusinessDept();
return;
}
if (!id) return;
@@ -1612,6 +1650,93 @@ export default {
return this.canOperation(operation, row);
});
},
// ==================== 合规(HCS)推送/对账(照“同步金蝶”按钮模式) ====================
hcsSyncLabel(value) {
return { unsynced: '待推送', synced: '已推送', failed: '推送失败' }[value] || value;
},
hcsSyncTagType(value) {
return { unsynced: 'info', synced: 'success', failed: 'danger' }[value] || 'info';
},
canHcsRepush(row) {
return (
!this.readonlyScope &&
['approved', 'change_approved'].includes(row.approvalStatus) &&
row.hcsSyncStatus !== 'synced'
);
},
handleHcsRepush(row) {
if (this.hcsRepushingId) return;
this.$confirm('确定推送该数据到合同合规系统?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// 同步推送合规耗时较长,加遮罩防重复操作(照审批通过遮罩)
const loading = this.$loading({
lock: true,
text: '正在推送合规,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
this.hcsRepushingId = row.id;
hcsRepush('project', row.id)
.then(res => {
if (res.data?.success === false) {
this.$message.error(res.data?.msg || '推送合规失败');
return;
}
this.$message.success(res.data?.data || '推送合规成功');
this.onLoad(this.page, this.query);
})
.catch(() => {
// 失败原因由 axios 拦截器统一弹出后端 msg,此处不再重复提示
})
.finally(() => {
this.hcsRepushingId = null;
loading.close();
});
});
},
handleHcsBatchRepush() {
if (this.hcsRepushingId) return;
if (!this.selectionList.length) {
this.$message.warning('请选择至少一条数据');
return;
}
const invalidCount = this.selectionList.filter(item => !this.canHcsRepush(item)).length;
if (invalidCount) {
this.$message.warning(`选中数据中有${invalidCount}条不符合推送条件(仅审批通过且未同步的可推送),请重新选择`);
return;
}
this.$confirm(`确定将选中的${this.selectionList.length}条数据推送到合同合规系统?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// 同步推送合规耗时较长,加遮罩防重复操作(照审批通过遮罩)
const loading = this.$loading({
lock: true,
text: '正在批量推送合规,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
this.hcsRepushingId = 'batch';
hcsRepushBatch('project', this.selectionList.map(item => item.id))
.then(res => {
if (res.data?.success === false) {
this.$message.error(res.data?.msg || '批量推送合规失败');
return;
}
this.$message.success(res.data?.data || '批量推送合规完成');
this.onLoad(this.page, this.query);
})
.catch(() => {
// 失败原因由 axios 拦截器统一弹出后端 msg,此处不再重复提示
})
.finally(() => {
this.hcsRepushingId = null;
loading.close();
});
});
},
canOperation(operation, row) {
const permission = operation.permission || `${this.config.permission}_${operation.action}`;
if (!this.hasPermission(permission) || this.readonlyScope || row.readonly) return false;
@@ -1753,14 +1878,31 @@ export default {
mkEnabled: this.mkEnabled,
}).then(() => request())
: request();
afterMk.then(res => {
if (res.data?.success === false || res.data?.data === false) {
this.$message.error(res.data?.msg || `${operation.label}失败,请联系管理员`);
return;
}
this.$message.success(`${operation.label}成功`);
this.onLoad(this.page, this.query);
});
// 项目通过会同步等待合规推送,加遮罩防重复点击
const loading =
operation.action === 'approve'
? this.$loading({
lock: true,
text: '正在推送合规,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
})
: null;
afterMk
.then(res => {
// data=false 表示审批已通过但合规推送失败,msg 带具体原因(照正式结算单审批)
if (operation.action === 'approve' && res.data?.data === false) {
this.$message.warning(res.data?.msg);
this.onLoad(this.page, this.query);
return;
}
if (res.data?.success === false) {
this.$message.error(res.data?.msg || `${operation.label}失败,请联系管理员`);
return;
}
this.$message.success(`${operation.label}成功`);
this.onLoad(this.page, this.query);
})
.finally(() => loading && loading.close());
};
if (operation.prompt) {
this.$prompt(operation.prompt, operation.label, {
@@ -1891,6 +2033,7 @@ export default {
.filter(Boolean);
this.syncSelectedCustomerOptions();
this.ensureCurrentPlatformOption();
this.ensureCurrentBusinessDeptOption();
},
fillDefaultUsers() {
const userId = this.userInfo?.userId || this.userInfo?.id || '';
@@ -1909,6 +2052,25 @@ export default {
this.form.principalUserName = userName;
}
},
/**
* 新增/重大补录:业务部门默认取当前用户所属部门中第一个「是否业务部门=是」的组织。
*/
fillDefaultBusinessDept() {
if (!['add', 'majorSupplement'].includes(this.dialogType)) return;
if (this.form.businessDeptId) return;
const raw = this.userInfo?.deptId || this.userInfo?.dept_id || '';
const userDeptIds = String(raw)
.split(/[,,]/)
.map(item => String(item || '').trim())
.filter(item => item && item !== '-1');
if (!userDeptIds.length || !this.deptOptions.length) return;
const matched = userDeptIds.find(id =>
this.deptOptions.some(item => String(item.value) === String(id))
);
if (!matched) return;
this.form.businessDeptId = matched;
this.handleBusinessDeptChange(matched);
},
resolveUserRealName(row = {}, role) {
return (
row[`${role}RealName`] ||
@@ -2491,17 +2653,61 @@ export default {
this.$refs.projectForm?.validateField('projectType');
},
loadDeptOptions() {
getDeptTree().then(res => {
const deptTree = res.data.data || [];
// 新增/编辑/重大补录/项目变更均可选择业务部门,排除外部组织
const businessDeptTree = ['add', 'edit', 'majorSupplement', 'change'].includes(this.dialogType)
? this.excludeExternalOrganization(deptTree)
: deptTree;
this.deptOptions = this.flattenDept(businessDeptTree);
this.businessDeptTreeOptions = this.toDeptCascaderOptions(businessDeptTree);
});
Promise.all([getDeptTree(), getBusinessDeptSelect()])
.then(([treeRes, bizRes]) => {
const deptTree = this.excludeExternalOrganization(treeRes.data.data || []);
const bizList = bizRes.data.data || [];
const bizIds = new Set(
bizList
.map(item => (item.id == null || item.id === '' ? '' : String(item.id)))
.filter(Boolean)
);
// 仅保留「是否业务部门=是」的节点及其祖先,祖先不可选
const businessDeptTree = this.filterBusinessDeptTree(deptTree, bizIds);
this.deptOptions = this.flattenDept(businessDeptTree).filter(item =>
bizIds.has(String(item.value))
);
this.businessDeptTreeOptions = this.toDeptCascaderOptions(businessDeptTree, bizIds);
this.fillDefaultBusinessDept();
this.ensureCurrentBusinessDeptOption();
})
.catch(() => {
this.deptOptions = [];
this.businessDeptTreeOptions = [];
});
this.loadPlatformCompanyOptions();
},
/**
* 剪枝组织树:只保留业务部门节点及其祖先路径。
*/
filterBusinessDeptTree(list = [], bizIds = new Set()) {
return (list || []).reduce((result, item) => {
const children = item.children?.length
? this.filterBusinessDeptTree(item.children, bizIds)
: [];
const isBiz = bizIds.has(String(item.id));
if (!isBiz && !children.length) {
return result;
}
result.push({
...item,
children: children.length ? children : undefined,
});
return result;
}, []);
},
ensureCurrentBusinessDeptOption() {
const id = this.form.businessDeptId;
if (!id) return;
const exists = this.deptOptions.some(item => String(item.value) === String(id));
if (exists) return;
const label = this.form.businessDeptName || String(id);
this.deptOptions.unshift({ label, rawLabel: label, value: id });
const pathExists = this.findDeptPath(id, this.businessDeptTreeOptions);
if (!pathExists) {
this.businessDeptTreeOptions.unshift({ label, value: id });
}
},
loadPlatformCompanyOptions() {
getPlatformCompanySelect().then(res => {
const list = res.data.data || [];
@@ -2545,12 +2751,22 @@ export default {
return result;
}, []);
},
toDeptCascaderOptions(list = []) {
return list.map(item => ({
label: item.title || item.deptName || item.name,
value: item.id,
children: item.children?.length ? this.toDeptCascaderOptions(item.children) : undefined,
}));
toDeptCascaderOptions(list = [], bizIds = null) {
return list.map(item => {
const value = item.id == null || item.id === '' ? item.value : item.id;
const option = {
label: item.title || item.deptName || item.name || item.label,
value: value == null || value === '' ? '' : String(value),
children: item.children?.length
? this.toDeptCascaderOptions(item.children, bizIds)
: undefined,
};
// 仅业务部门可选;祖先节点保留路径但禁用
if (bizIds && !bizIds.has(String(option.value))) {
option.disabled = true;
}
return option;
});
},
flattenDept(list = [], level = 0) {
return list.reduce((result, item) => {
@@ -577,10 +577,7 @@ export default {
this.$message.warning(`第${index + 1}条调度明细缺少承运商信息`);
return;
}
if (!row.driverName) {
this.$message.warning(`第${index + 1}条调度明细缺少司机信息`);
return;
}
// 司机是否必填由调度明细弹窗按承运类型判定(承运商承运时司机选填),此处不再重复校验
if (!row.vehicleNo) {
this.$message.warning(`第${index + 1}条调度明细缺少车牌号`);
return;
@@ -602,6 +602,8 @@ export default {
if (result.code !== 200) throw new Error(result.msg || '导入失败');
this.$message.success('导入完成');
}
// 与运单/配载一致:通知 keep-alive 列表实例重新拉取
sessionStorage.setItem('transport-plan-list-refresh', '1');
this.$router.push('/business/transport-plan');
} catch (error) {
this.$message.error(error.message || '导入失败');
+14 -4
View File
@@ -203,7 +203,11 @@
@click="openBatchDialog(row)"
>更换运单批次</el-link
><el-link
v-if="(row.processStatus !== '处理完成' || row.auditStatus === '待审核') && row.auditStatus !== '审核驳回'"
v-if="
row.processStatus !== '处理失败' &&
(row.processStatus !== '处理完成' || row.auditStatus === '待审核') &&
row.auditStatus !== '审核驳回'
"
type="primary"
@click="openBatchDialog(row)"
>更换运单批次</el-link
@@ -320,7 +324,7 @@
<el-form-item label="执行凭证" required
><el-upload
action="#"
accept=".zip,.7z"
accept=".zip"
:auto-upload="false"
:limit="1"
:on-change="selectVoucherFile"
@@ -332,7 +336,7 @@
>上传</el-button
><template #tip
><span class="voucher-manage-page__upload-tip"
>请上传车辆的执行凭证压缩包,支持zip、7z格式。 上传附件大于50M时为超大附件,确认提交后可在“批量补录->上传任务”中查看上传进度。</span
>请上传车辆的执行凭证压缩包,仅支持 zip 格式;无法解析的文件将标记为「处理失败」,可重新上传。上传附件大于50M时为超大附件,确认提交后可在“批量补录->上传任务”中查看上传进度。</span
></template
></el-upload
><el-progress
@@ -549,7 +553,7 @@
ref="resumeFileInput"
class="voucher-manage-page__hidden-file"
type="file"
accept=".zip,.7z"
accept=".zip"
@change="resumeFileSelected"
/>
</template>
@@ -998,6 +1002,12 @@ const uploadVoucher = async file => {
};
const selectVoucherFile = file => {
if (!file?.raw) return;
const fileName = String(file.raw.name || '').toLowerCase();
if (!fileName.endsWith('.zip')) {
ElMessage.warning('仅支持 zip 压缩包,无法解析的文件将标记为处理失败');
clearFile();
return;
}
selectedVoucherFile.value = file.raw;
editing.fileName = file.raw.name;
editing.fileUrl = '';
+117 -43
View File
@@ -44,7 +44,8 @@
reserve-keyword
:remote-method="searchCustomers"
:loading="customerLoading"
placeholder="请选择客商基础档案"
placeholder="请选择"
@change="syncFeeBearer"
>
<el-option
v-for="item in customerOptions"
@@ -63,6 +64,7 @@
allow-create
default-first-option
placeholder="请选择或输入"
@change="syncFeeBearer"
>
<el-option
v-for="item in receiverOptions"
@@ -74,7 +76,7 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="票面金额" prop="faceAmount">
<el-form-item label="票面金额" prop="faceAmount" required>
<el-input-number
v-model="form.faceAmount"
:min="0"
@@ -111,17 +113,15 @@
</el-col>
<el-col :span="6">
<el-form-item label="可用部门" prop="availableDeptIds">
<el-tree-select
v-model="form.availableDeptIds"
:data="deptTree"
:props="deptProps"
node-key="id"
multiple
show-checkbox
<el-cascader
v-model="availableDeptCascaderValue"
:options="businessDeptTreeOptions"
:props="deptCascaderProps"
placeholder="请选择"
filterable
clearable
collapse-tags
collapse-tags-tooltip
placeholder="请选择,默认全部"
@change="handleDeptChange"
/>
</el-form-item>
</el-col>
@@ -140,17 +140,9 @@
</el-col>
<el-col :span="6">
<el-form-item label="费用承担方" prop="feeBearerId">
<el-select
v-model="form.feeBearerId"
filterable
remote
reserve-keyword
:remote-method="searchCustomers"
:loading="customerLoading"
placeholder="请选择客商基础档案"
>
<el-select v-model="form.feeBearerId" filterable clearable placeholder="请选择">
<el-option
v-for="item in customerOptions"
v-for="item in feeBearerOptions"
:key="item.id"
:label="customerName(item)"
:value="item.id"
@@ -245,13 +237,13 @@ const emptyForm = () => ({
billNo: '',
issuerId: null,
receiverName: '',
billType: 'issued',
billType: '',
faceAmount: null,
availableBalance: 0,
issueDate: '',
maturityDate: '',
availableDeptIds: ['all'],
availableDeptNames: '全部',
availableDeptIds: [],
availableDeptNames: '',
feeBearerId: null,
confirmedDiscountRate: null,
issuingBank: '',
@@ -272,9 +264,17 @@ export default {
receiverOptions: [],
customerLoading: false,
saving: false,
deptTree: [],
businessDeptTreeOptions: [],
deptMap: new Map(),
deptProps: { label: 'title', value: 'id', children: 'children' },
deptCascaderProps: {
label: 'label',
value: 'value',
children: 'children',
multiple: true,
checkStrictly: true,
emitPath: true,
expandTrigger: 'click',
},
bankOptions: [
'中国工商银行',
'中国农业银行',
@@ -309,7 +309,10 @@ export default {
issuerId: [{ required: true, message: '请选择出票单位', trigger: 'change' }],
receiverName: [{ required: true, message: '请选择或输入收票单位', trigger: 'change' }],
billType: [{ required: true, message: '请选择汇票类型', trigger: 'change' }],
faceAmount: [{ validator: this.validateFaceAmount, trigger: 'change' }],
faceAmount: [
{ required: true, message: '请输入票面金额', trigger: 'change' },
{ validator: this.validateFaceAmount, trigger: 'change' },
],
issueDate: [{ required: true, message: '请选择出票日期', trigger: 'change' }],
maturityDate: [{ required: true, validator: this.validateMaturityDate, trigger: 'change' }],
availableDeptIds: [{ validator: this.validateDepartments, trigger: 'change' }],
@@ -340,6 +343,42 @@ export default {
(Number(this.form.faceAmount || 0) * Number(this.form.confirmedDiscountRate || 0)) / 100
);
},
// 可用部门:表单存部门 id,级联多选回显用根到节点的路径
availableDeptCascaderValue: {
get() {
return (this.form.availableDeptIds || [])
.filter(id => id !== undefined && id !== null && String(id) !== 'all' && String(id) !== '')
.map(id => this.findDeptPath(id, this.businessDeptTreeOptions) || [String(id)]);
},
set(paths) {
const ids = [
...new Set(
(paths || [])
.map(path => {
const nodes = Array.isArray(path) ? path.filter(item => item !== undefined && item !== null && item !== '') : [];
return nodes.length ? String(nodes.at(-1)) : '';
})
.filter(Boolean)
),
];
this.form.availableDeptIds = ids;
this.form.availableDeptNames = ids
.map(id => this.deptMap.get(String(id)))
.filter(Boolean)
.join('、');
},
},
feeBearerOptions() {
const issuer = this.customerOptions.find(item => String(item.id) === String(this.form.issuerId));
const receiverName = String(this.form.receiverName || '').trim();
const receiver = receiverName
? this.customerOptions.find(item => this.customerName(item) === receiverName)
: null;
return [issuer, receiver].filter(
(item, index, rows) =>
item && rows.findIndex(row => row && String(row.id) === String(item.id)) === index
);
},
},
created() {
this.initialize();
@@ -352,7 +391,6 @@ export default {
async initialize() {
await Promise.all([this.loadDepartments(), this.searchCustomers('')]);
if (!this.recordId) {
this.form.issueDate = this.$dayjs().format('YYYY-MM-DD');
return;
}
const data = this.unwrapData(await api.getDetail(this.recordId));
@@ -361,14 +399,20 @@ export default {
...data,
confirmedDiscountRate: this.normalizeDiscountRate(data.confirmedDiscountRate),
bankDiscountReferenceRate: this.normalizeDiscountRate(data.bankDiscountReferenceRate),
availableDeptIds: this.parse(data.availableDeptIdsJson),
availableDeptIds: this.parse(data.availableDeptIdsJson)
.filter(id => String(id) !== 'all')
.map(id => String(id)),
attachments: this.parse(data.attachmentsJson),
};
this.usageRecords = data.usageRecords || [];
this.receiverOptions = data.receiverName ? [data.receiverName] : [];
this.ensureCustomerOption(data.issuerId, data.issuerName);
this.ensureCustomerOption(data.feeBearerId, data.feeBearerName);
this.handleDeptChange(this.form.availableDeptIds);
this.form.availableDeptNames = (this.form.availableDeptIds || [])
.map(id => this.deptMap.get(String(id)))
.filter(Boolean)
.join('、');
this.syncFeeBearer();
},
parse(value) {
if (!value) return [];
@@ -381,22 +425,52 @@ export default {
},
async loadDepartments() {
const response = await getDeptTree(this.userInfo?.tenantId);
const rows = this.unwrapData(response) || [];
this.deptTree = [{ id: 'all', title: '全部', children: rows }];
this.deptMap = new Map([['all', '全部']]);
this.flattenDepartments(rows).forEach(item => this.deptMap.set(String(item.id), item.title));
const rows = this.excludeExternalOrganization(this.unwrapData(response) || []);
this.businessDeptTreeOptions = this.toDeptCascaderOptions(rows);
this.deptMap = new Map();
this.flattenDepartments(rows).forEach(item =>
this.deptMap.set(String(item.id), item.title || item.deptName || item.name)
);
},
excludeExternalOrganization(list = []) {
return list.reduce((result, item) => {
const deptName = item.title || item.deptName || item.name;
if (String(deptName || '').trim() === '外部组织') return result;
result.push({
...item,
children: item.children?.length
? this.excludeExternalOrganization(item.children)
: item.children,
});
return result;
}, []);
},
toDeptCascaderOptions(list = []) {
return list.map(item => ({
label: item.title || item.deptName || item.name,
value: item.id == null || item.id === '' ? '' : String(item.id),
children: item.children?.length ? this.toDeptCascaderOptions(item.children) : undefined,
}));
},
flattenDepartments(rows) {
return (rows || []).flatMap(item => [item, ...this.flattenDepartments(item.children || [])]);
},
handleDeptChange(values) {
const ids = values || [];
this.form.availableDeptNames = ids.some(item => String(item) === 'all')
? '全部'
: ids
.map(item => this.deptMap.get(String(item)))
.filter(Boolean)
.join('、');
findDeptPath(id, tree = [], parents = []) {
const target = Array.isArray(id) ? id.at(-1) : id;
if (target === undefined || target === null || target === '') return null;
for (const node of tree || []) {
const path = [...parents, node.value];
if (String(node.value) === String(target)) return path;
const matched = this.findDeptPath(target, node.children, path);
if (matched) return matched;
}
return null;
},
syncFeeBearer() {
const allowed = this.feeBearerOptions.map(item => String(item.id));
if (this.form.feeBearerId && !allowed.includes(String(this.form.feeBearerId))) {
this.form.feeBearerId = null;
}
},
async searchCustomers(keyword) {
this.customerLoading = true;
@@ -545,7 +619,7 @@ export default {
.bill-ledger-form-page__form :deep(.el-select),
.bill-ledger-form-page__form :deep(.el-input-number),
.bill-ledger-form-page__form :deep(.el-date-editor),
.bill-ledger-form-page__form :deep(.el-tree-select) {
.bill-ledger-form-page__form :deep(.el-cascader) {
width: 100%;
}
.bill-ledger-form-page__form :deep(.el-input-number .el-input__inner) {
+1 -1
View File
@@ -271,7 +271,7 @@ export default {
this.unwrapData(
await billLedgerApi.getAvailableOptions(
this.billDialog.keyword,
this.form.deptId,
undefined,
this.form.billLedgerId
)
) || [];
+3 -11
View File
@@ -156,17 +156,9 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该汇票付款?', '提示', { type: 'warning' });
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
try {
await api.approve({ id: row.id });
this.$message.success('审批通过');
await this.loadTable();
} finally {
this.loading = false;
}
await api.approve({ id: row.id });
this.$message.success('审批通过');
this.loadTable();
},
async handleReturn(row) {
const { value } = await this.$prompt('请输入驳回原因', '审批驳回');
+48 -21
View File
@@ -251,10 +251,10 @@
/>
</template>
</el-table-column>
<el-table-column label="不含税单价" min-width="130">
<el-table-column label="合计金额" min-width="140">
<template #default="{ row }">
<el-input-number
v-model="row.unitPriceNoTax"
v-model="row.totalAmount"
:disabled="readonly"
:min="0"
:precision="2"
@@ -263,9 +263,6 @@
/>
</template>
</el-table-column>
<el-table-column label="不含税金额" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.amountNoTax) }}</template>
</el-table-column>
<el-table-column label="税率" min-width="110">
<template #default="{ row }">
<el-select
@@ -282,11 +279,14 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="税额" min-width="120">
<template #default="{ row }">{{ formatMoney(row.taxAmount) }}</template>
<el-table-column label="不含税单价" min-width="140" align="right">
<template #default="{ row }">{{ formatUnitPrice(row.unitPriceNoTax) }}</template>
</el-table-column>
<el-table-column label="合计" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.totalAmount) }}</template>
<el-table-column label="不含税金额" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.amountNoTax) }}</template>
</el-table-column>
<el-table-column label="税额" min-width="120" align="right">
<template #default="{ row }">{{ formatMoney(row.taxAmount) }}</template>
</el-table-column>
<el-table-column label="备注" min-width="170">
<template #default="{ row }">
@@ -323,8 +323,17 @@
<el-table-column label="可开票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.availableInvoiceAmount) }}</template>
</el-table-column>
<el-table-column label="分摊发票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.allocatedInvoiceAmount) }}</template>
<el-table-column label="分摊发票金额" min-width="160">
<template #default="{ row }">
<el-input-number
v-model="row.allocatedInvoiceAmount"
:disabled="readonly"
:min="0"
:max="Number(row.availableInvoiceAmount || 0)"
:precision="2"
:controls="false"
/>
</template>
</el-table-column>
</el-table>
</section-card>
@@ -445,9 +454,6 @@
<el-table-column label="结算金额" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
</el-table-column>
<el-table-column label="已申请开票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.invoicedAmount) }}</template>
</el-table-column>
<el-table-column label="可开票金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.availableInvoiceAmount) }}</template>
</el-table-column>
@@ -855,6 +861,7 @@ export default {
keyword: this.settlementDialog.keyword,
contractCategory: '客户合同',
settlementType: 'receivable',
invoiceStatus: 'unreceived',
}
)
);
@@ -906,7 +913,7 @@ export default {
...item,
formalSettlementId: item.id,
settlementId: item.id,
allocatedInvoiceAmount: 0,
allocatedInvoiceAmount: rows.length === 1 ? Number(item.availableInvoiceAmount || 0) : 0,
}));
this.form.projectName = first.projectName;
this.form.deptName = first.deptName;
@@ -1101,15 +1108,30 @@ export default {
addLine(sheet) {
sheet.lines.push(emptyLine());
},
/**
* 填写合计金额 + 税率后反算:
* 合计金额 = 数量 × 不含税单价 × (1 + 税率)
* 不含税单价 = 合计金额 / 数量 / (1 + 税率),保留 6 位小数
* 不含税金额 = 数量 × 不含税单价,保留 2 位小数
*/
recalculateLine(row) {
const quantity = Number(row.quantity || 0);
const unitPrice = Number(row.unitPriceNoTax || 0);
const amountNoTax = Number((quantity * unitPrice).toFixed(2));
const totalAmount = Number(Number(row.totalAmount || 0).toFixed(2));
const rate = Number(row.taxRate || 0) / 100;
row.totalAmount = totalAmount;
row.amountWithTax = totalAmount;
if (quantity <= 0 || totalAmount <= 0) {
row.unitPriceNoTax = 0;
row.amountNoTax = 0;
row.taxAmount = 0;
return;
}
const factor = 1 + rate;
const unitPriceNoTax = Number((totalAmount / quantity / factor).toFixed(6));
const amountNoTax = Number((quantity * unitPriceNoTax).toFixed(2));
row.unitPriceNoTax = unitPriceNoTax;
row.amountNoTax = amountNoTax;
row.taxAmount = rate ? Number((amountNoTax * rate).toFixed(2)) : 0;
row.totalAmount = Number((amountNoTax + row.taxAmount).toFixed(2));
row.amountWithTax = row.totalAmount;
row.taxAmount = Number((totalAmount - amountNoTax).toFixed(2));
},
validateBusiness() {
if (!this.selectedDetailIds.length) throw new Error('请至少选择一条开票明细');
@@ -1122,12 +1144,14 @@ export default {
for (const line of sheet.lines) {
if (!line.goodsCategory || !line.goodsName) throw new Error('请完整填写商品和服务信息');
if (
[line.quantity, line.unitPriceNoTax, line.amountNoTax, line.taxRate].some(
[line.quantity, line.totalAmount, line.unitPriceNoTax, line.amountNoTax, line.taxRate].some(
Number.isNaN
)
) {
throw new Error('开票商品行金额格式不正确');
}
if (Number(line.quantity || 0) <= 0) throw new Error('开票商品行数量必须大于0');
if (Number(line.totalAmount || 0) <= 0) throw new Error('开票商品行合计金额必须大于0');
}
}
},
@@ -1227,6 +1251,9 @@ export default {
formatMoney(value) {
return Number(value || 0).toFixed(2);
},
formatUnitPrice(value) {
return Number(value || 0).toFixed(6);
},
},
};
</script>
+14 -6
View File
@@ -270,6 +270,7 @@ export default {
rows: [],
selection: [],
loading: false,
approveLoading: false,
batchSyncing: false,
page: { current: 1, size: 10, total: 0 },
mkEnabled: false,
@@ -408,11 +409,17 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该开票申请?', '提示', { type: 'warning' });
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm('确认审批通过该开票申请?', '提示', { type: 'warning' });
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
if (res.data.data === false) {
@@ -420,9 +427,10 @@ export default {
} else {
this.$message.success(res.data.msg || '审批通过');
}
await this.loadTable();
this.loadTable();
} finally {
this.loading = false;
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
+129 -31
View File
@@ -16,13 +16,22 @@
<el-row :gutter="32">
<el-col :span="6">
<el-form-item label="发票号码" prop="invoiceNo">
<el-input v-model="form.invoiceNo" readonly placeholder="请选择金蝶票据池发票">
<template v-if="!readonly" #append>
<el-tooltip content="查询金蝶票据池" placement="top">
<el-button :icon="Search" @click="openInvoiceDialog" />
</el-tooltip>
</template>
</el-input>
<el-tooltip
:content="form.invoiceNo"
:disabled="!form.invoiceNo"
placement="top"
:show-after="200"
>
<div class="receipt-form-page__overflow-trigger">
<el-input v-model="form.invoiceNo" readonly placeholder="请选择金蝶票据池发票">
<template v-if="!readonly" #append>
<el-tooltip content="查询金蝶票据池" placement="top">
<el-button :icon="Search" @click="openInvoiceDialog" />
</el-tooltip>
</template>
</el-input>
</div>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="6">
@@ -32,7 +41,16 @@
</el-col>
<el-col :span="6">
<el-form-item label="发票类型">
<el-input v-model="form.invoiceType" disabled placeholder="从金蝶票据池带出" />
<el-tooltip
:content="form.invoiceType"
:disabled="!form.invoiceType"
placement="top"
:show-after="200"
>
<div class="receipt-form-page__overflow-trigger">
<el-input v-model="form.invoiceType" disabled placeholder="从金蝶票据池带出" />
</div>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="6">
@@ -64,23 +82,54 @@
</el-col>
<el-col :span="6">
<el-form-item label="受票单位">
<el-input v-model="form.receiverName" disabled placeholder="从金蝶票据池带出" />
<el-tooltip
:content="form.receiverName"
:disabled="!form.receiverName"
placement="top"
:show-after="200"
>
<div class="receipt-form-page__overflow-trigger">
<el-input v-model="form.receiverName" disabled placeholder="从金蝶票据池带出" />
</div>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="开票单位">
<el-input v-model="form.issuerName" disabled placeholder="从金蝶票据池带出" />
<el-tooltip
:content="form.issuerName"
:disabled="!form.issuerName"
placement="top"
:show-after="200"
>
<div class="receipt-form-page__overflow-trigger">
<el-input v-model="form.issuerName" disabled placeholder="从金蝶票据池带出" />
</div>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联结算单" prop="settlementIds">
<el-input :model-value="settlementLabel" readonly placeholder="请选择应付正式结算单">
<template v-if="!readonly" #append>
<el-tooltip content="选择付款结算单" placement="top">
<el-button :icon="Search" @click="openSettlementDialog" />
</el-tooltip>
</template>
</el-input>
<el-tooltip
:content="settlementLabel"
:disabled="!settlementLabel"
placement="top"
:show-after="200"
>
<div class="receipt-form-page__overflow-trigger">
<el-input
:model-value="settlementLabel"
readonly
placeholder="请选择应付正式结算单"
>
<template v-if="!readonly" #append>
<el-tooltip content="选择付款结算单" placement="top">
<el-button :icon="Search" @click="openSettlementDialog" />
</el-tooltip>
</template>
</el-input>
</div>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
@@ -89,7 +138,12 @@
<section-card title="结算信息">
<el-table :data="form.settlements" border>
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column label="结算单号" min-width="180" align="center">
<el-table-column
label="结算单号"
min-width="180"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">
<el-link type="primary" @click="openSettlementDetail(row)">
{{ row.formalSettlementNo }}
@@ -173,7 +227,7 @@
<el-input
v-model="settlementDialog.keyword"
clearable
placeholder="3结算单号、项目或合同"
placeholder="结算单号、项目或合同"
@keyup.enter="loadSettlementCandidates"
/>
<el-button type="primary" @click="loadSettlementCandidates">查询</el-button>
@@ -182,16 +236,32 @@
ref="settlementTable"
v-loading="settlementDialog.loading"
:data="settlementDialog.rows"
row-key="id"
border
@selection-change="settlementDialog.selection = $event"
>
<el-table-column type="selection" width="52" align="center" />
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="170" />
<el-table-column prop="projectName" label="所属项目" min-width="150" />
<el-table-column prop="deptName" label="所属组织" min-width="150" />
<el-table-column prop="contractNo" label="合同编号" min-width="150" />
<el-table-column prop="payerName" label="付款方" min-width="150" />
<el-table-column prop="payeeName" label="收款方" min-width="150" />
<el-table-column type="selection" width="52" align="center" reserve-selection />
<el-table-column
prop="formalSettlementNo"
label="结算单号"
min-width="170"
show-overflow-tooltip
/>
<el-table-column
prop="projectName"
label="所属项目"
min-width="150"
show-overflow-tooltip
/>
<el-table-column prop="deptName" label="所属组织" min-width="150" show-overflow-tooltip />
<el-table-column
prop="contractNo"
label="合同编号"
min-width="150"
show-overflow-tooltip
/>
<el-table-column prop="payerName" label="付款方" min-width="150" show-overflow-tooltip />
<el-table-column prop="payeeName" label="收款方" min-width="150" show-overflow-tooltip />
<el-table-column label="结算总金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.settlementAmount) }}</template>
</el-table-column>
@@ -206,7 +276,9 @@
</el-table>
<template #footer>
<el-button @click="settlementDialog.visible = false">取消</el-button>
<el-button type="primary" @click="confirmSettlements">确定</el-button>
<el-button type="primary" @click="confirmSettlements">
确定{{ settlementDialog.selection.length ? `(${settlementDialog.selection.length})` : '' }}
</el-button>
</template>
</el-dialog>
</basic-container>
@@ -437,7 +509,15 @@ export default {
},
async openSettlementDialog() {
this.settlementDialog.visible = true;
this.settlementDialog.selection = [];
await this.loadSettlementCandidates();
await this.$nextTick();
const selectedIds = new Set(this.settlementIds.map(id => String(id)));
this.settlementDialog.rows.forEach(row => {
if (selectedIds.has(String(row.id))) {
this.$refs.settlementTable?.toggleRowSelection(row, true);
}
});
},
async loadSettlementCandidates() {
this.settlementDialog.loading = true;
@@ -468,11 +548,21 @@ export default {
this.$message.warning('关联结算单必须属于同一项目、组织及收付款方');
return;
}
const previousAmount = new Map(
this.form.settlements.map(item => [
String(item.formalSettlementId || item.settlementId),
item.allocatedInvoiceAmount,
])
);
this.form.settlements = rows.map(item => ({
...item,
formalSettlementId: item.id,
settlementId: item.id,
allocatedInvoiceAmount: rows.length === 1 ? Number(item.settlementAmount || 0) : 0,
allocatedInvoiceAmount: previousAmount.has(String(item.id))
? Number(previousAmount.get(String(item.id)) || 0)
: rows.length === 1
? Number(item.settlementAmount || 0)
: 0,
}));
this.form.projectName = first.projectName;
this.form.deptName = first.deptName;
@@ -482,9 +572,8 @@ export default {
await this.loadReferenceInformation();
this.$refs.formRef?.validateField('settlementIds').catch(() => {});
},
async selectSettlement(row) {
this.settlementDialog.selection = [row];
await this.confirmSettlements();
selectSettlement(row) {
this.$refs.settlementTable?.toggleRowSelection(row);
},
async loadReferenceInformation() {
const data = this.unwrapData(await api.getReferenceInformation(this.settlementIds.join(',')));
@@ -617,6 +706,15 @@ export default {
.receipt-form-page__form :deep(.el-input-number) {
width: 100%;
}
.receipt-form-page__overflow-trigger {
display: block;
width: 100%;
min-width: 0;
}
.receipt-form-page__form :deep(.el-tooltip__trigger:not(.el-select__wrapper)) {
display: block;
width: 100%;
}
.receipt-form-page__remark :deep(.el-form-item__content) {
margin-left: 0 !important;
}
+14 -6
View File
@@ -255,6 +255,7 @@ export default {
rows: [],
selection: [],
loading: false,
approveLoading: false,
pushLoading: false,
page: { current: 1, size: 10, total: 0 },
mkEnabled: false,
@@ -365,11 +366,17 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该收票登记?', '提示', { type: 'warning' });
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm('确认审批通过该收票登记?', '提示', { type: 'warning' });
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
if (res.data.data === false) {
@@ -377,9 +384,10 @@ export default {
} else {
this.$message.success(res.data.msg || '审批通过');
}
await this.loadTable();
this.loadTable();
} finally {
this.loading = false;
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
+291 -170
View File
@@ -121,7 +121,7 @@
><div class="payment-form-page__percentage-input">
<el-input-number
v-model="form.paymentRatio"
:disabled="readonly || multipleSettlementRows"
:disabled="readonly"
:min="0"
:max="100"
:precision="2"
@@ -134,7 +134,7 @@
><el-form-item label="申请付款金额" prop="appliedAmount"
><el-input-number
v-model="form.appliedAmount"
:disabled="readonly || multipleSettlementRows"
:disabled="readonly"
:min="0"
:precision="2"
:step="0.01"
@@ -219,6 +219,11 @@
show-word-limit /></el-form-item
></el-col>
</el-row>
<!-- 风险客商提示(基本信息备注后,同合同新增页):收款方外部客商高风险/黑名单时展示,文案由后端 riskTip 拼装 -->
<div v-if="payeeRiskText" class="payment-form-page__risk-tip">
<div class="payment-form-page__risk-tip-title">风险客商提示:</div>
<div class="payment-form-page__risk-tip-content">{{ payeeRiskText }}</div>
</div>
</section-card>
<section-card v-if="isSettlementRelatedType" title="结算信息">
<el-table :data="settlementRows" border
@@ -244,7 +249,7 @@
<el-table-column prop="paymentRatio" label="付款比例(%)" min-width="160">
<template #default="{ row }">
<el-input-number
v-if="multipleSettlementRows && !readonly"
v-if="!readonly"
:model-value="row.paymentRatio"
:min="0"
:max="rowPaymentRatioMax(row)"
@@ -262,7 +267,7 @@
<el-table-column prop="appliedAmount" label="付款金额" min-width="160">
<template #default="{ row }">
<el-input-number
v-if="multipleSettlementRows && !readonly"
v-if="!readonly"
:model-value="row.appliedAmount"
:min="0"
:max="Number(row.payableAmount || 0)"
@@ -719,6 +724,7 @@ import * as billLedgerApi from '@/api/payment/billLedger';
import { getDictionary } from '@/api/system/dictbiz';
import { getList as getProjectList } from '@/api/business/project-apply';
import { getDetail as getContractDetail } from '@/api/business/contract-manage';
import { getRisk as getCustomerRisk } from '@/api/business/hcs';
import * as formalApi from '@/api/settlement/formalSettlement';
import * as preApi from '@/api/settlement/preSettlement';
import {
@@ -852,6 +858,8 @@ export default {
billOptions: [],
billLoading: false,
billDialogVisible: false,
settlementPayerName: '',
settlementPayeeName: '',
billQuery: {
keyword: '',
},
@@ -872,6 +880,11 @@ export default {
/** 合同付款比例设置(按第1笔、第2笔…顺序) */
contractPaymentRatioRows: [],
payeeCustomerLevel: '',
// 收款方 C101-1 风险查询留档:risky=高风险/黑名单,tip=后端拼装提示文案
payeeRisky: false,
payeeRiskTip: '',
payeeRiskLevel: '',
payeeBlackStatus: '',
attachmentRuleLoading: false,
// 最近一次从结算单同步过来的附件 URL,切换结算单时用于整批替换
linkedSettlementAttachmentUrls: [],
@@ -1012,65 +1025,55 @@ export default {
referenceSettlementCount() {
return this.referenceSettlementNos.length;
},
multipleSettlementRows() {
return this.referenceRows.length > 1;
},
// 结算单号展示:单张显示单号;多张仅提示数量,明细在下方「结算信息」表,悬停可看全部单号
referenceDisplayText() {
if (this.referenceSettlementCount > 1) return `已选 ${this.referenceSettlementCount} 张结算单`;
return this.referenceLabel;
},
settlementRows() {
if (this.referenceRows.length > 1) {
return this.referenceRows.map(item => {
const paymentRatio = item.paymentRatio ?? this.form.paymentRatio;
const appliedAmount = Number(item.appliedAmount || 0);
return {
...item,
paymentRatio,
appliedAmount,
...this.buildSettlementRatioHint({ ...item, paymentRatio }),
};
});
}
if (this.referenceRows.length) {
return this.referenceRows.map(item => {
const appliedAmount =
item.fixedAppliedAmount === true
? Number(item.appliedAmount || 0)
: Number(
(
(Number(item.settlementAmount || 0) * Number(this.form.paymentRatio || 0)) /
100
).toFixed(2)
);
return {
...item,
paymentRatio: this.form.paymentRatio,
appliedAmount,
...this.buildSettlementRatioHint(item),
};
});
}
if (!this.referenceLabel) return [];
return [
{
settlementNo: this.referenceLabel,
settlementAmount: this.form.settlementAmount,
payableAmount: this.form.payableAmount,
paymentRatio: this.form.paymentRatio,
appliedAmount: this.form.appliedAmount,
paymentSequence: 1,
...this.buildSettlementRatioHint({ paymentSequence: 1 }),
},
];
const source = this.referenceRows.length
? this.referenceRows
: this.referenceLabel
? [
{
settlementNo: this.referenceLabel,
settlementAmount: this.form.settlementAmount,
payableAmount: this.form.payableAmount,
paymentRatio: null,
appliedAmount: null,
paymentSequence: 1,
},
]
: [];
// 结算行比例/金额只取行内数据,不回落到付款基本信息
return source.map(item => {
const paymentRatio = this.nullableNumber(item.paymentRatio);
const appliedAmount = this.nullableNumber(item.appliedAmount);
return {
...item,
paymentRatio,
appliedAmount,
...this.buildSettlementRatioHint({ ...item, paymentRatio }),
};
});
},
highRiskPayee() {
// 收款方 C101-1 高风险/黑名单,或客商等级 D/E/F(本地评级口径),命中须上传特批附件
if (this.payeeRisky) return true;
const level = String(this.payeeCustomerLevel || '')
.trim()
.toUpperCase();
return ['D', 'D级', 'E', 'E级', 'F', 'F级'].includes(level) || level.includes('高风险');
},
// 高风险/黑名单收款方提示(C101-1,同合同新增页风险客商提示口径;强制拦截在后端提交校验与金蝶推送门禁)
payeeRiskText() {
if (!this.payeeRisky) return '';
const levelMap = { 0: '低风险', 1: '中风险', 2: '高风险' };
const level = levelMap[this.payeeRiskLevel] || '未知';
const blacklist = String(this.payeeBlackStatus || '').trim().toLowerCase() === 'yes' ? '是' : '否';
const tip = this.payeeRiskTip || `收款方[${this.form.payeeName || ''}]为高风险/黑名单客商`;
return `风险等级:${level}|黑名单:${blacklist}。${tip},按集团规定不可直接付款,提交前须上传「特批附件」类型附件,审批通过后将自动发起付款特批`;
},
requiredAttachmentMaterials() {
if (this.form.paymentType === 'project_advance') {
return [ATTACHMENT_MATERIALS.contract];
@@ -1096,7 +1099,8 @@ export default {
},
'form.paymentRatio'(value) {
this.checkContractPaymentRatio(value);
if (this.amountSyncing || this.multipleSettlementRows || !this.paymentAmountBase) return;
// 上方比例仅用于反算申请付款金额,不联动结算信息列表
if (this.amountSyncing || !this.paymentAmountBase) return;
this.amountSyncing = true;
this.form.appliedAmount = Number(
((this.paymentAmountBase * Number(value || 0)) / 100).toFixed(2)
@@ -1106,7 +1110,8 @@ export default {
});
},
'form.appliedAmount'(value) {
if (this.amountSyncing || this.multipleSettlementRows || !this.paymentAmountBase) return;
// 上方申请付款金额反算比例,不联动结算信息列表
if (this.amountSyncing || !this.paymentAmountBase) return;
this.amountSyncing = true;
this.form.paymentRatio = Number(
((Number(value || 0) / this.paymentAmountBase) * 100).toFixed(2)
@@ -1119,11 +1124,12 @@ export default {
if (
this.amountSyncing ||
this.form.paymentType === 'project_advance' ||
this.multipleSettlementRows ||
!this.paymentAmountBase
!this.paymentAmountBase ||
this.nullableNumber(this.form.paymentRatio) === null
) {
return;
}
// 结算金额变化时只按上方比例重算申请付款金额,不改结算信息明细
this.amountSyncing = true;
this.form.appliedAmount = Number(
((this.paymentAmountBase * Number(this.form.paymentRatio || 0)) / 100).toFixed(2)
@@ -1221,10 +1227,6 @@ export default {
callback();
return;
}
if (selected.billType && selected.billType !== 'received') {
callback(new Error('汇票付款仅可选择收票类型的汇票'));
return;
}
if (selected.maturityDate) {
const maturity = this.$dayjs(selected.maturityDate).startOf('day');
const today = this.$dayjs().startOf('day');
@@ -1528,8 +1530,6 @@ export default {
paymentSequence: amount.paymentSequence,
}),
settlementNo: item.formalSettlementNo || item.settlementNo || '',
appliedAmount: Number(item.appliedAmount || 0),
fixedAppliedAmount: true,
};
});
this.seedMultipleRowPayments(referenceRows);
@@ -1541,13 +1541,6 @@ export default {
(total, item) => total + Number(item.payableAmount || 0),
0
);
const appliedAmount = referenceRows.reduce(
(total, item) => total + Number(item.appliedAmount || 0),
0
);
const paymentRatio = settlementAmount
? Number(((appliedAmount / settlementAmount) * 100).toFixed(2))
: 0;
const settlementIds = rows.map(item => item.settlementId || item.id).filter(Boolean);
this.amountSyncing = true;
this.referenceRows = referenceRows;
@@ -1574,12 +1567,12 @@ export default {
settlementAmount: Number(settlementAmount.toFixed(2)),
payableAmount: Number(payableAmount.toFixed(2)),
billType: '',
paymentRatio,
appliedAmount: Number(appliedAmount.toFixed(2)),
appliedAmount: this.headerAppliedAmountByRatio(settlementAmount),
invoices: rows.flatMap(item =>
this.createInvoiceRows(item.invoices || [], item.formalSettlementNo || item.settlementNo)
),
});
this.rememberSettlementParties(first.payerName, first.payeeName);
this.paymentRecords = rows.flatMap(item =>
(item.paymentRecords || item.paymentApplications || []).map(record => ({
...record,
@@ -1630,7 +1623,7 @@ export default {
referenceType: isPre ? 'pre' : 'formal',
settlementAmount: Number(Number(item.settlementAmount || 0).toFixed(2)),
payableAmount: Number(Number(item.payableAmount ?? item.settlementAmount ?? 0).toFixed(2)),
appliedAmount: Number(Number(item.appliedAmount || 0).toFixed(2)),
appliedAmount: this.nullableNumber(item.appliedAmount),
paymentRatio: Number(item.settlementAmount || 0)
? Number(
(
@@ -1639,11 +1632,10 @@ export default {
).toFixed(2)
)
: null,
fixedAppliedAmount: this.readonly,
};
})
.filter(Boolean);
if (rows.length > 1) {
if (rows.length) {
this.form.preSettlementIds = rows.filter(item => item.referenceType === 'pre').map(item => item.id);
this.form.settlementIds = rows.filter(item => item.referenceType === 'formal').map(item => item.id);
if (this.form.preSettlementIds.length) this.form.preSettlementId = this.form.preSettlementIds[0];
@@ -1667,24 +1659,37 @@ export default {
? 0
: Number(row.payableAmount || 0);
return {
id: row.preSettlementId || (isPre ? row.settlementId : null) || row.settlementId || row.id,
id:
row.preSettlementId ||
(isPre ? row.settlementId : null) ||
row.settlementId ||
(row.paymentNo ? null : row.id),
settlementNo: row.preSettlementNo || row.formalSettlementNo || row.settlementNo || '',
referenceType: isPre ? 'pre' : 'formal',
settlementAmount: Number(Number(settlementAmount || 0).toFixed(2)),
payableAmount: Number(Math.max(0, payableAmount).toFixed(2)),
paymentSequence: Number.isFinite(paymentSequence) && paymentSequence > 0 ? paymentSequence : 1,
paymentRatio: null,
appliedAmount: null,
};
},
nullableNumber(value) {
if (value === undefined || value === null || value === '') return null;
const amount = Number(value);
return Number.isFinite(amount) ? amount : null;
},
/** 付款基本信息内部:已填写比例时,按结算金额重算申请付款金额;不读取结算行付款金额。 */
headerAppliedAmountByRatio(settlementAmount) {
if (this.nullableNumber(this.form.paymentRatio) === null) return this.form.appliedAmount;
return Number(((Number(settlementAmount || 0) * Number(this.form.paymentRatio)) / 100).toFixed(2));
},
/**
* 按合同付款比例配置,判断当前付款次序是否超上限。
* @param {Object} row 结算信息行(含 paymentSequence)
*/
buildSettlementRatioHint(row = {}) {
const sequence = Number(row.paymentSequence || 1);
const rawRatio =
row.paymentRatio !== undefined && row.paymentRatio !== null && row.paymentRatio !== ''
? row.paymentRatio
: this.form.paymentRatio;
const rawRatio = row.paymentRatio;
const paymentRatio = Number(rawRatio);
const ratioConfig = this.contractPaymentRatioRows[sequence - 1];
const ratioLimitValue = ratioConfig?.ratioLimit;
@@ -1827,19 +1832,6 @@ export default {
(total, item) => total + Number(item.payableAmount || 0),
0
);
const appliedAmount = this.referenceRows.reduce(
(total, item) => total + Number(item.appliedAmount || 0),
0
);
const multiple = this.referenceRows.length > 1;
const paymentRatio = multiple
? settlementAmount
? Number(((appliedAmount / settlementAmount) * 100).toFixed(2))
: 0
: Number(this.form.paymentRatio || 0);
const headerAppliedAmount = multiple
? Number(appliedAmount.toFixed(2))
: Number(((payableAmount * paymentRatio) / 100).toFixed(2));
// 尾款付款场景下选择预付结算单时保留尾款付款类型,不强制改为进度预付
this.amountSyncing = true;
Object.assign(this.form, {
@@ -1865,9 +1857,9 @@ export default {
settlementAmount: Number(settlementAmount.toFixed(2)),
payableAmount: Number(payableAmount.toFixed(2)),
billType: '',
paymentRatio,
appliedAmount: headerAppliedAmount,
appliedAmount: this.headerAppliedAmountByRatio(settlementAmount),
});
this.rememberSettlementParties(first.payerName, first.payeeName);
this.paymentRecords = [];
this.clearReceiptAccount();
await this.fillBillTypeFromContract(first.contractId, true);
@@ -2063,12 +2055,31 @@ export default {
},
resolveAttachmentMaterial(file, materials = Object.values(ATTACHMENT_MATERIALS)) {
if (!this.attachmentFileUrl(file)) return null;
const typeMatched = (materials || []).find(
material => file.attachmentType === MATERIAL_TYPE_MAP[material.key]
);
const typeText = String(file.attachmentType || file.type || '')
.trim()
.toLocaleLowerCase();
const typeMatched = (materials || []).find(material => {
if (file.attachmentType === MATERIAL_TYPE_MAP[material.key]) return true;
if (!typeText) return false;
const label = String(material.label || '').toLocaleLowerCase();
return (
typeText === label ||
material.keywords.some(keyword => {
const normalizedKeyword = String(keyword).toLocaleLowerCase();
return normalizedKeyword && typeText.includes(normalizedKeyword);
})
);
});
return typeMatched || this.matchAttachmentMaterialByFileName(file, materials);
},
mergeAutomaticAttachments(files, materials, sourceName, defaultMaterial = null, sourceKey = '') {
mergeAutomaticAttachments(
files,
materials,
sourceName,
defaultMaterial = null,
sourceKey = '',
keepUnmatched = false
) {
const existingUrls = new Set(
(this.form.attachments || []).map(file => this.attachmentFileUrl(file)).filter(Boolean)
);
@@ -2077,16 +2088,20 @@ export default {
file,
material: this.resolveAttachmentMaterial(file, materials) || defaultMaterial,
}))
.filter(item => item.material && !existingUrls.has(this.attachmentFileUrl(item.file)))
.filter(item => {
const url = this.attachmentFileUrl(item.file);
return Boolean(url) && !existingUrls.has(url) && (item.material || keepUnmatched);
})
.map(({ file, material }) => {
existingUrls.add(this.attachmentFileUrl(file));
const url = this.attachmentFileUrl(file);
existingUrls.add(url);
return {
...file,
originalName: this.attachmentFileName(file),
name: this.attachmentFileName(file),
url: this.attachmentFileUrl(file),
link: file.link || this.attachmentFileUrl(file),
attachmentType: MATERIAL_TYPE_MAP[material.key],
url,
link: file.link || url,
attachmentType: material ? MATERIAL_TYPE_MAP[material.key] : 'other',
description: file.description || `自动取自${sourceName}`,
sourceImported: true,
sourceKey: sourceKey || undefined,
@@ -2119,11 +2134,7 @@ export default {
},
/** 按当前结算单附件整批同步:先清旧关联,再写入新结算单上传的附件 */
syncSettlementAttachments(settlementRows = []) {
const settlementMaterials = [
ATTACHMENT_MATERIALS.weighingSlip,
ATTACHMENT_MATERIALS.entrustOrder,
ATTACHMENT_MATERIALS.settlement,
];
const settlementMaterials = Object.values(ATTACHMENT_MATERIALS);
const settlementFiles = (settlementRows || []).flatMap(row => this.parse(row.attachmentsJson));
const nextUrlSet = new Set(
settlementFiles.map(file => this.attachmentFileUrl(file)).filter(Boolean)
@@ -2140,7 +2151,8 @@ export default {
settlementMaterials,
'结算单',
null,
'settlement'
'settlement',
true
);
this.linkedSettlementAttachmentUrls = imported
.map(file => this.attachmentFileUrl(file))
@@ -2327,6 +2339,10 @@ export default {
const preserveCurrentValue = autoSelectDefault === false;
this.receiptAccountOptions = [];
this.payeeCustomerLevel = '';
this.payeeRisky = false;
this.payeeRiskTip = '';
this.payeeRiskLevel = '';
this.payeeBlackStatus = '';
if (!partyBName) {
if (!preserveCurrentValue) this.clearReceiptAccount();
return;
@@ -2358,6 +2374,19 @@ export default {
}
const detail = this.unwrapData(await getCustomerArchiveDetail(customer.id));
this.payeeCustomerLevel = detail.customerLevel || '';
// 收款方实时查 C101-1 客商风险(后端对内部组织客商默认返回无风险):高风险/黑名单在
// 基本信息"风险客商提示"条常驻展示并要求特批附件;查询失败不阻断填写,提交时后端强校验兜底
if (detail.customerCode) {
try {
const risk = this.unwrapData(await getCustomerRisk(detail.customerCode)) || {};
this.payeeRisky = Boolean(risk.risky);
this.payeeRiskTip = risk.riskTip || '';
this.payeeRiskLevel = risk.fdRiskLevel || '';
this.payeeBlackStatus = risk.fdBlackStatus || '';
} catch (error) {
// 忽略风险查询异常,提交时后端 C101-1 强校验兜底
}
}
this.receiptAccountOptions = (detail.receiptAccounts || [])
.filter(item => item.accountName || item.accountHolderName || item.bankAccount)
.map(item => ({
@@ -2390,8 +2419,7 @@ export default {
}
},
payeeReceiptLabel(item) {
const name = item.accountName || item.accountHolderName || '未命名收款方';
return item.bankAccount ? `${name}(${item.bankAccount})` : name;
return item.accountName || item.accountHolderName || '未命名收款方';
},
receiptAccountLabel(item) {
return [item.accountName || item.accountHolderName, item.bankName, item.bankAccount]
@@ -2547,7 +2575,13 @@ export default {
try {
this.billOptions =
this.unwrapData(
await billLedgerApi.getAvailableOptions(keyword, this.form.deptId, selectedId)
await billLedgerApi.getAvailableOptions(
keyword,
undefined,
selectedId,
this.settlementPayerName,
this.settlementPayeeName
)
) || [];
} finally {
this.billLoading = false;
@@ -2568,8 +2602,10 @@ export default {
this.billPage.current,
this.billPage.size,
String(this.billQuery.keyword || '').trim() || undefined,
this.form.deptId,
this.form.billLedgerId
undefined,
this.form.billLedgerId,
this.settlementPayerName,
this.settlementPayeeName
);
const data = this.unwrapData(response) || {};
this.billRows = data.records || [];
@@ -2590,11 +2626,21 @@ export default {
this.billPage.current = 1;
this.loadBillPage();
},
rememberSettlementParties(payerName, payeeName) {
this.settlementPayerName = String(payerName || '').trim();
this.settlementPayeeName = String(payeeName || '').trim();
},
billMatchesSettlementParties(row) {
const issuer = String(row?.issuerName || '').trim();
const receiver = String(row?.receiverName || '').trim();
const payer = this.settlementPayerName;
const payee = this.settlementPayeeName;
if (!issuer || !receiver || !payer || !payee) return false;
return (
(issuer === payer && receiver === payee) || (issuer === payee && receiver === payer)
);
},
selectBill(row) {
if (row?.billType && row.billType !== 'received') {
ElMessage.warning('汇票付款仅可选择收票类型的汇票');
return;
}
if (row?.maturityDate) {
const maturity = this.$dayjs(row.maturityDate).startOf('day');
const today = this.$dayjs().startOf('day');
@@ -2848,6 +2894,7 @@ export default {
payerName: row.payerName,
payeeName: '',
});
this.rememberSettlementParties(row.payerName, row.payeeName);
this.referenceVisible = false;
this.refreshReferenceValidation();
const detail = this.unwrapData(detailResponse);
@@ -2930,6 +2977,7 @@ export default {
payerName: row.payerName,
payeeName: '',
});
this.rememberSettlementParties(row.payerName, row.payeeName);
this.referenceVisible = false;
this.refreshReferenceValidation();
const detail = this.unwrapData(detailResponse);
@@ -3014,26 +3062,55 @@ export default {
if (settlementAmount <= 0) return 100;
return Number(Math.min(100, (payableAmount / settlementAmount) * 100).toFixed(2));
},
/**
* 结算行金额规范化:只在行内反算比例,不使用付款基本信息的比例和申请金额。
*/
seedMultipleRowPayments(rows = []) {
if (rows.length <= 1) return;
const ratio = Number(this.form.paymentRatio || 0);
rows.forEach(item => {
const settlementAmount = Number(item.settlementAmount || 0);
const payableAmount = Number(item.payableAmount || 0);
const hasRatio =
item.paymentRatio !== null && item.paymentRatio !== undefined && item.paymentRatio !== '';
if (hasRatio) return;
let applied = Number(item.appliedAmount || 0);
if (applied <= 0 && ratio > 0) {
applied = Number(((settlementAmount * ratio) / 100).toFixed(2));
if (this.nullableNumber(item.appliedAmount) === null && this.nullableNumber(item.paymentRatio) === null) {
item.appliedAmount = null;
item.paymentRatio = null;
return;
}
if (applied > payableAmount) applied = Number(payableAmount.toFixed(2));
item.appliedAmount = Number(applied.toFixed(2));
item.paymentRatio = settlementAmount
? Number(((item.appliedAmount / settlementAmount) * 100).toFixed(2))
: 0;
this.syncRowPayment(item, 'amount');
});
},
/**
* 结算行付款比例与付款金额联动。比例 = 付款金额 / 结算总金额。
* @param {'ratio'|'amount'} source 以哪一侧为准
*/
syncRowPayment(row, source) {
const settlementAmount = Number(row.settlementAmount || 0);
const payableAmount = Number(row.payableAmount || 0);
if (source === 'ratio') {
const ratio = this.nullableNumber(row.paymentRatio);
if (ratio === null) {
row.paymentRatio = null;
row.appliedAmount = null;
return;
}
let applied = Number(((settlementAmount * ratio) / 100).toFixed(2));
if (applied > payableAmount) applied = Number(payableAmount.toFixed(2));
row.appliedAmount = applied;
row.paymentRatio = settlementAmount
? Number(((applied / settlementAmount) * 100).toFixed(2))
: Number(ratio.toFixed(2));
return;
}
const appliedValue = this.nullableNumber(row.appliedAmount);
if (appliedValue === null) {
row.appliedAmount = null;
row.paymentRatio = null;
return;
}
let applied = appliedValue;
if (applied < 0) applied = 0;
if (applied > payableAmount) applied = payableAmount;
row.appliedAmount = Number(applied.toFixed(2));
row.paymentRatio = settlementAmount
? Number(((row.appliedAmount / settlementAmount) * 100).toFixed(2))
: 0;
},
findReferenceRow(row) {
return this.referenceRows.find(
item =>
@@ -3045,32 +3122,19 @@ export default {
handleRowPaymentRatioChange(row, value) {
const target = this.findReferenceRow(row);
if (!target) return;
const settlementAmount = Number(target.settlementAmount || 0);
const payableAmount = Number(target.payableAmount || 0);
const ratio = value === null || value === undefined || value === '' ? 0 : Number(value);
let applied = Number(((settlementAmount * ratio) / 100).toFixed(2));
if (applied > payableAmount) applied = Number(payableAmount.toFixed(2));
target.appliedAmount = applied;
target.paymentRatio = settlementAmount
? Number(((applied / settlementAmount) * 100).toFixed(2))
: Number(ratio.toFixed(2));
this.syncHeaderPaymentFromRows();
target.paymentRatio = value;
this.syncRowPayment(target, 'ratio');
this.syncHeaderSettlementTotalsFromRows();
},
handleRowAppliedAmountChange(row, value) {
const target = this.findReferenceRow(row);
if (!target) return;
const settlementAmount = Number(target.settlementAmount || 0);
const payableAmount = Number(target.payableAmount || 0);
let applied = value === null || value === undefined || value === '' ? 0 : Number(value);
if (!Number.isFinite(applied) || applied < 0) applied = 0;
if (applied > payableAmount) applied = payableAmount;
target.appliedAmount = Number(applied.toFixed(2));
target.paymentRatio = settlementAmount
? Number(((target.appliedAmount / settlementAmount) * 100).toFixed(2))
: 0;
this.syncHeaderPaymentFromRows();
target.appliedAmount = value;
this.syncRowPayment(target, 'amount');
this.syncHeaderSettlementTotalsFromRows();
},
syncHeaderPaymentFromRows() {
/** 多结算单时仅同步结算金额/可付款金额合计,申请付款金额与比例由上方独立维护 */
syncHeaderSettlementTotalsFromRows() {
if (this.referenceRows.length <= 1) return;
const settlementAmount = this.referenceRows.reduce(
(total, item) => total + Number(item.settlementAmount || 0),
@@ -3080,23 +3144,21 @@ export default {
(total, item) => total + Number(item.payableAmount || 0),
0
);
const appliedAmount = this.referenceRows.reduce(
(total, item) => total + Number(item.appliedAmount || 0),
0
);
this.amountSyncing = true;
this.form.settlementAmount = Number(settlementAmount.toFixed(2));
this.form.payableAmount = Number(payableAmount.toFixed(2));
this.form.appliedAmount = Number(appliedAmount.toFixed(2));
this.form.paymentRatio = settlementAmount
? Number(((appliedAmount / settlementAmount) * 100).toFixed(2))
: 0;
this.$nextTick(() => {
this.amountSyncing = false;
this.$refs.formRef?.validateField?.(['settlementAmount', 'paymentRatio', 'appliedAmount']);
this.$refs.formRef?.validateField?.(['settlementAmount', 'appliedAmount']);
});
},
/** @deprecated 兼容旧调用名,行为见 syncHeaderSettlementTotalsFromRows */
syncHeaderPaymentFromRows() {
this.syncHeaderSettlementTotalsFromRows();
},
payload() {
// 驳回重提前再清一次:避免历史误存的正式结算单 ID 盖过预结算引用
this.clearFormalReferenceWhenPreOnly();
const {
id,
paymentType,
@@ -3133,13 +3195,34 @@ export default {
paymentType === 'progress_advance' ||
(this.referenceRows.length > 0 &&
this.referenceRows.every(item => item.referenceType === 'pre'));
// 进度预付 / 仅预结算引用:强制不传正式结算单 ID,并兜底恢复预结算单 ID
const resolvedPreSettlementId =
preSettlementId ||
preSettlementIds?.[0] ||
(usePreSettlementOnly ? settlementId : null) ||
null;
const resolvedPreSettlementIds =
preSettlementIds?.length > 0
? preSettlementIds
: resolvedPreSettlementId
? [resolvedPreSettlementId]
: [];
const preSettlementNo = usePreSettlementOnly
? this.form.preSettlementNo ||
(this.referenceRows || [])
.filter(item => item.referenceType === 'pre')
.map(item => item.settlementNo)
.filter(Boolean)
.join('、')
: this.form.preSettlementNo;
return {
id,
paymentType,
settlementId: usePreSettlementOnly ? null : settlementId,
settlementIds: usePreSettlementOnly ? [] : settlementIds,
preSettlementId,
preSettlementIds,
preSettlementId: usePreSettlementOnly ? resolvedPreSettlementId : preSettlementId,
preSettlementIds: usePreSettlementOnly ? resolvedPreSettlementIds : preSettlementIds,
preSettlementNo,
projectId,
projectName,
deptId,
@@ -3157,8 +3240,8 @@ export default {
settlementLines: (this.referenceRows || []).map(item => ({
formalSettlementId: item.referenceType === 'formal' ? item.id : null,
preSettlementId: item.referenceType === 'pre' ? item.id : null,
paymentRatio: item.paymentRatio,
appliedAmount: item.appliedAmount,
paymentRatio: this.nullableNumber(item.paymentRatio),
appliedAmount: this.nullableNumber(item.appliedAmount),
})),
paymentMethod,
billLedgerId,
@@ -3219,13 +3302,22 @@ export default {
ElMessage.warning('申请付款金额必填且必须大于0');
return false;
}
if (this.multipleSettlementRows) {
const invalidRow = this.referenceRows.find(
item => Number(item.appliedAmount || 0) > Number(item.payableAmount || 0)
);
if (this.isSettlementRelatedType && this.referenceRows.length) {
const invalidRow = this.referenceRows.find(item => {
const rowApplied = Number(item.appliedAmount || 0);
return !Number.isFinite(rowApplied) || rowApplied <= 0;
});
if (invalidRow) {
this.clearMessages();
ElMessage.warning(`${invalidRow.settlementNo || '结算单'}付款金额不能超过可付款金额`);
ElMessage.warning(`${invalidRow.settlementNo || '结算单'}请填写付款金额,且必须大于0`);
return false;
}
const exceededRow = this.referenceRows.find(
item => Number(item.appliedAmount || 0) > Number(item.payableAmount || 0)
);
if (exceededRow) {
this.clearMessages();
ElMessage.warning(`${exceededRow.settlementNo || '结算单'}付款金额不能超过可付款金额`);
return false;
}
}
@@ -3259,6 +3351,15 @@ export default {
this.clearMessages();
const saved = await this.saveDraft({ showSuccess: false, closePage: false });
if (!saved) return;
// 高风险/黑名单收款方必须上传特批附件(与后端提交强校验同口径)
if (
this.missingAttachmentMaterials.some(
item => item.key === ATTACHMENT_MATERIALS.specialApproval.key
)
) {
this.$message.warning('收款方为高风险/黑名单客商,必须上传「特批附件」类型附件后再提交审批');
return;
}
const previousApprovalStatus = this.form.approvalStatus || '';
await api.submit({ id: this.form.id });
await submitMkApprovalFlow({
@@ -3291,6 +3392,26 @@ export default {
.payment-form-page__form {
padding-bottom: 72px;
}
// 风险客商提示条(基本信息备注后,同合同新增页):橙黄背景 + 红色文字
.payment-form-page__risk-tip {
margin: 0 0 18px;
padding: 10px 16px;
background: #faecd8;
border-radius: 4px;
.payment-form-page__risk-tip-title {
color: #f56c6c;
font-weight: 600;
line-height: 22px;
}
.payment-form-page__risk-tip-content {
color: #f56c6c;
line-height: 22px;
}
}
.payment-form-page__settlement-nos {
display: flex;
align-items: center;
+12 -5
View File
@@ -163,6 +163,7 @@ export default {
rows: [],
selection: [],
loading: false,
approveLoading: false,
syncLoading: false,
resultSyncing: false,
query: {},
@@ -327,9 +328,14 @@ export default {
this.refreshChange();
},
async handleApprove(row) {
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
// 防止重复点击:请求进行中忽略后续点击
if (this.approveLoading) return;
this.approveLoading = true;
const loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
try {
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
@@ -338,9 +344,10 @@ export default {
} else {
this.$message.success(res.data.msg || '审批通过');
}
await this.onLoad(this.page);
this.refreshChange();
} finally {
this.loading = false;
loading.close();
this.approveLoading = false;
}
},
handleMkAudit(row) {
@@ -302,7 +302,10 @@ export default {
);
},
flowRemaining(flow) {
return Math.max(Number(flow.unclaimedAmount || 0) - Number(flow.claimedAmount || 0), 0);
const unclaimed = Number(flow.unclaimedAmount || 0);
const receipt = Number(flow.receiptAmount || 0);
const ceiling = unclaimed > 0 && receipt > 0 ? Math.min(unclaimed, receipt) : unclaimed || receipt;
return Math.max(ceiling - Number(flow.claimedAmount || 0), 0);
},
maxAllocation(row) {
const current = Number(row.settlement.allocations?.[row.flow.id] || 0);
+15 -7
View File
@@ -252,10 +252,11 @@ export default {
);
},
claimableAmount() {
return Math.max(
Number(this.form.unclaimedAmount || 0) - Number(this.form.claimedAmount || 0),
0
);
const unclaimed = Number(this.form.unclaimedAmount || 0);
const receipt = Number(this.form.receiptAmount || 0);
const ceiling =
unclaimed > 0 && receipt > 0 ? Math.min(unclaimed, receipt) : unclaimed || receipt;
return Math.max(ceiling - Number(this.form.claimedAmount || 0), 0);
},
},
created() {
@@ -274,14 +275,21 @@ export default {
}
const data = this.unwrapData(await api.getDetail(this.flowId));
const userInfo = this.$store.getters.userInfo || {};
// 部分认领继续认领:预填本流水历史关联且仍有剩余可认领金额的结算单
const relatedSettlements = (data?.relatedSettlements || []).map(item => ({
...item,
formalSettlementId: item.id,
settlementId: item.id,
allocatedReceiptAmount: 0,
}));
this.form = {
...emptyForm(),
...data,
claimerName: userInfo.realName || userInfo.userName || data.claimerName || '',
claimerDeptName: userInfo.deptName || userInfo.dept_name || data.claimerDeptName || '',
claimDate: this.$dayjs().format('YYYY-MM-DD'),
settlementIds: [],
settlements: [],
settlementIds: relatedSettlements.map(item => item.formalSettlementId),
settlements: relatedSettlements,
attachments: [],
};
},
@@ -347,7 +355,7 @@ export default {
return;
}
if (this.allocatedTotal > this.claimableAmount + 0.001) {
this.$message.warning('累计认领金额不能超过公告未认领金额(剩余可认领金额)');
this.$message.warning('累计认领金额不能超过剩余可认领金额');
return;
}
for (const row of this.form.settlements)
@@ -53,7 +53,7 @@
<el-option
v-for="item in contracts"
:key="item.id"
:label="formatContractOptionLabel(item)"
:label="item.contractName || ''"
:value="item.id"
/>
</el-select>
@@ -64,6 +64,20 @@
:precision="2"
:controls="false"
/>
<el-select
v-else-if="field.type === 'select' && editable"
v-model="form[field.prop]"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in formSelectOptions(field)"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
<span
v-else-if="field.prop === 'formalSettlementNo'"
:class="{ 'form-readonly--code': form.formalSettlementNo }"
@@ -71,6 +85,9 @@
{{ form.formalSettlementNo || (form.id ? '-' : '系统自动生成') }}
</span>
<span v-else-if="field.money">{{ formatMoney(form[field.prop]) }}</span>
<span v-else-if="field.type === 'select'">{{
formSelectLabel(field, form[field.prop])
}}</span>
<span v-else-if="field.type === 'contract'">{{
displayValue(form.contractName)
}}</span>
@@ -424,26 +441,7 @@
<section-card title="发票信息">
<div class="formal-editor__invoice-claim">
<el-form inline label-position="right" label-width="auto" @submit.prevent>
<el-form-item label="发票号码">
<el-input
v-model="invoiceClaimNo"
clearable
maxlength="32"
placeholder="请输入发票号码"
@keyup.enter="openInvoiceClaimDialog"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:loading="invoiceClaimLoading"
@click="openInvoiceClaimDialog"
>
认领查询
</el-button>
</el-form-item>
</el-form>
<el-button type="primary" @click="openInvoiceClaimDialog">认领查询</el-button>
</div>
<el-table :data="invoices" border>
<el-table-column type="index" label="序号" width="64" align="center" />
@@ -544,7 +542,6 @@
title="查询可认领发票"
confirm-text="确认认领"
multiple
:initial-invoice-no="String(invoiceClaimNo || '').trim()"
:query-api="invoicePoolQueryApi"
@confirm="handleInvoiceClaimConfirm"
/>
@@ -697,9 +694,19 @@
<el-table-column prop="changeTime" label="变更时间" min-width="170" align="center">
<template #default="{ row }">{{ displayValue(row.changeTime) }}</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="{ row }">
<el-link type="primary" @click="openChangeRecordDetail(row)">详情</el-link>
</template>
</el-table-column>
</el-table>
</section-card>
</div>
<change-record-detail-dialog
v-model="changeRecordDetailVisible"
:rows="changeRecordDetailRows"
/>
<template v-if="!pageMode" #footer>
<el-button v-if="editable" @click="handleSyncPlaceholder">同步</el-button>
<el-button @click="visible = false">取消</el-button>
@@ -1070,8 +1077,8 @@ import {
import { getDictionary } from '@/api/system/dictbiz';
import { h } from 'vue';
import { mapGetters } from 'vuex';
import { formatContractOptionLabel } from '@/utils/contract';
import { isTierUnitPrice, isUnitPriceAdjustable } from '@/utils/settlement-adjust-rule';
import { isApprovalSettlementChange } from '@/utils/settlement-change-record';
import { normalizeCurrencyCode } from '@/utils/currency';
import {
settlementRecordTypeName,
@@ -1084,6 +1091,7 @@ import {
viewKingdeeInvoiceFile,
} from '@/utils/kingdee-attachment';
import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import ProjectAdvanceWriteOff from './project-advance-write-off.vue';
import * as XLSX from 'xlsx';
import { isAdministrator } from '@/utils/auth';
@@ -1094,7 +1102,12 @@ const LOCAL_CURRENCY_HIDDEN_FIELDS = ['exchangeRateDate', 'exchangeRate', 'local
export default {
name: 'FormalSettlementEditor',
components: { InfoFilled, KingdeeInvoicePoolDialog, ProjectAdvanceWriteOff },
components: {
InfoFilled,
KingdeeInvoicePoolDialog,
ChangeRecordDetailDialog,
ProjectAdvanceWriteOff,
},
props: {
modelValue: Boolean,
recordId: [String, Number],
@@ -1124,14 +1137,14 @@ export default {
receiptClaims: [],
adjustments: [],
changeRecords: [],
changeRecordDetailVisible: false,
changeRecordDetailRows: [],
projectAdvanceWriteOffs: [],
attachments: [],
selectedAttachmentRows: [],
invoices: [],
// 开票申请经金蝶回写的发票结果(只读展示,含板式文件/数电PDF下载地址)
issuedInvoices: [],
invoiceClaimNo: '',
invoiceClaimLoading: false,
// 金蝶侧发票附件查看/下载进行中(行组级 loading 守卫)
kingdeeAttachmentBusy: false,
invoiceClaimDialog: {
@@ -1163,6 +1176,7 @@ export default {
projects: [],
feeOptions: [],
feeCategoryOptions: [],
businessModelOptions: [],
transportTypeOptions: [],
fields: formalSettlementFormFields,
sourceTableColumns: sourceColumns,
@@ -1374,22 +1388,17 @@ export default {
},
immediate: true,
},
summaryTotal(value) {
this.form.settlementAmount = Number(value || 0).toFixed(2);
this.form.localSettlementAmount = (
Number(value || 0) * Number(this.form.exchangeRate || 1)
).toFixed(2);
summaryTotal() {
this.syncSettlementAmountsFromSummary();
},
'form.exchangeRate'(value) {
this.form.localSettlementAmount = (
Number(this.summaryTotal || 0) * Number(value || 1)
).toFixed(2);
'form.exchangeRate'() {
if (this._skipExchangeRateRebuild) return;
this.buildSummaryFeesFromDetails();
},
},
methods: {
isTierUnitPrice,
isUnitPriceAdjustable,
formatContractOptionLabel,
hasPermission(code) {
if (this.isAdmin) return true;
const action = String(code || '').replace(
@@ -1440,7 +1449,9 @@ export default {
this.receiptClaims = this.unwrapData(await getReceiptClaims(id)) || [];
}
this.adjustments = data.adjustments || [];
this.changeRecords = data.changeRecords || [];
this.changeRecords = (data.changeRecords || []).filter(
row => !isApprovalSettlementChange(row.changeContent)
);
this.projectAdvanceWriteOffs = (data.projectAdvanceWriteOffs || []).map(row => ({
...row,
writeOffAmount: Number(row.writeOffAmount || 0),
@@ -1478,13 +1489,14 @@ export default {
this.receiptClaims = [];
this.adjustments = [];
this.changeRecords = [];
this.changeRecordDetailVisible = false;
this.changeRecordDetailRows = [];
this.projectAdvanceWriteOffs = [];
this.advancePayments = [];
this.attachments = [];
this.selectedAttachmentRows = [];
this.invoices = [];
this.issuedInvoices = [];
this.invoiceClaimNo = '';
this.invoiceClaimDialog.visible = false;
this.invoiceClaimDialog.selected = [];
this.attachmentUploadFiles = [];
@@ -1501,6 +1513,7 @@ export default {
this.loadFeeOptions(),
this.loadFeeCategoryOptions(),
this.loadAttachmentTypeOptions(),
this.loadBusinessModelOptions(),
this.loadTransportTypeOptions(),
]);
}
@@ -1666,8 +1679,9 @@ export default {
current.settlementAmount = current.originalAmount;
summaryMap.set(key, current);
});
// 先保留预结算手工费用行,再按明细本位币 + 结算汇率重算系统归集行
this.summaryFees = [...summaryMap.values()];
if (!this.summaryFees.length) await this.refreshSummaryFees();
await this.refreshSummaryFees();
},
async loadAllContracts() {
const response = await getContractOptions('');
@@ -1769,13 +1783,19 @@ export default {
},
async fetchBfiExchangeRate() {
const currency = this.form.currency;
if (!currency || currency === 'RMB') return;
if (!currency || currency === 'RMB') {
this.buildSummaryFeesFromDetails();
return;
}
if (!this.form.exchangeRateDate) return;
try {
const { data } = await getBfiExchangeRate(currency, this.form.exchangeRateDate);
const rateData = data?.data;
if (rateData?.excval != null) {
this._skipExchangeRateRebuild = true;
this.form.exchangeRate = Number(rateData.excval);
this._skipExchangeRateRebuild = false;
this.buildSummaryFeesFromDetails();
} else {
this.$message.warning(`未查询到 ${currency} 的BFI汇率数据`);
}
@@ -1783,6 +1803,37 @@ export default {
this.$message.warning('查询BFI汇率失败,请手动输入结算汇率');
}
},
/**
* 明细金额按本位币理解;外币结算时结算合计原金额/结算金额 = 本位币金额 / 结算汇率。
*/
convertLocalToSettlementAmount(localAmount) {
const amount = Number(localAmount || 0);
if (!Number.isFinite(amount)) return 0;
if (this.isLocalCurrencySettlement) {
return Number(amount.toFixed(2));
}
const rate = Number(this.form.exchangeRate || 0);
if (rate <= 0) return 0;
return Number((amount / rate).toFixed(2));
},
/**
* 结算金额取结算合计原币汇总值;本位币合计 = 结算金额 × 结算汇率。
*/
syncSettlementAmountsFromSummary() {
const settlementTotal = this.summaryFees.reduce(
(total, row) => total + Number(row.settlementAmount || 0),
0
);
this.form.settlementAmount = Number(settlementTotal || 0).toFixed(2);
if (this.isLocalCurrencySettlement) {
this.form.localSettlementAmount = this.form.settlementAmount;
this.form.exchangeRate = 1;
return;
}
const rate = Number(this.form.exchangeRate || 0);
this.form.localSettlementAmount =
rate > 0 ? (Number(this.form.settlementAmount || 0) * rate).toFixed(2) : '0.00';
},
openCandidateDialog() {
this.candidate.visible = true;
this.candidate.page.current = 1;
@@ -2004,8 +2055,9 @@ export default {
.map(row => [`${row.feeType}\u0000${row.feeItem}`, row])
);
const append = (feeItem, originalValue, settlementValue, fallbackFeeType = '') => {
const originalAmount = Number(originalValue || 0);
const settlementAmount = Number(settlementValue || 0);
// 明细费用按本位币归集,外币结算时再按汇率换算成结算原币金额
const originalAmount = this.convertLocalToSettlementAmount(originalValue);
const settlementAmount = this.convertLocalToSettlementAmount(settlementValue);
if (!feeItem || !Number.isFinite(originalAmount) || !Number.isFinite(settlementAmount)) {
return;
}
@@ -2043,6 +2095,7 @@ export default {
});
const manualRows = this.summaryFees.filter(row => Number(row.manualFlag) === 1);
this.summaryFees = [...generatedMap.values(), ...manualRows];
this.syncSettlementAmountsFromSummary();
},
// 每条明细对应的费用行:[调整前基准行, 调整后当前行],缺少费用快照时退化为明细自身的汇总行。
resolveDetailFeePairs(detail) {
@@ -2426,6 +2479,7 @@ export default {
row.settlementAmountTax = Number(data.afterAmount || 0);
} catch (error) {
row.calculateError = error.message || '费用试算失败';
this.$message.warning(row.calculateError);
} finally {
if (version === row.adjustCalculateVersion) row.calculating = false;
}
@@ -2798,6 +2852,8 @@ export default {
sourceDetailId: row.sourcePreSettlementId ? undefined : row.sourceDetailId || row.id,
adjustAmount: Number(row.adjustAmount || 0),
})),
businessModel: this.form.businessModel || undefined,
transportType: this.form.transportType || undefined,
exchangeRateDate: this.form.exchangeRateDate,
exchangeRate: this.form.exchangeRate,
summaryFees: this.summaryFees
@@ -2888,6 +2944,55 @@ export default {
const lineNo = row?.lineNo;
return lineNo === -1 || String(lineNo) === '-1' ? '' : this.displayValue(lineNo);
},
parseChangeRecordData(value) {
if (!value) return {};
if (typeof value === 'object') return value;
try {
const parsed = JSON.parse(value);
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : {};
} catch (error) {
return {};
}
},
formatChangeRecordValue(value) {
if (value === undefined || value === null || value === '') return '空';
if (Array.isArray(value)) {
if (!value.length) return '空';
return value
.map(item => {
if (!item || typeof item !== 'object') return String(item);
return Object.entries(item)
.map(([key, itemValue]) => `${key}:${this.formatChangeRecordValue(itemValue)}`)
.join(',');
})
.join('\n');
}
if (typeof value === 'object') return JSON.stringify(value);
return String(value);
},
buildChangeRecordDetailRows(row = {}) {
const before = this.parseChangeRecordData(row.beforeData);
const after = this.parseChangeRecordData(row.afterData);
const fields = [...new Set([...Object.keys(before), ...Object.keys(after)])];
const rows = fields
.filter(field => JSON.stringify(before[field]) !== JSON.stringify(after[field]))
.map(field => ({
field,
before: this.formatChangeRecordValue(before[field]),
after: this.formatChangeRecordValue(after[field]),
}));
if (row.changeContent) {
rows.unshift({ field: '变更内容', before: '空', after: row.changeContent });
}
if (row.changeReason) {
rows.push({ field: '变更原因', before: '空', after: row.changeReason });
}
return rows;
},
openChangeRecordDetail(row) {
this.changeRecordDetailRows = this.buildChangeRecordDetailRows(row);
this.changeRecordDetailVisible = true;
},
paymentMethodName(value) {
const labels = {
bank_transfer: '银行转账',
@@ -2917,9 +3022,36 @@ export default {
formatDetailMileage(value) {
return this.readonly && Number(value) === -1 ? '-' : this.displayValue(value);
},
async loadBusinessModelOptions() {
const { data } = await getDictionary({ code: 'business_model' });
const records = Array.isArray(data?.data) ? data.data : data?.data?.records || [];
this.businessModelOptions = records.map(item => ({
dictKey: item.dictKey ?? item.value,
dictValue: item.dictValue ?? item.label ?? item.name,
}));
},
async loadTransportTypeOptions() {
const { data } = await getDictionary({ code: 'transport_type' });
this.transportTypeOptions = data?.data || [];
const records = Array.isArray(data?.data) ? data.data : data?.data?.records || [];
this.transportTypeOptions = records.map(item => ({
dictKey: item.dictKey ?? item.value,
dictValue: item.dictValue ?? item.label ?? item.name,
}));
},
formSelectOptions(field) {
const key = field?.optionsKey;
const options = key ? this[key] : [];
return Array.isArray(options) ? options : [];
},
formSelectLabel(field, value) {
if (value === undefined || value === null || value === '') return '-';
const normalized = String(value).trim();
const option = this.formSelectOptions(field).find(
item =>
String(item.dictKey ?? '').trim() === normalized ||
String(item.dictValue ?? '').trim() === normalized
);
return option?.dictValue || normalized;
},
transportTypeName(value) {
if (value === undefined || value === null || value === '') return '';
@@ -3255,21 +3387,9 @@ export default {
}
.formal-editor__invoice-claim {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
justify-content: flex-end;
margin-bottom: 12px;
}
.formal-editor__invoice-claim-hint {
color: var(--el-color-danger);
font-size: 13px;
}
.formal-editor__invoice-claim :deep(.el-form-item) {
margin-bottom: 0;
}
.formal-editor__invoice-claim :deep(.el-input) {
width: 360px;
}
.formal-editor__issued-invoices {
margin-top: 16px;
}
@@ -1,155 +1,100 @@
<template>
<div class="fs-table-panel">
<div class="fs-table-panel__toolbar">
<div>
<el-button
v-if="hasPermission('add')"
type="primary"
@click="$emit('create')"
>新增</el-button
>
<el-button
v-if="showPaymentAction && hasPermission('payment')"
type="primary"
plain
:disabled="!selection.length"
@click="$emit('payment')"
>付款申请</el-button
>
<el-button
v-if="hasPermission('sync')"
type="primary"
plain
:disabled="!selection.length"
:loading="syncLoading"
@click="$emit('sync')"
>同步金蝶</el-button
>
<el-button
v-if="hasPermission('print')"
type="primary"
plain
@click="emitSingle('print')"
>打印结算单</el-button
>
<el-button
v-if="hasPermission('export')"
type="primary"
plain
@click="$emit('export')"
>导出</el-button
>
</div>
<settlement-table-tools
:columns="columnSettingOptions"
v-model:visible-column-keys="visibleColumnKeys"
v-model:table-size="tableSize"
:search-visible="searchVisible"
@update:search-visible="$emit('update:searchVisible', $event)"
@refresh="$emit('refresh')"
/>
</div>
<el-table
ref="tableRef"
v-loading="loading"
:data="rows"
:size="tableSize"
border
highlight-current-row
@current-change="handleCurrentChange"
@selection-change="handleSelectionChange"
>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column type="selection" width="52" fixed="left" align="center" />
<el-table-column
v-for="column in visibleColumns"
:key="column.prop"
v-bind="column"
align="center"
show-overflow-tooltip
<avue-crud
ref="crud"
:option="option"
:table-loading="loading"
:data="rows"
v-model:page="crudPage"
@search-change="(params, done) => $emit('search-change', params, done)"
@search-reset="$emit('search-reset')"
@selection-change="handleSelectionChange"
@refresh-change="$emit('refresh')"
@on-load="page => $emit('load', page)"
>
<template #menu-left>
<el-button v-if="hasPermission('add')" type="primary" @click="$emit('create')"
>新增</el-button
>
<template #default="{ row }">
<el-link
v-if="column.link && row[column.prop]"
type="primary"
@click="emitAction('view', row)"
>{{ row[column.prop] }}</el-link
>
<el-tag
v-else-if="column.status"
:type="statusType(row.approvalStatus)"
class="status-text"
>{{ displayValue(row[column.prop]) }}</el-tag
>
<span v-else-if="column.money">{{ formatMoney(row[column.prop], row.currency) }}</span>
<span
v-else-if="column.prop === 'invoiceStatusName'"
:class="['fs-table-panel__invoice-status', `is-${row.invoiceStatus || 'unreceived'}`]"
>{{ invoiceName(row.invoiceStatus, row.settlementType) }}</span>
<span v-else-if="column.prop === 'paymentStatusName'">{{
paymentName(row.paymentStatus)
}}</span>
<span v-else-if="column.prop === 'kingdeeSyncStatus'">{{
kingdeeSyncName(row.kingdeeSyncStatus)
}}</span>
<span v-else-if="column.prop === 'adjustFlag'">{{ adjustFlag(row) }}</span>
<template v-else-if="column.prop === 'kingdeeLockStatus'">
<el-tooltip v-if="lockTag(row).show" :content="lockTag(row).tip" placement="top">
<el-tag :type="lockTag(row).type" class="status-text">{{ lockTag(row).label }}</el-tag>
</el-tooltip>
<span v-else>-</span>
</template>
<span v-else>{{ displayValue(row[column.prop]) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="320" fixed="right" align="center">
<template #default="{ row }"
><div class="fs-table-panel__links">
<el-link
v-for="action in rowActions(row)"
:key="action.type"
:type="action.danger ? 'danger' : 'primary'"
@click="emitAction(action.type, row)"
>{{ action.label }}</el-link
>
</div></template
>
</el-table-column>
</el-table>
<div class="fs-table-panel__pagination">
<el-pagination
:current-page="page.current"
:page-size="page.size"
:total="page.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@current-change="current => $emit('page-change', { current, size: page.size })"
@size-change="size => $emit('page-change', { current: 1, size })"
/>
</div>
</div>
<el-button
v-if="showPaymentAction && hasPermission('payment')"
type="primary"
plain
:disabled="!selection.length"
@click="$emit('payment')"
>付款申请</el-button
>
<el-button
v-if="hasPermission('sync')"
type="primary"
plain
:disabled="!selection.length"
:loading="syncLoading"
@click="$emit('sync')"
>同步金蝶</el-button
>
<el-button v-if="hasPermission('print')" type="primary" plain @click="emitSingle('print')"
>打印结算单</el-button
>
<el-button v-if="hasPermission('export')" type="primary" plain @click="$emit('export')"
>导出</el-button
>
</template>
<template #formalSettlementNo="{ row }">
<el-link type="primary" @click="emitAction('view', row)">{{
row.formalSettlementNo || '-'
}}</el-link>
</template>
<template #invoiceStatusName="{ row }">
<span :class="['fs-invoice-status', `is-${row.invoiceStatus || 'unreceived'}`]">{{
invoiceName(row.invoiceStatus, row.settlementType)
}}</span>
</template>
<template #paymentStatusName="{ row }">{{ paymentName(row.paymentStatus) }}</template>
<template #approvalStatusName="{ row }">
<el-tag :type="statusType(row.approvalStatus)" class="status-text">{{
row.approvalStatusName || '-'
}}</el-tag>
</template>
<template #kingdeeSyncStatus="{ row }">{{ kingdeeSyncName(row.kingdeeSyncStatus) }}</template>
<template #kingdeeLockStatus="{ row }">
<el-tooltip v-if="lockTag(row).show" :content="lockTag(row).tip" placement="top">
<el-tag :type="lockTag(row).type" class="status-text">{{ lockTag(row).label }}</el-tag>
</el-tooltip>
<span v-else>-</span>
</template>
<template #menu="{ row }">
<el-link
v-for="action in rowActions(row)"
:key="action.type"
:type="action.danger ? 'danger' : 'primary'"
@click="emitAction(action.type, row)"
>{{ action.label }}</el-link
>
</template>
</avue-crud>
</template>
<script>
import {
invoiceStatusName,
kingdeeSyncStatusOptions,
paymentStatusOptions,
} from '@/option/settlement/formalSettlementSearch';
import SettlementTableTools from './settlement-table-tools.vue';
import { invoiceStatusName } from '@/option/settlement/formalSettlementSearch';
import { kingdeeSyncName, paymentStatusName } from '@/option/settlement/formalSettlement';
export default {
name: 'FormalSettlementTablePanel',
components: { SettlementTableTools },
props: {
option: { type: Object, required: true },
rows: { type: Array, default: () => [] },
columns: { type: Array, default: () => [] },
loading: { type: Boolean, default: false },
syncLoading: { type: Boolean, default: false },
page: { type: Object, required: true },
hasPermission: { type: Function, required: true },
mkEnabled: { type: Boolean, default: false },
searchVisible: { type: Boolean, default: true },
/** 是否展示付款申请按钮(仅付款结算单) */
showPaymentAction: { type: Boolean, default: true },
billLabel: { type: String, default: '结算单' },
@@ -158,66 +103,38 @@ export default {
'create',
'payment',
'sync',
'print',
'export',
'refresh',
'page-change',
'load',
'action',
'update:selection',
'update:searchVisible',
'search-change',
'search-reset',
],
data() {
return {
selection: [],
tableSize: 'default',
visibleColumnKeys: [],
knownColumnProps: [],
};
},
computed: {
columnSettingOptions() {
return this.columns.map(column => ({
prop: column.prop,
label: column.label,
}));
},
visibleColumns() {
if (!this.visibleColumnKeys.length) return this.columns;
return this.columns.filter(column => this.visibleColumnKeys.includes(column.prop));
// 分页对象由父级持有,avue 内部翻页时同步回写同一个对象
crudPage: {
get() {
return this.page;
},
set(value) {
Object.assign(this.page, value || {});
},
},
},
watch: {
columns: {
immediate: true,
handler(columns) {
const props = columns.map(column => column.prop);
if (!this.visibleColumnKeys.length) {
this.visibleColumnKeys = props;
this.knownColumnProps = props;
return;
}
const visible = new Set(this.visibleColumnKeys);
const known = new Set(this.knownColumnProps || []);
props.forEach(prop => {
if (!known.has(prop)) visible.add(prop);
});
this.knownColumnProps = props;
this.visibleColumnKeys = props.filter(prop => visible.has(prop));
},
},
rows() {
this.selection = [];
this.$refs.tableRef?.clearSelection();
this.$refs.crud?.toggleSelection?.();
this.$emit('update:selection', this.selection);
},
},
methods: {
handleCurrentChange(row) {
if (!row && this.selection.length === 1) {
this.selection = [];
this.$emit('update:selection', this.selection);
}
},
handleSelectionChange(selection) {
this.selection = selection;
this.$emit('update:selection', selection);
@@ -273,20 +190,19 @@ export default {
return invoiceStatusName(value, settlementType);
},
paymentName(value) {
return paymentStatusOptions.find(item => item.value === value)?.label || value || '-';
return paymentStatusName(value);
},
kingdeeSyncName(value) {
return kingdeeSyncStatusOptions.find(item => item.value === value)?.label || value || '-';
},
adjustFlag(row) {
// 原单已调整 / 重推生成的新单(显示来源原单号)
if (row.adjustStatusName) return row.adjustStatusName;
if (row.originFormalSettlementNo) return '调整后单';
return '-';
return kingdeeSyncName(value);
},
lockTag(row) {
if (row.kingdeeLockStatus === 'locked') {
return { show: true, type: 'danger', label: '金蝶锁定中', tip: '该单据已被金蝶锁定,不可编辑/作废' };
return {
show: true,
type: 'danger',
label: '金蝶锁定中',
tip: '该单据已被金蝶锁定,不可编辑/作废',
};
}
if (row.kingdeeLockStatus === 'failed') {
if ((row.kingdeeTryCount || 0) >= 5) {
@@ -316,30 +232,12 @@ export default {
}
return { show: false };
},
displayValue(value) {
return value === null || value === undefined || value === '' ? '-' : value;
},
formatMoney(value, currency = 'RMB') {
return `${Number(value || 0).toFixed(2)} ${currency || 'RMB'}`;
},
},
};
</script>
<style scoped lang="scss">
.fs-table-panel__toolbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
}
.fs-table-panel__links {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
}
.fs-table-panel__invoice-status {
.fs-invoice-status {
&.is-unreceived {
color: #f56c6c;
}
@@ -347,12 +245,7 @@ export default {
color: #e6a23c;
}
&.is-completed {
color: #67c23a;
color: #67c23c;
}
}
.fs-table-panel__pagination {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
</style>
@@ -20,7 +20,7 @@
<el-form-item :label="field.label" :prop="field.prop">
<el-input
v-if="field.type === 'contract'"
:model-value="formatContractOptionLabel(form)"
:model-value="form.contractName"
readonly
:disabled="!editable || details.length > 0"
placeholder="请选择合同"
@@ -53,6 +53,23 @@
:disabled="!editable"
@change="recalculateLocalAmount"
/>
<el-select
v-else-if="field.type === 'select' && editable"
v-model="form[field.prop]"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in formSelectOptions(field)"
:key="item.dictKey"
:label="item.dictValue"
:value="item.dictKey"
/>
</el-select>
<span v-else-if="field.type === 'select'" class="form-readonly">
{{ formSelectLabel(field, form[field.prop]) }}
</span>
<el-input
v-else-if="field.type === 'textarea'"
v-model="form[field.prop]"
@@ -251,29 +268,32 @@
:key="item.key"
:label="item.kind === 'fee' ? item.name : item.column.label"
:prop="item.kind === 'fee' ? undefined : item.column.prop"
:min-width="item.kind === 'fee' ? 130 : item.column.minWidth"
:min-width="item.kind === 'fee' ? 150 : item.column.minWidth"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">
<span v-if="item.kind === 'fee'" class="pre-settlement-editor__billing-rule-cell">
<span>
{{
formatMoney(
parseFeeItems(row.feeItemsJson)[item.name],
row.currency || form.currency
)
}}
</span>
<template #header>
<span class="pre-settlement-editor__billing-rule-cell">
<span>{{ item.kind === 'fee' ? item.name : item.column.label }}</span>
<el-icon
v-if="hasDetailBillingRule(row)"
v-if="showDetailColumnRuleIcon(item)"
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click.stop="openDetailBillingRule(row, item.name)"
@click.stop="openDetailColumnRule(item)"
>
<InfoFilled />
</el-icon>
</span>
</template>
<template #default="{ row }">
<span v-if="item.kind === 'fee'">
{{
formatMoney(
parseFeeItems(row.feeItemsJson)[item.name],
row.currency || form.currency
)
}}
</span>
<el-link
v-else-if="item.column.link && row[item.column.prop] && !publicMode"
type="primary"
@@ -284,19 +304,8 @@
<span v-else-if="item.column.money && item.column.prop === 'unitPrice'">
{{ formatUnitPrice(row) }}
</span>
<span
v-else-if="item.column.prop === 'freightAmount'"
class="pre-settlement-editor__billing-rule-cell"
>
<span>{{ formatMoney(row[item.column.prop], row.currency || form.currency) }}</span>
<el-icon
v-if="hasDetailBillingRule(row)"
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click.stop="openDetailBillingRule(row, '运输费')"
>
<InfoFilled />
</el-icon>
<span v-else-if="item.column.prop === 'freightAmount'">
{{ formatMoney(row[item.column.prop], row.currency || form.currency) }}
</span>
<span v-else-if="item.column.money">
{{ formatMoney(row[item.column.prop], row.currency || form.currency) }}
@@ -499,6 +508,11 @@
<span v-else>{{ displayValue(row[column.prop]) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center" fixed="right">
<template #default="{ row }">
<el-link type="primary" @click="openAdjustChangeRecord(row)">详情</el-link>
</template>
</el-table-column>
</el-table>
</section-card>
</div>
@@ -824,25 +838,28 @@
min-width="160"
align="center"
>
<template #default="{ row }">
<div class="pre-settlement-editor__billing-rule-cell">
<el-input-number
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, feeItem)"
/>
<template #header>
<span class="pre-settlement-editor__billing-rule-cell">
<span>{{ feeItem }}</span>
<el-icon
v-if="hasBillingRule(row)"
v-if="showAdjustFeeRuleIcon(feeItem)"
class="pre-settlement-editor__billing-rule-icon"
title="查看计费规则详情"
@click="openBillingRuleInfo(row, feeItem)"
@click.stop="openAdjustFeeRule(feeItem)"
>
<InfoFilled />
</el-icon>
</div>
</span>
</template>
<template #default="{ row }">
<el-input-number
v-model="row.feeItems[feeItem]"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, feeItem)"
/>
</template>
</el-table-column>
<el-table-column label="结算金额(含税)" min-width="170" align="center">
@@ -999,8 +1016,8 @@ import {
settlementDetailColumns,
settlementSummaryColumns,
} from '@/option/settlement/preSettlementTable';
import { formatContractOptionLabel } from '@/utils/contract';
import { isTierUnitPrice, isUnitPriceAdjustable } from '@/utils/settlement-adjust-rule';
import { isApprovalSettlementChange } from '@/utils/settlement-change-record';
import { normalizeCurrencyCode } from '@/utils/currency';
import { settlementStatusName } from '@/utils/settlementStatus';
import { downloadFileByUrl } from '@/utils/util';
@@ -1095,6 +1112,7 @@ export default {
},
feeOptions: [],
feeCategoryOptions: [],
businessModelOptions: [],
transportTypeOptions: [],
summaryFees: [],
details: [],
@@ -1144,6 +1162,8 @@ export default {
readonly: false,
detailId: '',
sourceDetailId: '',
// 未保存明细(id 仍等于来源应收应付明细)时先暂存,保存预结算单后再生效
draftMode: false,
detailLineNo: '',
reason: '',
},
@@ -1312,9 +1332,12 @@ export default {
if (value) this.initialize();
},
},
summaryTotal(value) {
this.form.settlementAmount = Number(value || 0).toFixed(2);
this.recalculateLocalAmount();
summaryTotal() {
this.syncSettlementAmountsFromSummary();
},
'form.exchangeRate'() {
if (this._skipExchangeRateRebuild) return;
this.buildSummaryFeesFromDetails();
},
filteredDetails: {
handler(list) {
@@ -1330,7 +1353,6 @@ export default {
methods: {
isTierUnitPrice,
isUnitPriceAdjustable,
formatContractOptionLabel,
hasPermission(code) {
return this.isAdmin || this.validData(this.permission?.[code], false);
},
@@ -1344,6 +1366,7 @@ export default {
if (!this.publicMode) {
await this.loadFeeOptions();
await this.loadFeeCategoryOptions();
await this.loadBusinessModelOptions();
await this.loadTransportTypeOptions();
await this.loadAttachmentTypeOptions();
}
@@ -1485,6 +1508,7 @@ export default {
this.detailFeeCache = {};
this.adjustDialog.detailId = '';
this.adjustDialog.sourceDetailId = '';
this.adjustDialog.draftMode = false;
this.adjustDialog.detailLineNo = '';
this.adjustChangeRecordVisible = false;
this.adjustChangeRecord = null;
@@ -1522,7 +1546,9 @@ export default {
availableWriteOffAmount: Number(row.availableWriteOffAmount || 0),
createTime: row.paymentCreateTime || row.createTime,
}));
this.changeRecords = detail.changeRecords || [];
this.changeRecords = (detail.changeRecords || []).filter(
row => !isApprovalSettlementChange(row.changeContent)
);
this.attachments = this.parseAttachments(detail.attachmentsJson);
this.sortAttachments();
this.selectedAttachmentRows = [];
@@ -1645,6 +1671,14 @@ export default {
const { data } = await getDictionary({ code: 'fee_category' });
this.feeCategoryOptions = data?.data || [];
},
async loadBusinessModelOptions() {
const { data } = await getDictionary({ code: 'business_model' });
const records = Array.isArray(data?.data) ? data.data : data?.data?.records || [];
this.businessModelOptions = records.map(item => ({
dictKey: item.dictKey ?? item.value,
dictValue: item.dictValue ?? item.label ?? item.name,
}));
},
async loadTransportTypeOptions() {
const { data } = await getDictionary({ code: 'transport_type' });
const records = Array.isArray(data?.data) ? data.data : data?.data?.records || [];
@@ -1653,6 +1687,21 @@ export default {
dictValue: item.dictValue ?? item.label ?? item.name,
}));
},
formSelectOptions(field) {
const key = field?.optionsKey;
const options = key ? this[key] : [];
return Array.isArray(options) ? options : [];
},
formSelectLabel(field, value) {
if (value === undefined || value === null || value === '') return '-';
const normalized = String(value).trim();
const option = this.formSelectOptions(field).find(
item =>
String(item.dictKey ?? '').trim() === normalized ||
String(item.dictValue ?? '').trim() === normalized
);
return option?.dictValue || normalized;
},
handleContractChange(id) {
const contract = this.contractOptions.find(item => String(item.id) === String(id));
if (!contract) {
@@ -1739,6 +1788,8 @@ export default {
return {
id: this.form.id || undefined,
contractId: this.form.contractId,
businessModel: this.form.businessModel || undefined,
transportType: this.form.transportType || undefined,
exchangeRateDate: this.form.exchangeRateDate || undefined,
exchangeRate: this.form.exchangeRate,
attachmentsJson: JSON.stringify(this.attachments || []),
@@ -1842,8 +1893,9 @@ export default {
.map(row => [`${row.feeType}\u0000${row.feeItem}`, row])
);
const appendSummary = (feeItem, originalValue, settlementValue, fallbackFeeType = '') => {
const originalAmount = Number(originalValue || 0);
const settlementAmount = Number(settlementValue || 0);
// 明细费用按本位币归集,外币结算时再按汇率换算成结算原币金额
const originalAmount = this.convertLocalToSettlementAmount(originalValue);
const settlementAmount = this.convertLocalToSettlementAmount(settlementValue);
if (!feeItem || !Number.isFinite(originalAmount) || !Number.isFinite(settlementAmount)) {
return;
}
@@ -1898,7 +1950,7 @@ export default {
});
nextFeeMap.forEach(row => orderedFees.push(row));
this.summaryFees = orderedFees;
this.recalculateLocalAmount();
this.syncSettlementAmountsFromSummary();
},
// 每条明细对应的费用行:[调整前基准行, 调整后当前行],缺少来源费用快照时退化为明细自身的汇总行。
resolveDetailFeePairs(detail) {
@@ -1986,17 +2038,21 @@ export default {
},
handleExchangeRateDateChange() {
this.fetchBfiExchangeRate();
this.recalculateLocalAmount();
},
async fetchBfiExchangeRate() {
if (!this.form.currency || this.form.currency === 'RMB') return;
if (!this.form.currency || this.form.currency === 'RMB') {
this.buildSummaryFeesFromDetails();
return;
}
if (!this.form.exchangeRateDate) return;
try {
const { data } = await getBfiExchangeRate(this.form.currency, this.form.exchangeRateDate);
const rateData = data?.data;
if (rateData?.excval != null) {
this._skipExchangeRateRebuild = true;
this.form.exchangeRate = Number(rateData.excval);
this.recalculateLocalAmount();
this._skipExchangeRateRebuild = false;
this.buildSummaryFeesFromDetails();
} else {
this.$message.warning(`未查询到 ${this.form.currency} 的BFI汇率数据`);
}
@@ -2004,9 +2060,39 @@ export default {
this.$message.warning('查询BFI汇率失败,请手动输入结算汇率');
}
},
/**
* 明细金额按本位币理解;外币结算时结算合计原金额/结算金额 = 本位币金额 / 结算汇率。
*/
convertLocalToSettlementAmount(localAmount) {
const amount = Number(localAmount || 0);
if (!Number.isFinite(amount)) return 0;
if (this.isLocalCurrencySettlement) {
return Number(amount.toFixed(2));
}
const rate = Number(this.form.exchangeRate || 0);
if (rate <= 0) return 0;
return Number((amount / rate).toFixed(2));
},
/**
* 结算金额取结算合计原币汇总值;本位币合计 = 结算金额 × 结算汇率。
*/
syncSettlementAmountsFromSummary() {
const settlementTotal = this.summaryFees.reduce(
(total, row) => total + Number(row.settlementAmount || 0),
0
);
this.form.settlementAmount = Number(settlementTotal || 0).toFixed(2);
if (this.isLocalCurrencySettlement) {
this.form.localSettlementAmount = this.form.settlementAmount;
this.form.exchangeRate = 1;
return;
}
const rate = Number(this.form.exchangeRate || 0);
this.form.localSettlementAmount =
rate > 0 ? (Number(this.form.settlementAmount || 0) * rate).toFixed(2) : '0.00';
},
recalculateLocalAmount() {
const rate = this.form.currency === 'RMB' ? 1 : Number(this.form.exchangeRate || 0);
this.form.localSettlementAmount = (Number(this.form.settlementAmount || 0) * rate).toFixed(2);
this.buildSummaryFeesFromDetails();
},
openCandidateDialog() {
if (!this.form.contractId) {
@@ -2249,17 +2335,21 @@ export default {
},
async openAdjustDialog(row, readonly) {
const detailRow = row;
const sourceDetailId = detailRow.sourceDetailId || '';
// 未保存明细 id 仍等于来源应收应付明细 id,调整结果先暂存
const draftMode =
!this.form.id ||
!detailRow.id ||
String(detailRow.id) === String(detailRow.sourceDetailId);
this.adjustDialog.visible = true;
this.adjustDialog.loading = true;
this.adjustDialog.readonly = readonly;
this.adjustDialog.draftMode = draftMode;
this.adjustDialog.detailId = detailRow.id;
this.adjustDialog.detailLineNo = detailRow.lineNo;
this.adjustDialog.sourceDetailId =
detailRow.id && String(detailRow.id) === String(detailRow.sourceDetailId)
? detailRow.sourceDetailId
: '';
const sourceDetailId = String(this.adjustDialog.sourceDetailId || '');
const pending = sourceDetailId ? this.pendingAdjustments[sourceDetailId] : null;
this.adjustDialog.sourceDetailId = sourceDetailId;
const pendingKey = String(sourceDetailId || '');
const pending = pendingKey ? this.pendingAdjustments[pendingKey] : null;
// 底部备注回显结算明细备注;暂存过的调整优先取暂存备注
this.adjustDialog.reason =
pending?.reason !== undefined && pending?.reason !== null
@@ -2276,11 +2366,12 @@ export default {
this.adjustRows = cachedFees.map(item => this.normalizeAdjustRow(item));
return;
}
if (sourceDetailId) {
if (!this.sourceFeeSnapshots[sourceDetailId]) {
this.sourceFeeSnapshots[sourceDetailId] = await this.loadSourceFeeRows(sourceDetailId);
if (draftMode && sourceDetailId) {
if (!this.sourceFeeSnapshots[String(sourceDetailId)]) {
this.sourceFeeSnapshots[String(sourceDetailId)] =
await this.loadSourceFeeRows(sourceDetailId);
}
this.adjustRows = this.cloneAdjustRows(this.sourceFeeSnapshots[sourceDetailId]);
this.adjustRows = this.cloneAdjustRows(this.sourceFeeSnapshots[String(sourceDetailId)]);
return;
}
const cachedFees = this.detailFeeCache[detailRow.id];
@@ -2307,6 +2398,17 @@ export default {
},
formatAdjustChangeValue(value) {
if (value === undefined || value === null || value === '') return '空';
if (Array.isArray(value)) {
if (!value.length) return '空';
return value
.map(item => {
if (!item || typeof item !== 'object') return String(item);
return Object.entries(item)
.map(([key, itemValue]) => `${key}:${this.formatAdjustChangeValue(itemValue)}`)
.join(',');
})
.join('\n');
}
if (typeof value === 'object') return JSON.stringify(value);
return String(value);
},
@@ -2369,12 +2471,60 @@ export default {
ruleFeeName(rule = {}) {
return String(rule.feeItem || rule.feeItemName || rule.name || '').trim();
},
isHandlingFeeItem(name) {
return String(name || '').includes('装卸');
},
feeNamesMatch(left, right) {
const source = String(left || '').trim();
const target = String(right || '').trim();
if (!source || !target) return false;
if (source === target) return true;
return this.isFreightFeeItem(source) && this.isFreightFeeItem(target);
if (this.isFreightFeeItem(source) && this.isFreightFeeItem(target)) return true;
return this.isHandlingFeeItem(source) && this.isHandlingFeeItem(target);
},
detailColumnFeeName(item = {}) {
if (item.kind === 'fee') return item.name || '';
if (item.column?.prop === 'freightAmount') return '运输费';
return '';
},
showDetailColumnRuleIcon(item) {
const feeName = this.detailColumnFeeName(item);
if (!feeName) return false;
return this.details.some(row => this.rowHasNamedBillingRule(row, feeName));
},
openDetailColumnRule(item) {
const feeName = this.detailColumnFeeName(item);
const row =
this.details.find(detail => this.rowHasNamedBillingRule(detail, feeName)) ||
this.details[0];
if (row) this.openDetailBillingRule(row, feeName);
},
showAdjustFeeRuleIcon(feeName) {
return (this.adjustRows || []).some(row => this.sourceHasNamedBillingRule(row, feeName));
},
openAdjustFeeRule(feeName) {
const row =
(this.adjustRows || []).find(item => this.sourceHasNamedBillingRule(item, feeName)) ||
this.adjustRows[0];
if (row) this.openBillingRuleInfo(row, feeName);
},
rowHasNamedBillingRule(row, feeName) {
return [row, ...this.detailFeeRows(row)].some(source =>
this.sourceHasNamedBillingRule(source, feeName)
);
},
sourceHasNamedBillingRule(source = {}, feeName) {
const rules = [
...this.collectBillingRules(source),
...(Array.isArray(source.billingRule?.rules) ? source.billingRule.rules : []),
];
if (rules.some(rule => this.feeNamesMatch(this.ruleFeeName(rule), feeName))) return true;
if (!this.hasBillingRule(source)) return false;
const named = String(
source.billingFeeItem || source.feeItem || this.ruleFeeName(source.billingRule) || ''
).trim();
if (!named) return true;
return this.feeNamesMatch(named, feeName);
},
collectBillingRules(row = {}) {
const source = row || {};
@@ -2493,7 +2643,7 @@ export default {
if (
['transportQuantity', 'mileage', 'unitPrice'].includes(changedField) &&
this.adjustDialog.sourceDetailId &&
row.id &&
(row.sourceFeeId || row.id) &&
(changedField !== 'unitPrice' || isUnitPriceAdjustable(row))
) {
this.scheduleSourceAdjustCalculation(row, changedField);
@@ -2509,7 +2659,8 @@ export default {
try {
const response = await calculateAdjustedFee({
detailId: this.adjustDialog.sourceDetailId,
feeId: row.id,
// 已保存预结算费用行需用源应收应付费用ID试算
feeId: row.sourceFeeId || row.id,
transportQuantity: Number(row.transportQuantity || 0),
mileage: Number(row.mileage || 0),
unitPrice: row.unitPrice === null || row.unitPrice === '' ? null : Number(row.unitPrice),
@@ -2535,6 +2686,7 @@ export default {
row.settlementAmountTax = Number(data.afterAmount || 0);
} catch (error) {
row.calculateError = error.message || '费用试算失败';
this.$message.warning(row.calculateError);
} finally {
if (version === row.adjustCalculateVersion) row.calculating = false;
}
@@ -2550,7 +2702,7 @@ export default {
}
this.adjustDialog.saving = true;
try {
if (this.adjustDialog.sourceDetailId) {
if (this.adjustDialog.draftMode && this.adjustDialog.sourceDetailId) {
this.pendingAdjustments[this.adjustDialog.sourceDetailId] = {
reason: this.adjustDialog.reason,
rows: this.adjustRows.map(row => ({ ...row, feeItems: { ...row.feeItems } })),
@@ -380,7 +380,13 @@ export default {
},
async loadFormalSettlements(keyword = '') {
const { data } = await api.getFormalSettlements(keyword);
this.candidates = data?.data || data || [];
const payload = data?.data ?? data;
// 兼容误返回分页对象的情况,只取正式结算单列表
this.candidates = Array.isArray(payload)
? payload
: Array.isArray(payload?.records)
? payload.records
: [];
},
async loadFeeOptions() {
const { data } = await api.getFeeOptions();
@@ -135,7 +135,7 @@
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="结算单上传" prop="file">
<el-form-item v-if="!readonly" label="结算单上传" prop="file">
<div class="settlement-import-create__upload">
<el-upload
ref="uploadRef"
@@ -143,13 +143,13 @@
accept=".xls,.xlsx"
:auto-upload="false"
:limit="1"
:disabled="readonly || !formReady"
:disabled="!formReady"
:file-list="files"
:on-change="onFileChange"
:on-exceed="onFileExceed"
:on-remove="onFileRemove"
>
<el-button type="primary" :disabled="readonly || !formReady">上传 Excel</el-button>
<el-button type="primary" :disabled="!formReady">上传 Excel</el-button>
</el-upload>
<el-link type="primary" :underline="false" @click="downloadTemplate">
下载模板
@@ -298,15 +298,10 @@
</el-table>
</section>
<div class="settlement-import-create__footer">
<div v-if="!readonly" class="settlement-import-create__footer">
<el-button @click="goBack">取消</el-button>
<el-button v-if="!readonly" :loading="draftLoading" @click="saveDraft">保存草稿</el-button>
<el-button
v-if="!readonly"
type="primary"
:loading="confirmLoading"
@click="confirmImport"
>
<el-button :loading="draftLoading" @click="saveDraft">保存草稿</el-button>
<el-button type="primary" :loading="confirmLoading" @click="confirmImport">
确认导入
</el-button>
</div>
@@ -577,6 +572,8 @@ const syncEditedText = (row, column, value) => {
if (column.prop !== 'vehicleNo') return;
applyVehicleNo(row, value);
};
const feeColumn = name => ({
prop: name,
label: name,
editor: 'number',
@@ -607,6 +604,38 @@ const dedupeColumns = columns => {
});
};
const settlementAmountColumn = {
prop: 'settlementAmount',
label: '结算金额',
editor: 'number',
minWidth: 120,
};
/** 模板已去掉结算金额;明细仍展示,并插在费用项之后、日期列之前 */
const ensureSettlementAmountColumn = columns => {
if (columns.some(column => column.prop === 'settlementAmount')) {
return columns;
}
const result = [...columns];
let insertAt = result.findIndex(column =>
['actualStartDate', 'actualEndDate', 'planStartDate', 'planEndDate', 'remark', 'waybillIdentifier'].includes(
column.prop
)
);
if (insertAt < 0) {
const lastFeeIndex = [...result].map((column, index) => (column.isFeeItem ? index : -1)).filter(index => index >= 0).pop();
const transportFeeIndex = result.findIndex(column => column.prop === 'transportFee');
insertAt =
lastFeeIndex !== undefined
? lastFeeIndex + 1
: transportFeeIndex >= 0
? transportFeeIndex + 1
: result.length;
}
result.splice(insertAt, 0, { ...settlementAmountColumn });
return result;
};
const detailColumns = computed(() => {
const historyColumns =
form.waybillMode === 'history'
@@ -622,16 +651,13 @@ const detailColumns = computed(() => {
const fallback = [
...columnsBeforeFee,
...feeItemNames.value.map(name => feeColumn(name)),
{
prop: 'settlementAmount',
label: '结算金额',
editor: 'number',
minWidth: 120,
},
{ ...settlementAmountColumn },
...columnsAfterFee,
];
const uploaded = parsedHeaders.value.map(columnFromHeader).filter(Boolean);
const columns = dedupeColumns(uploaded.length ? uploaded : fallback);
const columns = ensureSettlementAmountColumn(
dedupeColumns(uploaded.length ? uploaded : fallback)
);
return [...historyColumns, ...columns];
});
@@ -720,6 +746,7 @@ const formatCell = (row, column) => {
return value ?? '';
};
/** 导入解析后自动合计结算金额;编辑运输费/费用项时不再回算 */
const recalcSettlementAmount = row => {
const transportFee = toNumber(row.transportFee ?? row.freight);
row.transportFee = transportFee;
@@ -738,6 +765,18 @@ const recalcSettlementAmount = row => {
row.settlementAmount = settlementAmount;
row.otherFeeTotal = Number(feeSum.toFixed(2));
row.freightTotal = settlementAmount;
row['运费合计'] = settlementAmount;
};
const syncOtherFeeTotal = row => {
if (!row.feeItems || typeof row.feeItems !== 'object') {
row.feeItems = {};
}
let feeSum = 0;
feeItemNames.value.forEach(name => {
feeSum += toNumber(row.feeItems[name] ?? row[name]);
});
row.otherFeeTotal = Number(feeSum.toFixed(2));
};
const updateNumberCell = (row, column, value) => {
@@ -747,17 +786,16 @@ const updateNumberCell = (row, column, value) => {
if (!row.feeItems) row.feeItems = {};
row.feeItems[column.prop] = '';
row[column.prop] = '';
} else {
row[column.prop] = column.editor === 'optionalNumber' ? '' : '';
if (column.prop === 'transportFee') row.freight = '';
if (column.prop === 'unitPrice') row.transportUnitPrice = '';
}
if (column.prop === 'settlementAmount') {
row.settlementAmount = '';
row.freightTotal = '';
syncOtherFeeTotal(row);
return;
}
recalcSettlementAmount(row);
row[column.prop] = '';
if (column.prop === 'transportFee') row.freight = '';
if (column.prop === 'unitPrice') row.transportUnitPrice = '';
if (column.prop === 'settlementAmount') {
row.freightTotal = '';
row['运费合计'] = '';
}
return;
}
const [integer = '', decimal = ''] = raw.replace(/[^\d.]/g, '').split('.');
@@ -767,21 +805,20 @@ const updateNumberCell = (row, column, value) => {
if (!row.feeItems) row.feeItems = {};
row.feeItems[column.prop] = normalized;
row[column.prop] = normalized;
} else {
row[column.prop] = normalized;
if (column.prop === 'transportFee') {
row.freight = normalized;
}
if (column.prop === 'unitPrice') {
row.transportUnitPrice = normalized;
}
if (column.prop === 'settlementAmount') {
row.freightTotal = normalized;
row['运费合计'] = normalized;
return;
}
syncOtherFeeTotal(row);
return;
}
row[column.prop] = normalized;
if (column.prop === 'transportFee') {
row.freight = normalized;
}
if (column.prop === 'unitPrice') {
row.transportUnitPrice = normalized;
}
if (column.prop === 'settlementAmount') {
row.freightTotal = normalized;
row['运费合计'] = normalized;
}
recalcSettlementAmount(row);
};
const importFieldText = value => String(value ?? '').trim();
@@ -857,11 +894,8 @@ const normalizeParsedRow = (item, index) => {
applyVehicleNo(row, vehicleNo);
row.transportUnitPrice = row.unitPrice;
row.freight = row.transportFee;
if (row.settlementAmount === '' || row.settlementAmount === null || row.settlementAmount === undefined) {
recalcSettlementAmount(row);
} else {
row.freightTotal = row.settlementAmount;
}
// 模板无结算金额列:导入后按运输费+费用项自动合计
recalcSettlementAmount(row);
return row;
};
@@ -892,14 +926,34 @@ const stripInternalRowFields = row => {
};
};
/** 合并费用列名与各行 feeItems 键,避免保存/回显时丢动态费用列 */
const collectFeeItemNames = (preferred = [], detailRows = []) => {
const names = [];
const seen = new Set();
const pushName = value => {
const name = String(value || '').trim();
if (!name || seen.has(name)) return;
seen.add(name);
names.push(name);
};
(preferred || []).forEach(pushName);
(detailRows || []).forEach(row => {
const feeItems = row?.feeItems;
if (!feeItems || typeof feeItems !== 'object' || Array.isArray(feeItems)) return;
Object.keys(feeItems).forEach(pushName);
});
return names;
};
const buildPayload = () => {
const { file, ...batch } = form;
const payloadRows = rows.value.map(stripInternalRowFields);
return {
...batch,
settlementBillType: form.settlementType === 'payable' ? form.settlementBillType || 'formal' : 'formal',
waybillMode: form.waybillMode === 'history' ? 'history' : 'new',
feeItemNames: [...feeItemNames.value],
rows: rows.value.map(stripInternalRowFields),
feeItemNames: collectFeeItemNames(feeItemNames.value, payloadRows),
rows: payloadRows,
};
};
@@ -1344,22 +1398,18 @@ const confirmImport = async () => {
const loadTransportTypeOptions = async () => {
try {
// 运输方式取业务字典 transport_type 的字典名称(dictValue),不写死枚举
const response = await getDictionary({ code: 'transport_type' });
const list = unwrapData(response) || [];
transportTypeOptions.value = (Array.isArray(list) ? list : [])
.map(item => {
const label = item.dictValue || item.label || item.name || '';
const value = item.dictValue || item.dictKey || item.value || label;
return label ? { label, value } : null;
const label = String(item.dictValue || item.label || item.name || '').trim();
if (!label || String(item.dictKey) === '-1') return null;
return { label, value: label };
})
.filter(Boolean);
} catch (error) {
transportTypeOptions.value = [
{ label: '公路运输', value: '公路运输' },
{ label: '铁路运输', value: '铁路运输' },
{ label: '水路运输', value: '水路运输' },
{ label: '航空运输', value: '航空运输' },
];
transportTypeOptions.value = [];
}
};
@@ -1406,17 +1456,27 @@ const loadDetail = async id => {
if (detail.projectId) {
await loadContractsByProject(detail.projectId, detail.projectName || '');
}
feeItemNames.value = Array.isArray(detail.feeItemNames) ? detail.feeItemNames : [];
parsedHeaders.value = [];
const detailRows = Array.isArray(detail.rows) ? detail.rows : [];
// 先按库中列名与明细 feeItems 合并,再规范化行数据,保证草稿再打开仍展示全部费用列
feeItemNames.value = collectFeeItemNames(
Array.isArray(detail.feeItemNames) ? detail.feeItemNames : [],
detailRows
);
rows.value = detailRows.map((item, index) => normalizeParsedRow(item, index));
refreshDuplicateFlags();
readonly.value = detail.importStatus && detail.importStatus !== 'draft';
// 查看模式始终只读;编辑时仅草稿可改,已完成/已作废强制只读
readonly.value =
route.query.mode === 'view' ||
Boolean(detail.importStatus && detail.importStatus !== 'draft');
};
const initPage = async () => {
await loadOptions();
const id = route.query.id;
if (route.query.mode === 'view') {
readonly.value = true;
}
if (id) {
await loadDetail(id);
return;
@@ -125,15 +125,17 @@
<span class="reconciliation-editor__filter-label">货物名称</span>
<el-input v-model="internalQuery.cargoName" placeholder="请输入" clearable />
</div>
<el-button @click="resetInternalQuery">重置</el-button>
<el-button type="primary" @click="internalFilterTick++">查询</el-button>
<el-button
type="primary"
plain
:disabled="!filteredInternalRows.length"
@click="exportInternalDetails"
>导出</el-button
>
<div class="reconciliation-editor__filter-actions">
<el-button @click="resetInternalQuery">重置</el-button>
<el-button type="primary" @click="internalFilterTick++">查询</el-button>
<el-button
type="primary"
plain
:disabled="!filteredInternalRows.length"
@click="exportInternalDetails"
>导出</el-button
>
</div>
</div>
<el-table
:data="filteredInternalRows"
@@ -189,6 +191,9 @@
"
>{{ formatDate(row[column.prop]) }}</span
>
<span v-else-if="column.prop === 'unitPrice'">{{
formatOptionalMoney(row.unitPrice)
}}</span>
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
<span v-else>{{ displayValue(row[column.prop]) }}</span>
</template>
@@ -263,7 +268,7 @@
<template v-else-if="isExternalRowEditing(row) && isExternalEditableColumn(column.prop)">
<el-input-number
v-if="column.feeItemName"
v-model="row.feeItems[column.feeItemName]"
v-model="externalEditTarget(row).feeItems[column.feeItemName]"
:min="0"
:precision="2"
:controls="false"
@@ -271,7 +276,7 @@
/>
<el-date-picker
v-else-if="isExternalDateColumn(column.prop)"
v-model="row[column.prop]"
v-model="externalEditTarget(row)[column.prop]"
type="date"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
@@ -280,7 +285,7 @@
/>
<el-input-number
v-else-if="isExternalNumberColumn(column.prop)"
v-model="row[column.prop]"
v-model="externalEditTarget(row)[column.prop]"
:min="0"
:precision="2"
:controls="false"
@@ -288,7 +293,7 @@
/>
<el-select
v-else-if="column.prop === 'transportType'"
v-model="row[column.prop]"
v-model="externalEditTarget(row)[column.prop]"
size="small"
clearable
placeholder="请选择"
@@ -300,7 +305,7 @@
:value="item.value"
/>
</el-select>
<el-input v-else v-model="row[column.prop]" size="small" />
<el-input v-else v-model="externalEditTarget(row)[column.prop]" size="small" />
</template>
<span v-else-if="column.prop === 'transportType'">
{{ transportTypeLabel(row.transportType) }}
@@ -318,6 +323,9 @@
"
>{{ formatDate(row[column.prop]) }}</span
>
<span v-else-if="column.prop === 'unitPrice'">{{
formatOptionalMoney(row.unitPrice)
}}</span>
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
<span v-else>{{ displayValue(row[column.prop]) }}</span>
</template>
@@ -476,6 +484,7 @@
<span v-else-if="column.feeItemName">{{ formatMoney(getFeeItemAmount(row, column.feeItemName)) }}</span>
<span v-else-if="column.prop === 'mileage'">{{ formatMileage(row.mileage) }}</span>
<span v-else-if="column.prop === 'actualDepartureTime' || column.prop === 'actualCompletionTime'">{{ formatDate(row[column.prop]) }}</span>
<span v-else-if="column.prop === 'unitPrice'">{{ formatOptionalMoney(row.unitPrice) }}</span>
<span v-else-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
<span v-else>{{ displayValue(row[column.prop]) }}</span>
</template>
@@ -630,6 +639,10 @@ import { getDictionary } from '@/api/system/dictbiz';
import { Search } from '@element-plus/icons-vue';
import { h } from 'vue';
import { downloadXls } from '@/utils/util';
import {
consumeImportResponse,
resolveImportErrorMessage,
} from '@/utils/import-excel';
import { transportReconciliationFormFields } from '@/option/settlement/transportReconciliationForm';
import {
internalColumns,
@@ -676,6 +689,8 @@ export default {
completionDialog: { visible: false, loading: false },
completionSummaryRowsData: null,
externalEditing: {},
// 调整中的草稿,输入只改草稿,点「完成」才写回列表
externalEditDrafts: {},
externalEditSnapshots: {},
matchingStarted: false,
rules: {
@@ -932,6 +947,7 @@ export default {
this.internalDetails = [];
this.externalDetails = [];
this.externalEditing = {};
this.externalEditDrafts = {};
this.externalEditSnapshots = {};
this.completionSummaryRowsData = null;
this.matchingStarted = false;
@@ -1038,12 +1054,24 @@ export default {
.map(normalized)
.join('|');
},
blankOptionalNumber(value) {
if (value === null || value === undefined || value === '' || Number(value) === -1) {
return null;
}
return value;
},
normalizeInternalRow(row) {
const feeItems =
row.feeItems && typeof row.feeItems === 'object' && Object.keys(row.feeItems).length
? row.feeItems
: this.parseFeeItems(row.feeItemsJson);
return { ...row, feeItems };
return {
...row,
feeItems,
unitPrice: this.blankOptionalNumber(row.unitPrice),
mileage: this.blankOptionalNumber(row.mileage),
freightAmount: this.blankOptionalNumber(row.freightAmount),
};
},
normalizeExternalRow(row, index) {
const feeItems =
@@ -1053,6 +1081,9 @@ export default {
return {
...row,
feeItems,
unitPrice: this.blankOptionalNumber(row.unitPrice),
mileage: this.blankOptionalNumber(row.mileage),
freightAmount: this.blankOptionalNumber(row.freightAmount),
_externalKey: row.id || row.externalLineNo || `external-${index}`,
};
},
@@ -1280,6 +1311,9 @@ export default {
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
snapshot.unitPrice = this.blankOptionalNumber(row.unitPrice);
snapshot.mileage = this.blankOptionalNumber(row.mileage);
snapshot.freightAmount = this.blankOptionalNumber(row.freightAmount);
return snapshot;
});
},
@@ -1293,6 +1327,9 @@ export default {
snapshot.feeItemsJson = row.feeItemsJson || JSON.stringify(row.feeItems || {});
snapshot.actualDepartureTime = this.normalizeExternalDateTime(row.actualDepartureTime);
snapshot.actualCompletionTime = this.normalizeExternalDateTime(row.actualCompletionTime);
snapshot.unitPrice = this.blankOptionalNumber(row.unitPrice);
snapshot.mileage = this.blankOptionalNumber(row.mileage);
snapshot.freightAmount = this.blankOptionalNumber(row.freightAmount);
snapshot.suspectedDuplicate = duplicateIds.has(String(row.id));
return snapshot;
});
@@ -1322,7 +1359,7 @@ export default {
}
},
async handleUpdate() {
await this.$confirm('将以外部账单数据更新运单及内部结算明细,是否继续?', '更新账单', {
await this.$confirm('将以外部账单数据更新内部结算明细,是否继续?', '更新账单', {
type: 'warning',
});
this.actionLoading = true;
@@ -1503,23 +1540,24 @@ export default {
this.form.reconciliationMode === 'cargo'
? await api.importCargo(this.currentId, file)
: await api.importVehicle(this.currentId, file);
const contentType = response.headers?.['content-type'] || response.data?.type || '';
if (contentType.includes('spreadsheetml') || contentType.includes('ms-excel')) {
downloadXls(
response.data,
`运输对账导入失败明细${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`
);
// 成功时 axios 拦截器可能已把 JSON Blob 解析成对象,不能再调 .text()
const consumed = await consumeImportResponse(response, {
businessName: '运输对账',
dayjsFormat: this.$dayjs().format('YYYY-MM-DD HH-mm-ss'),
});
if (consumed.kind === 'excel') {
downloadXls(consumed.blob, consumed.fileName);
this.$message.warning('部分数据导入失败,已下载失败明细');
} else {
const result = JSON.parse(await response.data.text());
if (result.code !== 200) throw new Error(result.msg || '导入失败');
this.$message.success('外部账单导入成功');
}
this.matchingStarted = false;
await this.loadDetail();
this.matchingStarted = false;
} catch (error) {
this.$message.error(error.message || '外部账单导入失败');
if (!error?._notified) {
this.$message.error(await resolveImportErrorMessage(error));
}
}
},
async downloadTemplate(mode) {
@@ -1661,6 +1699,28 @@ export default {
isExternalRowEditing(row) {
return Boolean(this.externalEditing[this.externalRowKey(row)]);
},
cloneExternalEditRow(row) {
return {
...row,
feeItems: { ...(row.feeItems || this.parseFeeItems(row.feeItemsJson)) },
};
},
/** 编辑态绑定草稿,避免输入时实时改写列表导致疑似重复 Tab 刷新 */
externalEditTarget(row) {
const key = this.externalRowKey(row);
return this.externalEditDrafts[key] || row;
},
clearExternalEditState(key) {
const editing = { ...this.externalEditing };
const drafts = { ...this.externalEditDrafts };
const snapshots = { ...this.externalEditSnapshots };
delete editing[key];
delete drafts[key];
delete snapshots[key];
this.externalEditing = editing;
this.externalEditDrafts = drafts;
this.externalEditSnapshots = snapshots;
},
isExternalEditableColumn(prop) {
return !['externalLineNo', 'matchStatus'].includes(prop);
},
@@ -1672,34 +1732,30 @@ export default {
},
openExternalAdjust(row) {
const key = this.externalRowKey(row);
const draft = this.cloneExternalEditRow(row);
this.externalEditSnapshots = {
...this.externalEditSnapshots,
[key]: { ...row },
[key]: this.cloneExternalEditRow(row),
};
this.externalEditDrafts = { ...this.externalEditDrafts, [key]: draft };
this.externalEditing = { ...this.externalEditing, [key]: true };
},
cancelExternalAdjust(row) {
const key = this.externalRowKey(row);
const snapshot = this.externalEditSnapshots[key];
if (snapshot) Object.assign(row, snapshot);
const editing = { ...this.externalEditing };
const snapshots = { ...this.externalEditSnapshots };
delete editing[key];
delete snapshots[key];
this.externalEditing = editing;
this.externalEditSnapshots = snapshots;
this.clearExternalEditState(this.externalRowKey(row));
},
async finishExternalAdjust(row) {
row.feeItemsJson = JSON.stringify(row.feeItems || {});
const key = this.externalRowKey(row);
const editing = { ...this.externalEditing };
const snapshots = { ...this.externalEditSnapshots };
delete editing[key];
delete snapshots[key];
this.externalEditing = editing;
this.externalEditSnapshots = snapshots;
const draft = this.externalEditDrafts[key];
if (draft) {
const feeItems = { ...(draft.feeItems || {}) };
Object.assign(row, draft, { feeItems });
row.feeItemsJson = JSON.stringify(feeItems);
} else {
row.feeItemsJson = JSON.stringify(row.feeItems || {});
}
this.clearExternalEditState(key);
this.refreshLocalStats();
this.$message.success('调整已暂存');
this.$message.success('调整已暂存,匹配或完成对账后生效');
},
normalizeExternalDateTime(value) {
if (!value) return null;
@@ -1743,7 +1799,8 @@ export default {
differenceQuantity: Math.abs(internalQuantity - externalQuantity),
differenceAmount: Math.abs(internalAmount - externalAmount),
matchedCount,
unmatchedCount: internalUnmatched + externalUnmatched,
// 无法匹配按内部账单条数统计,不叠加外部未匹配数
unmatchedCount: internalUnmatched,
matchStatus:
this.internalDetails.length > 0 &&
this.internalDetails.length === this.externalDetails.length &&
@@ -1808,7 +1865,10 @@ export default {
: Number(value || 0).toFixed(2);
},
formatMileage(value) {
return Number(value) === -1 ? '' : this.displayValue(value);
return this.blankOptionalNumber(value) === null ? '' : this.displayValue(value);
},
formatOptionalMoney(value, currency = 'RMB') {
return this.blankOptionalNumber(value) === null ? '-' : this.formatMoney(value, currency);
},
formatDate(value) {
if (value === null || value === undefined || value === '') return '-';
@@ -1929,15 +1989,26 @@ export default {
}
.reconciliation-editor__filter {
display: grid;
grid-template-columns: repeat(4, minmax(160px, 1fr)) auto auto;
grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
gap: 8px;
margin-bottom: 12px;
align-items: center;
}
.reconciliation-editor__filter-item {
display: flex;
align-items: center;
min-width: 0;
}
.reconciliation-editor__filter-actions {
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
}
.reconciliation-editor__filter-actions .el-button {
min-width: 64px;
margin-left: 0;
}
.reconciliation-editor__filter-label {
flex: 0 0 auto;
margin-right: 8px;
+100 -240
View File
@@ -1,89 +1,39 @@
<template>
<basic-container class="formal-page">
<section v-show="searchVisible" class="formal-page__search">
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
<div class="formal-page__search-grid">
<el-form-item v-for="field in visibleSearchFields" :key="field.prop" :label="field.label">
<el-date-picker
v-if="field.type === 'daterange'"
v-model="query[field.prop]"
type="daterange"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
range-separator="~"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-select
v-else-if="field.type === 'select'"
v-model="query[field.prop]"
clearable
placeholder="请选择"
>
<el-option
v-for="item in field.options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-cascader
v-else-if="field.type === 'cascader'"
v-model="query[field.prop]"
:options="organizationTreeOptions"
:props="organizationCascaderProps"
clearable
filterable
style="width: 100%"
placeholder="请选择"
/>
<el-input v-else v-model="query[field.prop]" clearable placeholder="请输入" />
</el-form-item>
<div class="formal-page__search-actions">
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="resetSearch">重置</el-button>
<el-button text :icon="searchExpanded ? ArrowUp : ArrowDown" @click="toggleSearch">
{{ searchExpanded ? '收起' : '展开' }}
</el-button>
</div>
</div>
</el-form>
</section>
<section class="formal-page__table-panel">
<el-tabs
v-if="!lockedSettlementType"
type="border-card"
v-model="activeSettlementType"
@tab-change="handleSettlementTypeChange"
>
<el-tab-pane label="应付" name="payable">
<formal-settlement-table-panel
:key="'payable'"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</el-tab-pane>
<el-tab-pane label="应收" name="receivable">
<formal-settlement-table-panel
:key="'receivable'"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</el-tab-pane>
</el-tabs>
<formal-settlement-table-panel
v-else
:key="activeSettlementType"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</section>
<el-tabs
v-if="!lockedSettlementType"
type="border-card"
v-model="activeSettlementType"
@tab-change="handleSettlementTypeChange"
>
<el-tab-pane label="应付" name="payable">
<formal-settlement-table-panel
v-if="activeSettlementType === 'payable'"
key="payable"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</el-tab-pane>
<el-tab-pane label="应收" name="receivable">
<formal-settlement-table-panel
v-if="activeSettlementType === 'receivable'"
key="receivable"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
</el-tab-pane>
</el-tabs>
<formal-settlement-table-panel
v-else
key="locked"
v-bind="tablePanelProps"
v-on="tablePanelListeners"
/>
<formal-settlement-editor
v-model="editor.visible"
:record-id="editor.id"
:readonly="editor.readonly"
@success="loadTable"
@success="onLoad(page)"
/>
<el-dialog
v-model="paymentDialog.visible"
@@ -152,7 +102,6 @@
</template>
<script>
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
import { mapGetters } from 'vuex';
import { createSettlementTransfer } from '@/utils/settlement-transfer';
import {
@@ -164,33 +113,13 @@ import { isAdministrator } from '@/utils/auth';
import { downloadFile } from '@/utils/util';
import * as api from '@/api/settlement/formalSettlement';
import * as paymentApi from '@/api/payment/paymentApplication';
import {
invoiceStatusName,
formalSettlementSearchFields,
paymentStatusOptions,
} from '@/option/settlement/formalSettlementSearch';
import { formalSettlementOption } from '@/option/settlement/formalSettlement';
import organizationSearch from '@/mixins/organization-search';
import { formalSettlementTableColumns } from '@/option/settlement/formalSettlementTable';
import FormalSettlementEditor from './components/formal-settlement-editor.vue';
import FormalSettlementTablePanel from './components/formal-settlement-table-panel.vue';
import { submitMkApprovalFlow, loadMkEnabled } from '@/utils/mk-approval';
import { getMKApprovalUrl } from '@/api/system/business-process';
const emptyQuery = () => ({
formalSettlementNo: '',
preSettlementNo: '',
projectName: '',
deptName: [],
contractNo: '',
payerName: '',
payeeName: '',
invoiceStatus: '',
paymentStatus: '',
approvalStatus: '',
kingdeeSyncStatus: '',
createDateRange: [],
});
export default {
name: 'FormalSettlement',
components: { FormalSettlementEditor, FormalSettlementTablePanel },
@@ -205,19 +134,15 @@ export default {
},
data() {
return {
ArrowDown,
ArrowUp,
query: emptyQuery(),
searchExpanded: false,
searchVisible: true,
option: formalSettlementOption(),
query: {},
activeSettlementType: 'payable',
searchFields: formalSettlementSearchFields,
columns: formalSettlementTableColumns,
rows: [],
selection: [],
loading: false,
approveLoading: false,
syncLoading: false,
page: { current: 1, size: 10, total: 0 },
page: { currentPage: 1, pageSize: 10, pageSizes: [10, 20, 50, 100], total: 0 },
editor: { visible: false, id: null, readonly: false },
paymentDialog: {
visible: false,
@@ -248,14 +173,13 @@ export default {
},
tablePanelProps() {
return {
option: this.option,
rows: this.rows,
columns: this.columns,
loading: this.loading,
page: this.page,
hasPermission: this.hasPermissionFn,
syncLoading: this.syncLoading,
mkEnabled: this.mkEnabled,
searchVisible: this.searchVisible,
showPaymentAction: this.activeSettlementType === 'payable',
billLabel: this.billLabel,
};
@@ -266,20 +190,16 @@ export default {
payment: this.openPaymentDialog,
sync: this.handleSync,
export: this.handleExport,
refresh: this.loadTable,
'page-change': this.onPageChange,
refresh: () => this.onLoad(this.page),
load: this.onLoad,
action: this.onAction,
'search-change': this.searchChange,
'search-reset': this.searchReset,
'update:selection': selection => {
this.selection = selection;
},
'update:searchVisible': visible => {
this.searchVisible = visible;
},
};
},
visibleSearchFields() {
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
},
paymentAvailable() {
return this.paymentRemaining(this.paymentDialog.row);
},
@@ -293,6 +213,10 @@ export default {
}
},
},
activeSettlementType() {
// 切换结算类型后由新挂载的 avue-crud 触发 on-load,此处只重置分页,避免重复请求
this.page.currentPage = 1;
},
'$route.query.detailNo'(detailNo) {
if (detailNo) this.openRouteDetail(detailNo);
},
@@ -300,13 +224,9 @@ export default {
created() {
// 标签机制按 fullPath 缓存同页多实例:仅当前路由实例应响应 detailNo 跳转,防止缓存旧实例也弹窗
this.ownFullPath = this.$route.fullPath;
this.loadOrganizationOptions();
},
mounted() {
if (this.lockedSettlementType === 'payable' || this.lockedSettlementType === 'receivable') {
this.activeSettlementType = this.lockedSettlementType;
}
this.loadOrganizationOptions();
this.loadTable();
this.openRouteDetail();
loadMkEnabled()
.then(enabled => {
@@ -319,18 +239,18 @@ export default {
activated() {
if (sessionStorage.getItem('formal-settlement-list-refresh') === '1') {
sessionStorage.removeItem('formal-settlement-list-refresh');
this.loadTable();
this.onLoad(this.page);
}
},
methods: {
hasPermission(actionOrCode) {
return this.hasPermissionFn(actionOrCode);
},
async loadTable() {
async onLoad(page) {
this.loading = true;
try {
const params = this.buildQueryParams();
const response = await api.getList(this.page.current, this.page.size, params);
const response = await api.getList(page.currentPage, page.pageSize, params);
const data = this.unwrapData(response);
this.rows = data.records || [];
this.page.total = data.total || 0;
@@ -338,25 +258,24 @@ export default {
this.loading = false;
}
},
handleSearch() {
this.page.current = 1;
this.loadTable();
searchChange(params, done) {
// 所属组织级联返回 id 路径,转成组织名称传给后端
this.normalizeOrganizationSearch(params, 'deptName');
const range = params.createDateRange || [];
delete params.createDateRange;
this.query = {
...params,
createStartDate: range[0] || '',
createEndDate: range[1] || '',
};
this.page.currentPage = 1;
this.onLoad(this.page);
done();
},
resetSearch() {
this.query = emptyQuery();
this.handleSearch();
},
toggleSearch() {
this.searchExpanded = !this.searchExpanded;
},
handleSizeChange() {
this.page.current = 1;
this.loadTable();
},
onPageChange({ current, size }) {
this.page.current = current;
this.page.size = size;
this.loadTable();
searchReset() {
this.query = {};
this.page.currentPage = 1;
this.onLoad(this.page);
},
onAction({ type, row }) {
const handlers = {
@@ -418,7 +337,7 @@ export default {
await this.$confirm(`确认删除该${this.billLabel}草稿?`, '提示', { type: 'warning' });
await api.remove(row.id);
this.$message.success('删除成功');
this.loadTable();
this.onLoad(this.page);
},
async handleSubmit(row) {
await this.$confirm('提交后来源预付结算单将保持锁定,确认提交?', '提示', { type: 'warning' });
@@ -432,7 +351,7 @@ export default {
mkEnabled: this.mkEnabled,
});
this.$message.success('提交成功');
this.loadTable();
this.onLoad(this.page);
},
handleMkAudit(row) {
if (!row?.id) {
@@ -453,15 +372,21 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm(
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
'提示',
{ type: 'warning' }
);
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm(
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
'提示',
{ type: 'warning' }
);
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
if (res.data.data === false) {
@@ -469,9 +394,10 @@ export default {
} else {
this.$message.success(res.data.msg || '审批通过');
}
await this.loadTable();
this.onLoad(this.page);
} finally {
this.loading = false;
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
@@ -480,7 +406,7 @@ export default {
});
await api.returnBill({ id: row.id, reason: value });
this.$message.success('已驳回');
this.loadTable();
this.onLoad(this.page);
},
async handleVoid(row) {
const { value } = await this.$prompt('请输入作废原因', `作废${this.billLabel}`, {
@@ -488,7 +414,7 @@ export default {
});
await api.voidBill({ id: row.id, reason: value });
this.$message.success('已作废');
this.loadTable();
this.onLoad(this.page);
},
selectedOne(action) {
if (this.selection.length !== 1) {
@@ -518,7 +444,7 @@ export default {
lastFailReason = String(error?.message || error || '未知错误').trim() || '未知错误';
}
}
await this.loadTable();
await this.onLoad(this.page);
if (rows.length === 1) {
if (failCount) {
await this.$alert(`同步失败,${lastFailReason}`, '同步结果', {
@@ -642,7 +568,7 @@ export default {
);
this.paymentDialog.visible = false;
this.selection = [];
this.loadTable();
this.onLoad(this.page);
} finally {
this.paymentDialog.loading = false;
}
@@ -692,15 +618,8 @@ export default {
);
},
buildQueryParams() {
// 所属组织级联返回 id 路径,转成组织名称传给后端(用副本,避免污染搜索框回显)
const params = this.normalizeOrganizationSearch({ ...this.query }, 'deptName');
const params = { ...this.query };
params.settlementType = this.lockedSettlementType || this.activeSettlementType;
const range = params.createDateRange || [];
delete params.createDateRange;
if (range.length === 2) {
params.createStartDate = range[0];
params.createEndDate = range[1];
}
return params;
},
unwrapData(response) {
@@ -708,8 +627,8 @@ export default {
return body?.data || body;
},
handleSettlementTypeChange() {
this.page.current = 1;
this.loadTable();
// 分页重置与数据加载由 activeSettlementType watcher + 新挂载 crud 的 on-load 完成
this.selection = [];
},
escapeHtml(value) {
return String(value || '-').replace(
@@ -717,24 +636,6 @@ export default {
char => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[char])
);
},
isEditable(row) {
return ['draft', 'returned'].includes(row.approvalStatus);
},
statusType(status) {
return (
{ approved: 'success', reviewing: 'warning', returned: 'danger', voided: 'info' }[status] ||
''
);
},
invoiceName(value, settlementType) {
return invoiceStatusName(value, settlementType);
},
paymentName(value) {
return paymentStatusOptions.find(item => item.value === value)?.label || value || '-';
},
displayValue(value) {
return value === null || value === undefined || value === '' ? '-' : value;
},
formatMoney(value, currency = 'RMB') {
return `${Number(value || 0).toFixed(2)} ${currency || 'RMB'}`;
},
@@ -747,62 +648,21 @@ export default {
</script>
<style scoped lang="scss">
.formal-page__search {
padding: 12px 12px 4px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.formal-page__search-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px 24px;
align-items: start;
}
.formal-page__search :deep(.el-form-item) {
margin-bottom: 8px;
}
.formal-page__search :deep(.el-form-item__label) {
white-space: nowrap;
}
.formal-page__search :deep(.el-input),
.formal-page__search :deep(.el-select),
.formal-page__search :deep(.el-date-editor) {
width: 100%;
}
.formal-page__search-actions {
grid-column: 1 / -1;
display: flex;
justify-content: flex-end;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.formal-page__table-panel {
margin-top: 8px;
.formal-page {
:deep(.el-table) {
--el-table-border-color: #eff1f7;
}
:deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
background: #fafafa;
}
}
.formal-payment-dialog__batch-tip {
margin-bottom: 12px;
color: #606266;
}
.formal-page :deep(.el-table) {
--el-table-border-color: #eff1f7;
}
.formal-page :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
.formal-page :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
.formal-page :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
background: #fafafa;
}
:deep(.formal-page.basic-container .basic-container__card > .el-card__body) {
padding: 0;
}
@media (max-width: 1200px) {
.formal-page__search-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 760px) {
.formal-page__search-grid {
grid-template-columns: 1fr;
}
}
</style>
+14 -6
View File
@@ -334,6 +334,7 @@ export default {
ArrowDown,
ArrowUp,
loading: false,
approveLoading: false,
query: emptyQuery(),
searchFields: preSettlementSearchFields,
searchExpanded: false,
@@ -691,16 +692,23 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
await approve({ id: row.id });
this.$message.success('审批通过');
await this.loadTable();
this.loadTable();
} finally {
this.loading = false;
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
@@ -241,7 +241,12 @@
<div
class="settlement-detail-page__detail-panel-body settlement-detail-page__adjust-panel-body"
>
<el-table v-loading="adjustDialog.loading" :data="adjustRows" border>
<el-table
v-loading="adjustDialog.loading"
:data="adjustRows"
:max-height="adjustTableMaxHeight"
border
>
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column label="来源" width="110" align="center">
<template #default="{ row }">{{ feeSourceLabel(row.dataSource) }}</template>
@@ -446,36 +451,52 @@
:model="updateFeeForm"
:rules="updateFeeRules"
label-position="right"
label-width="auto"
label-width="120px"
class="settlement-detail-page__dialog-form"
>
<el-form-item label="更新范围" prop="contractId">
<el-input
:model-value="updateContractName"
class="settlement-detail-page__generate-select"
readonly
placeholder="请选择合同"
>
<template #append>
<el-button @click="openUpdateContractDialog">选择</el-button>
</template>
</el-input>
<div class="settlement-detail-page__update-fee-field">
<el-tooltip
:content="updateContractName"
:disabled="!updateContractName"
placement="top"
:show-after="200"
>
<div class="settlement-detail-page__update-fee-trigger">
<el-input
:model-value="updateContractName"
class="settlement-detail-page__update-fee-control"
readonly
placeholder="请选择合同"
>
<template #append>
<el-button @click="openUpdateContractDialog">选择</el-button>
</template>
</el-input>
</div>
</el-tooltip>
</div>
</el-form-item>
<el-form-item label="合同计费方案" prop="billingPlanId">
<el-select
v-model="updateFeeForm.billingPlanId"
clearable
filterable
:disabled="!updateFeeForm.contractId"
placeholder="请选择"
>
<el-option
v-for="item in billingPlanOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<div class="settlement-detail-page__update-fee-field">
<el-select
v-model="updateFeeForm.billingPlanId"
class="settlement-detail-page__update-fee-control"
clearable
filterable
:disabled="!updateFeeForm.contractId"
:placeholder="updateFeeForm.contractId ? '请选择' : '请先选择合同'"
:title="updateBillingPlanName || undefined"
>
<el-option
v-for="item in billingPlanOptions"
:key="item.id"
:label="item.name"
:value="item.id"
:title="item.name"
/>
</el-select>
</div>
</el-form-item>
</el-form>
<template #footer>
@@ -1099,6 +1120,8 @@ export default {
page: { current: 1, size: 10, total: 0 },
// 底部详情/调整面板打开时压缩主表高度,露出表格滚动条
listTableHeight: undefined,
savedListTableHeight: null,
listTableLayoutToken: 0,
detailDialog: {
visible: false,
title: '费用明细',
@@ -1113,6 +1136,8 @@ export default {
rule: null,
},
adjustDialog: { visible: false, loading: false, submitting: false, row: null },
// 表头 + 最多 3 行费用 + 横向滚动条,超出后表体上下滚动
adjustTableMaxHeight: 40 + 49 * 3 + 16,
adjustRows: [],
adjustDynamicFeeColumns: [],
adjustTextProps: ['specification', 'model', 'billingFactor', 'billingType'],
@@ -1203,6 +1228,14 @@ export default {
);
return formatContractOptionLabel(contract);
},
updateBillingPlanName() {
const billingPlanId = this.updateFeeForm.billingPlanId;
if (!billingPlanId) return '';
const plan = this.billingPlanOptions.find(
item => String(item.id) === String(billingPlanId)
);
return plan?.name || '';
},
generateContractCategory() {
return this.settlementType === 'payable' ? '承运商合同' : '客户合同';
},
@@ -1306,8 +1339,11 @@ export default {
'$route.fullPath'() {
this.openRouteDetail();
},
isBottomPanelOpen() {
this.updateListTableHeight();
isBottomPanelOpen: {
flush: 'post',
handler() {
this.updateListTableHeight();
},
},
searchVisible() {
this.updateListTableHeight();
@@ -1372,36 +1408,62 @@ export default {
},
/** 表格和分页撑满剩余可视区域;单据详情展开时贴住详情面板,关闭后恢复 */
updateListTableHeight() {
this.listTableLayoutToken = (this.listTableLayoutToken || 0) + 1;
const token = this.listTableLayoutToken;
this.$nextTick(() => {
window.requestAnimationFrame(() => this.applyListTableHeight());
window.requestAnimationFrame(() => {
if (token !== this.listTableLayoutToken) return;
this.applyListTableHeight(token);
window.requestAnimationFrame(() => {
if (token !== this.listTableLayoutToken) return;
this.applyListTableHeight(token);
});
});
});
},
applyListTableHeight() {
applyListTableHeight(token = this.listTableLayoutToken) {
if (token !== this.listTableLayoutToken) return;
const tableElement = this.$refs.mainTableRef?.$el;
if (!tableElement) return;
const pagination = this.$el?.querySelector?.('.settlement-detail-page__pagination');
const pagination = this.$el?.querySelector?.(
'.settlement-detail-page__table-panel .settlement-detail-page__pagination'
);
const paginationHeight = pagination?.offsetHeight || 0;
const tableTop = tableElement.getBoundingClientRect().top;
const view = this.$el?.closest?.('#avue-view');
const viewRect = view?.getBoundingClientRect?.();
let bottomEdge = viewRect ? viewRect.bottom - 12 : window.innerHeight;
if (this.isBottomPanelOpen) {
// 用滚动容器的可视高度,避免表格被压矮后按内容底部把高度锁死
let bottomEdge = view
? viewRect.top + view.clientHeight - 12
: window.innerHeight;
const panelOpen = this.isBottomPanelOpen;
if (panelOpen) {
if (!this.savedListTableHeight) {
this.savedListTableHeight = this.listTableHeight || null;
}
const panelRect = document
.querySelector('.settlement-detail-page__detail-panel')
?.getBoundingClientRect?.();
if (panelRect && panelRect.height > 0) {
bottomEdge = panelRect.top;
bottomEdge = Math.min(bottomEdge, panelRect.top);
this.listTableHeightRetry = 0;
} else if ((this.listTableHeightRetry || 0) < 5) {
this.listTableHeightRetry = (this.listTableHeightRetry || 0) + 1;
window.requestAnimationFrame(() => this.applyListTableHeight());
window.requestAnimationFrame(() => this.applyListTableHeight(token));
return;
}
} else {
this.listTableHeightRetry = 0;
}
const gap = this.isBottomPanelOpen ? 8 : 0;
this.listTableHeight = Math.max(180, Math.floor(bottomEdge - tableTop - paginationHeight - gap));
const gap = panelOpen ? 8 : 0;
let nextHeight = Math.max(180, Math.floor(bottomEdge - tableTop - paginationHeight - gap));
if (!panelOpen && this.savedListTableHeight) {
if (nextHeight + 24 < this.savedListTableHeight) {
nextHeight = this.savedListTableHeight;
}
this.savedListTableHeight = null;
}
this.listTableHeight = nextHeight;
this.$nextTick(() => this.$refs.mainTableRef?.doLayout?.());
},
contractCategoryName(value) {
@@ -1834,11 +1896,13 @@ export default {
this.changeRecordsDialog.visible = false;
this.billingRuleDialog.visible = false;
this.billingRuleDialog.rule = null;
this.updateListTableHeight();
},
closeAdjustPanel() {
this.clearAdjustCalculations();
this.adjustDialog.visible = false;
this.adjustDialog.row = null;
this.updateListTableHeight();
},
handleTableLink(row, column) {
if (column.prop === 'waybillNo') {
@@ -2422,7 +2486,8 @@ export default {
return;
}
const options = this.syncBillingPlanOptions(contractId);
const selected = options.find(item => item.defaultPlan) || options[0];
const defaultOptions = options.filter(item => item.defaultPlan);
const selected = defaultOptions[defaultOptions.length - 1] || options[options.length - 1];
this.updateFeeForm.billingPlanId = selected?.id || '';
},
async confirmUpdateFee() {
@@ -3144,11 +3209,37 @@ export default {
}
}
:deep(.el-form-item__content) {
min-width: 0;
}
// 仅作用于外层 tooltip 触发器,排除 el-select 内部下拉用的 .el-select__wrapper
// (后者也带 el-tooltip__trigger;若设为 block 会打断 flex,导致「请选择」与箭头叠在左上角)
:deep(.el-tooltip__trigger:not(.el-select__wrapper)) {
display: block;
width: 100%;
}
:deep(.el-select) {
width: 100%;
}
}
.settlement-detail-page__update-fee-field,
.settlement-detail-page__update-fee-trigger {
display: block;
width: 100%;
min-width: 0;
}
.settlement-detail-page__update-fee-control {
width: 100%;
:deep(.el-input-group) {
width: 100%;
}
}
.settlement-detail-page__adjust-input {
width: 100%;
min-width: 0;
@@ -3296,6 +3387,7 @@ export default {
.settlement-detail-page__adjust-panel-body {
padding-top: 16px;
overflow: hidden;
}
.settlement-detail-page__billing-rule-cell {
+5 -12
View File
@@ -317,18 +317,11 @@ export default {
},
async handleApprove(row) {
await this.$confirm('审批通过后将更新关联正式结算单,确认继续?', '提示');
// 防止重复点击:请求期间表格遮罩,后续点击直接忽略
if (this.loading) return;
this.loading = true;
try {
const res = await api.approve(row.id);
// data=false:自动同步金蝶失败;data=true 且 msg 带已推送场景的手工冲销提示
if (res.data.data === true || res.data.data === false) this.$message.warning(res.data.msg);
else this.$message.success(res.data.msg || '审批通过');
await this.loadTable();
} finally {
this.loading = false;
}
const res = await api.approve(row.id);
// data=false:自动同步金蝶失败;data=true 且 msg 带已推送场景的手工冲销提示
if (res.data.data === true || res.data.data === false) this.$message.warning(res.data.msg);
else this.$message.success(res.data.msg || '审批通过');
this.loadTable();
},
async handleReturn(row) {
const { value } = await this.$prompt('请输入驳回原因', '驳回', {
@@ -6,12 +6,33 @@
</template>
<script setup>
import { computed } from 'vue';
import { computed, getCurrentInstance, nextTick, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from 'vuex';
import SettlementImportPage from './components/settlement-import-page.vue';
const route = useRoute();
const pageTitle = computed(() => (route.query.id ? '编辑导入结算单' : '新增导入结算单'));
const store = useStore();
const instance = getCurrentInstance();
const pageTitle = computed(() => {
if (route.query.mode === 'view') return '查看导入结算单';
return route.query.id ? '编辑导入结算单' : '新增导入结算单';
});
const syncTagTitle = () => {
nextTick(() => {
store.commit('SET_TAG', {
fullPath: route.fullPath,
name: pageTitle.value,
});
instance?.proxy?.$router?.$avueRouter?.setTitle?.(pageTitle.value);
});
};
onMounted(() => {
syncTagTitle();
});
</script>
<style scoped lang="scss">
+148 -560
View File
@@ -1,224 +1,56 @@
<template>
<basic-container class="settlement-import-page">
<section v-show="searchVisible" class="settlement-import-page__search">
<el-form :model="query" label-position="right" label-width="160px" @submit.prevent>
<div class="settlement-import-page__search-grid">
<el-form-item v-for="field in visibleSearchFields" :key="field.prop" :label="field.label">
<el-select
v-if="field.type === 'select'"
v-model="query[field.prop]"
clearable
filterable
allow-create
default-first-option
placeholder="请选择"
>
<el-option
v-for="item in field.options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-input v-else v-model="query[field.prop]" clearable placeholder="请输入" />
</el-form-item>
<div class="settlement-import-page__search-actions">
<el-button type="primary" @click="handleSearch">搜索</el-button>
<el-button @click="resetSearch">清空</el-button>
<el-button text :icon="searchExpanded ? ArrowUp : ArrowDown" @click="toggleSearch">
{{ searchExpanded ? '收起' : '展开' }}
</el-button>
</div>
</div>
</el-form>
</section>
<section class="settlement-import-page__table-panel">
<div class="settlement-import-page__toolbar">
<div class="settlement-import-page__toolbar-left">
<el-button
v-if="hasPermission('settlement_import_add')"
type="primary"
@click="openCreate"
>
新增
</el-button>
<el-button plain @click="refreshTable">刷新</el-button>
</div>
</div>
<el-table v-loading="loading" :data="rows" border class="settlement-import-page__table">
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column prop="batchNo" label="导入批次号" min-width="160">
<template #default="{ row }">
<el-link type="primary" @click="openDetail(row)">{{ row.batchNo || '-' }}</el-link>
</template>
</el-table-column>
<el-table-column prop="importStatusName" label="状态" width="100" align="center">
<template #default="{ row }">
<el-tag :type="statusTagType(row.importStatus)" effect="plain">
{{ row.importStatusName || importStatusLabel(row.importStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="settlementTypeName" label="导入类型" min-width="100">
<template #default="{ row }">
{{ row.settlementTypeName || settlementTypeLabel(row.settlementType) }}
</template>
</el-table-column>
<el-table-column prop="settlementBillTypeName" label="结算单" min-width="110">
<template #default="{ row }">
{{ row.settlementBillTypeName || settlementBillTypeLabel(row.settlementBillType) }}
</template>
</el-table-column>
<el-table-column prop="projectName" label="项目" min-width="140" show-overflow-tooltip />
<el-table-column prop="customerName" label="客户" min-width="140" show-overflow-tooltip />
<el-table-column prop="carrierName" label="承运商" min-width="140" show-overflow-tooltip />
<el-table-column label="明细行数" width="100" align="center">
<template #default="{ row }">
{{ row.detailCount ?? row.waybillCount ?? 0 }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" />
<el-table-column prop="createUserName" label="创建人" min-width="120">
<template #default="{ row }">{{ row.createUserName || '-' }}</template>
</el-table-column>
<el-table-column label="操作" width="220" fixed="right">
<template #default="{ row }">
<div class="settlement-import-page__row-actions">
<el-link type="primary" @click="openDetail(row)">查看</el-link>
<el-link
v-if="row.importStatus === 'draft'"
type="primary"
@click="editDraft(row)"
>
编辑
</el-link>
<el-link
v-if="row.importStatus === 'draft' && hasPermission('settlement_import_delete')"
type="danger"
@click="handleDelete(row)"
>
删除
</el-link>
<el-link
v-if="
row.importStatus === 'completed' && hasPermission('settlement_import_void')
"
type="danger"
@click="openVoid(row)"
>
作废
</el-link>
</div>
</template>
</el-table-column>
</el-table>
<div class="settlement-import-page__pagination">
<el-pagination
background
v-model:current-page="page.current"
v-model:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 50, 100]"
:total="page.total"
@current-change="loadTable"
@size-change="handleSizeChange"
/>
</div>
</section>
<el-dialog
v-model="detailVisible"
title="导入结算单详情"
width="1100px"
append-to-body
destroy-on-close
class="settlement-import-detail-dialog"
<avue-crud
ref="crud"
:option="option"
:table-loading="loading"
:data="rows"
v-model:page="page"
@search-change="searchChange"
@search-reset="searchReset"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<el-descriptions :column="3" border>
<el-descriptions-item label="导入批次号">{{ detail.batchNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="状态">
{{ detail.importStatusName || importStatusLabel(detail.importStatus) }}
</el-descriptions-item>
<el-descriptions-item label="导入类型">
{{ detail.settlementTypeName || settlementTypeLabel(detail.settlementType) }}
</el-descriptions-item>
<el-descriptions-item label="结算单">
{{ detail.settlementBillTypeName || settlementBillTypeLabel(detail.settlementBillType) }}
</el-descriptions-item>
<el-descriptions-item label="运单类型">
{{ detail.waybillModeName || waybillModeLabel(detail.waybillMode) }}
</el-descriptions-item>
<el-descriptions-item label="明细行数">
{{ detail.detailCount ?? detail.waybillCount ?? detailRows.length }}
</el-descriptions-item>
<el-descriptions-item label="项目">{{ detail.projectName || '-' }}</el-descriptions-item>
<el-descriptions-item label="客户">{{ detail.customerName || '-' }}</el-descriptions-item>
<el-descriptions-item label="客户合同">
{{ detail.customerContractName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="承运商">{{ detail.carrierName || '-' }}</el-descriptions-item>
<el-descriptions-item label="承运商合同">
{{ detail.carrierContractName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="创建人">{{ detail.createUserName || '-' }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ detail.createTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ detail.remark || '-' }}</el-descriptions-item>
<el-descriptions-item label="关联结算单" :span="3">
<el-link
v-if="detail.formalSettlementId"
type="primary"
@click="goFormalSettlement(detail)"
>
{{ detail.formalSettlementNo || detail.formalSettlementId }}
</el-link>
<el-link
v-else-if="detail.preSettlementId"
type="primary"
@click="goPreSettlement(detail)"
>
{{ detail.preSettlementNo || detail.preSettlementId }}
</el-link>
<span v-else>-</span>
</el-descriptions-item>
</el-descriptions>
<div class="dialog-section-title settlement-import-page__detail-title">导入明细</div>
<el-table
v-loading="detailLoading"
:data="detailRows"
border
max-height="420"
class="settlement-import-page__table"
>
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column
v-for="column in detailDisplayColumns"
:key="column.prop"
:prop="column.fee ? undefined : column.prop"
:label="column.label"
:min-width="column.minWidth || 120"
show-overflow-tooltip
>
<template #default="{ row }">
{{ column.fee ? formatFeeAmount(row, column.prop) : formatDetailCell(row, column) }}
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button @click="detailVisible = false">关闭</el-button>
<template #menu-left>
<el-button
v-if="detail.importStatus === 'draft'"
v-if="hasPermission('settlement_import_add')"
type="primary"
@click="editDraft(detail)"
@click="openCreate"
>新增</el-button
>
编辑草稿
</el-button>
</template>
</el-dialog>
<template #batchNo="{ row }">
<el-link type="primary" @click="openDetail(row)">{{ row.batchNo || '-' }}</el-link>
</template>
<template #importStatusName="{ row }">
<el-tag :type="statusTagType(row.importStatus)" effect="plain">{{
row.importStatusName || importStatusLabel(row.importStatus)
}}</el-tag>
</template>
<template #menu="{ row }">
<el-link type="primary" @click="openDetail(row)">查看</el-link>
<el-link v-if="row.importStatus === 'draft'" type="primary" @click="editDraft(row)"
>编辑</el-link
>
<el-link
v-if="row.importStatus === 'draft' && hasPermission('settlement_import_delete')"
type="danger"
@click="handleDelete(row)"
>删除</el-link
>
<el-link
v-if="row.importStatus === 'completed' && hasPermission('settlement_import_void')"
type="danger"
@click="openVoid(row)"
>作废</el-link
>
</template>
</avue-crud>
<el-dialog v-model="voidVisible" title="作废导入结算单" width="480px" append-to-body>
<el-form
@@ -248,31 +80,11 @@
</template>
<script>
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
import { h } from 'vue';
import { ElOption, ElSelect } from 'element-plus';
import { mapGetters } from 'vuex';
import * as api from '@/api/settlement/settlementImport';
const emptyQuery = () => ({
batchNo: '',
settlementType: '',
importStatus: '',
projectName: '',
customerName: '',
carrierName: '',
});
const SETTLEMENT_TYPE_OPTIONS = [
{ label: '全部', value: '' },
{ label: '应收', value: 'receivable' },
{ label: '应付', value: 'payable' },
];
const IMPORT_STATUS_OPTIONS = [
{ label: '全部', value: '' },
{ label: '草稿', value: 'draft' },
{ label: '已完成', value: 'completed' },
{ label: '已作废', value: 'voided' },
];
import { settlementImportOption, importStatusLabel } from '@/option/settlement/settlementImport';
const SETTLEMENT_IMPORT_LIST_REFRESH_KEY = 'settlement-import-list-refresh';
@@ -280,20 +92,17 @@ export default {
name: 'SettlementImport',
data() {
return {
ArrowDown,
ArrowUp,
searchVisible: true,
searchExpanded: false,
loading: false,
query: emptyQuery(),
rows: [],
page: { current: 1, size: 10, total: 0 },
loading: false,
query: {},
option: settlementImportOption(),
page: {
currentPage: 1,
pageSize: 10,
pageSizes: [10, 20, 50, 100],
total: 0,
},
batchNoOptions: [],
detailVisible: false,
detailLoading: false,
detail: {},
detailRows: [],
detailFeeItemNames: [],
voidVisible: false,
voidLoading: false,
voidForm: { id: null, reason: '' },
@@ -311,84 +120,10 @@ export default {
const authority = this.userInfo?.authority || '';
return String(authority).includes('admin');
},
searchFields() {
return [
{
prop: 'batchNo',
label: '导入批次号',
type: 'select',
options: this.batchNoOptions,
},
{
prop: 'importStatus',
label: '状态',
type: 'select',
options: IMPORT_STATUS_OPTIONS,
},
{
prop: 'settlementType',
label: '导入类型',
type: 'select',
options: SETTLEMENT_TYPE_OPTIONS,
},
{ prop: 'projectName', label: '项目', type: 'input' },
{ prop: 'customerName', label: '客户', type: 'input' },
{ prop: 'carrierName', label: '承运商', type: 'input' },
];
},
visibleSearchFields() {
return this.searchExpanded ? this.searchFields : this.searchFields.slice(0, 4);
},
detailDisplayColumns() {
const before = [
{ prop: 'originalNo', label: '原始单号', minWidth: 130 },
{ prop: 'loadingIdentifier', label: '配载标识号', minWidth: 140 },
{ prop: 'vehicleNo', label: '车牌号/航班号/船号/班列号', minWidth: 190 },
{ prop: 'transportType', label: '运输方式', minWidth: 120 },
{ prop: 'driverName', label: '司机/船长姓名', minWidth: 130 },
{ prop: 'driverPhone', label: '司机/船长手机号', minWidth: 150 },
{ prop: 'departureAddress', label: '发货地址', minWidth: 160 },
{ prop: 'departureContact', label: '发货联系人', minWidth: 120 },
{ prop: 'departurePhone', label: '发货联系人电话', minWidth: 140 },
{ prop: 'arrivalAddress', label: '到货地址', minWidth: 160 },
{ prop: 'arrivalContact', label: '收货联系人', minWidth: 120 },
{ prop: 'arrivalPhone', label: '收货联系人电话', minWidth: 140 },
{ prop: 'cargoName', label: '货物名称', minWidth: 140 },
{ prop: 'cargoType', label: '货物类型', minWidth: 120 },
{ prop: 'packageType', label: '包装', minWidth: 100 },
{ prop: 'quantity', label: '数量', minWidth: 90 },
{ prop: 'quantityUnit', label: '数量单位', minWidth: 100 },
{ prop: 'specification', label: '规格', minWidth: 110 },
{ prop: 'model', label: '型号', minWidth: 110 },
{ prop: 'mileage', label: '里程(km)', minWidth: 110 },
{ prop: 'unitPrice', label: '运输单价', minWidth: 110 },
{ prop: 'transportFee', label: '运输费', minWidth: 110, money: true },
];
const fees = (this.detailFeeItemNames || []).map(name => ({
prop: name,
label: name,
minWidth: 110,
fee: true,
}));
const after = [
{ prop: 'settlementAmount', label: '结算金额', minWidth: 120, money: true },
{ prop: 'actualStartDate', label: '实际发货时间', minWidth: 140 },
{ prop: 'actualEndDate', label: '实际完成时间', minWidth: 140 },
{ prop: 'planStartDate', label: '预计发货时间', minWidth: 140 },
{ prop: 'planEndDate', label: '预计完成时间', minWidth: 140 },
{ prop: 'remark', label: '备注', minWidth: 140 },
{ prop: 'waybillIdentifier', label: '同一运单标识号', minWidth: 150 },
];
const history =
this.detail.waybillMode === 'history'
? [{ prop: 'waybillNo', label: '运单号', minWidth: 140 }]
: [];
return [...history, ...before, ...fees, ...after];
},
},
created() {
this.setBatchNoSearchRender();
this.loadOptions();
this.loadTable();
},
activated() {
this.consumeListRefresh();
@@ -409,140 +144,117 @@ export default {
return;
}
sessionStorage.removeItem(SETTLEMENT_IMPORT_LIST_REFRESH_KEY);
this.page.current = 1;
this.page.currentPage = 1;
this.loadOptions();
this.loadTable();
this.onLoad(this.page);
},
hasPermission(code) {
return this.isAdmin || this.validData(this.permission?.[code], false);
},
importStatusLabel(value) {
return (
IMPORT_STATUS_OPTIONS.find(item => item.value === value)?.label || value || '-'
);
},
importStatusLabel,
statusTagType(status) {
if (status === 'draft') return 'info';
if (status === 'completed') return 'success';
if (status === 'voided') return 'danger';
return '';
},
settlementTypeLabel(value) {
return (
SETTLEMENT_TYPE_OPTIONS.find(item => item.value === value)?.label || value || '-'
);
},
settlementBillTypeLabel(value) {
if (value === 'pre') return '预结算单';
return '正式结算单';
},
waybillModeLabel(value) {
if (value === 'history') return '历史运单';
return '新运单';
},
unwrapData(response) {
const body = response?.data || response || {};
return body?.data !== undefined ? body.data : body;
},
formatDetailCell(row, column) {
const value = row?.[column.prop];
if (value === null || value === undefined || value === '') return '';
if (!column.money) return value;
const number = Number(value);
return Number.isFinite(number) ? number.toFixed(2) : value;
},
formatFeeAmount(row, name) {
const feeItems = row?.feeItems || {};
const value = feeItems[name] ?? row?.[name];
if (value === null || value === undefined || value === '') return '';
const number = Number(value);
return Number.isFinite(number) ? number.toFixed(2) : value;
/** 批次号搜索控件:可搜索 + 可手输,选项来自已导入批次 */
setBatchNoSearchRender() {
const column = this.findColumn(this.option.column, 'batchNo');
if (!column) return;
column.renderSearch = scope =>
h(
ElSelect,
{
modelValue: scope.row?.batchNo ?? '',
'onUpdate:modelValue': value => {
if (scope.row) scope.row.batchNo = value ?? '';
},
clearable: true,
filterable: true,
allowCreate: true,
defaultFirstOption: true,
placeholder: '请选择',
style: 'width: 100%',
},
() =>
this.batchNoOptions.map(item =>
h(ElOption, { key: item.value, label: item.label, value: item.value })
)
);
},
async loadOptions() {
try {
const response = await api.getOptions();
const options = this.unwrapData(response) || {};
const batchNos = Array.isArray(options.batchNos) ? options.batchNos : [];
this.batchNoOptions = [
{ label: '全部', value: '' },
...batchNos.map(item => {
if (typeof item === 'string') {
return { label: item, value: item };
}
const value = item.id ?? item.value ?? item.name ?? item.batchNo ?? '';
const label = item.name ?? item.label ?? item.batchNo ?? value;
return { label: String(label || ''), value: String(value || '') };
}),
];
} catch (error) {
this.batchNoOptions = [{ label: '全部', value: '' }];
}
},
async loadTable() {
this.loading = true;
try {
const response = await api.getList(this.page.current, this.page.size, {
batchNo: this.query.batchNo || undefined,
settlementType: this.query.settlementType || undefined,
importStatus: this.query.importStatus || undefined,
projectName: this.query.projectName || undefined,
customerName: this.query.customerName || undefined,
carrierName: this.query.carrierName || undefined,
this.batchNoOptions = batchNos.map(item => {
if (typeof item === 'string') {
return { label: item, value: item };
}
const value = item.id ?? item.value ?? item.name ?? item.batchNo ?? '';
const label = item.name ?? item.label ?? item.batchNo ?? value;
return { label: String(label || ''), value: String(value || '') };
});
const data = this.unwrapData(response) || {};
this.rows = data.records || [];
this.page.total = Number(data.total || 0);
} finally {
this.loading = false;
} catch (error) {
this.batchNoOptions = [];
}
},
refreshTable() {
onLoad(page) {
this.loading = true;
api
.getList(page.currentPage, page.pageSize, { ...this.query })
.then(response => {
const data = this.unwrapData(response) || {};
this.rows = data.records || [];
this.page.total = Number(data.total || 0);
})
.finally(() => {
this.loading = false;
});
},
searchChange(params, done) {
this.query = { ...params };
this.page.currentPage = 1;
this.onLoad(this.page);
done();
},
searchReset() {
this.query = {};
this.page.currentPage = 1;
this.onLoad(this.page);
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.loadOptions();
this.loadTable();
},
handleSearch() {
this.page.current = 1;
this.loadTable();
},
resetSearch() {
this.query = emptyQuery();
this.handleSearch();
},
toggleSearch() {
this.searchExpanded = !this.searchExpanded;
},
handleSizeChange() {
this.page.current = 1;
this.loadTable();
this.onLoad(this.page);
},
openCreate() {
this.$router.push({ path: '/settlement/settlement-import/form' });
},
async openDetail(row) {
if (!row?.id) return;
this.detailVisible = true;
this.detailLoading = true;
this.detail = { ...row };
this.detailRows = [];
this.detailFeeItemNames = [];
try {
const response = await api.getDetail(row.id);
const detail = this.unwrapData(response) || { ...row };
this.detail = detail;
this.detailRows = Array.isArray(detail.rows) ? detail.rows : [];
this.detailFeeItemNames = Array.isArray(detail.feeItemNames) ? detail.feeItemNames : [];
} catch (error) {
this.detail = { ...row };
this.$message.error(error?.message || '加载详情失败');
} finally {
this.detailLoading = false;
}
},
editDraft(row) {
this.detailVisible = false;
this.$router.push({
path: '/settlement/settlement-import/form',
query: { id: row.id },
query: { name: '新增导入结算单' },
});
},
openDetail(row) {
if (!row?.id) return;
this.$router.push({
path: '/settlement/settlement-import/form',
query: { id: row.id, mode: 'view', name: '查看导入结算单' },
});
},
editDraft(row) {
this.$router.push({
path: '/settlement/settlement-import/form',
query: { id: row.id, name: '编辑导入结算单' },
});
},
async handleDelete(row) {
@@ -553,37 +265,12 @@ export default {
});
await api.removeDraft(row.id);
this.$message.success('删除成功');
this.loadTable();
this.loadOptions();
this.refreshChange();
} catch (error) {
if (error === 'cancel' || error === 'close') return;
this.$message.error(error?.message || '删除失败');
}
},
goFormalSettlement(row) {
if (!row?.formalSettlementId) return;
this.detailVisible = false;
this.$router.push({
path: '/settlement/formal-settlement/form',
query: {
mode: 'view',
id: row.formalSettlementId,
name: '正式结算详情',
},
});
},
goPreSettlement(row) {
if (!row?.preSettlementId) return;
this.detailVisible = false;
this.$router.push({
path: '/settlement/pre-settlement/form',
query: {
mode: 'view',
id: row.preSettlementId,
name: '预结算详情',
},
});
},
openVoid(row) {
this.voidForm = { id: row.id, reason: '' };
this.voidVisible = true;
@@ -599,7 +286,7 @@ export default {
});
this.$message.success('作废成功');
this.voidVisible = false;
this.loadTable();
this.onLoad(this.page);
this.loadOptions();
} finally {
this.voidLoading = false;
@@ -610,118 +297,19 @@ export default {
</script>
<style scoped lang="scss">
.settlement-import-page__search {
padding: 12px 12px 4px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.settlement-import-page__search-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px 24px;
align-items: start;
}
.settlement-import-page__search :deep(.el-form-item) {
margin-bottom: 8px;
}
.settlement-import-page__search :deep(.el-form-item__label) {
white-space: nowrap;
}
.settlement-import-page__search :deep(.el-input),
.settlement-import-page__search :deep(.el-select) {
width: 100%;
}
.settlement-import-page__search-actions {
grid-column: 1 / -1;
display: flex;
justify-content: flex-end;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.settlement-import-page__table-panel {
margin-top: 8px;
background: #fff;
}
.settlement-import-page__toolbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0 0;
}
.settlement-import-page__toolbar-left {
display: flex;
gap: 8px;
}
.settlement-import-page__table {
.settlement-import-page :deep(.el-table) {
--el-table-border-color: #eff1f7;
}
.settlement-import-page__table :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
.settlement-import-page__table
.settlement-import-page :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
.settlement-import-page
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
.settlement-import-page__table
.settlement-import-page
:deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
background: #fafafa;
}
.settlement-import-page__row-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.settlement-import-page__pagination {
display: flex;
justify-content: flex-end;
padding: 12px 0;
}
.settlement-import-page__detail-title {
margin: 16px 0 8px;
}
.dialog-section-title {
position: relative;
padding-left: 12px;
color: #303133;
font-size: 16px;
font-weight: 600;
&::before {
position: absolute;
top: 2px;
left: 0;
width: 4px;
height: 16px;
border-radius: 2px;
background: #409eff;
content: '';
}
}
.settlement-import-page :deep(.basic-container__card > .el-card__body) {
:deep(.settlement-import-page.basic-container .basic-container__card > .el-card__body) {
padding: 0;
}
@media (max-width: 1200px) {
.settlement-import-page__search-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 760px) {
.settlement-import-page__search-grid {
grid-template-columns: 1fr;
}
}
</style>
+91
View File
@@ -418,6 +418,46 @@ export default {
},
],
},
{
label: '合同初始流水号',
prop: 'contractInitialSerial',
type: 'input',
minWidth: 140,
order: 61,
placeholder: '如 1',
// -1 为空占位,列表展示为空
formatter: row =>
Number(row.contractInitialSerial) === -1 ? '' : row.contractInitialSerial,
tip: '该部门当年首个合同时从此流水号起编,后续递增;范围1-999,不填默认从1开始',
rules: [
{
validator: (rule, value, callback) => {
// -1 为空占位,不填时按空处理
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1
) {
callback();
return;
}
const text = String(value).trim();
if (!/^\d+$/.test(text)) {
callback(new Error('合同初始流水号只能输入正整数'));
return;
}
const serial = Number(text);
if (serial < 1 || serial > 999) {
callback(new Error('合同初始流水号范围为1到999'));
return;
}
callback();
},
trigger: 'blur',
},
],
},
{
label: '组织简称',
prop: 'shortName',
@@ -495,6 +535,27 @@ export default {
},
],
},
{
label: '是否业务部门',
prop: 'isBusinessDept',
type: 'select',
dicData: [
{ label: '否', value: 0 },
{ label: '是', value: 1 },
],
dataType: 'number',
value: 0,
width: 120,
order: 34,
formatter: row => (Number(row.isBusinessDept) === 1 ? '是' : '否'),
rules: [
{
required: true,
message: '请选择是否业务部门',
trigger: 'change',
},
],
},
{
label: '排序',
prop: 'sort',
@@ -1156,6 +1217,29 @@ export default {
row.parentId = 0;
}
},
normalizeContractInitialSerial(value) {
// -1 为空占位,不填时不落库、不回显
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1
) {
return null;
}
const text = String(value).trim();
if (!text) {
return null;
}
const serial = Number(text);
return Number.isInteger(serial) ? serial : value;
},
clearEmptyContractInitialSerial(form = this.form) {
if (!form) return;
if (Number(form.contractInitialSerial) === -1) {
form.contractInitialSerial = '';
}
},
isRootDept(row) {
return row && (row.parentId === 0 || String(row.parentId) === '0');
},
@@ -1302,6 +1386,7 @@ export default {
row.deptCode = String(row.deptCode || '').trim();
row.kingdeeDeptCode = String(row.kingdeeDeptCode || '').trim();
row.contractCodePrefix = String(row.contractCodePrefix || '').trim();
row.contractInitialSerial = this.normalizeContractInitialSerial(row.contractInitialSerial);
row.leaderId = func.join(row.leaderId);
this.normalizeTopParent(row);
if (!this.prepareDeptSubmitRow(row)) {
@@ -1349,6 +1434,7 @@ export default {
row.deptCode = String(row.deptCode || '').trim();
row.kingdeeDeptCode = String(row.kingdeeDeptCode || '').trim();
row.contractCodePrefix = String(row.contractCodePrefix || '').trim();
row.contractInitialSerial = this.normalizeContractInitialSerial(row.contractInitialSerial);
row.leaderId = func.join(row.leaderId);
this.normalizeTopParent(row);
if (!this.prepareDeptSubmitRow(row)) {
@@ -1458,6 +1544,10 @@ export default {
if (this.form.isPlatformCompany === undefined || this.form.isPlatformCompany === null) {
this.form.isPlatformCompany = 0;
}
if (this.form.isBusinessDept === undefined || this.form.isBusinessDept === null) {
this.form.isBusinessDept = 0;
}
this.clearEmptyContractInitialSerial(this.form);
this.initData(this.form.tenantId);
this.loadParentDeptCode(this.form.parentId);
}
@@ -1472,6 +1562,7 @@ export default {
if (this.form.parentId === '0') {
this.form.parentId = '';
}
this.clearEmptyContractInitialSerial(this.form);
this.loadParentDeptCode(this.form.parentId);
if (this.form.hasOwnProperty('leaderId')) {
const splitResult = func.split(this.form.leaderId);
+175 -39
View File
@@ -20,33 +20,32 @@
@on-load="onLoad"
>
<template #menu-left>
<el-button
type="primary"
v-if="permission.mp_user_add"
@click="$refs.crud.rowAdd()"
>
<el-button type="primary" v-if="permission.mp_user_add" @click="$refs.crud.rowAdd()">
新增
</el-button>
<el-button
type="primary"
plain
v-if="permission.mp_user_reset"
@click="handleReset"
>
<el-button type="primary" plain v-if="permission.mp_user_reset" @click="handleReset">
密码重置
</el-button>
<el-button
type="danger"
plain
v-if="permission.mp_user_delete"
@click="handleDelete"
>
<el-button type="danger" plain v-if="permission.mp_user_delete" @click="handleDelete">
批量删除
</el-button>
</template>
<template #identities="{ row }">
{{ row.identitiesName || formatIdentities(row.identities) }}
</template>
<template #deptName="{ row }">
<template v-if="formatDeptNames(row.deptName).length">
<el-tag
v-for="name in formatDeptNames(row.deptName)"
:key="name"
size="small"
class="dept-tag"
>
{{ name }}
</el-tag>
</template>
<span v-else>-</span>
</template>
<template #status="{ row }">
<el-tag :type="row.status === 1 ? 'primary' : 'info'" class="status-text">
{{ row.status === 1 ? '启用' : '停用' }}
@@ -55,6 +54,33 @@
<template #updateUserName="{ row }">
{{ formatUpdateUserName(row) }}
</template>
<template #deptId-form>
<el-cascader
v-model="deptCascaderValue"
:options="permissionDeptTree"
:props="deptCascaderProps"
:disabled="isViewMode"
clearable
filterable
collapse-tags
collapse-tags-tooltip
placeholder="请选择所属组织(可多选)"
style="width: 100%"
/>
</template>
<template #dataScopeDeptIds-form>
<el-tree
v-if="Number(form.dataScopeRange) === 3"
ref="dataScopeTree"
:data="permissionDeptTree"
show-checkbox
node-key="id"
:default-checked-keys="form.dataScopeDeptIds || []"
:props="{ label: 'title', children: 'children' }"
@check="handleDataScopeCheck"
/>
<span v-else class="form-tip">选择「自定义」后可勾选数据权限组织</span>
</template>
<template #menu="{ row, index }">
<el-link
type="primary"
@@ -70,25 +96,13 @@
>
编辑
</el-link>
<el-link
type="primary"
v-if="permission.mp_user_status"
@click="handleStatus(row)"
>
<el-link type="primary" v-if="permission.mp_user_status" @click="handleStatus(row)">
{{ row.status === 1 ? '停用' : '启用' }}
</el-link>
<el-link
type="primary"
v-if="permission.mp_user_reset"
@click="handleResetForRow(row)"
>
<el-link type="primary" v-if="permission.mp_user_reset" @click="handleResetForRow(row)">
重置密码
</el-link>
<el-link
type="danger"
v-if="permission.mp_user_delete"
@click="rowDel(row)"
>
<el-link type="danger" v-if="permission.mp_user_delete" @click="rowDel(row)">
删除
</el-link>
</template>
@@ -108,9 +122,12 @@
<script>
import { h } from 'vue';
import { getList, getDetail, submit, remove, changeStatus, resetPassword } from '@/api/system/mpUser';
import { getDeptTree } from '@/api/system/dept';
import option from '@/option/system/mpUser';
import { mapGetters } from 'vuex';
import { formatUpdateUserName } from '@/utils/audit';
import { sensitive } from '@/utils/sensitive';
import func from '@/utils/func';
const IDENTITY_LABEL = {
driver: '司机',
@@ -132,10 +149,12 @@ export default {
selectionList: [],
option,
data: [],
permissionDeptTree: [],
sensitiveManager: null,
};
},
computed: {
...mapGetters(['permission']),
...mapGetters(['permission', 'userInfo']),
permissionList() {
return {
addBtn: this.validData(this.permission.mp_user_add, false),
@@ -147,6 +166,46 @@ export default {
ids() {
return this.selectionList.map(item => item.id).join(',');
},
isViewMode() {
return this.dialogType === 'view';
},
deptCascaderProps() {
return {
label: 'title',
value: 'id',
children: 'children',
emitPath: false,
multiple: true,
checkStrictly: true,
expandTrigger: 'click',
disabled: 'disabled',
};
},
deptCascaderValue: {
get() {
const ids = Array.isArray(this.form.deptId)
? this.form.deptId
: this.form.deptId
? String(this.form.deptId).split(',').filter(Boolean)
: [];
return ids
.filter(item => item !== undefined && item !== null && item !== '')
.map(item => (typeof item === 'number' ? item : String(item)));
},
set(value) {
this.form.deptId = Array.isArray(value)
? value.filter(item => item !== undefined && item !== null && item !== '')
: value
? [value]
: [];
},
},
},
created() {
this.sensitiveManager = sensitive.create({
fields: ['phone', 'email'],
});
this.loadDeptTree();
},
methods: {
formatUpdateUserName,
@@ -158,19 +217,59 @@ export default {
.filter(Boolean)
.join(',');
},
normalizeSubmitRow(row = {}) {
const payload = { ...row };
formatDeptNames(deptName) {
if (!deptName) {
return [];
}
return String(deptName)
.split(',')
.map(item => item.trim())
.filter(Boolean);
},
loadDeptTree() {
const tenantId = this.userInfo?.tenantId;
if (!tenantId) {
return;
}
getDeptTree(tenantId).then(res => {
this.permissionDeptTree = res.data.data || [];
});
},
handleDataScopeCheck(_, checked) {
if (this.isViewMode) {
return;
}
this.form.dataScopeDeptIds = checked.checkedKeys || [];
},
normalizeSubmitRow(row = {}, isUpdate = false) {
let payload = { ...row };
// 编辑时剔除未改动的脱敏字段,避免把 138****8000 写回库
if (isUpdate && this.sensitiveManager) {
payload = this.sensitiveManager.getSubmitData(payload);
}
if (Array.isArray(payload.identities)) {
payload.identities = payload.identities.filter(Boolean).join(',');
}
payload.deptId = func.join(payload.deptId);
if (payload.phone) {
payload.phone = String(payload.phone).trim();
}
if (!payload.account && payload.phone) {
// 脱敏手机号不能作为账号默认值
if (!payload.account && payload.phone && !String(payload.phone).includes('*')) {
payload.account = payload.phone;
}
payload.dataScopeRange = Number(payload.dataScopeRange || 1);
payload.dataLevelRange = Number(payload.dataLevelRange || 1);
if (payload.dataScopeRange === 3) {
payload.dataScopeDeptIds = Array.isArray(payload.dataScopeDeptIds)
? payload.dataScopeDeptIds
: [];
} else {
payload.dataScopeDeptIds = [];
}
delete payload.password;
delete payload.identitiesName;
delete payload.deptName;
delete payload.sexName;
delete payload.createUserName;
delete payload.updateUserName;
@@ -178,13 +277,25 @@ export default {
},
beforeOpen(done, type) {
this.dialogType = type;
this.loadDeptTree();
if (['edit', 'view'].includes(type) && this.form.id) {
getDetail(this.form.id).then(res => {
const detail = res.data.data || {};
if (detail.identities && typeof detail.identities === 'string') {
detail.identities = detail.identities.split(',').filter(Boolean);
}
this.form = detail;
const deptIds = func.split(detail.deptId || '');
this.form = {
...detail,
deptId: Array.isArray(deptIds) ? deptIds : [],
dataScopeRange: detail.dataScopeRange || 1,
dataLevelRange: detail.dataLevelRange || 1,
dataScopeDeptIds: detail.dataScopeDeptIds || [],
};
this.sensitiveManager?.saveInitialData(this.form);
this.$nextTick(() => {
this.$refs.dataScopeTree?.setCheckedKeys?.(this.form.dataScopeDeptIds || []);
});
done();
});
return;
@@ -193,12 +304,23 @@ export default {
this.form = {
status: 1,
identities: ['driver'],
deptId: [],
dataScopeRange: 1,
dataLevelRange: 1,
dataScopeDeptIds: [],
};
this.sensitiveManager?.saveInitialData({});
}
done();
},
rowSave(row, done, loading) {
submit(this.normalizeSubmitRow(row)).then(
const payload = this.normalizeSubmitRow(row, false);
if (payload.dataScopeRange === 3 && (!payload.dataScopeDeptIds || !payload.dataScopeDeptIds.length)) {
this.$message.warning('请选择自定义数据权限组织');
loading();
return;
}
submit(payload).then(
() => {
this.onLoad(this.page);
this.$message.success('操作成功');
@@ -208,7 +330,13 @@ export default {
);
},
rowUpdate(row, index, done, loading) {
submit(this.normalizeSubmitRow(row)).then(
const payload = this.normalizeSubmitRow(row, true);
if (payload.dataScopeRange === 3 && (!payload.dataScopeDeptIds || !payload.dataScopeDeptIds.length)) {
this.$message.warning('请选择自定义数据权限组织');
loading();
return;
}
submit(payload).then(
() => {
this.onLoad(this.page);
this.$message.success('操作成功');
@@ -351,5 +479,13 @@ export default {
:deep(.avue-crud__menu) {
min-height: auto;
}
.dept-tag {
margin-right: 4px;
margin-bottom: 2px;
}
.form-tip {
color: var(--el-text-color-secondary);
font-size: 13px;
}
}
</style>
+142 -53
View File
@@ -4,7 +4,7 @@
<div class="box">
<el-scrollbar>
<basic-container>
<avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick" />
<avue-tree ref="deptTree" :option="treeOption" :data="treeData" @node-click="nodeClick" />
</basic-container>
</el-scrollbar>
</div>
@@ -115,9 +115,10 @@
<template #deptName="{ row }">
<template v-if="formatDeptNames(row.deptName).length">
<el-tag
v-for="name in formatDeptNames(row.deptName)"
:key="name"
v-for="(name, index) in formatDeptNames(row.deptName)"
:key="`${row.id}-${index}-${name}`"
class="user-dept-tag"
@click.stop="handleDeptTagClick(row, index)"
>{{ name }}</el-tag>
</template>
<span v-else>-</span>
@@ -172,9 +173,8 @@
</el-form-item>
</el-col>
<el-col :span="6"><el-form-item label="工号"><el-input v-model="form.code" :disabled="isUserViewMode" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="OA登录名"><el-input v-model="form.oaLoginId" :disabled="isUserViewMode" maxlength="128" placeholder="请输入OA登录名" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="人员类别"><el-select v-model="form.personCategory" :disabled="isUserViewMode"><el-option label="内部员工" :value="1" /><el-option label="承运商" :value="2" /></el-select></el-form-item></el-col>
<el-col :span="18"><el-form-item label="数据权限范围"><el-radio-group v-model="form.dataScopeRange" :disabled="isUserViewMode"><el-radio :value="1">仅所属组织</el-radio><el-radio :value="2">全部组织</el-radio><el-radio :value="3">自定义</el-radio></el-radio-group></el-form-item></el-col>
<el-col :span="18"><el-form-item label="数据层级范围"><el-radio-group v-model="form.dataLevelRange" :disabled="isUserViewMode"><el-radio :value="1">包含下级</el-radio><el-radio :value="2">仅本级</el-radio></el-radio-group></el-form-item></el-col>
<el-col :span="24">
<el-form-item label="备注">
<el-input
@@ -200,13 +200,6 @@
<el-table-column v-if="!isUserViewMode" label="操作" width="90"><template #default="{ row }"><el-link type="danger" @click="removeFormRole(row.id)">删除</el-link></template></el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane v-if="form.dataScopeRange === 3" label="数据权限">
<el-tree :data="permissionDeptTree" show-checkbox node-key="id" :default-checked-keys="form.dataScopeDeptIds || []" :props="{ label: 'title', children: 'children' }" @check="handleDataScopeCheck" />
</el-tab-pane>
<el-tab-pane label="客商权限">
<div class="permission-toolbar customer-toolbar"><el-checkbox v-model="form.includeNewCustomer" :true-value="1" :false-value="0" :disabled="isUserViewMode">包含新增的客商</el-checkbox></div>
<el-table ref="customerTable" :data="customerList" border @selection-change="handleCustomerSelection"><el-table-column type="selection" width="55" :selectable="isCustomerSelectable" /><el-table-column prop="customerCode" label="客商编码" /><el-table-column prop="fullName" label="客商名称" /></el-table>
</el-tab-pane>
</el-tabs>
<template #footer>
<span v-if="isUserViewMode" class="dialog-footer">
@@ -363,6 +356,10 @@
<span class="oa-sync-stat__label">跳过</span>
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
</div>
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">删除</span>
<span class="oa-sync-stat__value oa-sync-stat__value--remove">{{ oaSyncProgress.removed }}</span>
</div>
</div>
<div v-if="oaSyncProgress.dumpFilePath" class="oa-sync-meta">
原始数据 JSON:{{ oaSyncProgress.dumpFilePath }}
@@ -401,7 +398,6 @@ import {
auditRefuse,
setLeader,
getLeaderList,
getCustomerOptions,
} from '@/api/system/user';
import { exportBlob } from '@/api/common';
import { getDeptTree } from '@/api/system/dept';
@@ -453,6 +449,7 @@ export default {
total: 0,
synced: 0,
skipped: 0,
removed: 0,
dumpFilePath: '',
},
page: {
@@ -470,7 +467,6 @@ export default {
treeData: [],
permissionDeptTree: [],
postList: [],
customerList: [],
treeOption: treeOption,
userOption: userOption(this),
data: [],
@@ -646,10 +642,118 @@ export default {
},
methods: {
nodeClick(data) {
this.treeDeptId = data.id;
const deptId = data?.id;
if (deptId != null && String(this.treeDeptId) === String(deptId)) {
this.treeDeptId = '';
this.page.currentPage = 1;
this.$nextTick(() => {
this.$refs.deptTree?.setCurrentKey?.(null);
});
this.onLoad(this.page);
return;
}
this.treeDeptId = deptId;
this.page.currentPage = 1;
this.onLoad(this.page);
},
formatDeptIds(deptId) {
if (!deptId && deptId !== 0) {
return [];
}
return String(deptId)
.split(',')
.map(item => item.trim())
.filter(Boolean);
},
handleDeptTagClick(row, index) {
const deptIds = this.formatDeptIds(row.deptId);
let deptId = deptIds[index];
if (!deptId) {
const names = this.formatDeptNames(row.deptName);
deptId = this.findDeptIdByName(names[index]);
}
if (!deptId) {
this.$message.warning('未找到对应组织');
return;
}
this.selectDeptOnTree(deptId);
},
findDeptIdByName(name, tree = this.permissionDeptTree) {
if (!name) return null;
for (const node of tree || []) {
if (node.title === name || node.deptName === name || node.label === name) {
return node.id;
}
const matched = this.findDeptIdByName(name, node.children);
if (matched != null) return matched;
}
return null;
},
/**
* 展开左侧懒加载组织树到目标节点并设为选中,同时按该组织筛选用户列表
*/
async selectDeptOnTree(deptId) {
if (deptId == null || deptId === '') return;
if (!this.permissionDeptTree?.length) {
const tenantId = this.userInfo.tenantId || this.website.tenantId;
try {
const res = await getDeptTree(tenantId);
this.permissionDeptTree = res.data.data || [];
} catch (error) {
this.$message.error('组织树加载失败');
return;
}
}
const path = this.findDeptPath(deptId);
if (!path?.length) {
this.$message.warning('未在组织树中找到该部门');
return;
}
const tree = this.$refs.deptTree;
if (!tree) return;
for (let i = 0; i < path.length - 1; i++) {
await this.expandLazyTreeNode(path[i]);
}
await this.$nextTick();
const targetId = path[path.length - 1];
tree.setCurrentKey?.(targetId);
this.$nextTick(() => {
const currentEl = tree.$el?.querySelector?.('.el-tree-node.is-current');
currentEl?.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' });
});
if (String(this.treeDeptId) === String(targetId)) {
return;
}
this.treeDeptId = targetId;
this.page.currentPage = 1;
this.onLoad(this.page);
},
expandLazyTreeNode(key) {
return new Promise(resolve => {
const tree = this.$refs.deptTree;
if (!tree?.getNode) {
resolve();
return;
}
const tryExpand = (retries = 40) => {
const node = tree.getNode(key);
if (!node) {
if (retries <= 0) {
resolve();
return;
}
setTimeout(() => tryExpand(retries - 1), 50);
return;
}
if (node.expanded || node.isLeaf) {
resolve();
return;
}
node.expand(() => resolve());
};
tryExpand();
});
},
handleDropdownCommand(command, row, index) {
if (command === 'setLeader') {
this.handleSetLeader(row);
@@ -681,17 +785,21 @@ export default {
});
},
handleOaPersonFullSync() {
this.$confirm('全量同步将拉取 OA 全部人员及组织;已存在且 OA 更新时间一致的记录会跳过。是否继续?', '全量同步', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.$confirm(
'全量同步将按 OA 对齐人员:有登录名的按登录名更新且不修改密码,没有登录名但有工号的也会入库且不回填登录名,部门按 OA 当前部门重绑,OA 中已不存在或已离职的删除。是否继续?',
'全量同步',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
this.startOaSync(false);
});
},
handleOaPersonIncrementalSync() {
this.$confirm(
'增量同步仅拉取本地最大 OA 更新时间之后有变更的人员;不存在的新增,已存在且更新时间不一致的修改,一致的跳过。是否继续?',
'增量同步仅拉取本地最大 OA 更新时间之后有变更的人员:已有的更新且不修改密码,没有的新增,部门按 OA 当前部门重绑,离职人员直接删除。是否继续?',
'增量同步',
{
confirmButtonText: '确定',
@@ -716,6 +824,7 @@ export default {
total: 0,
synced: 0,
skipped: 0,
removed: 0,
dumpFilePath: '',
};
this.runOaSyncPages();
@@ -751,6 +860,7 @@ export default {
this.oaSyncProgress.total = page.total || 0;
this.oaSyncProgress.synced += page.syncedCount || 0;
this.oaSyncProgress.skipped += page.skippedCount || 0;
this.oaSyncProgress.removed += page.removedCount || 0;
if (page.dumpFilePath) {
this.oaSyncProgress.dumpFilePath = page.dumpFilePath;
}
@@ -831,9 +941,6 @@ export default {
const column = this.findColumn(this.userOption.group, 'leaderId');
column.dicData = res.data.data;
});
getCustomerOptions().then(res => {
this.customerList = res.data.data || [];
});
},
// 由部门 id 反查「根 → 该节点」的 id 路径,供级联回显(找不到返回 null)
findDeptPath(id, tree = this.permissionDeptTree, parents = []) {
@@ -879,21 +986,6 @@ export default {
.split(this.form.roleId || '')
.filter(id => String(id) !== String(roleId));
},
handleDataScopeCheck(_, checked) {
if (this.isUserViewMode) {
return;
}
this.form.dataScopeDeptIds = checked.checkedKeys;
},
handleCustomerSelection(rows) {
if (this.isUserViewMode) {
return;
}
this.form.customerIds = rows.map(row => row.id);
},
isCustomerSelectable() {
return !this.isUserViewMode;
},
normalizeSexDisplay(sex) {
if (sex === -1 || sex === '-1' || sex === '' || sex === null || sex === undefined) {
return undefined;
@@ -944,13 +1036,8 @@ export default {
deptId: [],
code: '',
personCategory: 1,
dataScopeRange: 1,
dataLevelRange: 1,
remark: '',
roleId: '',
dataScopeDeptIds: [],
customerIds: [],
includeNewCustomer: 0,
};
this.userDialog = true;
this.$nextTick(() => this.$refs.userFormRef && this.$refs.userFormRef.clearValidate());
@@ -964,22 +1051,13 @@ export default {
deptId: Array.isArray(deptIds) ? deptIds : [],
postId: func.split(user.postId || '')[0] || '',
roleId: func.join(user.roleId || ''),
dataScopeDeptIds: user.dataScopeDeptIds || [],
customerIds: user.customerIds || [],
includeNewCustomer: user.includeNewCustomer || 0,
personCategory: user.personCategory || 1,
dataScopeRange: user.dataScopeRange || 1,
dataLevelRange: user.dataLevelRange || 1,
sex: this.normalizeSexDisplay(user.sex),
};
this.sensitiveManager.saveInitialData(this.form);
this.userDialog = true;
this.$nextTick(() => {
this.$refs.userFormRef && this.$refs.userFormRef.clearValidate();
(this.form.customerIds || []).forEach(id => {
const customer = this.customerList.find(item => String(item.id) === String(id));
if (customer) this.$refs.customerTable && this.$refs.customerTable.toggleRowSelection(customer, true);
});
});
});
},
@@ -1074,6 +1152,9 @@ export default {
searchReset() {
this.query = {};
this.treeDeptId = '';
this.$nextTick(() => {
this.$refs.deptTree?.setCurrentKey?.(null);
});
this.onLoad(this.page);
},
searchChange(params, done) {
@@ -1478,6 +1559,10 @@ export default {
color: #909399;
}
.oa-sync-stat__value--remove {
color: #f56c6c;
}
.user-edit-dialog .el-form-item {
margin-bottom: 24px;
}
@@ -1508,6 +1593,10 @@ export default {
justify-content: flex-start;
}
.user-dept-tag {
cursor: pointer;
}
.user-dept-tag + .user-dept-tag {
margin-left: 6px;
}
+36 -15
View File
@@ -60,7 +60,11 @@
<span>{{ row.idCardNo || '-' }}</span>
</template>
<template #organizationName="{ row }">
{{ String(row.organizationName || '').replace(/^[\s\u3000]+/, '') }}
<span
v-if="isBlankOrganizationName(row.organizationName)"
class="organization-name--empty"
>未分配组织</span>
<span v-else>{{ String(row.organizationName || '').replace(/^[\s\u3000]+/, '') }}</span>
</template>
<template #status="{ row }">
<el-tag :type="row.status === 1 ? 'primary' : 'info'" class="status-text">
@@ -143,7 +147,7 @@
maxlength="18"
show-word-limit
placeholder="请输入"
@input="handleIdCardInput"
@blur="handleIdCardBlur"
/>
</el-form-item>
</el-col>
@@ -153,7 +157,7 @@
v-model="driverForm.birthday"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择"
placeholder="请选择出生年月"
/>
</el-form-item>
</el-col>
@@ -201,12 +205,16 @@
</el-col>
<el-col :span="6">
<el-form-item label="住址" prop="addressRegion">
<!-- 只读直接显示库里那串区划名称:级联要先按名称反解 path,区划改名后反解不出来,
同一串文字就会在灰字 placeholder 与黑字标签之间摇摆 -->
<el-input v-if="readonly" :model-value="driverForm.addressRegion || '—'" readonly />
<el-cascader
v-else
ref="addressRegionCascader"
v-model="driverForm.addressRegionPath"
:options="regionOptions"
:props="regionCascaderProps"
:placeholder="driverForm.addressRegion || '请选择'"
:placeholder="driverForm.addressRegion || '请选择省/市/区'"
clearable
filterable
@change="handleAddressRegionChange"
@@ -219,7 +227,7 @@
v-model="driverForm.address"
maxlength="200"
show-word-limit
placeholder="请输入"
placeholder="请输入详细地址(街道、门牌号)"
/>
</el-form-item>
</el-col>
@@ -592,7 +600,11 @@
<span>{{ row.plateNo || '-' }}</span>
</template>
<template #organizationName="{ row }">
{{ String(row.organizationName || '').replace(/^[\s\u3000]+/, '') }}
<span
v-if="isBlankOrganizationName(row.organizationName)"
class="organization-name--empty"
>未分配组织</span>
<span v-else>{{ String(row.organizationName || '').replace(/^[\s\u3000]+/, '') }}</span>
</template>
<template #boundDriver="{ row }">
<span>{{ row.boundDriver || '-' }}</span>
@@ -743,6 +755,8 @@ export default {
expired: 0,
},
driverBox: false,
// 搜索栏组织级联追加「未分配组织」一项(哨兵值见 organization-search mixin)
enableUnassignedOrgFilter: true,
vehicleSelectorVisible: false,
vehicleSelectorLoading: false,
vehicleSelectorOption,
@@ -857,7 +871,7 @@ export default {
emergencyContactMobile: [
{ required: true, message: '请输入紧急联系人手机号', trigger: 'blur' },
],
organizationName: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
// 后端已允许所属组织为空,这里不做必填校验
idCardFront: [{ required: true, message: '请上传身份证正面照', trigger: 'change' }],
idCardBack: [{ required: true, message: '请上传身份证反面照', trigger: 'change' }],
drivingLicenseFront: [{ required: true, message: '请上传驾驶证主页', trigger: 'change' }],
@@ -1122,19 +1136,21 @@ export default {
removeDigits(value = '') {
return String(value).replace(/\d/g, '');
},
handleIdCardInput(value) {
const idCardNo = String(value || '').toUpperCase();
/**
* 身份证号失焦后补出生年月与性别,与小程序 person.vue 的 onIdCardNoChange 同口径:
* 只在字段还空着时补——用户手改过的值不被他随后修改身份证号的动作冲掉。
* 不回写空值:18 位不合法时清空生日会把已选日期当垃圾丢掉。
* OCR 识别结果仍直接覆盖(见 applyIdCardRecognition),那是「重新采一次证件」,与手输联动不是一回事。
*/
handleIdCardBlur() {
const idCardNo = String(this.driverForm.idCardNo || '').toUpperCase();
this.driverForm.idCardNo = idCardNo;
const idCardInfo = this.parseIdCardInfo(idCardNo);
if (idCardInfo.birthday) {
if (!this.driverForm.birthday && idCardInfo.birthday) {
this.driverForm.birthday = idCardInfo.birthday;
} else {
this.driverForm.birthday = '';
}
if (idCardInfo.gender) {
if (!this.driverForm.gender && idCardInfo.gender) {
this.driverForm.gender = idCardInfo.gender;
} else {
this.driverForm.gender = '';
}
if (this.submitAttempted) {
this.$nextTick(() => {
@@ -1952,6 +1968,11 @@ export default {
}
}
// 空组织记录在列表里的占位文案
.organization-name--empty {
color: #909399;
}
.driver-page__date-expiring {
color: #d40000;
font-weight: 600;
+149 -23
View File
@@ -59,7 +59,22 @@
</el-button>
</template>
<template #organizationName="{ row }">
{{ String(row.organizationName || '').replace(/^[\s\u3000]+/, '') }}
<el-tooltip
:content="formatOrgDisplayName(row.organizationName)"
placement="top"
:disabled="!formatOrgDisplayName(row.organizationName)"
>
<span class="org-cell-text">{{ formatOrgDisplayName(row.organizationName) }}</span>
</el-tooltip>
</template>
<template #useDepartment="{ row }">
<el-tooltip
:content="formatOrgDisplayName(row.useDepartment)"
placement="top"
:disabled="!formatOrgDisplayName(row.useDepartment)"
>
<span class="org-cell-text">{{ formatOrgDisplayName(row.useDepartment) }}</span>
</el-tooltip>
</template>
<template #status="{ row }">
<el-tag :type="row.status === 1 ? 'primary' : 'info'" class="status-text">
@@ -315,26 +330,58 @@
</el-col>
<el-col :span="6">
<el-form-item label="所有组织" prop="organizationName">
<el-cascader
v-model="organizationCascaderValue"
:options="organizationTreeOptions"
:props="organizationCascaderProps"
filterable
clearable
placeholder="请选择"
/>
<el-tooltip
:content="
formatOrgCascaderPath(organizationCascaderPath) ||
formatOrgDisplayName(vehicleForm.organizationName)
"
placement="top"
:disabled="
!(
formatOrgCascaderPath(organizationCascaderPath) ||
formatOrgDisplayName(vehicleForm.organizationName)
)
"
>
<div class="org-cascader-tooltip">
<el-cascader
v-model="organizationCascaderValue"
:options="organizationFormTreeOptions"
:props="formOrgCascaderProps"
filterable
clearable
placeholder="请选择"
/>
</div>
</el-tooltip>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="使用部门" prop="useDepartment">
<el-cascader
v-model="useDepartmentCascaderValue"
:options="organizationTreeOptions"
:props="organizationCascaderProps"
filterable
clearable
placeholder="请选择"
/>
<el-tooltip
:content="
formatOrgCascaderPath(useDepartmentCascaderPath) ||
formatOrgDisplayName(vehicleForm.useDepartment)
"
placement="top"
:disabled="
!(
formatOrgCascaderPath(useDepartmentCascaderPath) ||
formatOrgDisplayName(vehicleForm.useDepartment)
)
"
>
<div class="org-cascader-tooltip">
<el-cascader
v-model="useDepartmentCascaderValue"
:options="useDepartmentFormTreeOptions"
:props="formOrgCascaderProps"
filterable
clearable
placeholder="请选择"
/>
</div>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
@@ -652,6 +699,17 @@ export default {
vehicleCertificateUploads: {},
uploadHeaders: getUploadHeaders(),
organizationOptions: [],
// 表单两个级联各自维护路径,避免名称回写互相覆盖;不要与搜索栏共用同一棵树节点
organizationCascaderPath: [],
useDepartmentCascaderPath: [],
formOrgCascaderProps: {
value: 'id',
label: 'label',
children: 'children',
emitPath: true,
checkStrictly: true,
expandTrigger: 'hover',
},
vehicleTypeOptions: [
{ label: '高栏车', value: '高栏' },
{ label: '低栏车', value: '低栏' },
@@ -697,22 +755,31 @@ export default {
: [{ required: true, message: '请选择行驶证有效期', trigger: 'change' }],
};
},
// 所属组织级联:表单存组织名称,级联控件用 id 路径,两者在此双向转换
// 两个级联必须使用克隆后的独立树,否则 checkStrictly 会在节点上互相抢选中态
organizationFormTreeOptions() {
return this.cloneOrgTree(this.organizationTreeOptions);
},
useDepartmentFormTreeOptions() {
return this.cloneOrgTree(this.organizationTreeOptions);
},
// 所属组织级联:本地保存 id 路径,名称同步到表单字段供后端使用
organizationCascaderValue: {
get() {
return this.resolveOrgPath(this.vehicleForm.organizationName);
return this.organizationCascaderPath;
},
set(path) {
this.vehicleForm.organizationName = this.resolveOrgName(path);
this.organizationCascaderPath = Array.isArray(path) ? [...path] : [];
this.vehicleForm.organizationName = this.resolveOrgName(this.organizationCascaderPath);
},
},
// 使用部门级联:与所属组织同一套部门树
// 使用部门级联:独立路径状态,避免与所属组织共用计算回写导致选不中
useDepartmentCascaderValue: {
get() {
return this.resolveOrgPath(this.vehicleForm.useDepartment);
return this.useDepartmentCascaderPath;
},
set(path) {
this.vehicleForm.useDepartment = this.resolveOrgName(path);
this.useDepartmentCascaderPath = Array.isArray(path) ? [...path] : [];
this.vehicleForm.useDepartment = this.resolveOrgName(this.useDepartmentCascaderPath);
},
},
isAdmin() {
@@ -745,10 +812,49 @@ export default {
this.initDeptTree();
this.loadOrganizationOptions();
},
watch: {
organizationTreeOptions() {
if (this.vehicleBox) {
this.syncOrgCascaderPaths();
}
},
},
methods: {
hasPermission(code) {
return this.isAdmin || this.permission?.[code] === true;
},
/** 去掉组织名称前导空白,供列表与提示展示 */
formatOrgDisplayName(name) {
return String(name || '').replace(/^[\s\u3000]+/, '');
},
/** 级联路径还原完整组织层级文案,悬停展示用 */
formatOrgCascaderPath(path) {
const ids = Array.isArray(path)
? path.filter(item => item !== undefined && item !== null && item !== '')
: [];
if (!ids.length) return '';
const labels = [];
let nodes = this.organizationTreeOptions || [];
for (const id of ids) {
const node = nodes.find(item => String(item.id) === String(id));
if (!node) break;
labels.push(node.rawLabel || node.label || '');
nodes = node.children || [];
}
return labels.filter(Boolean).join(' / ');
},
cloneOrgTree(tree = []) {
return (tree || []).map(item => ({
id: String(item.id),
label: item.label,
rawLabel: item.rawLabel,
children: item.children?.length ? this.cloneOrgTree(item.children) : undefined,
}));
},
syncOrgCascaderPaths() {
this.organizationCascaderPath = this.resolveOrgPath(this.vehicleForm.organizationName);
this.useDepartmentCascaderPath = this.resolveOrgPath(this.vehicleForm.useDepartment);
},
initDeptTree() {
getDeptTree(this.userInfo.tenantId).then(res => {
this.organizationOptions = this.flattenDeptOptions(res.data.data || []);
@@ -760,6 +866,9 @@ export default {
if (this.vehicleBox && !this.vehicleForm.useDepartment) {
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
}
if (this.vehicleBox) {
this.syncOrgCascaderPaths();
}
});
},
flattenDeptOptions(tree = [], level = 0) {
@@ -854,6 +963,7 @@ export default {
this.vehicleForm = emptyForm();
this.vehicleForm.organizationName = this.getCurrentOrganizationName();
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
this.syncOrgCascaderPaths();
this.syncPlateNo(false);
this.vehicleBox = true;
return;
@@ -867,6 +977,7 @@ export default {
if (!this.vehicleForm.useDepartment) {
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
}
this.syncOrgCascaderPaths();
this.splitPlateNo();
this.syncPlateNo(false);
this.vehicleBox = true;
@@ -878,6 +989,8 @@ export default {
},
resetVehicle() {
this.vehicleForm = emptyForm();
this.organizationCascaderPath = [];
this.useDepartmentCascaderPath = [];
this.vehicleCertificateUploads = {};
this.readonly = false;
this.submitLoading = false;
@@ -1530,7 +1643,20 @@ export default {
}
}
.org-cell-text {
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: bottom;
}
.vehicle-form {
.org-cascader-tooltip {
width: 100%;
}
:deep(.el-date-editor.el-input),
:deep(.el-date-editor.el-input__wrapper),
:deep(.el-select),
@@ -101,6 +101,12 @@
style="width: 500px"
/>
</el-form-item>
<el-form-item label="减分最高扣分">
<el-input :model-value="HARDCODED_MAX_MINUS_SCORE" disabled style="width: 500px">
<template #append>分</template>
</el-input>
<div class="score-config__hint">暂定最高扣 15 分,加分合计同样最高按 15 分计</div>
</el-form-item>
<el-form-item label="备注">
<el-input
v-model="configForm.remark"
@@ -489,9 +495,15 @@ const standardNumberFields = [
'creditLimitIncrease',
];
/** 暂定:加分/减分合计上限均为 15 分,超出按 15 分计 */
const HARDCODED_MAX_PLUS_SCORE = 15;
const HARDCODED_MAX_MINUS_SCORE = 15;
export default {
data() {
return {
HARDCODED_MAX_PLUS_SCORE,
HARDCODED_MAX_MINUS_SCORE,
form: {},
query: {},
loading: true,
@@ -628,6 +640,7 @@ export default {
name: '',
remark: '',
standardDescription: '',
maxMinusScore: HARDCODED_MAX_MINUS_SCORE,
status: 3,
categories: this.defaultCategories(),
standards: [],
@@ -684,6 +697,8 @@ export default {
});
return {
...detail,
// 暂定写死最高扣分,不读取历史配置值
maxMinusScore: HARDCODED_MAX_MINUS_SCORE,
categories: categories.map(category => ({
...(map[category.categoryCode] || category),
categoryName: category.categoryName,
@@ -816,6 +831,7 @@ export default {
},
prepareSubmitConfig(config) {
const payload = JSON.parse(JSON.stringify(config || {}));
payload.maxMinusScore = this.toScoreValue(HARDCODED_MAX_MINUS_SCORE);
(payload.categories || []).forEach(category => {
(category.items || []).forEach(item => {
item.score = this.toScoreValue(item.score);
@@ -1072,6 +1088,8 @@ export default {
this.$message.warning('请输入评定表名称');
return false;
}
// 减分最高扣分暂定写死为 15,提交前强制回填,避免历史脏数据触发校验
this.configForm.maxMinusScore = HARDCODED_MAX_MINUS_SCORE;
const basic = this.configForm.categories.find(item => item.categoryCode === 'basic');
if (!basic || basic.items.length === 0) {
this.$message.warning('至少配置1个基础得分项目');
@@ -1554,6 +1572,13 @@ export default {
overflow: auto;
}
.score-config__hint {
margin-top: 6px;
color: #909399;
font-size: 12px;
line-height: 1.4;
}
:deep(.score-config__name-input) {
width: 500px;
}
File diff suppressed because it is too large Load Diff
+2
View File
@@ -214,6 +214,7 @@
- 到场、装货、发货、在途、到货、卸货、签收节点的操作要求包含是否打卡、打卡定位;装货、发货、到货、卸货、签收还包含上传货量和上传货量类型;附件要求包含上传凭证和凭证类型。
- 在途节点额外包含打卡频次和打卡时段,打卡频次使用普通输入框,打卡时段使用时间选择器。
- 回单节点的操作要求包含是否确认、确认完成,是否确认提供“是 / 无需确认完成”单选,确认完成使用“内部人员”复选框。
- 回单节点的“内部人员”复选框只读,不接受手工勾选:是否确认为“是”时自动勾选(即回单需内部人员确认),为“无需确认完成”时自动取消勾选。
- 各节点中是否打卡、上传货量、上传凭证均使用单选或复选输入,控件类型与截图保持一致。
- 异常与边界:
@@ -233,6 +234,7 @@
- 不允许非在途节点配置打卡频次和打卡时段。
- 不允许是否打卡为否时仍强制填写打卡定位或打卡时段。
- 不允许上传凭证关闭后仍提交凭证类型。
- 不允许手工勾选或取消回单节点的“内部人员”复选框。
---