25 Commits

Author SHA1 Message Date
b2894lxlx 6212d68a77 付款申请表单优化与结算单过滤,并完善相关体验
进度预付仅可选预结算、尾款付款可选正式/预结算;同步收款账户、申请金额校验、关闭标签与费用明细残留等交互,并补充运单复制需求说明。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-23 00:17:07 +08:00
b2894lxlx ce1ce02551 完善变更记录、客商评分与车辆表单
变更记录详情统一为居中分页弹窗,并去掉经办人等信息行。
客商评分支持删除、提交前自评校验、复评后才能审批,以及 0 分提交。
车辆外廓尺寸和载质量单位改到输入框内,认证审核标签按四字换行,使用部门必填并默认当前部门。
临时额度的 -1 占位金额显示为空。新增项目编号可留空由系统生成。
修复缓存总单页在打开新增项目时误请求缺少 id 的详情接口。
详情页状态与运输方式标签样式统一。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-22 20:13:44 +08:00
b2894lxlx 3a8442e522 Merge remote-tracking branch 'websoft/master' 2026-09-22 12:06:53 +08:00
b2894lxlx ac87208ba9 MK公开页、预结算体验优化、地图选址与认证密码规则完善 2026-09-22 12:06:48 +08:00
weicw1996 815810f841 批量导入上传提示注明日期宽容写法
8 个 CRUD 导入上传 tip 与运单导入弹窗、运输计划导入页的提示文案
统一补充「日期支持 2026-08-02、2026-8-2、2026/8/2 等写法」,
配合后端宽容日期解析(weicw/tms-erp#1)。
2026-09-21 19:08:56 +08:00
weicw1996 4e04cdbc5b 统一运输方式兜底文案为公路运输
去掉计划单调度、运输计划展示中的「公路整车」旧文案
2026-09-21 19:08:55 +08:00
b2894lxlx 57368f0179 调试mk 2026-09-21 11:14:51 +08:00
b2894lxlx 7078de6385 调试mk 2026-09-20 18:12:51 +08:00
b2894lxlx 4af9afda61 调试mk 2026-09-20 13:17:05 +08:00
b2894lxlx 50ab33f369 Merge remote-tracking branch 'websoft/master'
# Conflicts:
#	src/views/business/project-apply.vue
2026-09-18 18:26:13 +08:00
b2894lxlx bcbc45bb03 调整 用户 2026-09-18 18:25:52 +08:00
gxwebsoft ff9fb9168b fix(router): 修复运单管理详情路由及合同详情路由重复定义问题
- 为 waybill-manage-page、transport-plan-page 等组件增加 routePathLocked 变量锁定路由路径
- 添加 isOwnedRouteActive 计算属性,防止缓存实例错误读取其它路由的 detailId 导致误请求
- watcher 和 openDetail 方法中添加路由守卫,避免多余的请求和误开详情标签
- 修改宿主视图绑定 detailId,避免直接绑定全局 $route.query 导致缓存污染
- 删除 router/views/index.js 中合同管理详情路由重复定义,防止内容区空白问题
- 优化 waybill-import-dialog 组件样式和结构,增加 section-card 包裹表单区域
- 调整相关组件 data、computed、watch 使用,确保第一次立即 watcher 正确读取路由数据
- 验证所有改动后相关页面 HTTP 200,标签页行为正常,解决「运单管理不存在」和合同详情空白问题
2026-09-18 12:22:25 +08:00
gxwebsoft 986feff7b7 fix(waybill-manage): 修复运单详情弹窗残留问题
- 页面形态状态(列表/独立表单页/独立详情页)在实例创建时锁定,避免随路由变化切换导致弹窗残留
- 模板中形态相关所有判定改为使用锁定状态变量,保证渲染一致性
- 修改 detailContainer、crudContainer、pageFormOption 等方法使用锁定状态,避免缓存实例 option 变形
- 新增 closeInnerDialogs 方法,在组件 deactivated 和 beforeUnmount 生命周期关闭所有 append-to-body 弹窗
- 解决标签页 keep-alive 机制下弹窗 Teleport 持续遗留导致界面异常的问题
- 对运单管理页面多处弹窗和视图控制做统一修复,提升页面稳定性和体验
2026-09-18 11:29:52 +08:00
gxwebsoft 3e7110ca8c fix(waybill-manage): 修复运单详情弹窗残留问题
- 页面形态状态(列表/独立表单页/独立详情页)在实例创建时锁定,避免随路由变化切换导致弹窗残留
- 模板中形态相关所有判定改为使用锁定状态变量,保证渲染一致性
- 修改 detailContainer、crudContainer、pageFormOption 等方法使用锁定状态,避免缓存实例 option 变形
- 新增 closeInnerDialogs 方法,在组件 deactivated 和 beforeUnmount 生命周期关闭所有 append-to-body 弹窗
- 解决标签页 keep-alive 机制下弹窗 Teleport 持续遗留导致界面异常的问题
- 对运单管理页面多处弹窗和视图控制做统一修复,提升页面稳定性和体验
2026-09-18 11:17:50 +08:00
gxwebsoft b4e12a671f fix(views): 修复独立页切换时弹窗残留问题
- 独立整页固定使用普通 div 容器,取消动态切换 el-dialog 避免切换时弹窗 DOM 残留
- 删除相关 dialogVisible、dialogTitle、页脚弹窗动态分支代码以简化逻辑
- watch $route 调整,优化独立页初始化流程,避免不必要的关闭弹窗操作
- 新增 closeInnerDialogs 方法,页面卸载或 keep-alive deactivate 时关闭所有二级弹窗
- 对 loading-manage 与 project-apply 两个模块同步改造,统一处理弹窗状态和容器渲染
- 解决 keep-alive 缓存导致旧弹窗一直挂载在 body 上的问题,改善用户切换体验
2026-09-18 10:17:48 +08:00
gxwebsoft 5bb072223f feat(loading-manage): 配载管理详情及重新派单改用独立页面
- 新增 `/business/loading-manage/detail` 路由,详情页由独立页面承载
- 统一将新增、编辑、详情和重新派单均采用独立表单页/详情页显示
- 修改组件内逻辑,新增 `isStandalonePage` 计算属性统一控制页面与弹窗切换
- 修改列表页链接及操作行为,详情和重新派单按钮跳转至对应独立页面
- 去除旧详情弹窗模式,相关样式调整支持独立页面自然滚动
- 添加路由监听,支持页面刷新和切换时正确初始化详情或表单数据
- 兼容老链接 `/business/loading-manage?detailId=x` 自动跳详情新路由
- 修正弹窗底栏样式,去除写死间距,统一由全局规则控制
- 代码中禁止顶层 scoped style 使用 `//` 注释,改用 `/* */` 避免编译错误
2026-09-17 22:40:41 +08:00
gxwebsoft 3d6e297147 feat(vehicle): 归一化保险记录导入日期格式,修复设备台账批量删除按钮
- 保险记录批量导入时,前端读取 Excel 并规范日期格式为 YYYY-MM-DD,兼容多种日期写法
- 重写 `handleImport` 支持自定义上传逻辑,调用归一化处理后再上传文件
- 添加日期归一化相关方法,确保不合法或已标准格式保持原值
- 设备台账界面新增批量删除按钮及相关逻辑,支持多选数据批量删除并提示确认
- 补充导出含创建时间和更新时间的后端修复说明,避免导出时间字段为空问题
- 说明后端导出分配逻辑,强调导出字段由后端控制,前端修改导出列无效
2026-09-17 21:21:33 +08:00
gxwebsoft 82fbb99593 fix(payment): 优化发票申请及收据表单提示和样式
- 简化合并开票结算单的合同限制提示文案
- 调整发票申请表单搜索区域的内容左对齐样式
- 修正发票收据表单关键词输入框的占位符文字错误
2026-09-17 14:59:26 +08:00
gxwebsoft 17c482e21a feat(waybill): 优化打卡时间轴按打卡时间排序展示
- 新增 computed 属性 orderedWaybillPunchRecords,按打卡时间升序排序已打卡记录
- 未打卡记录保持后端返回的节点顺序,排在已打卡记录之后
- 引入方法 waybillPunchRecordTimestamp 解析打卡时间,支持多种日期格式
- 修正 el-timeline v-for 使用 orderedWaybillPunchRecords 避免 key 冲突
- 保持原有流程节点顺序不变,仅调整时间轴展示顺序
2026-09-17 14:47:29 +08:00
gxwebsoft 2684624979 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/views/business/contract-manage.vue
#	src/views/business/temporary-credit-limit.vue
#	src/views/transportCapacity/vehicle.vue
2026-09-17 14:42:33 +08:00
b2894lxlx 84d9e098ba 调整 业务 2026-09-16 23:43:12 +08:00
b2894lxlx c1c4fa18c9 调整 iam 2026-09-16 06:30:30 +08:00
gxwebsoft 2131e99ec4 feat(contract-manage): 将合同详情由弹窗改为独立页面
- 新增路由 /business/contract-manage/detail,详情页共享合同管理组件
- 列表、表单、详情三分支用 isFormPage 和 isDetailPage 控制
- openDetail 方法改为跳转详情路由,initDetailPage 获取详情数据
- 新增 resetDetailState 和 closeDetailPage 方法,复用关闭逻辑
- 详情页去除弹窗高度限制,样式改为页面自滚动
- 详情页底栏使用固定位置关闭按钮,保持页面布局一致
- watch 和 created 中添加对 isDetailPage 的初始化调用和监听
2026-09-11 12:30:05 +08:00
gxwebsoft 6e5b15f203 Merge remote-tracking branch 'origin/master' 2026-09-11 10:41:13 +08:00
gxwebsoft fbfd5cde89 fix(api): 移除项目资金风险统计请求调用
- 由于后端/fund-risk-stats端点尚未实现,删除列表页中refreshFundRiskStats调用
- 从data中移除fundRiskStats相关数据,避免接口请求报错
- 列表头部风险筛选标签调整,仅显示“高风险/中风险”,去掉数量显示
- api/business/project-apply.js中保留getFundRiskStats定义,并添加注释说明后端就绪后恢复调用
2026-09-11 10:41:09 +08:00
101 changed files with 7925 additions and 2234 deletions
+6
View File
@@ -0,0 +1,6 @@
# 2026-09-10
- 移除 project-apply 的 fund-risk-stats 请求(后端未实现端点,每次列表加载都弹 No endpoint 报错):删除 onLoad 内 refreshFundRiskStats 调用与该方法、data 中 fundRiskStats;头部风险标签去掉「(数量)」只留「高风险/中风险」;api/business/project-apply.js 保留 getFundRiskStats 定义并注释「后端就绪后恢复」。
EOF2
}
cat >> /Users/gxwebsoft/VUE/tms-erp-web-ws/.workbuddy/memory/2026-09-10.md <<'EOF'
+28
View File
@@ -0,0 +1,28 @@
# 2026-09-11
## 上传证件区域固定宽度导致跨机器错位(transportCapacity
- 现象:driver.vue 新增弹窗的身份证/大头照上传框在本机对齐,他人电脑不对齐。
- 根因:`--large` 上传框写死 `width:240px`ship 写 248px),而弹窗 `width:90%` + `el-col :span=6` 列宽是弹性的、上方输入框 `width:100%`;列宽随分辨率 / Windows 系统缩放 / 浏览器缩放变化,240px 只在特定宽度下恰好等于列宽。叠加 `labelWidth:auto` 靠 JS 实测字体(苹方 vs 微软雅黑)宽度,label 列宽也不同 → 起始位置漂移。
- 修复:三个文件改为 `width:100%; max-width:240px; flex:none`ship 保留 248px 上限),窄屏跟随列宽、宽屏保持比例上限,左边缘恒与输入框对齐。
- `src/views/transportCapacity/driver.vue`.driver-uploader--large
- `src/views/transportCapacity/vehicle.vue`.vehicle-uploader--large
- `src/views/transportCapacity/ship.vue`.ship-uploader--large
-@vue/compiler-sfc(脚本放项目根目录)验证三个 SFC 编译通过。
- 教训:本项目所有「固定 px 宽度的上传/控件」都要配 `max-width` + `width:100%`,否则高分屏/低分屏下必然错位。
## 合同详情由弹窗改为独立页面(contract-manage
- 路由:新增 `/business/contract-manage/detail``src/router/views/index.js`name『合同详情』,meta `keepAlive:false` + `activeMenu:'/business/contract-manage'`),组件仍复用 `contract-manage.vue`(与 form 页同一套路)。
- 页面内三分支:`v-if="!isFormPage && !isDetailPage"`(列表)/ `v-else-if="isFormPage"`(表单)/ `v-else`(详情)。**v-else 必须紧邻 form 分支的 `</template>`**,中间不能插其它组件,否则 Vue 编译报「v-else 无相邻 v-if」——弹窗类组件(billing-plan-editor / 附件预览 / 变更记录详情 / 流程)放在三个分支之后。
- 关键改动:`openDetail``router.push({ path:'/business/contract-manage/detail', query:{ id, name } })`;新增 `initDetailPage()`(按 query.id 拉详情,`resetDetailState()` 先清空)、`closeDetailPage()`closeTag + 回列表)、`isDetailPage` / `detailPageTitle` computed`created``$route.fullPath` watch 都要加 `else if (this.isDetailPage)`
- 样式:`.contract-manage-detail--page { max-height:none; overflow:visible }`,去掉弹窗的 74vh 限制;底栏复用 `.contract-manage-page__footer`(fixed 浮动),只读详情页按钮保留「关闭」。
- 校验方式:dev server 已运行时 `curl "http://localhost:2889/src/views/business/contract-manage.vue"` 返回 200 即 Vite 编译通过(比整包 build 快)。
## 只给「查看弹窗」加宽 labeltemporary-credit-limit
- 场景:详情页长 label(「剩余项目资金使用额度(万元)」)换行超 2 行撑坏详情表格,但又不能影响新增/编辑页。
- **关键发现:Avue 的 `avue-form` 在 detail 模式下根节点会挂 `.avue--detail` 类**(源码 `node_modules/@smallwei/avue/lib/packages/element-plus/form/index3.js``class: normalizeClass([b(), { 'avue--detail': isDetail }])`)。所以「只针对详情态」的选择器就是:
```scss
.temporary-credit-limit-dialog .avue--detail .el-form-item__label { width:210px !important; flex:0 0 210px !important; }
```
新增/编辑弹窗无 `.avue--detail`,天然不受影响,不需要在 option 里做 mode 判断。
- 校验样式块编译:dev server 请求 `?vue&type=style&index=1&lang.scss`**lang 必须写 scss,写 css 会 500**),grep 规则确认产物。
- 结论备忘:长 label 优先「加宽 + 换行 ≤2 行」,不要用单行省略 + tooltip —— 详情是纯阅读场景,hover 才能看全字段名的可发现性差。
+63
View File
@@ -0,0 +1,63 @@
# 2026-09-17 工作日志
## 配载管理(loading-manage):弹窗全部改为独立表单页/详情页
- 需求:`/business/loading-manage` 不再用弹窗,改成与新增合同(`/business/contract-manage/form?mode=add&name=新增合同管理`)一致的独立页面。
- 现状:新增/编辑**已经**是独立页(组件内 `isStandaloneFormPage` + `/business/loading-manage/form` 路由),但「详情」和「重新派单」仍是 el-dialog(用户截图即详情弹窗)。
- 改动(3 个文件):
1. `src/router/views/index.js`:新增 `/business/loading-manage/detail`name 配载单详情,`meta.keepAlive:false, activeMenu:'/business/loading-manage'`),组件仍是 `loading-manage.vue`
2. `src/views/business/loading-manage.vue`
- computed 新增 `isStandaloneDetailPage`path==='/business/loading-manage/detail')、`isStandalonePage`form|detail 并集,作为隐藏列表容器的统一开关)、`detailPageTitle``formPageDefaultTitle`add/edit/reassign 映射);`isStandaloneFormPage` 放行 `mode=reassign`
- 模板中所有控制「是否独立页/是否弹窗」的 `isStandaloneFormPage` 改为 `isStandalonePage`;顶部标题按详情/表单取 `detailPageTitle`/`formPageTitle`
- 新增 `gotoLoadingDetail(row)`push `/detail?id=&name=配载单详情`,替换「配载单号」链接与操作列「详情」)、`gotoLoadingReassign(row)`push `/form?mode=reassign&id=&name=重新派单`)、`initStandaloneDetailPage()``initStandaloneFormPage` 模式透传 edit/reassign`openLoadingDialog` 对 add/edit/reassign 一律转独立页;`closeLoadingDialog` 判据改 `isStandalonePage`
- `mounted` / `watch $route` 增加详情页分支(直接打开与页内切换都要 init);detail 分支除 id 变化外,`dialogMode !== 'view'` 也重新 init(防止从表单页切详情时残留表单态)。
- 兼容旧链接:`/business/loading-manage?detailId=x` 仍可用,会 replace 到详情页。
- 样式:底栏去掉写死的 `gap:8px`(全站统一 12px);页面模式的内容区解除 `max-height:78vh` 内嵌滚动盒 —— 原 `:global(.loading-manage-form-page .loading-manage-dialog__body)` 权重 (0,2,0) 低于 scoped 规则 (0,3,0) 一直没生效,改为 `.loading-manage-page .loading-manage-form-dialog.loading-manage-form-page .loading-manage-dialog__body` (0,4,0),内容改随 `#avue-view` 自然滚动(与合同页一致)。
3. `src/views/business/components/waybill-manage-page.vue``openLoadingDetail``/business/loading-manage?detailId=` 改为 push `/business/loading-manage/detail?id=&name=配载单详情`
- 校验:dev server2889)单独编译 4 个模块均 HTTP 200(含 scoped scss);`vite build` 仍会在无关文件 `src/page/login/facelogin.vue` 被沙箱敏感内容保护中断。
- 踩坑:**`<style scoped lang="scss">` 顶层写 `//` 注释**会让该样式模块编译 500`Unexpected '/'. Escaping special characters with \ may help.`),已实测确认;顶层必须用 `/* */`
- 未做:登录态无法在浏览器实测(无测试账号),需用户点 `/business/loading-manage` → 详情/重新派单 自测;`voucher-manage-detail` 跳配载时带的 `?loadingNo=` 参数本来就未被列表消费(历史遗留)。
## 运单管理详情:打卡时间轴改为按打卡顺序展示
- 文件:`src/views/business/components/waybill-manage-page.vue`(详情页「执行详情 → 打卡详情」tab)
- 需求:时间轴不再固定按流程节点顺序(发货/在途/到货/卸货/签收/回单),改为按打卡时间先后展示。
- 实现(不改后端、不改原始数据):
1. 新增 computed `orderedWaybillPunchRecords`:映射出 `punchedAt`(毫秒时间戳)后排序 —— **已打卡记录按打卡时间升序排在前**,未打卡记录保持后端返回的节点顺序排在其后;时间相同用原索引稳定排序。
2. 新增 method `waybillPunchRecordTimestamp(record)``punched === false``statusName === '未打卡'` 直接返回 null(防止后端返回计划时间造成误序);优先 `this.$dayjs(text).valueOf()`,失败兜底 `new Date(text.replace(/-/g,'/'))`(兼容 Safari)。
3. 模板 `el-timeline``v-for` 改用 `orderedWaybillPunchRecords``key``record.nodeCode || record.id || index` 改为 `${nodeCode||id||'punch'}-${index}`,避免同节点多次打卡(在途)时 key 重复。
- 校验:项目根目录临时脚本 `_verify-sfc.mjs`@vue/compiler-sfc parse + compileScript + compileTemplate)通过,已删除脚本。
- 注意:`getPunchRecords``src/api/business/waybill-manage.js``/punch-records`)后端未提供节点排序字段,排序只能在前端做。
## 保险记录批量导入:前端归一化日期格式
- 文件:`src/views/vehicle/insurance-record.vue`(仅此一个文件)
- 背景:保险记录批量导入是**后端驱动**——前端 `handleImport``importBlob` 把原始 Excel 直接 POST 到 `/blade-transport/insurance-record/import-insurance-record`,前端不解析行。后端只认 `2026-09-01``2026-9-1` 导入失败。
- 决策:用户选择**前端归一化**(不动后端)。把 `openImportDialog` 改为自写 `httpRequest`:用 `xlsx` 读取 Excel → 把日期列(开始日期/结束日期/开票日期)`2026-9-1` 归一为 `2026-09-01` → 重写成新 File 再交给 `handleImportExcel` 上传;复用其失败明细下载与成功刷新逻辑。无日期列时回退为原文件(行为不变)。
- 关键方法:`normalizeExcelDates` / `readExcelRows` / `writeExcelFile` / `normalizeDateString`(正则 `^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?$`,用 `new Date` 校验合法性后补零;非法/已标准格式返回 null 保持原值)。
- 校验:本机 devlocalhost:2889)待用户部署自测。注意所有单元格经 `sheet_to_json(raw:false)` 后均为字符串,与 transport-plan-import 的客户端解析模式一致。
## 车/船务模块导出 xlsx「创建时间/更新时间」为空(后端 tms-api 修复)
- 现象:`/vehicle/insurance-record` 批量导出的 xlsx 里「创建时间」「更新时间」两列空白,「更新人」有值。用户要求车/船务模块所有页面统一修。
- 定位:导出由**后端**生成(前端只传查询参数,`exportColumns` 参数后端未使用)。实测 `~/Downloads/保险记录2026-09-17 20_46_08.xlsx`K/M 列单元格无 `<v>` 节点(值 null),E/F/J 日期列是数值 46266.0(带 numFmt `yyyy-MM-dd`WPS 显示为日期)。
- 根因:Service 用 BladeX `org.springblade.core.tool.utils.BeanUtil`**继承 Spring `BeanUtils`**)做 `copyProperties`。实体 `TenantEntity.createTime/updateTime``java.util.Date`,导出类字段是 `java.time.LocalDateTime` → Spring BeanUtils **类型不兼容静默跳过**,值为 null。而「更新人」是手动 `UserCache.getUserRealName(...)` 赋值的,所以有值。(Hutool 的 BeanUtil 能转 Date→LocalDateTime,但本项目用的是 BladeX 版本,不能。)
- 佐证:项目里正常的导出(Waybill / LoadingManage / CustomerArchive / CommonCargo)时间字段一律用 `java.util.Date`,并在 Service 里手动 `excel.setCreateTime(record.getCreateTime())`
- 修复(后端仓库 `/Users/gxwebsoft/JAVA/tms-api`blade-transport 模块):在 13 个导出方法里补显式赋值(Date→LocalDateTime 用 BladeX `DateUtil.fromDate``Func.isEmpty` 判空),不改 Excel 类字段类型(避免影响自定义 converter 与导入模板)。
```java
excel.setCreateTime(Func.isEmpty(x.getCreateTime()) ? null : DateUtil.fromDate(x.getCreateTime()));
excel.setUpdateTime(Func.isEmpty(x.getUpdateTime()) ? null : DateUtil.fromDate(x.getUpdateTime()));
```
- 涉及文件(13 个 Service + 1 新建 Excel 类 + 设备台账 controller/接口):InsuranceRecord / ViolationRecord / MaintenanceRecord / MaintenancePlan / TireReplacementRecord / AccidentRecord / AnnualInspectionRecord / MileageRecord / TransportChangeRecord / EtcRecord / OilElectricRecord / OtherExpenseRecord / EquipmentLedger。
- 设备台账特殊:原 `EquipmentLedgerExcel` 根本没有审计列(前端列表有),新建 `EquipmentLedgerExportExcel extends EquipmentLedgerExcel`(创建时间/更新人/更新时间),导出链路改用新类,**导入模板仍用旧类不受影响**。
- 未验证:本机无 mvn(仅 IDEA 内置),且离线模式缺 `blade-bom` 无法编译;用 javap 确认 `DateUtil.fromDate(Date)` 存在 + 逐行 grep 复核代替。需用户在 IDEA 里编译并重新部署后自测。
- 同类隐患(本次未改,其他模块):TemporaryCreditLimit、ProcessConfig、CommonRoute、CommonAddress、ContractManage、ProjectApply、ShippingTemplate 的导出 Excel 也是 LocalDateTime 且未手动 set 时间。
## 保险记录保额 -1 问题排查(未结案,待用户验证 DB 环境)
- 症状:新增弹窗保额不填 → 再开编辑弹窗显示 -1,触发「不能小于 0」校验。
- 已排除:前端(源码/dist 构建/git 全历史)、后端 tms-api + tms-erp-api-ws(源码/编译产物 javap/git 历史)均无任何 -1 赋值逻辑;保额为 formslot el-input,空值传 ''。
- 关键链路:编辑弹窗 beforeOpen 走 `/detail` 接口(getOne 原生查询),**不经过**列表 SQL 的 `CASE WHEN insured_amount<0 THEN 0` 兜底——所以表格显示 0、弹窗显示原始值。
- 数据库截图(用户 Navicat):该行 insured_amount=NULL,全表无负数 → 说明用户浏览的库与后端实际连接的库**不是同一个/DDL 不一致**。系统存在「空数值=-1」惯例(MaintenanceRecordMapper 里程 `CASE WHEN mileage=-1 THEN NULL`;前端 waybill-manage.js/process-config.js 均有 `Number(v)===-1?'':v` 掩码)→ 后端真实库的 insured_amount 列默认值很可能是 -1,MP 插入排除 null 列 → 默认值 -1 入库。
- 待验证:在后端 Nacos 数据源指向的库执行 `SHOW CREATE TABLE blade_insurance_record` + `SELECT insured_amount FROM blade_insurance_record WHERE policy_no='11111' AND vehicle_no='沪AE31312'`。
- 修复方案(待确认):1) ALTER 列默认值改 NULL + UPDATE 存量负数为 NULL2) 前端 beforeOpen 对 insuredAmount/premium 做 null/-1 → '' 归一(参照 waybill-manage normalizeNumericDisplayValue);3) 列表 SQL 的 CASE 兜底与 detail 不一致,可顺手统一。
+122
View File
@@ -0,0 +1,122 @@
# 2026-09-18
## 修复:改成独立整页后点左侧菜单仍弹出旧弹窗(loading-manage / project-apply
**现象**:配载单管理、项目管理已改为「新增/编辑/详情走独立整页」,但从独立页返回或直接点左侧菜单时,页面上仍会盖出一个老的 `el-dialog`(新增项目管理 / 配载单)。
**根因**(已读 Vue runtime-core 源码确认):
- `src/router/tab.js``tabKey`(默认 fullPath)为每个标签建一个具名 wrapper 组件放进 `wrapperMap``src/page/index/layout.vue``<keep-alive :include="$store.getters.tagsKeep">` 缓存 —— 每个标签页一个实例,全部缓存不销毁。
- 组件被 deactivate 后**仍会随 `$route`(全局响应式)重新渲染**;此时 `isStandalonePage` 变 false`<component :is="isStandalonePage ? 'div' : 'el-dialog'">` 由 div 翻回 `el-dialog`,而 `v-model``projectBox`/`dialogVisible`)仍是 true`append-to-body` 使弹窗 Teleport 到 body。
- `KeepAlive.deactivate``move(vnode, storageContainer, ..., moveType=OUT)`,但 `TeleportImpl.move``moveTeleport`)忽略传入的 moveType、一律按 REORDER 处理 → **teleport 出去的 DOM 不会被搬回 storage container**,永久残留在 `document.body` 上并显示出来。
**修法**(不回退 tab.js 的 `return wrapper` 提交 c1c4fa1,改修根因):
- 独立页容器固定为 `<div v-if="isXxxPage">`,不再按路由回退成 `el-dialog`
- 页内其它 `append-to-body` 二级弹窗加 `deactivated()` / `beforeUnmount()``closeInnerDialogs()` 把 v-model 置 false。
**改动文件**
- `src/views/business/loading-manage.vue`:容器改 `<div v-if="isStandalonePage">`;删 `dialogVisible``dialogTitle``resetLoadingDialog``clearLoadingDialog`、页脚弹窗分支(含「清空」);`watch.$route` 简化;新增 `closeInnerDialogs()`routeChange / commonAddress / candidateSearch+ `deactivated`/`beforeUnmount`
- `src/views/business/project-apply.vue`:容器改 `<div v-if="isProjectFormPage">`;删 `projectFormContainer`/`projectFormContainerProps``projectBox``resetProjectDialog``handleCancelProject``closeProjectForm` 简化为直接 push 列表;新增 `closeInnerDialogs()`changeRecordDetail / 附件文档预览 / 图片预览 / 选人)+ `deactivated`/`beforeUnmount`
**校验**dev server(2889) curl 两个 .vue 及其 scoped style 模块,均 HTTP 200500 才是编译失败)。`vite build` 因沙箱敏感内容保护会在 facelogin.vue 中断,未用。
**遗留同类风险(未改,已告知用户)**`business/components/waybill-manage-page.vue``detailContainer` 在 PageDetail / el-dialog 间切)、`settlement/components/{pre,formal}-settlement-editor.vue``transport-reconciliation-editor.vue``pageMode ? 'div':'el-dialog'`)、`business/components/waybill-import-dialog.vue``standalone`/`createPage`)。统一修法:容器类型在 `created()` 锁定,不随路由/prop 翻转。
---
## 追加修复:运单详情弹窗残留(waybill-manage-page.vue
用户复现路径:打开 `/business/waybill-manage/detail?id=xxx` → 点「配载管理」菜单 → 页面上又冒出运单详情弹窗。与上面同一根因:`detailContainer()``isStandaloneWaybillDetailPage` 在 PageDetail / el-dialog 间翻转,`:append-to-body="!isStandaloneWaybillDetailPage"` 随之为 true`v-model="detailBox"` 仍 true → Teleport 进 body 搬不回来。
**改动**`src/views/business/components/waybill-manage-page.vue`):
- data 新增三个锁定标志 `formPageLocked` / `detailPageLocked` / `formModeLocked`,在 `created()` 一次性从 `isStandaloneWaybillFormPage` / `isStandaloneWaybillDetailPage` / `$route.query.mode` 取值。
- 模板里所有形态判定(根 class、`v-if="!detailPageLocked"` 的列表容器、`form-page-title``status`、独立表单页按钮块、分页 `v-show``:append-to-body`、detail-page class、内容 `v-if="detailBox || detailPageLocked"`、独立页 footer / 弹窗 footer slot)全部改读锁定标志。
- `detailContainer()` / `crudContainer()` / `pageFormOption()`(含 `boxType`)改读锁定标志,避免缓存实例的 option 变形。
- 新增 `closeInnerDialogs()`(关 detailBox、里程补录、附件文档/图片预览、变更路线、常用地址、流程图、运输路线/地址/站点/地图、常用货物、货物导入、过程配置、Excel 导入)+ `deactivated()` / `beforeUnmount()`
**关键验证**`onDeactivated` 在子组件里也会触发 —— apiLifecycle 的 `injectHook` 会向上遍历父链,发现 KeepAlive 父级就把钩子注入到根实例(runtime-core 的 `injectToKeepAliveRoot`),所以写在子组件 waybill-manage-page 上的 `deactivated` 有效。
**校验**dev server curl 该 .vue 与 scoped style 均 200。仍未 commit。
**未提交**:上述改动 + 上一轮 loading-manage 独立页改造均未 commit。
---
## 排查(未改码):配载单详情页反复弹「运单管理不存在」
用户截图:打开 `/business/loading-manage/detail?id=2097607162718441474&name=配载单详情`,连续弹出 6-7 条红色「运单管理不存在」,标签栏堆了一串「运单管理详情」。
**文案来源**:前端 src 里没有这句话,是后端 `BusinessException` 的 msg,被 `src/axios.js` 的响应拦截器(`status !== 200``ElMessage.error(message)`)统一弹出。
**主因(通道 A**`views/business/waybill-manage-detail.vue` 只有 23 行,写了 `:detail-id="$route.query.id"` —— 直接绑全局 `$route`**没有路径守卫**。`waybill-manage-page.vue``detailId` watcher 是 `immediate` 且对任何非空 id 都 `openDetail({id})`。于是:
1. 之前打开过的每个运单详情标签(`/business/waybill-manage/detail?id=A``?id=B`…)各是一个被 keep-alive 缓存的独立实例;
2. 跳到配载单详情后,这些实例被 deactivate 但仍随 `$route` 重渲染 → `$route.query.id` 变成配载单 id
3. prop 变化 → `openDetail({id: 配载单id})``getDetail(配载单id)` 去查运单 → 后端「运单管理不存在」→ 拦截器弹一次。**几个旧标签就几条提示**;
4. 且被污染实例的 `isStandaloneWaybillDetailPage` 仍是 live computed(false) → `openDetail``$router.push` 分支 → 又生成新的「运单管理详情」标签(标签栏那串的来源)。
同理风险:`waybill-manage.vue:6``transport-plan.vue:6``:detail-id="$route.query.detailId"``business-crud-page.vue:7356` 会 push `/business/loading-manage?detailId=id`,正好会污染运单列表实例)。
**次因(通道 B**`loading-manage.vue``restoreWaybillRows` 会用 `waybillIdsJson` 里的每个运单 id 并发 `getWaybillDetail(id)`,若历史运单已被删/失效,也会报同一句文案且并发多条。单条 `.catch(() => null)` 挡不住拦截器已弹出的提示。
**区分方法**Network 里看报错请求的 `id` —— 等于 `2097607162718441474`(配载单 id)→ 通道 A;是别的数字(运单 id)→ 通道 B。或先关掉所有「运单管理详情」标签再复现,通道 A 会消失。
**待确认的修法**(用户要求先报不改):
1. `waybill-manage-page.vue``created()``routePathLocked = this.$route.path``detailId` watcher 首行加 `if (this.$route.path !== this.routePathLocked) return;`
2. `openDetail()` 的 push 分支加同样守卫(防其它调用路径)。
3. 宿主 view 绑定加路径守卫(`waybill-manage-detail.vue` / `waybill-manage.vue` / `transport-plan.vue`)双保险。
4. 可选:`getWaybillDetail` 支持静默模式,供 `restoreWaybillRows` 用,避免历史脏数据刷屏。
## 修复(已执行):「运单管理不存在」误报 + 误开标签
用户确认后按上方案落地,5 个文件:
1. `src/views/business/components/waybill-manage-page.vue`
- `data()` 新增 `routePathLocked: this.$route.path` —— **必须放 data,不能放 created**Vue Options API 顺序是 data → computed → watch(immediate) → created(已在 runtime-core `applyOptions` 源码中核实)。放 created 会让首个 immediate watcher 读到空值。
- 新增 computed `isOwnedRouteActive() { return this.$route.path === this.routePathLocked; }`
- `detailId` watcher 首行加 `if (!this.isOwnedRouteActive) return;`
- `openDetail``$router.push` 分支同样加守卫。
2. `src/views/business/components/transport-plan-page.vue`:完全同构的写法(`:detail-id` host 一致),加同样的 `routePathLocked` + `isOwnedRouteActive` + watcher 守卫。
3. `src/views/business/waybill-manage-detail.vue``:detail-id="$route.query.id"``:detail-id="detailId"`computed 做 `this.$route.path === '/business/waybill-manage/detail'` 守卫。
4. `src/views/business/waybill-manage.vue`:同上,守卫 `/business/waybill-manage`(保留旧链接 `?detailId=` 兼容)。
5. `src/views/business/transport-plan.vue`:同上,守卫 `/business/transport-plan`
**验证**
- dev server curl 5 个 .vue + 2 个 scoped style 全部 HTTP 200。
-`@vue/server-renderer` 写了临时 mjs(已删)模拟带 `$route` 的 app,确认 **data() 里访问 `this.$route` 可行**immediate watcher 触发时 `routePathLocked` 已是正确路径、首次加载不被拦截。
- `$route` 是 vue-router 挂在 `app.config.globalProperties` 上的 gettervue-router.mjs:1498),组件实例化时已就绪。
**未做(第 4 条可选)**:给 `getWaybillDetail` 加静默模式供 `restoreWaybillRows` 使用(历史失效运单仍会刷多条红字),待用户定夺。
**另注**`business-crud-page.vue:6651` 有同构的 `detailId` immediate watcher,但全项目只有上述 3 个宿主 view 传 `:detail-id`,它暂无调用方,未动。
**仍未 commit。**
## 修复(已执行):合同详情页整页空白 —— 路由表重复定义
**现象**:主订单详情点合同编号 → `/business/contract-manage/detail?id=...&name=合同详情` 内容区空白(侧栏/标签正常)。
**定位过程(关键:真实浏览器复现,不猜)**
1. 静态排查全部排除:`contract-manage.vue` 及其 26 个依赖 HTTP 200、模块 `import()` 成功、无循环依赖、详情分支引用的 24 个成员全部有定义。
2. dev 环境登录态无法直接拿(验证码 + `admin/admin``error_code 2004 用户密码强度过低`),改为**注入式复现**
- `agent-browser open <目标 URL>`(落 `/login`);
- eval 取 `document.getElementById('app').__vue_app__.config.globalProperties``$router` / `$store`
- 写 cookie `saber3-access-token`(注意 token 走 **js-cookie**,不是 localStorage+ `$store.state.user.token`
- 覆写 `XMLHttpRequest.prototype.open/send` 让所有 `/api/**` 返回 `{code:200,data:{...}}`defineProperty 伪造 readyState/status/responseText 后手动触发 `onloadend`)。
-`$router.push(...)` 做 SPA 跳转。
3. 复现出空白,并拿到决定性证据:
- `/business/contract-manage/detail``$route.matched.length === 1`(只有 Layoutname undefined),`#avue-view.children.length === 0`innerHTML 为 `<!---->`
- 对照 `/business/contract-manage/change`(结构相同但未重复定义)→ `matched.length === 2`(Layout + 合同变更),内容完整渲染。
- `$router.getRoutes()` 里 detail 有 **3 条**记录:2 个 Layout 父记录 + 1 个子记录(`合同详情`)。
**根因**`src/router/views/index.js``/business/contract-manage/detail` **被复制粘贴定义了两次**,两次的子路由都叫 `合同详情`。vue-router 的 `addRoute` 遇到重名会 `removeRoute(name)` 把先注册的子记录删掉,但**不会把它从父记录的 `children` 数组里摘除**;于是第一条 Layout 壳记录留在 matcher 列表里且排在前面,`resolve('/business/contract-manage/detail')` 命中这个"无有效子路由"的壳 → matched 只有 1 层 → `page/index/index.vue``#avue-view` 的二级 `<router-view>` 无匹配 → 内容区空白。
`getRoutes()` 计数是判据:form / change 都是 2 条 = 父 + 子(健康),detail 是 3 条 = 2 父 + 1 子(坏)。)
**修复**:删除重复块(原 314-325 行),只保留 159-169 行那一份。
**验证**
- 重复扫描脚本(正则匹配「顶层 path + `component: Layout` + 首个子路由 name」):views/index.js 27 条 Layout 子路由中仅 `合同详情` 重复;page/index.js 无重复 → 已清零。
- 修复后浏览器复验:detail → `matched.length === 2`Layout + 合同详情)、`#avue-view.children.length === 1`,正文完整渲染「基本信息 / 签约类型 / 合同编号 HT-2026-001 / … / 变更记录」。
- 全量回归:48 条 business/vehicle/payment/settlement 路由 `resolve()``matched.length` 全部 ≥ 2`bad: []`
- `curl` 校验:`views/index.js``contract-manage.vue` 均 200。
- 残留报错均为 mock 数据形状不符所致(所有接口都返回同一个合同对象,导致 `tree.reduce` / `feeCategories.find` 之类失败),非真实缺陷。
**未 commit**(连同 1、2 轮改动一起待确认)。
+19 -100
View File
@@ -1,108 +1,27 @@
# 项目长期记忆(tms-erp-web-ws / Saber3 客商模块 # 项目长期记忆(tms-erp-web-ws / Saber3
## 设计约定(已确认) 后端:`/Users/gxwebsoft/JAVA/tms-api``tms-erp-api-ws` 滞后,别看错仓库)。
### 表单 placeholder 统一为「请输入 / 请选择」(不带字段名) ## 列表 / 表单 / 详情三态同组件分流
- **规范**:输入框 placeholder 只写动作词 `请输入` / `请选择`,**后面不跟字段名称**(label 已说明是什么字段,重复无意义) `/xxx``/xxx/form``/xxx/detail` 指向同一 `.vue`form/detail 在 `src/router/views/index.js``component: Layout` + 空 `children.path` + `meta:{keepAlive:false}`detail 另带 `activeMenu`)。组件内按 `$route.path` 分流,必须 `watch:{$route}` 重新 init;标签标题取 `query.name`;独立页容器固定 `<div v-if>`,不用 `el-dialog`
- 已生效页面:waybill-manage、transport-plan、shipping-template、temporary-credit-limit(搜索栏 + 弹窗表单)、**driver.vue**2026-09-09 补齐 18 处)。
- **3 类例外必须保留,不要误简化**:
1. 复合操作:如 `请输入或选择车辆`(既可键盘输入又可点按钮弹窗选车),丢掉会损失语义。
2. 日期区间的 `起` / `止`:是起止标记,不是字段提示。
3. 默认值说明:如资格证号 `默认身份证号`、车牌号 `如:京A12345`,属于示例/默认值提示,非「请输入」格式。
- **校验错误提示 message 保持带字段名**(如「请选择准驾车型」「请输入档案编号」),与 placeholder 定位不同——报错必须指明具体哪个字段,不能只说「请选择」。
- Avue 配置化表单:在 option 各列加 `placeholder`;搜索栏可用通用工具 `withSearchPlaceholders([...])`(见 temporary-credit-limit.js)。
- 批量改法:Python 脚本按**完整 placeholder 字符串**做精确替换,每规则校验 `count > 0` 否则中断,避免误伤;改完用 `@vue/compiler-sfc` 的 parse + compileTemplate + compileScript 验证(脚本须放项目根目录下跑,放 /tmp 解析不到 node_modules)。
### 弹窗分组:统一用全局 `<section-card>` ## ⚠️ keep-alive 三坑
- 弹窗 body 背景由 `src/styles/element-ui.scss` 全局 `.el-dialog__body { background:#f5f6fa; padding:16px }` 统一灰底 背景(`router/tab.js` + `page/index/index.vue`):按 `fullPath` 建 wrapper`<keep-alive :include="tagsKeep">` 缓存,**每标签一实例、永不销毁**,deactivate 后**仍随全局 `$route` 重渲染**
- 每组 = 白底卡片:4px 主色竖条 + 8px 间距 + 圆角 6px + 淡阴影。组件全局注册 `<section-card title="...">`,支持 `#title` / `#extra` slot。
- 仅 3 项的小分组用 `el-col :span="8"` 均分一行。
### Avue 内置弹窗用 section-carddialogCustomClass 透明化 avue-form **坑一:独立页容器禁用 `<component :is>` 在 div / el-dialog 间切换。** `append-to-body` 走 Teleport`TeleportImpl.move` 忽略 `moveType`,不会把 DOM 搬回缓存容器 → 切菜单冒出旧弹窗。修法:固定 `<div v-if>` + `deactivated(){closeInnerDialogs()}` + `beforeUnmount()`(写在子组件也生效)。已修 loading-manage / project-apply / waybill-manage-page;未修 `settlement/components/{pre,formal}-settlement-editor.vue``transport-reconciliation-editor.vue``waybill-import-dialog.vue`
- option 顶层加 `dialogCustomClass:'xxx-dialog'`,再在 `element-ui.scss` 写三条:
1. `.xxx-dialog .avue-form { background:transparent; box-shadow:none; padding:0 }`
2. `.xxx-dialog .avue-form__group > .el-col > .el-form-item { margin-bottom:0 }`
3. `.xxx-dialog .avue-dialog__footer, .avue-crud__dialog .xxx-dialog .avue-dialog__footer { margin-top:0 !important }`
### 弹窗底部操作栏浮动(全局 CSS) **坑二:宿主 view 直绑全局 `$route.query.*` 给子组件 prop。** 缓存实例被灌入当前页 id → 拿错 id 查后端(批量弹「运单管理不存在」),live computed 还会误 push 标签。修法:`routePathLocked` 锁路径 + watcher / push 前判 `isOwnedRouteActive` + 宿主绑定加路径守卫。⚠️ `routePathLocked` **必须放 `data()`**Options API 顺序 data → computed → watch(immediate) → created;放 created 会读到空值、挡掉首次加载)。已修 waybill-manage-page / transport-plan-page + 三个宿主 view。
- `.el-dialog__body { max-height:calc(100vh - 200px); overflow-y:auto; overflow-x:hidden }`
- `.el-dialog__footer { margin:0; padding:12px 20px; background:#fff; border-top:1px solid #ebeef5; box-shadow:0 -2px 8px rgba(0,0,0,.04) }`
- Avue 内置弹窗 footer 真实 class 是 `.avue-dialog__footer`,须 `position:sticky; bottom:0; flex:none; background:#fff` 贴底。
### 上传证件区域尺寸(transportCapacity **坑三:路由表重复定义 → 内容区整页空白(2026-09-18)。** `/business/contract-manage/detail``router/views/index.js` 定义两次、子路由同名 `合同详情`。重名 `addRoute``removeRoute(name)` 移除旧子记录,但**不从父记录 children 里摘除**,第一条 Layout 壳记录留在 matcher 且靠前 → `resolve()` 命中它 → `$route.matched.length === 1` → 二级 router-view 无匹配 → 侧栏/标签正常但内容空白。修法:删重复定义。排查:扫「顶层 path + 首个子路由 name」重复项。
- 身份证/行驶证/道路运输证等固定 **240×151px**1.586:1)。
- scoped 覆盖 `.xxx-uploader--large { width:240px }``--large .el-upload { width:100%; height:151px }`
### 上传图片点击放大预览 ## 样式硬规则
- `src/components/image-upload-field/main.vue``<el-image preview-src-list fit="contain" preview-teleported :z-index="3000" @click.stop>`,阻止冒泡到 el-upload - 底栏 `flex; justify-content:flex-end`**不写 gap**(靠 EP 默认 `.el-button+.el-button{margin-left:12px}`);浮动底栏必须 `position:fixed`(祖先 overflow:hidden 使 sticky 失效)+ `:global(.avue--collapse .x){left:60px}``:global(.avue-layout--horizontal .x){left:0}``:global()` 要包整个选择器
- 按钮层级:次要=无 type;中间步骤=`primary plain`;主操作=`primary`(禁绿、禁两个蓝实心)。顺序 `[辅助][取消][保存草稿][提交]`
- 独立页标题 `.archive-page-form__title`;分组用全局 `<section-card>`;上传证件区 `width:100%; max-width:240px` + `.el-upload{height:151px}`
- ⚠️ `<style scoped lang="scss">` 顶层禁 `//` 注释(Vite5 + sass `Unexpected '/'` → 500),顶层用 `/* */`。其余见 `src/styles/element-ui.scss``AGENTS.md` 4.4。
### 独立表单页标题 `archive-page-form__title` ## 表单 / 自检 / 导出
- 样式全局化到 `src/styles/element-ui.scss`18px/600/#303133 + margin-bottom:20px + 4px 主色竖条 + 8px 间距 - placeholder 只写 `请输入`/`请选择`;例外:`请输入或选择车辆`、日期区间 `起`/`止`、示例值。校验 message 须带字段名
- business-crud-page 系列通过 `formPageTitle` prop 注入;loading-manage / master-order 手写前置标题 - `business-crud-page.vue`option 经 `cloneOption` 克隆,独立表单页走 `PageAvueForm`
- 自检:`curl "localhost:2889/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`)。
- `element-ui.scss` 全局兜底:`.el-table .el-table__body td.el-table__cell .cell > .el-input-number/.el-input/.el-select/.el-date-editor/.el-cascader { width:100% }`
### 业务状态标签文字化
- 全站"状态语义"的 `el-tag``class="status-text"`,转为普通文字,不带颜色/背景/边框/圆点。
- 实现:`element-ui.scss` 末尾 `.el-tag.status-text { ... }`
### 弹窗 / 独立表单页底栏按钮统一规则
- **排序**:从左到右按次→主排(次要居左、主操作居右),主操作永远放最后。
- 顺序模板:`[可选辅助工具(如同步/导入)][取消][保存草稿][提交/确认]`
- **容器布局(2026-08-27 改为「去 gap」)**`display:flex; justify-content:flex-end;`**不写 `gap`**)。按钮间距统一由 Element Plus 全局默认的相邻按钮 `.el-button+.el-button{margin-left:12px}` 提供,全站恒为 12px。原各 footer 写死的 `gap:8/12px` 已全部移除。`src/styles/element-ui.scss``.el-dialog__footer .el-button + .el-button` 也已从 `8px``12px`,与之一致。弹窗关闭按钮继承 Element Plus 自带 `.el-dialog__footer` 全局规则(见上条),独立页用 `.archive-form__footer``.archive-page-form & { position:fixed; right:0; left:230px; bottom:0; z-index:10; margin:0; padding:12px 24px; border-top:1px solid #eff1f7; background:#fff; box-shadow:0 -2px 8px rgba(0,0,0,.06); }`
- **⚠️ 浮动底部必须用 `position:fixed`,不能用 `position:sticky`**:本项目布局 `.app-main` / `.basic-container` 祖先带 `overflow:hidden`,会导致 `sticky` 永不触发(footer 不吸底)。固定写法照搬 customer-archive
```scss
.xxx-actions {
position: fixed; right: 0; left: 230px; bottom: 0; margin: 0; z-index: 10;
/* flex-end + padding + border-top + 白底 + 上投影 */
}
:global(.avue--collapse .xxx-actions) { left: 60px; } /* 侧栏折叠 */
:global(.avue-layout--horizontal .xxx-actions) { left: 0; } /* 横向布局 */
```
注意 `:global()` 要把「整个选择器」包进去(customer-archive 写法),不要只包前缀,否则 scoped 会在中间选择器上追加 data 属性导致不匹配。
- **颜色层级 3 档**
| 语义 | type | 备注 |
| --- | --- | --- |
| 次要(取消 / 关闭) | 不写 type(默认) | 灰描边 |
- **全站底部操作栏「返回」已统一改为「取消」**:独立表单页返回列表、弹窗关闭、主从编辑器返回等场景一律写「取消」;仅只读查看 / 纯关闭场景保留「关闭」。
| 中间步骤(保存草稿 / 按匹配结果更新) | `type="primary" plain` | 蓝描边 |
| 主操作(提交 / 完成对账 / 复评确认) | `type="primary"` | 蓝实心 |
- **禁区**
- 保存草稿和主操作不允许同为 `type="primary"`,否则两个蓝实心无视觉层级。
- 主操作禁止用 `type="success"`(绿)。全站统一深蓝实心。
- **生效页面(已按规则统一)**:
- `business/project-apply.vue`footer + 变更 footer
- `vehicle/customer-archive.vue` 全部 5 处 footer`archive-form__footer` 主表单页 + `contact-dialog`/`receipt-dialog`/`invoice-dialog` 子弹窗 + `score-detail-dialog` 含总分合计)
- `business/components/business-crud-page.vue` 的 PageAvueForm 独立表单页(`#menu-form-before` slot 新增 `取消` 按钮,shipping-template 模式验证通过;影响 `/business/waybill-manage/form`、`/business/transport-plan/form`、`/business/shipping-template/form` 三处独立表单页)
- `business/components/master-order-editor.vue` 主 `<footer>`(取消 default + 暂存/确认创建 plain + 创建并调度 primary`position:fixed` 浮动,含 `avue--collapse`/`avue-layout--horizontal` 左偏移)
- **payment 模块**表单页(`__actions` 均 `flex-end` + `position:fixed` 浮动,含 `avue--collapse`/`avue-layout--horizontal` 左偏移):
- `payment-application-form.vue``[取消][保存 plain][提交]`
- `invoice-application-form.vue` / `invoice-receipt-form.vue``[取消][同步 plain][保存 plain][提交]`
- `bill-ledger-form.vue``[取消][确认 primary]`
- `bill-payment-form.vue``[取消][保存 plain][提交]`
- `receipt-flow-form.vue``[取消][确认 primary]`
- `receipt-claim-record-form.vue`(单「关闭」按钮,居中→右对齐浮动)
- **settlement 模块**
- `settlement/components/pre-settlement-editor.vue`(弹窗 + pageMode 两处 footer:保存加 `plain``&__page-actions` 加 `position:fixed` 浮动,含 `avue--collapse`/`avue-layout--horizontal` 左偏移)
- `settlement/components/formal-settlement-editor.vue``.formal-editor__page-actions` 加 `position:fixed` 浮动,含 `avue--collapse`/`avue-layout--horizontal` 左偏移;按钮已 `[取消][提交]` 合规)
- `settlement/receivable-payable-detail.vue`(生成费用弹窗「上一步」改 `plain`
- **已合规未动**`settlement/components/transport-reconciliation-editor.vue``[取消][保存草稿 plain][按匹配结果更新账单 plain][完成对账 primary]`)、`settlement/components/settlement-adjustment-editor.vue`(弹窗 `[取消][保存 primary]`)、`business/temporary-credit-limit.vue`。
- **Avue-form footer 结构注意**`#menu-form-before` slot 内容在 Avue 内置按钮之**左**;`#menu-form` slot 在 Avue 内置按钮之**右**。要实现 `[次要][Avue 主操作]` 顺序,把次要按钮放进 `#menu-form-before`,主操作保留 Avue 内置即可。
- **Avue 表单 footer 按钮去图标(统一纯文字)**:Avue 的 `avue-form` 提交/清空按钮内置图标(`submitIcon: 'el-icon-check'`、`emptyIcon: 'el-icon-delete'`),且 Avue 源码用 `|| 'el-icon-xxx'` 兜底,无法通过 option 配置去掉。已在 `business-crud-page.vue` 样式里用 `:global(.business-crud-form-page-dialog .avue-form__menu .el-icon){display:none}` 统一隐藏,仅作用于独立表单页(PageAvueForm 容器),不影响其它弹窗。新增/编辑弹窗内的 Avue 表单若也要去图标,复用此选择器即可。
- **复杂 footer 例外**:当 footer 需要在按钮组左侧展示「总分合计 / 数量统计」等聚合信息时,块用 `flex:1` 推自己到最左,按钮组按上述规则排在右半边(参考 `score-detail-dialog`)。
## 关键文件
- `src/components/section-card/main.vue`
- `src/styles/element-ui.scss`
- `src/views/vehicle/customer-archive.vue`
- `src/views/transportCapacity/{driver,vehicle,ship}.vue`
- `src/views/business/project-apply.vue`
## 环境注意
- Vite 代理跨域:`axios.withCredentials=true`,改 `.env`/`vite.config.mjs` 须重启 dev。
## business-crud-page 复用模式
- option 由 prop `crudOption` 经 `cloneOption` 克隆。
- 独立表单页走 `PageAvueForm`,不包 el-dialog。
- 自定义详情弹窗:`config.detailButton=true` + `detailSections:[{title, fields}]`。
+2
View File
@@ -13,6 +13,8 @@
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" /> <meta name="format-detection" content="telephone=no" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<link rel="stylesheet" href="/iconfont/index.css" /> <link rel="stylesheet" href="/iconfont/index.css" />
<link rel="stylesheet" href="/iconfont/avue/iconfont.css" /> <link rel="stylesheet" href="/iconfont/avue/iconfont.css" />
<link rel="stylesheet" href="/iconfont/saber/iconfont.css" /> <link rel="stylesheet" href="/iconfont/saber/iconfont.css" />
+52
View File
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>oa登录</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
// 获取URL查询字符串
const queryString = window.location.search;
// 使用URLSearchParams解析查询字符串
const urlParams = new URLSearchParams(queryString);
// 获取特定的参数值
var userid = urlParams.get('userid'); // 用户id
var username = urlParams.get('username'); // 用户名
var redirectUrl = urlParams.get('redirectUrl'); // 重定向地址
if(userid==null){
userid="";
}
if(username==null){
username="";
}
$.get("/oaApi/getToken?userid="+userid+"&username="+username,function(result){
debugger
//成功返回token
if(result.data.token){
//设置系统的cookie
document.cookie = "X-AUTH-TOKEN="+result.data.token;
if(redirectUrl==null){
//如果是登录就跳转到系统首页
window.location.href = "./";
}else {
//如果是待办有重定向就跳转
window.location.href = redirectUrl;
}
}else {
alert("该业务系统未同步当前oa用户");
}
});
</script>
</head>
<body>
</body>
</html>
+9
View File
@@ -79,6 +79,15 @@ export const cancel = id =>
}, },
}); });
export const start = id =>
request({
url: `${baseUrl}/start`,
method: 'post',
params: {
id,
},
});
export const complete = id => export const complete = id =>
request({ request({
url: `${baseUrl}/complete`, url: `${baseUrl}/complete`,
+1
View File
@@ -16,6 +16,7 @@ export const submit = api.submit;
export const remove = api.remove; export const remove = api.remove;
// 项目资金使用风险统计(高风险 / 中风险数量),供列表头部快速筛选标签使用 // 项目资金使用风险统计(高风险 / 中风险数量),供列表头部快速筛选标签使用
// 暂未启用:后端 /fund-risk-stats 端点尚未实现,列表页已移除调用,等后端就绪后恢复
export const getFundRiskStats = params => export const getFundRiskStats = params =>
request({ request({
url: `${baseUrl}/fund-risk-stats`, url: `${baseUrl}/fund-risk-stats`,
+19
View File
@@ -33,6 +33,25 @@ export const getPunchRecords = waybillId =>
method: 'get', method: 'get',
params: { waybillId }, params: { waybillId },
}); });
/** 运单车辆实时定位 */
export const locateVehicle = id =>
request({
url: `${baseUrl}/locate`,
method: 'post',
params: { id },
timeout: 60000,
});
/** 运单车辆历史轨迹 */
export const trackVehicle = (id, startDate, endDate) =>
request({
url: `${baseUrl}/track`,
method: 'post',
params: { id, startDate, endDate },
timeout: 60000,
});
export const roadLoading = ids => export const roadLoading = ids =>
request({ request({
url: `${baseUrl}/road-loading`, url: `${baseUrl}/road-loading`,
+23
View File
@@ -0,0 +1,23 @@
import request from '@/axios';
export const getMkPublicDetail = (bizType, id) => {
return request({
url: `/blade-transport/mk-process/public/${bizType}/detail`,
method: 'get',
meta: {
isToken: false,
},
params: { id },
});
};
export const postMkPublicProcessMessage = (bizType, data) => {
return request({
url: `/blade-transport/mk-process/public/${bizType}/process-message`,
method: 'post',
meta: {
isToken: false,
},
data,
});
};
+1 -1
View File
@@ -24,7 +24,7 @@ export const syncKingdeeBatch = ids =>
export const paymentTypeOptions = [ export const paymentTypeOptions = [
{ label: '项目预付', value: 'project_advance' }, { label: '项目预付', value: 'project_advance' },
{ label: '进度预付', value: 'progress_advance' }, { label: '进度预付', value: 'progress_advance' },
{ label: '结算付款', value: 'settlement_payment' }, { label: '尾款付款', value: 'settlement_payment' },
]; ];
export const approvalStatusOptions = [ export const approvalStatusOptions = [
{ label: '草稿', value: 'draft' }, { label: '草稿', value: 'draft' },
+31
View File
@@ -0,0 +1,31 @@
import request from '@/axios';
/**
* 调用 MK processSubmit 提交审核流
* @param {Object} data
* @param {string} data.templateCode 模板编码
* @param {string} data.submitIdentity 提交人(手机号)
* @param {string} data.loginName 登录账号(手机号)
* @param {string} data.formInstanceId 业务表单实例 id
* @param {string} [data.subject] 流程标题
*/
export const processSubmit = data => {
return request({
url: '/blade-system/businessProcess/processSubmit',
method: 'post',
data,
});
};
/**
* 调用 MK processDelete 删除审核流(驳回后重新提交前使用)
* @param {Object} data
* @param {string} data.formInstanceId 业务表单实例 id
*/
export const processDelete = data => {
return request({
url: '/blade-system/businessProcess/processDelete',
method: 'post',
data,
});
};
+42
View File
@@ -41,6 +41,48 @@ export const add = row => {
}); });
}; };
export const syncIamOrganizations = () => {
return request({
url: '/blade-system/dept/sync-iam-organizations',
method: 'post',
});
};
export const clearNonTopDept = signal => {
return request({
url: '/blade-system/dept/clear-non-top',
method: 'post',
timeout: 60000,
signal,
});
};
export const syncOaCompany = (current = 1, size = 20, signal) => {
return request({
url: '/blade-system/dept/sync-oa-company',
method: 'post',
params: {
current,
size,
},
timeout: 60000,
signal,
});
};
export const syncOaDepartment = (current = 1, size = 20, signal) => {
return request({
url: '/blade-system/dept/sync-oa-department',
method: 'post',
params: {
current,
size,
},
timeout: 60000,
signal,
});
};
export const update = row => { export const update = row => {
return request({ return request({
url: '/blade-system/dept/submit', url: '/blade-system/dept/submit',
+13
View File
@@ -31,6 +31,19 @@ export const add = row => {
}); });
}; };
export const syncIamAccounts = (current = 1, size = 50, signal) => {
return request({
url: '/blade-system/user/sync-iam-accounts',
method: 'post',
params: {
current,
size,
},
timeout: 60000,
signal,
});
};
export const update = row => { export const update = row => {
return request({ return request({
url: '/blade-system/user/update', url: '/blade-system/user/update',
+39
View File
@@ -22,6 +22,19 @@ export const getDetail = id => {
}); });
}; };
export const getPublicDetail = id => {
return request({
url: '/blade-transport/customer-archive/public/detail',
method: 'get',
meta: {
isToken: false,
},
params: {
id,
},
});
};
export const getChangeRecordList = (customerId, current, size) => { export const getChangeRecordList = (customerId, current, size) => {
return request({ return request({
url: '/blade-transport/customer-archive/change-record/list', url: '/blade-transport/customer-archive/change-record/list',
@@ -34,6 +47,32 @@ export const getChangeRecordList = (customerId, current, size) => {
}); });
}; };
export const getPublicChangeRecordList = (customerId, current, size) => {
return request({
url: '/blade-transport/customer-archive/public/change-record/list',
method: 'get',
meta: {
isToken: false,
},
params: {
customerId,
current,
size,
},
});
};
export const postPublicProcessMessage = data => {
return request({
url: '/blade-transport/customer-archive/public/process-message',
method: 'post',
meta: {
isToken: false,
},
data,
});
};
export const submit = row => { export const submit = row => {
return request({ return request({
url: '/blade-transport/customer-archive/submit', url: '/blade-transport/customer-archive/submit',
+47 -5
View File
@@ -42,6 +42,14 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
longitude: {
type: [String, Number],
default: '',
},
latitude: {
type: [String, Number],
default: '',
},
}, },
emits: ['update:modelValue', 'confirm'], emits: ['update:modelValue', 'confirm'],
data() { data() {
@@ -66,9 +74,11 @@ export default {
this.visible = value; this.visible = value;
if (value) { if (value) {
this.keyword = this.address || ''; this.keyword = this.address || '';
this.selected = {};
this.status = '可搜索地址或点击地图选点';
this.searchResults = []; this.searchResults = [];
this.selected = this.buildInitialSelection();
this.status = this.selected.longitude
? this.selected.address || '已选点,可确认回填'
: '可搜索地址或点击地图选点';
} }
}, },
}, },
@@ -82,6 +92,18 @@ export default {
} }
}, },
methods: { methods: {
buildInitialSelection() {
const longitude = Number(this.longitude);
const latitude = Number(this.latitude);
if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
return {};
}
return {
longitude,
latitude,
address: this.address || '',
};
},
loadAmap() { loadAmap() {
if (window.AMap && window.AMap.Map) { if (window.AMap && window.AMap.Map) {
return Promise.resolve(); return Promise.resolve();
@@ -110,15 +132,27 @@ export default {
return new Promise(resolve => { return new Promise(resolve => {
this.$nextTick(() => { this.$nextTick(() => {
if (!this.$refs.map) return resolve(null); if (!this.$refs.map) return resolve(null);
const initial = this.buildInitialSelection();
const center =
Number.isFinite(initial.longitude) && Number.isFinite(initial.latitude)
? [initial.longitude, initial.latitude]
: [116.40769, 39.89945];
if (!this.amap) { if (!this.amap) {
this.amap = new window.AMap.Map(this.$refs.map, { this.amap = new window.AMap.Map(this.$refs.map, {
center: [116.40769, 39.89945], center,
zoom: 11, zoom: initial.longitude ? 14 : 11,
}); });
this.amap.on('click', event => this.pickPoint(event.lnglat)); this.amap.on('click', event => this.pickPoint(event.lnglat));
} else { } else {
this.amap.resize(); this.amap.resize();
this.clearMarker(); this.clearMarker();
this.amap.setZoomAndCenter(initial.longitude ? 14 : 11, center);
}
if (initial.longitude) {
const point = new window.AMap.LngLat(initial.longitude, initial.latitude);
this.renderMarker(point);
this.selected = { ...initial };
this.status = initial.address || '已选点,可确认回填';
} }
resolve(this.amap); resolve(this.amap);
}); });
@@ -254,11 +288,19 @@ export default {
} }
}, },
confirm() { confirm() {
if (!this.selected.longitude || !this.selected.latitude) {
this.$message.warning('请先搜索或点击地图完成选点');
return;
}
if (!this.selected.address) { if (!this.selected.address) {
this.$message.warning('请等待地址解析完成后再确认'); this.$message.warning('请等待地址解析完成后再确认');
return; return;
} }
this.$emit('confirm', this.selected.address); this.$emit('confirm', {
address: this.selected.address,
longitude: this.selected.longitude,
latitude: this.selected.latitude,
});
this.visible = false; this.visible = false;
}, },
}, },
@@ -0,0 +1,108 @@
<template>
<el-dialog
:model-value="modelValue"
title="变更记录详情"
append-to-body
destroy-on-close
align-center
width="1100px"
class="change-record-detail-dialog"
@update:model-value="$emit('update:modelValue', $event)"
@open="resetPage"
>
<el-table
:data="pageRows"
border
max-height="60vh"
:show-overflow-tooltip="false"
>
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="change-record-detail-value"
/>
</el-table>
<el-empty v-if="!total" description="暂无变更内容" :image-size="60" />
<div class="change-record-detail-dialog__pager">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
background
:total="total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
/>
</div>
<template #footer>
<el-button type="primary" @click="$emit('update:modelValue', false)">关闭</el-button>
</template>
</el-dialog>
</template>
<script>
export default {
name: 'ChangeRecordDetailDialog',
props: {
modelValue: {
type: Boolean,
default: false,
},
rows: {
type: Array,
default: () => [],
},
},
emits: ['update:modelValue'],
data() {
return {
currentPage: 1,
pageSize: 10,
};
},
computed: {
total() {
return this.rows.length;
},
pageRows() {
const start = (this.currentPage - 1) * this.pageSize;
return this.rows.slice(start, start + this.pageSize);
},
},
watch: {
rows() {
const maxPage = Math.max(1, Math.ceil(this.total / this.pageSize) || 1);
if (this.currentPage > maxPage) this.currentPage = 1;
},
},
methods: {
resetPage() {
this.currentPage = 1;
this.pageSize = 10;
},
},
};
</script>
<style lang="scss" scoped>
.change-record-detail-dialog__pager {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
:deep(.change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-word;
overflow: visible;
text-overflow: clip;
line-height: 1.6;
}
</style>
+1
View File
@@ -1,6 +1,7 @@
FROM nginx FROM nginx
VOLUME /tmp VOLUME /tmp
ENV LANG en_US.UTF-8 ENV LANG en_US.UTF-8
ADD ./src/docker/nginx.conf /etc/nginx/conf.d/default.conf
ADD ./dist/ /usr/share/nginx/html/ ADD ./dist/ /usr/share/nginx/html/
EXPOSE 80 EXPOSE 80
EXPOSE 443 EXPOSE 443
+19
View File
@@ -0,0 +1,19 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
location /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
location / {
add_header Cache-Control "no-store, no-cache, must-revalidate";
try_files $uri $uri/ /index.html;
}
}
+4
View File
@@ -1,8 +1,12 @@
import store from './store'; import store from './store';
import { isChunkLoadError, reloadForChunkError } from './utils/chunk-reload';
export default { export default {
install: app => { install: app => {
app.config.errorHandler = (err, vm, info) => { app.config.errorHandler = (err, vm, info) => {
if (isChunkLoadError(err) && reloadForChunkError()) {
return;
}
store.commit('ADD_LOGS', { store.commit('ADD_LOGS', {
type: 'error', type: 'error',
message: err.message, message: err.message,
+2
View File
@@ -1,4 +1,5 @@
import { createApp } from 'vue'; import { createApp } from 'vue';
import { installChunkReload } from './utils/chunk-reload';
import website from './config/website'; import website from './config/website';
import axios from './axios'; import axios from './axios';
import router from './router/'; import router from './router/';
@@ -46,6 +47,7 @@ import sectionCard from './components/section-card/main.vue';
import mapSearchResults from './components/map-search-results/main.vue'; import mapSearchResults from './components/map-search-results/main.vue';
window.$crudCommon = crudCommon; window.$crudCommon = crudCommon;
installChunkReload();
debug(); debug();
window.axios = axios; window.axios = axios;
const app = createApp(App); const app = createApp(App);
+15
View File
@@ -38,6 +38,21 @@ export const createOption = () => ({
menuWidth: 240, menuWidth: 240,
menuFixed: 'right', menuFixed: 'right',
column: [ column: [
{
label: '计量单位编码',
prop: 'unitCode',
minWidth: 150,
span: 24,
search: true,
searchOrder: 4,
searchSpan: 6,
maxlength: 50,
showWordLimit: true,
rules: [
{ required: true, message: '请输入计量单位编码', trigger: 'blur' },
{ max: 50, message: '计量单位编码不能超过50个字', trigger: 'blur' },
],
},
{ {
label: '计量单位', label: '计量单位',
prop: 'unitName', prop: 'unitName',
+18 -16
View File
@@ -55,8 +55,8 @@ export const config = {
'templateType', 'templateType',
'transportType', 'transportType',
'createUserName', 'createUserName',
'remark',
'updateTime', 'updateTime',
'remark',
'createTime', 'createTime',
], ],
exportColumns: [ exportColumns: [
@@ -65,8 +65,8 @@ export const config = {
{ prop: 'templateType', label: '模板类型' }, { prop: 'templateType', label: '模板类型' },
{ prop: 'transportType', label: '运输方式' }, { prop: 'transportType', label: '运输方式' },
{ prop: 'createUserName', label: '创建人' }, { prop: 'createUserName', label: '创建人' },
{ prop: 'remark', label: '备注' },
{ prop: 'updateTime', label: '更新时间' }, { prop: 'updateTime', label: '更新时间' },
{ prop: 'remark', label: '备注' },
{ prop: 'createTime', label: '创建时间' }, { prop: 'createTime', label: '创建时间' },
], ],
enableAllDept: false, enableAllDept: false,
@@ -82,12 +82,14 @@ export const config = {
detailAttachmentDescriptionPlain: true, detailAttachmentDescriptionPlain: true,
enableTransportPlanForm: true, enableTransportPlanForm: true,
enableShippingTemplateFreight: true, enableShippingTemplateFreight: true,
editableRoadAddress: true, editableRoadAddress: false,
fixedTransportAddressType: true, fixedTransportAddressType: true,
enableTemplateCodePreview: true, enableTemplateCodePreview: true,
attachmentTitle: '附件', attachmentTitle: '附件',
defaultForm: { defaultForm: {
templateType: '运输计划', templateType: '运输计划',
transportType: '公路运输',
transportTypeName: '公路运输',
}, },
transportFormRequiredFields: [ transportFormRequiredFields: [
['projectName', '项目'], ['projectName', '项目'],
@@ -119,15 +121,16 @@ export const option = {
labelWidth: 0, labelWidth: 0,
}, },
{ {
label: '模板编号', label: '模板类型',
prop: 'templateCode', prop: 'templateType',
type: 'select',
search: true, search: true,
searchOrder: 4, searchOrder: 2,
span: 8, span: 8,
order: 390, order: 390,
minWidth: 170, dicData: templateTypeOptions,
disabled: true, minWidth: 120,
placeholder: '系统自动生成', rules: selectRule('模板类型'),
display: true, display: true,
}, },
{ {
@@ -142,16 +145,15 @@ export const option = {
display: true, display: true,
}, },
{ {
label: '模板类型', label: '模板编号',
prop: 'templateType', prop: 'templateCode',
type: 'select',
search: true, search: true,
searchOrder: 2, searchOrder: 4,
span: 8, span: 8,
order: 370, order: 370,
dicData: templateTypeOptions, minWidth: 170,
minWidth: 120, disabled: true,
rules: selectRule('模板类型'), placeholder: '系统自动生成',
display: true, display: true,
}, },
{ {
@@ -334,7 +334,7 @@ export const option = {
}, },
...auditColumns.map(column => ({ ...column, hide: true })), ...auditColumns.map(column => ({ ...column, hide: true })),
])), ])),
dialogWidth: '96%', dialogWidth: '1100px',
menuFixed: 'right', menuFixed: 'right',
menuWidth: 320, menuWidth: 320,
index: false, index: false,
+6 -4
View File
@@ -209,12 +209,12 @@ export const config = {
attachmentTitle: '附件', attachmentTitle: '附件',
searchRangeMap: { searchRangeMap: {
planStartDateRange: ['planStartDateStart', 'planStartDateEnd'], planStartDateRange: ['planStartDateStart', 'planStartDateEnd'],
planEndDateRange: ['planEndDateStart', 'planEndDateEnd'], createTimeRange: ['createTimeStart', 'createTimeEnd', '00:00:00', '23:59:59'],
}, },
actions: ['copy', 'complete'], actions: ['copy', 'complete'],
statusProp: 'businessStatus', statusProp: 'businessStatus',
statusTextProp: 'businessStatusName', statusTextProp: 'businessStatusName',
deleteStatus: ['draft', 'waiting_dispatch'], deleteStatus: ['draft'],
editStatus: ['draft', 'waiting_dispatch', 'dispatching'], editStatus: ['draft', 'waiting_dispatch', 'dispatching'],
detailButton: true, detailButton: true,
detailSections: [ detailSections: [
@@ -341,6 +341,7 @@ export const option = {
{ {
label: '发货地址', label: '发货地址',
prop: 'departureAddress', prop: 'departureAddress',
slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchOrder: 7, searchOrder: 7,
@@ -352,6 +353,7 @@ export const option = {
{ {
label: '到货地址', label: '到货地址',
prop: 'arrivalAddress', prop: 'arrivalAddress',
slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchOrder: 6, searchOrder: 6,
@@ -577,8 +579,8 @@ export const option = {
viewDisplay: false, viewDisplay: false,
}, },
{ {
label: '计划结束日期', label: '创建时间',
prop: 'planEndDateRange', prop: 'createTimeRange',
type: 'date', type: 'date',
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
+3 -2
View File
@@ -5,6 +5,7 @@ export const GRANT_TYPE_DIC = [
{ label: '社交登录', value: 'social' }, { label: '社交登录', value: 'social' },
{ label: '客户端凭证', value: 'client_credentials' }, { label: '客户端凭证', value: 'client_credentials' },
{ label: '刷新令牌', value: 'refresh_token' }, { label: '刷新令牌', value: 'refresh_token' },
{ label: '退出登录', value: 'logout' },
]; ];
export const authLogOption = { export const authLogOption = {
@@ -38,7 +39,7 @@ export const authLogOption = {
prop: 'realName', prop: 'realName',
}, },
{ {
label: '授权类型', label: '操作类型',
prop: 'grantType', prop: 'grantType',
type: 'select', type: 'select',
search: true, search: true,
@@ -80,7 +81,7 @@ export const authLogOption = {
width: 120, width: 120,
}, },
{ {
label: '登录时间', label: '操作时间',
prop: 'loginTime', prop: 'loginTime',
sortable: true, sortable: true,
span: 24, span: 24,
+2 -5
View File
@@ -1,12 +1,9 @@
import { getDeptLazyTree } from '@/api/system/dept'; import { getDeptLazyTree } from '@/api/system/dept';
import { validateLoginPassword } from '@/utils/validate';
export const userOption = safe => { export const userOption = safe => {
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
if (value === '') { validateLoginPassword(rule, value, callback);
callback(new Error('请输入密码'));
} else {
callback();
}
}; };
const validatePass2 = (rule, value, callback) => { const validatePass2 = (rule, value, callback) => {
if (value === '') { if (value === '') {
+12 -1
View File
@@ -1,7 +1,18 @@
<template> <template>
<router-view #="{ Component }"> <router-view #="{ Component }">
<keep-alive :include="$store.getters.tagsKeep"> <keep-alive :include="$store.getters.tagsKeep">
<component :is="Component" /> <component :is="tabView($route, Component)" />
</keep-alive> </keep-alive>
</router-view> </router-view>
</template> </template>
<script>
import { tabView } from '@/router/tab';
export default {
name: 'layout',
methods: {
tabView,
},
};
</script>
+3 -1
View File
@@ -24,6 +24,7 @@
--> -->
<userLogin v-if="activeName === 'user'"></userLogin> <userLogin v-if="activeName === 'user'"></userLogin>
<registerLogin v-else-if="activeName === 'register'"></registerLogin> <registerLogin v-else-if="activeName === 'register'"></registerLogin>
<!-- 暂时默认账号密码登录IAM 选择入口先隐藏
<div v-else class="iam-login"> <div v-else class="iam-login">
<el-button type="primary" class="login-submit" @click.prevent="handleIamLogin"> <el-button type="primary" class="login-submit" @click.prevent="handleIamLogin">
IAM统一身份认证 IAM统一身份认证
@@ -32,6 +33,7 @@
账号密码登录 账号密码登录
</el-button> </el-button>
</div> </div>
-->
</div> </div>
</div> </div>
</div> </div>
@@ -61,7 +63,7 @@ export default {
return { return {
website: website, website: website,
time: '', time: '',
activeName: 'iam', activeName: 'user',
socialForm: { socialForm: {
tenantId: '000000', tenantId: '000000',
source: '', source: '',
+13 -10
View File
@@ -3,6 +3,8 @@ import store from './store';
import { tabKeyOf } from '@/router/tab'; import { tabKeyOf } from '@/router/tab';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { import {
consumeReloadQuery,
hasReloadQuery,
isChunkLoadError, isChunkLoadError,
reloadForChunkError, reloadForChunkError,
setPendingRoutePath, setPendingRoutePath,
@@ -17,19 +19,20 @@ const lockPage = '/lock'; //锁屏页
router.onError(error => { router.onError(error => {
if (!isChunkLoadError(error)) return; if (!isChunkLoadError(error)) return;
if (reloadForChunkError()) { if (reloadForChunkError()) {
ElMessage.warning('页面资源加载失败,正在重新加载…'); ElMessage.warning('页面资源已更新,正在重新加载…');
}
});
window.addEventListener('unhandledrejection', event => {
if (!isChunkLoadError(event.reason)) return;
if (reloadForChunkError()) {
event.preventDefault();
ElMessage.warning('页面资源加载失败,正在重新加载…');
} }
}); });
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (hasReloadQuery(to.query)) {
next({
path: to.path,
query: consumeReloadQuery(to.query),
hash: to.hash,
replace: true,
});
return;
}
setPendingRoutePath(to.fullPath); setPendingRoutePath(to.fullPath);
const meta = to.meta || {}; const meta = to.meta || {};
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu; const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
@@ -59,7 +62,7 @@ router.beforeEach((to, from, next) => {
fullPath: tabKeyOf(to), fullPath: tabKeyOf(to),
params: to.params, params: to.params,
query: to.query, query: to.query,
meta: meta, meta: { ...meta, keepAlive: true },
}); });
} }
next(); next();
+15 -10
View File
@@ -2,6 +2,9 @@ import website from '@/config/website';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import store from '@/store'; import store from '@/store';
import { generateIframePath, processUrlForQuery, isURL } from './router'; import { generateIframePath, processUrlForQuery, isURL } from './router';
import { wrapViewLoader } from '@/utils/chunk-reload';
// 保持懒加载,避免 eager 与 store 循环依赖(Cannot access 'store' before initialization
const modules = import.meta.glob('../**/**/*.vue'); const modules = import.meta.glob('../**/**/*.vue');
// 将多级路由扁平化为二级路由,支持 keep-alive 跨层级缓存 // 将多级路由扁平化为二级路由,支持 keep-alive 跨层级缓存
@@ -96,21 +99,23 @@ RouterPlugin.install = function (option = {}) {
component: (() => { component: (() => {
// 判断是否为首路由 // 判断是否为首路由
if (first) { if (first) {
return modules[ return wrapViewLoader(
option.store.getters.isMacOs || !website.setting.menu modules[
? '../page/index/layout.vue' option.store.getters.isMacOs || !website.setting.menu
: '../page/index/index.vue' ? '../page/index/layout.vue'
]; : '../page/index/index.vue'
]
);
// 判断是否为多层路由 // 判断是否为多层路由
} else if (isChild && !first) { } else if (isChild && !first) {
return modules['../page/index/layout.vue']; return wrapViewLoader(modules['../page/index/layout.vue']);
// 判断是否为最终的页面视图 // 判断是否为最终的页面视图
} else { } else {
let result = modules[`../${component}.vue`]; let result = modules[`../${component}.vue`];
if (!result) { if (!result) {
isComponent = false; isComponent = false;
} }
return result; return wrapViewLoader(result);
} }
})(), })(),
name, name,
@@ -127,7 +132,7 @@ RouterPlugin.install = function (option = {}) {
if (first) { if (first) {
oMenu[propsDefault.path] = `${path}`; oMenu[propsDefault.path] = `${path}`;
let componentPath = oMenu.component || component; let componentPath = oMenu.component || component;
let result = modules[`../${componentPath}.vue`]; let result = wrapViewLoader(modules[`../${componentPath}.vue`]);
if (!result) { if (!result) {
isComponent = false; isComponent = false;
} }
@@ -173,7 +178,7 @@ export const formatPath = (ele, first) => {
const icon = ele[propsDefault.icon]; const icon = ele[propsDefault.icon];
ele[propsDefault.icon] = icon || ''; ele[propsDefault.icon] = icon || '';
ele.meta = { ele.meta = {
keepAlive: ele.isOpen === 2, keepAlive: true,
}; };
const iframeComponent = 'components/iframe/main'; const iframeComponent = 'components/iframe/main';
const iframeSrc = href => { const iframeSrc = href => {
@@ -215,7 +220,7 @@ export const formatPath = (ele, first) => {
ele[propsDefault.children].forEach(child => { ele[propsDefault.children].forEach(child => {
child.component = 'views' + child[propsDefault.path]; child.component = 'views' + child[propsDefault.path];
child.meta = { child.meta = {
keepAlive: child.isOpen === 2, keepAlive: true,
}; };
if (isURL(child[propsDefault.href])) { if (isURL(child[propsDefault.href])) {
let href = child[propsDefault.href]; let href = child[propsDefault.href];
+76
View File
@@ -74,6 +74,82 @@ export default [
isAuth: false, isAuth: false,
}, },
}, },
{
path: '/vehicle/customer-archive/public-view',
name: '查看客商信息',
component: () => import('@/views/vehicle/customer-archive-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
},
},
{
path: '/business/project-apply/public-view',
name: '查看项目信息',
component: () => import('@/views/business/project-apply-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'project-apply',
},
},
{
path: '/business/contract-manage/public-view',
name: '查看合同信息',
component: () => import('@/views/business/contract-manage-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'contract-manage',
},
},
{
path: '/business/waybill-manage/public-view',
name: '查看运单信息',
component: () => import('@/views/business/waybill-manage-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'waybill-manage',
},
},
{
path: '/settlement/pre-settlement/public-view',
name: '查看预结算信息',
component: () => import('@/views/settlement/pre-settlement-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'pre-settlement',
},
},
{
path: '/settlement/formal-settlement/public-view',
name: '查看正式结算信息',
component: () => import('@/views/settlement/formal-settlement-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'formal-settlement',
},
},
{
path: '/payment/payment-application/public-view',
name: '查看付款申请信息',
component: () => import('@/views/payment/payment-application-public-view.vue'),
meta: {
keepAlive: false,
isTab: false,
isAuth: false,
bizType: 'payment-application',
},
},
{ {
path: '/', path: '/',
name: '主页', name: '主页',
+1 -1
View File
@@ -128,5 +128,5 @@ export function tabView(route, Component) {
}; };
wrapperMap.set(tabKey, wrapper); wrapperMap.set(tabKey, wrapper);
} }
return h(wrapper); return wrapper;
} }
+58 -38
View File
@@ -1,5 +1,8 @@
import Layout from '@/page/index/index.vue'; import Layout from '@/page/index/index.vue';
import Store from '@/store/'; import Store from '@/store/';
import { wrapViewLoader } from '@/utils/chunk-reload';
const loadView = loader => wrapViewLoader(loader);
export default [ export default [
{ {
@@ -10,7 +13,7 @@ export default [
path: '', path: '',
name: '汇票付款表单', name: '汇票付款表单',
meta: { keepAlive: false, activeMenu: '/payment/bill-payment' }, meta: { keepAlive: false, activeMenu: '/payment/bill-payment' },
component: () => import('@/views/payment/bill-payment-form.vue'), component: loadView(() => import('@/views/payment/bill-payment-form.vue')),
}, },
], ],
}, },
@@ -22,7 +25,7 @@ export default [
path: '', path: '',
name: '汇票台账表单', name: '汇票台账表单',
meta: { keepAlive: false, activeMenu: '/payment/bill-ledger' }, meta: { keepAlive: false, activeMenu: '/payment/bill-ledger' },
component: () => import('@/views/payment/bill-ledger-form.vue'), component: loadView(() => import('@/views/payment/bill-ledger-form.vue')),
}, },
], ],
}, },
@@ -34,7 +37,7 @@ export default [
path: '', path: '',
name: '认领记录详情', name: '认领记录详情',
meta: { keepAlive: false, activeMenu: '/payment/receipt-claim-record' }, meta: { keepAlive: false, activeMenu: '/payment/receipt-claim-record' },
component: () => import('@/views/payment/receipt-claim-record-form.vue'), component: loadView(() => import('@/views/payment/receipt-claim-record-form.vue')),
}, },
], ],
}, },
@@ -46,7 +49,7 @@ export default [
path: '', path: '',
name: '收款流水认领', name: '收款流水认领',
meta: { keepAlive: false, activeMenu: '/payment/receipt-flow' }, meta: { keepAlive: false, activeMenu: '/payment/receipt-flow' },
component: () => import('@/views/payment/receipt-flow-form.vue'), component: loadView(() => import('@/views/payment/receipt-flow-form.vue')),
}, },
], ],
}, },
@@ -58,7 +61,7 @@ export default [
path: '', path: '',
name: '收票登记', name: '收票登记',
meta: { keepAlive: false, activeMenu: '/payment/invoice-receipt' }, meta: { keepAlive: false, activeMenu: '/payment/invoice-receipt' },
component: () => import('@/views/payment/invoice-receipt-form.vue'), component: loadView(() => import('@/views/payment/invoice-receipt-form.vue')),
}, },
], ],
}, },
@@ -70,7 +73,7 @@ export default [
path: '', path: '',
name: '开票申请', name: '开票申请',
meta: { keepAlive: false, activeMenu: '/payment/invoice-application' }, meta: { keepAlive: false, activeMenu: '/payment/invoice-application' },
component: () => import('@/views/payment/invoice-application-form.vue'), component: loadView(() => import('@/views/payment/invoice-application-form.vue')),
}, },
], ],
}, },
@@ -82,7 +85,7 @@ export default [
path: '', path: '',
name: '付款申请', name: '付款申请',
meta: { keepAlive: false, activeMenu: '/payment/payment-application' }, meta: { keepAlive: false, activeMenu: '/payment/payment-application' },
component: () => import('@/views/payment/payment-application-form.vue'), component: loadView(() => import('@/views/payment/payment-application-form.vue')),
}, },
], ],
}, },
@@ -97,7 +100,7 @@ export default [
keepAlive: false, keepAlive: false,
activeMenu: '/settlement/pre-settlement', activeMenu: '/settlement/pre-settlement',
}, },
component: () => import('@/views/settlement/pre-settlement-form.vue'), component: loadView(() => import('@/views/settlement/pre-settlement-form.vue')),
}, },
], ],
}, },
@@ -112,7 +115,7 @@ export default [
keepAlive: false, keepAlive: false,
activeMenu: '/settlement/formal-settlement', activeMenu: '/settlement/formal-settlement',
}, },
component: () => import('@/views/settlement/formal-settlement-form.vue'), component: loadView(() => import('@/views/settlement/formal-settlement-form.vue')),
}, },
], ],
}, },
@@ -127,7 +130,7 @@ export default [
keepAlive: false, keepAlive: false,
activeMenu: '/settlement/transport-reconciliation', activeMenu: '/settlement/transport-reconciliation',
}, },
component: () => import('@/views/settlement/transport-reconciliation-form.vue'), component: loadView(() => import('@/views/settlement/transport-reconciliation-form.vue')),
}, },
], ],
}, },
@@ -139,7 +142,7 @@ export default [
path: '', path: '',
name: '执行凭证批次详情', name: '执行凭证批次详情',
meta: { keepAlive: false, activeMenu: '/business/voucher-manage' }, meta: { keepAlive: false, activeMenu: '/business/voucher-manage' },
component: () => import('@/views/business/voucher-manage-detail.vue'), component: loadView(() => import('@/views/business/voucher-manage-detail.vue')),
}, },
], ],
}, },
@@ -151,7 +154,7 @@ export default [
path: '', path: '',
name: '新增合同管理', name: '新增合同管理',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/business/contract-manage.vue'), component: loadView(() => import('@/views/business/contract-manage.vue')),
}, },
], ],
}, },
@@ -163,7 +166,7 @@ export default [
path: '', path: '',
name: '合同详情', name: '合同详情',
meta: { keepAlive: false, activeMenu: '/business/contract-manage' }, meta: { keepAlive: false, activeMenu: '/business/contract-manage' },
component: () => import('@/views/business/contract-manage.vue'), component: loadView(() => import('@/views/business/contract-manage.vue')),
}, },
], ],
}, },
@@ -175,7 +178,7 @@ export default [
path: '', path: '',
name: '新增项目申请', name: '新增项目申请',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/business/project-apply.vue'), component: loadView(() => import('@/views/business/project-apply.vue')),
}, },
], ],
}, },
@@ -187,7 +190,7 @@ export default [
path: '', path: '',
name: '新增编辑运单管理', name: '新增编辑运单管理',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/business/waybill-manage.vue'), component: loadView(() => import('@/views/business/waybill-manage.vue')),
}, },
], ],
}, },
@@ -199,7 +202,7 @@ export default [
path: '', path: '',
name: '运单管理详情', name: '运单管理详情',
meta: { keepAlive: false, activeMenu: '/business/waybill-manage' }, meta: { keepAlive: false, activeMenu: '/business/waybill-manage' },
component: () => import('@/views/business/waybill-manage-detail.vue'), component: loadView(() => import('@/views/business/waybill-manage-detail.vue')),
}, },
], ],
}, },
@@ -211,7 +214,7 @@ export default [
path: '', path: '',
name: '导入运单', name: '导入运单',
meta: { keepAlive: false, activeMenu: '/business/waybill-import' }, meta: { keepAlive: false, activeMenu: '/business/waybill-import' },
component: () => import('@/views/business/waybill-import.vue'), component: loadView(() => import('@/views/business/waybill-import.vue')),
}, },
], ],
}, },
@@ -223,7 +226,7 @@ export default [
path: '', path: '',
name: '新建导入运单', name: '新建导入运单',
meta: { keepAlive: false, activeMenu: '/business/waybill-import' }, meta: { keepAlive: false, activeMenu: '/business/waybill-import' },
component: () => import('@/views/business/waybill-import-form.vue'), component: loadView(() => import('@/views/business/waybill-import-form.vue')),
}, },
], ],
}, },
@@ -235,6 +238,18 @@ export default [
path: '', path: '',
name: '新增编辑配载管理', name: '新增编辑配载管理',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: loadView(() => import('@/views/business/loading-manage.vue')),
},
],
},
{
path: '/business/loading-manage/detail',
component: Layout,
children: [
{
path: '',
name: '配载单详情',
meta: { keepAlive: false, activeMenu: '/business/loading-manage' },
component: () => import('@/views/business/loading-manage.vue'), component: () => import('@/views/business/loading-manage.vue'),
}, },
], ],
@@ -247,7 +262,7 @@ export default [
path: '', path: '',
name: '新增编辑运输计划', name: '新增编辑运输计划',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/business/transport-plan.vue'), component: loadView(() => import('@/views/business/transport-plan.vue')),
}, },
], ],
}, },
@@ -259,7 +274,7 @@ export default [
path: '', path: '',
name: '导入运输计划', name: '导入运输计划',
meta: { keepAlive: false, activeMenu: '/business/transport-plan' }, meta: { keepAlive: false, activeMenu: '/business/transport-plan' },
component: () => import('@/views/business/transport-plan-import.vue'), component: loadView(() => import('@/views/business/transport-plan-import.vue')),
}, },
], ],
}, },
@@ -271,7 +286,7 @@ export default [
path: '', path: '',
name: '计划调度', name: '计划调度',
meta: { keepAlive: false, activeMenu: '/business/transport-plan' }, meta: { keepAlive: false, activeMenu: '/business/transport-plan' },
component: () => import('@/views/business/transport-plan-dispatch.vue'), component: loadView(() => import('@/views/business/transport-plan-dispatch.vue')),
}, },
], ],
}, },
@@ -283,7 +298,7 @@ export default [
path: '', path: '',
name: '新增编辑运单模板', name: '新增编辑运单模板',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/business/shipping-template.vue'), component: loadView(() => import('@/views/business/shipping-template.vue')),
}, },
], ],
}, },
@@ -295,7 +310,7 @@ export default [
path: '', path: '',
name: '新增客商档案', name: '新增客商档案',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/vehicle/customer-archive.vue'), component: loadView(() => import('@/views/vehicle/customer-archive.vue')),
}, },
], ],
}, },
@@ -307,7 +322,7 @@ export default [
path: '', path: '',
name: '合同变更', name: '合同变更',
meta: { keepAlive: false }, meta: { keepAlive: false },
component: () => import('@/views/business/contract-manage-change.vue'), component: loadView(() => import('@/views/business/contract-manage-change.vue')),
}, },
], ],
}, },
@@ -323,7 +338,7 @@ export default [
meta: { meta: {
i18n: 'dashboard', i18n: 'dashboard',
}, },
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/index.vue'), component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/wel/index.vue')),
}, },
{ {
path: 'dashboard', path: 'dashboard',
@@ -332,7 +347,7 @@ export default [
i18n: 'dashboard', i18n: 'dashboard',
menu: false, menu: false,
}, },
component: () => import(/* webpackChunkName: "views" */ '@/views/wel/dashboard.vue'), component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/wel/dashboard.vue')),
}, },
], ],
}, },
@@ -347,7 +362,7 @@ export default [
meta: { meta: {
i18n: 'test', i18n: 'test',
}, },
component: () => import(/* webpackChunkName: "views" */ '@/views/util/test.vue'), component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/util/test.vue')),
}, },
], ],
}, },
@@ -362,8 +377,9 @@ export default [
meta: { meta: {
i18n: 'dict', i18n: 'dict',
}, },
component: () => component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal.vue'), import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal.vue')
),
}, },
], ],
}, },
@@ -378,8 +394,9 @@ export default [
meta: { meta: {
i18n: 'dict', i18n: 'dict',
}, },
component: () => component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical.vue'), import(/* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical.vue')
),
}, },
], ],
}, },
@@ -394,7 +411,7 @@ export default [
meta: { meta: {
i18n: 'info', i18n: 'info',
}, },
component: () => import(/* webpackChunkName: "views" */ '@/views/system/userinfo.vue'), component: loadView(() => import(/* webpackChunkName: "views" */ '@/views/system/userinfo.vue')),
}, },
], ],
}, },
@@ -409,8 +426,9 @@ export default [
meta: { meta: {
i18n: 'work', i18n: 'work',
}, },
component: () => component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/form.vue'), import(/* webpackChunkName: "views" */ '@/views/work/process/leave/form.vue')
),
}, },
{ {
path: 'handle/:taskId/:processInstanceId/:businessId', path: 'handle/:taskId/:processInstanceId/:businessId',
@@ -418,8 +436,9 @@ export default [
meta: { meta: {
i18n: 'work', i18n: 'work',
}, },
component: () => component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/handle.vue'), import(/* webpackChunkName: "views" */ '@/views/work/process/leave/handle.vue')
),
}, },
{ {
path: 'detail/:processInstanceId/:businessId', path: 'detail/:processInstanceId/:businessId',
@@ -427,8 +446,9 @@ export default [
meta: { meta: {
i18n: 'work', i18n: 'work',
}, },
component: () => component: loadView(() =>
import(/* webpackChunkName: "views" */ '@/views/work/process/leave/detail.vue'), import(/* webpackChunkName: "views" */ '@/views/work/process/leave/detail.vue')
),
}, },
], ],
}, },
+2 -5
View File
@@ -16,11 +16,8 @@ const getters = {
lockPasswd: state => state.common.lockPasswd, lockPasswd: state => state.common.lockPasswd,
tagList: state => state.tags.tagList, tagList: state => state.tags.tagList,
tagsKeep: (state, getters) => { tagsKeep: (state, getters) => {
return getters.tagList // 所有已打开标签均纳入 keep-alive,关闭标签后自动从白名单移除并释放实例
.filter(ele => { return getters.tagList.map(ele => ele.fullPath).filter(Boolean);
return (ele.meta || {}).keepAlive;
})
.map(ele => ele.fullPath);
}, },
tagWel: state => state.tags.tagWel, tagWel: state => state.tags.tagWel,
token: state => state.user.token, token: state => state.user.token,
+137 -7
View File
@@ -1,38 +1,168 @@
/** /**
* 懒加载 chunk / CSS preload 失败后的整页恢复。 * 懒加载 chunk / CSS preload 失败后的整页恢复。
* 常见于:部署后旧 hash 失效、静态服务空闲断连、代理 CONNECTION_RESET。 * 常见于:部署后旧 hash 失效、静态服务空闲断连、代理 CONNECTION_RESET。
*
* 失败后必须整页刷新:旧入口里的 hashed 资源地址不会自行更新,
* 仅捕获路由错误而不刷新时,未打开过的页面会一直无法进入。
*/ */
const RELOAD_FLAG = 'app:chunk-reload-ts'; const RELOAD_FLAG = 'app:chunk-reload-ts';
const RELOAD_COOLDOWN_MS = 10000; const RELOAD_QUERY = '_chunkreload';
const RELOAD_COOLDOWN_MS = 15000;
const CHUNK_ERROR_RE = const CHUNK_ERROR_RE =
/Failed to fetch dynamically imported module|Importing a module script failed|Unable to preload CSS|error loading dynamically imported module|Loading CSS chunk|Loading chunk .+ failed|ChunkLoadError/i; /Failed to fetch dynamically imported module|Importing a module script failed|Unable to preload CSS|error loading dynamically imported module|Loading CSS chunk|Loading chunk .+ failed|ChunkLoadError|Unable to preload|error loading module|Load failed/i;
/** 最近一次路由跳转目标,供 onError 时整页落到正确地址 */ /** 最近一次路由跳转目标,供 onError 时整页落到正确地址 */
let pendingFullPath = ''; let pendingFullPath = '';
let installed = false;
let reloading = false;
export function setPendingRoutePath(fullPath = '') { export function setPendingRoutePath(fullPath = '') {
pendingFullPath = fullPath || ''; pendingFullPath = fullPath || '';
} }
function collectErrorText(error, depth = 0) {
if (!error || depth > 3) return '';
if (typeof error === 'string') return error;
const parts = [
error.message,
error.msg,
error.name,
error.stack,
error.error && collectErrorText(error.error, depth + 1),
error.reason && collectErrorText(error.reason, depth + 1),
error.cause && collectErrorText(error.cause, depth + 1),
error.payload && collectErrorText(error.payload, depth + 1),
];
const target = error.target;
if (target && (target.src || target.href)) {
parts.push(target.src || target.href);
}
try {
parts.push(String(error));
} catch (e) {
/* ignore */
}
return parts.filter(Boolean).join(' ');
}
export function isChunkLoadError(error) { export function isChunkLoadError(error) {
if (!error) return false; const text = collectErrorText(error);
const message = error.message || String(error); if (!text) return false;
return CHUNK_ERROR_RE.test(message); if (CHUNK_ERROR_RE.test(text)) return true;
return /Failed to fetch/i.test(text) && /\.m?js(\?|$|:)/i.test(text);
}
export function hasReloadQuery(query = {}) {
return !!(query && query[RELOAD_QUERY] !== undefined);
}
export function consumeReloadQuery(query = {}) {
if (!hasReloadQuery(query)) return query;
const next = { ...query };
delete next[RELOAD_QUERY];
return next;
}
function buildReloadUrl(targetPath) {
const url = new URL(targetPath, window.location.origin);
url.searchParams.set(RELOAD_QUERY, String(Date.now()));
return url.pathname + url.search + url.hash;
} }
/** /**
* @returns {boolean} 是否已触发刷新(冷却期内返回 false,避免死循环) * @returns {boolean} 是否已触发刷新(冷却期内返回 false,避免死循环)
*/ */
export function reloadForChunkError(targetPath) { export function reloadForChunkError(targetPath) {
if (reloading) return false;
const now = Date.now(); const now = Date.now();
const last = Number(sessionStorage.getItem(RELOAD_FLAG) || 0); const last = Number(sessionStorage.getItem(RELOAD_FLAG) || 0);
if (now - last < RELOAD_COOLDOWN_MS) { if (now - last < RELOAD_COOLDOWN_MS) {
return false; return false;
} }
reloading = true;
sessionStorage.setItem(RELOAD_FLAG, String(now)); sessionStorage.setItem(RELOAD_FLAG, String(now));
const path = targetPath || pendingFullPath || window.location.pathname + window.location.search + window.location.hash; const path =
window.location.assign(path); targetPath ||
pendingFullPath ||
`${window.location.pathname}${window.location.search}${window.location.hash}`;
const dest = buildReloadUrl(path);
// cache: 'reload' 会回写 HTTP 缓存,降低 index.html 仍指向旧 hash 资源的概率
fetch(`${window.location.pathname}?${RELOAD_QUERY}=${now}`, {
cache: 'reload',
credentials: 'same-origin',
headers: {
Pragma: 'no-cache',
'Cache-Control': 'no-cache',
},
})
.catch(() => {})
.finally(() => {
window.location.replace(dest);
});
return true; return true;
} }
export function wrapViewLoader(loader) {
if (typeof loader !== 'function') return loader;
return () =>
Promise.resolve()
.then(() => loader())
.catch(error => {
if (isChunkLoadError(error)) {
reloadForChunkError();
}
throw error;
});
}
export function installChunkReload() {
if (installed || typeof window === 'undefined') return;
installed = true;
window.addEventListener('vite:preloadError', event => {
if (reloadForChunkError()) {
event.preventDefault();
}
});
window.addEventListener('unhandledrejection', event => {
if (!isChunkLoadError(event.reason)) return;
if (reloadForChunkError()) {
event.preventDefault();
}
});
window.addEventListener(
'error',
event => {
const el = event.target;
const isAssetNode =
el &&
el !== window &&
(el.tagName === 'SCRIPT' ||
(el.tagName === 'LINK' && /modulepreload|stylesheet/i.test(el.rel || '')));
if (isAssetNode || isChunkLoadError(event.error || event.message)) {
if (reloadForChunkError()) {
event.preventDefault();
}
}
},
true
);
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') checkDeployedAssets();
});
}
function checkDeployedAssets() {
const el = document.querySelector('script[type="module"][src*="/assets/"]');
if (!el || !el.src) return;
fetch(el.src, { method: 'HEAD', cache: 'no-store', credentials: 'same-origin' })
.then(res => {
if (res.status === 404) reloadForChunkError();
})
.catch(() => {});
}
+94
View File
@@ -0,0 +1,94 @@
import { getDictionary } from '@/api/system/dictbiz';
import { processDelete, processSubmit } from '@/api/system/business-process';
import { ElMessage } from 'element-plus';
export const MK_BIZ = {
'customer-archive': {
dictName: '提交客商审核流',
subjectPrefix: '客商准入审批',
rejected: ['rejected'],
},
'project-apply': {
dictName: '提交项目审核流',
subjectPrefix: '项目审批',
rejected: ['rejected', 'change_rejected', 'withdrawn'],
},
'contract-manage': {
dictName: '提交合同审核流',
subjectPrefix: '合同审批',
rejected: ['rejected', 'change_rejected', 'withdrawn'],
},
'waybill-manage': {
dictName: '提交运单审核流',
subjectPrefix: '运单审批',
rejected: ['rejected', 'returned'],
},
'pre-settlement': {
dictName: '提交预结算审核流',
subjectPrefix: '预结算审批',
rejected: ['returned'],
},
'formal-settlement': {
dictName: '提交正式结算审核流',
subjectPrefix: '正式结算审批',
rejected: ['returned'],
},
'payment-application': {
dictName: '提交付款审核流',
subjectPrefix: '付款审批',
rejected: ['returned'],
},
};
const MK_SWITCH_NAME = '开启MK';
async function loadMkTemplateList() {
const res = await getDictionary({ code: 'mk_template' });
return res?.data?.data || [];
}
/** 业务字典 mk_template:名称「开启MK」且键值为 1 时才请求 MK */
export function isMkEnabled(list = []) {
const matched = list.find(item => String(item.dictValue || '').trim() === MK_SWITCH_NAME);
return String(matched?.dictKey ?? '').trim() === '1';
}
export async function resolveMkTemplateCode(dictName, list) {
const dictList = list || (await loadMkTemplateList());
const matched = dictList.find(item => String(item.dictValue || '').trim() === dictName);
const templateCode = matched?.dictKey;
if (!templateCode) {
ElMessage.warning(`未配置业务字典 mk_template「${dictName}」,无法提交审核流`);
return Promise.reject(new Error(`未配置业务字典 mk_template「${dictName}`));
}
return String(templateCode);
}
export async function submitMkApprovalFlow({
bizType,
formInstanceId,
subjectName = '',
approvalStatus = '',
}) {
const conf = MK_BIZ[bizType];
if (!conf) {
return Promise.reject(new Error(`不支持的MK业务类型:${bizType}`));
}
const list = await loadMkTemplateList();
if (!isMkEnabled(list)) {
return;
}
if ((conf.rejected || []).includes(approvalStatus)) {
await processDelete({ formInstanceId: String(formInstanceId) });
}
const templateCode = await resolveMkTemplateCode(conf.dictName, list);
const subject = subjectName
? `${conf.subjectPrefix}${subjectName}`
: `${conf.subjectPrefix}${formInstanceId}`;
return processSubmit({
templateCode,
formInstanceId: String(formInstanceId),
subject,
bizType,
});
}
+28
View File
@@ -283,3 +283,31 @@ export function validatejson(val) {
// 非对象、非数组、非字符串,或者字符串不是 JSON // 非对象、非数组、非字符串,或者字符串不是 JSON
return false; return false;
} }
/** 登录密码规则提示 */
export const LOGIN_PASSWORD_RULE_MESSAGE =
'密码须大于8位,且同时包含字母、数字和特殊字符(.!@#$%^&*';
/**
* 校验登录密码强度:大于8位,同时包含字母、数字、特殊字符(.!@#$%^&*
* @param {string} password
* @returns {boolean}
*/
export function isValidLoginPassword(password) {
return /^(?=.*[A-Za-z])(?=.*\d)(?=.*[.!@#$%^&*]).{9,}$/.test(String(password || ''));
}
/**
* Element Plus / Avue 表单校验器:登录密码强度
*/
export function validateLoginPassword(rule, value, callback) {
if (value === undefined || value === null || String(value).trim() === '') {
callback(new Error('请输入登录密码'));
return;
}
if (!isValidLoginPassword(value)) {
callback(new Error(LOGIN_PASSWORD_RULE_MESSAGE));
return;
}
callback();
}
+58 -4
View File
@@ -94,6 +94,17 @@
/> />
</el-select> </el-select>
</template> </template>
<template #detailAddress-form>
<el-input
v-model="form.detailAddress"
class="detail-address-input"
readonly
maxlength="255"
show-word-limit
placeholder="点击选择地图地址"
@click="openAddressMapPicker"
/>
</template>
<template #longitude-form> <template #longitude-form>
<el-input <el-input
v-model="form.longitude" v-model="form.longitude"
@@ -121,6 +132,13 @@
</template> </template>
</avue-form> </avue-form>
</el-dialog> </el-dialog>
<address-map-picker
v-model="addressMapPickerVisible"
:address="form.detailAddress"
:longitude="form.longitude"
:latitude="form.latitude"
@confirm="handleAddressMapConfirm"
/>
</basic-container> </basic-container>
</template> </template>
@@ -134,6 +152,7 @@ import { openImportDialog } from '@/utils/import-excel';
import { formatUpdateUserName } from '@/utils/audit'; import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate'; import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
@@ -181,6 +200,9 @@ const addExcelRequiredHeaderMarks = async blob => {
}; };
export default { export default {
components: {
AddressMapPicker,
},
data() { data() {
const validateIataCode = (rule, value, callback) => { const validateIataCode = (rule, value, callback) => {
if (!/^[A-Z]{3}$/.test(String(value || '').toUpperCase())) { if (!/^[A-Z]{3}$/.test(String(value || '').toUpperCase())) {
@@ -220,6 +242,7 @@ export default {
loading: true, loading: true,
data: [], data: [],
excelBox: false, excelBox: false,
addressMapPickerVisible: false,
excelForm: {}, excelForm: {},
provinceOptions: [], provinceOptions: [],
cityOptions: [], cityOptions: [],
@@ -368,15 +391,14 @@ export default {
{ {
label: '详细地址', label: '详细地址',
prop: 'detailAddress', prop: 'detailAddress',
type: 'textarea', formslot: true,
minRows: 2,
span: 24, span: 24,
minWidth: 220, minWidth: 220,
overHidden: false, overHidden: false,
maxlength: 255, maxlength: 255,
showWordLimit: true, showWordLimit: true,
rules: [ rules: [
{ required: true, message: '请输入详细地址', trigger: 'blur' }, { required: true, message: '请选择详细地址', trigger: 'change' },
{ max: 255, message: '详细地址不能超过255字', trigger: 'blur' }, { max: 255, message: '详细地址不能超过255字', trigger: 'blur' },
], ],
}, },
@@ -504,7 +526,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
accept: '.xls,.xlsx', accept: '.xls,.xlsx',
action: '/blade-system/airport-master/import-airport-master', action: '/blade-system/airport-master/import-airport-master',
}, },
@@ -669,6 +691,29 @@ export default {
handleCoordinateInput(prop, value) { handleCoordinateInput(prop, value) {
this.form[prop] = normalizeCoordinateInput(value); this.form[prop] = normalizeCoordinateInput(value);
}, },
openAddressMapPicker() {
this.addressMapPickerVisible = true;
},
handleAddressMapConfirm(payload) {
const selection = typeof payload === 'string' ? { address: payload } : payload || {};
if (selection.address) {
this.form.detailAddress = selection.address;
}
if (
selection.longitude !== undefined &&
selection.longitude !== null &&
selection.longitude !== ''
) {
this.form.longitude = Number(selection.longitude).toFixed(6);
}
if (
selection.latitude !== undefined &&
selection.latitude !== null &&
selection.latitude !== ''
) {
this.form.latitude = Number(selection.latitude).toFixed(6);
}
},
normalizeRow(row) { normalizeRow(row) {
row.code = row.iataCode ? `JC-${row.iataCode}` : row.code; row.code = row.iataCode ? `JC-${row.iataCode}` : row.code;
row.regionCode = String(row.regionCode || '').trim(); row.regionCode = String(row.regionCode || '').trim();
@@ -917,4 +962,13 @@ export default {
white-space: nowrap; white-space: nowrap;
} }
} }
.detail-address-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
</style> </style>
+1 -1
View File
@@ -274,7 +274,7 @@ export default {
res: 'data', res: 'data',
}, },
headers: getUploadHeaders(), headers: getUploadHeaders(),
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-system/cargo-type/import-cargo-type', action: '/blade-system/cargo-type/import-cargo-type',
}, },
{ {
+1 -1
View File
@@ -326,7 +326,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-system/currency/import-currency', action: '/blade-system/currency/import-currency',
}, },
{ {
+1
View File
@@ -119,6 +119,7 @@ export default {
return this.isAdmin || this.permission?.[code] === true; return this.isAdmin || this.permission?.[code] === true;
}, },
normalizeRow(row) { normalizeRow(row) {
row.unitCode = String(row.unitCode || '').trim();
row.unitName = String(row.unitName || '').trim(); row.unitName = String(row.unitName || '').trim();
row.dimension = String(row.dimension || '').trim(); row.dimension = String(row.dimension || '').trim();
row.remark = String(row.remark || '').trim(); row.remark = String(row.remark || '').trim();
+43 -6
View File
@@ -194,10 +194,11 @@
<el-input <el-input
v-model="form.detailAddress" v-model="form.detailAddress"
class="detail-address-input" class="detail-address-input"
clearable readonly
maxlength="255" maxlength="255"
show-word-limit show-word-limit
placeholder="请输入" placeholder="点击选择地图地址"
@click="openAddressMapPicker"
/> />
</template> </template>
<template #remark-form> <template #remark-form>
@@ -244,6 +245,13 @@
</template> </template>
</avue-form> </avue-form>
</el-dialog> </el-dialog>
<address-map-picker
v-model="addressMapPickerVisible"
:address="form.detailAddress"
:longitude="form.longitude"
:latitude="form.latitude"
@confirm="handleAddressMapConfirm"
/>
</basic-container> </basic-container>
</template> </template>
@@ -264,12 +272,16 @@ import { openImportDialog } from '@/utils/import-excel';
import { formatUpdateUserName } from '@/utils/audit'; import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate'; import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
const DEFAULT_COUNTRY_CODE = '+86'; const DEFAULT_COUNTRY_CODE = '+86';
const newLocal = '请选择类型'; const newLocal = '请选择类型';
export default { export default {
components: {
AddressMapPicker,
},
data() { data() {
const validateCode = (rule, value, callback) => { const validateCode = (rule, value, callback) => {
const code = String(value || '').toUpperCase(); const code = String(value || '').toUpperCase();
@@ -315,6 +327,7 @@ export default {
loading: true, loading: true,
data: [], data: [],
excelBox: false, excelBox: false,
addressMapPickerVisible: false,
excelForm: {}, excelForm: {},
portOptions: [], portOptions: [],
countryOptions: [], countryOptions: [],
@@ -572,11 +585,11 @@ export default {
minWidth: 220, minWidth: 220,
overHidden: false, overHidden: false,
order: 85, order: 85,
placeholder: '请输入', placeholder: '点击选择地图地址',
maxlength: 255, maxlength: 255,
showWordLimit: true, showWordLimit: true,
rules: [ rules: [
{ required: true, message: '请输入详细地址', trigger: 'blur' }, { required: true, message: '请选择详细地址', trigger: 'change' },
{ max: 255, message: '详细地址不能超过255字', trigger: 'blur' }, { max: 255, message: '详细地址不能超过255字', trigger: 'blur' },
], ],
}, },
@@ -673,7 +686,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
accept: '.xls,.xlsx', accept: '.xls,.xlsx',
action: '/blade-system/port-terminal/import-port-terminal', action: '/blade-system/port-terminal/import-port-terminal',
}, },
@@ -1040,6 +1053,21 @@ export default {
handleCoordinateInput(prop, value) { handleCoordinateInput(prop, value) {
this.form[prop] = normalizeCoordinateInput(value); this.form[prop] = normalizeCoordinateInput(value);
}, },
openAddressMapPicker() {
this.addressMapPickerVisible = true;
},
handleAddressMapConfirm(payload) {
const selection = typeof payload === 'string' ? { address: payload } : payload || {};
if (selection.address) {
this.form.detailAddress = selection.address;
}
if (selection.longitude !== undefined && selection.longitude !== null && selection.longitude !== '') {
this.form.longitude = Number(selection.longitude).toFixed(6);
}
if (selection.latitude !== undefined && selection.latitude !== null && selection.latitude !== '') {
this.form.latitude = Number(selection.latitude).toFixed(6);
}
},
resolveCountryCode(country) { resolveCountryCode(country) {
if (!country) { if (!country) {
return Promise.resolve(''); return Promise.resolve('');
@@ -1107,7 +1135,7 @@ export default {
return false; return false;
} }
if (isBlank(row.detailAddress)) { if (isBlank(row.detailAddress)) {
this.$message.warning('请输入详细地址'); this.$message.warning('请选择详细地址');
return false; return false;
} }
if (isBlank(row.longitude)) { if (isBlank(row.longitude)) {
@@ -1399,6 +1427,15 @@ export default {
line-height: 20px; line-height: 20px;
padding: 4px 0; padding: 4px 0;
} }
.detail-address-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
</style> </style>
<style lang="scss"> <style lang="scss">
+57 -5
View File
@@ -94,6 +94,17 @@
/> />
</el-select> </el-select>
</template> </template>
<template #detailAddress-form>
<el-input
v-model="form.detailAddress"
class="detail-address-input"
readonly
maxlength="255"
show-word-limit
placeholder="点击选择地图地址"
@click="openAddressMapPicker"
/>
</template>
<template #longitude-form> <template #longitude-form>
<el-input <el-input
v-model="form.longitude" v-model="form.longitude"
@@ -121,6 +132,13 @@
</template> </template>
</avue-form> </avue-form>
</el-dialog> </el-dialog>
<address-map-picker
v-model="addressMapPickerVisible"
:address="form.detailAddress"
:longitude="form.longitude"
:latitude="form.latitude"
@confirm="handleAddressMapConfirm"
/>
</basic-container> </basic-container>
</template> </template>
@@ -134,12 +152,16 @@ import { openImportDialog } from '@/utils/import-excel';
import { formatUpdateUserName } from '@/utils/audit'; import { formatUpdateUserName } from '@/utils/audit';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate'; import { getCoordinateValidationMessage, normalizeCoordinateInput } from '@/utils/coordinate';
import AddressMapPicker from '@/components/address-map-picker/main.vue';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
const DEFAULT_COUNTRY_CODE = '+86'; const DEFAULT_COUNTRY_CODE = '+86';
export default { export default {
components: {
AddressMapPicker,
},
data() { data() {
const validateTmisCode = (rule, value, callback) => { const validateTmisCode = (rule, value, callback) => {
if (!/^\d{5}$/.test(value || '')) { if (!/^\d{5}$/.test(value || '')) {
@@ -185,6 +207,7 @@ export default {
loading: true, loading: true,
data: [], data: [],
excelBox: false, excelBox: false,
addressMapPickerVisible: false,
excelForm: {}, excelForm: {},
provinceOptions: [], provinceOptions: [],
cityOptions: [], cityOptions: [],
@@ -340,15 +363,14 @@ export default {
{ {
label: '详细地址', label: '详细地址',
prop: 'detailAddress', prop: 'detailAddress',
type: 'textarea', formslot: true,
minRows: 2,
span: 24, span: 24,
minWidth: 220, minWidth: 220,
overHidden: false, overHidden: false,
maxlength: 255, maxlength: 255,
showWordLimit: true, showWordLimit: true,
rules: [ rules: [
{ required: true, message: '请输入详细地址', trigger: 'blur' }, { required: true, message: '请选择详细地址', trigger: 'change' },
{ max: 255, message: '详细地址不能超过255字', trigger: 'blur' }, { max: 255, message: '详细地址不能超过255字', trigger: 'blur' },
], ],
}, },
@@ -475,7 +497,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
accept: '.xls,.xlsx', accept: '.xls,.xlsx',
action: '/blade-system/railway-station/import-railway-station', action: '/blade-system/railway-station/import-railway-station',
}, },
@@ -652,6 +674,29 @@ export default {
handleCoordinateInput(prop, value) { handleCoordinateInput(prop, value) {
this.form[prop] = normalizeCoordinateInput(value); this.form[prop] = normalizeCoordinateInput(value);
}, },
openAddressMapPicker() {
this.addressMapPickerVisible = true;
},
handleAddressMapConfirm(payload) {
const selection = typeof payload === 'string' ? { address: payload } : payload || {};
if (selection.address) {
this.form.detailAddress = selection.address;
}
if (
selection.longitude !== undefined &&
selection.longitude !== null &&
selection.longitude !== ''
) {
this.form.longitude = Number(selection.longitude).toFixed(6);
}
if (
selection.latitude !== undefined &&
selection.latitude !== null &&
selection.latitude !== ''
) {
this.form.latitude = Number(selection.latitude).toFixed(6);
}
},
normalizeRow(row) { normalizeRow(row) {
row.code = row.tmisCode ? `TL${row.tmisCode}` : row.code; row.code = row.tmisCode ? `TL${row.tmisCode}` : row.code;
row.regionCode = String(row.regionCode || '').trim(); row.regionCode = String(row.regionCode || '').trim();
@@ -910,9 +955,16 @@ export default {
:deep(.el-table td .cell) { :deep(.el-table td .cell) {
white-space: nowrap; white-space: nowrap;
} }
} }
.detail-address-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
</style> </style>
<style lang="scss"> <style lang="scss">
+1 -1
View File
@@ -309,7 +309,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-system/region/import-region', action: '/blade-system/region/import-region',
}, },
{ {
@@ -157,12 +157,19 @@
<el-table-column label="计费单位" width="150" <el-table-column label="计费单位" width="150"
><template #default="{ row }" ><template #default="{ row }"
><span v-if="readonly">{{ displayValue(row.billingUnit) }}</span ><span v-if="readonly">{{ displayValue(row.billingUnit) }}</span
><el-select v-else v-model="row.billingUnit" clearable filterable :loading="unitLoading" ><el-select
v-else
v-model="row.billingUnit"
clearable
filterable
:disabled="!canSelectBillingUnit(row)"
:loading="unitLoading"
:placeholder="billingUnitPlaceholder(row)"
><el-option ><el-option
v-for="item in unitOptions" v-for="item in unitOptionsFor(row)"
:key="item.id || item.dictKey || item.dictValue" :key="item.id || item.value"
:label="item.dictValue" :label="item.label"
:value="item.dictValue" /></el-select></template :value="item.value" /></el-select></template
></el-table-column> ></el-table-column>
<el-table-column label="单价(元)" width="180" <el-table-column label="单价(元)" width="180"
><template #default="{ row }" ><template #default="{ row }"
@@ -367,12 +374,26 @@
<script> <script>
import { getList as getCargoTypeList } from '@/api/base/cargo-type'; import { getList as getCargoTypeList } from '@/api/base/cargo-type';
import { getList as getFeeItemList } from '@/api/base/fee-item'; import { getList as getFeeItemList } from '@/api/base/fee-item';
import { getList as getMeasurementUnitList } from '@/api/base/measurement-unit';
import { getLazyTree as getRegionLazyTree } from '@/api/base/region'; import { getLazyTree as getRegionLazyTree } from '@/api/base/region';
import { InfoFilled } from '@element-plus/icons-vue'; import { InfoFilled } from '@element-plus/icons-vue';
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import SectionCard from '@/components/section-card/main.vue'; import SectionCard from '@/components/section-card/main.vue';
const clone = value => JSON.parse(JSON.stringify(value)); const clone = value => JSON.parse(JSON.stringify(value));
/** 计费要素与计量单位维度的对应关系(这些要素可选计费单位) */
const BILLING_ELEMENT_DIMENSION_MAP = {
按重量: '重量',
按体积: '体积',
按数量: '数量',
};
const BILLING_UNIT_SELECTABLE_ELEMENTS = Object.keys(BILLING_ELEMENT_DIMENSION_MAP);
/** 固定计费单位(不可编辑) */
const FIXED_BILLING_UNIT_MAP = {
按里程: '公里',
'按吨·公里': '吨公里',
'固定金额(整单一口价)': '单',
};
const defaultRule = () => ({ const defaultRule = () => ({
feeType: '', feeType: '',
feeItem: '', feeItem: '',
@@ -417,11 +438,11 @@ export default {
feeItems: {}, feeItems: {},
feeItemLoadingMap: {}, feeItemLoadingMap: {},
unitOptions: [], unitOptions: [],
measurementUnits: [],
unitLoading: false, unitLoading: false,
billingElements: [ billingElements: [
'按重量', '按重量',
'按体积', '按体积',
'按车辆',
'按里程', '按里程',
'按吨·公里', '按吨·公里',
'固定金额(整单一口价)', '固定金额(整单一口价)',
@@ -430,7 +451,6 @@ export default {
typeMap: { typeMap: {
按重量: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'], 按重量: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
按体积: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'], 按体积: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
按车辆: ['固定单价'],
按里程: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'], 按里程: ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
'按吨·公里': ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'], '按吨·公里': ['固定单价', '区间单价', '阶梯单价', '区间阶梯一口价'],
'固定金额(整单一口价)': ['固定一口价'], '固定金额(整单一口价)': ['固定一口价'],
@@ -545,6 +565,7 @@ export default {
next.limitRanges = next.limitRanges.map(item => ({ ...item, minimumBillingWeight: '' })); next.limitRanges = next.limitRanges.map(item => ({ ...item, minimumBillingWeight: '' }));
this.syncLegacyLimit(next); this.syncLegacyLimit(next);
next.matchCondition = { ...defaultRule().matchCondition, ...(rule.matchCondition || {}) }; next.matchCondition = { ...defaultRule().matchCondition, ...(rule.matchCondition || {}) };
this.syncBillingUnit(next);
return next; return next;
}, },
normalizeRanges(row) { normalizeRanges(row) {
@@ -614,14 +635,75 @@ export default {
.finally(() => { .finally(() => {
this.feeCategoryLoading = false; this.feeCategoryLoading = false;
}); });
this.loadUnitOptions();
},
loadUnitOptions() {
this.unitLoading = true; this.unitLoading = true;
getDictionary({ code: 'unit_fee' }) Promise.all([
.then(res => { getDictionary({ code: 'unit_fee' }).then(res => {
this.unitOptions = res.data?.data || []; this.unitOptions = res.data?.data || [];
}) }),
.finally(() => { getMeasurementUnitList(1, 9999, { status: 1 }).then(res => {
this.unitLoading = false; const data = res?.data?.data || res?.data || {};
}); const records = Array.isArray(data) ? data : data.records || [];
this.measurementUnits = records.filter(
item => item.status === undefined || item.status === null || Number(item.status) === 1
);
}),
]).finally(() => {
this.unitLoading = false;
});
},
measurementDimension(billingElement) {
return BILLING_ELEMENT_DIMENSION_MAP[billingElement] || '';
},
fixedBillingUnit(billingElement) {
return FIXED_BILLING_UNIT_MAP[String(billingElement || '').trim()] || '';
},
canSelectBillingUnit(row) {
return BILLING_UNIT_SELECTABLE_ELEMENTS.includes(String(row?.billingElement || '').trim());
},
billingUnitPlaceholder(row) {
if (!row?.billingElement) return '请先选择计费要素';
if (this.fixedBillingUnit(row.billingElement)) return this.fixedBillingUnit(row.billingElement);
if (!this.canSelectBillingUnit(row)) return '当前计费要素无需选择';
return '请选择';
},
unitOptionsFor(row) {
const fixedUnit = this.fixedBillingUnit(row?.billingElement);
if (fixedUnit) {
return [{ id: fixedUnit, label: fixedUnit, value: fixedUnit }];
}
if (!this.canSelectBillingUnit(row)) {
return [];
}
const dimension = this.measurementDimension(row?.billingElement);
if (dimension) {
return this.measurementUnits
.filter(item => String(item.dimension || '').trim() === dimension)
.map(item => ({
id: item.id,
label: item.unitName,
value: item.unitName,
}))
.filter(item => item.value);
}
return [];
},
syncBillingUnit(row) {
const fixedUnit = this.fixedBillingUnit(row?.billingElement);
if (fixedUnit) {
row.billingUnit = fixedUnit;
return;
}
if (!this.canSelectBillingUnit(row)) {
row.billingUnit = '';
return;
}
const options = this.unitOptionsFor(row);
if (!options.some(item => String(item.value) === String(row.billingUnit || ''))) {
row.billingUnit = '';
}
}, },
feeTypeKey(row) { feeTypeKey(row) {
const option = this.feeCategories.find( const option = this.feeCategories.find(
@@ -699,7 +781,14 @@ export default {
return this.typeMap[row.billingElement] || []; return this.typeMap[row.billingElement] || [];
}, },
handleElementChange(row) { handleElementChange(row) {
if (!this.billingTypes(row).includes(row.billingType)) row.billingType = ''; const billingTypes = this.billingTypes(row);
if (!billingTypes.includes(row.billingType)) {
row.billingType =
row.billingElement === '固定金额(整单一口价)' && billingTypes.includes('固定一口价')
? '固定一口价'
: '';
}
this.syncBillingUnit(row);
if (!this.canEditMinimum(row)) { if (!this.canEditMinimum(row)) {
row.minimumBillingWeight = ''; row.minimumBillingWeight = '';
row.limitRanges = (row.limitRanges || []).map(item => ({ row.limitRanges = (row.limitRanges || []).map(item => ({
@@ -831,7 +920,6 @@ export default {
['taxRate', '税率'], ['taxRate', '税率'],
['billingElement', '计费要素'], ['billingElement', '计费要素'],
['billingType', '计费类型'], ['billingType', '计费类型'],
['billingUnit', '计费单位'],
]; ];
for (const [i, row] of this.draft.rules.entries()) { for (const [i, row] of this.draft.rules.entries()) {
const empty = required.find( const empty = required.find(
@@ -841,6 +929,15 @@ export default {
this.$message.warning(`${i + 1}${empty[1]}不能为空`); this.$message.warning(`${i + 1}${empty[1]}不能为空`);
return false; return false;
} }
if (
this.canSelectBillingUnit(row) &&
(row.billingUnit === undefined ||
row.billingUnit === null ||
String(row.billingUnit).trim() === '')
) {
this.$message.warning(`${i + 1}行计费单位不能为空`);
return false;
}
const feeItem = String(row.feeItem).trim(); const feeItem = String(row.feeItem).trim();
if (feeItemSet.has(feeItem)) { if (feeItemSet.has(feeItem)) {
this.$message.warning(`费用项“${feeItem}”不能重复`); this.$message.warning(`费用项“${feeItem}”不能重复`);
@@ -1899,11 +1899,11 @@
label-width="auto" label-width="auto"
class="business-crud-page__module-form business-crud-page__module-form--three" class="business-crud-page__module-form business-crud-page__module-form--three"
> >
<el-form-item label="账单起始日" required :error="settlementRuleErrors.billStartDate"> <el-form-item label="账单起始日" required :error="settlementRuleErrors.billStartDate">
<el-date-picker <el-date-picker
v-model="settlementRuleForm.billStartDate" v-model="settlementRuleForm.billStartDate"
type="date" type="date"
placeholder="请选择账单起始日" placeholder="请选择账单起始日"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
:disabled="dialogReadonly" :disabled="dialogReadonly"
@@ -3374,7 +3374,7 @@
{{ dispatchDialogStatusText }} {{ dispatchDialogStatusText }}
</el-tag> </el-tag>
<el-tag type="primary" effect="light"> <el-tag type="primary" effect="light">
{{ formatDispatchTransportType(dispatchRow.transportType) || '公路整车' }} {{ formatDispatchTransportType(dispatchRow.transportType) || '公路运输' }}
</el-tag> </el-tag>
</div> </div>
</div> </div>
@@ -7784,8 +7784,8 @@ export default {
const rule = this.normalizeSettlementRule(source); const rule = this.normalizeSettlementRule(source);
this.settlementRuleErrors = {}; this.settlementRuleErrors = {};
if (this.isBillingFieldEmpty(rule.billStartDate)) { if (this.isBillingFieldEmpty(rule.billStartDate)) {
this.settlementRuleErrors = { billStartDate: '请选择账单起始日' }; this.settlementRuleErrors = { billStartDate: '请选择账单起始日' };
this.$message.warning(`${label}${label ? '' : ''}请选择账单起始日`); this.$message.warning(`${label}${label ? '' : ''}请选择账单起始日`);
return false; return false;
} }
if (this.isBillingFieldEmpty(rule.settlementType)) { if (this.isBillingFieldEmpty(rule.settlementType)) {
@@ -103,8 +103,13 @@
<div class="contract-attachment-upload-dialog__body"> <div class="contract-attachment-upload-dialog__body">
<div class="contract-attachment-upload-dialog__field"> <div class="contract-attachment-upload-dialog__field">
<span class="contract-attachment-upload-dialog__label">附件位置</span> <span class="contract-attachment-upload-dialog__label">附件位置</span>
<el-select :model-value="attachmentLocation" disabled style="width: 100%"> <el-select v-model="uploadDialogLocation" placeholder="请选择附件位置" style="width: 100%">
<el-option :label="attachmentLocation" :value="attachmentLocation" /> <el-option
v-for="item in resolvedLocationOptions"
:key="item"
:label="item"
:value="item"
/>
</el-select> </el-select>
</div> </div>
<div class="contract-attachment-upload-dialog__field"> <div class="contract-attachment-upload-dialog__field">
@@ -273,15 +278,17 @@ export default {
markApprovedOnUpload: Boolean, markApprovedOnUpload: Boolean,
useUploadDialog: Boolean, useUploadDialog: Boolean,
attachmentLocation: { type: String, default: '合同文件' }, attachmentLocation: { type: String, default: '合同文件' },
attachmentLocationOptions: { type: Array, default: null },
preview: { type: Function, default: null }, preview: { type: Function, default: null },
}, },
emits: ['update:rows'], emits: ['update:rows', 'upload-to-location'],
data() { data() {
return { return {
selected: [], selected: [],
attachmentFileTypes, attachmentFileTypes,
contractAttachmentTypeOptions: [...defaultContractAttachmentTypeOptions], contractAttachmentTypeOptions: [...defaultContractAttachmentTypeOptions],
uploadDialogVisible: false, uploadDialogVisible: false,
uploadDialogLocation: '合同文件',
uploadDialogType: resolveOtherAttachmentType(defaultContractAttachmentTypeOptions), uploadDialogType: resolveOtherAttachmentType(defaultContractAttachmentTypeOptions),
uploadDialogFiles: [], uploadDialogFiles: [],
uploadDialogFileList: [], uploadDialogFileList: [],
@@ -300,6 +307,11 @@ export default {
defaultAttachmentType() { defaultAttachmentType() {
return resolveOtherAttachmentType(this.contractAttachmentTypeOptions); return resolveOtherAttachmentType(this.contractAttachmentTypeOptions);
}, },
resolvedLocationOptions() {
const options = (this.attachmentLocationOptions || []).filter(Boolean);
if (options.length) return options;
return ['合同文件', '其它附件'];
},
}, },
created() { created() {
this.loadAttachmentTypeOptions(); this.loadAttachmentTypeOptions();
@@ -340,6 +352,10 @@ export default {
this.update([...this.rows]); this.update([...this.rows]);
}, },
openUploadDialog() { openUploadDialog() {
const options = this.resolvedLocationOptions;
this.uploadDialogLocation = options.includes(this.attachmentLocation)
? this.attachmentLocation
: options[0] || this.attachmentLocation;
this.uploadDialogType = this.defaultAttachmentType; this.uploadDialogType = this.defaultAttachmentType;
this.uploadDialogFiles = []; this.uploadDialogFiles = [];
this.uploadDialogFileList = []; this.uploadDialogFileList = [];
@@ -348,6 +364,7 @@ export default {
resetUploadDialog() { resetUploadDialog() {
this.uploadDialogFiles = []; this.uploadDialogFiles = [];
this.uploadDialogFileList = []; this.uploadDialogFileList = [];
this.uploadDialogLocation = this.attachmentLocation;
this.uploadDialogType = this.defaultAttachmentType; this.uploadDialogType = this.defaultAttachmentType;
}, },
beforeUpload(file) { beforeUpload(file) {
@@ -416,6 +433,10 @@ export default {
this.$message.warning('请先上传附件'); this.$message.warning('请先上传附件');
return; return;
} }
if (!this.uploadDialogLocation) {
this.$message.warning('请选择附件位置');
return;
}
if (!this.uploadDialogType) { if (!this.uploadDialogType) {
this.$message.warning('请选择附件类型'); this.$message.warning('请选择附件类型');
return; return;
@@ -430,7 +451,14 @@ export default {
uploadTime: row.uploadTime || uploadTime, uploadTime: row.uploadTime || uploadTime,
...(this.markApprovedOnUpload ? { approved: true } : {}), ...(this.markApprovedOnUpload ? { approved: true } : {}),
})); }));
this.update([...(this.rows || []), ...appended]); if (this.uploadDialogLocation === this.attachmentLocation) {
this.update([...(this.rows || []), ...appended]);
} else {
this.$emit('upload-to-location', {
location: this.uploadDialogLocation,
rows: appended,
});
}
this.uploadDialogVisible = false; this.uploadDialogVisible = false;
}, },
handleChange(rows) { handleChange(rows) {
@@ -1,8 +1,61 @@
<template> <template>
<div v-loading="loading" class="master-detail"> <div v-loading="loading" class="master-detail">
<section v-if="master" class="detail-overview"> <section v-if="master" class="detail-overview">
<div class="detail-heading"><div><h2>多联总单详情 <span>|</span> {{ master.masterNo }}</h2><el-tag :type="statusType(master.businessStatus)" class="status-text">{{ statusName(master.businessStatus) }}</el-tag><el-tag v-if="transportFlowLabel" type="info" class="transport-flow-tag">{{ transportFlowLabel }}</el-tag></div><el-button @click="$emit('back')">取消</el-button></div> <div class="detail-heading">
<dl class="detail-meta"><div><dt>客户</dt><dd>{{ master.customerName || '-' }}</dd></div><div><dt>合同编号</dt><dd>{{ master.contractNo || '-' }}</dd></div><div><dt>项目</dt><dd>{{ master.projectName || '-' }}</dd></div><div class="detail-meta__attachments"><dt>附件</dt><dd><template v-if="attachments.length"><el-link v-for="file in attachments" :key="file.url || file.link || file.name || file.originalName" type="primary" @click="previewAttachment(file)">{{ attachmentName(file) }}</el-link></template><span v-else>-</span></dd></div></dl> <div>
<h2>多联总单详情 <span>|</span> {{ master.masterNo }}</h2>
<el-tag :type="statusType(master.businessStatus)">{{
statusName(master.businessStatus)
}}</el-tag>
<el-tag v-if="transportFlowLabel" type="primary" class="transport-flow-tag">{{
transportFlowLabel
}}</el-tag>
</div>
</div>
<dl class="detail-meta">
<div>
<dt>客户</dt>
<dd>
<el-link v-if="master.customerName" type="primary" @click="openCustomer">{{
master.customerName
}}</el-link>
<span v-else>-</span>
</dd>
</div>
<div>
<dt>合同编号</dt>
<dd>
<el-link v-if="master.contractNo && master.contractId" type="primary" @click="openContract">{{
master.contractNo
}}</el-link>
<span v-else>{{ master.contractNo || '-' }}</span>
</dd>
</div>
<div>
<dt>项目</dt>
<dd>
<el-link v-if="master.projectName && master.projectId" type="primary" @click="openProject">{{
master.projectName
}}</el-link>
<span v-else>{{ master.projectName || '-' }}</span>
</dd>
</div>
<div class="detail-meta__attachments">
<dt>附件</dt>
<dd>
<template v-if="attachments.length">
<el-link
v-for="file in attachments"
:key="file.url || file.link || file.name || file.originalName"
type="primary"
@click="previewAttachment(file)"
>{{ attachmentName(file) }}</el-link
>
</template>
<span v-else>-</span>
</dd>
</div>
</dl>
<div class="route-map"><template v-for="(route, index) in segments" :key="route.segmentNo"><div class="route-map__node"><span :class="['route-badge', index ? 'middle' : 'start']">{{ index ? '经' : '起' }}</span><strong>{{ segmentLocationName(route, 'departure') }}</strong><small>{{ route.departureAddress || '-' }}</small><small class="route-map__progress">{{ index ? `已到达 ${quantity(segments[index - 1].arrivedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(segments[index - 1])}` : `已调度 ${quantity(route.dispatchedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(route)}` }}</small><small v-if="index" class="route-map__progress">已调度 {{ quantity(route.dispatchedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div><div class="route-map__line"></div><div v-if="index === segments.length - 1" class="route-map__node"><span class="route-badge end">终</span><strong>{{ segmentLocationName(route, 'arrival') }}</strong><small>{{ route.arrivalAddress || '-' }}</small><small class="route-map__progress">已到达 {{ quantity(route.arrivedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div></template></div> <div class="route-map"><template v-for="(route, index) in segments" :key="route.segmentNo"><div class="route-map__node"><span :class="['route-badge', index ? 'middle' : 'start']">{{ index ? '经' : '起' }}</span><strong>{{ segmentLocationName(route, 'departure') }}</strong><small>{{ route.departureAddress || '-' }}</small><small class="route-map__progress">{{ index ? `已到达 ${quantity(segments[index - 1].arrivedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(segments[index - 1])}` : `已调度 ${quantity(route.dispatchedQuantity)}/${quantity(master.totalQuantity)} ${plannedUnit(route)}` }}</small><small v-if="index" class="route-map__progress">已调度 {{ quantity(route.dispatchedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div><div class="route-map__line"></div><div v-if="index === segments.length - 1" class="route-map__node"><span class="route-badge end">终</span><strong>{{ segmentLocationName(route, 'arrival') }}</strong><small>{{ route.arrivalAddress || '-' }}</small><small class="route-map__progress">已到达 {{ quantity(route.arrivedQuantity) }}/{{ quantity(master.totalQuantity) }} {{ plannedUnit(route) }}</small></div></template></div>
</section> </section>
@@ -42,6 +95,8 @@
<script> <script>
import * as api from '@/api/business/master-order'; import * as api from '@/api/business/master-order';
import { getDetail as getProjectDetail } from '@/api/business/project-apply';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { CaretBottom, CaretTop } from '@element-plus/icons-vue'; import { CaretBottom, CaretTop } from '@element-plus/icons-vue';
import { ElImageViewer } from 'element-plus'; import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue'; import { OpenFileViewer } from '@open-file-viewer/vue';
@@ -51,10 +106,26 @@ import pdfWorkerSrc from 'pdfjs-dist/build/pdf.worker.mjs?url';
const viewerPlugins = [imagePlugin(), pdfPlugin({ workerSrc: pdfWorkerSrc, useFetchData: true }), officePlugin({ pdf: { workerSrc: pdfWorkerSrc, useFetchData: true } }), textPlugin(), fallbackPlugin()]; const viewerPlugins = [imagePlugin(), pdfPlugin({ workerSrc: pdfWorkerSrc, useFetchData: true }), officePlugin({ pdf: { workerSrc: pdfWorkerSrc, useFetchData: true } }), textPlugin(), fallbackPlugin()];
const parseJsonArray = value => {
if (Array.isArray(value)) return value;
if (!value) return [];
try {
const parsed = JSON.parse(value);
if (Array.isArray(parsed)) return parsed;
return parsed && typeof parsed === 'object' ? [parsed] : [];
} catch (error) {
return [];
}
};
const customerRowLabel = (row = {}) =>
row.customer || row.fullName || row.shortName || row.customerName || row.customerCode || '';
const customerRowId = (row = {}) => row.id || row.customerId || '';
export default { export default {
components: { ElImageViewer, OpenFileViewer }, components: { ElImageViewer, OpenFileViewer },
props: { id: [String, Number] }, props: { id: [String, Number] },
emits: ['back'],
data() { return { loading: false, master: null, expandedSegments: {}, CaretBottom, CaretTop, imagePreviewVisible: false, imagePreviewUrls: [], imagePreviewIndex: 0, documentPreviewVisible: false, previewFile: {}, viewerPlugins, viewerToolbar: { download: true, fullscreen: true, print: true, rotate: true, zoom: true } }; }, data() { return { loading: false, master: null, expandedSegments: {}, CaretBottom, CaretTop, imagePreviewVisible: false, imagePreviewUrls: [], imagePreviewIndex: 0, documentPreviewVisible: false, previewFile: {}, viewerPlugins, viewerToolbar: { download: true, fullscreen: true, print: true, rotate: true, zoom: true } }; },
computed: { computed: {
segments() { segments() {
@@ -71,6 +142,7 @@ export default {
dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; }, dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; },
}, },
async mounted() { async mounted() {
if (!this.id) return;
this.loading = true; this.loading = true;
try { try {
const res = await api.getDetail(this.id); const res = await api.getDetail(this.id);
@@ -148,6 +220,68 @@ export default {
this.$router.push({ path: '/business/waybill-manage/detail', query: { id: row.id } }); this.$router.push({ path: '/business/waybill-manage/detail', query: { id: row.id } });
}, },
openPlan(row) { this.$router.push({ path: '/business/transport-plan', query: { detailId: row.id } }); }, openPlan(row) { this.$router.push({ path: '/business/transport-plan', query: { detailId: row.id } }); },
openContract() {
if (!this.master?.contractId) {
this.$message.warning('合同信息缺失,无法打开');
return;
}
this.$router.push({
path: '/business/contract-manage/detail',
query: { id: this.master.contractId, name: '合同详情' },
});
},
openProject() {
if (!this.master?.projectId) {
this.$message.warning('项目信息缺失,无法打开');
return;
}
this.$router.push({
path: '/business/project-apply/form',
query: { mode: 'view', id: this.master.projectId, name: '查看项目管理' },
});
},
async resolveCustomerId() {
if (this.master?.customerId) return this.master.customerId;
const name = String(this.master?.customerName || '').trim();
if (!name) return '';
if (this.master?.projectId) {
try {
const res = await getProjectDetail(this.master.projectId);
const rows = parseJsonArray(res.data?.data?.customerJson);
const matched =
rows.find(row => customerRowLabel(row) === name) ||
rows.find(row => {
const label = customerRowLabel(row);
return label && (name.includes(label) || label.includes(name));
});
const id = customerRowId(matched);
if (id) return id;
} catch (error) {
// 退
}
}
try {
const res = await getCustomerArchiveList(1, 20, { fullName: name });
const records = res.data?.data?.records || [];
const exact =
records.find(item => item.fullName === name || item.shortName === name) || records[0];
return exact?.id || '';
} catch (error) {
return '';
}
},
async openCustomer() {
if (!this.master?.customerName) return;
const customerId = await this.resolveCustomerId();
if (!customerId) {
this.$message.warning('未找到对应客商档案,无法打开');
return;
}
this.$router.push({
path: '/vehicle/customer-archive/form',
query: { id: String(customerId), name: '查看客商档案', view: '1' },
});
},
waybillStatusName(value) { return ({ pending: '待执行', waiting: '待执行', running: '进行中', processing: '进行中', completed: '已完成', cancelled: '已取消' })[value] || value || '-'; }, 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'; }, waybillStatusType(value) { return ({ pending: 'info', waiting: 'info', running: 'warning', processing: 'warning', completed: 'success', cancelled: 'danger' })[value] || 'info'; },
statusName(value) { return ({ waiting_dispatch: '待调度', dispatching: '调度中', completed: '调度完成', closed: '调度关闭' })[value] || value || '-'; }, statusName(value) { return ({ waiting_dispatch: '待调度', dispatching: '调度中', completed: '调度完成', closed: '调度关闭' })[value] || value || '-'; },
@@ -159,9 +293,37 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.master-detail { padding-bottom: 20px; color: #303133; } .master-detail { padding-bottom: 20px; color: #303133; }
.detail-overview, .execution-detail-card { margin-bottom: 8px; border: 1px solid #eff1f7; background: #fff; } .detail-overview, .execution-detail-card { margin-bottom: 8px; border: 1px solid #eff1f7; background: #fff; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; h2 { display: inline-block; margin: 0 16px 0 0; font-size: 20px; } h2 span { margin: 0 8px; color: #909399; font-weight: 400; } } .detail-heading {
.transport-flow-tag { margin-left: 8px; } display: flex;
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; margin: 0; padding: 0 24px 20px; dt { margin-bottom: 6px; color: #909399; font-size: 13px; } dd { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; color: #409eff; font-size: 14px; word-break: break-all; } } align-items: center;
justify-content: space-between;
padding: 18px 24px;
h2 {
display: inline-block;
margin: 0 16px 0 0;
font-size: 20px;
}
h2 span {
margin: 0 8px;
color: #909399;
font-weight: 400;
}
:deep(.el-tag) {
height: 28px;
padding: 0 12px;
border: 0;
border-radius: 8px;
font-size: 13px;
line-height: 28px;
}
}
.transport-flow-tag {
margin-left: 8px;
}
.detail-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; margin: 0; padding: 0 24px 20px; dt { margin-bottom: 6px; color: #909399; font-size: 13px; } dd { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; color: #303133; font-size: 14px; word-break: break-all; } :deep(.el-link) { font-size: 14px; } }
.route-map { display: flex; align-items: flex-start; padding: 16px 24px 20px; border-top: 1px solid #eff1f7; overflow-x: auto; } .route-map { display: flex; align-items: flex-start; padding: 16px 24px 20px; border-top: 1px solid #eff1f7; overflow-x: auto; }
.route-map__node { display: grid; flex: 0 0 150px; justify-items: center; gap: 6px; text-align: center; strong { font-size: 16px; white-space: nowrap; } small { color: #606266; white-space: nowrap; } } .route-map__node { display: grid; flex: 0 0 150px; justify-items: center; gap: 6px; text-align: center; strong { font-size: 16px; white-space: nowrap; } small { color: #606266; white-space: nowrap; } }
.route-map__progress { color: #303133 !important; } .route-map__progress { color: #303133 !important; }
@@ -95,10 +95,51 @@
<div class="goods-heading"><h3>货物信息</h3><div><el-link type="primary" @click="addGoods(route)">新增货物</el-link></div></div> <div class="goods-heading"><h3>货物信息</h3><div><el-link type="primary" @click="addGoods(route)">新增货物</el-link></div></div>
<el-table :data="route.goods" border class="goods-table"> <el-table :data="route.goods" border class="goods-table">
<el-table-column type="index" label="序号" width="64" /> <el-table-column type="index" label="序号" width="64" />
<el-table-column min-width="180"><template #header><span>货物类型<span class="goods-required-mark">*</span></span></template><template #default="{ row }"><el-cascader v-model="row.cargoTypePath" class="goods-table__cargo-type" :options="cargoTypeOptions" :props="cargoTypeCascaderProps" placeholder="请选择货物类型" clearable filterable @change="value => handleCargoTypeChange(route, row, value)" /></template></el-table-column> <el-table-column min-width="180"
<el-table-column min-width="180"><template #header><span>货物名称<span class="goods-required-mark">*</span></span></template><template #default="{ row }"><el-select v-model="row.sourceIndex" class="goods-table__cargo-name" placeholder="请选择总单货物" @change="selectGoods(route, row)"><el-option v-for="item in masterGoodsByCargoType(row)" :key="item.sourceIndex" :label="item.cargoName" :value="item.sourceIndex" /></el-select></template></el-table-column> ><template #header
<el-table-column prop="remainingQuantity" column-key="remainingQuantity" label="剩余数量" width="150" class-name="goods-table__remaining"><template #default="{ row }">{{ formatQuantity(goodsRemainingQuantity(route, row)) }}</template></el-table-column> ><span>货物类型<span class="goods-required-mark">*</span></span></template
<el-table-column prop="dispatchQuantity" column-key="dispatchQuantity" width="200" class-name="goods-table__dispatch"><template #header><span>本次数量<span class="goods-required-mark">*</span></span></template><template #default="{ row }"><el-input :model-value="row.dispatchQuantity" inputmode="decimal" placeholder="请输入" @input="value => handleDispatchQuantityInput(route, row, value)" /></template></el-table-column> ><template #default="{ row }"
><el-autocomplete
v-model="row.cargoType"
class="goods-table__cargo-type"
clearable
:debounce="300"
placeholder="请输入货物类型"
:fetch-suggestions="fetchCargoTypeSuggestions"
@select="item => handleCargoTypeSelect(route, row, item)"
@change="value => handleCargoTypeChange(route, row, value)"
/></template>
</el-table-column>
<el-table-column min-width="180"
><template #header
><span>货物名称<span class="goods-required-mark">*</span></span></template
><template #default="{ row }"
><el-select
v-model="row.sourceIndex"
class="goods-table__cargo-name"
placeholder="请选择总单货物"
@change="selectGoods(route, row)"
><el-option
v-for="item in masterGoodsByCargoType(row)"
:key="item.sourceIndex"
:label="item.cargoName"
:value="item.sourceIndex" /></el-select
></template>
</el-table-column>
<el-table-column
prop="dispatchQuantity"
column-key="dispatchQuantity"
width="200"
class-name="goods-table__dispatch"
><template #header
><span>本次数量<span class="goods-required-mark">*</span></span></template
><template #default="{ row }"
><el-input
:model-value="row.dispatchQuantity"
inputmode="decimal"
placeholder="请输入"
@input="value => handleDispatchQuantityInput(route, row, value)" /></template
></el-table-column>
<el-table-column prop="quantityUnit" width="110"><template #header><span>数量单位<span class="goods-required-mark">*</span></span></template></el-table-column> <el-table-column prop="quantityUnit" width="110"><template #header><span>数量单位<span class="goods-required-mark">*</span></span></template></el-table-column>
<el-table-column prop="packageType" label="包装" min-width="110" /> <el-table-column prop="packageType" label="包装" min-width="110" />
<el-table-column prop="brand" label="品牌" min-width="110" /> <el-table-column prop="brand" label="品牌" min-width="110" />
@@ -208,7 +249,7 @@ export default {
props: { id: [String, Number] }, props: { id: [String, Number] },
emits: ['back'], emits: ['back'],
data() { data() {
return { loading: false, submitting: false, master: null, routes: [], pending: [], pendingExpanded: false, editingId: null, driverInputs: {}, carrierOptions: [], driverOptions: [], carrierLoading: false, driverLoading: false, escortLoading: false, cargoTypeOptions: [], cargoTypeCascaderProps: { label: 'cargoName', value: 'id', children: 'children', emitPath: true }, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] }; return { loading: false, submitting: false, master: null, routes: [], pending: [], pendingExpanded: false, editingId: null, driverInputs: {}, carrierOptions: [], driverOptions: [], carrierLoading: false, driverLoading: false, escortLoading: false, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] };
}, },
computed: { computed: {
totalQuantity() { return (this.master?.goods || []).reduce((sum, item) => sum + Number(item.quantity || 0), 0); }, totalQuantity() { return (this.master?.goods || []).reduce((sum, item) => sum + Number(item.quantity || 0), 0); },
@@ -216,6 +257,9 @@ export default {
goodsNames() { return (this.master?.goods || []).map(item => item.cargoName).filter(Boolean).join('、') || '-'; }, goodsNames() { return (this.master?.goods || []).map(item => item.cargoName).filter(Boolean).join('、') || '-'; },
goodsTypes() { return [...new Set((this.master?.goods || []).map(item => item.cargoType).filter(Boolean))].join('、') || '-'; }, goodsTypes() { return [...new Set((this.master?.goods || []).map(item => item.cargoType).filter(Boolean))].join('、') || '-'; },
masterGoods() { return (this.master?.goods || []).map((item, sourceIndex) => ({ ...item, sourceIndex, label: [item.cargoName, item.cargoType].filter(Boolean).join(' / ') })); }, masterGoods() { return (this.master?.goods || []).map((item, sourceIndex) => ({ ...item, sourceIndex, label: [item.cargoName, item.cargoType].filter(Boolean).join(' / ') })); },
cargoTypeSelectOptions() {
return [...new Set((this.master?.goods || []).map(item => item.cargoType).filter(Boolean))];
},
dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; }, dateRange() { return this.master?.planStartTime && this.master?.planEndTime ? `${String(this.master.planStartTime).slice(0, 10)} ~ ${String(this.master.planEndTime).slice(0, 10)}` : '-'; },
pendingGroups() { pendingGroups() {
return this.pending.reduce((groups, item, index) => { return this.pending.reduce((groups, item, index) => {
@@ -251,12 +295,12 @@ export default {
}, },
methods: { methods: {
async load() { async load() {
if (!this.id) return;
this.loading = true; this.loading = true;
try { try {
const res = await api.getDetail(this.id); const res = await api.getDetail(this.id);
this.master = res.data?.data || res.data || res; this.master = res.data?.data || res.data || res;
await this.loadContractCurrency(); await this.loadContractCurrency();
this.cargoTypeOptions = this.buildMasterCargoTypeOptions(this.master.goods || []);
this.routes = this.dispatchRouteNodes().map((node, index) => this.createRoute(node, index)); this.routes = this.dispatchRouteNodes().map((node, index) => this.createRoute(node, index));
} finally { this.loading = false; } } finally { this.loading = false; }
}, },
@@ -318,46 +362,42 @@ export default {
this.syncFreightItems(route); this.syncFreightItems(route);
return route; return route;
}, },
buildMasterCargoTypeOptions(goods = []) {
return [...new Set(goods.map(item => item.cargoType).filter(Boolean))].map(cargoType => ({
id: cargoType,
cargoName: cargoType,
}));
},
masterGoodsByCargoType(row = {}) { masterGoodsByCargoType(row = {}) {
return this.masterGoods.filter(item => !row.cargoType || item.cargoType === row.cargoType); const cargoType = String(row.cargoType || '').trim();
if (!cargoType) return this.masterGoods;
const matched = this.masterGoods.filter(item => item.cargoType === cargoType);
return matched.length ? matched : this.masterGoods;
}, },
findCargoTypeByPath(path = []) { fetchCargoTypeSuggestions(queryString, callback) {
let options = this.cargoTypeOptions; const keyword = String(queryString || '').trim().toLowerCase();
let selected; const options = this.cargoTypeSelectOptions.map(item => ({ value: item }));
(path || []).forEach(id => { callback(
selected = (options || []).find(item => String(item.id) === String(id)); keyword ? options.filter(item => String(item.value).toLowerCase().includes(keyword)) : options
options = selected?.children || []; );
});
return selected;
}, },
findCargoTypePath(cargoType, options = this.cargoTypeOptions, parentPath = []) { handleCargoTypeSelect(route, row, item = {}) {
for (const option of options || []) { this.handleCargoTypeChange(route, row, item.value || '');
const path = [...parentPath, option.id];
if (option.cargoName === cargoType) return path;
if (option.children?.length) {
const result = this.findCargoTypePath(cargoType, option.children, path);
if (result.length) return result;
}
}
return [];
}, },
handleCargoTypeChange(route, row, value) { handleCargoTypeChange(route, row, value) {
const path = Array.isArray(value) ? value : []; row.cargoType = String(value ?? row.cargoType ?? '').trim();
const cargoType = this.findCargoTypeByPath(path); const matched = this.masterGoods.filter(item => item.cargoType === row.cargoType);
row.cargoTypePath = path; const firstGoods = matched[0];
row.cargoType = cargoType?.cargoName || '';
const firstGoods = this.masterGoodsByCargoType(row)[0];
if (firstGoods) { if (firstGoods) {
row.sourceIndex = firstGoods.sourceIndex; row.sourceIndex = firstGoods.sourceIndex;
this.selectGoods(route, row); this.selectGoods(route, row);
} else {
Object.assign(row, {
sourceIndex: undefined,
cargoName: '',
quantity: '',
quantityUnit: '',
packageType: '',
brand: '',
specification: '',
model: '',
materialCode: '',
});
} }
else Object.assign(row, { sourceIndex: undefined, cargoName: '', quantity: '', quantityUnit: '' });
this.syncFreightItems(route); this.syncFreightItems(route);
}, },
isRoad(route) { isRoad(route) {
@@ -542,53 +582,48 @@ export default {
); );
return false; return false;
}, },
pendingGoodsQuantity(route, row) {
const goodsIndex = this.masterGoodsIndex(row);
return this.pending.reduce((sum, item) => {
if (!this.isSameRouteSegment(route, item)) return sum;
const pendingGoodsIndex = this.masterGoodsIndex(item);
if (
(goodsIndex >= 0 && pendingGoodsIndex >= 0 && pendingGoodsIndex !== goodsIndex) ||
(goodsIndex < 0 && !this.isSameGoods(item, row))
) {
return sum;
}
return sum + this.quantityNumber(item.quantity);
}, 0);
},
isSameRouteSegment(route = {}, item = {}) { isSameRouteSegment(route = {}, item = {}) {
const routeSegment = route.segmentNo || route.relationNo || ''; const routeSegment = route.segmentNo || route.relationNo || '';
const itemSegment = item.segmentNo || item.relationNo || ''; const itemSegment = item.segmentNo || item.relationNo || '';
return String(routeSegment) === String(itemSegment); return String(routeSegment) === String(itemSegment);
}, },
editingGoodsQuantity(route, row) {
return (route.goods || []).reduce((sum, item) => {
if (item === row || !this.isSameGoods(item, row)) return sum;
return sum + this.quantityNumber(item.dispatchQuantity);
}, 0);
},
goodsRemainingQuantity(route, row) {
return Math.max(
0,
this.baseGoodsRemainingQuantity(route, row) -
this.pendingGoodsQuantity(route, row) -
this.editingGoodsQuantity(route, row)
);
},
availableDispatchQuantity(route, row) { return this.goodsRemainingQuantity(route, row); },
handleDispatchQuantityInput(route, row, value) { handleDispatchQuantityInput(route, row, value) {
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.'); const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
const nextValue = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer; row.dispatchQuantity =
const availableQuantity = this.availableDispatchQuantity(route, row); decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer;
if (Number(nextValue || 0) > availableQuantity) {
row.dispatchQuantity = this.formatQuantity(availableQuantity);
this.syncFreightItems(route);
this.$message.warning('本次数量不能超过剩余数量');
return;
}
row.dispatchQuantity = nextValue;
this.syncFreightItems(route); this.syncFreightItems(route);
}, },
validatePendingTotals() {
for (const route of this.routes) {
const items = this.pending.filter(item => this.isSameRouteSegment(route, item));
if (!items.length) continue;
if (!this.validatePreviousSegmentCompletedQuantity(route, [])) return false;
const totals = new Map();
for (const item of items) {
const index = this.masterGoodsIndex(item);
const key = index >= 0 ? `i:${index}` : this.goodsKey(item);
totals.set(key, (totals.get(key) || 0) + this.quantityNumber(item.quantity));
}
for (const [key, qty] of totals.entries()) {
if (!key.startsWith('i:')) continue;
const sourceIndex = Number(key.slice(2));
const masterGoods = this.master?.goods?.[sourceIndex];
if (!masterGoods) continue;
const available = this.baseGoodsRemainingQuantity(route, {
...masterGoods,
sourceIndex,
});
if (qty > available) {
this.$message.warning(
`${route.segmentNo}${masterGoods.cargoName || ''}」调度总量不能超过剩余数量(${this.formatQuantity(available)} ${masterGoods.quantityUnit || this.quantityUnitLabel}`
);
return false;
}
}
}
return true;
},
handleFreightUnitPriceInput(item, value) { handleFreightUnitPriceInput(item, value) {
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.'); const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
item.unitPrice = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 2)}` : integer; item.unitPrice = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 2)}` : integer;
@@ -618,7 +653,7 @@ export default {
const index = (route.goods || []).indexOf(item) + 1; const index = (route.goods || []).indexOf(item) + 1;
const fields = [ const fields = [
[!String(item.cargoName || '').trim() || item.sourceIndex === undefined || item.sourceIndex === null || item.sourceIndex === '', '货物名称'], [!String(item.cargoName || '').trim() || item.sourceIndex === undefined || item.sourceIndex === null || item.sourceIndex === '', '货物名称'],
[!String(item.cargoType || '').trim() && !(item.cargoTypePath || []).length, '货物类型'], [!String(item.cargoType || '').trim(), '货物类型'],
[item.dispatchQuantity === undefined || item.dispatchQuantity === null || item.dispatchQuantity === '' || Number(item.dispatchQuantity) <= 0, '本次数量'], [item.dispatchQuantity === undefined || item.dispatchQuantity === null || item.dispatchQuantity === '' || Number(item.dispatchQuantity) <= 0, '本次数量'],
[!String(item.quantityUnit || '').trim(), '数量单位'], [!String(item.quantityUnit || '').trim(), '数量单位'],
]; ];
@@ -650,7 +685,6 @@ export default {
return { return {
...goods, ...goods,
sourceIndex, sourceIndex,
cargoTypePath: this.findCargoTypePath(goods.cargoType),
dispatchQuantity: undefined, dispatchQuantity: undefined,
}; };
}, },
@@ -666,7 +700,8 @@ export default {
selectGoods(route, row) { selectGoods(route, row) {
const source = (this.master.goods || [])[Number(row.sourceIndex)]; const source = (this.master.goods || [])[Number(row.sourceIndex)];
if (!source) return; if (!source) return;
Object.assign(row, this.createGoodsRow(source, Number(row.sourceIndex))); const cargoType = String(row.cargoType || '').trim() || source.cargoType;
Object.assign(row, this.createGoodsRow(source, Number(row.sourceIndex)), { cargoType });
this.syncFreightItems(route); this.syncFreightItems(route);
}, },
removeGoods(route, index) { route.goods.splice(index, 1); this.syncFreightItems(route); }, removeGoods(route, index) { route.goods.splice(index, 1); this.syncFreightItems(route); },
@@ -854,8 +889,6 @@ export default {
const goods = route.goods.filter(item => Number(item.dispatchQuantity) > 0); const goods = route.goods.filter(item => Number(item.dispatchQuantity) > 0);
if (!goods.length) return this.$message.warning('请填写本次数量'); if (!goods.length) return this.$message.warning('请填写本次数量');
if (!this.validateDispatchGoods(route, goods)) return; if (!this.validateDispatchGoods(route, goods)) return;
if (goods.some(item => Number(item.dispatchQuantity) > this.availableDispatchQuantity(route, item))) return this.$message.warning('本次数量不能超过剩余数量');
if (!this.validatePreviousSegmentCompletedQuantity(route, goods)) return;
this.syncFreightItems(route); this.syncFreightItems(route);
if (!this.validateFreightItems(route)) return; if (!this.validateFreightItems(route)) return;
if (!this.validateRoutePhones(route)) return; if (!this.validateRoutePhones(route)) return;
@@ -954,6 +987,7 @@ export default {
async submit() { async submit() {
if (!this.pending.length) return this.$message.warning('请加入待提交调度清单'); if (!this.pending.length) return this.$message.warning('请加入待提交调度清单');
if (this.pending.some(item => !this.validateRoutePhones(item))) return; if (this.pending.some(item => !this.validateRoutePhones(item))) return;
if (!this.validatePendingTotals()) return;
this.submitting = true; this.submitting = true;
try { await api.dispatch({ id: this.master.id, dispatches: this.pending.map(({ id, ...item }) => ({ ...item, mileage: this.normalizeMileage(item.mileage) })) }); this.$message.success('调度成功'); this.$emit('back'); } finally { this.submitting = false; } try { await api.dispatch({ id: this.master.id, dispatches: this.pending.map(({ id, ...item }) => ({ ...item, mileage: this.normalizeMileage(item.mileage) })) }); this.$message.success('调度成功'); this.$emit('back'); } finally { this.submitting = false; }
}, },
@@ -985,7 +1019,7 @@ export default {
.transport-type-field :deep(.el-input) { width: 240px; } .transport-type-field :deep(.el-input) { width: 240px; }
.goods-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 -24px 12px; padding: 14px 24px; border-top: 1px solid #eff1f7; border-bottom: 1px solid #eff1f7; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } span { color: #909399; font-size: 13px; } } .goods-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 -24px 12px; padding: 14px 24px; border-top: 1px solid #eff1f7; border-bottom: 1px solid #eff1f7; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } span { color: #909399; font-size: 13px; } }
.freight-heading { margin: 16px 0 12px; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } } .freight-heading { margin: 16px 0 12px; h3 { margin: 0; padding-left: 12px; border-left: 4px solid #409eff; font-size: 16px; } }
.goods-table { :deep(th.el-table__cell), :deep(td.el-table__cell) { border-color: #eff1f7; } :deep(.el-table__row--striped td.el-table__cell) { background: #fafafa; } :deep(.goods-table__remaining .cell) { white-space: nowrap; } :deep(.goods-table__dispatch .el-input) { width: 100%; min-width: 0; } :deep(.goods-table__cargo-type .el-input__inner), :deep(.goods-table__cargo-name .el-select__selected-item) { color: #303133; } } .goods-table { :deep(th.el-table__cell), :deep(td.el-table__cell) { border-color: #eff1f7; } :deep(.el-table__row--striped td.el-table__cell) { background: #fafafa; } :deep(.goods-table__dispatch .el-input) { width: 100%; min-width: 0; } :deep(.goods-table__cargo-type), :deep(.goods-table__cargo-name) { width: 100%; } :deep(.goods-table__cargo-type .el-input__inner), :deep(.goods-table__cargo-name .el-select__selected-item) { color: #303133; } }
.goods-required-mark { margin-left: 2px; color: #f56c6c; } .goods-required-mark { margin-left: 2px; color: #f56c6c; }
.freight-form { :deep(.freight-unit-select) { width: 92px; flex: 0 0 92px; min-width: 0; } } .freight-form { :deep(.freight-unit-select) { width: 92px; flex: 0 0 92px; min-width: 0; } }
.carrier-type-form { margin-top: 16px; } .carrier-type-form { margin-top: 16px; }
@@ -146,8 +146,9 @@
/> />
<el-input <el-input
v-model="form.departureAddress" v-model="form.departureAddress"
placeholder="请输入发货地址" class="shipping-template-page__address-map-input"
:readonly="transportStationMode || !config.editableRoadAddress" readonly
placeholder="请选择发货地址"
:disabled="transportAddressSelectDisabled" :disabled="transportAddressSelectDisabled"
@click="handleTransportSecondaryAddressInputClick('departure')" @click="handleTransportSecondaryAddressInputClick('departure')"
> >
@@ -189,8 +190,9 @@
/> />
<el-input <el-input
v-model="form.arrivalAddress" v-model="form.arrivalAddress"
placeholder="请输入收货地址" class="shipping-template-page__address-map-input"
:readonly="transportStationMode || !config.editableRoadAddress" readonly
placeholder="请选择收货地址"
:disabled="transportAddressSelectDisabled" :disabled="transportAddressSelectDisabled"
@click="handleTransportSecondaryAddressInputClick('arrival')" @click="handleTransportSecondaryAddressInputClick('arrival')"
> >
@@ -1131,7 +1133,7 @@ const defaultCargo = () => ({
cargoTypePath: [], cargoTypePath: [],
packageType: '', packageType: '',
quantity: '', quantity: '',
quantityUnit: '', quantityUnit: '',
brand: '', brand: '',
specification: '', specification: '',
model: '', model: '',
@@ -1258,6 +1260,7 @@ export default {
crudDialogType: '', crudDialogType: '',
standaloneFormKey: '', standaloneFormKey: '',
copyingRow: null, copyingRow: null,
suppressTransportTypeClear: false,
detailBox: false, detailBox: false,
detailLoading: false, detailLoading: false,
detailRow: {}, detailRow: {},
@@ -1511,10 +1514,10 @@ export default {
}, },
}, },
'form.transportType'(value, oldValue) { 'form.transportType'(value, oldValue) {
if (value !== oldValue) { if (this.suppressTransportTypeClear) return;
this.handleTransportTypeChange(value); if (String(value ?? '') === String(oldValue ?? '')) return;
this.syncFreightItems(); this.handleTransportTypeChange(value);
} this.syncFreightItems();
}, },
}, },
created() { created() {
@@ -1527,6 +1530,20 @@ export default {
methods: { methods: {
buildOption(option) { buildOption(option) {
const next = { ...option, column: (option.column || []).map(column => ({ ...column })) }; const next = { ...option, column: (option.column || []).map(column => ({ ...column })) };
const tableOrder = this.config.tableColumnOrder || [];
if (tableOrder.length) {
const orderMap = new Map(tableOrder.map((prop, index) => [prop, index]));
next.column.sort((left, right) => {
const leftOrder = orderMap.has(left.prop) ? orderMap.get(left.prop) : tableOrder.length;
const rightOrder = orderMap.has(right.prop)
? orderMap.get(right.prop)
: tableOrder.length;
return leftOrder - rightOrder;
});
next.column.forEach(column => {
if (column.prop) column.hide = !orderMap.has(column.prop);
});
}
if (this.menuWidth != null) next.menuWidth = this.menuWidth; if (this.menuWidth != null) next.menuWidth = this.menuWidth;
if ( if (
this.standaloneFormPage && this.standaloneFormPage &&
@@ -1790,6 +1807,7 @@ export default {
console.log('进入复制模式分支'); console.log('进入复制模式分支');
const copyData = { ...this.copyingRow }; const copyData = { ...this.copyingRow };
this.copyingRow = null; this.copyingRow = null;
this.suppressTransportTypeClear = true;
this.form = { ...(this.config.defaultForm || {}), ...copyData }; this.form = { ...(this.config.defaultForm || {}), ...copyData };
console.log('合并后的 form:', this.form); console.log('合并后的 form:', this.form);
// //
@@ -1842,7 +1860,11 @@ export default {
done?.(); done?.();
}, },
applyFormDetail(row) { applyFormDetail(row) {
this.suppressTransportTypeClear = true;
this.form = { ...(row || {}) }; this.form = { ...(row || {}) };
this.$nextTick(() => {
this.suppressTransportTypeClear = false;
});
this.selectedProjectId = this.form.projectId || ''; this.selectedProjectId = this.form.projectId || '';
this.transportCargoRows = this.parseJsonArray(this.form.goodsJson).map(item => this.transportCargoRows = this.parseJsonArray(this.form.goodsJson).map(item =>
this.normalizeCargo(item) this.normalizeCargo(item)
@@ -1924,14 +1946,6 @@ export default {
this.$message.warning(`${index + 1}行货物类型不能为空`); this.$message.warning(`${index + 1}行货物类型不能为空`);
return false; return false;
} }
if (!String(row.cargoName || '').trim() || !row.quantity || !row.quantityUnit) {
this.$message.warning(`${index + 1}行货物信息不完整`);
return false;
}
if (Number(row.quantity) <= 0) {
this.$message.warning(`${index + 1}行数量必须大于0`);
return false;
}
if (String(row.remark || '').length > 200) { if (String(row.remark || '').length > 200) {
this.$message.warning(`${index + 1}行备注不能超过200个字符`); this.$message.warning(`${index + 1}行备注不能超过200个字符`);
return false; return false;
@@ -2013,6 +2027,8 @@ export default {
delete detail.updateUser; delete detail.updateUser;
delete detail.updateUserName; delete detail.updateUserName;
delete detail.status; delete detail.status;
// -
detail.templateName = `${detail.templateName || ''}-副本`;
console.log('处理后的数据:', detail); console.log('处理后的数据:', detail);
console.log('isStandaloneBusinessPage:', this.isStandaloneBusinessPage); console.log('isStandaloneBusinessPage:', this.isStandaloneBusinessPage);
@@ -2286,13 +2302,60 @@ export default {
}, },
handleTransportTypeChange(value) { handleTransportTypeChange(value) {
this.form.transportTypeName = this.getTransportTypeLabel(value); this.form.transportTypeName = this.getTransportTypeLabel(value);
this.clearTransportShippingInfo();
},
clearTransportShippingInfo() {
[
'departureName',
'departureAddress',
'departureAddressCode',
'departureSiteCode',
'departureLongitude',
'departureLatitude',
'departureContact',
'departurePhone',
'arrivalName',
'arrivalAddress',
'arrivalAddressCode',
'arrivalSiteCode',
'arrivalLongitude',
'arrivalLatitude',
'arrivalContact',
'arrivalPhone',
].forEach(prop => {
this.form[prop] = '';
});
this.transportMapSelected = {};
this.transportRouteBox = false;
this.transportAddressBox = false;
this.transportStationBox = false;
this.transportMapBox = false;
this.transportAddressTarget = '';
this.transportStationTarget = '';
this.transportMapTarget = '';
this.transportMapKeyword = '';
this.transportMapStatus = '可搜索地址或点击地图选点';
if (this.transportAmapMarker) {
this.transportAmapMarker.setMap(null);
this.transportAmapMarker = null;
}
this.$refs.crud?.clearValidate?.([
'departureAddress',
'arrivalAddress',
'departureName',
'arrivalName',
'departureContact',
'departurePhone',
'arrivalContact',
'arrivalPhone',
]);
}, },
openTransportPrimaryAddressPicker(target) { openTransportPrimaryAddressPicker(target) {
if (this.transportStationMode) this.openTransportStationDialog(target); if (this.transportStationMode) this.openTransportStationDialog(target);
}, },
handleTransportSecondaryAddressInputClick(target) { handleTransportSecondaryAddressInputClick(target) {
if (this.transportStationMode || !this.config.editableRoadAddress) if (this.transportAddressSelectDisabled) return;
this.openTransportSecondaryAddressPicker(target); this.openTransportSecondaryAddressPicker(target);
}, },
openTransportSecondaryAddressPicker(target) { openTransportSecondaryAddressPicker(target) {
this.transportStationMode this.transportStationMode
@@ -3328,6 +3391,13 @@ export default {
gap: 8px; gap: 8px;
align-items: center; align-items: center;
} }
.shipping-template-page__address-map-input {
cursor: pointer;
:deep(.el-input__wrapper),
:deep(.el-input__inner) {
cursor: pointer;
}
}
.shipping-template-page__section-actions { .shipping-template-page__section-actions {
display: flex; display: flex;
gap: 12px; gap: 12px;
@@ -85,15 +85,23 @@
</template> </template>
<template #departureAddress="{ row }"> <template #departureAddress="{ row }">
<el-tooltip v-if="row.departureAddress" :content="row.departureAddress" placement="top"> <el-tooltip
<span>{{ formatTransportPlanProvinceCityDistrict(row.departureAddress) }}</span> v-if="row.departureAddress || row.departureName"
:content="row.departureAddress || row.departureName"
placement="top"
>
<span>{{ formatTransportPlanListAddress(row, 'departure') }}</span>
</el-tooltip> </el-tooltip>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
<template #arrivalAddress="{ row }"> <template #arrivalAddress="{ row }">
<el-tooltip v-if="row.arrivalAddress" :content="row.arrivalAddress" placement="top"> <el-tooltip
<span>{{ formatTransportPlanProvinceCityDistrict(row.arrivalAddress) }}</span> v-if="row.arrivalAddress || row.arrivalName"
:content="row.arrivalAddress || row.arrivalName"
placement="top"
>
<span>{{ formatTransportPlanListAddress(row, 'arrival') }}</span>
</el-tooltip> </el-tooltip>
<span v-else>-</span> <span v-else>-</span>
</template> </template>
@@ -574,7 +582,7 @@
> >
<el-link <el-link
type="primary" type="primary"
v-if="hasPermission(`${config.permission}_view`) && !showDetailButton(row)" v-if="showViewButton(row)"
@click="$refs.crud.rowView(row, index)" @click="$refs.crud.rowView(row, index)"
> >
查看 查看
@@ -1223,7 +1231,7 @@
{{ dispatchDialogStatusText }} {{ dispatchDialogStatusText }}
</el-tag> </el-tag>
<el-tag type="primary" effect="light"> <el-tag type="primary" effect="light">
{{ formatDispatchTransportType(dispatchRow.transportType) || '公路整车' }} {{ formatDispatchTransportType(dispatchRow.transportType) || '公路运输' }}
</el-tag> </el-tag>
</div> </div>
</div> </div>
@@ -1492,27 +1500,38 @@
<el-input <el-input
v-model="dispatchItemForm.departureName" v-model="dispatchItemForm.departureName"
:placeholder="dispatchStationNamePlaceholder" :placeholder="dispatchStationNamePlaceholder"
:suffix-icon="dispatchStationMode ? Search : undefined" :readonly="dispatchStationMode"
disabled @click="openDispatchPrimaryAddressPicker('departure')"
/> >
<template v-if="dispatchStationMode" #suffix>
<el-icon
class="transport-plan-page__map-suffix"
@click.stop="openDispatchSecondaryAddressPicker('departure')"
>
<Search />
</el-icon>
</template>
</el-input>
<el-input <el-input
v-model="dispatchItemForm.departureAddress" v-model="dispatchItemForm.departureAddress"
:placeholder="dispatchAddressDetailPlaceholder" :placeholder="dispatchAddressDetailPlaceholder"
disabled :readonly="dispatchStationMode"
@click="handleDispatchSecondaryAddressInputClick('departure')"
> >
<template v-if="!dispatchStationMode" #suffix> <template v-if="!dispatchStationMode" #suffix>
<el-link <el-link
type="primary" type="primary"
:underline="false" :underline="false"
class="transport-plan-page__address-choose-link" class="transport-plan-page__address-choose-link"
@click.stop="openTransportMapDialog('departure')"
>选择</el-link >选择</el-link
> >
</template> </template>
</el-input> </el-input>
<span class="transport-plan-page__route-label">联系人</span> <span class="transport-plan-page__route-label">联系人</span>
<el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" disabled /> <el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" />
<span class="transport-plan-page__route-label">联系方式</span> <span class="transport-plan-page__route-label">联系方式</span>
<el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" disabled /> <el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="收货地址" required> <el-form-item label="收货地址" required>
@@ -1520,27 +1539,38 @@
<el-input <el-input
v-model="dispatchItemForm.arrivalName" v-model="dispatchItemForm.arrivalName"
:placeholder="dispatchStationNamePlaceholder" :placeholder="dispatchStationNamePlaceholder"
:suffix-icon="dispatchStationMode ? Search : undefined" :readonly="dispatchStationMode"
disabled @click="openDispatchPrimaryAddressPicker('arrival')"
/> >
<template v-if="dispatchStationMode" #suffix>
<el-icon
class="transport-plan-page__map-suffix"
@click.stop="openDispatchSecondaryAddressPicker('arrival')"
>
<Search />
</el-icon>
</template>
</el-input>
<el-input <el-input
v-model="dispatchItemForm.arrivalAddress" v-model="dispatchItemForm.arrivalAddress"
:placeholder="dispatchAddressDetailPlaceholder" :placeholder="dispatchAddressDetailPlaceholder"
disabled :readonly="dispatchStationMode"
@click="handleDispatchSecondaryAddressInputClick('arrival')"
> >
<template v-if="!dispatchStationMode" #suffix> <template v-if="!dispatchStationMode" #suffix>
<el-link <el-link
type="primary" type="primary"
:underline="false" :underline="false"
class="transport-plan-page__address-choose-link" class="transport-plan-page__address-choose-link"
@click.stop="openTransportMapDialog('arrival')"
>选择</el-link >选择</el-link
> >
</template> </template>
</el-input> </el-input>
<span class="transport-plan-page__route-label">联系人</span> <span class="transport-plan-page__route-label">联系人</span>
<el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" disabled /> <el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" />
<span class="transport-plan-page__route-label">联系方式</span> <span class="transport-plan-page__route-label">联系方式</span>
<el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" disabled /> <el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" />
</div> </div>
</el-form-item> </el-form-item>
</div> </div>
@@ -1576,20 +1606,15 @@
><span class="transport-plan-page__required-column">货物类型</span></template ><span class="transport-plan-page__required-column">货物类型</span></template
> >
<template #default="{ row }"> <template #default="{ row }">
<el-select <el-autocomplete
v-model="row.cargoType" v-model="row.cargoType"
placeholder="请选择货物类型" placeholder="请输入货物类型"
clearable clearable
filterable :debounce="300"
:fetch-suggestions="fetchDispatchConfiguredCargoTypeSuggestions"
@select="item => handleDispatchConfiguredCargoTypeSelect(row, item)"
@change="value => handleDispatchConfiguredCargoTypeChange(row, value)" @change="value => handleDispatchConfiguredCargoTypeChange(row, value)"
> />
<el-option
v-for="item in getDispatchConfiguredCargoTypeOptions()"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column min-width="240" align="center"> <el-table-column min-width="240" align="center">
@@ -1597,20 +1622,18 @@
><span class="transport-plan-page__required-column">货物名称</span></template ><span class="transport-plan-page__required-column">货物名称</span></template
> >
<template #default="{ row }"> <template #default="{ row }">
<el-select <el-autocomplete
v-model="row.cargoName" v-model="row.cargoName"
placeholder="请选择货物名称" placeholder="请输入货物名称"
clearable clearable
filterable :debounce="300"
:fetch-suggestions="
(queryString, callback) =>
fetchDispatchConfiguredCargoNameSuggestions(queryString, callback, row)
"
@select="item => handleDispatchConfiguredCargoNameSelect(row, item)"
@change="value => handleDispatchConfiguredCargoNameChange(row, value)" @change="value => handleDispatchConfiguredCargoNameChange(row, value)"
> />
<el-option
v-for="item in getDispatchConfiguredCargoNameOptions(row)"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="包装" min-width="130" align="center"> <el-table-column label="包装" min-width="130" align="center">
@@ -1627,7 +1650,11 @@
</el-table-column> </el-table-column>
<el-table-column label="剩余数量" min-width="130" align="center"> <el-table-column label="剩余数量" min-width="130" align="center">
<template #default="{ row }"> <template #default="{ row }">
{{ formatDispatchQuantity(dispatchItemRemainingQuantity(row)) }} {{
isDispatchPlanQuantityUnlimited(row)
? '-'
: formatDispatchQuantity(dispatchItemRemainingQuantity(row))
}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column min-width="130" align="center"> <el-table-column min-width="130" align="center">
@@ -1848,36 +1875,33 @@
<el-input v-model="dispatchItemForm.escortPhone" placeholder="请输入" /> <el-input v-model="dispatchItemForm.escortPhone" placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="货物类型" required> <el-form-item label="货物类型" required>
<el-select <el-autocomplete
v-model="dispatchItemForm.cargoType" v-model="dispatchItemForm.cargoType"
placeholder="请选择货物类型" placeholder="请输入货物类型"
clearable clearable
filterable :debounce="300"
@change="handleDispatchConfiguredCargoTypeChange(dispatchItemForm, $event)" :fetch-suggestions="fetchDispatchConfiguredCargoTypeSuggestions"
> @select="item => handleDispatchConfiguredCargoTypeSelect(dispatchItemForm, item)"
<el-option @change="value => handleDispatchConfiguredCargoTypeChange(dispatchItemForm, value)"
v-for="item in getDispatchConfiguredCargoTypeOptions()" />
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="货物名称" required> <el-form-item label="货物名称" required>
<el-select <el-autocomplete
v-model="dispatchItemForm.cargoName" v-model="dispatchItemForm.cargoName"
placeholder="请选择货物名称" placeholder="请输入货物名称"
clearable clearable
filterable :debounce="300"
@change="handleDispatchConfiguredCargoNameChange(dispatchItemForm, $event)" :fetch-suggestions="
> (queryString, callback) =>
<el-option fetchDispatchConfiguredCargoNameSuggestions(
v-for="item in getDispatchConfiguredCargoNameOptions(dispatchItemForm)" queryString,
:key="item.value" callback,
:label="item.label" dispatchItemForm
:value="item.value" )
/> "
</el-select> @select="item => handleDispatchConfiguredCargoNameSelect(dispatchItemForm, item)"
@change="value => handleDispatchConfiguredCargoNameChange(dispatchItemForm, value)"
/>
</el-form-item> </el-form-item>
<el-form-item label="规格"> <el-form-item label="规格">
<el-input v-model="dispatchItemForm.specification" placeholder="请输入" /> <el-input v-model="dispatchItemForm.specification" placeholder="请输入" />
@@ -1902,7 +1926,10 @@
</el-select> </el-select>
</template> </template>
</el-input> </el-input>
<div class="transport-plan-page__dispatch-quantity-hint"> <div
v-if="!isDispatchPlanQuantityUnlimited(dispatchItemForm)"
class="transport-plan-page__dispatch-quantity-hint"
>
剩余数量{{ 剩余数量{{
formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm)) formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm))
}} }}
@@ -2993,6 +3020,10 @@ export default {
Location, Location,
OfficeBuilding, OfficeBuilding,
Search, Search,
// watcher /
// dataOptions API data computed watch(immediate) created
// created immediate watcher
routePathLocked: this.$route.path,
form: {}, form: {},
suppressTransportTypeClear: false, suppressTransportTypeClear: false,
query: {}, query: {},
@@ -3412,15 +3443,21 @@ export default {
})); }));
}, },
dispatchHasAddableQuantity() { dispatchHasAddableQuantity() {
return this.dispatchTableQuantityItems.some( const items = this.dispatchTableQuantityItems;
item => item.total > 0 && item.listed < item.total - 1e-8 if (!items.length) return true;
); // 0
if (items.every(item => item.total <= 0)) return true;
return items.some(item => item.total > 0 && item.listed < item.total - 1e-8);
}, },
dispatchSummaryText() { dispatchSummaryText() {
const formatSummary = field => const formatSummary = field =>
this.dispatchSummaryItems this.dispatchSummaryItems
.map(item => `${this.formatDispatchQuantity(item[field])}${item.unit}`) .map(item => `${this.formatDispatchQuantity(item[field])}${item.unit}`)
.join('、'); .join('、');
const unlimited = this.dispatchSummaryItems.every(item => item.total <= 0);
if (unlimited) {
return `已调度 ${formatSummary('assigned') || `0${TRANSPORT_PLAN_QUANTITY_UNIT}`}`;
}
return `${formatSummary('total')} | 已调度 ${formatSummary( return `${formatSummary('total')} | 已调度 ${formatSummary(
'assigned' 'assigned'
)}剩余${formatSummary('remaining')}`; )}剩余${formatSummary('remaining')}`;
@@ -3563,6 +3600,11 @@ export default {
!this.dialogReadonly !this.dialogReadonly
); );
}, },
// tab.js fullPath path
// keep-alive $route id
isOwnedRouteActive() {
return this.$route.path === this.routePathLocked;
},
billingCargoTypeCascaderProps() { billingCargoTypeCascaderProps() {
return { return {
label: 'cargoName', label: 'cargoName',
@@ -3606,12 +3648,13 @@ export default {
return ['water', 'rail', 'air'].includes(this.transportMode); return ['water', 'rail', 'air'].includes(this.transportMode);
}, },
transportStationTypeLabel() { transportStationTypeLabel() {
const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode;
const labelMap = { const labelMap = {
water: '港口/码头', water: '港口/码头',
rail: '铁路车站', rail: '铁路车站',
air: '空港机场', air: '空港机场',
}; };
return labelMap[this.transportMode] || ''; return labelMap[mode] || '';
}, },
transportStationNamePlaceholder() { transportStationNamePlaceholder() {
if (!this.transportStationMode) return '行政区划自动带出'; if (!this.transportStationMode) return '行政区划自动带出';
@@ -3639,6 +3682,9 @@ export default {
detailId: { detailId: {
immediate: true, immediate: true,
handler(id) { handler(id) {
// 宿 view $route.query.detailId
// id
if (!this.isOwnedRouteActive) return;
if (id !== undefined && id !== null && id !== '') { if (id !== undefined && id !== null && id !== '') {
this.$nextTick(() => this.openDetail({ id })); this.$nextTick(() => this.openDetail({ id }));
} }
@@ -3798,6 +3844,37 @@ export default {
const cityMatch = text.match(/市/); const cityMatch = text.match(/市/);
return cityMatch ? text.slice(0, cityMatch.index + 1) : text; return cityMatch ? text.slice(0, cityMatch.index + 1) : text;
}, },
formatTransportPlanListAddress(row = {}, field) {
const address = String(row[`${field}Address`] || '').trim();
const name = String(row[`${field}Name`] || '').trim();
const fromAddress = this.extractTransportPlanProvinceCityDistrict(address);
if (fromAddress) return fromAddress;
const fromName = this.extractTransportPlanProvinceCityDistrict(name);
if (fromName) return fromName;
return name || address || '-';
},
extractTransportPlanProvinceCityDistrict(value) {
const text = String(value || '')
.trim()
.replace(/[\\/||、,\s]+/g, '');
if (!text) return '';
const districtPattern = '(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗)';
const parts = [];
let remainder = text;
const province = text.match(/^(.+?(?:省|自治区|特别行政区))/);
if (province) {
parts.push(province[1]);
remainder = text.slice(province[1].length);
}
const city = remainder.match(/^(.+?市)/);
if (city) {
parts.push(city[1]);
remainder = remainder.slice(city[1].length);
}
const district = remainder.match(new RegExp(`^(.+?${districtPattern})`));
if (district) parts.push(district[1]);
return parts.length ? parts.join('/') : '';
},
formatTransportPlanRoadCityDistrict(value) { formatTransportPlanRoadCityDistrict(value) {
const text = String(value || '').trim(); const text = String(value || '').trim();
if (!text) return '-'; if (!text) return '-';
@@ -3955,6 +4032,11 @@ export default {
const status = this.statusValue(row); const status = this.statusValue(row);
return status !== 'draft'; return status !== 'draft';
}, },
showViewButton(row) {
if (!this.hasPermission(`${this.config.permission}_view`)) return false;
if (this.statusValue(row) === 'draft') return false;
return !this.showDetailButton(row);
},
formatDetailValue(row, prop) { formatDetailValue(row, prop) {
if (!row) return '-'; if (!row) return '-';
if (prop === 'businessStatus') return this.displayStatus(row, prop); if (prop === 'businessStatus') return this.displayStatus(row, prop);
@@ -4540,6 +4622,37 @@ export default {
getDispatchRemainingQuantity(unit) { getDispatchRemainingQuantity(unit) {
return this.getDispatchSummaryItem(unit)?.remaining || 0; return this.getDispatchSummaryItem(unit)?.remaining || 0;
}, },
/** 计划总量为 0 时不限制调度数量 */
isDispatchPlanQuantityUnlimited(row = {}) {
const unit = this.getDispatchQuantityUnit(row);
const hasCargoIdentity = Boolean(
String(row.cargoName || row.goodsName || row.name || '').trim() ||
String(row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || '').trim()
);
const planGoodsRows = this.dispatchPlanGoodsRows;
if (planGoodsRows.length && hasCargoIdentity) {
const cargoKey = this.getDispatchCargoIdentity(row);
const matchedPlanRows = planGoodsRows.filter(
goods => this.getDispatchCargoIdentity(goods) === cargoKey
);
if (!matchedPlanRows.length) {
return (this.getDispatchSummaryItem(unit)?.total || 0) <= 0;
}
const total = matchedPlanRows.reduce(
(sum, goods) =>
sum +
this.parseDispatchQuantity(
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
),
0
);
return total <= 0;
}
if (!planGoodsRows.length) {
return Number(this.dispatchRow.totalQuantity || this.dispatchRow.quantity || 0) <= 0;
}
return (this.getDispatchSummaryItem(unit)?.total || 0) <= 0;
},
formatDispatchQuantity(value) { formatDispatchQuantity(value) {
const number = Number(value || 0); const number = Number(value || 0);
if (!Number.isFinite(number)) return '0'; if (!Number.isFinite(number)) return '0';
@@ -5238,6 +5351,13 @@ export default {
} }
}, },
ensureTransportTypeBeforeAddress() { ensureTransportTypeBeforeAddress() {
if (this.dispatchItemBox) {
const transportType =
this.dispatchItemForm.transportType || this.dispatchRow?.transportType || '';
if (!this.isBillingFieldEmpty(transportType)) return true;
this.$message.warning('请先选择运输方式');
return false;
}
if (!this.shippingInfoFormEnabled || !this.isBillingFieldEmpty(this.form.transportType)) { if (!this.shippingInfoFormEnabled || !this.isBillingFieldEmpty(this.form.transportType)) {
return true; return true;
} }
@@ -5314,19 +5434,21 @@ export default {
}, },
openTransportStationDialog(target) { openTransportStationDialog(target) {
if (!this.ensureTransportTypeBeforeAddress()) return; if (!this.ensureTransportTypeBeforeAddress()) return;
if (!this.transportStationMode) return; const stationMode = this.dispatchItemBox ? this.dispatchStationMode : this.transportStationMode;
if (!stationMode) return;
this.transportStationTarget = target; this.transportStationTarget = target;
this.transportStationQuery = {}; this.transportStationQuery = {};
this.transportStationPage.currentPage = 1; this.transportStationPage.currentPage = 1;
this.transportStationBox = true; this.transportStationBox = true;
}, },
getTransportStationListRequest() { getTransportStationListRequest() {
const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode;
const requestMap = { const requestMap = {
water: getPortTerminalList, water: getPortTerminalList,
rail: getRailwayStationList, rail: getRailwayStationList,
air: getAirportMasterList, air: getAirportMasterList,
}; };
return requestMap[this.transportMode]; return requestMap[mode];
}, },
loadTransportStationList() { loadTransportStationList() {
const request = this.getTransportStationListRequest(); const request = this.getTransportStationListRequest();
@@ -5436,7 +5558,28 @@ export default {
water: '港口/码头', water: '港口/码头',
air: '空港机场', air: '空港机场',
}; };
return typeMap[this.transportMode] || ''; const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode;
return typeMap[mode] || '';
},
getTransportAddressForm() {
return this.dispatchItemBox ? this.dispatchItemForm : this.form;
},
openDispatchPrimaryAddressPicker(target) {
if (this.dispatchStationMode) {
this.openTransportStationDialog(target);
}
},
openDispatchSecondaryAddressPicker(target) {
if (this.dispatchStationMode) {
this.openTransportStationDialog(target);
return;
}
this.openTransportMapDialog(target);
},
handleDispatchSecondaryAddressInputClick(target) {
if (this.dispatchStationMode) {
this.openDispatchSecondaryAddressPicker(target);
}
}, },
loadTransportAddressList() { loadTransportAddressList() {
this.transportAddressLoading = true; this.transportAddressLoading = true;
@@ -5487,35 +5630,39 @@ export default {
}, },
applyTransportAddress(target, address = {}) { applyTransportAddress(target, address = {}) {
const prefix = target === 'departure' ? 'departure' : 'arrival'; const prefix = target === 'departure' ? 'departure' : 'arrival';
this.form[`${prefix}Name`] = address.preferRegionName const addressForm = this.getTransportAddressForm();
addressForm[`${prefix}Name`] = address.preferRegionName
? address.regionName || address.addressName || '' ? address.regionName || address.addressName || ''
: address.addressName || address.regionName || ''; : address.addressName || address.regionName || '';
this.form[`${prefix}Address`] = address.detailAddress || address.address || ''; addressForm[`${prefix}Address`] = address.detailAddress || address.address || '';
this.form[`${prefix}AddressCode`] = address.addressCode || ''; addressForm[`${prefix}AddressCode`] = address.addressCode || '';
this.form[`${prefix}SiteCode`] = addressForm[`${prefix}SiteCode`] =
address.addressType === '常规地址' address.addressType === '常规地址'
? '/' ? '/'
: address.siteCodeDisplay || address.siteCode || ''; : address.siteCodeDisplay || address.siteCode || '';
this.form[`${prefix}Longitude`] = address.longitude || ''; addressForm[`${prefix}Longitude`] = address.longitude || '';
this.form[`${prefix}Latitude`] = address.latitude || ''; addressForm[`${prefix}Latitude`] = address.latitude || '';
this.form[`${prefix}Contact`] = address.contactName || this.form[`${prefix}Contact`] || ''; addressForm[`${prefix}Contact`] =
this.form[`${prefix}Phone`] = address.contactPhone || this.form[`${prefix}Phone`] || ''; address.contactName || addressForm[`${prefix}Contact`] || '';
addressForm[`${prefix}Phone`] = address.contactPhone || addressForm[`${prefix}Phone`] || '';
// Avue // Avue
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.crud?.clearValidate?.([`${prefix}Address`]); this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
}); });
}, },
openTransportMapDialog(target) { openTransportMapDialog(target) {
if (this.dialogReadonly) return; if (this.dialogReadonly && !this.dispatchItemBox) return;
if (!this.ensureTransportTypeBeforeAddress()) return; if (!this.ensureTransportTypeBeforeAddress()) return;
const prefix = target === 'departure' ? 'departure' : 'arrival'; const prefix = target === 'departure' ? 'departure' : 'arrival';
const addressForm = this.getTransportAddressForm();
this.transportMapTarget = prefix; this.transportMapTarget = prefix;
this.transportMapKeyword = this.form[`${prefix}Address`] || this.form[`${prefix}Name`] || ''; this.transportMapKeyword =
addressForm[`${prefix}Address`] || addressForm[`${prefix}Name`] || '';
this.transportMapSelected = this.buildTransportMapSelection({ this.transportMapSelected = this.buildTransportMapSelection({
lng: this.form[`${prefix}Longitude`], lng: addressForm[`${prefix}Longitude`],
lat: this.form[`${prefix}Latitude`], lat: addressForm[`${prefix}Latitude`],
address: this.form[`${prefix}Address`], address: addressForm[`${prefix}Address`],
regionName: this.form[`${prefix}Name`], regionName: addressForm[`${prefix}Name`],
}); });
this.transportMapStatus = this.transportMapSelected.longitude this.transportMapStatus = this.transportMapSelected.longitude
? '已加载当前选点,可重新选点' ? '已加载当前选点,可重新选点'
@@ -5673,12 +5820,13 @@ export default {
return; return;
} }
const prefix = this.transportMapTarget; const prefix = this.transportMapTarget;
this.form[`${prefix}Address`] = const addressForm = this.getTransportAddressForm();
this.transportMapSelected.detailAddress || this.form[`${prefix}Address`]; addressForm[`${prefix}Address`] =
this.form[`${prefix}Name`] = this.transportMapSelected.detailAddress || addressForm[`${prefix}Address`];
this.transportMapSelected.regionName || this.form[`${prefix}Name`]; addressForm[`${prefix}Name`] =
this.form[`${prefix}Longitude`] = this.transportMapSelected.longitude; this.transportMapSelected.regionName || addressForm[`${prefix}Name`];
this.form[`${prefix}Latitude`] = this.transportMapSelected.latitude; addressForm[`${prefix}Longitude`] = this.transportMapSelected.longitude;
addressForm[`${prefix}Latitude`] = this.transportMapSelected.latitude;
this.transportMapBox = false; this.transportMapBox = false;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.crud?.clearValidate?.([`${prefix}Address`]); this.$refs.crud?.clearValidate?.([`${prefix}Address`]);
@@ -7287,8 +7435,9 @@ export default {
item.cargoTypePath.join('/') === rowTypePath.join('/') item.cargoTypePath.join('/') === rowTypePath.join('/')
) )
: goodsOptions; : goodsOptions;
const source = filtered.length ? filtered : goodsOptions;
const options = new Map(); const options = new Map();
filtered.forEach(item => { source.forEach(item => {
if (!item.cargoName || options.has(item.cargoName)) return; if (!item.cargoName || options.has(item.cargoName)) return;
options.set(item.cargoName, { options.set(item.cargoName, {
label: item.cargoName, label: item.cargoName,
@@ -7302,26 +7451,73 @@ export default {
}); });
return Array.from(options.values()); return Array.from(options.values());
}, },
handleDispatchConfiguredCargoTypeChange(row, value) { fetchDispatchConfiguredCargoTypeSuggestions(queryString, callback) {
const option = this.getDispatchConfiguredCargoTypeOptions().find( const keyword = String(queryString || '').trim().toLowerCase();
item => String(item.value) === String(value || '') const options = this.getDispatchConfiguredCargoTypeOptions().map(item => ({
...item,
value: item.label,
}));
callback(
keyword
? options.filter(item => String(item.value).toLowerCase().includes(keyword))
: options
); );
row.cargoType = option?.label || ''; },
row.cargoTypeCode = option?.cargoTypeCode || ''; fetchDispatchConfiguredCargoNameSuggestions(queryString, callback, row = {}) {
row.cargoTypePath = option?.cargoTypePath || []; const keyword = String(queryString || '').trim().toLowerCase();
const options = this.getDispatchConfiguredCargoNameOptions(row).map(item => ({
...item,
value: item.label,
}));
callback(
keyword
? options.filter(item => String(item.value).toLowerCase().includes(keyword))
: options
);
},
handleDispatchConfiguredCargoTypeSelect(row, item = {}) {
this.handleDispatchConfiguredCargoTypeChange(row, item.value || item.label || '');
},
handleDispatchConfiguredCargoNameSelect(row, item = {}) {
this.handleDispatchConfiguredCargoNameChange(row, item.value || item.label || '');
},
handleDispatchConfiguredCargoTypeChange(row, value) {
const nextValue = String(value ?? row.cargoType ?? '').trim();
const option = this.getDispatchConfiguredCargoTypeOptions().find(
item => String(item.value) === nextValue || item.label === nextValue
);
if (option) {
row.cargoType = option.label || '';
row.cargoTypeCode = option.cargoTypeCode || '';
row.cargoTypePath = option.cargoTypePath || [];
} else {
row.cargoType = nextValue;
row.cargoTypeCode = '';
row.cargoTypePath = [];
}
row.cargoName = ''; row.cargoName = '';
row.specification = ''; row.specification = '';
row.model = ''; row.model = '';
}, },
handleDispatchConfiguredCargoNameChange(row, value) { handleDispatchConfiguredCargoNameChange(row, value) {
const nextValue = String(value ?? row.cargoName ?? '').trim();
const option = this.getDispatchConfiguredCargoNameOptions(row).find( const option = this.getDispatchConfiguredCargoNameOptions(row).find(
item => String(item.value) === String(value || '') item => String(item.value) === nextValue || item.label === nextValue
); );
row.cargoName = option?.value || ''; if (!option) {
if (!option) return; row.cargoName = nextValue;
row.cargoType = option.cargoTypeLabel || row.cargoType || ''; return;
row.cargoTypeCode = option.cargoTypeCode || row.cargoTypeCode || ''; }
row.cargoTypePath = option.cargoTypePath || row.cargoTypePath || []; const previousType = String(row.cargoType || '').trim();
const isKnownType = this.getDispatchConfiguredCargoTypeOptions().some(
item => item.label === previousType || String(item.value) === previousType
);
row.cargoName = option.value || '';
if (!previousType || isKnownType) {
row.cargoType = option.cargoTypeLabel || previousType;
row.cargoTypeCode = option.cargoTypeCode || row.cargoTypeCode || '';
row.cargoTypePath = option.cargoTypePath || row.cargoTypePath || [];
}
row.specification = option.specification || row.specification || ''; row.specification = option.specification || row.specification || '';
row.model = option.model || row.model || ''; row.model = option.model || row.model || '';
}, },
@@ -7345,10 +7541,7 @@ export default {
vehicleNo: this.dispatchRow.vehicleNo || '', vehicleNo: this.dispatchRow.vehicleNo || '',
cargoName: defaultGoods.cargoName || this.dispatchRow.cargoName || '', cargoName: defaultGoods.cargoName || this.dispatchRow.cargoName || '',
cargoType: defaultGoods.cargoType || this.dispatchRow.cargoType || '', cargoType: defaultGoods.cargoType || this.dispatchRow.cargoType || '',
quantity: quantity: '',
index >= 0
? defaultGoods.quantity || ''
: this.formatDispatchQuantity(this.getDispatchRemainingQuantity(defaultUnit)),
quantityUnit: defaultUnit, quantityUnit: defaultUnit,
specification: defaultGoods.specification || '', specification: defaultGoods.specification || '',
model: defaultGoods.model || '', model: defaultGoods.model || '',
@@ -8003,6 +8196,7 @@ export default {
quantityGroups.set(key, group); quantityGroups.set(key, group);
}); });
for (const { row: goods, quantity } of quantityGroups.values()) { for (const { row: goods, quantity } of quantityGroups.values()) {
if (this.isDispatchPlanQuantityUnlimited(goods)) continue;
const unit = this.getDispatchQuantityUnit(goods); const unit = this.getDispatchQuantityUnit(goods);
const remaining = this.dispatchItemRemainingQuantity(goods); const remaining = this.dispatchItemRemainingQuantity(goods);
if (quantity - remaining > 1e-8) { if (quantity - remaining > 1e-8) {
@@ -10,109 +10,206 @@
:class="{ 'waybill-import-page': standalone }" :class="{ 'waybill-import-page': standalone }"
@closed="handleClosed" @closed="handleClosed"
> >
<div class="waybill-import-toolbar"> <section v-show="searchVisible" class="waybill-import-toolbar__search">
<div class="waybill-import-toolbar__search"> <el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
<el-form :inline="true" :model="query" label-width="auto"> <div class="waybill-import-toolbar__search-grid">
<el-form-item label="运单批次号" <el-form-item label="运单批次号">
><el-input v-model="query.batchNo" clearable <el-input v-model="query.batchNo" clearable placeholder="请输入" />
/></el-form-item> </el-form-item>
<el-form-item label="承运商" <el-form-item label="承运商">
><el-select v-model="query.carrierId" clearable filterable <el-select v-model="query.carrierId" clearable filterable placeholder="请选择">
><el-option <el-option
v-for="item in queryCarriers" v-for="item in queryCarriers"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" /></el-select :value="item.id"
></el-form-item> />
<el-form-item label="创建时间" </el-select>
><el-date-picker </el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTimeRange" v-model="query.createTimeRange"
type="datetimerange" type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
/></el-form-item> range-separator="~"
<el-form-item label="创建人" start-placeholder="开始时间"
><el-select v-model="query.createUser" clearable filterable end-placeholder="结束时间"
><el-option clearable
/>
</el-form-item>
<el-form-item label="创建人">
<el-select v-model="query.createUser" clearable filterable placeholder="请选择">
<el-option
v-for="item in creators" v-for="item in creators"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" /></el-select :value="item.id"
></el-form-item> />
</el-form> </el-select>
<div class="waybill-import-toolbar__search-actions"> </el-form-item>
<el-button type="primary" @click="loadBatches">查询</el-button
><el-button @click="resetQuery">重置</el-button>
</div> </div>
</div> <div class="waybill-import-toolbar__search-actions">
<div class="waybill-import-toolbar__actions"> <el-button type="primary" @click="loadBatches">查询</el-button>
<el-button type="primary" @click="handleCreate">新建导入</el-button <el-button @click="resetQuery">重置</el-button>
><el-button type="danger" plain :disabled="!selected.length" @click="removeBatches" </div>
</el-form>
</section>
<div class="avue-crud__header waybill-import-toolbar__actions">
<div class="avue-crud__left">
<el-button type="primary" @click="handleCreate">新建导入</el-button>
<el-button type="danger" plain :disabled="!selected.length" @click="removeBatches"
>批量删除</el-button >批量删除</el-button
> >
</div> </div>
<div class="avue-crud__right">
<el-button icon="el-icon-refresh" circle @click="loadBatches" />
<el-button icon="el-icon-operation" circle @click="columnSettingVisible = true" />
<el-button icon="el-icon-search" circle @click="searchVisible = !searchVisible" />
<el-button icon="el-icon-grid" circle @click="toggleTableSize" />
</div>
</div> </div>
<el-table :data="batches" border @selection-change="selected = $event"> <section class="waybill-import-toolbar__table-panel">
<el-table-column type="selection" width="50" /><el-table-column <el-table
type="index" :data="batches"
label="序号" :size="tableSize"
width="70" border
/> @selection-change="selected = $event"
<el-table-column prop="batchNo" label="运单批次号" min-width="150" /><el-table-column
prop="projectName"
label="项目名称"
min-width="150"
/>
<el-table-column prop="carrierName" label="承运商" min-width="140" /><el-table-column
prop="carrierType"
label="承运类型"
min-width="120"
/>
<el-table-column prop="waybillCount" label="运单数" width="90" /><el-table-column
prop="importTypeName"
label="导入方式"
width="100"
/>
<el-table-column
prop="createTime"
label="创建时间"
min-width="170"
sortable
/><el-table-column prop="updateTime" label="更新时间" min-width="170" sortable />
<el-table-column prop="statusName" label="状态" width="100" /><el-table-column
label="操作"
width="180"
fixed="right"
> >
<template #default="{ row }" <el-table-column type="selection" width="50" /><el-table-column
><el-link type="primary" @click="openDetail(row)">查看</el-link type="index"
><el-link label="序号"
v-if="row.importStatus === 'draft'" width="70"
type="primary" />
@click="editBatch(row)" <el-table-column
>编辑</el-link v-if="columnVisible.batchNo"
><el-link type="danger" @click="removeBatch(row)">删除</el-link></template prop="batchNo"
label="运单批次号"
min-width="150"
/><el-table-column
v-if="columnVisible.projectName"
prop="projectName"
label="项目名称"
min-width="150"
/>
<el-table-column
v-if="columnVisible.carrierName"
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"
prop="statusName"
label="状态"
width="100"
/>
<el-table-column
v-if="columnVisible.createUserName"
prop="createUserName"
label="创建人"
min-width="120"
> >
</el-table-column> <template #default="{ row }">{{ row.createUserName || '-' }}</template>
</el-table> </el-table-column>
<el-pagination <el-table-column
v-model:current-page="page.current" v-if="columnVisible.createTime"
v-model:page-size="page.size" prop="createTime"
layout="total, prev, pager, next, sizes" label="创建时间"
:page-sizes="[10, 20, 50]" min-width="170"
:total="page.total" sortable
@current-change="loadBatches" /><el-table-column
@size-change="loadBatches" v-if="columnVisible.updateTime"
/> prop="updateTime"
label="更新时间"
min-width="170"
sortable
/>
<el-table-column
label="操作"
width="180"
fixed="right"
>
<template #default="{ row }">
<el-link
v-if="row.importStatus !== 'draft'"
type="primary"
@click="openDetail(row)"
>查看</el-link
>
<el-link
v-if="row.importStatus === 'draft'"
type="primary"
@click="editBatch(row)"
>编辑</el-link
>
<el-link
v-if="row.importStatus === 'draft'"
type="danger"
@click="removeBatch(row)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<div class="waybill-import-toolbar__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="loadBatches"
@size-change="loadBatches"
/>
</div>
</section>
</component> </component>
<el-dialog
v-model="columnSettingVisible"
title="列设置"
width="360px"
append-to-body
>
<el-checkbox-group v-model="visibleColumnKeys" class="waybill-import-toolbar__column-setting">
<el-checkbox v-for="item in columnOptions" :key="item.prop" :label="item.prop">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
<template #footer>
<el-button @click="columnSettingVisible = false">关闭</el-button>
</template>
</el-dialog>
<el-dialog v-model="detailVisible" title="导入运单详情" width="90%" append-to-body> <el-dialog v-model="detailVisible" title="导入运单详情" width="90%" append-to-body>
<el-form :inline="true" :model="detailQuery" <section-card class="waybill-search">
><el-form-item label="车牌号/船号" <el-form :inline="true" :model="detailQuery"
>
<el-form-item label="车牌号/船号"
><el-input v-model="detailQuery.vehicleNo" clearable /></el-form-item ><el-input v-model="detailQuery.vehicleNo" clearable /></el-form-item
><el-form-item label="货物名称" ><el-form-item label="司机/船长姓名"
><el-input v-model="detailQuery.cargoName" clearable /></el-form-item ><el-input v-model="detailQuery.driverName" clearable placeholder="请输入" /></el-form-item
><el-button type="primary" @click="loadDetails">查询</el-button></el-form ><el-button type="primary" @click="loadDetails">查询</el-button></el-form
> >
</section-card>
<el-table :data="details" border <el-table :data="details" border
><el-table-column type="index" label="序号" width="65" /><el-table-column ><el-table-column type="index" label="序号" width="65" /><el-table-column
prop="batchNo" prop="batchNo"
@@ -126,7 +223,10 @@
prop="vehicleNo" prop="vehicleNo"
label="车牌号/航班号/船号/班列号" label="车牌号/航班号/船号/班列号"
min-width="190" min-width="190"
/><el-table-column prop="transportType" label="运输方式" width="110" /><el-table-column /><el-table-column prop="transportType" label="" width="110">
<template #default="{ row }">{{ transportTypeLabel(row.transportType) }}</template>
</el-table-column>
<el-table-column
prop="driverName" prop="driverName"
label="司机/船长姓名" label="司机/船长姓名"
min-width="120" min-width="120"
@@ -200,17 +300,20 @@
prop="waybillIdentifier" prop="waybillIdentifier"
label="同一运单标识号" label="同一运单标识号"
min-width="140" min-width="140"
/><el-table-column label="" width="80">-</el-table-column></el-table /></el-table
> >
<el-pagination <div class="waybill-import-toolbar__pagination">
v-model:current-page="detailPage.current" <el-pagination
v-model:page-size="detailPage.size" background
layout="total, prev, pager, next, sizes" v-model:current-page="detailPage.current"
:page-sizes="[10, 20, 50]" v-model:page-size="detailPage.size"
:total="detailPage.total" layout="total, sizes, prev, pager, next, jumper"
@current-change="loadDetails" :page-sizes="[10, 20, 50, 100]"
@size-change="loadDetails" :total="detailPage.total"
/> @current-change="loadDetails"
@size-change="loadDetails"
/>
</div>
</el-dialog> </el-dialog>
<component <component
@@ -351,7 +454,7 @@
:on-change="fileChange" :on-change="fileChange"
:on-remove="fileRemove" :on-remove="fileRemove"
><el-button type="primary">添加附件</el-button></el-upload ><el-button type="primary">添加附件</el-button></el-upload
><span class="waybill-import-create__file-tip">请上传运单明细表仅支持 excel 格式</span ><span class="waybill-import-create__file-tip">请上传运单明细表仅支持 excel 格式日期支持 2026-08-022026-8-22026/8/2 等写法</span
><el-link type="primary" @click="downloadTemplate">下载模板</el-link></el-form-item ><el-link type="primary" @click="downloadTemplate">下载模板</el-link></el-form-item
> >
</el-form> </el-form>
@@ -494,6 +597,7 @@ import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import * as api from '@/api/business/waybill-manage'; import * as api from '@/api/business/waybill-manage';
import { downloadXls } from '@/utils/util'; import { downloadXls } from '@/utils/util';
import SectionCard from '@/components/section-card/main.vue';
const props = defineProps({ modelValue: Boolean, standalone: Boolean, createPage: Boolean }); const props = defineProps({ modelValue: Boolean, standalone: Boolean, createPage: Boolean });
const emit = defineEmits(['update:modelValue', 'closed']); const emit = defineEmits(['update:modelValue', 'closed']);
@@ -506,8 +610,32 @@ const handleClosed = () => emit('closed');
const createVisible = ref(props.createPage), const createVisible = ref(props.createPage),
detailVisible = ref(false), detailVisible = ref(false),
formRef = ref(); formRef = ref();
const searchVisible = ref(true);
const columnSettingVisible = ref(false);
const tableSize = ref('default');
const tableSizeOptions = ['default', 'large', 'small'];
const columnOptions = [
{ prop: 'batchNo', label: '运单批次号' },
{ prop: 'projectName', label: '项目名称' },
{ prop: 'carrierName', label: '承运商' },
{ prop: 'carrierType', label: '承运类型' },
{ prop: 'waybillCount', label: '运单数' },
{ prop: 'importTypeName', label: '导入方式' },
{ prop: 'statusName', label: '状态' },
{ prop: 'createUserName', label: '创建人' },
{ prop: 'createTime', label: '创建时间' },
{ prop: 'updateTime', label: '更新时间' },
];
const visibleColumnKeys = ref(columnOptions.map(item => item.prop));
const columnVisible = computed(() =>
Object.fromEntries(columnOptions.map(item => [item.prop, visibleColumnKeys.value.includes(item.prop)]))
);
const toggleTableSize = () => {
const index = tableSizeOptions.indexOf(tableSize.value);
tableSize.value = tableSizeOptions[(index + 1) % tableSizeOptions.length];
};
const query = reactive({ batchNo: '', carrierId: '', createUser: '', createTimeRange: [] }); const query = reactive({ batchNo: '', carrierId: '', createUser: '', createTimeRange: [] });
const detailQuery = reactive({ vehicleNo: '', cargoName: '' }); const detailQuery = reactive({ vehicleNo: '', driverName: '' });
const createDefaultForm = () => ({ const createDefaultForm = () => ({
id: '', id: '',
batchNo: '', batchNo: '',
@@ -862,6 +990,20 @@ const loadEditorOptions = async () => {
cargoTypeFlatOptions.value = flattenCargoTypeOptions(cargoTypeOptions.value); cargoTypeFlatOptions.value = flattenCargoTypeOptions(cargoTypeOptions.value);
driverOptions.value = extractRecords(driverRes); driverOptions.value = extractRecords(driverRes);
}; };
const ensureTransportTypeOptions = async () => {
if (transportTypeOptions.value.length) return;
const dictRes = await getDictionary({ code: 'transport_type' });
transportTypeOptions.value = extractRecords(dictRes).map(item => ({
label: item.dictValue || item.label,
value: item.dictKey || item.value,
}));
};
const transportTypeLabel = value => {
if (value === null || value === undefined || value === '') return '-';
return (
transportTypeOptions.value.find(item => String(item.value) === String(value))?.label || value
);
};
const loadBatches = async () => { const loadBatches = async () => {
const res = await api.getImportBatches({ ...query, current: page.current, size: page.size }); const res = await api.getImportBatches({ ...query, current: page.current, size: page.size });
batches.value = res.data?.data?.records || []; batches.value = res.data?.data?.records || [];
@@ -922,9 +1064,13 @@ const closeCreate = () => {
} }
createVisible.value = false; createVisible.value = false;
}; };
const openDetail = row => { const openDetail = async row => {
detailQuery.batchId = row.id; detailQuery.batchId = row.id;
detailQuery.vehicleNo = '';
detailQuery.driverName = '';
detailPage.current = 1;
detailVisible.value = true; detailVisible.value = true;
await ensureTransportTypeOptions();
loadDetails(); loadDetails();
}; };
// 稿稿 // 稿稿
@@ -1329,34 +1475,81 @@ const confirmImport = async () => {
<style scoped lang="scss"> <style scoped lang="scss">
.waybill-import-toolbar { .waybill-import-toolbar {
margin-bottom: 12px;
&__search { &__search {
display: flex; padding: 18px 18px 8px;
align-items: flex-start; margin-bottom: 8px;
gap: 12px; background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.el-form { &__search-grid {
flex: 1; display: grid;
margin-bottom: 0; grid-template-columns: repeat(4, minmax(0, 1fr));
} gap: 8px 24px;
}
&__search :deep(.el-form-item) {
margin-bottom: 8px;
}
&__search :deep(.el-form-item__label) {
white-space: nowrap;
}
&__search :deep(.el-input),
&__search :deep(.el-select),
&__search :deep(.el-date-editor),
&__search :deep(.el-date-editor.el-input),
&__search :deep(.el-date-editor.el-input__wrapper),
&__search :deep(.el-date-editor--datetimerange) {
width: 100%;
} }
&__search-actions { &__search-actions {
display: flex; display: flex;
flex: none; justify-content: flex-end;
gap: 8px; gap: 8px;
margin-bottom: 8px;
} }
&__actions { &__actions {
margin-top: 8px; margin-top: 12px;
background: transparent;
}
&__column-setting {
display: flex;
flex-direction: column;
gap: 8px;
}
&__table-panel {
padding: 0 12px 12px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&__pagination {
display: flex;
justify-content: flex-end;
width: 100%;
box-sizing: border-box;
padding: 16px 0;
}
&__table-panel :deep(.el-table) {
--el-table-border-color: #eff1f7;
}
&__table-panel :deep(.el-table__body tr:nth-child(even) > td.el-table__cell),
&__table-panel :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--left),
&__table-panel :deep(.el-table__body tr:nth-child(even) > td.el-table-fixed-column--right) {
background: #fafafa;
} }
} }
.waybill-import-page { .waybill-import-page {
min-height: calc(100vh - 120px); min-height: calc(100vh - 120px);
padding: 12px 24px 24px;
background: #fff;
} }
.waybill-import-create { .waybill-import-create {
@@ -1429,4 +1622,7 @@ const confirmImport = async () => {
:global(.avue-layout--horizontal .waybill-import-create__footer) { :global(.avue-layout--horizontal .waybill-import-create__footer) {
left: 0; left: 0;
} }
.waybill-search .el-form-item{
margin-bottom: 0 !important;
}
</style> </style>
@@ -3,21 +3,21 @@
:class="[ :class="[
'waybill-manage-page', 'waybill-manage-page',
{ {
'waybill-manage-page--form-page': isStandaloneWaybillFormPage, 'waybill-manage-page--form-page': formPageLocked,
'waybill-manage-page--detail-page': isStandaloneWaybillDetailPage, 'waybill-manage-page--detail-page': detailPageLocked,
}, },
]" ]"
> >
<component <component
v-if="!isStandaloneWaybillDetailPage" v-if="!detailPageLocked"
:is="crudContainer" :is="crudContainer"
:option="pageFormOption" :option="pageFormOption"
:form-page-title="isStandaloneWaybillFormPage ? formPageTitle : undefined" :form-page-title="formPageLocked ? formPageTitle : undefined"
:table-loading="loading" :table-loading="loading"
:data="data" :data="data"
v-model:page="page" v-model:page="page"
v-model="form" v-model="form"
:status="isStandaloneWaybillFormPage ? dialogReadonly : undefined" :status="formPageLocked ? dialogReadonly : undefined"
ref="crud" ref="crud"
:permission="permissionList" :permission="permissionList"
:before-open="beforeOpen" :before-open="beforeOpen"
@@ -1546,7 +1546,7 @@
</el-link> </el-link>
</div> </div>
<div <div
v-if="isStandaloneWaybillFormPage" v-if="formPageLocked"
class="waybill-manage-page__standalone-menu-actions" class="waybill-manage-page__standalone-menu-actions"
> >
<el-button class="waybill-manage-page__form-close" @click="closeCrudDialog"> <el-button class="waybill-manage-page__form-close" @click="closeCrudDialog">
@@ -1747,7 +1747,7 @@
</el-dialog> </el-dialog>
<empty-pagination <empty-pagination
v-show="!isStandaloneWaybillFormPage && !isStandaloneWaybillDetailPage" v-show="!formPageLocked && !detailPageLocked"
:page="page" :page="page"
@size-change="sizeChange" @size-change="sizeChange"
@current-change="currentChange" @current-change="currentChange"
@@ -1758,28 +1758,33 @@
:is="detailContainer" :is="detailContainer"
v-model="detailBox" v-model="detailBox"
:title="`${config.title}详情`" :title="`${config.title}详情`"
:append-to-body="!isStandaloneWaybillDetailPage" :append-to-body="!detailPageLocked"
top="10px" top="10px"
width="96%" width="96%"
show-close show-close
:class="[ :class="[
'waybill-manage-page__detail-dialog', 'waybill-manage-page__detail-dialog',
{ 'waybill-manage-page__detail-page': isStandaloneWaybillDetailPage }, { 'waybill-manage-page__detail-page': detailPageLocked },
$attrs.option?.dialogCustomClass, $attrs.option?.dialogCustomClass,
]" ]"
> >
<div v-loading="detailLoading" class="waybill-manage-page__detail-content"> <div v-loading="detailLoading" class="waybill-manage-page__detail-content">
<template v-if="detailBox || isStandaloneWaybillDetailPage"> <template v-if="detailBox || detailPageLocked">
<section-card class="waybill-manage-page__waybill-detail-summary"> <section-card class="waybill-manage-page__waybill-detail-summary">
<div class="waybill-manage-page__waybill-heading"> <div class="waybill-manage-page__waybill-heading">
<strong>运单详情</strong> <strong>运单详情</strong>
<span>{{ detailRow.waybillNo || '-' }}</span> <span>{{ detailRow.waybillNo || '-' }}</span>
<span class="detail-status-text status-text-success">{{ <el-tag :type="statusTagType(detailRow.businessStatus)">
displayStatus(detailRow, 'businessStatus') {{ displayStatus(detailRow, 'businessStatus') }}
}}</span> </el-tag>
<span class="detail-status-text detail-transport-type"> <el-tag type="primary">
{{ getTransportTypeLabel(waybillTransportMode(detailRow)) || '-' }} {{
</span> detailRow.transportTypeName ||
getTransportTypeLabel(detailRow.transportType) ||
waybillTransportMode(detailRow) ||
'-'
}}
</el-tag>
<el-link <el-link
v-if="detailRow.id" v-if="detailRow.id"
class="waybill-manage-page__waybill-route-change-link" class="waybill-manage-page__waybill-route-change-link"
@@ -1923,6 +1928,13 @@
}}</strong }}</strong
> >
</div> </div>
<div
v-if="!waybillIsCarrier(detailRow)"
class="waybill-manage-page__waybill-detail-field"
>
<span>里程(km)</span
><strong>{{ normalizeMileageValue(detailRow.mileage) || '-' }}</strong>
</div>
</template> </template>
<template v-else-if="waybillIsNonRoadTransport(detailRow)"> <template v-else-if="waybillIsNonRoadTransport(detailRow)">
<div class="waybill-manage-page__waybill-detail-field"> <div class="waybill-manage-page__waybill-detail-field">
@@ -2029,8 +2041,8 @@
<div v-loading="waybillPunchRecordsLoading"> <div v-loading="waybillPunchRecordsLoading">
<el-timeline v-if="waybillPunchRecords.length"> <el-timeline v-if="waybillPunchRecords.length">
<el-timeline-item <el-timeline-item
v-for="(record, index) in waybillPunchRecords" v-for="(record, index) in orderedWaybillPunchRecords"
:key="record.nodeCode || record.id || index" :key="`${record.nodeCode || record.id || 'punch'}-${index}`"
:timestamp="record.punchTime || record.statusName || '未打卡'" :timestamp="record.punchTime || record.statusName || '未打卡'"
:type="record.punched ? 'primary' : 'info'" :type="record.punched ? 'primary' : 'info'"
:color="record.punched ? '#2b6ce8' : '#c0c4cc'" :color="record.punched ? '#2b6ce8' : '#c0c4cc'"
@@ -2177,7 +2189,11 @@
/> />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="司机上传" name="driverUpload"> <el-tab-pane
v-if="waybillDriverUploads.length"
label="司机上传"
name="driverUpload"
>
<div <div
v-loading="waybillPunchRecordsLoading" v-loading="waybillPunchRecordsLoading"
class="waybill-manage-page__driver-upload-grid" class="waybill-manage-page__driver-upload-grid"
@@ -2194,11 +2210,6 @@
{{ photo.label || '凭证' }} {{ photo.label || '凭证' }}
</div> </div>
</div> </div>
<el-empty
v-if="!waybillPunchRecordsLoading && !waybillDriverUploads.length"
description="暂无司机上传数据"
:image-size="50"
/>
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@@ -2206,21 +2217,113 @@
<section-card title="物流轨迹"> <section-card title="物流轨迹">
<template #extra> <template #extra>
<div class="waybill-manage-page__waybill-track-actions"> <div class="waybill-manage-page__waybill-track-actions">
<el-button plain @click="handleWaybillTrackAction('playback')" <el-button
plain
:type="waybillTrackMode === 'playback' ? 'primary' : undefined"
:loading="waybillTrackLoading"
@click="handleWaybillTrackAction('playback')"
>轨迹回放</el-button >轨迹回放</el-button
> >
<el-button plain @click="handleWaybillTrackAction('locate')">实时定位</el-button> <el-button
plain
:type="waybillTrackMode === 'locate' ? 'primary' : undefined"
:loading="waybillLocateLoading"
@click="handleWaybillTrackAction('locate')"
>实时定位</el-button
>
</div> </div>
</template> </template>
<div class="waybill-manage-page__waybill-map-empty">暂无数据</div> <div
v-if="waybillTrackMode === 'playback'"
class="waybill-manage-page__waybill-track-toolbar"
>
<span>时间段</span>
<el-date-picker
v-model="waybillTrackDateRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="YYYY-MM-DD"
:clearable="false"
:disabled="waybillTrackLoading"
/>
<el-button
type="primary"
:loading="waybillTrackLoading"
@click="loadWaybillTrack"
>查询</el-button
>
<span class="waybill-manage-page__waybill-track-total"
>轨迹点 {{ waybillTrackInfo?.total || 0 }} </span
>
</div>
<div
v-if="waybillTrackMode === 'locate'"
class="waybill-manage-page__waybill-locate"
>
<div v-if="waybillLocateInfo" class="waybill-manage-page__waybill-locate-meta">
<div>
<span>车牌号</span><strong>{{ waybillLocateInfo.vehicleNo || '-' }}</strong>
</div>
<div>
<span>定位时间</span><strong>{{ waybillLocateInfo.locateTime || '-' }}</strong>
</div>
<div>
<span>速度</span><strong>{{ waybillLocateInfo.speed || '-' }}</strong>
</div>
<div>
<span>方向</span><strong>{{ waybillLocateInfo.direction || '-' }}</strong>
</div>
<div class="waybill-manage-page__waybill-locate-address">
<span>地址</span><strong>{{ waybillLocateInfo.address || '-' }}</strong>
</div>
<div>
<span>坐标</span
><strong
>{{
waybillLocateInfo.longitude != null && waybillLocateInfo.latitude != null
? `${waybillLocateInfo.longitude}, ${waybillLocateInfo.latitude}`
: '-'
}}
</strong>
</div>
</div>
<div
ref="waybillLocateMap"
class="waybill-manage-page__waybill-locate-map"
></div>
<div
v-if="!waybillLocateInfo"
class="waybill-manage-page__waybill-map-tip"
>
{{ waybillLocateHint || '暂无数据' }}
</div>
</div>
<div
v-else-if="waybillTrackMode === 'playback'"
class="waybill-manage-page__waybill-locate"
>
<div
ref="waybillTrackMap"
class="waybill-manage-page__waybill-locate-map waybill-manage-page__waybill-locate-map--track"
></div>
<div
v-if="!(waybillTrackInfo?.points || []).length"
class="waybill-manage-page__waybill-map-tip"
>
{{ waybillTrackHint || '暂无数据' }}
</div>
</div>
<div v-else class="waybill-manage-page__waybill-map-empty">暂无数据</div>
</section-card> </section-card>
</div> </div>
</template> </template>
</div> </div>
<div v-if="isStandaloneWaybillDetailPage" class="waybill-manage-page__detail-footer"> <div v-if="detailPageLocked && !isPublicWaybillView" class="waybill-manage-page__detail-footer">
<el-button type="primary" @click="closeDetail">关闭</el-button> <el-button type="primary" @click="closeDetail">关闭</el-button>
</div> </div>
<template v-if="!isStandaloneWaybillDetailPage" #footer> <template v-if="!detailPageLocked" #footer>
<el-button type="primary" @click="closeDetail">关闭</el-button> <el-button type="primary" @click="closeDetail">关闭</el-button>
</template> </template>
</component> </component>
@@ -3023,13 +3126,15 @@ import {
getList as getProcessConfigList, getList as getProcessConfigList,
getVoucherImages as getProcessConfigVoucherImages, getVoucherImages as getProcessConfigVoucherImages,
} from '@/api/business/process-config'; } from '@/api/business/process-config';
import { getPunchRecords as getWaybillPunchRecords } from '@/api/business/waybill-manage'; import { getPunchRecords as getWaybillPunchRecords, locateVehicle, trackVehicle } from '@/api/business/waybill-manage';
import { getMkPublicDetail } from '@/api/mk-process';
import { getList as getDriverList } from '@/api/transportCapacity/driver'; import { getList as getDriverList } from '@/api/transportCapacity/driver';
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import { getDictionary as getSystemDictionary } from '@/api/system/dict'; import { getDictionary as getSystemDictionary } from '@/api/system/dict';
import { addressTypeOptions } from '@/option/base/common-address'; import { addressTypeOptions } from '@/option/base/common-address';
import { packageOptions } from '@/option/business/common'; import { packageOptions } from '@/option/business/common';
import { formatUpdateUserName } from '@/utils/audit'; import { formatUpdateUserName } from '@/utils/audit';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { openImportDialog } from '@/utils/import-excel'; import { openImportDialog } from '@/utils/import-excel';
import { applyTableMenuWidth } from '@/utils/table-menu'; import { applyTableMenuWidth } from '@/utils/table-menu';
@@ -3286,6 +3391,21 @@ export default {
waybillRouteChangeRecords: [], waybillRouteChangeRecords: [],
waybillRouteChangeDragIndex: -1, waybillRouteChangeDragIndex: -1,
waybillRouteChangeSaving: false, waybillRouteChangeSaving: false,
waybillLocateLoading: false,
waybillLocateInfo: null,
waybillLocateHint: '',
waybillLocateMapInstance: null,
waybillLocateMarker: null,
waybillLocateInfoWindow: null,
waybillTrackMode: '',
waybillTrackLoading: false,
waybillTrackInfo: null,
waybillTrackHint: '',
waybillTrackDateRange: [],
waybillTrackMapInstance: null,
waybillTrackPolyline: null,
waybillTrackStartMarker: null,
waybillTrackEndMarker: null,
mileageDialog: { mileageDialog: {
visible: false, visible: false,
submitting: false, submitting: false,
@@ -3512,9 +3632,27 @@ export default {
selectionList: [], selectionList: [],
attachmentUploadMode: false, attachmentUploadMode: false,
standaloneFormKey: '', standaloneFormKey: '',
// $route
// data created Vue Options API
// data computed watch(immediate) created created
// immediate watcher
routePathLocked: this.$route.path,
// / / $route
// keep-alive deactivate $route
// / append-to-body el-dialog
// Teleport body KeepAlive.deactivate move DOM
// /
formPageLocked: false,
detailPageLocked: false,
// add / edit $route query option
formModeLocked: '',
}; };
}, },
created() { created() {
this.formPageLocked = this.isStandaloneWaybillFormPage;
this.detailPageLocked = this.isStandaloneWaybillDetailPage;
this.formModeLocked = this.$route.query.mode || '';
if (this.isPublicWaybillView) return;
if (this.config.enableAllDept && this.isAdmin) { if (this.config.enableAllDept && this.isAdmin) {
this.allDept = 1; this.allDept = 1;
} }
@@ -3538,6 +3676,14 @@ export default {
this.consumeTemplateCreatePayload(); this.consumeTemplateCreatePayload();
} }
}, },
// keep-alive append-to-body
// Teleport DOM body
deactivated() {
this.closeInnerDialogs();
},
beforeUnmount() {
this.closeInnerDialogs();
},
computed: { computed: {
...mapGetters(['permission', 'userInfo']), ...mapGetters(['permission', 'userInfo']),
permissionList() { permissionList() {
@@ -3545,17 +3691,49 @@ export default {
addBtn: this.canCreate, addBtn: this.canCreate,
}; };
}, },
//
//
orderedWaybillPunchRecords() {
const records = Array.isArray(this.waybillPunchRecords) ? this.waybillPunchRecords : [];
return records
.map((record, index) => ({
record,
index,
punchedAt: this.waybillPunchRecordTimestamp(record),
}))
.sort((a, b) => {
const aPunched = a.punchedAt !== null;
const bPunched = b.punchedAt !== null;
if (aPunched && bPunched) return a.punchedAt - b.punchedAt || a.index - b.index;
if (aPunched !== bPunched) return aPunched ? -1 : 1;
return a.index - b.index;
})
.map(item => item.record);
},
isStandaloneWaybillPage() { isStandaloneWaybillPage() {
return this.standaloneFormPage && standaloneWaybillFormPaths.includes(this.$route.path); return this.standaloneFormPage && standaloneWaybillFormPaths.includes(this.$route.path);
}, },
isStandaloneWaybillFormPage() { isStandaloneWaybillFormPage() {
return this.isStandaloneWaybillPage && ['add', 'edit'].includes(this.$route.query.mode); return this.isStandaloneWaybillPage && ['add', 'edit'].includes(this.$route.query.mode);
}, },
isPublicWaybillView() {
return this.$route.path === '/business/waybill-manage/public-view';
},
isStandaloneWaybillDetailPage() { isStandaloneWaybillDetailPage() {
return this.standaloneDetailPage && this.$route.path === standaloneWaybillDetailRoute; return (
(this.standaloneDetailPage && this.$route.path === standaloneWaybillDetailRoute) ||
this.isPublicWaybillView
);
},
// $route data formPageLocked
// tab.js fullPath path
// keep-alive $route id
// id
isOwnedRouteActive() {
return this.$route.path === this.routePathLocked;
}, },
detailContainer() { detailContainer() {
return this.isStandaloneWaybillDetailPage ? 'PageDetail' : 'el-dialog'; return this.detailPageLocked ? 'PageDetail' : 'el-dialog';
}, },
formPageTitle() { formPageTitle() {
if (this.isStandaloneWaybillFormPage) { if (this.isStandaloneWaybillFormPage) {
@@ -3567,13 +3745,13 @@ export default {
return ''; return '';
}, },
crudContainer() { crudContainer() {
return this.isStandaloneWaybillFormPage ? 'PageAvueForm' : 'avue-crud'; return this.formPageLocked ? 'PageAvueForm' : 'avue-crud';
}, },
pageFormOption() { pageFormOption() {
if (!this.isStandaloneWaybillFormPage) return this.option; if (!this.formPageLocked) return this.option;
const base = { const base = {
...this.option, ...this.option,
boxType: this.$route.query.mode === 'edit' ? 'edit' : 'add', boxType: this.formModeLocked === 'edit' ? 'edit' : 'add',
menuBtn: true, menuBtn: true,
submitBtn: true, submitBtn: true,
emptyBtn: false, emptyBtn: false,
@@ -3821,6 +3999,10 @@ export default {
detailId: { detailId: {
immediate: true, immediate: true,
handler(id) { handler(id) {
// 宿 view $route.query.id / detailId
// id
// openDetail id
if (!this.isOwnedRouteActive) return;
if (id !== undefined && id !== null && id !== '') { if (id !== undefined && id !== null && id !== '') {
this.$nextTick(() => this.openDetail({ id })); this.$nextTick(() => this.openDetail({ id }));
} }
@@ -3837,6 +4019,25 @@ export default {
}, },
}, },
methods: { methods: {
// keep-alive / append-to-body
// Teleport DOM body data
closeInnerDialogs() {
this.detailBox = false;
this.mileageDialog.visible = false;
this.attachmentDocumentPreviewVisible = false;
this.attachmentImagePreviewVisible = false;
this.waybillRouteChangeBox = false;
this.waybillCommonAddressBox = false;
this.flowBox = false;
this.transportRouteBox = false;
this.transportAddressBox = false;
this.transportStationBox = false;
this.transportMapBox = false;
this.commonCargoBox = false;
this.cargoImportBox = false;
this.waybillProcessConfigBox = false;
this.excelBox = false;
},
initStandaloneFormPage() { initStandaloneFormPage() {
if (!this.isStandaloneWaybillFormPage) return; if (!this.isStandaloneWaybillFormPage) return;
const mode = this.$route.query.mode === 'edit' ? 'edit' : 'add'; const mode = this.$route.query.mode === 'edit' ? 'edit' : 'add';
@@ -4384,6 +4585,9 @@ export default {
}, },
openDetail(row) { openDetail(row) {
if (!this.isStandaloneWaybillDetailPage) { if (!this.isStandaloneWaybillDetailPage) {
// row.id id
// push
if (!this.isOwnedRouteActive) return;
this.$router.push({ path: standaloneWaybillDetailRoute, query: { id: row.id } }); this.$router.push({ path: standaloneWaybillDetailRoute, query: { id: row.id } });
return; return;
} }
@@ -4400,14 +4604,19 @@ export default {
this.waybillVoucherFolder = null; this.waybillVoucherFolder = null;
this.waybillVoucherFolderView = false; this.waybillVoucherFolderView = false;
this.waybillVoucherImagesLoaded = false; this.waybillVoucherImagesLoaded = false;
const request = const request = this.isPublicWaybillView
typeof this.api.getDetail === 'function' ? getMkPublicDetail('waybill-manage', row.id)
: typeof this.api.getDetail === 'function'
? this.api.getDetail(row.id) ? this.api.getDetail(row.id)
: Promise.resolve({ data: { data: row } }); : Promise.resolve({ data: { data: row } });
request request
.then(res => { .then(res => {
const detail = res?.data?.data || res?.data || row; const detail = res?.data?.data || res?.data || row;
this.detailRow = detail; this.detailRow = detail;
if (this.isPublicWaybillView) {
this.applyFormDetail(detail);
return;
}
this.loadWaybillPunchRecords(); this.loadWaybillPunchRecords();
this.loadWaybillVoucherImages(); this.loadWaybillVoucherImages();
if (detail.contractId) { if (detail.contractId) {
@@ -4440,6 +4649,13 @@ export default {
}); });
}, },
closeDetail() { closeDetail() {
this.destroyWaybillLocateMap();
this.destroyWaybillTrackMap();
this.waybillTrackMode = '';
this.waybillLocateInfo = null;
this.waybillLocateHint = '';
this.waybillTrackInfo = null;
this.waybillTrackHint = '';
if (this.isStandaloneWaybillDetailPage) { if (this.isStandaloneWaybillDetailPage) {
this.$router.$avueRouter?.closeTag?.(); this.$router.$avueRouter?.closeTag?.();
this.$router.push({ path: '/business/waybill-manage', query: {} }); this.$router.push({ path: '/business/waybill-manage', query: {} });
@@ -4463,7 +4679,10 @@ export default {
this.$message.info('当前配载单暂无详情数据'); this.$message.info('当前配载单暂无详情数据');
return; return;
} }
this.$router.push({ path: '/business/loading-manage', query: { detailId: id } }); this.$router.push({
path: '/business/loading-manage/detail',
query: { id, name: '配载单详情' },
});
}, },
loadWaybillDetailProcessNodes(projectId) { loadWaybillDetailProcessNodes(projectId) {
this.waybillDetailProcessNodes = []; this.waybillDetailProcessNodes = [];
@@ -4492,6 +4711,19 @@ export default {
}) })
.catch(() => []); .catch(() => []);
}, },
// null
waybillPunchRecordTimestamp(record = {}) {
if (record.punched === false || record.statusName === '未打卡') return null;
const raw = record.punchTime || record.punchAt || record.punchDateTime || '';
const text = String(raw).trim();
if (!text) return null;
const parsed = this.$dayjs ? this.$dayjs(text) : null;
if (parsed && typeof parsed.isValid === 'function' && parsed.isValid()) {
return parsed.valueOf();
}
const fallback = new Date(text.replace(/-/g, '/')).getTime();
return Number.isNaN(fallback) ? null : fallback;
},
loadWaybillPunchRecords() { loadWaybillPunchRecords() {
const waybillId = this.detailRow?.id; const waybillId = this.detailRow?.id;
if (!waybillId || this.waybillPunchRecordsLoading) return; if (!waybillId || this.waybillPunchRecordsLoading) return;
@@ -4768,7 +5000,262 @@ export default {
} }
}, },
handleWaybillTrackAction(action) { handleWaybillTrackAction(action) {
this.$message.info(action === 'playback' ? '暂无可回放的物流轨迹' : '暂无车辆实时定位数据'); if (action === 'playback') {
this.destroyWaybillLocateMap();
this.waybillTrackMode = 'playback';
this.waybillLocateInfo = null;
this.waybillLocateHint = '';
if (!Array.isArray(this.waybillTrackDateRange) || this.waybillTrackDateRange.length !== 2) {
this.waybillTrackDateRange = this.buildDefaultTrackDateRange();
}
this.loadWaybillTrack();
return;
}
this.destroyWaybillTrackMap();
this.waybillTrackMode = 'locate';
this.waybillTrackInfo = null;
this.waybillTrackHint = '';
this.loadWaybillLocate();
},
buildDefaultTrackDateRange() {
const pad = value => String(value).padStart(2, '0');
const formatDate = date =>
`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
const today = new Date();
const yesterday = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1);
return [formatDate(yesterday), formatDate(today)];
},
destroyWaybillLocateMap() {
if (this.waybillLocateMarker) {
this.waybillLocateMarker.setMap(null);
this.waybillLocateMarker = null;
}
if (this.waybillLocateInfoWindow) {
this.waybillLocateInfoWindow.close();
this.waybillLocateInfoWindow = null;
}
if (this.waybillLocateMapInstance) {
this.waybillLocateMapInstance.destroy();
this.waybillLocateMapInstance = null;
}
},
destroyWaybillTrackMap() {
if (this.waybillTrackPolyline) {
this.waybillTrackPolyline.setMap(null);
this.waybillTrackPolyline = null;
}
if (this.waybillTrackStartMarker) {
this.waybillTrackStartMarker.setMap(null);
this.waybillTrackStartMarker = null;
}
if (this.waybillTrackEndMarker) {
this.waybillTrackEndMarker.setMap(null);
this.waybillTrackEndMarker = null;
}
if (this.waybillTrackMapInstance) {
this.waybillTrackMapInstance.destroy();
this.waybillTrackMapInstance = null;
}
},
async loadWaybillLocate() {
const waybillId = this.detailRow?.id;
if (!waybillId) {
this.$message.warning('运单信息不完整');
return;
}
if (!this.detailRow.vehicleNo) {
this.$message.warning('运单未绑定车牌号,无法实时定位');
return;
}
this.waybillLocateLoading = true;
this.waybillLocateHint = '正在获取车辆实时定位...';
this.waybillLocateInfo = null;
try {
const locateApi =
typeof this.api.locateVehicle === 'function' ? this.api.locateVehicle : locateVehicle;
const res = await locateApi(waybillId);
const data = res?.data?.data || null;
if (!data || data.longitude == null || data.latitude == null) {
this.waybillLocateInfo = null;
this.waybillLocateHint = '暂无车辆实时定位数据';
this.$message.warning('暂无车辆实时定位数据');
return;
}
this.waybillLocateInfo = data;
this.waybillLocateHint = '';
await this.$nextTick();
await this.renderWaybillLocateMap(data);
} catch (error) {
this.waybillLocateInfo = null;
this.waybillLocateHint = '实时定位获取失败';
this.$message.error(error?.message || '实时定位获取失败');
} finally {
this.waybillLocateLoading = false;
}
},
async loadWaybillTrack() {
const waybillId = this.detailRow?.id;
if (!waybillId) {
this.$message.warning('运单信息不完整');
return;
}
if (!this.detailRow.vehicleNo) {
this.$message.warning('运单未绑定车牌号,无法查询历史轨迹');
return;
}
if (!Array.isArray(this.waybillTrackDateRange) || this.waybillTrackDateRange.length !== 2) {
this.waybillTrackDateRange = this.buildDefaultTrackDateRange();
}
const [startDate, endDate] = this.waybillTrackDateRange;
this.waybillTrackLoading = true;
this.waybillTrackHint = '正在获取历史轨迹...';
this.destroyWaybillTrackMap();
try {
const trackApi =
typeof this.api.trackVehicle === 'function' ? this.api.trackVehicle : trackVehicle;
const res = await trackApi(waybillId, startDate, endDate);
const data = res?.data?.data || null;
const points = Array.isArray(data?.points) ? data.points : [];
if (!data || points.length === 0) {
this.waybillTrackInfo = data || { total: 0, points: [] };
this.waybillTrackHint = '暂无可回放的物流轨迹';
this.$message.warning('暂无可回放的物流轨迹');
return;
}
this.waybillTrackInfo = data;
this.waybillTrackHint = '';
await this.$nextTick();
await this.renderWaybillTrackMap(points);
} catch (error) {
this.waybillTrackInfo = null;
this.waybillTrackHint = '历史轨迹获取失败';
this.$message.error(error?.message || '历史轨迹获取失败');
} finally {
this.waybillTrackLoading = false;
}
},
async renderWaybillLocateMap(locateInfo) {
const longitude = Number(locateInfo?.longitude);
const latitude = Number(locateInfo?.latitude);
if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
this.$message.warning('定位坐标无效,无法在地图上展示');
return;
}
try {
await this.loadAmap();
await this.$nextTick();
const container = this.$refs.waybillLocateMap;
if (!container || !window.AMap) {
this.$message.warning('高德地图容器未就绪');
return;
}
this.destroyWaybillLocateMap();
this.waybillLocateMapInstance = new window.AMap.Map(container, {
zoom: 15,
center: [longitude, latitude],
viewMode: '2D',
resizeEnable: true,
});
const content = [
`<div style="padding:4px 2px;line-height:1.6;font-size:12px;">`,
`<div><b>${locateInfo.vehicleNo || '车辆位置'}</b></div>`,
locateInfo.locateTime ? `<div>时间:${locateInfo.locateTime}</div>` : '',
locateInfo.address ? `<div>地址:${locateInfo.address}</div>` : '',
`<div>坐标:${longitude}, ${latitude}</div>`,
`</div>`,
].join('');
this.waybillLocateInfoWindow = new window.AMap.InfoWindow({
content,
offset: new window.AMap.Pixel(0, -30),
});
this.waybillLocateMarker = new window.AMap.Marker({
position: [longitude, latitude],
title: locateInfo.vehicleNo || '车辆位置',
anchor: 'bottom-center',
});
this.waybillLocateMarker.on('click', () => {
this.waybillLocateInfoWindow.open(this.waybillLocateMapInstance, [longitude, latitude]);
});
this.waybillLocateMapInstance.add(this.waybillLocateMarker);
this.waybillLocateInfoWindow.open(this.waybillLocateMapInstance, [longitude, latitude]);
this.waybillLocateMapInstance.setFitView([this.waybillLocateMarker], false, [40, 40, 40, 40]);
setTimeout(() => {
this.waybillLocateMapInstance?.resize?.();
}, 80);
} catch (error) {
window.console.warn('实时定位地图渲染失败', error);
this.$message.error('高德地图渲染失败,请稍后重试');
}
},
async renderWaybillTrackMap(points) {
const path = (points || [])
.map(item => [Number(item.longitude), Number(item.latitude)])
.filter(item => Number.isFinite(item[0]) && Number.isFinite(item[1]));
if (!path.length) {
this.$message.warning('轨迹坐标无效,无法在地图上展示');
return;
}
try {
await this.loadAmap();
await this.$nextTick();
const container = this.$refs.waybillTrackMap;
if (!container || !window.AMap) {
this.$message.warning('高德地图容器未就绪');
return;
}
this.destroyWaybillTrackMap();
this.waybillTrackMapInstance = new window.AMap.Map(container, {
zoom: 12,
center: path[0],
viewMode: '2D',
resizeEnable: true,
});
this.waybillTrackPolyline = new window.AMap.Polyline({
path,
strokeColor: '#409eff',
strokeWeight: 6,
strokeOpacity: 0.9,
lineJoin: 'round',
lineCap: 'round',
showDir: path.length > 1,
});
this.waybillTrackStartMarker = new window.AMap.Marker({
position: path[0],
title: '起点',
anchor: 'bottom-center',
label: {
content: '起',
direction: 'top',
offset: new window.AMap.Pixel(0, -6),
},
});
this.waybillTrackEndMarker = new window.AMap.Marker({
position: path[path.length - 1],
title: '终点',
anchor: 'bottom-center',
label: {
content: '终',
direction: 'top',
offset: new window.AMap.Pixel(0, -6),
},
});
this.waybillTrackMapInstance.add([
this.waybillTrackPolyline,
this.waybillTrackStartMarker,
this.waybillTrackEndMarker,
]);
this.waybillTrackMapInstance.setFitView(
[this.waybillTrackPolyline, this.waybillTrackStartMarker, this.waybillTrackEndMarker],
false,
[48, 48, 48, 48]
);
setTimeout(() => {
this.waybillTrackMapInstance?.resize?.();
}, 80);
} catch (error) {
window.console.warn('历史轨迹地图渲染失败', error);
this.$message.error('高德地图渲染失败,请稍后重试');
}
}, },
displayStatus(row, prop) { displayStatus(row, prop) {
const formatStatus = this.config.formatStatus; const formatStatus = this.config.formatStatus;
@@ -4782,7 +5269,9 @@ export default {
: defaultText; : defaultText;
}, },
statusTagType(status) { statusTagType(status) {
if ([1, 'pending', 'processing', 'approved', 'change_approved'].includes(status)) { if (
[1, 'pending', 'processing', 'running', 'approved', 'change_approved'].includes(status)
) {
return 'success'; return 'success';
} }
if ([2, 'cancelled', 'withdrawn', 'draft'].includes(status)) { if ([2, 'cancelled', 'withdrawn', 'draft'].includes(status)) {
@@ -5053,11 +5542,23 @@ export default {
return; return;
} }
this.getSaveRequest()(submitRow).then( this.getSaveRequest()(submitRow).then(
() => { res => {
this.onLoad(this.page); const data = res.data?.data || {};
this.$message({ type: 'success', message: '操作成功!' }); const id = data.id || submitRow.id;
done(); const after = id
if (this.isStandaloneWaybillPage) this.closeCrudDialog(); ? submitMkApprovalFlow({
bizType: 'waybill-manage',
formInstanceId: id,
subjectName: data.waybillNo || submitRow.waybillNo || '',
approvalStatus: data.approvalStatus || submitRow.approvalStatus || '',
})
: Promise.resolve();
return after.then(() => {
this.onLoad(this.page);
this.$message({ type: 'success', message: '提交成功!' });
done();
if (this.isStandaloneWaybillPage) this.closeCrudDialog();
});
}, },
error => { error => {
window.console.log(error); window.console.log(error);
@@ -5076,12 +5577,26 @@ export default {
? this.api.updateAttachments ? this.api.updateAttachments
: this.getSaveRequest(); : this.getSaveRequest();
request(submitRow).then( request(submitRow).then(
() => { res => {
this.attachmentUploadMode = false; const skipMk = this.attachmentUploadMode;
this.onLoad(this.page); const data = res.data?.data || {};
this.$message({ type: 'success', message: '操作成功!' }); const id = data.id || submitRow.id;
done(); const after =
if (this.isStandaloneWaybillPage) this.closeCrudDialog(); skipMk || !id
? Promise.resolve()
: submitMkApprovalFlow({
bizType: 'waybill-manage',
formInstanceId: id,
subjectName: data.waybillNo || submitRow.waybillNo || '',
approvalStatus: data.approvalStatus || submitRow.approvalStatus || '',
});
return after.then(() => {
this.attachmentUploadMode = false;
this.onLoad(this.page);
this.$message({ type: 'success', message: skipMk ? '操作成功!' : '提交成功!' });
done();
if (this.isStandaloneWaybillPage) this.closeCrudDialog();
});
}, },
error => { error => {
this.attachmentUploadMode = false; this.attachmentUploadMode = false;
@@ -5172,19 +5687,28 @@ export default {
if (type === 'add' && copyId) { if (type === 'add' && copyId) {
this.api.getDetail(copyId).then(res => { this.api.getDetail(copyId).then(res => {
const sourceData = res.data.data || {}; const sourceData = res.data.data || {};
// //
delete sourceData.id; delete sourceData.id;
delete sourceData.code; delete sourceData.code;
delete sourceData.waybillNo; delete sourceData.waybillNo;
delete sourceData.waybillStatus; delete sourceData.waybillStatus;
delete sourceData.driverAcceptStatus;
delete sourceData.driverAcceptTime;
delete sourceData.driverAcceptDriverId;
delete sourceData.driverRejectTime;
delete sourceData.driverRejectReason;
delete sourceData.loadingNo;
delete sourceData.masterNo;
delete sourceData.createTime; delete sourceData.createTime;
delete sourceData.updateTime; delete sourceData.updateTime;
delete sourceData.createUser; delete sourceData.createUser;
delete sourceData.updateUser; delete sourceData.updateUser;
delete sourceData.createDept; delete sourceData.createDept;
delete sourceData.createUserName;
delete sourceData.updateUserName;
this.applyFormDetail(sourceData); this.applyFormDetail(sourceData);
// // 沿
this.form.dataSource = '手工创建'; this.form.dataSource = '手工创建';
done(); done();
}); });
@@ -8056,7 +8580,7 @@ export default {
}; };
this.mileageForm = { this.mileageForm = {
id: row.id, id: row.id,
mileage: row.mileage === null || row.mileage === undefined ? '' : String(row.mileage), mileage: this.normalizeMileageValue(row.mileage),
mileageRemark: row.mileageRemark || '', mileageRemark: row.mileageRemark || '',
}; };
this.$nextTick(() => this.$refs.mileageFormRef?.clearValidate()); this.$nextTick(() => this.$refs.mileageFormRef?.clearValidate());
@@ -9245,6 +9769,15 @@ export default {
strong { strong {
font-size: 20px; font-size: 20px;
} }
:deep(.el-tag) {
height: 28px;
padding: 0 12px;
border: 0;
border-radius: 8px;
font-size: 13px;
line-height: 28px;
}
} }
&__waybill-route-change-link { &__waybill-route-change-link {
@@ -9445,6 +9978,81 @@ export default {
border: 1px solid #eff1f7; border: 1px solid #eff1f7;
} }
&__waybill-locate {
position: relative;
display: flex;
flex-direction: column;
gap: 10px;
}
&__waybill-locate-meta {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px 16px;
padding: 10px 12px;
border: 1px solid #eff1f7;
background: #fafafa;
color: #606266;
font-size: 13px;
span {
margin-right: 8px;
color: #909399;
}
strong {
color: #303133;
font-weight: 600;
}
}
&__waybill-locate-address {
grid-column: 1 / -1;
}
&__waybill-locate-map {
width: 100%;
min-height: 320px;
height: 320px;
border: 1px solid #eff1f7;
background: #f5f7fa;
}
&__waybill-locate-map--track {
min-height: 420px;
height: 420px;
}
&__waybill-map-tip {
position: absolute;
left: 50%;
top: 50%;
z-index: 2;
transform: translate(-50%, -50%);
padding: 8px 14px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.92);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
color: #909399;
font-size: 13px;
text-align: center;
pointer-events: none;
}
&__waybill-track-toolbar {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
margin-bottom: 10px;
color: #606266;
font-size: 13px;
}
&__waybill-track-total {
color: #909399;
}
&__waybill-track-actions { &__waybill-track-actions {
display: flex; display: flex;
gap: 8px; gap: 8px;
+71 -11
View File
@@ -70,7 +70,7 @@
type="date" type="date"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD" placeholder="请输入"
/> />
<span></span> <span></span>
<el-date-picker <el-date-picker
@@ -78,7 +78,7 @@
type="date" type="date"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD" placeholder="请输入"
/> />
</div> </div>
</el-form-item> </el-form-item>
@@ -92,12 +92,12 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="合同金额"> <el-form-item label="合同金额">
<el-input-number <el-input
v-model="form.contractAmount" :model-value="contractAmountDisplay"
:min="0"
:precision="2"
:controls="false"
placeholder="请输入" placeholder="请输入"
clearable
@input="handleContractAmountInput"
@clear="form.contractAmount = null"
/> />
</el-form-item> </el-form-item>
<el-form-item label="是否范本"> <el-form-item label="是否范本">
@@ -190,9 +190,11 @@
description description
attachment-type attachment-type
use-upload-dialog use-upload-dialog
:attachment-location-options="changeAttachmentLocationOptions"
:rows="contractFileRows" :rows="contractFileRows"
:preview="previewAttachment" :preview="previewAttachment"
@update:rows="contractFileRows = $event" @update:rows="contractFileRows = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/> />
<section class="change-section"> <section class="change-section">
@@ -218,7 +220,7 @@
</el-radio-group> </el-radio-group>
</div> </div>
<el-form v-if="settlementRule.autoGenerate === 1" :model="settlementRule" label-position="right" label-width="auto" class="settlement-form"> <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-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 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="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="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>
@@ -258,9 +260,11 @@
attachment-type attachment-type
use-upload-dialog use-upload-dialog
attachment-location="其它附件" attachment-location="其它附件"
:attachment-location-options="changeAttachmentLocationOptions"
:rows="attachments" :rows="attachments"
:preview="previewAttachment" :preview="previewAttachment"
@update:rows="attachments = $event" @update:rows="attachments = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/> />
<section class="change-section change-reason-section"> <section class="change-section change-reason-section">
@@ -283,9 +287,11 @@
attachment-type attachment-type
use-upload-dialog use-upload-dialog
attachment-location="变更材料" attachment-location="变更材料"
:attachment-location-options="changeAttachmentLocationOptions"
:rows="changeMaterials" :rows="changeMaterials"
:preview="previewAttachment" :preview="previewAttachment"
@update:rows="changeMaterials = $event" @update:rows="changeMaterials = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/> />
<div class="page-footer"> <div class="page-footer">
<el-button @click="$router.back()">取消</el-button> <el-button @click="$router.back()">取消</el-button>
@@ -302,6 +308,7 @@
<script> <script>
import * as api from '@/api/business/contract-manage'; import * as api from '@/api/business/contract-manage';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import BillingPlanEditor from './components/billing-plan-editor.vue'; import BillingPlanEditor from './components/billing-plan-editor.vue';
import ContractAttachmentSection, { import ContractAttachmentSection, {
normalizeContractFileRows, normalizeContractFileRows,
@@ -342,7 +349,15 @@ const normalizeOptionalPositiveInteger = value => {
return Number.isInteger(number) && number > 0 ? number : null; return Number.isInteger(number) && number > 0 ? number : null;
}; };
const normalizeOptionalAmount = value => { const normalizeOptionalAmount = value => {
if (value === undefined || value === null || value === '') return null; if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return null;
}
const number = Number(value); const number = Number(value);
return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : null; return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : null;
}; };
@@ -420,6 +435,22 @@ export default {
pageTitle() { pageTitle() {
return this.$route.query.name || '合同变更'; return this.$route.query.name || '合同变更';
}, },
changeAttachmentLocationOptions() {
return ['合同文件', '其它附件', '变更材料'];
},
contractAmountDisplay() {
const value = this.form.contractAmount;
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return '';
}
return value;
},
contractCategoryOptions() { contractCategoryOptions() {
return this.contractCategoryDictOptions.length return this.contractCategoryDictOptions.length
? this.contractCategoryDictOptions ? this.contractCategoryDictOptions
@@ -463,6 +494,13 @@ export default {
}, },
}, },
methods: { methods: {
handleContractAmountInput(value) {
const text = String(value || '').replace(/[^\d.]/g, '');
const parts = text.split('.');
const normalized =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
this.form.contractAmount = normalized === '' ? null : normalized;
},
loadDictionaries() { loadDictionaries() {
Promise.all([ Promise.all([
getSystemDictionary({ code: 'currency_type' }), getSystemDictionary({ code: 'currency_type' }),
@@ -618,6 +656,20 @@ export default {
attachmentExtension(row = {}) { const source = String(this.attachmentName(row) || this.attachmentUrl(row)).split('?')[0]; const index = source.lastIndexOf('.'); return index > -1 ? source.slice(index + 1).toLowerCase() : ''; }, attachmentExtension(row = {}) { const source = String(this.attachmentName(row) || this.attachmentUrl(row)).split('?')[0]; const index = source.lastIndexOf('.'); return index > -1 ? source.slice(index + 1).toLowerCase() : ''; },
isAttachmentImage(row) { return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(this.attachmentExtension(row)); }, isAttachmentImage(row) { return ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'].includes(this.attachmentExtension(row)); },
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; }, 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 (location === '合同文件') {
this.contractFileRows = [...(this.contractFileRows || []), ...rows];
return;
}
if (location === '其它附件') {
this.attachments = [...(this.attachments || []), ...rows];
return;
}
if (location === '变更材料') {
this.changeMaterials = [...(this.changeMaterials || []), ...rows];
}
},
handlePreviewUnsupported() { this.$message.warning('当前文件暂不支持在线预览'); }, handlePreviewUnsupported() { this.$message.warning('当前文件暂不支持在线预览'); },
handlePreviewError() { this.$message.error('附件预览失败'); }, handlePreviewError() { this.$message.error('附件预览失败'); },
formatFileSize(value) { const size = Number(value || 0); return size > 1024 * 1024 ? `${(size / 1024 / 1024).toFixed(2)}MB` : `${Math.max(1, Math.ceil(size / 1024))}KB`; }, formatFileSize(value) { const size = Number(value || 0); return size > 1024 * 1024 ? `${(size / 1024 / 1024).toFixed(2)}MB` : `${Math.max(1, Math.ceil(size / 1024))}KB`; },
@@ -628,8 +680,8 @@ export default {
addCustomPeriodRow() { const periods = normalizeCustomPeriods(this.settlementRule.customPeriods || []); periods.push({ startDay: '', endDay: '' }); this.settlementRule.customPeriods = periods; }, addCustomPeriodRow() { const periods = normalizeCustomPeriods(this.settlementRule.customPeriods || []); periods.push({ startDay: '', endDay: '' }); this.settlementRule.customPeriods = periods; },
removeCustomPeriodRow(index) { if (index <= 0) return; const periods = [...(this.settlementRule.customPeriods || [])]; periods.splice(index, 1); this.settlementRule.customPeriods = normalizeCustomPeriods(periods); }, 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; }, 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; }, 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) }); this.$message.success('变更已提交'); this.$router.back(); }, 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', formInstanceId: this.form.id, subjectName: this.form.contractName || '', approvalStatus: this.form.approvalStatus || 'change_rejected' }); this.$message.success('变更已提交'); this.$router.back(); },
}, },
}; };
</script> </script>
@@ -653,6 +705,14 @@ export default {
.contract-basic-section :deep(.el-input), .contract-basic-section :deep(.el-input),
.contract-basic-section :deep(.el-select), .contract-basic-section :deep(.el-select),
.contract-basic-section :deep(.el-date-editor) { width: 360px; max-width: 100%; } .contract-basic-section :deep(.el-date-editor) { width: 360px; max-width: 100%; }
.contract-basic-section :deep(.el-input-number) {
width: 360px;
max-width: 100%;
.el-input__inner {
text-align: left;
}
}
.dialog-section-title { margin-bottom: 18px; font-size: 16px; font-weight: 600; } .dialog-section-title { margin-bottom: 18px; font-size: 16px; font-weight: 600; }
.dialog-section-title::before { display: inline-block; width: 4px; height: 16px; margin-right: 8px; vertical-align: -2px; background: #409eff; content: ''; } .dialog-section-title::before { display: inline-block; width: 4px; height: 16px; margin-right: 8px; vertical-align: -2px; background: #409eff; content: ''; }
.section-head { display: flex; align-items: center; justify-content: space-between; } .section-head { display: flex; align-items: center; justify-content: space-between; }
@@ -0,0 +1,21 @@
<template>
<mk-public-shell biz-type="contract-manage" :get-form="getForm">
<contract-manage ref="page" />
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import ContractManage from '@/views/business/contract-manage.vue';
export default {
name: 'ContractManagePublicView',
components: { MkPublicShell, ContractManage },
methods: {
getForm() {
const row = this.$refs.page?.detailRow || {};
return { ...row, subject: row.contractName || row.contractNo || '' };
},
},
};
</script>
+157 -99
View File
@@ -222,7 +222,7 @@
Number(detailSettlementRule.autoGenerate) === 1 ? '开启' : '关闭' Number(detailSettlementRule.autoGenerate) === 1 ? '开启' : '关闭'
}}</el-descriptions-item> }}</el-descriptions-item>
<template v-if="Number(detailSettlementRule.autoGenerate) === 1"> <template v-if="Number(detailSettlementRule.autoGenerate) === 1">
<el-descriptions-item label="账单起始日">{{ <el-descriptions-item label="账单起始日">{{
displayValue(detailSettlementRule.billStartDate) displayValue(detailSettlementRule.billStartDate)
}}</el-descriptions-item> }}</el-descriptions-item>
<el-descriptions-item label="结算类型">{{ <el-descriptions-item label="结算类型">{{
@@ -244,7 +244,7 @@
}}</el-descriptions-item }}</el-descriptions-item
> >
<el-descriptions-item <el-descriptions-item
v-if="detailSettlementRule.settlementType === '固定天数周期结算'" v-if="isFixedCycleSettlementType(detailSettlementRule.settlementType)"
label="周期天数" label="周期天数"
>{{ >{{
detailObjectUnitValue(detailSettlementRule, 'cycleDays', '天') detailObjectUnitValue(detailSettlementRule, 'cycleDays', '天')
@@ -345,7 +345,7 @@
</section> </section>
</div> </div>
<div class="contract-manage-page__footer"> <div class="contract-manage-page__footer">
<el-button @click="closeDetail">关闭</el-button> <el-button v-if="!isPublicViewPage" @click="closeDetail">关闭</el-button>
</div> </div>
</template> </template>
@@ -478,7 +478,7 @@
type="date" type="date"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD" placeholder="请输入"
/> />
<span></span> <span></span>
<el-date-picker <el-date-picker
@@ -486,7 +486,7 @@
type="date" type="date"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="YYYY-MM-DD" placeholder="请输入"
/> />
</div> </div>
</el-form-item> </el-form-item>
@@ -498,12 +498,12 @@
><template #suffix></template></el-input> ><template #suffix></template></el-input>
</el-form-item> </el-form-item>
<el-form-item label="合同金额"> <el-form-item label="合同金额">
<el-input-number <el-input
v-model="form.contractAmount" :model-value="contractAmountDisplay"
:min="0"
:precision="2"
:controls="false"
placeholder="请输入" placeholder="请输入"
clearable
@input="handleContractAmountInput"
@clear="form.contractAmount = null"
/> />
</el-form-item> </el-form-item>
<el-form-item label="是否范本"> <el-form-item label="是否范本">
@@ -593,11 +593,13 @@
description description
attachment-type attachment-type
use-upload-dialog use-upload-dialog
:attachment-location-options="contractAttachmentLocationOptions"
:lock-approved="isAttachmentUploadMode || hasApprovedContractFiles" :lock-approved="isAttachmentUploadMode || hasApprovedContractFiles"
:mark-approved-on-upload="isAttachmentUploadMode" :mark-approved-on-upload="isAttachmentUploadMode"
:rows="contractFileRows" :rows="contractFileRows"
:preview="previewAttachment" :preview="previewAttachment"
@update:rows="contractFileRows = $event" @update:rows="contractFileRows = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/> />
<section class="contract-manage-form__section contract-manage-form__section--panel"> <section class="contract-manage-form__section contract-manage-form__section--panel">
@@ -646,7 +648,7 @@
content="开启时,系统根据配置规则归集运单,定时生成结算单" content="开启时,系统根据配置规则归集运单,定时生成结算单"
placement="top" placement="top"
> >
<el-icon class="settlement-switch-tip"><QuestionFilled /></el-icon> <el-icon class="contract-manage-form__fee-mode-tip"><QuestionFilled /></el-icon>
</el-tooltip> </el-tooltip>
<el-radio :label="0">关闭</el-radio> <el-radio :label="0">关闭</el-radio>
</el-radio-group> </el-radio-group>
@@ -655,13 +657,13 @@
v-if="settlementRuleEnabled" v-if="settlementRuleEnabled"
class="contract-manage-form__grid contract-manage-form__settlement-grid" class="contract-manage-form__grid contract-manage-form__settlement-grid"
> >
<el-form-item label="账单起始日" required> <el-form-item label="账单起始日" required>
<el-date-picker <el-date-picker
v-model="settlementRuleForm.billStartDate" v-model="settlementRuleForm.billStartDate"
type="date" type="date"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择账单起始日" placeholder="请选择账单起始日"
/> />
</el-form-item> </el-form-item>
<el-form-item label="结算类型" required> <el-form-item label="结算类型" required>
@@ -813,10 +815,12 @@
attachment-type attachment-type
use-upload-dialog use-upload-dialog
attachment-location="其它附件" attachment-location="其它附件"
:attachment-location-options="contractAttachmentLocationOptions"
:readonly="isAttachmentUploadMode" :readonly="isAttachmentUploadMode"
:rows="attachmentRows" :rows="attachmentRows"
:preview="previewAttachment" :preview="previewAttachment"
@update:rows="attachmentRows = $event" @update:rows="attachmentRows = $event"
@upload-to-location="handleAttachmentUploadToLocation"
/> />
<section <section
@@ -962,44 +966,10 @@
@close="attachmentImagePreviewVisible = false" @close="attachmentImagePreviewVisible = false"
/> />
<el-dialog <change-record-detail-dialog
v-model="detailChangeRecordVisible" v-model="detailChangeRecordVisible"
title="变更记录详情" :rows="detailChangeRecordDetailRows"
append-to-body />
destroy-on-close
width="1100px"
top="10px"
class="contract-change-record-detail-dialog"
>
<div v-if="detailChangeRecord" class="contract-change-record-detail-meta">
<span>经办人{{ detailChangeRecord.handlerUserName || '-' }}</span>
<span>变更类型{{ detailChangeRecord.changeType || '-' }}</span>
<span>状态{{ detailChangeRecord.statusName || detailChangeRecord.status || '-' }}</span>
</div>
<el-table :data="detailChangeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="contract-change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="contract-change-record-detail-value"
/>
</el-table>
<el-empty
v-if="!detailChangeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="detailChangeRecordVisible = false">关闭</el-button>
</template>
</el-dialog>
<billing-plan-editor <billing-plan-editor
v-model="detailBillingPlanBox" v-model="detailBillingPlanBox"
@@ -1027,6 +997,7 @@ import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import { exportBlob } from '@/api/common'; import { exportBlob } from '@/api/common';
import * as api from '@/api/business/contract-manage'; import * as api from '@/api/business/contract-manage';
import { getMkPublicDetail } from '@/api/mk-process';
import { getList as getProjectList } from '@/api/business/project-apply'; import { getList as getProjectList } from '@/api/business/project-apply';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive'; import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { getDeptTree } from '@/api/system/dept'; import { getDeptTree } from '@/api/system/dept';
@@ -1035,7 +1006,9 @@ import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { config, option } from '@/option/business/contract-manage'; import { config, option } from '@/option/business/contract-manage';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { downloadFileByUrl, downloadXls } from '@/utils/util'; import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import BillingPlanEditor from './components/billing-plan-editor.vue'; import BillingPlanEditor from './components/billing-plan-editor.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import ContractAttachmentSection, { import ContractAttachmentSection, {
attachmentName as sharedAttachmentName, attachmentName as sharedAttachmentName,
attachmentUrl as sharedAttachmentUrl, attachmentUrl as sharedAttachmentUrl,
@@ -1057,7 +1030,15 @@ const normalizeOptionalInteger = (value, emptyValue = null) => {
return Number.isFinite(number) ? Math.trunc(number) : emptyValue; return Number.isFinite(number) ? Math.trunc(number) : emptyValue;
}; };
const normalizeOptionalAmount = (value, emptyValue = null) => { const normalizeOptionalAmount = (value, emptyValue = null) => {
if (value === undefined || value === null || value === '') return emptyValue; if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return emptyValue;
}
const number = Number(value); const number = Number(value);
return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : emptyValue; return Number.isFinite(number) && number >= 0 ? Number(number.toFixed(2)) : emptyValue;
}; };
@@ -1099,7 +1080,7 @@ const defaultForm = () => ({
settlementCurrency: '', settlementCurrency: '',
invoiceCycle: '', invoiceCycle: '',
paymentDays: '', paymentDays: '',
contractAmount: '', contractAmount: null,
templateFlag: 0, templateFlag: 0,
originalContractNo: '', originalContractNo: '',
electronicSealFlag: 0, electronicSealFlag: 0,
@@ -1180,7 +1161,14 @@ const attachmentViewerPlugins = [
export default { export default {
name: 'ContractManage', name: 'ContractManage',
components: { ContractAttachmentSection, BillingPlanEditor, ElImageViewer, OpenFileViewer, PdfPreview }, components: {
ContractAttachmentSection,
BillingPlanEditor,
ChangeRecordDetailDialog,
ElImageViewer,
OpenFileViewer,
PdfPreview,
},
data() { data() {
return { return {
api, api,
@@ -1271,7 +1259,7 @@ export default {
formalSettlementRuleForm: defaultSettlementRule(), formalSettlementRuleForm: defaultSettlementRule(),
paymentRatioRows: [], paymentRatioRows: [],
changeRecordRows: [], changeRecordRows: [],
settlementTypeOptions: ['结', '日结', '周结', '月结', '固定天数周期结算'], settlementTypeOptions: ['结', '日结', '周结', '月结', '固定天数周期'],
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'], billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
detailLoading: false, detailLoading: false,
detailRow: {}, detailRow: {},
@@ -1315,7 +1303,12 @@ export default {
return this.$route.path === '/business/contract-manage/form'; return this.$route.path === '/business/contract-manage/form';
}, },
isDetailPage() { isDetailPage() {
return this.$route.path === '/business/contract-manage/detail'; return (
this.$route.path === '/business/contract-manage/detail' || this.isPublicViewPage
);
},
isPublicViewPage() {
return this.$route.path === '/business/contract-manage/public-view';
}, },
formMode() { formMode() {
return this.$route.query.mode === 'edit' ? 'edit' : 'add'; return this.$route.query.mode === 'edit' ? 'edit' : 'add';
@@ -1330,6 +1323,23 @@ export default {
isAttachmentUploadMode() { isAttachmentUploadMode() {
return this.$route.query.attachmentUpload === '1'; return this.$route.query.attachmentUpload === '1';
}, },
contractAttachmentLocationOptions() {
if (this.isAttachmentUploadMode) return ['合同文件'];
return ['合同文件', '其它附件'];
},
contractAmountDisplay() {
const value = this.form.contractAmount;
if (
value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
) {
return '';
}
return value;
},
hasApprovedContractFiles() { hasApprovedContractFiles() {
return (this.contractFileRows || []).some( return (this.contractFileRows || []).some(
row => row =>
@@ -1411,7 +1421,7 @@ export default {
return this.showBillCycleType && this.settlementRuleForm.billCycleType === '自定义多周期'; return this.showBillCycleType && this.settlementRuleForm.billCycleType === '自定义多周期';
}, },
showCycleDays() { showCycleDays() {
return this.settlementRuleForm.settlementType === '固定天数周期结算'; return this.isFixedCycleSettlementType(this.settlementRuleForm.settlementType);
}, },
billCutoffDayOptions() { billCutoffDayOptions() {
return Array.from({ length: 31 }, (_, index) => ({ return Array.from({ length: 31 }, (_, index) => ({
@@ -1472,9 +1482,11 @@ export default {
}, },
}, },
created() { created() {
this.loadProjectOptions(); if (!this.isPublicViewPage) {
this.loadSettlementDictionaries(); this.loadProjectOptions();
this.loadOrganizationOptions(); this.loadSettlementDictionaries();
this.loadOrganizationOptions();
}
if (this.isFormPage) this.initFormPage(); if (this.isFormPage) this.initFormPage();
if (this.isDetailPage) this.initDetailPage(); if (this.isDetailPage) this.initDetailPage();
}, },
@@ -1674,7 +1686,7 @@ export default {
copyCount: normalizeOptionalInteger(detail.copyCount, ''), copyCount: normalizeOptionalInteger(detail.copyCount, ''),
invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle, ''), invoiceCycle: normalizeOptionalInteger(detail.invoiceCycle, ''),
paymentDays: normalizeOptionalInteger(detail.paymentDays, ''), paymentDays: normalizeOptionalInteger(detail.paymentDays, ''),
contractAmount: normalizeOptionalAmount(detail.contractAmount, ''), contractAmount: normalizeOptionalAmount(detail.contractAmount, null),
archiveStatus: detail.archiveStatus || '未归档', archiveStatus: detail.archiveStatus || '未归档',
feeGenerationMode: feeGenerationMode:
detail.feeGenerationMode || (Number(detail.billingEnabled) === 0 ? 'manual' : 'system'), detail.feeGenerationMode || (Number(detail.billingEnabled) === 0 ? 'manual' : 'system'),
@@ -1824,9 +1836,17 @@ export default {
const id = saved.id || this.form.id; const id = saved.id || this.form.id;
if (action === 'temporary' || action === 'formal') { if (action === 'temporary' || action === 'formal') {
if (!id) throw new Error('合同保存成功但未返回主键,无法提交合同'); if (!id) throw new Error('合同保存成功但未返回主键,无法提交合同');
return action === 'temporary' return (action === 'temporary'
? this.api.toTemporary(id) ? this.api.toTemporary(id)
: this.api.submitFormal(id); : this.api.submitFormal(id)
).then(() =>
submitMkApprovalFlow({
bizType: 'contract-manage',
formInstanceId: id,
subjectName: saved.contractName || submit.contractName || '',
approvalStatus: saved.approvalStatus || submit.approvalStatus || '',
})
);
} }
return null; return null;
}) })
@@ -1853,8 +1873,20 @@ export default {
: this.api.submit(payload); : this.api.submit(payload);
request request
.then(() => { .then(() => {
this.$message.success(isChangeRejected ? '已重新提交变更审批' : '修改成功'); if (!isChangeRejected) {
this.closeForm(); this.$message.success('修改成功');
this.closeForm();
return;
}
return submitMkApprovalFlow({
bizType: 'contract-manage',
formInstanceId: payload.id || this.form.id,
subjectName: payload.contractName || this.form.contractName || '',
approvalStatus: this.form.approvalStatus || 'change_rejected',
}).then(() => {
this.$message.success('已重新提交变更审批');
this.closeForm();
});
}) })
.finally(() => { .finally(() => {
this.submitAction = ''; this.submitAction = '';
@@ -2097,6 +2129,13 @@ export default {
integerInput(prop, value) { integerInput(prop, value) {
this.form[prop] = String(value || '').replace(/\D/g, ''); this.form[prop] = String(value || '').replace(/\D/g, '');
}, },
handleContractAmountInput(value) {
const text = String(value || '').replace(/[^\d.]/g, '');
const parts = text.split('.');
const normalized =
parts.length > 1 ? `${parts[0]}.${parts.slice(1).join('').slice(0, 2)}` : parts[0];
this.form.contractAmount = normalized === '' ? null : normalized;
},
positiveIntegerInput(prop, value) { positiveIntegerInput(prop, value) {
const normalized = String(value || '').replace(/\D/g, '').replace(/^0+/, ''); const normalized = String(value || '').replace(/\D/g, '').replace(/^0+/, '');
this.form[prop] = normalized; this.form[prop] = normalized;
@@ -2127,6 +2166,16 @@ export default {
}; };
this.attachmentDocumentPreviewVisible = true; this.attachmentDocumentPreviewVisible = true;
}, },
handleAttachmentUploadToLocation({ location, rows = [] }) {
if (!rows.length) return;
if (location === '合同文件') {
this.contractFileRows = [...(this.contractFileRows || []), ...rows];
return;
}
if (location === '其它附件') {
this.attachmentRows = [...(this.attachmentRows || []), ...rows];
}
},
handleAttachmentPreviewUnsupported() { handleAttachmentPreviewUnsupported() {
this.$message.warning('当前文件暂不支持在线预览'); this.$message.warning('当前文件暂不支持在线预览');
}, },
@@ -2185,8 +2234,12 @@ export default {
} }
return true; return true;
}, },
isFixedCycleSettlementType(value) {
return value === '按固定天数周期' || value === '固定天数周期结算';
},
normalizeSettlementRule(rule = {}) { normalizeSettlementRule(rule = {}) {
const next = { ...defaultSettlementRule(), ...rule }; const next = { ...defaultSettlementRule(), ...rule };
if (next.settlementType === '固定天数周期结算') next.settlementType = '按固定天数周期';
if (next.settlementType !== '月结') { if (next.settlementType !== '月结') {
next.billCycleType = ''; next.billCycleType = '';
next.billCutoffDay = ''; next.billCutoffDay = '';
@@ -2201,7 +2254,7 @@ export default {
} else { } else {
next.customPeriods = []; next.customPeriods = [];
} }
if (next.settlementType !== '固定天数周期结算') next.cycleDays = ''; if (!this.isFixedCycleSettlementType(next.settlementType)) next.cycleDays = '';
return next; return next;
}, },
syncSettlementConfig() { syncSettlementConfig() {
@@ -2224,7 +2277,7 @@ export default {
this.settlementRuleForm.billCycleType = ''; this.settlementRuleForm.billCycleType = '';
this.settlementRuleForm.billCutoffDay = ''; this.settlementRuleForm.billCutoffDay = '';
this.settlementRuleForm.customPeriods = []; this.settlementRuleForm.customPeriods = [];
if (value !== '固定天数周期结算') this.settlementRuleForm.cycleDays = ''; if (!this.isFixedCycleSettlementType(value)) this.settlementRuleForm.cycleDays = '';
}, },
handleBillCycleTypeChange(value) { handleBillCycleTypeChange(value) {
if (value !== '固定截单日') this.settlementRuleForm.billCutoffDay = ''; if (value !== '固定截单日') this.settlementRuleForm.billCutoffDay = '';
@@ -2315,7 +2368,7 @@ export default {
validateSettlementRule(rule, label) { validateSettlementRule(rule, label) {
if (Number(rule.autoGenerate) !== 1) return true; if (Number(rule.autoGenerate) !== 1) return true;
if (!rule.billStartDate || !rule.settlementType) { if (!rule.billStartDate || !rule.settlementType) {
this.$message.warning(`${label}:请完整填写账单起始日和结算类型`); this.$message.warning(`${label}:请完整填写账单起始日和结算类型`);
return false; return false;
} }
if (rule.settlementType === '月结' && !rule.billCycleType) { if (rule.settlementType === '月结' && !rule.billCycleType) {
@@ -2333,7 +2386,7 @@ export default {
if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') { if (rule.settlementType === '月结' && rule.billCycleType === '自定义多周期') {
return this.validateCustomPeriods(rule.customPeriods, label); return this.validateCustomPeriods(rule.customPeriods, label);
} }
if (rule.settlementType === '固定天数周期结算' && !rule.cycleDays) { if (this.isFixedCycleSettlementType(rule.settlementType) && !rule.cycleDays) {
this.$message.warning(`${label}:请选择周期天数`); this.$message.warning(`${label}:请选择周期天数`);
return false; return false;
} }
@@ -2385,8 +2438,10 @@ export default {
if (!id) return; if (!id) return;
this.detailLoading = true; this.detailLoading = true;
this.applyDetailState({}); this.applyDetailState({});
this.api const request = this.isPublicViewPage
.getDetail(id) ? getMkPublicDetail('contract-manage', id)
: this.api.getDetail(id);
request
.then(res => { .then(res => {
this.applyDetailState(res.data?.data || {}); this.applyDetailState(res.data?.data || {});
}) })
@@ -2555,7 +2610,7 @@ export default {
.join('')}` .join('')}`
); );
} }
if (config.billStartDate) parts.push(`账单起始日${config.billStartDate}`); if (config.billStartDate) parts.push(`账单起始日:${config.billStartDate}`);
return parts.join(''); return parts.join('');
}; };
if (normalized.preSettlementConfig || normalized.formalSettlementConfig) { if (normalized.preSettlementConfig || normalized.formalSettlementConfig) {
@@ -2651,6 +2706,15 @@ export default {
}, },
detailValue(prop) { detailValue(prop) {
const value = this.detailRow[prop]; const value = this.detailRow[prop];
if (prop === 'contractAmount') {
return value === undefined ||
value === null ||
value === '' ||
Number(value) === -1 ||
String(value) === '-1'
? '-'
: value;
}
if ( if (
prop === 'contractStage' || prop === 'contractStage' ||
prop === 'approvalStatus' || prop === 'approvalStatus' ||
@@ -2698,7 +2762,19 @@ export default {
} }
const run = value => { const run = value => {
const args = operation.prompt ? [row.id, value] : [row.id]; const args = operation.prompt ? [row.id, value] : [row.id];
this.api[operation.action](...args).then(() => { const request = () => this.api[operation.action](...args);
const afterMk =
operation.action === 'submitFormal'
? request().then(() =>
submitMkApprovalFlow({
bizType: 'contract-manage',
formInstanceId: row.id,
subjectName: row.contractName || '',
approvalStatus: row.approvalStatus || '',
})
)
: request();
afterMk.then(() => {
this.$message.success(operation.successMessage || `${operation.label}成功`); this.$message.success(operation.successMessage || `${operation.label}成功`);
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}); });
@@ -2867,25 +2943,6 @@ export default {
word-break: break-word; word-break: break-word;
} }
.contract-change-record-detail-meta {
display: flex;
flex-wrap: wrap;
gap: 8px 32px;
margin-bottom: 16px;
color: #606266;
}
:deep(.contract-change-record-detail-dialog .el-dialog__body) {
max-height: 65vh;
overflow: auto;
padding-top: 12px;
}
:deep(.contract-change-record-detail-dialog .contract-change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-all;
}
:global(.avue--collapse .contract-manage-page__footer) { :global(.avue--collapse .contract-manage-page__footer) {
left: 60px; left: 60px;
} }
@@ -2985,13 +3042,6 @@ export default {
align-items: center; align-items: center;
gap: 20px; gap: 20px;
margin-bottom: 16px; margin-bottom: 16px;
.settlement-switch-tip {
margin: 0 4px;
color: #a8abb2;
cursor: help;
font-size: 14px;
}
} }
&__settlement-grid { &__settlement-grid {
@@ -3049,11 +3099,19 @@ export default {
min-width: 0; min-width: 0;
} }
:deep(.el-input-number) {
width: 360px;
max-width: 100%;
.el-input__inner {
text-align: left;
}
}
:deep(.el-input), :deep(.el-input),
:deep(.el-select), :deep(.el-select),
:deep(.el-cascader), :deep(.el-cascader),
:deep(.el-tree-select), :deep(.el-tree-select),
:deep(.el-input-number),
:deep(.el-date-editor) { :deep(.el-date-editor) {
width: 360px; width: 360px;
max-width: 100%; max-width: 100%;
File diff suppressed because it is too large Load Diff
+225 -111
View File
@@ -1,57 +1,58 @@
<template> <template>
<basic-container class="master-order-page"> <basic-container class="master-order-page">
<template v-if="mode === 'list'"> <template v-if="mode === 'list'">
<el-form :model="query" class="master-search" label-width="160px" @submit.prevent> <div class="master-order-page__search">
<el-row :gutter="16"> <el-form :model="query" label-position="right" label-width="88px" @submit.prevent>
<el-col v-for="field in primaryFields" :key="field.prop" :span="6" <div class="master-order-page__search-grid">
><el-form-item :label="field.label" <el-form-item v-for="field in primaryFields" :key="field.prop" :label="field.label">
><el-input v-model="query[field.prop]" placeholder="请输入" /></el-form-item <el-input v-model="query[field.prop]" clearable placeholder="请输入" />
></el-col> </el-form-item>
<el-col :span="6" <el-form-item label="状态">
><el-form-item label="状态" <el-select v-model="query.businessStatus" clearable placeholder="全部">
><el-select v-model="query.businessStatus" placeholder="全部" <el-option label="全部" value="" />
><el-option label="全部" value="" /><el-option <el-option
v-for="item in statuses" v-for="item in statuses"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" /></el-select></el-form-item :value="item.value"
></el-col> />
<template v-if="searchExpanded"> </el-select>
<el-col v-for="field in secondaryFields" :key="field.prop" :span="6" </el-form-item>
><el-form-item :label="field.label" <template v-if="searchExpanded">
><el-input v-model="query[field.prop]" placeholder="请输入" /></el-form-item <el-form-item v-for="field in secondaryFields" :key="field.prop" :label="field.label">
></el-col> <el-input v-model="query[field.prop]" clearable placeholder="请输入" />
<el-col :span="6" </el-form-item>
><el-form-item label="计划开始日期" <el-form-item label="计划开始日期">
><el-date-picker <el-date-picker
v-model="query.planStartRange" v-model="query.planStartRange"
type="datetimerange" type="datetimerange"
format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="请选择" start-placeholder="请选择"
end-placeholder="请选择" /></el-form-item end-placeholder="请选择"
></el-col> />
<el-col :span="6" </el-form-item>
><el-form-item label="计划结束日期" <el-form-item label="计划结束日期">
><el-date-picker <el-date-picker
v-model="query.planEndRange" v-model="query.planEndRange"
type="datetimerange" type="datetimerange"
format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="请选择" start-placeholder="请选择"
end-placeholder="请选择" /></el-form-item end-placeholder="请选择"
></el-col> />
</template> </el-form-item>
<el-col :span="24" class="search-actions" </template>
><el-button type="primary" @click="search">查询</el-button <div class="master-order-page__search-actions">
><el-button @click="reset">重置</el-button <el-button type="primary" @click="search">查询</el-button>
><el-link type="primary" @click="searchExpanded = !searchExpanded" <el-button @click="reset">重置</el-button>
><el-icon><component :is="searchExpanded ? ArrowUp : ArrowDown" /></el-icon <el-link type="primary" @click="searchExpanded = !searchExpanded">{{
>{{ searchExpanded ? '折叠' : '展开' }}</el-link searchExpanded ? '收起' : '展开'
></el-col }}</el-link>
> </div>
</el-row> </div>
</el-form> </el-form>
</div>
<section class="master-list-panel"> <section class="master-list-panel">
<div class="toolbar"> <div class="toolbar">
<el-button type="primary" @click="goCreate()">新建多联总单</el-button <el-button type="primary" @click="goCreate()">新建多联总单</el-button
@@ -76,7 +77,13 @@
<div class="route-point"> <div class="route-point">
<span :class="['route-node', node.type]">{{ node.text }}</span> <span :class="['route-node', node.type]">{{ node.text }}</span>
<div class="route-detail"> <div class="route-detail">
<el-tooltip placement="top"><template #content>{{ node.name }}</template><strong>{{ node.name }}</strong></el-tooltip> <el-tooltip
:content="node.address || node.name || '-'"
placement="top"
:show-after="120"
>
<strong>{{ node.name }}</strong>
</el-tooltip>
<span v-for="line in node.lines" :key="line">{{ line }}</span> <span v-for="line in node.lines" :key="line">{{ line }}</span>
</div> </div>
</div> </div>
@@ -125,7 +132,7 @@
/> />
</template> </template>
<master-order-dispatch v-else-if="mode === 'dispatch'" :id="routeId" @back="goList" /> <master-order-dispatch v-else-if="mode === 'dispatch'" :id="routeId" @back="goList" />
<master-order-detail v-else :id="routeId" @back="goList" /> <master-order-detail v-else-if="mode === 'detail'" :id="routeId" />
<el-dialog v-model="confirm.visible" title="提示" width="400px" <el-dialog v-model="confirm.visible" title="提示" width="400px"
><span>{{ confirm.message }}</span ><span>{{ confirm.message }}</span
><template #footer ><template #footer
@@ -138,7 +145,6 @@
<script> <script>
import * as api from '@/api/business/master-order'; import * as api from '@/api/business/master-order';
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue';
import MasterOrderEditor from './components/master-order-editor.vue'; import MasterOrderEditor from './components/master-order-editor.vue';
import MasterOrderDispatch from './components/master-order-dispatch.vue'; import MasterOrderDispatch from './components/master-order-dispatch.vue';
import MasterOrderDetail from './components/master-order-detail.vue'; import MasterOrderDetail from './components/master-order-detail.vue';
@@ -147,8 +153,10 @@ export default {
components: { MasterOrderEditor, MasterOrderDispatch, MasterOrderDetail }, components: { MasterOrderEditor, MasterOrderDispatch, MasterOrderDetail },
data() { data() {
return { return {
ArrowDown, // keep-alive $route
ArrowUp, // query.mode / query.id
//mode=add id id
routePathLocked: this.$route.path,
searchExpanded: false, searchExpanded: false,
loading: false, loading: false,
records: [], records: [],
@@ -176,10 +184,15 @@ export default {
}; };
}, },
computed: { computed: {
isOwnedRoute() {
return this.$route.path === this.routePathLocked;
},
mode() { mode() {
if (!this.isOwnedRoute) return 'list';
return this.$route.query.mode || 'list'; return this.$route.query.mode || 'list';
}, },
routeId() { routeId() {
if (!this.isOwnedRoute) return '';
return this.$route.query.id; return this.$route.query.id;
}, },
masterEditorTitle() { masterEditorTitle() {
@@ -190,6 +203,7 @@ export default {
'$route.query': { '$route.query': {
immediate: true, immediate: true,
handler() { handler() {
if (!this.isOwnedRoute) return;
this.syncTagTitle(); this.syncTagTitle();
if (this.mode === 'list') this.load(); if (this.mode === 'list') this.load();
}, },
@@ -303,7 +317,7 @@ export default {
}, },
timeRange(row) { timeRange(row) {
return row.planStartTime && row.planEndTime return row.planStartTime && row.planEndTime
? `${String(row.planStartTime).slice(0, 16)} - ${String(row.planEndTime).slice(0, 16)}` ? `${String(row.planStartTime).slice(0, 10)} - ${String(row.planEndTime).slice(0, 10)}`
: '-'; : '-';
}, },
goodsSummary(row) { goodsSummary(row) {
@@ -334,6 +348,19 @@ export default {
const value = String(type || '').trim().toLowerCase(); const value = String(type || '').trim().toLowerCase();
return value === 'road' || value.includes('公路'); return value === 'road' || value.includes('公路');
}, },
isStationLikeName(value) {
const text = String(value || '').trim();
if (!text) return false;
return /(?:火车站|高铁站|客运站|货运站|港口|码头|机场|空港|航站楼)$/.test(text) || /(?<!市|州|盟|区|县|旗)站$/.test(text);
},
isNonRoadLocation({ name, siteCode, transportType, nextTransportType } = {}) {
const code = String(siteCode || '').trim();
if (code && code !== '/') return true;
if (this.isStationLikeName(name)) return true;
if (transportType && !this.isRoadTransportType(transportType)) return true;
if (nextTransportType && !this.isRoadTransportType(nextTransportType)) return true;
return false;
},
formatRoadAddress(value) { formatRoadAddress(value) {
const text = String(value || '').replace(/\s+/g, ''); const text = String(value || '').replace(/\s+/g, '');
if (!text) return '-'; if (!text) return '-';
@@ -355,10 +382,16 @@ export default {
routeNodeName(value, address, transportType, region = {}) { routeNodeName(value, address, transportType, region = {}) {
const text = String(value || '').trim(); const text = String(value || '').trim();
if (!text) return '-'; if (!text) return '-';
const siteCode = String(region.siteCode || '').trim(); if (
// this.isNonRoadLocation({
// name: text,
if (siteCode && siteCode !== '/') return text; siteCode: region.siteCode,
transportType,
nextTransportType: region.nextTransportType,
})
) {
return text;
}
// / // /
// //
const parsedText = this.formatRoadAddress(text); const parsedText = this.formatRoadAddress(text);
@@ -383,86 +416,149 @@ export default {
const source = /省|自治区|特别行政区|市|州|盟/.test(text) ? text : address || text; const source = /省|自治区|特别行政区|市|州|盟/.test(text) ? text : address || text;
const formatted = this.formatRoadAddress(source); const formatted = this.formatRoadAddress(source);
if (/(?:区|县|旗)$/.test(text) && !formatted.includes(text)) { if (/(?:区|县|旗)$/.test(text) && !formatted.includes(text)) {
const city = formatted.split(' ')[0]; const cityName = formatted.split(' ')[0];
return city && city !== formatted ? `${city} ${text}` : formatted; return cityName && cityName !== formatted ? `${cityName} ${text}` : formatted;
} }
return formatted; return formatted;
}, },
resolveRouteNodeLocation({
name,
address,
transportType,
nextTransportType,
cityName,
districtName,
siteCode,
} = {}) {
const rawName = String(name || '').trim();
const rawAddress = String(address || '').trim();
const regionText = [cityName, districtName].filter(Boolean).join(' ');
const nonRoad = this.isNonRoadLocation({
name: rawName,
siteCode,
transportType,
nextTransportType,
});
if (nonRoad) {
//
// address name
if (this.isStationLikeName(rawAddress) && !this.isStationLikeName(rawName)) {
return {
name: rawAddress,
address: rawName || regionText || rawAddress,
};
}
const displayName = rawName || rawAddress || '-';
const tipAddress =
(rawAddress && rawAddress !== displayName ? rawAddress : '') ||
regionText ||
rawAddress ||
displayName;
return { name: displayName, address: tipAddress };
}
return {
name: this.routeNodeName(rawName || rawAddress, rawAddress, transportType, {
cityName,
districtName,
siteCode,
nextTransportType,
}),
address: rawAddress || rawName || regionText || '-',
};
},
routeNodes(row = {}) { routeNodes(row = {}) {
const routes = row.routeProgress || []; const routes = row.routeProgress || [];
const total = this.routeNumber(row.totalQuantity); const total = this.routeNumber(row.totalQuantity);
const firstTransportType = routes[0]?.transportType || row.routes?.[0]?.transportType || row.transportType || ''; const firstTransportType = routes[0]?.transportType || row.routes?.[0]?.transportType || row.transportType || '';
if (!routes.length) { if (!routes.length) {
const start = this.resolveRouteNodeLocation({
name: row.departureName || row.departureAddress,
address: row.departureAddress,
transportType: firstTransportType,
cityName: row.departureCityName,
districtName: row.departureDistrictName,
siteCode: row.departureSiteCode,
});
const end = this.resolveRouteNodeLocation({
name: row.arrivalName || row.arrivalAddress,
address: row.arrivalAddress,
transportType: row.finalTransportType || firstTransportType,
cityName: row.arrivalCityName,
districtName: row.arrivalDistrictName,
siteCode: row.arrivalSiteCode,
});
return [ return [
{ {
key: 'start', key: 'start',
type: 'start', type: 'start',
text: '起', text: '起',
name: this.routeNodeName( ...start,
row.departureName || row.departureAddress,
row.departureAddress,
firstTransportType,
{
cityName: row.departureCityName,
districtName: row.departureDistrictName,
siteCode: row.departureSiteCode,
}
),
lines: [`已调度0/${total}`], lines: [`已调度0/${total}`],
}, },
{ {
key: 'end', key: 'end',
type: 'end', type: 'end',
text: '终', text: '终',
name: this.routeNodeName( ...end,
row.arrivalName || row.arrivalAddress,
row.arrivalAddress,
row.finalTransportType || firstTransportType,
{
cityName: row.arrivalCityName,
districtName: row.arrivalDistrictName,
siteCode: row.arrivalSiteCode,
}
),
lines: [`到达0/${total}`], lines: [`到达0/${total}`],
}, },
]; ];
} }
const start = this.resolveRouteNodeLocation({
name: row.departureName || row.departureAddress,
address: row.departureAddress,
transportType: firstTransportType,
nextTransportType: firstTransportType,
cityName: row.departureCityName,
districtName: row.departureDistrictName,
siteCode: row.departureSiteCode,
});
return [ return [
{ {
key: 'start', key: 'start',
type: 'start', type: 'start',
text: '起', text: '起',
name: this.routeNodeName( ...start,
row.departureName || row.departureAddress,
row.departureAddress,
firstTransportType,
{
cityName: row.departureCityName,
districtName: row.departureDistrictName,
siteCode: row.departureSiteCode,
}
),
lines: [`已调度${this.routeNumber(routes[0]?.dispatchedQuantity)}/${total}`], lines: [`已调度${this.routeNumber(routes[0]?.dispatchedQuantity)}/${total}`],
}, },
...routes.map((route, index) => { ...routes.map((route, index) => {
const isEnd = index === routes.length - 1; const isEnd = index === routes.length - 1;
const arrived = this.routeNumber(this.routeArrivedQuantity(route)); const arrived = this.routeNumber(this.routeArrivedQuantity(route));
const dispatched = this.routeNumber(routes[index + 1]?.dispatchedQuantity); const dispatched = this.routeNumber(routes[index + 1]?.dispatchedQuantity);
const address =
route.arrivalAddress ||
route.departureAddress ||
(isEnd ? row.arrivalAddress : '') ||
'';
const location = this.resolveRouteNodeLocation({
name:
route.arrivalName ||
route.departureName ||
(isEnd ? row.arrivalName : '') ||
'',
address,
transportType: route.transportType,
nextTransportType: isEnd
? row.finalTransportType || route.transportType
: routes[index + 1]?.transportType || '',
cityName:
route.arrivalCityName ||
route.departureCityName ||
(isEnd ? row.arrivalCityName : ''),
districtName:
route.arrivalDistrictName ||
route.departureDistrictName ||
(isEnd ? row.arrivalDistrictName : ''),
siteCode:
route.arrivalSiteCode ||
route.departureSiteCode ||
(isEnd ? row.arrivalSiteCode : ''),
});
return { return {
key: route.segmentNo || `route-${index}`, key: route.segmentNo || `route-${index}`,
type: isEnd ? 'end' : 'middle', type: isEnd ? 'end' : 'middle',
text: isEnd ? '终' : '经', text: isEnd ? '终' : '经',
name: this.routeNodeName( ...location,
route.arrivalName || route.departureName || row.arrivalName,
route.arrivalAddress || route.departureAddress,
route.transportType,
{
cityName: route.arrivalCityName || route.departureCityName,
districtName: route.arrivalDistrictName || route.departureDistrictName,
siteCode: route.arrivalSiteCode || route.departureSiteCode,
}
),
lines: isEnd lines: isEnd
? [`到达${arrived}/${total}`] ? [`到达${arrived}/${total}`]
: [`到达 ${arrived}/${total}`, `已调度 ${dispatched}/到达${arrived}/${total}`], : [`到达 ${arrived}/${total}`, `已调度 ${dispatched}/到达${arrived}/${total}`],
@@ -494,31 +590,43 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.master-search { .master-order-page {
margin-bottom: 12px; &__search {
padding: 12px 12px 4px; padding: 12px 12px 4px;
background: #fff; margin-bottom: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); background: #fff;
.el-form-item { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&__search-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 8px 24px;
}
&__search-actions {
display: flex;
grid-column: 1 / -1;
justify-content: flex-end;
align-items: center;
gap: 8px;
min-height: 32px;
}
:deep(.el-form-item) {
margin-bottom: 8px; margin-bottom: 8px;
} }
.el-input,
.el-select,
.el-date-editor {
width: 100%;
}
:deep(.el-form-item__label) { :deep(.el-form-item__label) {
white-space: nowrap; white-space: nowrap;
} }
.search-actions {
display: flex; :deep(.el-input),
justify-content: flex-end; :deep(.el-select),
align-items: center; :deep(.el-date-editor.el-input),
gap: 12px; :deep(.el-date-editor.el-input__wrapper),
min-height: 40px; :deep(.el-date-editor--datetimerange) {
.el-icon { width: 100%;
margin-right: 4px;
}
} }
} }
.master-list-panel { .master-list-panel {
@@ -612,10 +720,16 @@ export default {
line-height: 1.8; line-height: 1.8;
white-space: nowrap; white-space: nowrap;
strong { strong {
display: inline-block;
max-width: 150px;
overflow: hidden;
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
line-height: 1.4; line-height: 1.4;
max-width: 180px; text-overflow: ellipsis;
white-space: nowrap;
vertical-align: bottom;
cursor: default;
} }
} }
.route-connector { .route-connector {
@@ -0,0 +1,149 @@
<template>
<div ref="page" class="project-apply-public-view">
<project-apply ref="project" />
</div>
</template>
<script>
import ProjectApply from './project-apply.vue';
import { postMkPublicProcessMessage } from '@/api/mk-process';
export default {
name: 'ProjectApplyPublicView',
components: {
ProjectApply,
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay => setTimeout(this.handleIframeHeight, delay));
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
sendIframeHeight() {
this.$nextTick(() => {
window.parent.postMessage({ height: document.body.clientHeight }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage({ type: 'afterSubmit', success: true, parameters }, '*');
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
postMkPublicProcessMessage('project-apply', {
status,
formValues: formValues || {},
formData,
}).catch(error => {
console.error('项目公开页提交流程数据失败:', error);
});
},
buildFormData() {
const form = this.getProjectForm();
return {
...form,
subject: form.projectName || form.projectShortName || '',
formInstanceId: this.getFormId(),
};
},
getProjectForm() {
const form = this.$refs.project && this.$refs.project.form;
if (!form) return {};
try {
return JSON.parse(JSON.stringify(form));
} catch (error) {
return { ...form };
}
},
getFormId() {
return this.$route.query.id || this.getProjectForm().id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.project-apply-public-view {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
}
</style>
+207 -70
View File
@@ -1,5 +1,5 @@
<template> <template>
<basic-container class="project-apply-page"> <basic-container class="project-apply-page" :class="{ 'is-public-view': isPublicViewPage }">
<avue-crud <avue-crud
v-if="!isProjectFormPage" v-if="!isProjectFormPage"
:option="tableOption" :option="tableOption"
@@ -196,7 +196,7 @@
<el-form-item label="项目编号" prop="projectCode"> <el-form-item label="项目编号" prop="projectCode">
<el-input <el-input
v-model="form.projectCode" v-model="form.projectCode"
placeholder="请输入" :placeholder="dialogType === 'add' ? '若不填写,系统自动生成' : '请输入'"
:disabled="dialogType === 'edit'" :disabled="dialogType === 'edit'"
/> />
</el-form-item> </el-form-item>
@@ -703,6 +703,7 @@
label="变更内容" label="变更内容"
min-width="180" min-width="180"
align="center" align="center"
:show-overflow-tooltip="false"
> >
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip placement="top" :show-after="200"> <el-tooltip placement="top" :show-after="200">
@@ -730,43 +731,10 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog <change-record-detail-dialog
v-model="changeRecordDetailVisible" v-model="changeRecordDetailVisible"
title="变更记录详情" :rows="changeRecordDetailRows"
append-to-body />
destroy-on-close
width="1100px"
top="10px"
class="project-change-record-detail-dialog"
>
<div v-if="changeRecordDetail" class="project-change-record-detail-meta">
<span>变更日期{{ changeRecordDetail.changeDate || '-' }}</span>
<span>变更账号{{ changeRecordDetail.handler || '-' }}</span>
</div>
<el-table :data="changeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="project-change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="project-change-record-detail-value"
/>
</el-table>
<el-empty
v-if="!changeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="changeRecordDetailVisible = false">关闭</el-button>
</template>
</el-dialog>
<template v-if="isChangeDialog"> <template v-if="isChangeDialog">
<div class="dialog-section-title">变更原因</div> <div class="dialog-section-title">变更原因</div>
@@ -784,6 +752,7 @@
</el-form> </el-form>
<div <div
v-if="!isPublicViewPage"
class="project-apply-dialog__footer" class="project-apply-dialog__footer"
:class="{ 'project-apply-dialog__footer--change': isChangeDialog }" :class="{ 'project-apply-dialog__footer--change': isChangeDialog }"
> >
@@ -909,12 +878,29 @@
/> />
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
v-model="publicCustomerVisible"
title="查看客商档案"
append-to-body
destroy-on-close
width="92%"
top="4vh"
class="project-apply-public-customer-dialog"
>
<customer-archive
v-if="publicCustomerVisible"
:embedded-public-id="publicCustomerId"
/>
</el-dialog>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import { exportBlob } from '@/api/common'; import { exportBlob } from '@/api/common';
import { defineAsyncComponent } from 'vue';
import * as api from '@/api/business/project-apply'; import * as api from '@/api/business/project-apply';
import { getMkPublicDetail } from '@/api/mk-process';
import { import {
getList as getCustomerArchiveList, getList as getCustomerArchiveList,
getDetail as getCustomerArchiveDetail, getDetail as getCustomerArchiveDetail,
@@ -925,9 +911,11 @@ import { getDictionary as getBizDictionary } from '@/api/system/dictbiz';
import { getList as getUserList } from '@/api/system/user'; import { getList as getUserList } from '@/api/system/user';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { downloadFileByUrl, downloadXls } from '@/utils/util'; import { downloadFileByUrl, downloadXls } from '@/utils/util';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import { ElImageViewer } from 'element-plus'; import { ElImageViewer } from 'element-plus';
import { OpenFileViewer } from '@open-file-viewer/vue'; import { OpenFileViewer } from '@open-file-viewer/vue';
import PdfPreview from '@/components/pdf-preview/main.vue'; import PdfPreview from '@/components/pdf-preview/main.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import { import {
fallbackPlugin, fallbackPlugin,
imagePlugin, imagePlugin,
@@ -1044,7 +1032,10 @@ const majorProjectAttachmentTypeOptions = [
].map(item => ({ label: item, value: item })).concat(otherAttachmentType); ].map(item => ({ label: item, value: item })).concat(otherAttachmentType);
export default { export default {
name: 'ProjectApply',
components: { components: {
CustomerArchive: defineAsyncComponent(() => import('@/views/vehicle/customer-archive.vue')),
ChangeRecordDetailDialog,
ElImageViewer, ElImageViewer,
OpenFileViewer, OpenFileViewer,
PdfPreview, PdfPreview,
@@ -1116,6 +1107,10 @@ export default {
total: 0, total: 0,
}, },
selectionList: [], selectionList: [],
// keep-alive $route
// isProjectFormPage false div el-dialogappend-to-body
//
isFormPageInstance: false,
projectBox: false, projectBox: false,
dialogType: 'add', dialogType: 'add',
dialogReadonly: false, dialogReadonly: false,
@@ -1234,6 +1229,8 @@ export default {
changeRecordDetail: null, changeRecordDetail: null,
changeRecordDetailRows: [], changeRecordDetailRows: [],
userBox: false, userBox: false,
publicCustomerVisible: false,
publicCustomerId: '',
userPickType: '', userPickType: '',
userLoading: false, userLoading: false,
userData: [], userData: [],
@@ -1308,13 +1305,17 @@ export default {
return ['add', 'majorSupplement'].includes(this.dialogType); return ['add', 'majorSupplement'].includes(this.dialogType);
}, },
isProjectFormPage() { isProjectFormPage() {
return this.$route.path === '/business/project-apply/form'; return this.isFormPageInstance;
},
isPublicViewPage() {
return this.$route.path === '/business/project-apply/public-view';
}, },
projectFormContainer() { projectFormContainer() {
return this.isProjectFormPage ? 'div' : 'el-dialog'; // keep-alive
return this.isFormPageInstance ? 'div' : 'el-dialog';
}, },
projectFormContainerProps() { projectFormContainerProps() {
if (this.isProjectFormPage) return { class: 'project-apply-page-form' }; if (this.isFormPageInstance) return { class: 'project-apply-page-form' };
return { return {
modelValue: this.projectBox, modelValue: this.projectBox,
title: this.projectDialogTitle, title: this.projectDialogTitle,
@@ -1355,15 +1356,36 @@ export default {
}, },
}, },
created() { created() {
if (this.isPublicViewPage) {
this.isFormPageInstance = true;
this.openPublicProjectForm();
return;
}
this.loadDeptOptions(); this.loadDeptOptions();
this.loadCargoTypeOptions(); this.loadCargoTypeOptions();
this.loadTransportTypeOptions(); this.loadTransportTypeOptions();
this.loadSettlementModeOptions(); this.loadSettlementModeOptions();
if (this.isProjectFormPage) { if (this.$route.path === '/business/project-apply/form') {
this.isFormPageInstance = true;
this.openProjectFormPage(); this.openProjectFormPage();
} }
}, },
// keep-alive append-to-body
// Teleport DOM
deactivated() {
this.closeInnerDialogs();
},
beforeUnmount() {
this.closeInnerDialogs();
},
methods: { methods: {
closeInnerDialogs() {
this.changeRecordDetailVisible = false;
this.attachmentDocumentPreviewVisible = false;
this.attachmentImagePreviewVisible = false;
this.userBox = false;
this.publicCustomerVisible = false;
},
buildTableOption() { buildTableOption() {
return { return {
...option, ...option,
@@ -1385,6 +1407,75 @@ export default {
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission && this.permission[code], false); return this.isAdmin || this.validData(this.permission && this.permission[code], false);
}, },
openPublicProjectForm() {
const id = this.$route.query.id;
this.dialogType = 'view';
this.dialogReadonly = true;
this.projectBox = true;
if (!id) {
this.$message.error('缺少项目ID');
return;
}
getMkPublicDetail('project-apply', id)
.then(res => {
const detail = res.data?.data || {};
this.applyPublicDictOptions(detail);
const displayDetail = { ...detail };
delete displayDetail.cargoTypeOptions;
delete displayDetail.transportTypeOptions;
delete displayDetail.settlementModeOptions;
this.applyProjectDetail(displayDetail);
})
.catch(() => {
this.$message.error('项目信息加载失败');
});
},
applyPublicDictOptions(detail = {}) {
this.cargoTypeOptions = this.resolvePublicDictOptions(
detail.cargoTypeOptions,
detail.cargoType
);
this.transportTypeOptions = this.resolvePublicDictOptions(
detail.transportTypeOptions,
detail.transportType
);
this.settlementModeOptions = this.resolvePublicDictOptions(
detail.settlementModeOptions,
detail.settlementMode
);
if (detail.businessDeptId) {
const label = detail.businessDeptName || String(detail.businessDeptId);
this.businessDeptTreeOptions = [{ label, value: detail.businessDeptId }];
this.deptOptions = [{ label, rawLabel: label, value: detail.businessDeptId }];
}
if (detail.undertakeDeptId) {
this.platformCompanyOptions = [
{
label: detail.undertakeDeptName || String(detail.undertakeDeptId),
value: detail.undertakeDeptId,
},
];
}
},
resolvePublicDictOptions(options, currentValue) {
const list = Array.isArray(options)
? options
.filter(item => item && item.value !== undefined && item.value !== null && item.value !== '')
.map(item => ({
label: item.label || String(item.value),
value: item.value,
}))
: [];
if (
currentValue !== undefined &&
currentValue !== null &&
currentValue !== '' &&
!list.some(item => String(item.value) === String(currentValue))
) {
list.unshift({ label: String(currentValue), value: currentValue });
}
return list;
},
openProjectFormPage() { openProjectFormPage() {
const type = this.$route.query.mode || 'add'; const type = this.$route.query.mode || 'add';
const id = this.$route.query.id; const id = this.$route.query.id;
@@ -1399,6 +1490,7 @@ export default {
this.fillDefaultUsers(); this.fillDefaultUsers();
return; return;
} }
if (!id) return;
this.api.getDetail(id).then(res => { this.api.getDetail(id).then(res => {
const detail = res.data.data || {}; const detail = res.data.data || {};
const isChange = type === 'change'; const isChange = type === 'change';
@@ -1569,7 +1661,17 @@ export default {
} }
const run = value => { const run = value => {
const args = operation.prompt ? [row.id, value] : [row.id]; const args = operation.prompt ? [row.id, value] : [row.id];
this.api[operation.action](...args).then(res => { const request = () => this.api[operation.action](...args);
const afterMk =
operation.action === 'submitApproval'
? submitMkApprovalFlow({
bizType: 'project-apply',
formInstanceId: row.id,
subjectName: row.projectName || '',
approvalStatus: row.approvalStatus || '',
}).then(() => request())
: request();
afterMk.then(res => {
if (res.data?.success === false || res.data?.data === false) { if (res.data?.success === false || res.data?.data === false) {
this.$message.error(res.data?.msg || `${operation.label}失败,请联系管理员`); this.$message.error(res.data?.msg || `${operation.label}失败,请联系管理员`);
return; return;
@@ -1737,9 +1839,26 @@ export default {
this.$message.error(res.data?.msg || '保存失败,请联系管理员'); this.$message.error(res.data?.msg || '保存失败,请联系管理员');
return; return;
} }
this.$message.success('操作成功!'); const data = res.data?.data || {};
this.closeProjectForm(); const id = data.id || this.form.id;
this.onLoad(this.page, this.query); const name = data.projectName || this.form.projectName || '';
const status = data.approvalStatus || this.form.approvalStatus || '';
if (!id) {
this.$message.success('操作成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
return;
}
return submitMkApprovalFlow({
bizType: 'project-apply',
formInstanceId: id,
subjectName: name,
approvalStatus: status,
}).then(() => {
this.$message.success('提交成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
});
}, },
error => { error => {
window.console.log(error); window.console.log(error);
@@ -1807,9 +1926,23 @@ export default {
); );
return; return;
} }
this.$message.success(`${needSubmit ? '提交' : '保存'}成功!`); if (!needSubmit) {
this.closeProjectForm(); this.$message.success('保存成功!');
this.onLoad(this.page, this.query); this.closeProjectForm();
this.onLoad(this.page, this.query);
return;
}
const id = this.form.id;
return submitMkApprovalFlow({
bizType: 'project-apply',
formInstanceId: id,
subjectName: this.form.projectName || '',
approvalStatus: this.form.approvalStatus || 'change_rejected',
}).then(() => {
this.$message.success('提交成功!');
this.closeProjectForm();
this.onLoad(this.page, this.query);
});
}) })
.finally(() => { .finally(() => {
this.submitLoading = false; this.submitLoading = false;
@@ -1950,6 +2083,11 @@ export default {
this.$message.warning('客商档案 ID 为空,无法打开'); this.$message.warning('客商档案 ID 为空,无法打开');
return; return;
} }
if (this.isPublicViewPage) {
this.publicCustomerId = String(id);
this.publicCustomerVisible = true;
return;
}
this.$router.push({ this.$router.push({
path: '/vehicle/customer-archive/form', path: '/vehicle/customer-archive/form',
query: { id: String(id), name: '查看客商档案', view: '1' }, query: { id: String(id), name: '查看客商档案', view: '1' },
@@ -2532,6 +2670,12 @@ export default {
this.$message.warning('项目ID为空,无法查看变更详情'); this.$message.warning('项目ID为空,无法查看变更详情');
return; return;
} }
if (this.isPublicViewPage) {
this.changeRecordDetail = { ...row };
this.changeRecordDetailRows = this.buildChangeRecordDetailRows(this.changeRecordDetail);
this.changeRecordDetailVisible = true;
return;
}
try { try {
if (!this.transportTypeOptions.length) { if (!this.transportTypeOptions.length) {
await this.loadTransportTypeOptions(); await this.loadTransportTypeOptions();
@@ -2588,6 +2732,12 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.project-apply-page.is-public-view {
:deep(.el-link) {
pointer-events: auto;
}
}
.project-apply-form { .project-apply-form {
padding: 0; padding: 0;
@@ -2820,27 +2970,6 @@ export default {
} }
} }
:deep(.project-change-record-detail-dialog .el-dialog__body) {
max-height: 65vh;
overflow: auto;
}
:deep(.project-change-record-detail-dialog .project-change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-word;
overflow: visible;
text-overflow: clip;
line-height: 1.6;
}
.project-change-record-detail-meta {
display: flex;
gap: 32px;
margin-bottom: 16px;
color: #606266;
font-size: 14px;
}
:global(.project-apply-dialog .el-dialog__body) { :global(.project-apply-dialog .el-dialog__body) {
max-height: 76vh; max-height: 76vh;
overflow-y: auto; overflow-y: auto;
@@ -2957,3 +3086,11 @@ export default {
} }
} }
</style> </style>
<style lang="scss">
.project-apply-public-customer-dialog .el-dialog__body {
max-height: 78vh;
overflow: auto;
padding-top: 8px;
}
</style>
+101 -23
View File
@@ -99,13 +99,25 @@
<el-table :data="attachmentRows" border @selection-change="selectedAttachments = $event"> <el-table :data="attachmentRows" border @selection-change="selectedAttachments = $event">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" /> <el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column label="文件名" min-width="240" show-overflow-tooltip> <el-table-column label="文件名" min-width="240" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<el-link type="primary" @click="previewAttachment(row)"> <el-link type="primary" @click="previewAttachment(row)">
{{ attachmentName(row) }} {{ attachmentName(row) }}
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="附件描述" min-width="220">
<template #default="{ row }">
<span v-if="dialogReadonly">{{ row.description || '-' }}</span>
<el-input
v-else
v-model="row.description"
maxlength="200"
placeholder="请输入"
@input="syncAttachmentsJson"
/>
</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center"> <el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template> <template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column> </el-table-column>
@@ -172,7 +184,7 @@
title="查看临时额度申请" title="查看临时额度申请"
append-to-body append-to-body
destroy-on-close destroy-on-close
width="96%" width="1100px"
class="temporary-credit-limit-dialog temporary-credit-limit-detail-dialog" class="temporary-credit-limit-dialog temporary-credit-limit-detail-dialog"
> >
<div v-loading="detailLoading" class="business-crud-page__detail-content"> <div v-loading="detailLoading" class="business-crud-page__detail-content">
@@ -204,13 +216,16 @@
</div> </div>
<el-table :data="attachmentRows" empty-text="暂无附件"> <el-table :data="attachmentRows" empty-text="暂无附件">
<el-table-column type="index" label="序号" width="70" align="center" /> <el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column label="文件名" min-width="240" show-overflow-tooltip> <el-table-column label="文件名" min-width="240" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<el-link type="primary" @click="previewAttachment(row)"> <el-link type="primary" @click="previewAttachment(row)">
{{ attachmentName(row) }} {{ attachmentName(row) }}
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="附件描述" min-width="220" show-overflow-tooltip>
<template #default="{ row }">{{ row.description || '-' }}</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center"> <el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template> <template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column> </el-table-column>
@@ -595,7 +610,12 @@ export default {
return value; return value;
}, },
applyDetail(detail) { applyDetail(detail) {
this.form = { ...detail }; this.form = {
...detail,
projectFundLimit: this.blankSentinelAmount(detail.projectFundLimit),
usedFundLimit: this.blankSentinelAmount(detail.usedFundLimit),
remainingFundLimit: this.blankSentinelAmount(detail.remainingFundLimit),
};
this.selectedProjectId = detail.projectId || ''; this.selectedProjectId = detail.projectId || '';
this.attachmentRows = this.parseJsonArray(detail.attachmentsJson); this.attachmentRows = this.parseJsonArray(detail.attachmentsJson);
this.selectedAttachments = []; this.selectedAttachments = [];
@@ -605,6 +625,9 @@ export default {
const { projectQuotaInfoTitle, temporaryCreditInfoTitle, ...payload } = row || {}; const { projectQuotaInfoTitle, temporaryCreditInfoTitle, ...payload } = row || {};
return { return {
...payload, ...payload,
projectFundLimit: this.toOptionalAmount(payload.projectFundLimit),
usedFundLimit: this.toOptionalAmount(payload.usedFundLimit),
remainingFundLimit: this.toOptionalAmount(payload.remainingFundLimit),
applyLimit: payload.applyLimit === '' ? '' : Number(payload.applyLimit), applyLimit: payload.applyLimit === '' ? '' : Number(payload.applyLimit),
attachmentsJson: JSON.stringify(this.attachmentRows), attachmentsJson: JSON.stringify(this.attachmentRows),
}; };
@@ -750,8 +773,8 @@ export default {
projectName: project.projectName || '', projectName: project.projectName || '',
projectCode: project.projectCode || '', projectCode: project.projectCode || '',
undertakeDeptName: project.undertakeDeptName || '', undertakeDeptName: project.undertakeDeptName || '',
projectFundLimit: project.fundLimit || project.projectFundLimit || 0, projectFundLimit: this.blankSentinelAmount(project.fundLimit ?? project.projectFundLimit),
usedFundLimit: project.usedFundLimit || 0, usedFundLimit: this.blankSentinelAmount(project.usedFundLimit),
}); });
this.form.remainingFundLimit = this.calculateRemainingFundLimit(); this.form.remainingFundLimit = this.calculateRemainingFundLimit();
getProjectDetail(project.id).then(res => { getProjectDetail(project.id).then(res => {
@@ -759,18 +782,32 @@ export default {
Object.assign(this.form, { Object.assign(this.form, {
projectCode: detail.projectCode || this.form.projectCode, projectCode: detail.projectCode || this.form.projectCode,
undertakeDeptName: detail.undertakeDeptName || this.form.undertakeDeptName, undertakeDeptName: detail.undertakeDeptName || this.form.undertakeDeptName,
projectFundLimit: projectFundLimit: this.blankSentinelAmount(
detail.fundLimit ?? detail.projectFundLimit ?? this.form.projectFundLimit, detail.fundLimit ?? detail.projectFundLimit ?? this.form.projectFundLimit
usedFundLimit: detail.usedFundLimit ?? this.form.usedFundLimit, ),
usedFundLimit: this.blankSentinelAmount(
detail.usedFundLimit ?? this.form.usedFundLimit
),
}); });
this.form.remainingFundLimit = this.calculateRemainingFundLimit(); this.form.remainingFundLimit = this.calculateRemainingFundLimit();
}); });
}, },
blankSentinelAmount(value) {
if (value === undefined || value === null || value === '') return '';
return Number(value) === -1 ? '' : value;
},
toOptionalAmount(value) {
const amount = this.blankSentinelAmount(value);
return amount === '' ? null : amount;
},
calculateRemainingFundLimit() { calculateRemainingFundLimit() {
const total = Number(this.form.projectFundLimit); const total = this.blankSentinelAmount(this.form.projectFundLimit);
const used = Number(this.form.usedFundLimit); const used = this.blankSentinelAmount(this.form.usedFundLimit);
if (!Number.isFinite(total) || !Number.isFinite(used)) return ''; if (total === '' || used === '') return '';
return Math.round((total - used + Number.EPSILON) * 100) / 100; const totalAmount = Number(total);
const usedAmount = Number(used);
if (!Number.isFinite(totalAmount) || !Number.isFinite(usedAmount)) return '';
return Math.round((totalAmount - usedAmount + Number.EPSILON) * 100) / 100;
}, },
handleAmountInput(value) { handleAmountInput(value) {
const text = String(value || '').replace(/[^\d.]/g, ''); const text = String(value || '').replace(/[^\d.]/g, '');
@@ -783,24 +820,37 @@ export default {
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss'); const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
this.attachmentRows = (list || []).map(item => ({ this.attachmentRows = (list || []).map(item => ({
...item, ...item,
description: item.description || '',
uploadUserName: item.uploadUserName || uploadUserName, uploadUserName: item.uploadUserName || uploadUserName,
uploadTime: item.uploadTime || uploadTime, uploadTime: item.uploadTime || uploadTime,
})); }));
this.form.attachmentsJson = JSON.stringify(this.attachmentRows); this.syncAttachmentsJson();
}, },
removeAttachment(index) { removeAttachment(index) {
this.attachmentRows.splice(index, 1); this.attachmentRows.splice(index, 1);
this.form.attachmentsJson = JSON.stringify(this.attachmentRows); this.syncAttachmentsJson();
},
syncAttachmentsJson() {
this.form.attachmentsJson = JSON.stringify(this.attachmentRows || []);
}, },
parseJsonArray(value) { parseJsonArray(value) {
if (Array.isArray(value)) return value; let list = [];
if (!value) return []; if (Array.isArray(value)) {
try { list = value;
const data = JSON.parse(value); } else if (!value) {
return Array.isArray(data) ? data : [];
} catch (error) {
return []; return [];
} else {
try {
const data = JSON.parse(value);
list = Array.isArray(data) ? data : [];
} catch (error) {
return [];
}
} }
return list.map(item => ({
...item,
description: item?.description || '',
}));
}, },
attachmentName(row = {}) { attachmentName(row = {}) {
return row.originalName || row.name || row.fileName || '附件'; return row.originalName || row.name || row.fileName || '附件';
@@ -907,6 +957,7 @@ export default {
.temporary-credit-limit-page { .temporary-credit-limit-page {
&__field { &__field {
width: 100%; width: 100%;
max-width: 240px;
} }
&__attachment-head { &__attachment-head {
@@ -993,7 +1044,7 @@ export default {
align-items: center; align-items: center;
gap: 8px; gap: 8px;
width: 100%; width: 100%;
padding: 14px 16px 4px; padding: 14px 0 4px;
margin-bottom: 0; margin-bottom: 0;
color: #303133; color: #303133;
font-size: 15px; font-size: 15px;
@@ -1086,9 +1137,36 @@ export default {
background: transparent !important; background: transparent !important;
box-shadow: none !important; box-shadow: none !important;
margin: 0 !important; margin: 0 !important;
padding: 0 !important; padding: 0 16px 8px !important;
border-radius: 0 !important; border-radius: 0 !important;
} }
// /
&:not(.temporary-credit-limit-detail-dialog) {
.el-form-item__content {
min-width: 0;
}
.el-form-item__content > .el-input,
.el-form-item__content > .el-select,
.el-form-item__content > .el-date-editor,
.el-form-item__content > .el-cascader,
.el-form-item__content > .el-textarea,
.temporary-credit-limit-page__field {
width: 100%;
max-width: 240px;
}
.el-form-item__content > .el-textarea {
max-width: 100%;
}
.el-date-editor.el-input,
.el-date-editor.el-input__wrapper {
width: 100%;
max-width: 240px;
}
}
} }
.temporary-credit-limit-dialog .business-crud-page__detail-content .el-descriptions__label { .temporary-credit-limit-dialog .business-crud-page__detail-content .el-descriptions__label {
+365 -244
View File
@@ -1,116 +1,113 @@
<template> <template>
<basic-container class="transport-plan-dispatch-page"> <basic-container class="transport-plan-dispatch-page">
<div v-loading="loading" class="transport-plan-dispatch-page__shell"> <div v-loading="loading" class="transport-plan-dispatch-page__shell">
<!-- 顶部信息区 --> <!-- 顶部信息区对齐运单详情汇总样式 -->
<div class="transport-plan-dispatch-page__top"> <section-card class="transport-plan-dispatch-page__summary">
<div class="transport-plan-dispatch-page__heading"> <div class="transport-plan-dispatch-page__heading">
<div class="transport-plan-dispatch-page__heading-title"> <el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button>
<el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button> <strong>计划调度</strong>
<span class="transport-plan-dispatch-page__heading-name">计划调度</span> <span>{{ planData.planNo || planData.loadingNo || '-' }}</span>
<span class="transport-plan-dispatch-page__heading-no"> <span class="detail-status-text" :class="statusTextClass">
{{ planData.planNo || planData.loadingNo || '-' }} {{ planData.businessStatusName || '-' }}
</span>
<span class="detail-status-text detail-transport-type">
{{ planData.transportTypeName || '公路运输' }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-grid">
<div class="transport-plan-dispatch-page__summary-item">
<span class="transport-plan-dispatch-page__summary-label">客户</span>
<span class="transport-plan-dispatch-page__summary-value">
{{ planData.customerName || '-' }}
</span> </span>
<el-tag :type="getStatusTagType(planData.businessStatus)" effect="light" class="status-text"> </div>
{{ planData.businessStatusName || '-' }} <div class="transport-plan-dispatch-page__summary-item">
</el-tag> <span class="transport-plan-dispatch-page__summary-label">合同编号</span>
<el-tag type="primary" effect="light"> <span class="transport-plan-dispatch-page__summary-value is-link">
{{ planData.transportTypeName || '公路整车' }} {{ planData.contractNo || '-' }}
</el-tag> </span>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<span class="transport-plan-dispatch-page__summary-label">项目</span>
<span class="transport-plan-dispatch-page__summary-value">
{{ planData.projectName || '-' }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<span class="transport-plan-dispatch-page__summary-label">计划执行时间</span>
<span class="transport-plan-dispatch-page__summary-value">
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
</span>
</div>
<div class="transport-plan-dispatch-page__summary-item is-goods">
<span class="transport-plan-dispatch-page__summary-label">货物信息</span>
<span class="transport-plan-dispatch-page__summary-value is-wrap">
{{ planData.goodsInfo || formatGoodsInfo(planData) }}
</span>
</div>
<div class="transport-plan-dispatch-page__route">
<div class="transport-plan-dispatch-page__route-item is-start">
<div class="transport-plan-dispatch-page__route-marker"></div>
<div class="transport-plan-dispatch-page__route-detail">
<strong class="transport-plan-dispatch-page__route-name">
{{
formatRouteCityDistrict(planData.departureAddress || planData.departureName)
}}
</strong>
<el-tooltip
:content="planData.departureAddress || planData.departureName || '-'"
placement="top"
>
<span class="transport-plan-dispatch-page__route-addr">
{{ planData.departureAddress || planData.departureName || '-' }}
</span>
</el-tooltip>
<div class="transport-plan-dispatch-page__route-contact">
<span>联系人{{ planData.departureContact || '-' }}</span>
<span>联系方式{{ planData.departurePhone || '-' }}</span>
</div>
</div>
</div>
<span class="transport-plan-dispatch-page__route-line" aria-hidden="true" />
<div class="transport-plan-dispatch-page__route-item is-end">
<div class="transport-plan-dispatch-page__route-marker"></div>
<div class="transport-plan-dispatch-page__route-detail">
<strong class="transport-plan-dispatch-page__route-name">
{{ formatRouteCityDistrict(planData.arrivalAddress || planData.arrivalName) }}
</strong>
<el-tooltip
:content="planData.arrivalAddress || planData.arrivalName || '-'"
placement="top"
>
<span class="transport-plan-dispatch-page__route-addr">
{{ planData.arrivalAddress || planData.arrivalName || '-' }}
</span>
</el-tooltip>
<div class="transport-plan-dispatch-page__route-contact">
<span>联系人{{ planData.arrivalContact || '-' }}</span>
<span>联系方式{{ planData.arrivalPhone || '-' }}</span>
</div>
</div>
</div>
</div>
<div class="transport-plan-dispatch-page__attachments">
<span class="transport-plan-dispatch-page__summary-label">附件</span>
<div>
<el-link
v-for="(item, index) in attachmentList"
:key="index"
type="primary"
:href="item.url"
:underline="false"
target="_blank"
>
{{ item.name || item.originalName || '附件' }}
</el-link>
<span v-if="!attachmentList.length">-</span>
</div>
</div> </div>
</div> </div>
</section-card>
<div class="transport-plan-dispatch-page__summary">
<section-card title="基本信息" class="transport-plan-dispatch-page__summary-card">
<div class="transport-plan-dispatch-page__summary-grid">
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">客户</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.customerName || '-' }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">项目</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.projectName || '-' }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">合同编号</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.contractNo || '-' }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">计划执行时间</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item is-wide">
<div class="transport-plan-dispatch-page__summary-label">货物信息</div>
<div class="transport-plan-dispatch-page__summary-value">
{{ planData.goodsInfo || formatGoodsInfo(planData) }}
</div>
</div>
<div class="transport-plan-dispatch-page__summary-item">
<div class="transport-plan-dispatch-page__summary-label">附件</div>
<div class="transport-plan-dispatch-page__summary-value">
<template v-if="attachmentList.length">
<el-link
v-for="(item, index) in attachmentList"
:key="index"
type="primary"
:href="item.url"
:underline="false"
target="_blank"
class="transport-plan-dispatch-page__attachment-link"
>
{{ item.name || item.originalName || '附件' }}
</el-link>
</template>
<span v-else>-</span>
</div>
</div>
</div>
</section-card>
<section-card title="收发货路线" class="transport-plan-dispatch-page__route-card">
<div class="transport-plan-dispatch-page__route">
<div class="transport-plan-dispatch-page__route-item">
<span class="transport-plan-dispatch-page__route-badge is-start"></span>
<div class="transport-plan-dispatch-page__route-body">
<div class="transport-plan-dispatch-page__route-title">
{{ planData.departureName || '-' }}
</div>
<div class="transport-plan-dispatch-page__route-address">
{{ formatAddress(planData.departureAddress) }}
</div>
<div class="transport-plan-dispatch-page__route-contact">
{{ formatContact(planData.departureContact, planData.departurePhone) }}
</div>
</div>
</div>
<div class="transport-plan-dispatch-page__route-vehicle">
<el-icon><Van /></el-icon>
</div>
<div class="transport-plan-dispatch-page__route-item">
<span class="transport-plan-dispatch-page__route-badge is-end"></span>
<div class="transport-plan-dispatch-page__route-body">
<div class="transport-plan-dispatch-page__route-title">
{{ planData.arrivalName || '-' }}
</div>
<div class="transport-plan-dispatch-page__route-address">
{{ formatAddress(planData.arrivalAddress) }}
</div>
<div class="transport-plan-dispatch-page__route-contact">
{{ formatContact(planData.arrivalContact, planData.arrivalPhone) }}
</div>
</div>
</div>
</div>
</section-card>
</div>
</div>
<!-- 调度列表 --> <!-- 调度列表 -->
<section-card class="transport-plan-dispatch-page__list-card"> <section-card class="transport-plan-dispatch-page__list-card">
@@ -204,7 +201,6 @@
</template> </template>
<script> <script>
import { Van } from '@element-plus/icons-vue';
import { getDetail, dispatch } from '@/api/business/transport-plan'; import { getDetail, dispatch } from '@/api/business/transport-plan';
import SectionCard from '@/components/section-card/main.vue'; import SectionCard from '@/components/section-card/main.vue';
import TransportPlanPage from './components/transport-plan-page.vue'; import TransportPlanPage from './components/transport-plan-page.vue';
@@ -216,7 +212,6 @@ const TRANSPORT_PLAN_QUANTITY_UNIT = '吨';
export default { export default {
name: 'TransportPlanDispatch', name: 'TransportPlanDispatch',
components: { components: {
Van,
SectionCard, SectionCard,
TransportPlanPage, TransportPlanPage,
}, },
@@ -237,11 +232,21 @@ export default {
planId() { planId() {
return this.$route.query.planId; return this.$route.query.planId;
}, },
statusTextClass() {
const status = this.planData.businessStatus;
if (status === 2 || status === '2') return 'status-text-success';
if (status === 1 || status === '1') return 'is-dispatching';
if (status === 3 || status === '3') return 'is-danger';
return 'is-info';
},
summaryText() { summaryText() {
const goodsList = this.parseGoodsList(this.planData.goodsJson); const goodsList = this.parseGoodsList(this.planData.goodsJson);
if (!goodsList.length) { if (!goodsList.length) {
const total = Number(this.planData.totalQuantity || 0); const total = Number(this.planData.totalQuantity || 0);
const dispatched = this.calculateDispatchedQuantity(); const dispatched = this.calculateDispatchedQuantity();
if (total <= 0) {
return `已调度 ${dispatched.toFixed(2)}`;
}
const remaining = Math.max(total - dispatched, 0); const remaining = Math.max(total - dispatched, 0);
return `${total}吨 | 已调度 ${dispatched.toFixed(2)}吨,剩余${remaining.toFixed(2)}`; return `${total}吨 | 已调度 ${dispatched.toFixed(2)}吨,剩余${remaining.toFixed(2)}`;
} }
@@ -264,6 +269,9 @@ export default {
}); });
const parts = Object.entries(summary).map(([unit, data]) => { const parts = Object.entries(summary).map(([unit, data]) => {
if (data.total <= 0) {
return `已调度 ${data.dispatched.toFixed(2)}${unit}`;
}
const remaining = Math.max(data.total - data.dispatched, 0); const remaining = Math.max(data.total - data.dispatched, 0);
return `${data.total}${unit} | 已调度 ${data.dispatched.toFixed(2)}${unit},剩余${remaining.toFixed( return `${data.total}${unit} | 已调度 ${data.dispatched.toFixed(2)}${unit},剩余${remaining.toFixed(
2 2
@@ -276,13 +284,20 @@ export default {
const goodsList = this.parseGoodsList(this.planData.goodsJson); const goodsList = this.parseGoodsList(this.planData.goodsJson);
if (!goodsList.length) { if (!goodsList.length) {
const total = Number(this.planData.totalQuantity || 0); const total = Number(this.planData.totalQuantity || 0);
if (total <= 0) return true;
const dispatched = this.calculateDispatchedQuantity(); const dispatched = this.calculateDispatchedQuantity();
return dispatched < total; return dispatched < total;
} }
const hasPositiveTotal = goodsList.some(
goods => Number(goods.quantity || 0) > 0
);
if (!hasPositiveTotal) return true;
return goodsList.some(goods => { return goodsList.some(goods => {
const unit = goods.quantityUnit || TRANSPORT_PLAN_QUANTITY_UNIT; const unit = goods.quantityUnit || TRANSPORT_PLAN_QUANTITY_UNIT;
const totalQty = Number(goods.quantity || 0); const totalQty = Number(goods.quantity || 0);
if (totalQty <= 0) return true;
const dispatchedQty = this.dispatchList const dispatchedQty = this.dispatchList
.filter(item => item.quantityUnit === unit) .filter(item => item.quantityUnit === unit)
.reduce((sum, item) => sum + Number(item.quantity || 0), 0); .reduce((sum, item) => sum + Number(item.quantity || 0), 0);
@@ -364,15 +379,6 @@ export default {
calculateDispatchedQuantity() { calculateDispatchedQuantity() {
return this.dispatchList.reduce((sum, item) => sum + Number(item.quantity || 0), 0); return this.dispatchList.reduce((sum, item) => sum + Number(item.quantity || 0), 0);
}, },
getStatusTagType(status) {
const statusMap = {
0: 'info',
1: 'warning',
2: 'success',
3: 'danger',
};
return statusMap[status] || 'info';
},
formatDateRange(startDate, endDate) { formatDateRange(startDate, endDate) {
const dates = [startDate, endDate].filter(Boolean); const dates = [startDate, endDate].filter(Boolean);
return dates.length ? dates.join(' ~ ') : '-'; return dates.length ? dates.join(' ~ ') : '-';
@@ -382,9 +388,30 @@ export default {
const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/); const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/);
return match ? match[0] || address : address; return match ? match[0] || address : address;
}, },
formatContact(contact, phone) { formatProvinceCityDistrict(value) {
const parts = [contact, phone].filter(Boolean); const text = String(value || '').trim();
return parts.length ? parts.join(' / ') : '-'; if (!text) return '-';
const districtMatch = text.match(/(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗)/);
if (districtMatch) {
return text.slice(0, districtMatch.index + districtMatch[0].length);
}
const cityMatch = text.match(/市/);
return cityMatch ? text.slice(0, cityMatch.index + 1) : text;
},
formatRouteCityDistrict(value) {
const text = String(value || '').trim();
if (!text) return '-';
const provinceMatch = text.match(/^.+?(?:省|自治区|特别行政区)/);
const cityRegion = provinceMatch ? text.slice(provinceMatch[0].length) : text;
const cityMatch = cityRegion.match(/^(.+?市)/);
if (!cityMatch) return this.formatProvinceCityDistrict(text);
const city = cityMatch[1];
const remainder = cityRegion.slice(city.length);
const districtMatch = remainder.match(
/^(.+?(?:自治县|自治旗|林区|矿区|新区|开发区|区|县|旗){1,2})/
);
const district = districtMatch ? districtMatch[1] : '';
return [city, district].filter(Boolean).join(' ');
}, },
formatDriver(row) { formatDriver(row) {
const parts = [row.driverName, row.driverPhone].filter(Boolean); const parts = [row.driverName, row.driverPhone].filter(Boolean);
@@ -419,32 +446,33 @@ export default {
this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细'); this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细');
return; return;
} }
this.openPageDispatchItemDialog(-1);
// transport-plan-page
this.$nextTick(() => {
const component = this.$refs.transportPlanPageRef;
if (component) {
//
component.dispatchRow = this.planData;
component.dispatchRows = [...this.dispatchList];
//
component.openDispatchItemDialog(-1);
}
});
}, },
handleEdit(row, index) { handleEdit(row, index) {
// transport-plan-page this.openPageDispatchItemDialog(index, row);
},
openPageDispatchItemDialog(index = -1, row) {
this.$nextTick(() => { this.$nextTick(() => {
const component = this.$refs.transportPlanPageRef; const component = this.$refs.transportPlanPageRef;
if (component) { if (!component) return;
// component.dispatchRow = this.planData;
component.dispatchRow = this.planData; component.dispatchRows = [...this.dispatchList];
component.dispatchRows = [...this.dispatchList]; this.bindDispatchItemSaveSync(component);
// if (index >= 0) component.openDispatchItemDialog(index, row);
component.openDispatchItemDialog(index, row); else component.openDispatchItemDialog(-1);
}
}); });
}, },
bindDispatchItemSaveSync(component) {
if (component.__dispatchListSaveSynced) return;
const originalSave = component.saveDispatchItem;
component.saveDispatchItem = (...args) => {
originalSave.apply(component, args);
if (!component.dispatchItemBox) {
this.dispatchList = [...(component.dispatchRows || [])];
}
};
component.__dispatchListSaveSynced = true;
},
handleDelete(index) { handleDelete(index) {
this.$confirm('确定删除该调度明细?', '提示', { this.$confirm('确定删除该调度明细?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@@ -551,126 +579,189 @@ export default {
height: 100%; height: 100%;
} }
&__top { &__summary {
display: flex; :deep(.el-card__body) {
flex-direction: column; padding: 18px 22px;
gap: 16px; }
} }
&__heading { &__heading {
padding: 16px;
background: #fff;
border-radius: 4px;
&-title {
display: flex;
align-items: center;
gap: 12px;
font-size: 18px;
font-weight: 600;
}
&-name {
font-size: 18px;
}
&-no {
font-size: 14px;
color: #606266;
}
}
&__summary {
display: flex; display: flex;
gap: 16px; align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 18px;
&-card { strong {
flex: 1; font-size: 20px;
} }
&-grid { .detail-status-text {
display: grid; display: inline-flex;
grid-template-columns: repeat(2, 1fr); align-items: center;
gap: 16px; height: 28px;
padding: 0 12px;
border-radius: 8px;
font-size: 13px;
line-height: 28px;
} }
&-item { .status-text-success,
display: flex; .is-dispatching {
flex-direction: column; color: #67c23a;
gap: 8px; background: #e1f3d8;
&.is-wide {
grid-column: 1 / -1;
}
} }
&-label { .detail-transport-type {
font-size: 14px; color: #409eff;
background: #ecf5ff;
}
.is-danger {
color: #f56c6c;
background: #fef0f0;
}
.is-info {
color: #909399; color: #909399;
} background: #f4f4f5;
&-value {
font-size: 14px;
color: #303133;
} }
} }
&__route-card { &__summary-grid {
flex: 1; display: grid;
grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(360px, 1.5fr);
gap: 16px 24px;
}
&__summary-item {
display: flex;
flex-direction: column;
gap: 8px;
min-width: 0;
&.is-goods {
grid-column: 1 / 5;
}
}
&__summary-label {
color: #909399;
}
&__summary-value {
overflow: hidden;
color: #303133;
font-weight: 500;
text-overflow: ellipsis;
white-space: nowrap;
&.is-link {
color: #409eff;
}
&.is-wrap {
white-space: normal;
word-break: break-word;
}
} }
&__route { &__route {
display: grid;
grid-template-columns: minmax(100px, 1fr) minmax(36px, 0.7fr) minmax(100px, 1fr);
grid-row: 1 / span 3;
grid-column: 5;
align-items: start;
min-width: 0;
padding: 4px 0;
}
&__route-item {
display: flex; display: flex;
min-width: 0;
flex-direction: column;
align-items: center; align-items: center;
gap: 24px; text-align: center;
}
&-item { &__route-marker {
flex: 1; display: inline-flex;
width: 36px;
height: 36px;
align-items: center;
justify-content: center;
color: #fff;
border-radius: 8px;
background: #409eff;
font-size: 18px;
font-weight: 600;
.is-end & {
background: #67c23a;
}
}
&__route-line {
width: 100%;
height: 6px;
margin-top: 15px;
border-radius: 1px;
background: #e4e7ed;
}
&__route-detail {
display: flex;
min-width: 0;
flex-direction: column;
align-items: center;
gap: 5px;
margin-top: 8px;
width: 100%;
}
&__route-name {
max-width: 100%;
overflow: hidden;
color: #303133;
font-size: 18px;
font-weight: 600;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
&__route-addr {
display: block;
max-width: 100%;
overflow: hidden;
color: #606266;
font-size: 12px;
line-height: 1.5;
text-overflow: ellipsis;
white-space: nowrap;
}
&__route-contact {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 2px 8px;
max-width: 100%;
color: #909399;
font-size: 12px;
line-height: 1.5;
}
&__attachments {
grid-column: 1 / 5;
display: flex;
flex-direction: column;
gap: 8px;
div {
display: flex; display: flex;
gap: 12px; flex-wrap: wrap;
} gap: 16px;
&-badge {
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 14px;
flex-shrink: 0;
&.is-start {
background: #67c23a;
}
&.is-end {
background: #409eff;
}
}
&-body {
flex: 1;
display: flex;
flex-direction: column;
gap: 4px;
}
&-title {
font-size: 16px;
font-weight: 600;
}
&-address,
&-contact {
font-size: 14px;
color: #606266;
}
&-vehicle {
font-size: 24px;
color: #909399;
} }
} }
@@ -706,12 +797,42 @@ export default {
border-radius: 4px; border-radius: 4px;
} }
&__attachment-link { @media (max-width: 1200px) {
margin-right: 12px; &__summary-grid {
grid-template-columns: repeat(4, minmax(130px, 1fr));
}
&__summary-item.is-goods,
&__attachments {
grid-column: 1 / -1;
}
&__route {
grid-column: 1 / -1;
grid-row: auto;
}
}
@media (max-width: 800px) {
&__summary-grid {
grid-template-columns: 1fr;
}
&__route {
grid-template-columns: minmax(0, 1fr);
gap: 16px;
}
&__route-line {
width: 10px;
height: 32px;
margin: 0 auto;
}
&__summary-item.is-goods,
&__attachments {
grid-column: auto;
}
} }
} }
.status-text {
font-size: 12px;
}
</style> </style>
+1 -1
View File
@@ -76,7 +76,7 @@
<el-button type="primary">添加附件</el-button> <el-button type="primary">添加附件</el-button>
</el-upload> </el-upload>
<span class="transport-plan-import-page__file-tip"> <span class="transport-plan-import-page__file-tip">
请上传计划明细表仅支持 Excel 格式 请上传计划明细表仅支持 Excel 格式日期支持 2026-08-022026-8-22026/8/2 等写法
</span> </span>
<el-link type="primary" @click="handleTemplateDownload">下载模板</el-link> <el-link type="primary" @click="handleTemplateDownload">下载模板</el-link>
</el-form-item> </el-form-item>
+10 -1
View File
@@ -1,9 +1,11 @@
<template> <template>
<!-- waybill-manage-detail.vue只在当前路由属于本页时才透传 detailId
避免标签页缓存的实例被其它页面的 detailId 污染后误开详情 -->
<transport-plan-page <transport-plan-page
:api="api" :api="api"
:config="config" :config="config"
:crud-option="option" :crud-option="option"
:detail-id="$route.query.detailId" :detail-id="detailId"
:menu-width="220" :menu-width="220"
standalone-form-page standalone-form-page
/> />
@@ -14,6 +16,8 @@ import TransportPlanPage from './components/transport-plan-page.vue';
import * as api from '@/api/business/transport-plan'; import * as api from '@/api/business/transport-plan';
import { config, option } from '@/option/business/transport-plan'; import { config, option } from '@/option/business/transport-plan';
const listRoutePath = '/business/transport-plan';
export default { export default {
components: { TransportPlanPage }, components: { TransportPlanPage },
data() { data() {
@@ -23,5 +27,10 @@ export default {
option, option,
}; };
}, },
computed: {
detailId() {
return this.$route.path === listRoutePath ? this.$route.query.detailId : '';
},
},
}; };
</script> </script>
+26 -6
View File
@@ -16,7 +16,9 @@
><el-select v-model="query.processStatus" clearable placeholder="全部" ><el-select v-model="query.processStatus" clearable placeholder="全部"
><el-option label="上传中" value="上传中" /><el-option ><el-option label="上传中" value="上传中" /><el-option
label="处理中" label="处理中"
value="处理中" /><el-option label="处理完成" value="处理完成" /></el-select value="处理中" /><el-option label="处理完成" value="处理完成" /><el-option
label="处理失败"
value="处理失败" /></el-select
></el-form-item> ></el-form-item>
<el-form-item label="运单批次号" <el-form-item label="运单批次号"
><el-input v-model="query.waybillBatchNo" clearable placeholder="请输入" ><el-input v-model="query.waybillBatchNo" clearable placeholder="请输入"
@@ -84,7 +86,14 @@
min-width="160" min-width="160"
><template #default="{ row }">{{ row.carrierName || '-' }}</template></el-table-column ><template #default="{ row }">{{ row.carrierName || '-' }}</template></el-table-column
> >
<el-table-column prop="processStatus" label="处理状态" width="120" /><el-table-column <el-table-column prop="processStatus" label="处理状态" width="120"
><template #default="{ row }"
><span
:class="{ 'voucher-manage-page__process-failed': row.processStatus === '处理失败' }"
>{{ row.processStatus }}</span
></template
></el-table-column
><el-table-column
prop="voucherCount" prop="voucherCount"
label="凭证数量" label="凭证数量"
width="100" width="100"
@@ -109,7 +118,7 @@
placement="top" placement="top"
><el-icon class="voucher-manage-page__audit-reject-icon"><WarnTriangleFilled /></el-icon ><el-icon class="voucher-manage-page__audit-reject-icon"><WarnTriangleFilled /></el-icon
></el-tooltip></span></template ></el-tooltip></span></template
></el-table-column><el-table-column label="操作" width="320" fixed="right" align="center" ></el-table-column><el-table-column label="操作" width="220" fixed="right" align="center"
><template #default="{ row }" ><template #default="{ row }"
><div class="voucher-manage-page__actions"> ><div class="voucher-manage-page__actions">
<el-link <el-link
@@ -130,7 +139,7 @@
@click="download(row)" @click="download(row)"
>下载</el-link >下载</el-link
><el-link ><el-link
v-if="row.auditStatus === '审核驳回'" v-if="row.auditStatus === '审核驳回' || row.processStatus === '处理失败'"
type="primary" type="primary"
@click="openUpload(row, 'reupload')" @click="openUpload(row, 'reupload')"
>重新上传</el-link >重新上传</el-link
@@ -145,7 +154,7 @@
@click="openBatchDialog(row)" @click="openBatchDialog(row)"
>更换运单批次</el-link >更换运单批次</el-link
><el-link ><el-link
v-if="row.processStatus === '上传中' || row.auditStatus === '审核驳回'" v-if="row.processStatus === '上传中' || row.processStatus === '处理失败' || row.auditStatus === '审核驳回'"
type="danger" type="danger"
@click="removeRow(row)" @click="removeRow(row)"
>删除</el-link >删除</el-link
@@ -1238,7 +1247,15 @@ const view = async row => {
query: { id: row.id, batchNo: row.voucherBatchNo }, query: { id: row.id, batchNo: row.voucherBatchNo },
}); });
}; };
const download = row => window.open(row.fileUrl, '_blank'); const download = row => {
const url = row?.fileUrl;
if (!url) {
ElMessage.warning('附件地址为空,无法下载');
return;
}
// URL ?
window.open(String(url).split('?')[0], '_blank');
};
const handleAuditPass = row => const handleAuditPass = row =>
ElMessageBox.confirm(`确认审核通过凭证批次"${row.voucherBatchNo}"吗?`, '提示', { ElMessageBox.confirm(`确认审核通过凭证批次"${row.voucherBatchNo}"吗?`, '提示', {
type: 'warning', type: 'warning',
@@ -1329,6 +1346,9 @@ load();
color: #f56c6c; color: #f56c6c;
cursor: help; cursor: help;
} }
&__process-failed {
color: #f56c6c;
}
&__actions { &__actions {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
+6 -21
View File
@@ -1,6 +1,5 @@
<template> <template>
<basic-container class="waybill-import-page-container"> <basic-container class="waybill-import-page-container">
<div class="waybill-import-page-title">导入运单</div>
<waybill-import-dialog standalone /> <waybill-import-dialog standalone />
</basic-container> </basic-container>
</template> </template>
@@ -11,28 +10,14 @@ import WaybillImportDialog from './components/waybill-import-dialog.vue';
<style scoped lang="scss"> <style scoped lang="scss">
.waybill-import-page-container { .waybill-import-page-container {
:deep(.basic-container__card) {
background: transparent;
border: none;
box-shadow: none;
}
:deep(.basic-container__card > .el-card__body) { :deep(.basic-container__card > .el-card__body) {
padding: 0; padding: 0;
} }
} }
.waybill-import-page-title {
position: relative;
padding: 16px 24px 12px 36px;
border-bottom: 1px solid #eff1f7;
color: #303133;
font-size: 18px;
font-weight: 600;
&::before {
position: absolute;
top: 16px;
left: 24px;
width: 4px;
height: 22px;
border-radius: 2px;
background: #409eff;
content: '';
}
}
</style> </style>
+14 -1
View File
@@ -1,9 +1,15 @@
<template> <template>
<!--
detailId 必须做路由守卫本组件对应 /business/waybill-manage/detail
$route 是全局响应式的标签页 keep-alive 会缓存本实例路由切到别的详情页后
实例仍会重渲染若无守卫就会把当前页面的 id灌进子组件导致它拿别的单据 id
去查运单 运单管理不存在并误生成一个又一个运单详情标签
-->
<waybill-manage-page <waybill-manage-page
:api="api" :api="api"
:config="config" :config="config"
:crud-option="option" :crud-option="option"
:detail-id="$route.query.id" :detail-id="detailId"
:menu-width="250" :menu-width="250"
standalone-detail-page standalone-detail-page
/> />
@@ -14,10 +20,17 @@ import WaybillManagePage from './components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage'; import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage'; import { config, option } from '@/option/business/waybill-manage';
const detailRoutePath = '/business/waybill-manage/detail';
export default { export default {
components: { WaybillManagePage }, components: { WaybillManagePage },
data() { data() {
return { api, config, option }; return { api, config, option };
}, },
computed: {
detailId() {
return this.$route.path === detailRoutePath ? this.$route.query.id : '';
},
},
}; };
</script> </script>
@@ -0,0 +1,38 @@
<template>
<mk-public-shell biz-type="waybill-manage" :get-form="getForm">
<waybill-manage-page
ref="page"
:api="api"
:config="config"
:crud-option="option"
:detail-id="detailId"
standalone-detail-page
/>
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import WaybillManagePage from '@/views/business/components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage';
export default {
name: 'WaybillManagePublicView',
components: { MkPublicShell, WaybillManagePage },
data() {
return { api, config, option };
},
computed: {
detailId() {
return this.$route.query.id || '';
},
},
methods: {
getForm() {
const row = this.$refs.page?.detailRow || {};
return { ...row, subject: row.waybillNo || '' };
},
},
};
</script>
+10 -1
View File
@@ -1,9 +1,11 @@
<template> <template>
<!-- waybill-manage-detail.vue保留旧链接 /business/waybill-manage?detailId=xxx 的能力
但只在当前路由确实属于本页时才透传避免被其它页面的 detailId 污染 -->
<waybill-manage-page <waybill-manage-page
:api="api" :api="api"
:config="config" :config="config"
:crud-option="option" :crud-option="option"
:detail-id="$route.query.detailId" :detail-id="detailId"
:menu-width="250" :menu-width="250"
standalone-form-page standalone-form-page
/> />
@@ -14,6 +16,8 @@ import WaybillManagePage from './components/waybill-manage-page.vue';
import * as api from '@/api/business/waybill-manage'; import * as api from '@/api/business/waybill-manage';
import { config, option } from '@/option/business/waybill-manage'; import { config, option } from '@/option/business/waybill-manage';
const listRoutePath = '/business/waybill-manage';
export default { export default {
components: { WaybillManagePage }, components: { WaybillManagePage },
data() { data() {
@@ -23,5 +27,10 @@ export default {
option, option,
}; };
}, },
computed: {
detailId() {
return this.$route.path === listRoutePath ? this.$route.query.detailId : '';
},
},
}; };
</script> </script>
+155
View File
@@ -0,0 +1,155 @@
<template>
<div ref="page" class="mk-public-shell">
<slot />
</div>
</template>
<script>
import { postMkPublicProcessMessage } from '@/api/mk-process';
export default {
name: 'MkPublicShell',
props: {
bizType: {
type: String,
required: true,
},
getForm: {
type: Function,
default: null,
},
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay => setTimeout(this.handleIframeHeight, delay));
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
sendIframeHeight() {
this.$nextTick(() => {
window.parent.postMessage({ height: document.body.clientHeight }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage({ type: 'afterSubmit', success: true, parameters }, '*');
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
postMkPublicProcessMessage(this.bizType, {
status,
formValues: formValues || {},
formData,
}).catch(error => {
console.error('公开页提交流程数据失败:', error);
});
},
buildFormData() {
const form = this.readForm();
return {
...form,
subject: form.subject || '',
formInstanceId: this.getFormId(),
};
},
readForm() {
const form = typeof this.getForm === 'function' ? this.getForm() : {};
if (!form) return {};
try {
return JSON.parse(JSON.stringify(form));
} catch (error) {
return { ...form };
}
},
getFormId() {
return this.$route.query.id || this.readForm().id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.mk-public-shell {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
}
</style>
+271
View File
@@ -0,0 +1,271 @@
<template>
<div ref="page" class="mk-public-biz-view">
<basic-container>
<div class="mk-public-biz-view__title">{{ pageTitle }}</div>
<el-descriptions v-if="detail" :column="2" border>
<el-descriptions-item
v-for="item in visibleFields"
:key="item.prop"
:label="item.label"
:span="item.span || 1"
>
{{ displayValue(detail[item.prop]) }}
</el-descriptions-item>
</el-descriptions>
<el-empty v-else description="暂无数据" />
</basic-container>
</div>
</template>
<script>
import { getMkPublicDetail, postMkPublicProcessMessage } from '@/api/mk-process';
const FIELD_MAP = {
'project-apply': [
{ label: '申请单号', prop: 'applyNo' },
{ label: '项目编号', prop: 'projectCode' },
{ label: '项目名称', prop: 'projectName', span: 2 },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
{ label: '所属组织', prop: 'deptName' },
{ label: '备注', prop: 'remark', span: 2 },
],
'contract-manage': [
{ label: '合同编号', prop: 'contractNo' },
{ label: '合同名称', prop: 'contractName', span: 2 },
{ label: '合同类别', prop: 'contractCategory' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
{ label: '甲方', prop: 'partyA' },
{ label: '乙方', prop: 'partyB' },
{ label: '项目名称', prop: 'projectName', span: 2 },
],
'waybill-manage': [
{ label: '运单号', prop: 'waybillNo' },
{ label: '项目', prop: 'projectName' },
{ label: '客户合同', prop: 'contractName' },
{ label: '客户名称', prop: 'customerName' },
{ label: '货物名称', prop: 'cargoName' },
{ label: '承运商', prop: 'carrierName' },
{ label: '当前过程节点', prop: 'currentProcessNode' },
{ label: '发货地', prop: 'departureName' },
{ label: '收货地', prop: 'arrivalName' },
],
'pre-settlement': [
{ label: '预结算单号', prop: 'preSettlementNo' },
{ label: '合同名称', prop: 'contractName' },
{ label: '项目名称', prop: 'projectName' },
{ label: '结算金额', prop: 'settlementAmount' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
{ label: '备注', prop: 'remark', span: 2 },
],
'formal-settlement': [
{ label: '正式结算单号', prop: 'formalSettlementNo' },
{ label: '预结算单号', prop: 'preSettlementNos' },
{ label: '项目名称', prop: 'projectName' },
{ label: '合同名称', prop: 'contractName' },
{ label: '结算金额', prop: 'settlementAmount' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
],
'payment-application': [
{ label: '付款申请号', prop: 'paymentNo' },
{ label: '付款类型', prop: 'paymentTypeName' },
{ label: '收款方', prop: 'payeeName' },
{ label: '项目名称', prop: 'projectName' },
{ label: '申请金额', prop: 'applyAmount' },
{ label: '审核状态', prop: 'approvalStatusName' },
{ label: '当前节点', prop: 'currentNode' },
{ label: '当前处理人', prop: 'currentProcessor' },
],
};
const TITLE_MAP = {
'project-apply': '查看项目信息',
'contract-manage': '查看合同信息',
'waybill-manage': '查看运单信息',
'pre-settlement': '查看预结算信息',
'formal-settlement': '查看正式结算信息',
'payment-application': '查看付款申请信息',
};
export default {
name: 'MkPublicBizView',
data() {
return {
detail: null,
};
},
computed: {
bizType() {
return this.$route.meta.bizType || this.$route.query.bizType || '';
},
pageTitle() {
return TITLE_MAP[this.bizType] || '查看详情';
},
visibleFields() {
return FIELD_MAP[this.bizType] || [];
},
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.loadDetail();
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay => setTimeout(this.handleIframeHeight, delay));
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
loadDetail() {
const id = this.getFormId();
if (!id || !this.bizType) return;
getMkPublicDetail(this.bizType, id).then(res => {
this.detail = res.data?.data || null;
this.handleIframeHeight();
});
},
sendIframeHeight() {
this.$nextTick(() => {
window.parent.postMessage({ height: document.body.clientHeight }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage({ type: 'afterSubmit', success: true, parameters }, '*');
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
const payload = { status, formValues: formValues || {}, formData };
postMkPublicProcessMessage(this.bizType, payload).catch(error => {
console.error('公开页提交流程数据失败:', error);
});
},
buildFormData() {
const detail = this.detail || {};
return {
...detail,
id: this.getFormId() || detail.id,
subject: this.pageTitle,
formInstanceId: this.getFormId(),
};
},
getFormId() {
return this.$route.query.id || this.detail?.id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
displayValue(value) {
if (value === null || value === undefined || value === '') return '-';
if (Array.isArray(value)) return value.join('、') || '-';
if (typeof value === 'object') return JSON.stringify(value);
return value;
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.mk-public-biz-view {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
&__title {
position: relative;
padding-left: 12px;
margin: 8px 0 16px;
font-size: 16px;
font-weight: 600;
line-height: 22px;
&::before {
content: '';
position: absolute;
left: 0;
top: 2px;
width: 4px;
height: 18px;
background: #409eff;
}
}
}
</style>
@@ -882,7 +882,7 @@ export default {
item.receiverName !== first.receiverName item.receiverName !== first.receiverName
); );
if (incompatible) { if (incompatible) {
this.$message.warning('合并开票的结算单必须属于同一合同、项目、组织及收付款方'); this.$message.warning('合并开票的结算单必须属于同一合同');
return; return;
} }
this.form.settlements = rows.map(item => ({ this.form.settlements = rows.map(item => ({
@@ -1260,7 +1260,7 @@ export default {
} }
.invoice-form-page__dialog-search { .invoice-form-page__dialog-search {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-start;
gap: 8px; gap: 8px;
margin-bottom: 12px; margin-bottom: 12px;
} }
+1 -1
View File
@@ -216,7 +216,7 @@
<el-input <el-input
v-model="settlementDialog.keyword" v-model="settlementDialog.keyword"
clearable clearable
placeholder="结算单号、项目或合同" placeholder="3结算单号、项目或合同"
@keyup.enter="loadSettlementCandidates" @keyup.enter="loadSettlementCandidates"
/> />
<el-button type="primary" @click="loadSettlementCandidates">查询</el-button> <el-button type="primary" @click="loadSettlementCandidates">查询</el-button>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,21 @@
<template>
<mk-public-shell biz-type="payment-application" :get-form="getForm">
<payment-application-form ref="page" />
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import PaymentApplicationForm from '@/views/payment/payment-application-form.vue';
export default {
name: 'PaymentApplicationPublicView',
components: { MkPublicShell, PaymentApplicationForm },
methods: {
getForm() {
const form = this.$refs.page?.form || {};
return { ...form, subject: form.paymentNo || form.projectName || '' };
},
},
};
</script>
+8 -1
View File
@@ -233,6 +233,7 @@ import { mapGetters } from 'vuex';
import * as api from '@/api/payment/paymentApplication'; import * as api from '@/api/payment/paymentApplication';
import { paymentApplicationTableColumns } from '@/option/payment/paymentApplication'; import { paymentApplicationTableColumns } from '@/option/payment/paymentApplication';
import organizationSearch from '@/mixins/organization-search'; import organizationSearch from '@/mixins/organization-search';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
const emptyQuery = () => ({ const emptyQuery = () => ({
paymentNo: '', paymentNo: '',
@@ -325,7 +326,7 @@ export default {
openProjectAdvance() { openProjectAdvance() {
this.$router.push({ this.$router.push({
path: '/payment/payment-application/form', path: '/payment/payment-application/form',
query: { mode: 'add', paymentType: 'project_advance' }, query: { mode: 'add', paymentType: 'progress_advance' },
}); });
}, },
openEdit(row) { openEdit(row) {
@@ -361,6 +362,12 @@ export default {
}, },
async handleSubmit(row) { async handleSubmit(row) {
await api.submit({ id: row.id }); await api.submit({ id: row.id });
await submitMkApprovalFlow({
bizType: 'payment-application',
formInstanceId: row.id,
subjectName: row.paymentNo || '',
approvalStatus: row.approvalStatus || '',
});
this.$message.success('提交成功'); this.$message.success('提交成功');
this.loadTable(); this.loadTable();
}, },
@@ -211,8 +211,15 @@
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-show="!detailCollapsed" :data="filteredDetails" border> <el-table v-show="!detailCollapsed" :data="pagedDetails" border>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" /> <el-table-column
type="index"
label="序号"
width="64"
fixed="left"
align="center"
:index="detailIndexMethod"
/>
<el-table-column <el-table-column
v-for="column in detailTableColumns" v-for="column in detailTableColumns"
:key="column.prop" :key="column.prop"
@@ -245,6 +252,16 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div v-show="!detailCollapsed" class="formal-editor__pagination">
<el-pagination
v-model:current-page="detailPage.current"
v-model:page-size="detailPage.size"
:total="filteredDetails.length"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleDetailPageSizeChange"
/>
</div>
</section-card> </section-card>
<section-card> <section-card>
@@ -623,7 +640,7 @@
>提交</el-button >提交</el-button
> >
</template> </template>
<div v-if="pageMode" class="formal-editor__page-actions"> <div v-if="pageMode && !publicMode" class="formal-editor__page-actions">
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
<el-button <el-button
v-if="editable && !recordId" v-if="editable && !recordId"
@@ -929,6 +946,7 @@
</template> </template>
<script> <script>
import { getMkPublicDetail } from '@/api/mk-process';
import { import {
adjustDetail, adjustDetail,
getCandidateDetails, getCandidateDetails,
@@ -977,6 +995,10 @@ export default {
type: Object, type: Object,
default: null, default: null,
}, },
publicMode: {
type: Boolean,
default: false,
},
}, },
emits: ['update:modelValue', 'success'], emits: ['update:modelValue', 'success'],
data() { data() {
@@ -1088,6 +1110,10 @@ export default {
batchNo: '', batchNo: '',
cargoName: '', cargoName: '',
}, },
detailPage: {
current: 1,
size: 10,
},
}; };
}, },
computed: { computed: {
@@ -1135,6 +1161,13 @@ export default {
}) })
); );
}, },
pagedDetails() {
const list = this.filteredDetails;
const size = Number(this.detailPage.size) || 10;
const current = Math.max(Number(this.detailPage.current) || 1, 1);
const start = (current - 1) * size;
return list.slice(start, start + size);
},
missingAttachmentTypeText() { missingAttachmentTypeText() {
const missing = this.getMissingAttachmentTypes(); const missing = this.getMissingAttachmentTypes();
return missing.length ? `未上传:${missing.join('、')}` : ''; return missing.length ? `未上传:${missing.join('、')}` : '';
@@ -1159,6 +1192,16 @@ export default {
if (value) this.initialize(); if (value) this.initialize();
}, },
}, },
filteredDetails: {
handler(list) {
const size = Number(this.detailPage.size) || 10;
const maxPage = Math.max(1, Math.ceil((list?.length || 0) / size) || 1);
if (this.detailPage.current > maxPage) {
this.detailPage.current = maxPage;
}
},
immediate: true,
},
summaryTotal(value) { summaryTotal(value) {
this.form.settlementAmount = Number(value || 0).toFixed(2); this.form.settlementAmount = Number(value || 0).toFixed(2);
this.form.localSettlementAmount = ( this.form.localSettlementAmount = (
@@ -1173,7 +1216,9 @@ export default {
}, },
methods: { methods: {
async loadFormalDetail(id) { async loadFormalDetail(id) {
const response = await getDetail(id); const response = this.publicMode
? await getMkPublicDetail('formal-settlement', id)
: await getDetail(id);
const data = this.unwrapData(response); const data = this.unwrapData(response);
this.form = { this.form = {
...createFormalSettlementForm(), ...createFormalSettlementForm(),
@@ -1185,12 +1230,13 @@ export default {
}; };
this.sources = data.sources || []; this.sources = data.sources || [];
this.details = data.details || []; this.details = data.details || [];
this.detailPage.current = 1;
this.summaryFees = data.summaryFees || []; this.summaryFees = data.summaryFees || [];
// //
this.detailFeeSnapshots = {}; this.detailFeeSnapshots = {};
this.pendingAdjustments = {}; this.pendingAdjustments = {};
this.paymentApplications = data.paymentApplications || []; this.paymentApplications = data.paymentApplications || [];
if (this.readonly && this.form.settlementType === 'receivable') { if (this.readonly && this.form.settlementType === 'receivable' && !this.publicMode) {
this.receiptClaims = this.unwrapData(await getReceiptClaims(id)) || []; this.receiptClaims = this.unwrapData(await getReceiptClaims(id)) || [];
} }
this.adjustments = data.adjustments || []; this.adjustments = data.adjustments || [];
@@ -1237,14 +1283,17 @@ export default {
rule: null, rule: null,
}; };
this.detailCollapsed = false; this.detailCollapsed = false;
this.detailPage = { current: 1, size: 10 };
this.resetDetailQuery(false); this.resetDetailQuery(false);
await Promise.all([ if (!this.publicMode) {
this.loadAllContracts(), await Promise.all([
this.loadFeeOptions(), this.loadAllContracts(),
this.loadFeeCategoryOptions(), this.loadFeeOptions(),
this.loadAttachmentTypeOptions(), this.loadFeeCategoryOptions(),
this.loadTransportTypeOptions(), this.loadAttachmentTypeOptions(),
]); this.loadTransportTypeOptions(),
]);
}
if (!this.recordId) { if (!this.recordId) {
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD'); this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
if (this.initialData) await this.applyInitialData(); if (this.initialData) await this.applyInitialData();
@@ -1328,6 +1377,7 @@ export default {
settlementAmountTax: settlementAmountTax:
row.settlementAmountTax ?? row.totalAmount ?? row.afterAmount ?? row.settlementAmount, row.settlementAmountTax ?? row.totalAmount ?? row.afterAmount ?? row.settlementAmount,
})); }));
this.detailPage.current = 1;
this.form.sourceDetailIds = this.details.map(item => item.sourceDetailId); this.form.sourceDetailIds = this.details.map(item => item.sourceDetailId);
await this.refreshSummaryFees(); await this.refreshSummaryFees();
}, },
@@ -1373,6 +1423,7 @@ export default {
sourcePreSettlementId: settlement.id, sourcePreSettlementId: settlement.id,
})) }))
); );
this.detailPage.current = 1;
const summaryMap = new Map(); const summaryMap = new Map();
settlements settlements
.flatMap(settlement => settlement.summaryFees || []) .flatMap(settlement => settlement.summaryFees || [])
@@ -1601,6 +1652,7 @@ export default {
...this.details.filter(item => item.formalSettlementId), ...this.details.filter(item => item.formalSettlementId),
...existing.values(), ...existing.values(),
]; ];
this.detailPage.current = 1;
this.form.sourceDetailIds = [...existing.values()].map(item => item.sourceDetailId); this.form.sourceDetailIds = [...existing.values()].map(item => item.sourceDetailId);
this.detailCandidate.loading = true; this.detailCandidate.loading = true;
try { try {
@@ -1819,6 +1871,9 @@ export default {
return sourceDetailId ? `src:${sourceDetailId}` : ''; return sourceDetailId ? `src:${sourceDetailId}` : '';
}, },
async loadDetailFeeRows(detail) { async loadDetailFeeRows(detail) {
if (this.publicMode) {
return [this.normalizeAdjustRow(detail)];
}
if (detail.formalSettlementId && detail.id) { if (detail.formalSettlementId && detail.id) {
const rows = this.unwrapData(await getDetailFees(detail.id)) || []; const rows = this.unwrapData(await getDetailFees(detail.id)) || [];
return rows.map(item => this.normalizeAdjustRow(item)); return rows.map(item => this.normalizeAdjustRow(item));
@@ -1920,12 +1975,19 @@ export default {
}, },
handleDetailQuery() { handleDetailQuery() {
this.appliedDetailQuery = { ...this.detailQuery }; this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage.current = 1;
}, },
resetDetailQuery(apply = true) { resetDetailQuery(apply = true) {
this.detailQuery = { documentNo: '', waybillNo: '', batchNo: '', cargoName: '' }; this.detailQuery = { documentNo: '', waybillNo: '', batchNo: '', cargoName: '' };
if (apply) this.handleDetailQuery(); if (apply) this.handleDetailQuery();
else this.appliedDetailQuery = { ...this.detailQuery }; else this.appliedDetailQuery = { ...this.detailQuery };
}, },
handleDetailPageSizeChange() {
this.detailPage.current = 1;
},
detailIndexMethod(index) {
return (this.detailPage.current - 1) * this.detailPage.size + index + 1;
},
exportDetails() { exportDetails() {
if (!this.details.length) return this.$message.warning('暂无可导出的结算明细'); if (!this.details.length) return this.$message.warning('暂无可导出的结算明细');
const rows = this.details.map((row, index) => { const rows = this.details.map((row, index) => {
@@ -66,6 +66,12 @@
<span v-else-if="field.prop === 'settlementType'" class="form-readonly"> <span v-else-if="field.prop === 'settlementType'" class="form-readonly">
{{ settlementTypeName }} {{ settlementTypeName }}
</span> </span>
<span v-else-if="field.prop === 'preSettlementNo'" class="form-readonly">
{{ form.preSettlementNo || (!form.id ? '系统自动生成' : '-') }}
</span>
<span v-else-if="field.prop === 'createTime'" class="form-readonly">
{{ formatCreateDate(form.createTime) }}
</span>
<span v-else-if="field.money" class="form-readonly"> <span v-else-if="field.money" class="form-readonly">
{{ formatMoney(form[field.prop], moneyCurrency(field.prop)) }} {{ formatMoney(form[field.prop], moneyCurrency(field.prop)) }}
</span> </span>
@@ -184,7 +190,6 @@
</template> </template>
<el-form <el-form
:model="detailQuery" :model="detailQuery"
inline
label-position="right" label-position="right"
label-width="auto" label-width="auto"
class="pre-settlement-editor__detail-filter" class="pre-settlement-editor__detail-filter"
@@ -228,8 +233,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div v-show="!detailCollapsed"> <div v-show="!detailCollapsed">
<el-table :data="filteredDetails" border class="pre-settlement-editor__detail-table"> <el-table :data="pagedDetails" border class="pre-settlement-editor__detail-table">
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" /> <el-table-column
type="index"
label="序号"
width="64"
fixed="left"
align="center"
:index="detailIndexMethod"
/>
<el-table-column <el-table-column
v-for="column in visibleDetailColumns" v-for="column in visibleDetailColumns"
:key="column.prop" :key="column.prop"
@@ -300,6 +312,16 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pre-settlement-editor__pagination">
<el-pagination
v-model:current-page="detailPage.current"
v-model:page-size="detailPage.size"
:total="filteredDetails.length"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleDetailPageSizeChange"
/>
</div>
</div> </div>
</section-card> </section-card>
@@ -313,13 +335,43 @@
<el-table :data="attachments" border @selection-change="handleAttachmentSelectionChange"> <el-table :data="attachments" border @selection-change="handleAttachmentSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="70" align="center" /> <el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column label="文件名" min-width="260" show-overflow-tooltip> <el-table-column label="附件类型" min-width="180" align="center">
<template #default="{ row }">
<el-select
v-if="editable"
v-model="row.type"
filterable
placeholder="请选择"
@change="sortAttachments"
>
<el-option
v-for="item in attachmentTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<span v-else>{{ attachmentTypeName(row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="文件名称" min-width="260" show-overflow-tooltip>
<template #default="{ row }"> <template #default="{ row }">
<el-link type="primary" @click="previewAttachment(row)"> <el-link type="primary" @click="previewAttachment(row)">
{{ attachmentName(row) }} {{ attachmentName(row) }}
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="附件描述" min-width="220">
<template #default="{ row }">
<span v-if="!editable">{{ row.description || '-' }}</span>
<el-input
v-else
v-model="row.description"
maxlength="200"
placeholder="请输入"
/>
</template>
</el-table-column>
<el-table-column label="文件大小" width="120" align="center"> <el-table-column label="文件大小" width="120" align="center">
<template #default="{ row }">{{ formatFileSize(row.size) }}</template> <template #default="{ row }">{{ formatFileSize(row.size) }}</template>
</el-table-column> </el-table-column>
@@ -425,7 +477,7 @@
提交 提交
</el-button> </el-button>
</template> </template>
<div v-if="pageMode" class="pre-settlement-editor__page-actions"> <div v-if="pageMode && !publicMode" class="pre-settlement-editor__page-actions">
<el-button @click="visible = false">取消</el-button> <el-button @click="visible = false">取消</el-button>
<el-button v-if="editable" type="primary" plain :loading="saving" @click="saveDraft(false)" <el-button v-if="editable" type="primary" plain :loading="saving" @click="saveDraft(false)"
>保存</el-button >保存</el-button
@@ -681,134 +733,113 @@
append-to-body append-to-body
destroy-on-close destroy-on-close
> >
<el-tabs v-model="adjustDialog.activeTab" class="pre-settlement-editor__adjust-tabs"> <el-table v-loading="adjustDialog.loading" :data="adjustRows" border>
<el-tab-pane label="结算明细调整" name="adjust"> <el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table v-loading="adjustDialog.loading" :data="adjustRows" border> <el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" />
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" /> <el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
<el-table-column prop="cargoName" label="货物名称" min-width="140" align="center" /> <el-table-column label="计费规则" min-width="190" align="center">
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" /> <template #default="{ row }">
<el-table-column label="计费规则" min-width="190" align="center"> <div class="pre-settlement-editor__billing-rule-cell">
<template #default="{ row }"> <span>{{ displayValue(billingRuleName(row)) }}</span>
<div class="pre-settlement-editor__billing-rule-cell"> <el-icon
<span>{{ displayValue(billingRuleName(row)) }}</span> class="pre-settlement-editor__billing-rule-icon"
<el-icon title="查看计费规则详情"
class="pre-settlement-editor__billing-rule-icon" @click="openBillingRuleInfo(row)"
title="查看计费规则详情" >
@click="openBillingRuleInfo(row)" <InfoFilled />
> </el-icon>
<InfoFilled /> </div>
</el-icon> </template>
</div> </el-table-column>
</template> <el-table-column label="运输总量" min-width="150" align="center">
</el-table-column> <template #default="{ row }">
<el-table-column label="运输总量" min-width="150" align="center"> <span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
<template #default="{ row }"> <el-input-number
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span> v-else
<el-input-number v-model="row.transportQuantity"
v-else :min="0"
v-model="row.transportQuantity" :precision="2"
:min="0" :controls="false"
:precision="2" @change="recalculateAdjustRow(row, 'transportQuantity')"
:controls="false"
@change="recalculateAdjustRow(row, 'transportQuantity')"
/>
</template>
</el-table-column>
<el-table-column label="里程(KM" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.mileage"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'mileage')"
/>
</template>
</el-table-column>
<el-table-column label="运输单价" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.unitPrice"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'unitPrice')"
/>
</template>
</el-table-column>
<el-table-column
v-for="feeItem in adjustFeeItemNames"
:key="feeItem"
:label="feeItem"
min-width="140"
align="center"
>
<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">
<template #default="{ row }">
<el-input-number
v-model="row.settlementAmountTax"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
/>
</template>
</el-table-column>
<el-table-column label="备注" min-width="200" align="center">
<template #default="{ row }">
<el-input v-model="row.remark" maxlength="200" :disabled="adjustDialog.readonly" />
</template>
</el-table-column>
</el-table>
<el-form
v-if="!adjustDialog.readonly"
:model="adjustDialog"
label-position="right"
label-width="auto"
class="pre-settlement-editor__adjust-reason"
>
<el-form-item label="调整原因">
<el-input v-model="adjustDialog.reason" maxlength="200" show-word-limit />
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="变更记录" name="records">
<el-table :data="changeRecords" border>
<el-table-column type="index" label="序号" width="70" align="center" />
<el-table-column prop="changeTime" label="变更日期" min-width="170" align="center" />
<el-table-column prop="operatorName" label="经办人" min-width="140" align="center" />
<el-table-column prop="changeType" label="变更类型" min-width="160" align="center" />
<el-table-column
prop="changeReason"
label="变更原因"
min-width="240"
align="center"
show-overflow-tooltip
/> />
<el-table-column label="状态" min-width="120" align="center"> </template>
<template #default>已生效</template> </el-table-column>
</el-table-column> <el-table-column label="里程(KM" min-width="140" align="center">
<el-table-column label="操作" width="120" align="center" fixed="right"> <template #default="{ row }">
<template #default="{ row }"> <el-input-number
<el-link type="primary" @click="openAdjustChangeRecord(row)">查看详情</el-link> v-model="row.mileage"
</template> :min="0"
</el-table-column> :precision="2"
</el-table> :controls="false"
<el-empty v-if="!adjustChangeRecords.length" description="暂无变更记录" :image-size="60" /> :disabled="adjustDialog.readonly"
</el-tab-pane> @change="recalculateAdjustRow(row, 'mileage')"
</el-tabs> />
</template>
</el-table-column>
<el-table-column label="运输单价" min-width="140" align="center">
<template #default="{ row }">
<el-input-number
v-model="row.unitPrice"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@change="recalculateAdjustRow(row, 'unitPrice')"
/>
</template>
</el-table-column>
<el-table-column
v-for="feeItem in adjustFeeItemNames"
:key="feeItem"
:label="feeItem"
min-width="140"
align="center"
>
<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">
<template #default="{ row }">
<el-input-number
v-model="row.settlementAmountTax"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
/>
</template>
</el-table-column>
<el-table-column label="备注" min-width="200" align="center">
<template #default="{ row }">
<el-input v-model="row.remark" maxlength="200" :disabled="adjustDialog.readonly" />
</template>
</el-table-column>
</el-table>
<el-form
v-if="!adjustDialog.readonly"
:model="adjustDialog"
label-position="right"
label-width="auto"
class="pre-settlement-editor__adjust-reason"
>
<el-form-item label="调整原因">
<el-input
v-model="adjustDialog.reason"
type="textarea"
:rows="2"
maxlength="200"
show-word-limit
placeholder="请输入"
/>
</el-form-item>
</el-form>
<template #footer> <template #footer>
<el-button @click="adjustDialog.visible = false">取消</el-button> <el-button @click="adjustDialog.visible = false">取消</el-button>
<el-button <el-button
@@ -822,35 +853,10 @@
</template> </template>
</el-dialog> </el-dialog>
<el-dialog <change-record-detail-dialog
v-model="adjustChangeRecordVisible" v-model="adjustChangeRecordVisible"
title="变更记录详情" :rows="adjustChangeRecordDetailRows"
append-to-body />
destroy-on-close
width="1100px"
top="10px"
class="pre-settlement-change-record-detail-dialog"
>
<div v-if="adjustChangeRecord" class="pre-settlement-change-record-detail-meta">
<span>变更日期{{ adjustChangeRecord.changeTime || '-' }}</span>
<span>经办人{{ adjustChangeRecord.operatorName || '-' }}</span>
<span>变更类型{{ adjustChangeRecord.changeType || '-' }}</span>
<span>状态已生效</span>
</div>
<el-table :data="adjustChangeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="220" />
<el-table-column prop="before" label="变更前" min-width="330" />
<el-table-column prop="after" label="变更后" min-width="420" />
</el-table>
<el-empty
v-if="!adjustChangeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="adjustChangeRecordVisible = false">关闭</el-button>
</template>
</el-dialog>
<el-dialog <el-dialog
v-model="billingRuleDialog.visible" v-model="billingRuleDialog.visible"
@@ -922,6 +928,8 @@
import { h } from 'vue'; import { h } from 'vue';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { InfoFilled } from '@element-plus/icons-vue'; import { InfoFilled } from '@element-plus/icons-vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
import { getMkPublicDetail } from '@/api/mk-process';
import { import {
adjustDetail, adjustDetail,
getCandidateDetails, getCandidateDetails,
@@ -955,11 +963,12 @@ import {
settlementSummaryColumns, settlementSummaryColumns,
} from '@/option/settlement/preSettlementTable'; } from '@/option/settlement/preSettlementTable';
import { downloadFileByUrl } from '@/utils/util'; import { downloadFileByUrl } from '@/utils/util';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
export default { export default {
name: 'PreSettlementEditor', name: 'PreSettlementEditor',
components: { InfoFilled }, components: { InfoFilled, ChangeRecordDetailDialog },
props: { props: {
modelValue: { modelValue: {
type: Boolean, type: Boolean,
@@ -981,6 +990,10 @@ export default {
type: Object, type: Object,
default: null, default: null,
}, },
publicMode: {
type: Boolean,
default: false,
},
}, },
emits: ['update:modelValue', 'success'], emits: ['update:modelValue', 'success'],
data() { data() {
@@ -1053,9 +1066,14 @@ export default {
batchNo: '', batchNo: '',
cargoName: '', cargoName: '',
}, },
detailPage: {
current: 1,
size: 10,
},
advances: [], advances: [],
changeRecords: [], changeRecords: [],
attachments: [], attachments: [],
attachmentTypeOptions: [],
selectedAttachmentRows: [], selectedAttachmentRows: [],
candidateDialog: { candidateDialog: {
visible: false, visible: false,
@@ -1078,7 +1096,6 @@ export default {
loading: false, loading: false,
saving: false, saving: false,
readonly: false, readonly: false,
activeTab: 'adjust',
detailId: '', detailId: '',
sourceDetailId: '', sourceDetailId: '',
detailLineNo: '', detailLineNo: '',
@@ -1205,6 +1222,13 @@ export default {
}) })
); );
}, },
pagedDetails() {
const list = this.filteredDetails;
const size = Number(this.detailPage.size) || 10;
const current = Math.max(Number(this.detailPage.current) || 1, 1);
const start = (current - 1) * size;
return list.slice(start, start + size);
},
adjustFeeItemNames() { adjustFeeItemNames() {
const names = new Set(); const names = new Set();
this.adjustRows.forEach(row => { this.adjustRows.forEach(row => {
@@ -1231,6 +1255,16 @@ export default {
this.form.settlementAmount = Number(value || 0).toFixed(2); this.form.settlementAmount = Number(value || 0).toFixed(2);
this.recalculateLocalAmount(); this.recalculateLocalAmount();
}, },
filteredDetails: {
handler(list) {
const size = Number(this.detailPage.size) || 10;
const maxPage = Math.max(1, Math.ceil((list?.length || 0) / size) || 1);
if (this.detailPage.current > maxPage) {
this.detailPage.current = maxPage;
}
},
immediate: true,
},
}, },
methods: { methods: {
hasPermission(code) { hasPermission(code) {
@@ -1238,9 +1272,12 @@ export default {
}, },
async initialize() { async initialize() {
this.resetEditor(); this.resetEditor();
await this.loadFeeOptions(); if (!this.publicMode) {
await this.loadFeeCategoryOptions(); await this.loadFeeOptions();
await this.loadTransportTypeOptions(); await this.loadFeeCategoryOptions();
await this.loadTransportTypeOptions();
await this.loadAttachmentTypeOptions();
}
if (this.recordId) await this.loadDetail(); if (this.recordId) await this.loadDetail();
else if (this.initialData) await this.applyInitialData(); else if (this.initialData) await this.applyInitialData();
}, },
@@ -1280,6 +1317,7 @@ export default {
localCurrency: first.localCurrency || 'RMB', localCurrency: first.localCurrency || 'RMB',
}); });
this.details = rows.map(row => this.normalizeSourceDetail(row)); this.details = rows.map(row => this.normalizeSourceDetail(row));
this.detailPage.current = 1;
this.loading = true; this.loading = true;
try { try {
await this.ensureSourceFeeSnapshots(); await this.ensureSourceFeeSnapshots();
@@ -1341,6 +1379,7 @@ export default {
cargoName: '', cargoName: '',
}; };
this.appliedDetailQuery = { ...this.detailQuery }; this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage = { current: 1, size: 10 };
this.advances = []; this.advances = [];
this.changeRecords = []; this.changeRecords = [];
this.attachments = []; this.attachments = [];
@@ -1349,7 +1388,6 @@ export default {
this.pendingAdjustments = {}; this.pendingAdjustments = {};
this.sourceFeeSnapshots = {}; this.sourceFeeSnapshots = {};
this.detailFeeCache = {}; this.detailFeeCache = {};
this.adjustDialog.activeTab = 'adjust';
this.adjustDialog.detailId = ''; this.adjustDialog.detailId = '';
this.adjustDialog.sourceDetailId = ''; this.adjustDialog.sourceDetailId = '';
this.adjustDialog.detailLineNo = ''; this.adjustDialog.detailLineNo = '';
@@ -1369,11 +1407,14 @@ export default {
async loadDetail() { async loadDetail() {
this.loading = true; this.loading = true;
try { try {
const { data } = await getDetail(this.form.id || this.recordId); const response = this.publicMode
const detail = data?.data || {}; ? await getMkPublicDetail('pre-settlement', this.form.id || this.recordId)
: await getDetail(this.form.id || this.recordId);
const detail = response.data?.data || {};
this.form = { ...emptyPreSettlementForm(), ...detail }; this.form = { ...emptyPreSettlementForm(), ...detail };
this.summaryFees = (detail.summaryFees || []).map(row => ({ ...row })); this.summaryFees = (detail.summaryFees || []).map(row => ({ ...row }));
this.details = (detail.details || []).map(row => this.normalizeSourceDetail(row)); this.details = (detail.details || []).map(row => this.normalizeSourceDetail(row));
this.detailPage.current = 1;
this.advances = (detail.advances || []).map(row => ({ this.advances = (detail.advances || []).map(row => ({
...row, ...row,
createUserName: row.createUserName || detail.createUserName, createUserName: row.createUserName || detail.createUserName,
@@ -1381,6 +1422,7 @@ export default {
})); }));
this.changeRecords = detail.changeRecords || []; this.changeRecords = detail.changeRecords || [];
this.attachments = this.parseAttachments(detail.attachmentsJson); this.attachments = this.parseAttachments(detail.attachmentsJson);
this.sortAttachments();
this.selectedAttachmentRows = []; this.selectedAttachmentRows = [];
if ( if (
detail.contractId && detail.contractId &&
@@ -1398,8 +1440,15 @@ export default {
partyB: detail.payeeName, partyB: detail.payeeName,
}); });
} }
// if (this.publicMode && detail.detailFees) {
await this.loadAllDetailFees(); Object.entries(detail.detailFees).forEach(([detailId, feeRows]) => {
if (Array.isArray(feeRows) && feeRows.length) {
this.detailFeeCache[detailId] = feeRows;
}
});
} else {
await this.loadAllDetailFees();
}
} finally { } finally {
this.loading = false; this.loading = false;
} }
@@ -1553,12 +1602,19 @@ export default {
await this.persistPendingAdjustments(); await this.persistPendingAdjustments();
if (shouldSubmit) { if (shouldSubmit) {
await submit({ id: this.form.id }); await submit({ id: this.form.id });
await submitMkApprovalFlow({
bizType: 'pre-settlement',
formInstanceId: this.form.id,
subjectName: this.form.preSettlementNo || this.form.contractName || '',
approvalStatus: this.form.approvalStatus || '',
});
this.$message.success('审批流程已发起'); this.$message.success('审批流程已发起');
this.visible = false; this.visible = false;
this.$emit('success', this.form.id); this.$emit('success', this.form.id);
return; return;
} }
this.$message.success('保存成功'); this.$message.success('保存成功');
this.visible = false;
this.$emit('success', this.form.id); this.$emit('success', this.form.id);
} finally { } finally {
this[stateKey] = false; this[stateKey] = false;
@@ -1888,6 +1944,7 @@ export default {
}, },
handleDetailQuery() { handleDetailQuery() {
this.appliedDetailQuery = { ...this.detailQuery }; this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage.current = 1;
}, },
resetDetailQuery() { resetDetailQuery() {
this.detailQuery = { this.detailQuery = {
@@ -1897,6 +1954,13 @@ export default {
cargoName: '', cargoName: '',
}; };
this.appliedDetailQuery = { ...this.detailQuery }; this.appliedDetailQuery = { ...this.detailQuery };
this.detailPage.current = 1;
},
handleDetailPageSizeChange() {
this.detailPage.current = 1;
},
detailIndexMethod(index) {
return (this.detailPage.current - 1) * this.detailPage.size + index + 1;
}, },
normalizeAdjustRow(item, feeItemNames = []) { normalizeAdjustRow(item, feeItemNames = []) {
const rawFeeItems = const rawFeeItems =
@@ -2019,7 +2083,6 @@ export default {
this.adjustDialog.visible = true; this.adjustDialog.visible = true;
this.adjustDialog.loading = true; this.adjustDialog.loading = true;
this.adjustDialog.readonly = readonly; this.adjustDialog.readonly = readonly;
this.adjustDialog.activeTab = 'adjust';
this.adjustDialog.detailId = detailRow.id; this.adjustDialog.detailId = detailRow.id;
this.adjustDialog.detailLineNo = detailRow.lineNo; this.adjustDialog.detailLineNo = detailRow.lineNo;
this.adjustDialog.sourceDetailId = this.adjustDialog.sourceDetailId =
@@ -2035,6 +2098,11 @@ export default {
this.adjustRows = this.cloneAdjustRows(pending.rows); this.adjustRows = this.cloneAdjustRows(pending.rows);
return; return;
} }
if (this.publicMode) {
const cachedFees = this.detailFeeCache[detailRow.id] || [];
this.adjustRows = cachedFees.map(item => this.normalizeAdjustRow(item));
return;
}
if (sourceDetailId) { if (sourceDetailId) {
if (!this.sourceFeeSnapshots[sourceDetailId]) { if (!this.sourceFeeSnapshots[sourceDetailId]) {
this.sourceFeeSnapshots[sourceDetailId] = await this.loadSourceFeeRows(sourceDetailId); this.sourceFeeSnapshots[sourceDetailId] = await this.loadSourceFeeRows(sourceDetailId);
@@ -2042,6 +2110,11 @@ export default {
this.adjustRows = this.cloneAdjustRows(this.sourceFeeSnapshots[sourceDetailId]); this.adjustRows = this.cloneAdjustRows(this.sourceFeeSnapshots[sourceDetailId]);
return; return;
} }
const cachedFees = this.detailFeeCache[detailRow.id];
if (this.publicMode && Array.isArray(cachedFees)) {
this.adjustRows = cachedFees.map(item => this.normalizeAdjustRow(item));
return;
}
const response = await getDetailFees(detailRow.id); const response = await getDetailFees(detailRow.id);
const rows = response.data?.data || response.data || []; const rows = response.data?.data || response.data || [];
this.adjustRows = rows.map(item => this.normalizeAdjustRow(item)); this.adjustRows = rows.map(item => this.normalizeAdjustRow(item));
@@ -2230,10 +2303,6 @@ export default {
return String(name || '').includes('运费') || String(name || '').includes('运输费'); return String(name || '').includes('运费') || String(name || '').includes('运输费');
}, },
async saveAdjustment() { async saveAdjustment() {
if (!this.adjustDialog.reason.trim()) {
this.$message.warning('请输入调整原因');
return;
}
if (this.adjustRows.some(row => row.calculating)) { if (this.adjustRows.some(row => row.calculating)) {
this.$message.warning('费用正在重新计算,请稍候'); this.$message.warning('费用正在重新计算,请稍候');
return; return;
@@ -2412,13 +2481,92 @@ export default {
handleAttachmentChange(list) { handleAttachmentChange(list) {
const uploadUserName = this.userInfo?.realName || this.userInfo?.userName || ''; const uploadUserName = this.userInfo?.realName || this.userInfo?.userName || '';
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss'); const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
this.attachments = (list || []).map(file => ({ const existingRows = this.attachments || [];
...file, this.attachments = (list || []).map(file => {
uploadUserName: file.uploadUserName || uploadUserName, const fileUrl = this.attachmentUrl(file);
uploadTime: file.uploadTime || uploadTime, const existing = existingRows.find(item => {
})); const sameUid = file.uid && item.uid && String(file.uid) === String(item.uid);
const sameUrl = fileUrl && this.attachmentUrl(item) === fileUrl;
return sameUid || sameUrl;
});
const originalName = this.attachmentName(file);
return {
...file,
type: existing?.type || file.type || this.resolveAttachmentType(originalName),
description: existing?.description || file.description || '',
uploadUserName: existing?.uploadUserName || file.uploadUserName || uploadUserName,
uploadTime: existing?.uploadTime || file.uploadTime || uploadTime,
};
});
this.sortAttachments();
this.selectedAttachmentRows = []; this.selectedAttachmentRows = [];
}, },
async loadAttachmentTypeOptions() {
try {
const response = await getDictionary({ code: 'pre_settlement_attachment_type' });
const data = response?.data?.data || [];
this.attachmentTypeOptions = data
.map(item => ({
label: item.dictValue,
value: item.dictValue,
}))
.filter(item => item.label && item.value);
} catch (error) {
this.attachmentTypeOptions = [];
}
this.sortAttachments();
},
resolveAttachmentType(fileName) {
const normalizedName = String(fileName || '').toLocaleLowerCase();
const matchedType = [...this.attachmentTypeOptions]
.filter(item => item?.label || item?.value)
.sort(
(a, b) =>
String(b.label || b.value || '').length - String(a.label || a.value || '').length
)
.find(item => {
const typeText = String(item.label || item.value || '').toLocaleLowerCase();
return typeText && normalizedName.includes(typeText);
});
if (matchedType?.value) return matchedType.value;
const otherType = this.attachmentTypeOptions.find(item => this.isOtherAttachmentType(item));
if (otherType?.value) return otherType.value;
return '';
},
isOtherAttachmentType(item) {
const typeText = String(item?.label || item?.value || '').trim();
return (
typeText === '其他' ||
typeText === '其它' ||
typeText === '其他附件' ||
typeText === '其它附件'
);
},
getAttachmentTypeOrder(type) {
const normalizedType = String(type || '').trim();
const index = this.attachmentTypeOptions.findIndex(
item =>
String(item.value || '').trim() === normalizedType ||
String(item.label || '').trim() === normalizedType
);
return index === -1 ? Number.MAX_SAFE_INTEGER : index;
},
sortAttachments() {
this.attachments = (this.attachments || [])
.map((file, index) => ({ file, index }))
.sort((a, b) => {
const orderDifference =
this.getAttachmentTypeOrder(a.file.type) - this.getAttachmentTypeOrder(b.file.type);
return orderDifference || a.index - b.index;
})
.map(item => item.file);
},
attachmentTypeName(type) {
const option = this.attachmentTypeOptions.find(
item => String(item.value) === String(type) || String(item.label) === String(type)
);
return option?.label || type || '-';
},
handleAttachmentSelectionChange(rows) { handleAttachmentSelectionChange(rows) {
this.selectedAttachmentRows = rows || []; this.selectedAttachmentRows = rows || [];
}, },
@@ -2462,13 +2610,25 @@ export default {
}, },
parseAttachments(value) { parseAttachments(value) {
if (!value) return []; if (!value) return [];
if (Array.isArray(value)) return value; let list = [];
try { if (Array.isArray(value)) {
const parsed = JSON.parse(value); list = value;
return Array.isArray(parsed) ? parsed : []; } else {
} catch (error) { try {
return []; const parsed = JSON.parse(value);
list = Array.isArray(parsed) ? parsed : [];
} catch (error) {
return [];
}
} }
return list.map(file => {
const originalName = this.attachmentName(file);
return {
...file,
type: file?.type || this.resolveAttachmentType(originalName),
description: file?.description || '',
};
});
}, },
parseFeeItems(value) { parseFeeItems(value) {
if (!value) return {}; if (!value) return {};
@@ -2505,6 +2665,11 @@ export default {
if (!Number.isFinite(amount)) return '-'; if (!Number.isFinite(amount)) return '-';
return `${amount.toFixed(2)} ${currency || 'RMB'}`; return `${amount.toFixed(2)} ${currency || 'RMB'}`;
}, },
formatCreateDate(value) {
if (value === undefined || value === null || value === '') return '-';
const parsed = this.$dayjs(value);
return parsed.isValid() ? parsed.format('YYYY-MM-DD') : this.displayValue(value);
},
formatQuantity(row) { formatQuantity(row) {
const value = row.transportQuantity; const value = row.transportQuantity;
if (value === undefined || value === null || value === '') return '-'; if (value === undefined || value === null || value === '') return '-';
@@ -2655,22 +2820,43 @@ export default {
} }
&__detail-filter { &__detail-filter {
display: flex; display: grid;
flex-wrap: wrap; grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
gap: 0 24px; align-items: center;
gap: 8px 16px;
margin-bottom: 12px; margin-bottom: 12px;
padding: 12px 12px 4px;
background: #fff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
:deep(.el-form-item) { :deep(.el-form-item) {
display: flex;
min-width: 0;
margin-right: 0;
margin-bottom: 0; margin-bottom: 0;
} }
:deep(.el-form-item__content) {
flex: 1;
min-width: 0;
}
:deep(.el-input) { :deep(.el-input) {
width: 220px; width: 100%;
} }
} }
&__detail-filter-actions { &__detail-filter-actions {
margin-left: auto; width: auto;
margin-left: 0;
white-space: nowrap;
justify-self: end;
:deep(.el-form-item__content) {
flex: none;
justify-content: flex-end;
flex-wrap: nowrap;
}
} }
&__contract-filter { &__contract-filter {
@@ -2783,23 +2969,6 @@ export default {
} }
} }
.pre-settlement-change-record-detail-meta {
display: flex;
flex-wrap: wrap;
gap: 8px 32px;
margin-bottom: 16px;
color: #606266;
}
:deep(.pre-settlement-change-record-detail-dialog .el-dialog__body) {
padding-top: 12px;
}
:deep(.pre-settlement-change-record-detail-dialog .el-table .cell) {
white-space: pre-wrap;
word-break: break-all;
}
:deep(.pre-settlement-editor .el-dialog__body) { :deep(.pre-settlement-editor .el-dialog__body) {
padding: 12px 16px; padding: 12px 16px;
} }
@@ -56,6 +56,7 @@ export default {
methods: { methods: {
goBack() { goBack() {
removeSettlementTransfer(this.$route.query.transferToken); removeSettlementTransfer(this.$route.query.transferToken);
this.$router.$avueRouter.closeTag();
this.$router.push('/settlement/formal-settlement'); this.$router.push('/settlement/formal-settlement');
}, },
syncTagTitle() { syncTagTitle() {
@@ -0,0 +1,55 @@
<template>
<mk-public-shell biz-type="formal-settlement" :get-form="getForm">
<basic-container>
<div class="mk-public-form-title">查看正式结算</div>
<formal-settlement-editor
ref="page"
:model-value="true"
page-mode
readonly
public-mode
:record-id="recordId"
/>
</basic-container>
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import FormalSettlementEditor from '@/views/settlement/components/formal-settlement-editor.vue';
export default {
name: 'FormalSettlementPublicView',
components: { MkPublicShell, FormalSettlementEditor },
computed: {
recordId() {
return this.$route.query.id || '';
},
},
methods: {
getForm() {
const form = this.$refs.page?.form || {};
return { ...form, subject: form.formalSettlementNo || form.contractName || '' };
},
},
};
</script>
<style lang="scss" scoped>
.mk-public-form-title {
display: flex;
align-items: center;
min-height: 24px;
margin-bottom: 16px;
font-size: 18px;
font-weight: 600;
&::before {
width: 4px;
height: 20px;
margin-right: 8px;
background: #409eff;
content: '';
}
}
</style>
@@ -182,6 +182,7 @@ import organizationSearch from '@/mixins/organization-search';
import { formalSettlementTableColumns } from '@/option/settlement/formalSettlementTable'; import { formalSettlementTableColumns } from '@/option/settlement/formalSettlementTable';
import FormalSettlementEditor from './components/formal-settlement-editor.vue'; import FormalSettlementEditor from './components/formal-settlement-editor.vue';
import FormalSettlementTablePanel from './components/formal-settlement-table-panel.vue'; import FormalSettlementTablePanel from './components/formal-settlement-table-panel.vue';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
const emptyQuery = () => ({ const emptyQuery = () => ({
formalSettlementNo: '', formalSettlementNo: '',
@@ -337,6 +338,12 @@ export default {
async handleSubmit(row) { async handleSubmit(row) {
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' }); await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
await api.submit({ id: row.id }); await api.submit({ id: row.id });
await submitMkApprovalFlow({
bizType: 'formal-settlement',
formInstanceId: row.id,
subjectName: row.formalSettlementNo || '',
approvalStatus: row.approvalStatus || '',
});
this.$message.success('提交成功'); this.$message.success('提交成功');
this.loadTable(); this.loadTable();
}, },
@@ -50,6 +50,7 @@ export default {
}, },
goBack() { goBack() {
removeSettlementTransfer(this.$route.query.transferToken); removeSettlementTransfer(this.$route.query.transferToken);
this.$router.$avueRouter.closeTag();
this.$router.push('/settlement/pre-settlement'); this.$router.push('/settlement/pre-settlement');
}, },
syncTagTitle() { syncTagTitle() {
@@ -0,0 +1,55 @@
<template>
<mk-public-shell biz-type="pre-settlement" :get-form="getForm">
<basic-container>
<div class="mk-public-form-title">查看预结算</div>
<pre-settlement-editor
ref="page"
:model-value="true"
page-mode
readonly
public-mode
:record-id="recordId"
/>
</basic-container>
</mk-public-shell>
</template>
<script>
import MkPublicShell from '@/views/mk/mk-public-shell.vue';
import PreSettlementEditor from '@/views/settlement/components/pre-settlement-editor.vue';
export default {
name: 'PreSettlementPublicView',
components: { MkPublicShell, PreSettlementEditor },
computed: {
recordId() {
return this.$route.query.id || '';
},
},
methods: {
getForm() {
const form = this.$refs.page?.form || {};
return { ...form, subject: form.preSettlementNo || form.contractName || '' };
},
},
};
</script>
<style lang="scss" scoped>
.mk-public-form-title {
display: flex;
align-items: center;
min-height: 24px;
margin-bottom: 16px;
font-size: 18px;
font-weight: 600;
&::before {
width: 4px;
height: 20px;
margin-right: 8px;
background: #409eff;
content: '';
}
}
</style>
+1
View File
@@ -497,6 +497,7 @@ export default {
path: '/payment/payment-application/form', path: '/payment/payment-application/form',
query: { query: {
mode: 'add', mode: 'add',
paymentType: 'progress_advance',
transferToken, transferToken,
preSettlementIds: sourcePreSettlements preSettlementIds: sourcePreSettlements
.map(row => row.preSettlementId) .map(row => row.preSettlementId)
@@ -169,12 +169,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div
v-if="!latestChangeLoading && !latestChangeRows.length"
class="settlement-detail-page__empty"
>
暂无变更记录
</div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@@ -189,6 +183,7 @@
title="变更记录详情" title="变更记录详情"
width="88%" width="88%"
append-to-body append-to-body
align-center
> >
<el-table v-loading="changeRecordsDialog.loading" :data="changeRows" border> <el-table v-loading="changeRecordsDialog.loading" :data="changeRows" border>
<el-table-column type="index" label="序号" width="64" align="center" /> <el-table-column type="index" label="序号" width="64" align="center" />
@@ -1159,28 +1154,16 @@ export default {
minWidth: 130, minWidth: 130,
align: 'right', align: 'right',
}; };
const dynamicColumns = this.isPayable const dynamicColumns = [
? [ {
{ label: '运输费',
label: '运输费', prop: 'tableFreightAmount',
prop: 'tableFreightAmount', feeSummaryType: 'freight',
feeSummaryType: 'freight', minWidth: 130,
minWidth: 130, align: 'right',
align: 'right', },
}, otherFeeColumn,
otherFeeColumn, ];
]
: [
...this.tableFeeItemNames.map((name, index) => ({
label: name,
prop: `tableFeeItem${index}`,
feeItemName: name,
dynamic: true,
minWidth: 130,
align: 'right',
})),
otherFeeColumn,
];
if (totalIndex < 0) return [...columns, ...dynamicColumns]; if (totalIndex < 0) return [...columns, ...dynamicColumns];
columns.splice(totalIndex, 0, ...dynamicColumns); columns.splice(totalIndex, 0, ...dynamicColumns);
return columns; return columns;
@@ -1215,10 +1198,24 @@ export default {
await this.loadTable(); await this.loadTable();
await this.openRouteDetail(); await this.openRouteDetail();
}, },
// keep-alive teleport/append-to-body
deactivated() {
this.closeInnerDialogs();
},
beforeUnmount() { beforeUnmount() {
this.clearAdjustCalculations(); this.closeInnerDialogs();
}, },
methods: { methods: {
closeInnerDialogs() {
this.closeDetailPanel();
this.closeAdjustPanel();
this.changeRecordsDialog.visible = false;
this.updateFeeDialog.visible = false;
this.transferDialog.visible = false;
this.generateDialog.visible = false;
this.previewDialog.visible = false;
this.generateContractDialog.visible = false;
},
contractCategoryName(value) { contractCategoryName(value) {
return ( return (
this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label || this.contractCategoryOptions.find(item => String(item.value) === String(value))?.label ||
@@ -1504,7 +1501,7 @@ export default {
const res = await api.getList(this.page.current, this.page.size, params); const res = await api.getList(this.page.current, this.page.size, params);
const data = this.unwrapPage(res); const data = this.unwrapPage(res);
this.rows = (data.records || []).map(this.decorateRow); this.rows = (data.records || []).map(this.decorateRow);
this.tableFeeItemNames = this.isPayable ? [] : this.collectFeeItemNames(this.rows); this.tableFeeItemNames = [];
this.page.total = data.total || 0; this.page.total = data.total || 0;
} finally { } finally {
this.loading = false; this.loading = false;
@@ -1744,7 +1741,7 @@ export default {
}); });
const adjusted = { const adjusted = {
...item, ...item,
transportQuantity: Number(item.transportQuantity || 0), transportQuantity: this.normalizeAdjustTransportQuantity(item),
mileage: mileage:
item.mileage === null || item.mileage === undefined || Number(item.mileage) === -1 item.mileage === null || item.mileage === undefined || Number(item.mileage) === -1
? null ? null
@@ -1773,6 +1770,21 @@ export default {
feeSourceLabel(value) { feeSourceLabel(value) {
return ['手动录入', '手动添加', '手工录入'].includes(value) ? '手动录入' : '自动生成'; return ['手动录入', '手动添加', '手工录入'].includes(value) ? '手动录入' : '自动生成';
}, },
normalizeAdjustTransportQuantity(item = {}) {
const value = item.transportQuantity;
if (value === undefined || value === null || value === '' || Number(value) === -1) {
return '';
}
const element = item.billingFactor;
// / 1
if (
(element === '按车辆' || element === '固定金额(整单一口价)') &&
Number(value) === 1
) {
return '';
}
return Number(value);
},
adjustBillingTypes(row) { adjustBillingTypes(row) {
return ADJUST_BILLING_TYPE_MAP[row.billingFactor] || []; return ADJUST_BILLING_TYPE_MAP[row.billingFactor] || [];
}, },
@@ -1900,7 +1912,12 @@ export default {
model: row.model, model: row.model,
billingFactor: row.billingFactor, billingFactor: row.billingFactor,
billingType: row.billingType, billingType: row.billingType,
transportQuantity: row.transportQuantity, transportQuantity:
row.transportQuantity === '' ||
row.transportQuantity === null ||
row.transportQuantity === undefined
? null
: Number(row.transportQuantity),
priceUnit: row.priceUnit, priceUnit: row.priceUnit,
unitPrice: row.unitPrice, unitPrice: row.unitPrice,
mileage: row.mileage, mileage: row.mileage,
@@ -2734,12 +2751,6 @@ export default {
padding: 16px 0; padding: 16px 0;
} }
.settlement-detail-page__empty {
padding: 24px 0;
color: #909399;
text-align: center;
}
.settlement-detail-page__dialog-form { .settlement-detail-page__dialog-form {
padding: 16px 20px; padding: 16px 20px;
background: #fff; background: #fff;
+316 -9
View File
@@ -30,6 +30,14 @@
@click="handleDelete" @click="handleDelete"
>删除 >删除
</el-button> </el-button>
<el-button
type="primary"
plain
:loading="oaSyncLoading"
v-if="userInfo.authority.includes('admin')"
@click="handleOaOrgSync"
>自动同步组织
</el-button>
</template> </template>
<template #menu="scope"> <template #menu="scope">
<el-link <el-link
@@ -116,11 +124,62 @@
/> />
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
v-model="oaSyncVisible"
width="480px"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="!oaSyncRunning"
:show-close="!oaSyncRunning"
class="oa-sync-dialog"
@close="closeOaSyncDialog"
>
<template #header>
<span class="dialog-title">{{ oaSyncDialogTitle }}</span>
</template>
<div class="oa-sync-body">
<el-progress
:percentage="oaSyncPercent"
:status="oaSyncProgressStatus"
:stroke-width="12"
/>
<div class="oa-sync-meta" v-if="oaSyncStage === 'clear'">当前阶段{{ oaSyncStageLabel }}</div>
<div class="oa-sync-meta" v-else>
当前阶段{{ oaSyncStageLabel }} {{ oaSyncProgress.current || 0 }} / {{ oaSyncTotalPage }}
</div>
<div class="oa-sync-stats">
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">同步成功</span>
<span class="oa-sync-stat__value oa-sync-stat__value--success">{{ oaSyncProgress.synced }}</span>
</div>
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">跳过</span>
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
</div>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button v-if="oaSyncRunning" @click="cancelOaSync">取消</el-button>
<el-button v-else type="primary" @click="closeOaSyncDialog">关闭</el-button>
</span>
</template>
</el-dialog>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import { getLazyList, remove, update, add, getDept, getDeptTree } from '@/api/system/dept'; import {
getLazyList,
remove,
update,
add,
getDept,
getDeptTree,
syncOaCompany,
syncOaDepartment,
clearNonTopDept,
} from '@/api/system/dept';
import { getLeaderList } from '@/api/system/user'; import { getLeaderList } from '@/api/system/user';
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive'; import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@@ -152,6 +211,21 @@ export default {
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
oaSyncLoading: false,
oaSyncVisible: false,
oaSyncRunning: false,
oaSyncCancelled: false,
oaSyncStatus: 'running',
oaSyncStage: 'company',
oaSyncClearNonTop: false,
oaSyncController: null,
oaSyncProgress: {
current: 0,
size: 20,
total: 0,
synced: 0,
skipped: 0,
},
parentId: 0, parentId: 0,
page: { page: {
pageSize: 10, pageSize: 10,
@@ -216,8 +290,9 @@ export default {
return; return;
} }
const parentId = this.normalizeParentId(this.form?.parentId); const parentId = this.normalizeParentId(this.form?.parentId);
//
if (!parentId) { if (!parentId) {
callback(new Error('请先选择上级组织')); callback();
return; return;
} }
if (!this.parentDept || String(this.parentDept.id) !== String(parentId)) { if (!this.parentDept || String(this.parentDept.id) !== String(parentId)) {
@@ -358,13 +433,6 @@ export default {
props: { props: {
label: 'title', label: 'title',
}, },
rules: [
{
required: true,
message: '请选择上级组织',
trigger: 'click',
},
],
}, },
{ {
label: '所属租户', label: '所属租户',
@@ -436,8 +504,177 @@ export default {
}); });
return ids.join(','); return ids.join(',');
}, },
oaSyncDialogTitle() {
if (this.oaSyncStatus === 'done') {
return '同步完成';
}
if (this.oaSyncStatus === 'cancelled') {
return '已取消同步';
}
if (this.oaSyncStatus === 'error') {
return '同步失败';
}
return '自动同步组织';
},
oaSyncStageLabel() {
if (this.oaSyncStage === 'clear') {
return '清除非顶级组织';
}
return this.oaSyncStage === 'department' ? '同步部门' : '同步公司';
},
oaSyncTotalPage() {
const total = Number(this.oaSyncProgress.total) || 0;
const size = Number(this.oaSyncProgress.size) || 20;
if (total <= 0) {
return this.oaSyncProgress.current || 0;
}
return Math.max(1, Math.ceil(total / size));
},
oaSyncPercent() {
if (this.oaSyncStatus === 'done') {
return 100;
}
const totalPage = this.oaSyncTotalPage;
const current = Number(this.oaSyncProgress.current) || 0;
const stageBase = this.oaSyncStage === 'department' ? 50 : 0;
if (totalPage <= 0) {
return stageBase;
}
const stagePercent = Math.min(50, Math.round((current / totalPage) * 50));
return Math.min(99, stageBase + stagePercent);
},
oaSyncProgressStatus() {
if (this.oaSyncStatus === 'done') {
return 'success';
}
if (this.oaSyncStatus === 'error') {
return 'exception';
}
return undefined;
},
}, },
methods: { methods: {
handleOaOrgSync() {
this.$confirm(
'是否清除非顶级组织?选择“是”将先删除顶级以外的组织后再同步;选择“否”则直接同步。',
'提示',
{
confirmButtonText: '是',
cancelButtonText: '否',
distinguishCancelAndClose: true,
closeOnClickModal: false,
type: 'warning',
}
)
.then(() => {
this.startOaOrgSync(true);
})
.catch(action => {
if (action === 'cancel') {
this.startOaOrgSync(false);
}
});
},
startOaOrgSync(clearNonTop) {
this.oaSyncLoading = true;
this.oaSyncVisible = true;
this.oaSyncRunning = true;
this.oaSyncCancelled = false;
this.oaSyncStatus = 'running';
this.oaSyncClearNonTop = !!clearNonTop;
this.oaSyncStage = clearNonTop ? 'clear' : 'company';
this.oaSyncController = new AbortController();
this.oaSyncProgress = {
current: 0,
size: 20,
total: 0,
synced: 0,
skipped: 0,
};
this.runOaOrgSyncPages();
},
isOaSyncCanceledError(error) {
return (
this.oaSyncCancelled ||
error?.code === 'ERR_CANCELED' ||
error?.name === 'CanceledError' ||
error?.name === 'AbortError'
);
},
async runOaOrgSyncStage(syncApi) {
const size = 20;
let current = 1;
while (!this.oaSyncCancelled) {
const res = await syncApi(current, size, this.oaSyncController?.signal);
const page = res?.data?.data || {};
this.oaSyncProgress.current = page.current || current;
this.oaSyncProgress.size = page.size || size;
this.oaSyncProgress.total = page.total || 0;
this.oaSyncProgress.synced += page.syncedCount || 0;
this.oaSyncProgress.skipped += page.skippedCount || 0;
if (page.finished) {
break;
}
current += 1;
}
},
async runOaOrgSyncPages() {
try {
if (this.oaSyncClearNonTop) {
this.oaSyncStage = 'clear';
await clearNonTopDept(this.oaSyncController?.signal);
if (this.oaSyncCancelled) {
this.oaSyncStatus = 'cancelled';
return;
}
}
this.oaSyncStage = 'company';
await this.runOaOrgSyncStage(syncOaCompany);
if (this.oaSyncCancelled) {
this.oaSyncStatus = 'cancelled';
return;
}
this.oaSyncStage = 'department';
this.oaSyncProgress.current = 0;
this.oaSyncProgress.total = 0;
await this.runOaOrgSyncStage(syncOaDepartment);
if (this.oaSyncCancelled) {
this.oaSyncStatus = 'cancelled';
return;
}
this.oaSyncStatus = 'done';
} catch (error) {
if (this.isOaSyncCanceledError(error)) {
this.oaSyncStatus = 'cancelled';
} else {
this.oaSyncStatus = 'error';
this.$message.error(error?.message || 'OA组织同步失败');
}
} finally {
this.oaSyncRunning = false;
this.oaSyncLoading = false;
if (this.oaSyncStatus === 'done' || this.oaSyncStatus === 'cancelled') {
this.parentId = 0;
this.data = [];
this.$refs.crud?.refreshTable?.();
this.onLoad(this.page, this.query);
}
}
},
cancelOaSync() {
if (!this.oaSyncRunning) {
return;
}
this.oaSyncCancelled = true;
this.oaSyncController?.abort();
},
closeOaSyncDialog() {
if (this.oaSyncRunning) {
this.cancelOaSync();
return;
}
this.oaSyncVisible = false;
},
initData(tenantId) { initData(tenantId) {
getDeptTree(tenantId).then(res => { getDeptTree(tenantId).then(res => {
const column = this.findColumn(this.option.column, 'parentId'); const column = this.findColumn(this.option.column, 'parentId');
@@ -605,6 +842,11 @@ export default {
.filter(Boolean); .filter(Boolean);
return result.length ? result.join('、') : '-'; return result.length ? result.join('、') : '-';
}, },
normalizeTopParent(row) {
if (!this.normalizeParentId(row?.parentId)) {
row.parentId = 0;
}
},
isRootDept(row) { isRootDept(row) {
return row && (row.parentId === 0 || String(row.parentId) === '0'); return row && (row.parentId === 0 || String(row.parentId) === '0');
}, },
@@ -620,6 +862,7 @@ export default {
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId; row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
row.deptCode = String(row.deptCode || '').trim(); row.deptCode = String(row.deptCode || '').trim();
row.leaderId = func.join(row.leaderId); row.leaderId = func.join(row.leaderId);
this.normalizeTopParent(row);
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) { if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
this.$message.warning('请选择承运商'); this.$message.warning('请选择承运商');
loading(); loading();
@@ -649,6 +892,7 @@ export default {
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId; row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
row.deptCode = String(row.deptCode || '').trim(); row.deptCode = String(row.deptCode || '').trim();
row.leaderId = func.join(row.leaderId); row.leaderId = func.join(row.leaderId);
this.normalizeTopParent(row);
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) { if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
this.$message.warning('请选择承运商'); this.$message.warning('请选择承运商');
loading(); loading();
@@ -858,3 +1102,66 @@ export default {
color: var(--el-color-danger-light-3); color: var(--el-color-danger-light-3);
} }
</style> </style>
<style>
.oa-sync-dialog .dialog-title {
display: inline-flex;
align-items: center;
font-size: 16px;
font-weight: 600;
}
.oa-sync-dialog .dialog-title::before {
width: 4px;
height: 18px;
margin-right: 8px;
background: #409eff;
content: '';
}
.oa-sync-body {
padding: 8px 4px 0;
}
.oa-sync-meta {
margin-top: 12px;
color: #606266;
font-size: 13px;
}
.oa-sync-stats {
display: flex;
gap: 16px;
margin-top: 16px;
}
.oa-sync-stat {
flex: 1;
padding: 12px 16px;
background: #fafafa;
border: 1px solid #eff1f7;
border-radius: 4px;
}
.oa-sync-stat__label {
display: block;
color: #909399;
font-size: 12px;
}
.oa-sync-stat__value {
display: block;
margin-top: 6px;
font-size: 22px;
font-weight: 600;
line-height: 1.2;
}
.oa-sync-stat__value--success {
color: #409eff;
}
.oa-sync-stat__value--skip {
color: #909399;
}
</style>
+261 -11
View File
@@ -56,6 +56,14 @@
@click="handleAudit" @click="handleAudit"
> >
</el-button> </el-button>
<el-button
type="primary"
plain
:loading="iamSyncLoading"
v-if="userInfo.authority.includes('admin') && !auditMode"
@click="handleIamSync"
>同步人员
</el-button>
<el-button <el-button
type="success" type="success"
plain plain
@@ -190,6 +198,17 @@
<el-form ref="userFormRef" :model="form" :rules="userRules" label-position="right" label-width="calc(6em + 24px)"> <el-form ref="userFormRef" :model="form" :rules="userRules" label-position="right" label-width="calc(6em + 24px)">
<el-row :gutter="18"> <el-row :gutter="18">
<el-col :span="6"><el-form-item label="账号名" prop="account"><el-input v-model="form.account" /></el-form-item></el-col> <el-col :span="6"><el-form-item label="账号名" prop="account"><el-input v-model="form.account" /></el-form-item></el-col>
<el-col v-if="userDialogMode === 'add'" :span="6">
<el-form-item label="登录密码" prop="password">
<el-input
v-model="form.password"
type="password"
show-password
autocomplete="new-password"
placeholder="大于8位,含字母、数字、特殊字符.!@#$%^&*"
/>
</el-form-item>
</el-col>
<el-col :span="6"><el-form-item label="姓名" prop="realName"><el-input v-model="form.realName" /></el-form-item></el-col> <el-col :span="6"><el-form-item label="姓名" prop="realName"><el-input v-model="form.realName" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="手机号" prop="phone"><el-input v-model="form.phone" /></el-form-item></el-col> <el-col :span="6"><el-form-item label="手机号" prop="phone"><el-input v-model="form.phone" /></el-form-item></el-col>
<el-col :span="6"><el-form-item label="邮箱"><el-input v-model="form.email" /></el-form-item></el-col> <el-col :span="6"><el-form-item label="邮箱"><el-input v-model="form.email" /></el-form-item></el-col>
@@ -313,7 +332,12 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="新密码" prop="password"> <el-form-item label="新密码" prop="password">
<el-input v-model="passwordForm.password" type="password" show-password /> <el-input
v-model="passwordForm.password"
type="password"
show-password
placeholder="大于8位,含字母、数字、特殊字符.!@#$%^&*"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@@ -332,6 +356,45 @@
</template> </template>
</el-dialog> </el-dialog>
<el-dialog
v-model="oaSyncVisible"
width="480px"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="!oaSyncRunning"
:show-close="!oaSyncRunning"
class="oa-sync-dialog"
@close="closeOaSyncDialog"
>
<template #header>
<span class="dialog-title">{{ oaSyncDialogTitle }}</span>
</template>
<div class="oa-sync-body">
<el-progress
:percentage="oaSyncPercent"
:status="oaSyncProgressStatus"
:stroke-width="12"
/>
<div class="oa-sync-meta">当前进度 {{ oaSyncProgress.current || 0 }} / {{ oaSyncTotalPage }} </div>
<div class="oa-sync-stats">
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">同步成功</span>
<span class="oa-sync-stat__value oa-sync-stat__value--success">{{ oaSyncProgress.synced }}</span>
</div>
<div class="oa-sync-stat">
<span class="oa-sync-stat__label">跳过</span>
<span class="oa-sync-stat__value oa-sync-stat__value--skip">{{ oaSyncProgress.skipped }}</span>
</div>
</div>
</div>
<template #footer>
<span class="dialog-footer">
<el-button v-if="oaSyncRunning" @click="cancelOaSync">取消</el-button>
<el-button v-else type="primary" @click="closeOaSyncDialog">关闭</el-button>
</span>
</template>
</el-dialog>
<!-- 认证日志组件 --> <!-- 认证日志组件 -->
<auth-log ref="authLog" /> <auth-log ref="authLog" />
<!-- 认证锁定配置组件 --> <!-- 认证锁定配置组件 -->
@@ -348,6 +411,7 @@ import {
remove, remove,
update, update,
add, add,
syncIamAccounts,
grant, grant,
resetPassword, resetPassword,
setPassword, setPassword,
@@ -365,6 +429,7 @@ import { mapGetters } from 'vuex';
import { h } from 'vue'; import { h } from 'vue';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { downloadXls } from '@/utils/util'; import { downloadXls } from '@/utils/util';
import { validateLoginPassword } from '@/utils/validate';
import NProgress from 'nprogress'; import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import func from '@/utils/func'; import func from '@/utils/func';
@@ -393,6 +458,19 @@ export default {
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
iamSyncLoading: false,
oaSyncVisible: false,
oaSyncRunning: false,
oaSyncCancelled: false,
oaSyncStatus: 'running',
oaSyncController: null,
oaSyncProgress: {
current: 0,
size: 50,
total: 0,
synced: 0,
skipped: 0,
},
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@@ -415,8 +493,7 @@ export default {
passwordForm: {}, passwordForm: {},
passwordRules: { passwordRules: {
password: [ password: [
{ required: true, message: '请输入新密码', trigger: 'blur' }, { required: true, validator: validateLoginPassword, trigger: 'blur' },
{ min: 6, max: 32, message: '密码长度在6到32个字符', trigger: 'blur' },
], ],
password2: [ password2: [
{ required: true, message: '请再次输入新密码', trigger: 'blur' }, { required: true, message: '请再次输入新密码', trigger: 'blur' },
@@ -425,6 +502,7 @@ export default {
}, },
userRules: { userRules: {
account: [{ required: true, message: '请输入账号名', trigger: 'blur' }], account: [{ required: true, message: '请输入账号名', trigger: 'blur' }],
password: [{ required: true, validator: validateLoginPassword, trigger: 'blur' }],
realName: [{ required: true, message: '请输入姓名', trigger: 'blur' }], realName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }], phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
deptId: [{ required: true, message: '请选择所属组织', trigger: 'change' }], deptId: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
@@ -443,19 +521,56 @@ export default {
}, },
computed: { computed: {
...mapGetters(['userInfo', 'permission']), ...mapGetters(['userInfo', 'permission']),
// checkStrictly false oaSyncDialogTitle() {
if (this.oaSyncStatus === 'done') {
return '同步完成';
}
if (this.oaSyncStatus === 'cancelled') {
return '已取消同步';
}
if (this.oaSyncStatus === 'error') {
return '同步失败';
}
return '同步人员';
},
oaSyncTotalPage() {
const total = Number(this.oaSyncProgress.total) || 0;
const size = Number(this.oaSyncProgress.size) || 50;
if (total <= 0) {
return this.oaSyncProgress.current || 0;
}
return Math.max(1, Math.ceil(total / size));
},
oaSyncPercent() {
if (this.oaSyncStatus === 'done') {
return 100;
}
const totalPage = this.oaSyncTotalPage;
const current = Number(this.oaSyncProgress.current) || 0;
if (totalPage <= 0) {
return 0;
}
return Math.min(100, Math.round((current / totalPage) * 100));
},
oaSyncProgressStatus() {
if (this.oaSyncStatus === 'done') {
return 'success';
}
if (this.oaSyncStatus === 'error') {
return 'exception';
}
return undefined;
},
// checkStrictly true
deptCascaderProps() { deptCascaderProps() {
return { return {
label: 'title', label: 'title',
value: 'id', value: 'id',
children: 'children', children: 'children',
emitPath: false, emitPath: false,
checkStrictly: false, checkStrictly: true,
expandTrigger: 'click', expandTrigger: 'click',
leaf: (data, node) => { leaf: data => !data.children || data.children.length === 0,
// children children
return !data.children || data.children.length === 0;
},
}; };
}, },
// form.deptId join id // form.deptId join id
@@ -553,6 +668,89 @@ export default {
this.handleExport(); this.handleExport();
} }
}, },
handleIamSync() {
this.$confirm('确定从OA同步人员及组织信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.startOaSync();
});
},
startOaSync() {
this.iamSyncLoading = true;
this.oaSyncVisible = true;
this.oaSyncRunning = true;
this.oaSyncCancelled = false;
this.oaSyncStatus = 'running';
this.oaSyncController = new AbortController();
this.oaSyncProgress = {
current: 0,
size: 50,
total: 0,
synced: 0,
skipped: 0,
};
this.runOaSyncPages();
},
isOaSyncCanceledError(error) {
return (
this.oaSyncCancelled ||
error?.code === 'ERR_CANCELED' ||
error?.name === 'CanceledError' ||
error?.name === 'AbortError'
);
},
async runOaSyncPages() {
const size = 50;
let current = 1;
try {
while (!this.oaSyncCancelled) {
const res = await syncIamAccounts(current, size, this.oaSyncController?.signal);
const page = res?.data?.data || {};
this.oaSyncProgress.current = page.current || current;
this.oaSyncProgress.size = page.size || size;
this.oaSyncProgress.total = page.total || 0;
this.oaSyncProgress.synced += page.syncedCount || 0;
this.oaSyncProgress.skipped += page.skippedCount || 0;
if (page.finished) {
this.oaSyncStatus = 'done';
break;
}
current += 1;
}
if (this.oaSyncCancelled && this.oaSyncStatus === 'running') {
this.oaSyncStatus = 'cancelled';
}
} catch (error) {
if (this.isOaSyncCanceledError(error)) {
this.oaSyncStatus = 'cancelled';
} else {
this.oaSyncStatus = 'error';
this.$message.error(error?.message || 'OA人员同步失败');
}
} finally {
this.oaSyncRunning = false;
this.iamSyncLoading = false;
if (this.oaSyncStatus === 'done' || this.oaSyncStatus === 'cancelled') {
this.onLoad(this.page, this.query);
}
}
},
cancelOaSync() {
if (!this.oaSyncRunning) {
return;
}
this.oaSyncCancelled = true;
this.oaSyncController?.abort();
},
closeOaSyncDialog() {
if (this.oaSyncRunning) {
this.cancelOaSync();
return;
}
this.oaSyncVisible = false;
},
handleSetLeader(row) { handleSetLeader(row) {
const tip = row.isLeader === 1 ? '确定取消用户的主管职务?' : '确定设置用户为主管职务?'; const tip = row.isLeader === 1 ? '确定取消用户的主管职务?' : '确定设置用户为主管职务?';
const message = row.isLeader === 1 ? '取消主管成功!' : '设置主管成功!'; const message = row.isLeader === 1 ? '取消主管成功!' : '设置主管成功!';
@@ -651,6 +849,7 @@ export default {
if (mode === 'add') { if (mode === 'add') {
this.form = { this.form = {
account: '', account: '',
password: '',
realName: '', realName: '',
phone: '', phone: '',
email: '', email: '',
@@ -706,6 +905,9 @@ export default {
roleId: func.join(this.form.roleId), roleId: func.join(this.form.roleId),
leaderId: func.join(this.form.leaderId), leaderId: func.join(this.form.leaderId),
}; };
if (this.userDialogMode !== 'add') {
delete row.password;
}
const request = this.userDialogMode === 'add' ? add(row) : update(this.sensitiveManager.getSubmitData(row)); const request = this.userDialogMode === 'add' ? add(row) : update(this.sensitiveManager.getSubmitData(row));
request.then(() => { request.then(() => {
this.userDialog = false; this.userDialog = false;
@@ -1121,14 +1323,16 @@ export default {
margin-top: 8px; margin-top: 8px;
} }
.user-edit-dialog .dialog-title { .user-edit-dialog .dialog-title,
.oa-sync-dialog .dialog-title {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
} }
.user-edit-dialog .dialog-title::before { .user-edit-dialog .dialog-title::before,
.oa-sync-dialog .dialog-title::before {
width: 4px; width: 4px;
height: 18px; height: 18px;
margin-right: 8px; margin-right: 8px;
@@ -1136,6 +1340,52 @@ export default {
content: ''; content: '';
} }
.oa-sync-body {
padding: 8px 4px 0;
}
.oa-sync-meta {
margin-top: 12px;
color: #606266;
font-size: 13px;
}
.oa-sync-stats {
display: flex;
gap: 16px;
margin-top: 16px;
}
.oa-sync-stat {
flex: 1;
padding: 12px 16px;
background: #fafafa;
border: 1px solid #eff1f7;
border-radius: 4px;
}
.oa-sync-stat__label {
display: block;
color: #909399;
font-size: 12px;
}
.oa-sync-stat__value {
display: block;
margin-top: 6px;
font-size: 22px;
font-weight: 600;
line-height: 1.2;
}
.oa-sync-stat__value--success {
color: #409eff;
}
.oa-sync-stat__value--skip {
color: #909399;
}
.user-edit-dialog .el-form-item { .user-edit-dialog .el-form-item {
margin-bottom: 14px; margin-bottom: 14px;
} }
+14 -1
View File
@@ -91,7 +91,7 @@
<el-input <el-input
v-model="passwordForm.newPassword" v-model="passwordForm.newPassword"
type="password" type="password"
placeholder="请输入新密码" placeholder="大于8位,含字母、数字、特殊字符.!@#$%^&*"
show-password show-password
> >
<template #prefix> <template #prefix>
@@ -143,6 +143,7 @@
import { getUserInfo, updateInfo, updatePassword } from '@/api/system/user'; import { getUserInfo, updateInfo, updatePassword } from '@/api/system/user';
import md5 from 'js-md5'; import md5 from 'js-md5';
import { sensitive } from '@/utils/sensitive'; import { sensitive } from '@/utils/sensitive';
import { isValidLoginPassword, LOGIN_PASSWORD_RULE_MESSAGE } from '@/utils/validate';
import { import {
Plus, Plus,
Bell, Bell,
@@ -259,6 +260,18 @@ export default {
}, },
// //
submitPassword() { submitPassword() {
if (!this.passwordForm.newPassword || !this.passwordForm.newPassword1) {
this.$message.warning('请输入新密码和确认密码');
return;
}
if (this.passwordForm.newPassword !== this.passwordForm.newPassword1) {
this.$message.warning('两次输入的新密码不一致');
return;
}
if (!isValidLoginPassword(this.passwordForm.newPassword)) {
this.$message.warning(LOGIN_PASSWORD_RULE_MESSAGE);
return;
}
this.loading = true; this.loading = true;
updatePassword( updatePassword(
md5(this.passwordForm.oldPassword), md5(this.passwordForm.oldPassword),
+5 -2
View File
@@ -1892,10 +1892,13 @@ export default {
overflow: hidden; overflow: hidden;
} }
// 1.586:1 100% // 240px 1.586:1
// /
:deep(.driver-uploader--large) { :deep(.driver-uploader--large) {
display: block; display: block;
width: 240px; width: 100%;
max-width: 240px;
flex: none;
margin: 0; margin: 0;
} }
+5 -1
View File
@@ -1349,9 +1349,13 @@ export default {
height: 151px; height: 151px;
} }
// 248px
// /
:deep(.ship-uploader--large) { :deep(.ship-uploader--large) {
display: block; display: block;
width: 248px; width: 100%;
max-width: 248px;
flex: none;
margin: 0; margin: 0;
} }
+61 -21
View File
@@ -129,7 +129,7 @@
> >
<el-form <el-form
label-position="right" label-position="right"
label-width="calc(7em + 24px)" label-width="calc(4em + 12px)"
class="certification-audit archive-form" class="certification-audit archive-form"
> >
<section-card title="基础信息"> <section-card title="基础信息">
@@ -145,19 +145,25 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="外廓尺寸(毫米)"> <el-form-item label="外廓尺寸">
<div class="dimension-group"> <div class="dimension-group">
<div class="dimension-group__item"> <div class="dimension-group__item">
<span class="dimension-group__label"></span> <span class="dimension-group__label"></span>
<span class="certification-audit__value">{{ auditValue('outerLength') }}</span> <span class="certification-audit__value">
{{ auditValueWithUnit('outerLength', 'mm') }}
</span>
</div> </div>
<div class="dimension-group__item"> <div class="dimension-group__item">
<span class="dimension-group__label"></span> <span class="dimension-group__label"></span>
<span class="certification-audit__value">{{ auditValue('outerWidth') }}</span> <span class="certification-audit__value">
{{ auditValueWithUnit('outerWidth', 'mm') }}
</span>
</div> </div>
<div class="dimension-group__item"> <div class="dimension-group__item">
<span class="dimension-group__label"></span> <span class="dimension-group__label"></span>
<span class="certification-audit__value">{{ auditValue('outerHeight') }}</span> <span class="certification-audit__value">
{{ auditValueWithUnit('outerHeight', 'mm') }}
</span>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
@@ -165,13 +171,17 @@
</el-row> </el-row>
<el-row :gutter="18"> <el-row :gutter="18">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="核定载质量KG"> <el-form-item label="核定载质量">
<span class="certification-audit__value">{{ auditValue('approvedLoadKg') }}</span> <span class="certification-audit__value">
{{ auditValueWithUnit('approvedLoadKg', 'KG') }}
</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="准牵引总质量KG"> <el-form-item label="准牵引总质量">
<span class="certification-audit__value">{{ auditValue('tractionMassKg') }}</span> <span class="certification-audit__value">
{{ auditValueWithUnit('tractionMassKg', 'KG') }}
</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@@ -357,7 +367,7 @@
v-if="showRejectReason" v-if="showRejectReason"
class="certification-audit__reason" class="certification-audit__reason"
label-position="right" label-position="right"
label-width="calc(7em + 24px)" label-width="calc(4em + 24px)"
> >
<el-form-item label="驳回原因" required> <el-form-item label="驳回原因" required>
<el-input <el-input
@@ -427,7 +437,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="外廓尺寸(毫米)"> <el-form-item label="外廓尺寸">
<div class="dimension-group"> <div class="dimension-group">
<div class="dimension-group__item"> <div class="dimension-group__item">
<span class="dimension-group__label"></span> <span class="dimension-group__label"></span>
@@ -436,7 +446,9 @@
inputmode="numeric" inputmode="numeric"
placeholder="请输入" placeholder="请输入"
@input="vehicleForm.outerLength = digitsOnly($event)" @input="vehicleForm.outerLength = digitsOnly($event)"
/> >
<template #suffix>mm</template>
</el-input>
</div> </div>
<div class="dimension-group__item"> <div class="dimension-group__item">
<span class="dimension-group__label"></span> <span class="dimension-group__label"></span>
@@ -445,7 +457,9 @@
inputmode="numeric" inputmode="numeric"
placeholder="请输入" placeholder="请输入"
@input="vehicleForm.outerWidth = digitsOnly($event)" @input="vehicleForm.outerWidth = digitsOnly($event)"
/> >
<template #suffix>mm</template>
</el-input>
</div> </div>
<div class="dimension-group__item"> <div class="dimension-group__item">
<span class="dimension-group__label"></span> <span class="dimension-group__label"></span>
@@ -454,7 +468,9 @@
inputmode="numeric" inputmode="numeric"
placeholder="请输入" placeholder="请输入"
@input="vehicleForm.outerHeight = digitsOnly($event)" @input="vehicleForm.outerHeight = digitsOnly($event)"
/> >
<template #suffix>mm</template>
</el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
@@ -462,23 +478,27 @@
</el-row> </el-row>
<el-row :gutter="18"> <el-row :gutter="18">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="核定载质量KG" prop="approvedLoadKg"> <el-form-item label="核定载质量" prop="approvedLoadKg">
<el-input <el-input
v-model="vehicleForm.approvedLoadKg" v-model="vehicleForm.approvedLoadKg"
inputmode="numeric" inputmode="numeric"
placeholder="请输入" placeholder="请输入"
@input="vehicleForm.approvedLoadKg = digitsOnly($event)" @input="vehicleForm.approvedLoadKg = digitsOnly($event)"
/> >
<template #suffix>KG</template>
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="准牵引总质量KG" prop="tractionMassKg"> <el-form-item label="准牵引总质量" prop="tractionMassKg">
<el-input <el-input
v-model="vehicleForm.tractionMassKg" v-model="vehicleForm.tractionMassKg"
inputmode="numeric" inputmode="numeric"
placeholder="请输入" placeholder="请输入"
@input="vehicleForm.tractionMassKg = digitsOnly($event)" @input="vehicleForm.tractionMassKg = digitsOnly($event)"
/> >
<template #suffix>KG</template>
</el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@@ -896,6 +916,7 @@ export default {
energyTypeOptions: ['柴油', '汽油', '新能源', '天然气'], energyTypeOptions: ['柴油', '汽油', '新能源', '天然气'],
baseRules: { baseRules: {
organizationName: [{ required: true, message: '请选择所属组织', trigger: 'change' }], organizationName: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
useDepartment: [{ required: true, message: '请选择使用部门', trigger: 'change' }],
plateNo: [ plateNo: [
{ required: true, message: '请输入车牌号', trigger: 'change' }, { required: true, message: '请输入车牌号', trigger: 'change' },
{ validator: this.validatePlateNo, trigger: 'change' }, { validator: this.validatePlateNo, trigger: 'change' },
@@ -986,6 +1007,9 @@ export default {
if (this.vehicleBox && !this.vehicleForm.id && !this.vehicleForm.organizationName) { if (this.vehicleBox && !this.vehicleForm.id && !this.vehicleForm.organizationName) {
this.vehicleForm.organizationName = this.getCurrentOrganizationName(); this.vehicleForm.organizationName = this.getCurrentOrganizationName();
} }
if (this.vehicleBox && !this.vehicleForm.useDepartment) {
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
}
}); });
}, },
flattenDeptOptions(tree = [], level = 0) { flattenDeptOptions(tree = [], level = 0) {
@@ -1061,6 +1085,7 @@ export default {
if (!row?.id) { if (!row?.id) {
this.vehicleForm = emptyForm(); this.vehicleForm = emptyForm();
this.vehicleForm.organizationName = this.getCurrentOrganizationName(); this.vehicleForm.organizationName = this.getCurrentOrganizationName();
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
this.syncPlateNo(false); this.syncPlateNo(false);
this.vehicleBox = true; this.vehicleBox = true;
return; return;
@@ -1070,6 +1095,9 @@ export default {
...emptyForm(), ...emptyForm(),
...(res.data.data || {}), ...(res.data.data || {}),
}; };
if (!this.vehicleForm.useDepartment) {
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
}
this.splitPlateNo(); this.splitPlateNo();
this.syncPlateNo(false); this.syncPlateNo(false);
this.vehicleBox = true; this.vehicleBox = true;
@@ -1102,6 +1130,10 @@ export default {
const value = this.certificationAuditForm[prop]; const value = this.certificationAuditForm[prop];
return value === undefined || value === null || value === '' ? '-' : value; return value === undefined || value === null || value === '' ? '-' : value;
}, },
auditValueWithUnit(prop, unit) {
const value = this.auditValue(prop);
return value === '-' ? value : `${value}${unit}`;
},
handleCertificationApprove() { handleCertificationApprove() {
auditCertification(this.certificationAuditForm.id, 1).then(() => { auditCertification(this.certificationAuditForm.id, 1).then(() => {
this.$message.success('认证已通过'); this.$message.success('认证已通过');
@@ -1693,11 +1725,19 @@ export default {
} }
} }
.certification-audit, .certification-audit {
:deep(.el-form-item__label) {
flex: 0 0 calc(4em + 12px) !important;
width: calc(4em + 12px) !important;
max-width: calc(4em + 12px);
}
}
.certification-audit__reason { .certification-audit__reason {
:deep(.el-form-item__label) { :deep(.el-form-item__label) {
flex: 0 0 calc(7em + 24px) !important; flex: 0 0 calc(4em + 24px) !important;
width: calc(7em + 24px) !important; width: calc(4em + 24px) !important;
max-width: calc(4em + 24px);
} }
} }
@@ -0,0 +1,168 @@
<template>
<div ref="page" class="customer-archive-public-view">
<customer-archive ref="archive" />
</div>
</template>
<script>
import CustomerArchive from './customer-archive.vue';
import { postPublicProcessMessage } from '@/api/vehicle/customer-archive';
export default {
name: 'CustomerArchivePublicView',
components: {
CustomerArchive,
},
created() {
this.handleIframeHeight = () => this.sendIframeHeight();
this.handleProcessMessage = event => this.onProcessMessage(event);
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.addEventListener('message', this.handleProcessMessage);
},
mounted() {
document.documentElement.classList.add('mk-iframe-page');
document.body.classList.add('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.add('mk-iframe-page');
this.handleIframeHeight();
window.addEventListener('load', this.handleIframeHeight);
this.mkHeightTimers = [300, 800, 1600].map(delay =>
setTimeout(this.handleIframeHeight, delay)
);
if (typeof ResizeObserver === 'undefined') return;
this.mkHeightObserver = new ResizeObserver(() => this.handleIframeHeight());
this.$nextTick(() => {
if (this.$refs.page) this.mkHeightObserver.observe(this.$refs.page);
this.mkHeightObserver.observe(document.body);
});
},
beforeUnmount() {
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
window.removeEventListener('load', this.handleIframeHeight);
window.removeEventListener('message', this.handleProcessMessage);
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
if (this.mkHeightObserver) {
this.mkHeightObserver.disconnect();
this.mkHeightObserver = null;
}
document.documentElement.classList.remove('mk-iframe-page');
document.body.classList.remove('mk-iframe-page');
const app = document.getElementById('app');
if (app) app.classList.remove('mk-iframe-page');
},
methods: {
sendIframeHeight() {
this.$nextTick(() => {
var tbody = document.body;
var height = tbody.clientHeight;
// postMessage
window.parent.postMessage({ height: height }, '*');
});
},
onProcessMessage(event) {
const data = event && event.data;
if (!data || typeof data !== 'object') return;
if (data.height && !data.status && !data.type) return;
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
console.log('客商公开页收到流程消息:', data);
const formValues = data.formValues;
if (data.status === 'submit') {
this.submitData(formValues);
} else if (data.status === 'save') {
this.saveData(formValues);
}
if (data.type === 'getFormValues') {
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
}
},
submitData(lbpmFormValues) {
const formData = this.buildFormData();
this.postFormData('submit', lbpmFormValues, formData);
if (!lbpmFormValues) return;
const parameters = Object.assign({}, lbpmFormValues, {
loginName: this.getLoginName(lbpmFormValues),
formInstanceId: this.getFormId(),
subject: formData.subject,
});
window.parent.postMessage(
{
type: 'afterSubmit',
success: true,
parameters,
},
'*'
);
},
saveData(lbpmFormValues) {
this.postFormData('save', lbpmFormValues, this.buildFormData());
},
postFormData(status, formValues, formData) {
const payload = {
status,
formValues: formValues || {},
formData,
};
console.log('客商公开页提交流程数据:', payload);
postPublicProcessMessage(payload).catch(error => {
console.error('客商公开页提交流程数据失败:', error);
});
},
buildFormData() {
const archive = this.getArchiveForm();
return {
...archive,
subject: archive.fullName || archive.shortName || '',
formInstanceId: this.getFormId(),
};
},
getArchiveForm() {
const archive = this.$refs.archive && this.$refs.archive.archiveForm;
if (!archive) return {};
try {
return JSON.parse(JSON.stringify(archive));
} catch (error) {
return { ...archive };
}
},
getFormId() {
return this.$route.query.id || this.getArchiveForm().id || '';
},
getLoginName(formValues = {}) {
return (
formValues.loginName ||
this.$route.query.loginName ||
this.$route.query.submitIdentity ||
''
);
},
},
};
</script>
<style lang="scss">
html.mk-iframe-page,
html.mk-iframe-page body,
html.mk-iframe-page #app,
html.mk-iframe-page #app.mk-iframe-page {
height: auto !important;
min-height: 100%;
overflow: visible;
}
</style>
<style lang="scss" scoped>
.customer-archive-public-view {
min-height: 100%;
padding: 12px 0 24px;
box-sizing: border-box;
background: #f0f2f5;
:deep(.basic-container) {
padding: 0 12px;
}
:deep(.archive-page-form .archive-form__footer) {
left: 0;
}
}
</style>
+340 -116
View File
@@ -1,5 +1,5 @@
<template> <template>
<basic-container class="customer-archive-page"> <basic-container class="customer-archive-page" :class="{ 'is-public-view': isPublicViewPage }">
<avue-crud <avue-crud
v-if="!isArchivePage" v-if="!isArchivePage"
:option="option" :option="option"
@@ -144,9 +144,24 @@
> >
撤回 撤回
</el-link> </el-link>
<el-link
type="primary"
v-if="
hasPermission('customer_type_re_cert') &&
row.approvalStatus === 'reviewing' &&
row.reviewStatus !== '已完成'
"
@click="openReview(row)"
>
复评
</el-link>
<el-link <el-link
type="success" type="success"
v-if="hasPermission('customer_archive_approve') && row.approvalStatus === 'reviewing'" v-if="
hasPermission('customer_archive_approve') &&
row.approvalStatus === 'reviewing' &&
row.reviewStatus === '已完成'
"
@click="handleApprove(row)" @click="handleApprove(row)"
> >
审核通过 审核通过
@@ -517,7 +532,7 @@
<span>{{ formatScoreValue(row.selfScore) }}</span> <span>{{ formatScoreValue(row.selfScore) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="复评得分" min-width="145" align="center"> <el-table-column v-if="archiveForm.id" label="复评得分" min-width="145" align="center">
<template #default="{ row }"> <template #default="{ row }">
<span>{{ formatScoreValue(row.reviewScore) }}</span> <span>{{ formatScoreValue(row.reviewScore) }}</span>
</template> </template>
@@ -553,11 +568,18 @@
<span>{{ row.reviewStatus }}</span> <span>{{ row.reviewStatus }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="135" fixed="right" align="center"> <el-table-column label="操作" width="160" fixed="right" align="center">
<template #default="{ row }"> <template #default="{ row }">
<el-link type="primary" @click="openScore(row.__raw, row.__rawIndex)"> <el-link type="primary" @click="openScore(row.__raw, row.__rawIndex)">
详情 详情
</el-link> </el-link>
<el-link
v-if="showScoreDelete"
type="danger"
@click="deleteScore(row.__rawIndex)"
>
删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -624,6 +646,7 @@
<el-table-column label="开户人姓名" prop="accountHolderName" min-width="150" /> <el-table-column label="开户人姓名" prop="accountHolderName" min-width="150" />
<el-table-column label="收款账号" prop="bankAccount" min-width="180" /> <el-table-column label="收款账号" prop="bankAccount" min-width="180" />
<el-table-column label="开户行" prop="bankName" min-width="180" /> <el-table-column label="开户行" prop="bankName" min-width="180" />
<el-table-column label="联行号" prop="cnapsCode" min-width="160" />
<el-table-column label="备注" prop="remark" min-width="180" /> <el-table-column label="备注" prop="remark" min-width="180" />
<el-table-column <el-table-column
label="操作" label="操作"
@@ -875,45 +898,12 @@
/> />
</section-card> </section-card>
<el-dialog <change-record-detail-dialog
v-model="changeRecordDetailVisible" v-model="changeRecordDetailVisible"
title="变更记录详情" :rows="changeRecordDetailRows"
append-to-body />
destroy-on-close
width="1100px"
top="10px"
class="change-record-detail-dialog"
>
<div v-if="changeRecordDetail" class="change-record-detail-meta">
<span>变更日期{{ changeRecordDetail.changeTime || '-' }}</span>
<span>变更账号{{ changeRecordDetail.changeUserName || '-' }}</span>
</div>
<el-table :data="changeRecordDetailRows" border :show-overflow-tooltip="false">
<el-table-column prop="field" label="变更字段" min-width="180" />
<el-table-column
prop="before"
label="变更前"
min-width="360"
class-name="change-record-detail-value"
/>
<el-table-column
prop="after"
label="变更后"
min-width="500"
class-name="change-record-detail-value"
/>
</el-table>
<el-empty
v-if="!changeRecordDetailRows.length"
description="暂无变更内容"
:image-size="60"
/>
<template #footer>
<el-button type="primary" @click="changeRecordDetailVisible = false">关闭</el-button>
</template>
</el-dialog>
<div class="archive-form__footer"> <div class="archive-form__footer" v-if="!isPublicViewPage">
<!-- 次要独立页返回 / 只读关闭 / 弹窗取消 --> <!-- 次要独立页返回 / 只读关闭 / 弹窗取消 -->
<el-button @click="closeArchive">{{ readonly ? '关闭' : '取消' }}</el-button> <el-button @click="closeArchive">{{ readonly ? '关闭' : '取消' }}</el-button>
<el-button type="primary" plain v-if="!readonly" @click="saveArchive">保存</el-button> <el-button type="primary" plain v-if="!readonly" @click="saveArchive">保存</el-button>
@@ -1022,6 +1012,9 @@
<el-form-item label="开户行" prop="bankName"> <el-form-item label="开户行" prop="bankName">
<el-input v-model="receiptForm.bankName" maxlength="100" /> <el-input v-model="receiptForm.bankName" maxlength="100" />
</el-form-item> </el-form-item>
<el-form-item label="联行号" prop="cnapsCode">
<el-input v-model="receiptForm.cnapsCode" maxlength="32" />
</el-form-item>
<el-form-item label="收款账号" prop="bankAccount"> <el-form-item label="收款账号" prop="bankAccount">
<el-input v-model="receiptForm.bankAccount" maxlength="50" /> <el-input v-model="receiptForm.bankAccount" maxlength="50" />
</el-form-item> </el-form-item>
@@ -1319,7 +1312,25 @@
class="score-detail-table score-detail-table--inline" class="score-detail-table score-detail-table--inline"
max-height="520" max-height="520"
> >
<el-table-column label="评分项目" prop="itemName" width="150" align="center" /> <el-table-column
label="评分项目"
width="150"
align="center"
:show-overflow-tooltip="false"
>
<template #default="{ row: detail }">
<el-tooltip
:content="detail.itemName"
placement="top"
effect="dark"
append-to="body"
:show-after="200"
:disabled="!detail.itemName"
>
<span class="score-item-name">{{ detail.itemName }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="评分标准" min-width="430"> <el-table-column label="评分标准" min-width="430">
<template #default="{ row: detail }"> <template #default="{ row: detail }">
<div class="score-standard-cell"> <div class="score-standard-cell">
@@ -1329,6 +1340,7 @@
inputmode="decimal" inputmode="decimal"
:disabled="readonly" :disabled="readonly"
@input="value => handleScoreValueInput(detail, value)" @input="value => handleScoreValueInput(detail, value)"
@blur="handleScoreValueBlur(detail)"
> >
<template #append>{{ getScoreRule(detail)?.changeUnit || '' }}</template> <template #append>{{ getScoreRule(detail)?.changeUnit || '' }}</template>
</el-input> </el-input>
@@ -1358,13 +1370,15 @@
<span>{{ formatScoreValue(getSignedScore(detail, 'selfScore')) }}</span> <span>{{ formatScoreValue(getSignedScore(detail, 'selfScore')) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="复评得分" width="150" align="center"> <el-table-column v-if="!isNewScore" label="复评得分" width="150" align="center">
<template #default="{ row: detail }"> <template #default="{ row: detail }">
<el-input <el-input
v-model="detail.reviewScore" v-model="detail.reviewScore"
maxlength="10" maxlength="10"
inputmode="decimal" inputmode="decimal"
:disabled="readonly || !hasPermission('customer_type_re_cert')" :disabled="
(!reviewMode && readonly) || !hasPermission('customer_type_re_cert')
"
@input="value => handleScoreDetailScoreInput(detail, 'reviewScore', value)" @input="value => handleScoreDetailScoreInput(detail, 'reviewScore', value)"
> >
<template <template
@@ -1385,7 +1399,7 @@
<template #default="{ row }"> <template #default="{ row }">
<span class="score-category-table__name">{{ row.categoryName }}</span> <span class="score-category-table__name">{{ row.categoryName }}</span>
<span>自评{{ getSignedScore(row, 'selfScore') }}</span> <span>自评{{ getSignedScore(row, 'selfScore') }}</span>
<span>复评{{ getSignedScore(row, 'reviewScore') }}</span> <span v-if="!isNewScore">复评{{ getSignedScore(row, 'reviewScore') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="60" align="center"> <el-table-column width="60" align="center">
@@ -1459,12 +1473,15 @@
<div class="score-detail-dialog__total"> <div class="score-detail-dialog__total">
<span>总分合计</span> <span>总分合计</span>
<span>自评{{ formatScoreValue(currentScore.selfScore) }}</span> <span>自评{{ formatScoreValue(currentScore.selfScore) }}</span>
<span>复评{{ formatScoreValue(currentScore.reviewScore) }}</span> <span v-if="!isNewScore">复评{{ formatScoreValue(currentScore.reviewScore) }}</span>
</div> </div>
<el-button @click="scoreBox = false">取消</el-button> <el-button @click="scoreBox = false">取消</el-button>
<el-button type="primary" plain v-if="!readonly" @click="saveScoreDetail">保存</el-button> <el-button v-if="isNewScore" type="primary" @click="submitSelfScore">提交自评</el-button>
<el-button type="primary" plain v-if="!readonly && !isNewScore" @click="saveScoreDetail">
保存
</el-button>
<el-button <el-button
v-if="!readonly && hasPermission('customer_type_re_cert')" v-if="!isNewScore && (!readonly || reviewMode) && hasPermission('customer_type_re_cert')"
type="primary" type="primary"
@click="confirmReviewScore" @click="confirmReviewScore"
> >
@@ -1482,7 +1499,9 @@ import { ElCascader } from 'element-plus';
import { import {
getList, getList,
getDetail, getDetail,
getPublicDetail,
getChangeRecordList, getChangeRecordList,
getPublicChangeRecordList,
submit, submit,
submitApproval, submitApproval,
withdrawApproval, withdrawApproval,
@@ -1498,6 +1517,7 @@ import {
getDetail as getCreditScoreQuantificationDetail, getDetail as getCreditScoreQuantificationDetail,
} from '@/api/vehicle/credit-score-quantification'; } from '@/api/vehicle/credit-score-quantification';
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import { submitMkApprovalFlow } from '@/utils/mk-approval';
import { getDeptTree } from '@/api/system/dept'; import { getDeptTree } from '@/api/system/dept';
import { getLazyTree } from '@/api/base/region'; import { getLazyTree } from '@/api/base/region';
import { exportBlob } from '@/api/common'; import { exportBlob } from '@/api/common';
@@ -1516,6 +1536,7 @@ import NProgress from 'nprogress';
import 'nprogress/nprogress.css'; import 'nprogress/nprogress.css';
import SectionCard from '@/components/section-card/main.vue'; import SectionCard from '@/components/section-card/main.vue';
import PdfPreview from '@/components/pdf-preview/main.vue'; import PdfPreview from '@/components/pdf-preview/main.vue';
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
const createTimeRangeMap = { const createTimeRangeMap = {
createTimeRange: ['createTimeStart', 'createTimeEnd'], createTimeRange: ['createTimeStart', 'createTimeEnd'],
@@ -1531,11 +1552,18 @@ const qualificationViewerPlugins = [
export default { export default {
components: { components: {
SectionCard, SectionCard,
ChangeRecordDetailDialog,
ArrowRight, ArrowRight,
ElImageViewer, ElImageViewer,
OpenFileViewer, OpenFileViewer,
PdfPreview, PdfPreview,
}, },
props: {
embeddedPublicId: {
type: [String, Number],
default: '',
},
},
data() { data() {
const nonNegativeLabelMap = { const nonNegativeLabelMap = {
invoiceTaxRate: '开票税点', invoiceTaxRate: '开票税点',
@@ -1618,6 +1646,8 @@ export default {
receiptBox: false, receiptBox: false,
invoiceBox: false, invoiceBox: false,
readonly: false, readonly: false,
reviewMode: false,
listActivated: false,
originalAccessType: '', originalAccessType: '',
activeTab: 'scores', activeTab: 'scores',
archiveForm: this.emptyArchive(), archiveForm: this.emptyArchive(),
@@ -1776,6 +1806,7 @@ export default {
accountName: [{ required: true, message: '请输入收款单位名称', trigger: 'blur' }], accountName: [{ required: true, message: '请输入收款单位名称', trigger: 'blur' }],
accountHolderName: [{ required: true, message: '请输入开户人姓名', trigger: 'blur' }], accountHolderName: [{ required: true, message: '请输入开户人姓名', trigger: 'blur' }],
bankName: [{ required: true, message: '请输入开户行', trigger: 'blur' }], bankName: [{ required: true, message: '请输入开户行', trigger: 'blur' }],
cnapsCode: [{ required: true, message: '请输入联行号', trigger: 'blur' }],
bankAccount: [{ required: true, message: '请输入收款账号', trigger: 'blur' }], bankAccount: [{ required: true, message: '请输入收款账号', trigger: 'blur' }],
remark: [{ max: 200, message: '备注最多200个字符', trigger: 'blur' }], remark: [{ max: 200, message: '备注最多200个字符', trigger: 'blur' }],
}, },
@@ -1811,7 +1842,7 @@ export default {
editBtn: false, editBtn: false,
selection: true, selection: true,
dialogClickModal: false, dialogClickModal: false,
menuWidth: 280, menuWidth: 320,
column: [ column: [
{ {
label: '客商编号', label: '客商编号',
@@ -1989,15 +2020,36 @@ export default {
}; };
}, },
created() { created() {
if (this.isPublicViewPage) {
this.readonly = true;
const id = this.embeddedPublicId || this.$route.query.id;
if (!id) {
this.archiveBox = true;
this.$message.error('缺少客商ID');
return;
}
this.openArchive({ id }, true);
return;
}
this.initDeptTree(); this.initDeptTree();
this.initRegionOptions(); this.initRegionOptions();
this.initBusinessDictionaries(); this.initBusinessDictionaries();
this.initScoreQuantificationOptions(); this.initScoreQuantificationOptions();
if (this.isArchivePage) { if (this.isArchivePage) {
const readonly = this.$route.query.view === '1' || this.$route.query.view === 'true'; this.reviewMode = this.$route.query.review === '1';
const readonly =
this.$route.query.view === '1' || this.$route.query.view === 'true' || this.reviewMode;
this.openArchive(this.$route.query.id ? { id: this.$route.query.id } : null, readonly); this.openArchive(this.$route.query.id ? { id: this.$route.query.id } : null, readonly);
} }
}, },
activated() {
if (this.isArchivePage || this.isPublicViewPage) return;
if (!this.listActivated) {
this.listActivated = true;
return;
}
this.onLoad(this.page, this.query);
},
computed: { computed: {
...mapGetters(['permission', 'userInfo']), ...mapGetters(['permission', 'userInfo']),
isAdmin() { isAdmin() {
@@ -2010,7 +2062,14 @@ export default {
}; };
}, },
isArchivePage() { isArchivePage() {
return this.$route.path === '/vehicle/customer-archive/form'; return (
this.$route.path === '/vehicle/customer-archive/form' || this.isPublicViewPage
);
},
isPublicViewPage() {
return (
this.$route.path === '/vehicle/customer-archive/public-view' || !!this.embeddedPublicId
);
}, },
archiveContainer() { archiveContainer() {
return 'div'; return 'div';
@@ -2076,6 +2135,7 @@ export default {
return ids.join(','); return ids.join(',');
}, },
dialogTitle() { dialogTitle() {
if (this.reviewMode) return '客商复评';
if (this.readonly) return '查看客商档案'; if (this.readonly) return '查看客商档案';
return this.archiveForm.id ? '编辑客商档案' : '新增客商档案'; return this.archiveForm.id ? '编辑客商档案' : '新增客商档案';
}, },
@@ -2119,6 +2179,14 @@ export default {
scoreList() { scoreList() {
return this.archiveForm.scores || []; return this.archiveForm.scores || [];
}, },
showScoreDelete() {
if (this.readonly) return false;
const status = this.archiveForm.approvalStatus || 'draft';
return status === 'draft' || status === 'rejected';
},
isNewScore() {
return this.scoreRecordIndex < 0 && !this.reviewMode;
},
scorePageCount() { scorePageCount() {
return Math.max(Math.ceil(this.scoreList.length / this.scorePage.pageSize), 1); return Math.max(Math.ceil(this.scoreList.length / this.scorePage.pageSize), 1);
}, },
@@ -2190,6 +2258,45 @@ export default {
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false); return this.isAdmin || this.validData(this.permission[code], false);
}, },
mergeSelectOptions(target, values) {
const list = Array.isArray(values) ? values : values ? [values] : [];
list.forEach(value => {
if (value === undefined || value === null || value === '') return;
if (!this[target].some(item => String(item.value) === String(value))) {
this[target].push({ label: String(value), value });
}
});
},
ensurePublicViewOptions(archive = {}) {
this.mergeSelectOptions('customerNatureOptions', archive.customerNature);
this.mergeSelectOptions('customerTypeOptions', archive.customerType);
this.mergeSelectOptions('businessScopeOptions', archive.businessScope);
this.mergeSelectOptions(
'qualificationTypeOptions',
(this.qualificationFiles || []).map(item => item.type)
);
const deptId = Array.isArray(archive.deptId) ? archive.deptId[0] : archive.deptId;
if (deptId && archive.deptName) {
this.deptTree = [
{
label: archive.deptName,
value: String(deptId),
children: [],
},
];
this.deptOptions = this.flattenDept(this.deptTree);
}
(archive.scores || []).forEach(score => {
if (!score.quantificationId) return;
const id = String(score.quantificationId);
if (!this.scoreQuantificationOptions.some(item => String(item.id) === id)) {
this.scoreQuantificationOptions.push({
id,
name: score.quantificationName || score.name || id,
});
}
});
},
// tooltip // tooltip
checkOverflow(refName, flag) { checkOverflow(refName, flag) {
const inst = this.$refs[refName]; const inst = this.$refs[refName];
@@ -2278,7 +2385,8 @@ export default {
loadChangeRecords() { loadChangeRecords() {
if (!this.archiveForm.id) return; if (!this.archiveForm.id) return;
const page = this.changeRecordPage; const page = this.changeRecordPage;
getChangeRecordList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => { const requestList = this.isPublicViewPage ? getPublicChangeRecordList : getChangeRecordList;
requestList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => {
const data = res.data.data || {}; const data = res.data.data || {};
page.records = this.replaceNegativeOneWithBlank(data.records || []); page.records = this.replaceNegativeOneWithBlank(data.records || []);
page.total = Number(data.total || 0); page.total = Number(data.total || 0);
@@ -2636,6 +2744,7 @@ export default {
accountName: '', accountName: '',
accountHolderName: '', accountHolderName: '',
bankName: '', bankName: '',
cnapsCode: '',
bankAccount: '', bankAccount: '',
registeredPhone: '', registeredPhone: '',
registeredAddress: '', registeredAddress: '',
@@ -3889,7 +3998,16 @@ export default {
query: { id: row.id, name: '查看客商档案', view: '1' }, query: { id: row.id, name: '查看客商档案', view: '1' },
}); });
}, },
openReview(row) {
this.$router.push({
path: '/vehicle/customer-archive/form',
query: { id: row.id, name: '客商复评', review: '1' },
});
},
closeArchive() { closeArchive() {
if (this.isPublicViewPage) return;
this.archiveBox = false;
this.$router.$avueRouter?.closeTag?.();
this.$router.push('/vehicle/customer-archive'); this.$router.push('/vehicle/customer-archive');
}, },
openArchive(row, readonly = false) { openArchive(row, readonly = false) {
@@ -3898,7 +4016,9 @@ export default {
this.resetDetailPagination(); this.resetDetailPagination();
this.resetChangeRecordPage(); this.resetChangeRecordPage();
if (row && row.id) { if (row && row.id) {
getDetail(row.id).then(res => { const requestDetail = this.isPublicViewPage ? getPublicDetail : getDetail;
requestDetail(row.id)
.then(res => {
const archive = this.normalizeDetail(res.data.data); const archive = this.normalizeDetail(res.data.data);
this.archiveForm = readonly ? this.replaceNegativeOneWithBlank(archive) : archive; this.archiveForm = readonly ? this.replaceNegativeOneWithBlank(archive) : archive;
this.originalAccessType = this.archiveForm.accessType || ''; this.originalAccessType = this.archiveForm.accessType || '';
@@ -3912,9 +4032,15 @@ export default {
this.qualificationUploadFiles = []; this.qualificationUploadFiles = [];
this.ocrQualificationUploadFiles = []; this.ocrQualificationUploadFiles = [];
this.selectedQualificationFiles = []; this.selectedQualificationFiles = [];
if (this.isPublicViewPage) this.ensurePublicViewOptions(this.archiveForm);
this.archiveBox = true; this.archiveBox = true;
this.loadChangeRecords(); this.loadChangeRecords();
}); if (this.reviewMode) this.openReviewScore();
})
.catch(() => {
this.archiveBox = true;
if (this.isPublicViewPage) this.$message.error('客商信息加载失败');
});
return; return;
} }
this.archiveForm = this.emptyArchive(); this.archiveForm = this.emptyArchive();
@@ -3951,14 +4077,15 @@ export default {
this.invoiceForm = this.emptyInvoice(); this.invoiceForm = this.emptyInvoice();
this.$refs.archiveForm?.clearValidate(); this.$refs.archiveForm?.clearValidate();
}, },
// //
validateFormalForApproval(archive) { validateScoreForApproval(archive) {
if (archive.accessType !== 'formal') return true; const scores = archive.scores || [];
const hasCompletedScore = (archive.scores || []).some( if (scores.length > 1) {
item => item.selfStatus === '已完成' || item.reviewStatus === '已完成' || item.finalScore this.$message.warning('评分记录只能有一条');
); return false;
if (!hasCompletedScore) { }
this.$message.warning('正式客商提交审核前必须完成信用评分'); if (scores.length !== 1 || scores[0].selfStatus !== '已完成') {
this.$message.warning('提交审批前必须完成自评');
return false; return false;
} }
return true; return true;
@@ -4010,7 +4137,7 @@ export default {
.filter(item => item.contactName || item.contactPhone); .filter(item => item.contactName || item.contactPhone);
archive.receiptAccounts = (archive.receiptAccounts || []) archive.receiptAccounts = (archive.receiptAccounts || [])
.map(item => this.normalizeReceipt(item)) .map(item => this.normalizeReceipt(item))
.filter(item => item.accountName || item.accountHolderName || item.bankAccount); .filter(item => item.accountName || item.accountHolderName || item.bankAccount || item.cnapsCode);
archive.invoices = (archive.invoices || []) archive.invoices = (archive.invoices || [])
.map(item => { .map(item => {
const invoice = this.normalizeInvoice(item); const invoice = this.normalizeInvoice(item);
@@ -4068,7 +4195,7 @@ export default {
const archive = this.normalizeArchive(); const archive = this.normalizeArchive();
// //
archive.recordChange = true; archive.recordChange = true;
if (!this.validateFormalForApproval(archive)) return; if (!this.validateScoreForApproval(archive)) return;
submit(archive).then(res => { submit(archive).then(res => {
const data = res.data.data; const data = res.data.data;
const id = (data && typeof data === 'object' ? data.id : data) || this.archiveForm.id; const id = (data && typeof data === 'object' ? data.id : data) || this.archiveForm.id;
@@ -4078,7 +4205,16 @@ export default {
this.$message({ type: 'success', message: '保存成功,请在列表提交审批' }); this.$message({ type: 'success', message: '保存成功,请在列表提交审批' });
return; return;
} }
submitApproval(id).then(() => { const fullName =
(data && typeof data === 'object' ? data.fullName : '') ||
archive.fullName ||
this.archiveForm.fullName ||
'';
this.submitCustomerApproval(
id,
fullName,
archive.approvalStatus || this.archiveForm.approvalStatus
).then(() => {
this.closeArchive(); this.closeArchive();
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ type: 'success', message: '提交成功!' }); this.$message({ type: 'success', message: '提交成功!' });
@@ -4086,9 +4222,32 @@ export default {
}); });
}); });
}, },
/**
* 列表 / 新增 / 编辑提交共用开启 MK 时提交审核流并更新客商审批状态
*/
submitCustomerApproval(id, fullName = '', approvalStatus = '') {
return submitMkApprovalFlow({
bizType: 'customer-archive',
formInstanceId: id,
subjectName: fullName,
approvalStatus,
}).then(() => submitApproval(id));
},
openReviewScore() {
const scores = this.archiveForm.scores || [];
if (!scores.length) {
this.$message.warning('暂无评分记录,无法复评');
return;
}
this.$nextTick(() => this.openScore(scores[0], 0));
},
addScore() { addScore() {
if ((this.archiveForm.scores || []).length) {
this.$message.warning('请勿重复添加');
return;
}
this.scoreRecordIndex = -1; this.scoreRecordIndex = -1;
this.currentScore = this.normalizeScore({}); this.currentScore = this.normalizeScore({ applyCreditLimit: '' });
this.scoreAttachmentFiles = []; this.scoreAttachmentFiles = [];
this.expandedScoreCategoryKeys = []; this.expandedScoreCategoryKeys = [];
this.scoreBox = true; this.scoreBox = true;
@@ -4170,7 +4329,7 @@ export default {
JSON.stringify( JSON.stringify(
(item.options || []).map(option => ({ (item.options || []).map(option => ({
label: option.label || option.optionName || option.value, label: option.label || option.optionName || option.value,
value: option.value || option.optionName || option.label, value: option.value ?? option.optionName ?? option.label,
score: option.score, score: option.score,
changeType: option.changeType, changeType: option.changeType,
changeValue: option.changeValue, changeValue: option.changeValue,
@@ -4260,20 +4419,21 @@ export default {
const isScoreOption = item.changeType || item.changeValue || item.changeUnit; const isScoreOption = item.changeType || item.changeValue || item.changeUnit;
const changeLabel = item.changeType === 'decrease' ? '每减少' : '每增加'; const changeLabel = item.changeType === 'decrease' ? '每减少' : '每增加';
const scoreLabel = item.scoreType === 'subtract' ? '减' : '加'; const scoreLabel = item.scoreType === 'subtract' ? '减' : '加';
const rawScore = item.score;
const generatedLabel = isScoreOption const generatedLabel = isScoreOption
? `${changeLabel}${item.changeValue || ''}${item.changeUnit || ''}${scoreLabel}${ ? `${changeLabel}${item.changeValue || ''}${item.changeUnit || ''}${scoreLabel}${
item.score || '' this.isBlankScore(rawScore) ? '' : rawScore
}` }`
: ''; : '';
const label = item.label || item.optionName || item.value || generatedLabel; const label = item.label || item.optionName || item.value || generatedLabel;
return { return {
...item, ...item,
label, label,
value: item.value || item.optionName || item.label || generatedLabel, value: item.value ?? item.optionName ?? item.label ?? generatedLabel,
score: score:
item.scoreType === 'subtract' && item.score !== undefined item.scoreType === 'subtract' && !this.isBlankScore(rawScore)
? -Math.abs(Number(item.score)) ? -Math.abs(Number(rawScore))
: item.score, : rawScore,
}; };
}); });
if (Array.isArray(value)) return normalize(value); if (Array.isArray(value)) return normalize(value);
@@ -4337,23 +4497,35 @@ export default {
const valid = increase ? input >= base : input <= base; const valid = increase ? input >= base : input <= base;
if (!valid) { if (!valid) {
detail.selfScore = ''; detail.selfScore = '';
this.$message.warning(`输入值${increase ? '不能小于' : '不能大于'}基准数值${base}`);
this.calculateScore(this.currentScore); this.calculateScore(this.currentScore);
return; return;
} }
detail.selfScore = this.getScoreTypeCalculatedScore(detail); detail.selfScore = this.getScoreTypeCalculatedScore(detail);
this.calculateScore(this.currentScore); this.calculateScore(this.currentScore);
}, },
handleScoreValueBlur(detail) {
const normalized = String(detail.scoreInput ?? '').trim();
if (!normalized || normalized === '-' || normalized === '.') return;
const rule = this.getScoreRule(detail);
const base = Number(detail.baseValue);
const input = Number(normalized);
if (!rule || !Number.isFinite(base) || !Number.isFinite(input)) return;
const increase = rule.changeType !== 'decrease';
const valid = increase ? input >= base : input <= base;
if (!valid) {
this.$message.warning(`输入值${increase ? '不能小于' : '不能大于'}基准数值${base}`);
}
},
scoreOptionChange(detail, optionValue) { scoreOptionChange(detail, optionValue) {
const option = this.parseScoreOptions(detail.optionsJson).find( const option = this.parseScoreOptions(detail.optionsJson).find(
item => item.value === optionValue item => item.value === optionValue
); );
const score = Number(option?.score || 0); const rawScore = option?.score;
detail.selfScore = score; detail.selfScore = this.isBlankScore(rawScore) ? 0 : Number(rawScore);
this.calculateScore(this.currentScore); this.calculateScore(this.currentScore);
}, },
handleScoreDetailScoreInput(detail, prop, value) { handleScoreDetailScoreInput(detail, prop, value) {
const normalized = String(value || '') const normalized = String(value ?? '')
.replace(/[^\d.]/g, '') .replace(/[^\d.]/g, '')
.replace(/^\./, '') .replace(/^\./, '')
.replace(/(\..*)\./g, '$1') .replace(/(\..*)\./g, '$1')
@@ -4485,8 +4657,7 @@ export default {
sumScore(plusDetails, 'reviewScore') - sumScore(plusDetails, 'reviewScore') -
sumScore(minusDetails, 'reviewScore'); sumScore(minusDetails, 'reviewScore');
const hasReviewScore = details.some( const hasReviewScore = details.some(
item => item => !this.isBlankScore(item.reviewScore)
item.reviewScore !== undefined && item.reviewScore !== null && item.reviewScore !== ''
); );
const finalScore = hasReviewScore ? reviewScore : selfScore; const finalScore = hasReviewScore ? reviewScore : selfScore;
const fullMark = this.getScoreFullMark(details); const fullMark = this.getScoreFullMark(details);
@@ -4506,13 +4677,17 @@ export default {
} }
return score; return score;
}, },
isBlankScore(value) {
return value === undefined || value === null || String(value).trim() === '';
},
hasIncompleteBasicScoreDetail(details = []) { hasIncompleteBasicScoreDetail(details = []) {
return this.getScoreCategoryDetailsByList(details, 'basic').some(item => { return this.getScoreCategoryDetailsByList(details, 'basic').some(item => {
if (this.isScoreTypeDetail(item)) { if (this.isScoreTypeDetail(item)) {
const input = String(item.scoreInput ?? '').trim(); const input = String(item.scoreInput ?? '').trim();
return !input || !Number.isFinite(Number(input)) || item.selfScore === ''; const inputBlank = input === '' || input === '-' || input === '.';
return inputBlank || !Number.isFinite(Number(input)) || this.isBlankScore(item.selfScore);
} }
return !item.selectedOption; return this.isBlankScore(item.selectedOption);
}); });
}, },
finishScore(score) { finishScore(score) {
@@ -4529,10 +4704,13 @@ export default {
score.reviewStatus = '已完成'; score.reviewStatus = '已完成';
this.$message.success('评分已完成'); this.$message.success('评分已完成');
}, },
saveScoreDetail() { saveScoreDetail(successMessage) {
if (!this.validateScoreForm(false)) return; if (!this.validateScoreForm(false)) return;
this.currentScore.attachments = JSON.parse(JSON.stringify(this.scoreAttachmentFiles || [])); this.currentScore.attachments = JSON.parse(JSON.stringify(this.scoreAttachmentFiles || []));
this.currentScore.proofAttachments = this.stringifyAttachments(this.scoreAttachmentFiles); this.currentScore.proofAttachments = this.stringifyAttachments(this.scoreAttachmentFiles);
this.currentScore.selfStatus = this.hasIncompleteBasicScoreDetail(this.currentScore.details)
? '未完成'
: '已完成';
this.calculateScore(this.currentScore); this.calculateScore(this.currentScore);
const score = JSON.parse(JSON.stringify(this.currentScore)); const score = JSON.parse(JSON.stringify(this.currentScore));
if (this.scoreRecordIndex > -1) { if (this.scoreRecordIndex > -1) {
@@ -4544,23 +4722,62 @@ export default {
this.syncArchiveCreditFromScores(); this.syncArchiveCreditFromScores();
this.activeTab = 'scores'; this.activeTab = 'scores';
this.scoreBox = false; this.scoreBox = false;
this.saveScoreArchive(); const pending = this.saveScoreArchive(successMessage);
}, if (this.reviewMode && successMessage && pending && pending.then) {
saveScoreArchive() { pending.then(() => this.closeArchive());
if (!this.archiveForm.id) {
this.$message.success('评分记录已添加,请保存客商档案后生效');
return;
} }
submit(this.normalizeArchive()).then(() => { return pending;
this.$message.success('评分记录已保存'); },
deleteScore(index) {
this.$confirm('确定删除该评分记录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
if (!Array.isArray(this.archiveForm.scores)) this.archiveForm.scores = [];
this.archiveForm.scores.splice(index, 1);
if (this.scoreRecordIndex === index) {
this.scoreBox = false;
} else if (this.scoreRecordIndex > index) {
this.scoreRecordIndex -= 1;
}
const latestScore = this.getLatestCreditScore(this.archiveForm.scores);
if (latestScore) {
this.syncArchiveCreditFromScores();
} else {
this.archiveForm.customerLevel = '';
this.archiveForm.maxCreditLimit = '';
this.archiveForm.applyCreditLimit = '';
}
this.handleScoreCurrentChange(this.scorePage.currentPage);
this.saveScoreArchive('评分记录已删除', '评分记录已删除,请保存客商档案后生效');
})
.catch(() => {});
},
saveScoreArchive(
successMessage = '评分记录已保存',
draftMessage = '评分记录已添加,请保存客商档案后生效'
) {
if (!this.archiveForm.id) {
this.$message.success(draftMessage);
return Promise.resolve();
}
return submit(this.normalizeArchive()).then(() => {
this.$message.success(successMessage);
}); });
}, },
submitSelfScore() {
if (!this.validateScoreForm(true)) return;
this.currentScore.selfStatus = '已完成';
this.currentScore.reviewStatus = '未完成';
this.saveScoreDetail('自评已提交');
},
confirmReviewScore() { confirmReviewScore() {
if (!this.validateScoreForm(true)) return; if (!this.validateScoreForm(true)) return;
this.currentScore.selfStatus = '已完成'; this.currentScore.selfStatus = '已完成';
this.currentScore.reviewStatus = '已完成'; this.currentScore.reviewStatus = '已完成';
this.saveScoreDetail(); this.saveScoreDetail('复评确认成功');
this.$message.success('复评确认成功');
}, },
validateScoreForm(requireComplete) { validateScoreForm(requireComplete) {
if (!this.currentScore.scoreDate) { if (!this.currentScore.scoreDate) {
@@ -4598,7 +4815,7 @@ export default {
if ( if (
item.reviewScore === undefined || item.reviewScore === undefined ||
item.reviewScore === null || item.reviewScore === null ||
item.reviewScore === '' String(item.reviewScore).trim() === ''
) { ) {
return false; return false;
} }
@@ -4615,7 +4832,7 @@ export default {
return false; return false;
} }
if (requireComplete && this.hasIncompleteBasicScoreDetail(this.currentScore.details)) { if (requireComplete && this.hasIncompleteBasicScoreDetail(this.currentScore.details)) {
this.$message.warning('请完整填写基础得分项评分明细'); this.$message.warning('请完整填写所有基础项目后再提交自评');
return false; return false;
} }
return true; return true;
@@ -4670,13 +4887,19 @@ export default {
getDetail(row.id).then(res => { getDetail(row.id).then(res => {
const archive = this.normalizeDetail(res.data.data); const archive = this.normalizeDetail(res.data.data);
archive.qualificationAttachments = archive.qualificationAttachments || ''; archive.qualificationAttachments = archive.qualificationAttachments || '';
if (!this.validateFormalForApproval(archive)) return; if (!this.validateScoreForApproval(archive)) return;
this.$confirm('是否提交客商准入审批?', '提示', { this.$confirm('是否提交客商准入审批?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}) })
.then(() => submitApproval(row.id)) .then(() =>
this.submitCustomerApproval(
row.id,
archive.fullName || row.fullName,
archive.approvalStatus || row.approvalStatus
)
)
.then(() => { .then(() => {
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ type: 'success', message: '提交成功!' }); this.$message({ type: 'success', message: '提交成功!' });
@@ -4758,7 +4981,7 @@ export default {
}, },
selectionClear() { selectionClear() {
this.selectionList = []; this.selectionList = [];
this.$refs.crud.toggleSelection(); this.$refs.crud?.toggleSelection();
}, },
currentChange(currentPage) { currentChange(currentPage) {
this.page.currentPage = currentPage; this.page.currentPage = currentPage;
@@ -5151,10 +5374,16 @@ export default {
} }
:deep(.el-table__body td) { :deep(.el-table__body td) {
//min-height: 112px;
color: #303133; color: #303133;
} }
:deep(.score-item-name) {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
:deep(.el-select), :deep(.el-select),
:deep(.el-input), :deep(.el-input),
:deep(.el-select) { :deep(.el-select) {
@@ -5189,6 +5418,16 @@ export default {
.invoice-form { .invoice-form {
max-width: none; max-width: none;
:deep(.el-input),
:deep(.el-cascader),
:deep(.el-select) {
width: 100%;
}
:deep(.el-cascader .el-input) {
width: 100%;
}
} }
.invoice-contact-table { .invoice-contact-table {
@@ -5327,25 +5566,10 @@ export default {
word-break: break-word; word-break: break-word;
} }
:deep(.change-record-detail-dialog .el-dialog__body) { .customer-archive-page.is-public-view {
max-height: 65vh; :deep(.archive-page-form .archive-form__footer) {
overflow: auto; left: 0;
} }
:deep(.change-record-detail-dialog .change-record-detail-value .cell) {
white-space: pre-wrap;
word-break: break-word;
overflow: visible;
text-overflow: clip;
line-height: 1.6;
}
.change-record-detail-meta {
display: flex;
gap: 32px;
margin-bottom: 16px;
color: #606266;
font-size: 14px;
} }
.archive-page-form { .archive-page-form {
+26
View File
@@ -21,6 +21,15 @@
@on-load="onLoad" @on-load="onLoad"
> >
<template #menu-left> <template #menu-left>
<el-button
v-if="hasPermission('equipment_ledger_delete')"
type="danger"
icon="el-icon-delete"
plain
@click="handleDelete"
>
批量删除
</el-button>
<el-button <el-button
v-if="hasPermission('equipment_ledger_import')" v-if="hasPermission('equipment_ledger_import')"
type="primary" type="primary"
@@ -310,6 +319,23 @@ export default {
this.$message.success('操作成功'); this.$message.success('操作成功');
}); });
}, },
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确认删除选中的数据?删除后将不可恢复!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => remove(this.ids))
.then(() => {
this.onLoad(this.page);
this.$message.success('操作成功');
this.$refs.crud.toggleSelection();
});
},
beforeOpen(done, type) { beforeOpen(done, type) {
this.boxType = type; this.boxType = type;
if (type === 'add') { if (type === 'add') {
+91 -2
View File
@@ -217,7 +217,7 @@ import { getList as getOcrTemplateList } from '@/api/base/insurance-ocr-template
import { getDeptTree } from '@/api/system/dept'; import { getDeptTree } from '@/api/system/dept';
import { exportBlob } from '@/api/common'; import { exportBlob } from '@/api/common';
import { downloadXls } from '@/utils/util'; import { downloadXls } from '@/utils/util';
import { openImportDialog } from '@/utils/import-excel'; import { handleImportExcel } from '@/utils/import-excel';
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getUploadHeaders } from '@/utils/upload'; import { getUploadHeaders } from '@/utils/upload';
import { normalizeSearchRangeParams } from '@/utils/search-range'; import { normalizeSearchRangeParams } from '@/utils/search-range';
@@ -540,7 +540,96 @@ export default {
}); });
}, },
handleImport() { handleImport() {
openImportDialog(this, '保险记录'); const column = this.findColumn(this.excelOption.column, 'excelFile');
if (!column) {
this.$message.error('导入配置异常,请稍后重试');
return;
}
// 2026-9-1 2026-09-01
column.httpRequest = async (uploadOption, uploadColumn) => {
try {
const normalizedFile = await this.normalizeExcelDates(uploadOption.file);
await handleImportExcel(
this,
{ ...uploadOption, file: normalizedFile },
uploadColumn,
'保险记录',
null,
{ timeout: 60000 }
);
} catch (error) {
this.$message.error(error.message || '导入失败');
if (typeof uploadOption.onError === 'function') {
uploadOption.onError(error);
}
}
};
this.excelBox = true;
},
// Excel YYYY-MM-DD
async normalizeExcelDates(file) {
const rows = await this.readExcelRows(file);
const dateHeaders = ['开始日期', '结束日期', '开票日期'];
const headerIndex = (rows[0] || []).reduce((map, label, index) => {
const key = String(label || '').trim();
if (key) map[key] = index;
return map;
}, {});
const targetIndexes = dateHeaders
.map(label => headerIndex[label])
.filter(index => index !== undefined);
if (!targetIndexes.length) return file;
rows.forEach((row, rowIndex) => {
if (rowIndex === 0) return;
targetIndexes.forEach(index => {
if (row[index] !== undefined && row[index] !== '') {
const normalized = this.normalizeDateString(String(row[index]));
if (normalized) row[index] = normalized;
}
});
});
return this.writeExcelFile(rows, file.name);
},
async readExcelRows(file) {
const XLSX = await import('xlsx');
const buffer = await file.arrayBuffer();
const workbook = XLSX.read(buffer, { type: 'array', cellDates: false });
const worksheet = workbook.Sheets[workbook.SheetNames[0]];
return XLSX.utils.sheet_to_json(worksheet, {
header: 1,
defval: '',
raw: false,
blankrows: false,
});
},
async writeExcelFile(rows, fileName) {
const XLSX = await import('xlsx');
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, XLSX.utils.aoa_to_sheet(rows), 'Sheet1');
const binary = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
return new File([binary], fileName || 'insurance-record.xlsx', {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
});
},
// YYYY-M-D / YYYY-MM-DD / YYYY/M/D / YYYY... null
normalizeDateString(value) {
const text = String(value || '').trim();
if (!text) return null;
const match = text.match(/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?$/);
if (!match) return null;
const year = Number(match[1]);
const month = Number(match[2]);
const day = Number(match[3]);
const date = new Date(year, month - 1, day);
if (
date.getFullYear() !== year ||
date.getMonth() !== month - 1 ||
date.getDate() !== day
) {
return null;
}
const pad = n => String(n).padStart(2, '0');
return `${year}-${pad(month)}-${pad(day)}`;
}, },
handleExport() { handleExport() {
this.$confirm('是否导出保险记录数据?', '提示', { this.$confirm('是否导出保险记录数据?', '提示', {
+3 -3
View File
@@ -516,7 +516,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-transport/maintenance-plan/import-maintenance-plan', action: '/blade-transport/maintenance-plan/import-maintenance-plan',
}, },
{ {
@@ -564,8 +564,8 @@ export default {
this.addressMapPickerVisible = true; this.addressMapPickerVisible = true;
} }
}, },
handleAddressMapConfirm(address) { handleAddressMapConfirm(payload) {
this.form.address = address; this.form.address = typeof payload === 'string' ? payload : payload?.address || '';
}, },
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false); return this.isAdmin || this.validData(this.permission[code], false);
+3 -3
View File
@@ -489,7 +489,7 @@ export default {
propsHttp: { propsHttp: {
res: 'data', res: 'data',
}, },
tip: '请上传 .xls,.xlsx 标准格式文件', tip: '请上传 .xls,.xlsx 标准格式文件;日期支持 2026-08-02、2026-8-2、2026/8/2 等写法',
action: '/blade-transport/maintenance-record/import-maintenance-record', action: '/blade-transport/maintenance-record/import-maintenance-record',
}, },
{ {
@@ -545,8 +545,8 @@ export default {
this.addressMapPickerVisible = true; this.addressMapPickerVisible = true;
} }
}, },
handleAddressMapConfirm(address) { handleAddressMapConfirm(payload) {
this.form.address = address; this.form.address = typeof payload === 'string' ? payload : payload?.address || '';
}, },
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false); return this.isAdmin || this.validData(this.permission[code], false);
+2 -2
View File
@@ -288,8 +288,8 @@ export default {
this.locationMapPickerVisible = true; this.locationMapPickerVisible = true;
} }
}, },
handleLocationMapConfirm(address) { handleLocationMapConfirm(payload) {
this.form.location = address; this.form.location = typeof payload === 'string' ? payload : payload?.address || '';
}, },
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false); return this.isAdmin || this.validData(this.permission[code], false);

Some files were not shown because too many files have changed in this diff Show More