Compare commits

..

19 Commits

Author SHA1 Message Date
刘泉佳 f49f36fb60 ✨ 金蝶附件下载(A801-2)前端:票池弹窗/正式结算/付款申请三入口附件查看下载与类型分流 2026-09-27 21:17:59 +08:00
刘泉佳 aabe67e4d6 ✨ 金蝶附件同步(A902)前端:四页面附件同步列、重推补传提示与收票推送超时放宽 2026-09-24 13:27:41 +08:00
刘泉佳 e63c7fdd42 Merge remote-tracking branch 'origin/feature/bfi-api-rate' into feature/bfi-api-rate
# Conflicts:
#	src/api/payment/invoiceReceipt.js
2026-09-24 11:56:47 +08:00
刘泉佳 aa0aec3704 feat: 批量转结算弹窗新增单据号和合同编码查询条件 2026-09-23 15:39:32 +08:00
刘泉佳 622705325b feat: 选票弹窗新增剩余可用金额列并支持游标翻页与上一页缓存回显
- 下一页回传上页nextCursor续扫,新查询/换页容量/重新打开自动重置游标与页缓存
- 上一页直接回显已浏览页缓存,不再发起请求
- 查询表单删除单据使用状态条件(后端固定查未用),新增剩余可用金额展示列
2026-09-23 15:06:33 +08:00
刘泉佳 4657fc29bd ♻️ 收票管理仅保留推送金蝶收票单并统一命名为批量同步 2026-09-23 11:05:19 +08:00
刘泉佳 884de893db ✨ 收票单推送金蝶与票池实时游标分页前端适配:选票弹窗hasMore分页,下线镜像补查与票池同步入口,保存时按票号重查回填 2026-09-23 10:22:51 +08:00
刘泉佳 cc73d544ff 🔧 引入vue-tsc与typecheck脚本支持类型检查,pnpm-lock.yaml改为忽略不跟踪 2026-09-23 10:22:46 +08:00
刘泉佳 10fecb5a54 ✨ 金蝶票池选票统一查镜像前端接线(新增统一选票弹窗组件,替换收票与结算认领弹窗并删除Mock) 2026-09-22 21:26:50 +08:00
刘泉佳 bab6bdba27 Merge remote-tracking branch 'origin/feature/bfi-api-rate' into feature/bfi-api-rate 2026-09-22 16:36:33 +08:00
刘泉佳 a554ccf38e 🐛 axios网络级失败(502/504/超时)补充统一错误提示,修复接口报错页面无感知 2026-09-21 21:20:57 +08:00
刘泉佳 a748e52551 ✨ 开票申请商品行选择开票内容时快照税收分类编码并随保存提交 2026-09-21 19:14:57 +08:00
刘泉佳 e89e78b527 ✨ 正式结算单认领查询对接发票云全票池(多条件搜索+服务端分页) 2026-09-20 19:41:37 +08:00
刘泉佳 2a03991297 ⚡ 客商档案金蝶回填优化:放宽锁定字段、信用代码可重新输入并修复查询误判 2026-09-20 16:06:03 +08:00
刘泉佳 884cc4355f fix: 同步金蝶接口放宽请求超时,修复长耗时推送成功但页面无提示 2026-09-18 20:42:52 +08:00
刘泉佳 58aaf79445 ✨ 客商档案新增金蝶客商查询回填与同步金蝶重推入口 2026-09-18 20:01:29 +08:00
刘泉佳 f067518c0e fix: 付款申请批量同步金蝶失败时展示失败原因
- 批量同步后解析返回结果,按"同步失败"标识区分成功与失败条目
- 部分失败时以 warning 提示成功/失败条数及具体失败原因(停留8秒),全部成功仍提示已同步条数
2026-09-18 11:58:00 +08:00
刘泉佳 11460f3378 ✨ 付款管理新增同步付款结果按钮并扩展金蝶单据状态选项 2026-09-18 11:57:59 +08:00
刘泉佳 7f543937fb ✨ 结算单新增时自动查询BFI汇率
- currency.js: 新增getBfiExchangeRate接口调用
- pre-settlement-editor.vue:
  - 选择合同后同步结算币种并自动查询当天BFI汇率
  - 汇率日期变更时自动查询BFI汇率并回填结算汇率
  - 新增时自动设置当天日期并查询汇率
- formal-settlement-editor.vue:
  - 选择合同后同步结算币种并自动查询当天BFI汇率
  - 汇率日期变更时自动查询BFI汇率并回填结算汇率
  - 新增时自动查询当天BFI汇率
2026-09-16 14:14:53 +08:00
68 changed files with 2065 additions and 7114 deletions
+1
View File
@@ -1,5 +1,6 @@
.DS_Store .DS_Store
node_modules node_modules
pnpm-lock.yaml
/dist /dist
/tests/e2e/videos/ /tests/e2e/videos/
-6
View File
@@ -1,6 +0,0 @@
# 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
@@ -1,28 +0,0 @@
# 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 快)。
## 只给「查看弹窗」加宽 label(temporary-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 才能看全字段名的可发现性差。
-12
View File
@@ -1,12 +0,0 @@
# 2026-09-17 工作日志
## 运单管理详情:打卡时间轴改为按打卡顺序展示
- 文件:`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`)后端未提供节点排序字段,排序只能在前端做。
+2 -7
View File
@@ -30,13 +30,8 @@
- Avue 内置弹窗 footer 真实 class 是 `.avue-dialog__footer`,须 `position:sticky; bottom:0; flex:none; background:#fff` 贴底。 - Avue 内置弹窗 footer 真实 class 是 `.avue-dialog__footer`,须 `position:sticky; bottom:0; flex:none; background:#fff` 贴底。
### 上传证件区域尺寸(transportCapacity) ### 上传证件区域尺寸(transportCapacity)
- 身份证/行驶证/道路运输证等目标比例 **240×151px**(1.586:1),ship 为 248px 上限。 - 身份证/行驶证/道路运输证等固定 **240×151px**(1.586:1)。
- ⚠️ **不能写死 `width:240px`**:弹窗 `width:90%` + 列 `el-col :span=6` 是弹性的,固定 px 只在特定分辨率/系统缩放下恰好等于列宽(本机对齐、他人错位)。统一写法: - scoped 覆盖 `.xxx-uploader--large { width:240px }` 与 `--large .el-upload { width:100%; height:151px }`。
```scss
.xxx-uploader--large { display:block; width:100%; max-width:240px; flex:none; margin:0; }
.xxx-uploader--large .el-upload { width:100%; height:151px; }
```
2026-09-11 已修正 driver / vehicle / ship 三处。
### 上传图片点击放大预览 ### 上传图片点击放大预览
- `src/components/image-upload-field/main.vue` 用 `<el-image preview-src-list fit="contain" preview-teleported :z-index="3000" @click.stop>`,阻止冒泡到 el-upload。 - `src/components/image-upload-field/main.vue` 用 `<el-image preview-src-list fit="contain" preview-teleported :z-index="3000" @click.stop>`,阻止冒泡到 el-upload。
-2
View File
@@ -13,8 +13,6 @@
<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
@@ -1,52 +0,0 @@
<!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>
+5 -2
View File
@@ -6,7 +6,8 @@
"prod": "vite --mode production", "prod": "vite --mode production",
"build": "vite build", "build": "vite build",
"build:prod": "vite build --mode production", "build:prod": "vite build --mode production",
"serve": "vite preview --host" "serve": "vite preview --host",
"typecheck": "vue-tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
@@ -46,9 +47,11 @@
"prettier": "^2.8.7", "prettier": "^2.8.7",
"sass": "^1.85.1", "sass": "^1.85.1",
"terser": "^5.31.1", "terser": "^5.31.1",
"typescript": "^7.0.2",
"unplugin-auto-import": "^0.11.2", "unplugin-auto-import": "^0.11.2",
"vite": "^5.4.19", "vite": "^5.4.19",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-vue-setup-extend": "^0.4.0" "vite-plugin-vue-setup-extend": "^0.4.0",
"vue-tsc": "^3.3.11"
} }
} }
-4259
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -58,3 +58,14 @@ export const changeStatus = (id, status) => {
}, },
}); });
}; };
export const getBfiExchangeRate = (currencyCode, effectdate) => {
return request({
url: '/blade-transport/bfi/exchange-rate',
method: 'get',
params: {
currencyCode,
effectdate,
},
});
};
-9
View File
@@ -79,15 +79,6 @@ 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,7 +16,6 @@ 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`,
+1 -1
View File
@@ -22,7 +22,7 @@ export const approve = data => request({ url: `${baseUrl}/approve`, method: 'pos
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data }); export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data }); export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
export const syncKingdee = id => export const syncKingdee = id =>
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } }); request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id }, timeout: 120000 });
export const invoiceTypeOptions = [ export const invoiceTypeOptions = [
{ label: '电子专票', value: 'electronic_special' }, { label: '电子专票', value: 'electronic_special' },
+19 -8
View File
@@ -5,8 +5,17 @@ const baseUrl = '/blade-transport/invoice-receipt';
export const getList = (current, size, params) => export const getList = (current, size, params) =>
request({ url: `${baseUrl}/list`, method: 'get', params: { current, size, ...params } }); request({ url: `${baseUrl}/list`, method: 'get', params: { current, size, ...params } });
export const getDetail = id => request({ url: `${baseUrl}/detail`, method: 'get', params: { id } }); export const getDetail = id => request({ url: `${baseUrl}/detail`, method: 'get', params: { id } });
export const getInvoicePool = keyword => export const queryInvoicePool = params =>
request({ url: `${baseUrl}/invoice-pool`, method: 'get', params: { keyword } }); request({ url: `${baseUrl}/invoice-pool`, method: 'get', params });
export const downloadInvoicePoolAttachment = invoiceNo =>
// 金蝶票池发票文件下载(后端代理 A801-2 流式回源),耗时较普通接口长,放宽到 120s
request({
url: `${baseUrl}/invoice-pool/attachment/download`,
method: 'get',
params: { invoiceNo },
responseType: 'blob',
timeout: 120000,
});
export const getSettlementCandidates = (keyword, receiptId) => export const getSettlementCandidates = (keyword, receiptId) =>
request({ request({
url: `${baseUrl}/settlement-candidates`, url: `${baseUrl}/settlement-candidates`,
@@ -25,8 +34,9 @@ export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post'
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data }); export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data }); export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data }); export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
export const syncKingdee = id => export const pushKingdee = ids =>
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } }); // 推送联带 A902 附件上传(登记附件 + 镜像发票文件下载回传),耗时较普通接口长,放宽到 120s
request({ url: `${baseUrl}/push-kingdee`, method: 'post', data: ids, timeout: 120000 });
export const approvalStatusOptions = [ export const approvalStatusOptions = [
{ label: '草稿', value: 'draft' }, { label: '草稿', value: 'draft' },
@@ -36,8 +46,9 @@ export const approvalStatusOptions = [
{ label: '已作废', value: 'voided' }, { label: '已作废', value: 'voided' },
]; ];
export const kingdeeStatusOptions = [ export const kingdeePushStatusOptions = [
{ label: '未同步', value: 'unsynced' }, { label: '未推送', value: 'unsynced' },
{ label: '已同步', value: 'synced' }, { label: '已保存收票单', value: 'pushed' },
{ label: '同步失败', value: 'failed' }, { label: '已指定应付', value: 'assigned' },
{ label: '推送失败', value: 'failed' },
]; ];
+10 -2
View File
@@ -16,10 +16,15 @@ export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post'
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data }); export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data }); export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data }); export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
// 同步金蝶涉及多次金蝶远程接口调用(A103-2 预检 + A103-1/A103-3 推送),单笔可达 20s+,覆盖全局 10s 超时
export const syncKingdee = id => export const syncKingdee = id =>
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } }); request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id }, timeout: 120000 });
// 批量同步逐单单据级事务串行推送,耗时随单量线性增长
export const syncKingdeeBatch = ids => export const syncKingdeeBatch = ids =>
request({ url: `${baseUrl}/sync-kingdee-batch`, method: 'post', data: ids }); request({ url: `${baseUrl}/sync-kingdee-batch`, method: 'post', data: ids, timeout: 300000 });
// 回写任务按 paymentNo 分批远程查询 A103-2/A103-4,同样可能超过全局超时
export const syncKingdeeResult = () =>
request({ url: `${baseUrl}/sync-kingdee-result`, method: 'post', timeout: 300000 });
export const paymentTypeOptions = [ export const paymentTypeOptions = [
{ label: '项目预付', value: 'project_advance' }, { label: '项目预付', value: 'project_advance' },
@@ -36,5 +41,8 @@ export const approvalStatusOptions = [
export const kingdeeStatusOptions = [ export const kingdeeStatusOptions = [
{ label: '未生成', value: 'unsynced' }, { label: '未生成', value: 'unsynced' },
{ label: '已生成', value: 'synced' }, { label: '已生成', value: 'synced' },
{ label: '付款中', value: 'paying' },
{ label: '已付款', value: 'paid' },
{ label: '已关闭', value: 'closed' },
{ label: '生成失败', value: 'failed' }, { label: '生成失败', value: 'failed' },
]; ];
+4 -1
View File
@@ -30,8 +30,9 @@ export const submit = data => request({ url: `${baseUrl}/submit`, method: 'post'
export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data }); export const approve = data => request({ url: `${baseUrl}/approve`, method: 'post', data });
export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data }); export const returnBill = data => request({ url: `${baseUrl}/return`, method: 'post', data });
export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data }); export const voidBill = data => request({ url: `${baseUrl}/void`, method: 'post', data });
// 同步金蝶涉及多次金蝶远程接口调用(A102-4 预检 + A102-2 保存),可达 20s+,覆盖全局 10s 超时
export const syncKingdee = id => export const syncKingdee = id =>
request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id } }); request({ url: `${baseUrl}/sync-kingdee`, method: 'post', params: { id }, timeout: 120000 });
export const getDetailFees = detailId => export const getDetailFees = detailId =>
request({ url: `${baseUrl}/detail-fees`, method: 'get', params: { detailId } }); request({ url: `${baseUrl}/detail-fees`, method: 'get', params: { detailId } });
export const getReceiptClaims = formalSettlementId => export const getReceiptClaims = formalSettlementId =>
@@ -48,3 +49,5 @@ export const applyPayments = data =>
request({ url: `${baseUrl}/apply-payments`, method: 'post', data }); request({ url: `${baseUrl}/apply-payments`, method: 'post', data });
export const claimInvoices = data => export const claimInvoices = data =>
request({ url: `${baseUrl}/claim-invoices`, method: 'post', data }); request({ url: `${baseUrl}/claim-invoices`, method: 'post', data });
export const queryInvoicePool = params =>
request({ url: `${baseUrl}/invoice-pool`, method: 'get', params });
-7
View File
@@ -41,13 +41,6 @@ export const add = row => {
}); });
}; };
export const syncIamOrganizations = () => {
return request({
url: '/blade-system/dept/sync-iam-organizations',
method: 'post',
});
};
export const update = row => { export const update = row => {
return request({ return request({
url: '/blade-system/dept/submit', url: '/blade-system/dept/submit',
-7
View File
@@ -31,13 +31,6 @@ export const add = row => {
}); });
}; };
export const syncIamAccounts = () => {
return request({
url: '/blade-system/user/sync-iam-accounts',
method: 'post',
});
};
export const update = row => { export const update = row => {
return request({ return request({
url: '/blade-system/user/update', url: '/blade-system/user/update',
+20
View File
@@ -113,6 +113,26 @@ export const getScoreTemplate = quantificationId => {
}); });
}; };
export const queryKingdeeCustomer = creditCode => {
return request({
url: '/blade-transport/bfi/customer/query-by-credit-code',
method: 'get',
params: {
creditCode,
},
});
};
export const syncKingdee = id => {
return request({
url: '/blade-transport/customer-archive/sync-kingdee',
method: 'post',
params: {
id,
},
});
};
export const recognizeBusinessLicenseOcr = imageUrl => { export const recognizeBusinessLicenseOcr = imageUrl => {
return request({ return request({
url: '/blade-transport/baidu-ocr/recognize-url', url: '/blade-transport/baidu-ocr/recognize-url',
+8
View File
@@ -223,6 +223,14 @@ axios.interceptors.response.use(
}, },
error => { error => {
NProgress.done(); NProgress.done();
// 网络级失败(HTTP 状态 >500、网关错误、超时、断网等 validateStatus 放行之外的响应)
// 原为静默 reject,接口报错页面无任何感知;统一补错误提示,取消请求与刷新令牌请求除外
if (!axios.isCancel(error) && !isRefreshTokenRequest(error?.config)) {
ElMessage({
message: error?.response?.data?.msg || '请求失败,请稍后重试',
type: 'error',
});
}
return Promise.reject(new Error(error)); return Promise.reject(new Error(error));
} }
); );
@@ -0,0 +1,380 @@
<template>
<el-dialog v-model="visible" :title="title" width="92%" append-to-body destroy-on-close @open="handleOpen">
<el-form :model="query" inline label-width="130px" @submit.prevent>
<el-form-item label="发票号码">
<el-input v-model="query.invoiceNo" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="开票日期">
<el-date-picker
v-model="query.invoiceDateRange"
type="daterange"
value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="销方(开票方税号)">
<el-input
v-model="query.salerTaxNo"
clearable
style="width: 180px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="购方(收票方税号)">
<el-input
v-model="query.buyerTaxNo"
clearable
style="width: 180px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="发票类型">
<el-select
v-model="query.invoiceType"
clearable
filterable
placeholder="不限"
style="width: 230px"
>
<el-option
v-for="option in invoiceTypeOptions"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button :disabled="loading" @click="resetQuery">重置</el-button>
<el-button type="primary" :disabled="loading" @click="handleQuery">查询</el-button>
</el-form-item>
</el-form>
<el-table
ref="poolTable"
v-loading="loading"
:data="rows"
:row-key="rowKey"
border
height="520"
:highlight-current-row="!multiple"
@selection-change="selection => (selected = selection)"
@row-dblclick="handleRowDblclick"
>
<el-table-column v-if="multiple" type="selection" width="52" fixed="left" align="center" reserve-selection />
<el-table-column v-else width="52" align="center" fixed="left">
<template #default="{ row }">
<el-radio
:model-value="current && current.invoiceNo"
:value="row.invoiceNo"
@change="current = row"
>
<span></span>
</el-radio>
</template>
</el-table-column>
<el-table-column prop="invoiceNo" label="发票号码" min-width="180" />
<el-table-column prop="invoiceDate" label="开票日期" min-width="120" />
<el-table-column prop="invoiceType" label="发票类型" min-width="140" />
<el-table-column prop="issuerName" label="开票单位" min-width="180" show-overflow-tooltip />
<el-table-column prop="receiverName" label="受票单位" min-width="180" show-overflow-tooltip />
<el-table-column label="金额(含税)" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.invoiceAmount) }}</template>
</el-table-column>
<el-table-column label="税率" min-width="90" align="center">
<template #default="{ row }">{{ formatRate(row.taxRate) }}</template>
</el-table-column>
<el-table-column label="税额" min-width="120" align="right">
<template #default="{ row }">{{ formatMoney(row.taxAmount) }}</template>
</el-table-column>
<el-table-column label="剩余可用金额" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.availableTaxAmount) }}</template>
</el-table-column>
<el-table-column prop="kingdeeBillNo" label="金蝶单据号" min-width="210" show-overflow-tooltip />
<el-table-column label="认领状态" min-width="100" align="center">
<template #default="{ row }">
<el-tag v-if="row.claimed" type="danger" size="small">已认领</el-tag>
<el-tag v-else type="info" size="small">未认领</el-tag>
</template>
</el-table-column>
<el-table-column label="登记状态" min-width="100" align="center">
<template #default="{ row }">
<el-tag v-if="row.registered" type="warning" size="small">已登记</el-tag>
<el-tag v-else type="info" size="small">未登记</el-tag>
</template>
</el-table-column>
<el-table-column label="附件" width="120" fixed="right" align="center">
<template #default="{ row }">
<el-link
type="primary"
:underline="false"
:disabled="attachmentBusy === row.invoiceNo"
@click.stop="viewAttachment(row)"
>查看</el-link
>
<el-link
type="primary"
:underline="false"
:disabled="attachmentBusy === row.invoiceNo"
@click.stop="downloadAttachment(row)"
>下载</el-link
>
</template>
</el-table-column>
<el-table-column v-if="!multiple" label="操作" width="90" fixed="right" align="center">
<template #default="{ row }">
<el-link type="primary" @click.stop="confirmRows([row])">选择</el-link>
</template>
</el-table-column>
</el-table>
<div class="kingdee-pool-dialog__pager">
<span class="kingdee-pool-dialog__pager-info">第 {{ page.current }} 页</span>
<el-button :disabled="page.current <= 1 || loading" @click="prevPage">上一页</el-button>
<el-button :disabled="!page.hasMore || loading" @click="nextPage">下一页</el-button>
<el-select v-model="page.size" style="width: 110px" @change="handleSizeChange">
<el-option v-for="n in [10, 20, 50, 100]" :key="n" :label="`${n}条/页`" :value="n" />
</el-select>
</div>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="handleConfirm">{{ confirmText }}</el-button>
</template>
</el-dialog>
</template>
<script>
import {
downloadKingdeeInvoiceFile,
isKingdeePathAttachment,
viewKingdeeInvoiceFile,
} from '@/utils/kingdee-attachment';
export default {
name: 'KingdeeInvoicePoolDialog',
props: {
modelValue: { type: Boolean, required: true },
title: { type: String, default: '查询金蝶票据池' },
confirmText: { type: String, default: '确定' },
multiple: { type: Boolean, default: false },
initialInvoiceNo: { type: String, default: '' },
queryApi: { type: Function, required: true },
},
emits: ['update:modelValue', 'confirm'],
data() {
return {
loading: false,
// 与后端 BfiConstant.INVOICE_TYPE_NAMES 对齐:value 为发票类型编码,label 为中文名
// 选票场景只开放数电票(普票/专票)
invoiceTypeOptions: [
{ value: '26', label: '数电发票(普通发票)' },
{ value: '27', label: '数电发票(增值税专用发票)' },
],
rows: [],
selected: [],
current: null,
page: { current: 1, size: 10, hasMore: false },
// 续扫游标(服务端过滤补页后翻页须按游标对齐,防漏行/重行)
nextCursor: null,
// 下一页请求待回传的游标:nextPage 时暂存,load 成功或失败后清空
pendingCursor: null,
// 已浏览页缓存:上一页直接回显不再请求(0 远程调用)
pageCache: {},
// 正在查看/下载附件的发票号(行级 loading 守卫)
attachmentBusy: null,
query: this.emptyQuery(),
};
},
computed: {
visible: {
get() {
return this.modelValue;
},
set(value) {
this.$emit('update:modelValue', value);
},
},
},
methods: {
emptyQuery() {
return {
invoiceNo: '',
// 默认查近一个月,随请求传后端并在页面回显
invoiceDateRange: [this.$dayjs().subtract(1, 'month').format('YYYY-MM-DD'), this.$dayjs().format('YYYY-MM-DD')],
salerTaxNo: '',
buyerTaxNo: '',
invoiceType: '',
};
},
// 远程实时查询的票未入本地镜像,id 恒空,用发票号码兜底作为行主键
rowKey(row) {
return row.invoiceNo || row.id;
},
// 票池行附件字段为复数 attachmentsJson,行内首项即发票文件({source,path,name})
rowAttachment(row = {}) {
const value = row.attachmentsJson;
if (!value) return null;
let parsed = value;
if (typeof value === 'string') {
try {
parsed = JSON.parse(value);
} catch {
return null;
}
}
return Array.isArray(parsed) ? parsed[0] || null : parsed || null;
},
attachmentName(row) {
const attachment = this.rowAttachment(row);
return attachment?.name || `${row.invoiceNo || '发票'}.pdf`;
},
async viewAttachment(row) {
const attachment = this.rowAttachment(row);
if (!isKingdeePathAttachment(attachment)) {
this.$message.warning('当前发票暂无可查看附件');
return;
}
this.attachmentBusy = row.invoiceNo;
try {
await viewKingdeeInvoiceFile(row.invoiceNo, this.attachmentName(row));
} finally {
this.attachmentBusy = null;
}
},
async downloadAttachment(row) {
const attachment = this.rowAttachment(row);
if (!isKingdeePathAttachment(attachment)) {
this.$message.warning('当前发票暂无可下载附件');
return;
}
this.attachmentBusy = row.invoiceNo;
try {
await downloadKingdeeInvoiceFile(row.invoiceNo, this.attachmentName(row));
} finally {
this.attachmentBusy = null;
}
},
handleOpen() {
this.query = this.emptyQuery();
this.query.invoiceNo = this.initialInvoiceNo || '';
this.current = null;
this.selected = [];
this.$refs.poolTable?.clearSelection();
this.page.current = 1;
this.resetScanState();
this.load();
},
handleQuery() {
this.page.current = 1;
this.resetScanState();
this.load();
},
handleSizeChange() {
this.page.current = 1;
this.resetScanState();
this.load();
},
prevPage() {
// 已浏览页直接回显缓存,不再请求
const cached = this.pageCache[this.page.current - 1];
if (cached) {
this.page.current -= 1;
this.rows = cached.rows;
this.page.hasMore = cached.hasMore;
this.nextCursor = cached.nextCursor;
return;
}
this.page.current -= 1;
this.load();
},
nextPage() {
this.pendingCursor = this.nextCursor;
this.page.current += 1;
this.load();
},
resetQuery() {
this.query = this.emptyQuery();
this.handleQuery();
},
// 新查询/换页容量/重新打开时清空游标与已浏览页缓存,重新锚定扫描
resetScanState() {
this.nextCursor = null;
this.pendingCursor = null;
this.pageCache = {};
},
unwrap(response) {
const body = response?.data || response || {};
return body?.data || body;
},
async load() {
this.loading = true;
// 请求前快照页码:prev/next 会先改写 current,远程失败时回滚避免停留在错页
const lastRequested = this.page.current;
const cursor = this.pendingCursor;
this.pendingCursor = null;
try {
const range = this.query.invoiceDateRange || [];
const data = this.unwrap(
await this.queryApi({
current: this.page.current,
size: this.page.size,
cursor: cursor || undefined,
invoiceNo: this.query.invoiceNo || undefined,
invoiceDateStart: range[0] || undefined,
invoiceDateEnd: range[1] || undefined,
salerTaxNo: this.query.salerTaxNo || undefined,
buyerTaxNo: this.query.buyerTaxNo || undefined,
invoiceType: this.query.invoiceType || undefined,
})
);
this.rows = data.records || [];
this.page.hasMore = !!data.hasMore;
this.nextCursor = data.nextCursor || null;
this.pageCache[this.page.current] = { rows: this.rows, hasMore: this.page.hasMore, nextCursor: this.nextCursor };
} catch (error) {
if (this.page.current !== lastRequested) {
this.page.current = lastRequested;
}
throw error;
} finally {
this.loading = false;
}
},
handleRowDblclick(row) {
if (!this.multiple) {
this.confirmRows([row]);
}
},
handleConfirm() {
const picked = this.multiple ? this.selected : this.current ? [this.current] : [];
this.confirmRows(picked);
},
confirmRows(rows) {
if (!rows.length) {
this.$message.warning(this.multiple ? '请至少选择一条发票' : '请选择一张发票');
return;
}
this.$emit('confirm', rows);
this.visible = false;
},
formatMoney(value) {
const number = Number(value);
return Number.isFinite(number) ? number.toFixed(2) : '-';
},
formatRate(value) {
const number = Number(value);
return Number.isFinite(number) ? `${number}%` : '-';
},
},
};
</script>
<style lang="scss" scoped>
.kingdee-pool-dialog__pager {
display: flex;
align-items: center;
gap: 12px;
justify-content: flex-end;
margin-top: 12px;
}
</style>
-1
View File
@@ -1,7 +1,6 @@
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
@@ -1,19 +0,0 @@
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,12 +1,8 @@
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,5 +1,4 @@
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/';
@@ -47,7 +46,6 @@ 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);
+16 -18
View File
@@ -55,8 +55,8 @@ export const config = {
'templateType', 'templateType',
'transportType', 'transportType',
'createUserName', 'createUserName',
'updateTime',
'remark', 'remark',
'updateTime',
'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: 'updateTime', label: '更新时间' },
{ prop: 'remark', label: '备注' }, { prop: 'remark', label: '备注' },
{ prop: 'updateTime', label: '更新时间' },
{ prop: 'createTime', label: '创建时间' }, { prop: 'createTime', label: '创建时间' },
], ],
enableAllDept: false, enableAllDept: false,
@@ -82,14 +82,12 @@ export const config = {
detailAttachmentDescriptionPlain: true, detailAttachmentDescriptionPlain: true,
enableTransportPlanForm: true, enableTransportPlanForm: true,
enableShippingTemplateFreight: true, enableShippingTemplateFreight: true,
editableRoadAddress: false, editableRoadAddress: true,
fixedTransportAddressType: true, fixedTransportAddressType: true,
enableTemplateCodePreview: true, enableTemplateCodePreview: true,
attachmentTitle: '附件', attachmentTitle: '附件',
defaultForm: { defaultForm: {
templateType: '运输计划', templateType: '运输计划',
transportType: '公路运输',
transportTypeName: '公路运输',
}, },
transportFormRequiredFields: [ transportFormRequiredFields: [
['projectName', '项目'], ['projectName', '项目'],
@@ -121,16 +119,15 @@ export const option = {
labelWidth: 0, labelWidth: 0,
}, },
{ {
label: '模板类型', label: '模板编号',
prop: 'templateType', prop: 'templateCode',
type: 'select',
search: true, search: true,
searchOrder: 2, searchOrder: 4,
span: 8, span: 8,
order: 390, order: 390,
dicData: templateTypeOptions, minWidth: 170,
minWidth: 120, disabled: true,
rules: selectRule('模板类型'), placeholder: '系统自动生成',
display: true, display: true,
}, },
{ {
@@ -145,15 +142,16 @@ export const option = {
display: true, display: true,
}, },
{ {
label: '模板编号', label: '模板类型',
prop: 'templateCode', prop: 'templateType',
type: 'select',
search: true, search: true,
searchOrder: 4, searchOrder: 2,
span: 8, span: 8,
order: 370, order: 370,
minWidth: 170, dicData: templateTypeOptions,
disabled: true, minWidth: 120,
placeholder: '系统自动生成', rules: selectRule('模板类型'),
display: true, display: true,
}, },
{ {
+4 -6
View File
@@ -209,12 +209,12 @@ export const config = {
attachmentTitle: '附件', attachmentTitle: '附件',
searchRangeMap: { searchRangeMap: {
planStartDateRange: ['planStartDateStart', 'planStartDateEnd'], planStartDateRange: ['planStartDateStart', 'planStartDateEnd'],
createTimeRange: ['createTimeStart', 'createTimeEnd', '00:00:00', '23:59:59'], planEndDateRange: ['planEndDateStart', 'planEndDateEnd'],
}, },
actions: ['copy', 'complete'], actions: ['copy', 'complete'],
statusProp: 'businessStatus', statusProp: 'businessStatus',
statusTextProp: 'businessStatusName', statusTextProp: 'businessStatusName',
deleteStatus: ['draft'], deleteStatus: ['draft', 'waiting_dispatch'],
editStatus: ['draft', 'waiting_dispatch', 'dispatching'], editStatus: ['draft', 'waiting_dispatch', 'dispatching'],
detailButton: true, detailButton: true,
detailSections: [ detailSections: [
@@ -341,7 +341,6 @@ export const option = {
{ {
label: '发货地址', label: '发货地址',
prop: 'departureAddress', prop: 'departureAddress',
slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchOrder: 7, searchOrder: 7,
@@ -353,7 +352,6 @@ export const option = {
{ {
label: '到货地址', label: '到货地址',
prop: 'arrivalAddress', prop: 'arrivalAddress',
slot: true,
formslot: true, formslot: true,
search: true, search: true,
searchOrder: 6, searchOrder: 6,
@@ -579,8 +577,8 @@ export const option = {
viewDisplay: false, viewDisplay: false,
}, },
{ {
label: '创建时间', label: '计划结束日期',
prop: 'createTimeRange', prop: 'planEndDateRange',
type: 'date', type: 'date',
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
+1
View File
@@ -13,6 +13,7 @@ export const invoiceApplicationTableColumns = [
{ prop: 'currentProcessor', label: '当前处理人', minWidth: 130 }, { prop: 'currentProcessor', label: '当前处理人', minWidth: 130 },
{ prop: 'kingdeeBillNo', label: '金蝶单据号', minWidth: 150 }, { prop: 'kingdeeBillNo', label: '金蝶单据号', minWidth: 150 },
{ prop: 'kingdeeStatusName', label: '金蝶单据状态', minWidth: 140 }, { prop: 'kingdeeStatusName', label: '金蝶单据状态', minWidth: 140 },
{ prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 },
]; ];
export const invoiceApplicationDetailColumns = [ export const invoiceApplicationDetailColumns = [
+4 -2
View File
@@ -11,6 +11,8 @@ export const invoiceReceiptTableColumns = [
{ prop: 'currentProcessor', label: '当前处理人', minWidth: 130 }, { prop: 'currentProcessor', label: '当前处理人', minWidth: 130 },
{ prop: 'createUserName', label: '创建人', minWidth: 110 }, { prop: 'createUserName', label: '创建人', minWidth: 110 },
{ prop: 'createTime', label: '创建时间', minWidth: 170 }, { prop: 'createTime', label: '创建时间', minWidth: 170 },
{ prop: 'kingdeeBillNo', label: '金蝶单据号', minWidth: 150 }, { prop: 'kingdeeReceivedInvoiceNo', label: '金蝶单据号', minWidth: 150 },
{ prop: 'kingdeeStatusName', label: '金蝶单据状态', minWidth: 140 }, { prop: 'kingdeePushStatusName', label: '金蝶状态', minWidth: 130 },
{ prop: 'kingdeePushMsg', label: '失败原因', minWidth: 160 },
{ prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 },
]; ];
+1
View File
@@ -17,4 +17,5 @@ export const paymentApplicationTableColumns = [
{ prop: 'currentProcessor', label: '当前处理人', minWidth: 120 }, { prop: 'currentProcessor', label: '当前处理人', minWidth: 120 },
{ prop: 'kingdeeBillNo', label: '金蝶单据号', minWidth: 130 }, { prop: 'kingdeeBillNo', label: '金蝶单据号', minWidth: 130 },
{ prop: 'kingdeeStatusName', label: '金蝶单据状态', minWidth: 130 }, { prop: 'kingdeeStatusName', label: '金蝶单据状态', minWidth: 130 },
{ prop: 'attachmentSyncStatusName', label: '附件同步', minWidth: 100 },
]; ];
@@ -21,6 +21,7 @@ export const formalSettlementTableColumns = [
{ label: '当前处理人', prop: 'currentProcessor', minWidth: 130 }, { label: '当前处理人', prop: 'currentProcessor', minWidth: 130 },
{ label: '金蝶单据号', prop: 'kingdeeBillNo', minWidth: 150 }, { label: '金蝶单据号', prop: 'kingdeeBillNo', minWidth: 150 },
{ label: '金蝶单据状态', prop: 'kingdeeSyncStatus', minWidth: 135 }, { label: '金蝶单据状态', prop: 'kingdeeSyncStatus', minWidth: 135 },
{ label: '附件同步', prop: 'attachmentSyncStatusName', minWidth: 100 },
{ label: '创建人', prop: 'createUserName', minWidth: 110 }, { label: '创建人', prop: 'createUserName', minWidth: 110 },
{ label: '创建时间', prop: 'createTime', minWidth: 170 }, { label: '创建时间', prop: 'createTime', minWidth: 170 },
]; ];
@@ -88,6 +88,8 @@ export const updateFeeFormFields = [
]; ];
export const transferSearchFields = [ export const transferSearchFields = [
{ label: '单据号', prop: 'documentNo', type: 'input' },
{ label: '合同编码', prop: 'contractNo', type: 'input' },
{ label: '合同名称', prop: 'contractName', type: 'input' }, { label: '合同名称', prop: 'contractName', type: 'input' },
{ label: '批次号', prop: 'batchNo', type: 'input' }, { label: '批次号', prop: 'batchNo', type: 'input' },
{ label: '生成日期', prop: 'generateDateRange', type: 'daterange' }, { label: '生成日期', prop: 'generateDateRange', type: 'daterange' },
+1 -12
View File
@@ -1,18 +1,7 @@
<template> <template>
<router-view #="{ Component }"> <router-view #="{ Component }">
<keep-alive :include="$store.getters.tagsKeep"> <keep-alive :include="$store.getters.tagsKeep">
<component :is="tabView($route, Component)" /> <component :is="Component" />
</keep-alive> </keep-alive>
</router-view> </router-view>
</template> </template>
<script>
import { tabView } from '@/router/tab';
export default {
name: 'layout',
methods: {
tabView,
},
};
</script>
+10 -13
View File
@@ -3,8 +3,6 @@ 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,
@@ -19,20 +17,19 @@ 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;
@@ -62,7 +59,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, keepAlive: true }, meta: meta,
}); });
} }
next(); next();
+10 -13
View File
@@ -2,7 +2,6 @@ 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';
const modules = import.meta.glob('../**/**/*.vue'); const modules = import.meta.glob('../**/**/*.vue');
// 将多级路由扁平化为二级路由,支持 keep-alive 跨层级缓存 // 将多级路由扁平化为二级路由,支持 keep-alive 跨层级缓存
@@ -97,23 +96,21 @@ RouterPlugin.install = function (option = {}) {
component: (() => { component: (() => {
// 判断是否为首路由 // 判断是否为首路由
if (first) { if (first) {
return wrapViewLoader( return modules[
modules[ option.store.getters.isMacOs || !website.setting.menu
option.store.getters.isMacOs || !website.setting.menu ? '../page/index/layout.vue'
? '../page/index/layout.vue' : '../page/index/index.vue'
: '../page/index/index.vue' ];
]
);
// 判断是否为多层路由 // 判断是否为多层路由
} else if (isChild && !first) { } else if (isChild && !first) {
return wrapViewLoader(modules['../page/index/layout.vue']); return 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 wrapViewLoader(result); return result;
} }
})(), })(),
name, name,
@@ -130,7 +127,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 = wrapViewLoader(modules[`../${componentPath}.vue`]); let result = modules[`../${componentPath}.vue`];
if (!result) { if (!result) {
isComponent = false; isComponent = false;
} }
@@ -176,7 +173,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: true, keepAlive: ele.isOpen === 2,
}; };
const iframeComponent = 'components/iframe/main'; const iframeComponent = 'components/iframe/main';
const iframeSrc = href => { const iframeSrc = href => {
@@ -218,7 +215,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: true, keepAlive: child.isOpen === 2,
}; };
if (isURL(child[propsDefault.href])) { if (isURL(child[propsDefault.href])) {
let href = child[propsDefault.href]; let href = child[propsDefault.href];
+1 -1
View File
@@ -128,5 +128,5 @@ export function tabView(route, Component) {
}; };
wrapperMap.set(tabKey, wrapper); wrapperMap.set(tabKey, wrapper);
} }
return wrapper; return h(wrapper);
} }
-12
View File
@@ -299,18 +299,6 @@ export default [
}, },
], ],
}, },
{
path: '/business/contract-manage/detail',
component: Layout,
children: [
{
path: '',
name: '合同详情',
meta: { keepAlive: false, activeMenu: '/business/contract-manage' },
component: () => import('@/views/business/contract-manage.vue'),
},
],
},
{ {
path: '/business/contract-manage/change', path: '/business/contract-manage/change',
component: Layout, component: Layout,
+5 -2
View File
@@ -16,8 +16,11 @@ 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) => {
// 所有已打开标签均纳入 keep-alive,关闭标签后自动从白名单移除并释放实例 return getters.tagList
return getters.tagList.map(ele => ele.fullPath).filter(Boolean); .filter(ele => {
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,
+7 -137
View File
@@ -1,168 +1,38 @@
/** /**
* 懒加载 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_QUERY = '_chunkreload'; const RELOAD_COOLDOWN_MS = 10000;
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|Unable to preload|error loading module|Load failed/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/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) {
const text = collectErrorText(error); if (!error) return false;
if (!text) return false; const message = error.message || String(error);
if (CHUNK_ERROR_RE.test(text)) return true; return CHUNK_ERROR_RE.test(message);
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 = const path = targetPath || pendingFullPath || window.location.pathname + window.location.search + window.location.hash;
targetPath || window.location.assign(path);
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(() => {});
}
+90
View File
@@ -0,0 +1,90 @@
/**
* 金蝶侧发票附件查看/下载公共工具
*
* 票池发票附件为 {source:'piaozone', path, name}:path 是金蝶侧文件 id(非 http 直链),
* 须由后端代理 A801-2 流式回源;OSS 直链附件(url/link/fileUrl)仍由前端直连下载/预览。
* 三处入口共用:票池弹窗、正式结算认领发票行、付款申请发票附件行。
*/
import { ElMessage } from 'element-plus';
import { downloadFile } from '@/utils/util';
import { downloadInvoicePoolAttachment } from '@/api/payment/invoiceReceipt';
/**
* 金蝶侧附件判定:source=piaozone,或有 path 且非 http(s) 直链
* @param {Object|Null} attachment 附件对象(attachmentsJson/attachmentJson 行内首项)
* @returns {Boolean}
*/
export const isKingdeePathAttachment = attachment => {
if (!attachment) return false;
if (attachment.source === 'piaozone') return true;
return Boolean(attachment.path) && !/^https?:\/\//i.test(attachment.path);
};
/**
* 请求金蝶文件流:成功返回 Blob;业务失败为 HTTP 200 + R.fail JSON(响应通道未写流时后端即失败),
* 按 Content-Type 识别并抛出带 msg 的错误;网络级失败拦截器已提示,标记 silent 避免重复提示
* @param {String} invoiceNo 发票号码
* @returns {Promise<Blob>}
*/
const requestKingdeeFile = async invoiceNo => {
let res;
try {
res = await downloadInvoicePoolAttachment(invoiceNo);
} catch (error) {
throw Object.assign(new Error(error?.message || '附件下载失败'), { silent: true });
}
const blob = res?.data;
if (!(blob instanceof Blob)) {
throw new Error('响应不是文件流');
}
if (blob.type && blob.type.includes('application/json')) {
let message = '附件下载失败';
try {
const parsed = JSON.parse(await blob.text());
message = parsed.msg || parsed.message || message;
} catch {
// 错误体非 JSON 时按默认提示
}
throw new Error(message);
}
return blob;
};
/**
* 下载金蝶侧发票附件(经 A801-2 后端代理),失败统一 ElMessage 提示
* @param {String} invoiceNo 发票号码
* @param {String} fileName 下载文件名(缺省按 发票号.pdf)
*/
export const downloadKingdeeInvoiceFile = async (invoiceNo, fileName) => {
if (!invoiceNo) {
ElMessage.warning('当前发票缺少发票号码,无法下载金蝶侧附件');
return;
}
try {
const blob = await requestKingdeeFile(invoiceNo);
downloadFile(blob, fileName || `${invoiceNo}.pdf`);
} catch (error) {
if (!error?.silent) ElMessage.error(error?.message || '金蝶附件下载失败');
}
};
/**
* 新窗口预览金蝶侧发票附件:拉取 Blob 转 objectURL(PDF 可预览;OFD 等浏览器不可预览的格式由浏览器触发下载)
* @param {String} invoiceNo 发票号码
* @param {String} fileName 预览文件名(缺省按 发票号.pdf)
*/
export const viewKingdeeInvoiceFile = async (invoiceNo, fileName) => {
if (!invoiceNo) {
ElMessage.warning('当前发票缺少发票号码,无法预览金蝶侧附件');
return;
}
try {
const blob = await requestKingdeeFile(invoiceNo);
const url = URL.createObjectURL(blob);
window.open(url, '_blank');
// 延迟释放 objectURL:立即回收可能导致新窗口尚未加载完成即失效
setTimeout(() => URL.revokeObjectURL(url), 60000);
} catch (error) {
if (!error?.silent) ElMessage.error(error?.message || '金蝶附件预览失败');
}
};
@@ -1,51 +1,8 @@
<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></div> <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>
<dl class="detail-meta"> <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>
<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>
@@ -85,8 +42,6 @@
<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';
@@ -96,26 +51,10 @@ 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() {
@@ -209,68 +148,6 @@ 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 || '-'; },
@@ -284,7 +161,7 @@ export default {
.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 { 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; } }
.transport-flow-tag { margin-left: 8px; } .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; } } .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; } }
.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,51 +95,10 @@
<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" <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>
><template #header <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>
><span>货物类型<span class="goods-required-mark">*</span></span></template <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>
><template #default="{ row }" <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-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" />
@@ -249,7 +208,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, quantityUnitOptions: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] }; 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: ['吨', '千克', '立方米', '件', '车', '箱', '托盘'] };
}, },
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); },
@@ -257,9 +216,6 @@ 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) => {
@@ -300,6 +256,7 @@ export default {
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; }
}, },
@@ -361,42 +318,46 @@ 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 = {}) {
const cargoType = String(row.cargoType || '').trim(); return this.masterGoods.filter(item => !row.cargoType || item.cargoType === row.cargoType);
if (!cargoType) return this.masterGoods;
const matched = this.masterGoods.filter(item => item.cargoType === cargoType);
return matched.length ? matched : this.masterGoods;
}, },
fetchCargoTypeSuggestions(queryString, callback) { findCargoTypeByPath(path = []) {
const keyword = String(queryString || '').trim().toLowerCase(); let options = this.cargoTypeOptions;
const options = this.cargoTypeSelectOptions.map(item => ({ value: item })); let selected;
callback( (path || []).forEach(id => {
keyword ? options.filter(item => String(item.value).toLowerCase().includes(keyword)) : options selected = (options || []).find(item => String(item.id) === String(id));
); options = selected?.children || [];
});
return selected;
}, },
handleCargoTypeSelect(route, row, item = {}) { findCargoTypePath(cargoType, options = this.cargoTypeOptions, parentPath = []) {
this.handleCargoTypeChange(route, row, item.value || ''); for (const option of options || []) {
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) {
row.cargoType = String(value ?? row.cargoType ?? '').trim(); const path = Array.isArray(value) ? value : [];
const matched = this.masterGoods.filter(item => item.cargoType === row.cargoType); const cargoType = this.findCargoTypeByPath(path);
const firstGoods = matched[0]; row.cargoTypePath = path;
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) {
@@ -581,47 +542,52 @@ 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('.');
row.dispatchQuantity = const nextValue = decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer;
decimal || String(value || '').includes('.') ? `${integer}.${decimal.slice(0, 3)}` : integer; const availableQuantity = this.availableDispatchQuantity(route, row);
this.syncFreightItems(route); if (Number(nextValue || 0) > availableQuantity) {
}, row.dispatchQuantity = this.formatQuantity(availableQuantity);
validatePendingTotals() { this.syncFreightItems(route);
for (const route of this.routes) { this.$message.warning('本次数量不能超过剩余数量');
const items = this.pending.filter(item => this.isSameRouteSegment(route, item)); return;
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; row.dispatchQuantity = nextValue;
this.syncFreightItems(route);
}, },
handleFreightUnitPriceInput(item, value) { handleFreightUnitPriceInput(item, value) {
const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.'); const [integer = '', decimal = ''] = String(value || '').replace(/[^\d.]/g, '').split('.');
@@ -652,7 +618,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(), '货物类型'], [!String(item.cargoType || '').trim() && !(item.cargoTypePath || []).length, '货物类型'],
[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(), '数量单位'],
]; ];
@@ -684,6 +650,7 @@ export default {
return { return {
...goods, ...goods,
sourceIndex, sourceIndex,
cargoTypePath: this.findCargoTypePath(goods.cargoType),
dispatchQuantity: undefined, dispatchQuantity: undefined,
}; };
}, },
@@ -699,8 +666,7 @@ 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;
const cargoType = String(row.cargoType || '').trim() || source.cargoType; Object.assign(row, this.createGoodsRow(source, Number(row.sourceIndex)));
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); },
@@ -888,6 +854,8 @@ 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;
@@ -986,7 +954,6 @@ 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; }
}, },
@@ -1018,7 +985,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__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-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-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,9 +146,8 @@
/> />
<el-input <el-input
v-model="form.departureAddress" v-model="form.departureAddress"
class="shipping-template-page__address-map-input" placeholder="请输入发货地址"
readonly :readonly="transportStationMode || !config.editableRoadAddress"
placeholder="请选择发货地址"
:disabled="transportAddressSelectDisabled" :disabled="transportAddressSelectDisabled"
@click="handleTransportSecondaryAddressInputClick('departure')" @click="handleTransportSecondaryAddressInputClick('departure')"
> >
@@ -190,9 +189,8 @@
/> />
<el-input <el-input
v-model="form.arrivalAddress" v-model="form.arrivalAddress"
class="shipping-template-page__address-map-input" placeholder="请输入收货地址"
readonly :readonly="transportStationMode || !config.editableRoadAddress"
placeholder="请选择收货地址"
:disabled="transportAddressSelectDisabled" :disabled="transportAddressSelectDisabled"
@click="handleTransportSecondaryAddressInputClick('arrival')" @click="handleTransportSecondaryAddressInputClick('arrival')"
> >
@@ -1133,7 +1131,7 @@ const defaultCargo = () => ({
cargoTypePath: [], cargoTypePath: [],
packageType: '', packageType: '',
quantity: '', quantity: '',
quantityUnit: '吨', quantityUnit: '',
brand: '', brand: '',
specification: '', specification: '',
model: '', model: '',
@@ -1260,7 +1258,6 @@ export default {
crudDialogType: '', crudDialogType: '',
standaloneFormKey: '', standaloneFormKey: '',
copyingRow: null, copyingRow: null,
suppressTransportTypeClear: false,
detailBox: false, detailBox: false,
detailLoading: false, detailLoading: false,
detailRow: {}, detailRow: {},
@@ -1514,10 +1511,10 @@ export default {
}, },
}, },
'form.transportType'(value, oldValue) { 'form.transportType'(value, oldValue) {
if (this.suppressTransportTypeClear) return; if (value !== oldValue) {
if (String(value ?? '') === String(oldValue ?? '')) return; this.handleTransportTypeChange(value);
this.handleTransportTypeChange(value); this.syncFreightItems();
this.syncFreightItems(); }
}, },
}, },
created() { created() {
@@ -1530,20 +1527,6 @@ 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 &&
@@ -1807,7 +1790,6 @@ 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);
// 删除模板编号,等待系统生成 // 删除模板编号,等待系统生成
@@ -1860,11 +1842,7 @@ 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)
@@ -1946,6 +1924,14 @@ 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;
@@ -2027,8 +2013,6 @@ 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);
@@ -2302,60 +2286,13 @@ 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.transportAddressSelectDisabled) return; if (this.transportStationMode || !this.config.editableRoadAddress)
this.openTransportSecondaryAddressPicker(target); this.openTransportSecondaryAddressPicker(target);
}, },
openTransportSecondaryAddressPicker(target) { openTransportSecondaryAddressPicker(target) {
this.transportStationMode this.transportStationMode
@@ -3391,13 +3328,6 @@ 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,23 +85,15 @@
</template> </template>
<template #departureAddress="{ row }"> <template #departureAddress="{ row }">
<el-tooltip <el-tooltip v-if="row.departureAddress" :content="row.departureAddress" placement="top">
v-if="row.departureAddress || row.departureName" <span>{{ formatTransportPlanProvinceCityDistrict(row.departureAddress) }}</span>
: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 <el-tooltip v-if="row.arrivalAddress" :content="row.arrivalAddress" placement="top">
v-if="row.arrivalAddress || row.arrivalName" <span>{{ formatTransportPlanProvinceCityDistrict(row.arrivalAddress) }}</span>
: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>
@@ -582,7 +574,7 @@
> >
<el-link <el-link
type="primary" type="primary"
v-if="showViewButton(row)" v-if="hasPermission(`${config.permission}_view`) && !showDetailButton(row)"
@click="$refs.crud.rowView(row, index)" @click="$refs.crud.rowView(row, index)"
> >
查看 查看
@@ -1500,38 +1492,27 @@
<el-input <el-input
v-model="dispatchItemForm.departureName" v-model="dispatchItemForm.departureName"
:placeholder="dispatchStationNamePlaceholder" :placeholder="dispatchStationNamePlaceholder"
:readonly="dispatchStationMode" :suffix-icon="dispatchStationMode ? Search : undefined"
@click="openDispatchPrimaryAddressPicker('departure')" disabled
> />
<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"
:readonly="dispatchStationMode" disabled
@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="请输入" /> <el-input v-model="dispatchItemForm.departureContact" placeholder="请输入" disabled />
<span class="transport-plan-page__route-label">联系方式</span> <span class="transport-plan-page__route-label">联系方式</span>
<el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" /> <el-input v-model="dispatchItemForm.departurePhone" placeholder="请输入" disabled />
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="收货地址" required> <el-form-item label="收货地址" required>
@@ -1539,38 +1520,27 @@
<el-input <el-input
v-model="dispatchItemForm.arrivalName" v-model="dispatchItemForm.arrivalName"
:placeholder="dispatchStationNamePlaceholder" :placeholder="dispatchStationNamePlaceholder"
:readonly="dispatchStationMode" :suffix-icon="dispatchStationMode ? Search : undefined"
@click="openDispatchPrimaryAddressPicker('arrival')" disabled
> />
<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"
:readonly="dispatchStationMode" disabled
@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="请输入" /> <el-input v-model="dispatchItemForm.arrivalContact" placeholder="请输入" disabled />
<span class="transport-plan-page__route-label">联系方式</span> <span class="transport-plan-page__route-label">联系方式</span>
<el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" /> <el-input v-model="dispatchItemForm.arrivalPhone" placeholder="请输入" disabled />
</div> </div>
</el-form-item> </el-form-item>
</div> </div>
@@ -1606,15 +1576,20 @@
><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-autocomplete <el-select
v-model="row.cargoType" v-model="row.cargoType"
placeholder="请输入货物类型" placeholder="请选择货物类型"
clearable clearable
:debounce="300" filterable
: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">
@@ -1622,18 +1597,20 @@
><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-autocomplete <el-select
v-model="row.cargoName" v-model="row.cargoName"
placeholder="请输入货物名称" placeholder="请选择货物名称"
clearable clearable
:debounce="300" filterable
: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">
@@ -1650,11 +1627,7 @@
</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">
@@ -1875,33 +1848,36 @@
<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-autocomplete <el-select
v-model="dispatchItemForm.cargoType" v-model="dispatchItemForm.cargoType"
placeholder="请输入货物类型" placeholder="请选择货物类型"
clearable clearable
:debounce="300" filterable
:fetch-suggestions="fetchDispatchConfiguredCargoTypeSuggestions" @change="handleDispatchConfiguredCargoTypeChange(dispatchItemForm, $event)"
@select="item => handleDispatchConfiguredCargoTypeSelect(dispatchItemForm, item)" >
@change="value => handleDispatchConfiguredCargoTypeChange(dispatchItemForm, value)" <el-option
/> 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-autocomplete <el-select
v-model="dispatchItemForm.cargoName" v-model="dispatchItemForm.cargoName"
placeholder="请输入货物名称" placeholder="请选择货物名称"
clearable clearable
:debounce="300" filterable
:fetch-suggestions=" @change="handleDispatchConfiguredCargoNameChange(dispatchItemForm, $event)"
(queryString, callback) => >
fetchDispatchConfiguredCargoNameSuggestions( <el-option
queryString, v-for="item in getDispatchConfiguredCargoNameOptions(dispatchItemForm)"
callback, :key="item.value"
dispatchItemForm :label="item.label"
) :value="item.value"
" />
@select="item => handleDispatchConfiguredCargoNameSelect(dispatchItemForm, item)" </el-select>
@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="请输入" />
@@ -1926,10 +1902,7 @@
</el-select> </el-select>
</template> </template>
</el-input> </el-input>
<div <div class="transport-plan-page__dispatch-quantity-hint">
v-if="!isDispatchPlanQuantityUnlimited(dispatchItemForm)"
class="transport-plan-page__dispatch-quantity-hint"
>
剩余数量:{{ 剩余数量:{{
formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm)) formatDispatchQuantity(dispatchItemRemainingQuantity(dispatchItemForm))
}} }}
@@ -3439,21 +3412,15 @@ export default {
})); }));
}, },
dispatchHasAddableQuantity() { dispatchHasAddableQuantity() {
const items = this.dispatchTableQuantityItems; return this.dispatchTableQuantityItems.some(
if (!items.length) return true; item => item.total > 0 && item.listed < item.total - 1e-8
// 计划总量为 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')}`;
@@ -3639,13 +3606,12 @@ 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[mode] || ''; return labelMap[this.transportMode] || '';
}, },
transportStationNamePlaceholder() { transportStationNamePlaceholder() {
if (!this.transportStationMode) return '行政区划自动带出'; if (!this.transportStationMode) return '行政区划自动带出';
@@ -3832,37 +3798,6 @@ 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 '-';
@@ -4020,11 +3955,6 @@ 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);
@@ -4610,37 +4540,6 @@ 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';
@@ -5339,13 +5238,6 @@ 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;
} }
@@ -5422,21 +5314,19 @@ export default {
}, },
openTransportStationDialog(target) { openTransportStationDialog(target) {
if (!this.ensureTransportTypeBeforeAddress()) return; if (!this.ensureTransportTypeBeforeAddress()) return;
const stationMode = this.dispatchItemBox ? this.dispatchStationMode : this.transportStationMode; if (!this.transportStationMode) return;
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[mode]; return requestMap[this.transportMode];
}, },
loadTransportStationList() { loadTransportStationList() {
const request = this.getTransportStationListRequest(); const request = this.getTransportStationListRequest();
@@ -5546,28 +5436,7 @@ export default {
water: '港口/码头', water: '港口/码头',
air: '空港机场', air: '空港机场',
}; };
const mode = this.dispatchItemBox ? this.dispatchTransportMode : this.transportMode; return typeMap[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;
@@ -5618,39 +5487,35 @@ export default {
}, },
applyTransportAddress(target, address = {}) { applyTransportAddress(target, address = {}) {
const prefix = target === 'departure' ? 'departure' : 'arrival'; const prefix = target === 'departure' ? 'departure' : 'arrival';
const addressForm = this.getTransportAddressForm(); this.form[`${prefix}Name`] = address.preferRegionName
addressForm[`${prefix}Name`] = address.preferRegionName
? address.regionName || address.addressName || '' ? address.regionName || address.addressName || ''
: address.addressName || address.regionName || ''; : address.addressName || address.regionName || '';
addressForm[`${prefix}Address`] = address.detailAddress || address.address || ''; this.form[`${prefix}Address`] = address.detailAddress || address.address || '';
addressForm[`${prefix}AddressCode`] = address.addressCode || ''; this.form[`${prefix}AddressCode`] = address.addressCode || '';
addressForm[`${prefix}SiteCode`] = this.form[`${prefix}SiteCode`] =
address.addressType === '常规地址' address.addressType === '常规地址'
? '/' ? '/'
: address.siteCodeDisplay || address.siteCode || ''; : address.siteCodeDisplay || address.siteCode || '';
addressForm[`${prefix}Longitude`] = address.longitude || ''; this.form[`${prefix}Longitude`] = address.longitude || '';
addressForm[`${prefix}Latitude`] = address.latitude || ''; this.form[`${prefix}Latitude`] = address.latitude || '';
addressForm[`${prefix}Contact`] = this.form[`${prefix}Contact`] = address.contactName || this.form[`${prefix}Contact`] || '';
address.contactName || addressForm[`${prefix}Contact`] || ''; this.form[`${prefix}Phone`] = address.contactPhone || this.form[`${prefix}Phone`] || '';
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 && !this.dispatchItemBox) return; if (this.dialogReadonly) 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.transportMapKeyword = this.form[`${prefix}Address`] || this.form[`${prefix}Name`] || '';
addressForm[`${prefix}Address`] || addressForm[`${prefix}Name`] || '';
this.transportMapSelected = this.buildTransportMapSelection({ this.transportMapSelected = this.buildTransportMapSelection({
lng: addressForm[`${prefix}Longitude`], lng: this.form[`${prefix}Longitude`],
lat: addressForm[`${prefix}Latitude`], lat: this.form[`${prefix}Latitude`],
address: addressForm[`${prefix}Address`], address: this.form[`${prefix}Address`],
regionName: addressForm[`${prefix}Name`], regionName: this.form[`${prefix}Name`],
}); });
this.transportMapStatus = this.transportMapSelected.longitude this.transportMapStatus = this.transportMapSelected.longitude
? '已加载当前选点,可重新选点' ? '已加载当前选点,可重新选点'
@@ -5808,13 +5673,12 @@ export default {
return; return;
} }
const prefix = this.transportMapTarget; const prefix = this.transportMapTarget;
const addressForm = this.getTransportAddressForm(); this.form[`${prefix}Address`] =
addressForm[`${prefix}Address`] = this.transportMapSelected.detailAddress || this.form[`${prefix}Address`];
this.transportMapSelected.detailAddress || addressForm[`${prefix}Address`]; this.form[`${prefix}Name`] =
addressForm[`${prefix}Name`] = this.transportMapSelected.regionName || this.form[`${prefix}Name`];
this.transportMapSelected.regionName || addressForm[`${prefix}Name`]; this.form[`${prefix}Longitude`] = this.transportMapSelected.longitude;
addressForm[`${prefix}Longitude`] = this.transportMapSelected.longitude; this.form[`${prefix}Latitude`] = this.transportMapSelected.latitude;
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`]);
@@ -7423,9 +7287,8 @@ 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();
source.forEach(item => { filtered.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,
@@ -7439,73 +7302,26 @@ export default {
}); });
return Array.from(options.values()); return Array.from(options.values());
}, },
fetchDispatchConfiguredCargoTypeSuggestions(queryString, callback) {
const keyword = String(queryString || '').trim().toLowerCase();
const options = this.getDispatchConfiguredCargoTypeOptions().map(item => ({
...item,
value: item.label,
}));
callback(
keyword
? options.filter(item => String(item.value).toLowerCase().includes(keyword))
: options
);
},
fetchDispatchConfiguredCargoNameSuggestions(queryString, callback, row = {}) {
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) { handleDispatchConfiguredCargoTypeChange(row, value) {
const nextValue = String(value ?? row.cargoType ?? '').trim();
const option = this.getDispatchConfiguredCargoTypeOptions().find( const option = this.getDispatchConfiguredCargoTypeOptions().find(
item => String(item.value) === nextValue || item.label === nextValue item => String(item.value) === String(value || '')
); );
if (option) { row.cargoType = option?.label || '';
row.cargoType = option.label || ''; row.cargoTypeCode = option?.cargoTypeCode || '';
row.cargoTypeCode = option.cargoTypeCode || ''; row.cargoTypePath = option?.cargoTypePath || [];
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) === nextValue || item.label === nextValue item => String(item.value) === String(value || '')
); );
if (!option) { row.cargoName = option?.value || '';
row.cargoName = nextValue; if (!option) return;
return; row.cargoType = option.cargoTypeLabel || row.cargoType || '';
} row.cargoTypeCode = option.cargoTypeCode || row.cargoTypeCode || '';
const previousType = String(row.cargoType || '').trim(); row.cargoTypePath = option.cargoTypePath || row.cargoTypePath || [];
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 || '';
}, },
@@ -7529,7 +7345,10 @@ 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 || '',
@@ -8184,7 +8003,6 @@ 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,200 +10,107 @@
:class="{ 'waybill-import-page': standalone }" :class="{ 'waybill-import-page': standalone }"
@closed="handleClosed" @closed="handleClosed"
> >
<section v-show="searchVisible" class="waybill-import-toolbar__search"> <div class="waybill-import-toolbar">
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent> <div class="waybill-import-toolbar__search">
<div class="waybill-import-toolbar__search-grid"> <el-form :inline="true" :model="query" label-width="auto">
<el-form-item label="运单批次号"> <el-form-item label="运单批次号"
<el-input v-model="query.batchNo" clearable placeholder="请输入" /> ><el-input v-model="query.batchNo" clearable
</el-form-item> /></el-form-item>
<el-form-item label="承运商"> <el-form-item label="承运商"
<el-select v-model="query.carrierId" clearable filterable placeholder="请选择"> ><el-select v-model="query.carrierId" clearable filterable
<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" :value="item.id" /></el-select
/> ></el-form-item>
</el-select> <el-form-item label="创建时间"
</el-form-item> ><el-date-picker
<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"
range-separator="~" /></el-form-item>
start-placeholder="开始时间" <el-form-item label="创建人"
end-placeholder="结束时间" ><el-select v-model="query.createUser" clearable filterable
clearable ><el-option
/>
</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" :value="item.id" /></el-select
/> ></el-form-item>
</el-select> </el-form>
</el-form-item>
</div>
<div class="waybill-import-toolbar__search-actions"> <div class="waybill-import-toolbar__search-actions">
<el-button type="primary" @click="loadBatches">查询</el-button> <el-button type="primary" @click="loadBatches">查询</el-button
<el-button @click="resetQuery">重置</el-button> ><el-button @click="resetQuery">重置</el-button>
</div> </div>
</el-form> </div>
</section> <div class="waybill-import-toolbar__actions">
<div class="avue-crud__header waybill-import-toolbar__actions"> <el-button type="primary" @click="handleCreate">新建导入</el-button
<div class="avue-crud__left"> ><el-button type="danger" plain :disabled="!selected.length" @click="removeBatches"
<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>
<section class="waybill-import-toolbar__table-panel"> <el-table :data="batches" border @selection-change="selected = $event">
<el-table <el-table-column type="selection" width="50" /><el-table-column
:data="batches" type="index"
:size="tableSize" label="序号"
border width="70"
@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"
> >
<el-table-column type="selection" width="50" /><el-table-column <template #default="{ row }"
type="index" ><el-link type="primary" @click="openDetail(row)">查看</el-link
label="序号" ><el-link
width="70" v-if="row.importStatus === 'draft'"
/> type="primary"
<el-table-column @click="editBatch(row)"
v-if="columnVisible.batchNo" >编辑</el-link
prop="batchNo" ><el-link type="danger" @click="removeBatch(row)">删除</el-link></template
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.createUserName"
prop="createUserName"
label="创建人"
min-width="120"
> >
<template #default="{ row }">{{ row.createUserName || '-' }}</template> </el-table-column>
</el-table-column> </el-table>
<el-table-column <el-pagination
v-if="columnVisible.statusName" v-model:current-page="page.current"
prop="statusName" v-model:page-size="page.size"
label="状态" layout="total, prev, pager, next, sizes"
width="100" :page-sizes="[10, 20, 50]"
/> :total="page.total"
<el-table-column @current-change="loadBatches"
v-if="columnVisible.createTime" @size-change="loadBatches"
prop="createTime" />
label="创建时间"
min-width="170"
sortable
/><el-table-column
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" <el-form :inline="true" :model="detailQuery"
><el-form-item label="车牌号/船号" ><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.driverName" clearable placeholder="请输入" /></el-form-item ><el-input v-model="detailQuery.cargoName" clearable /></el-form-item
><el-button type="primary" @click="loadDetails">查询</el-button></el-form ><el-button type="primary" @click="loadDetails">查询</el-button></el-form
> >
<el-table :data="details" border <el-table :data="details" border
@@ -219,10 +126,7 @@
prop="vehicleNo" prop="vehicleNo"
label="车牌号/航班号/船号/班列号" label="车牌号/航班号/船号/班列号"
min-width="190" min-width="190"
/><el-table-column prop="transportType" label="运输方式" width="110"> /><el-table-column prop="transportType" label="运输方式" width="110" /><el-table-column
<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"
@@ -296,20 +200,17 @@
prop="waybillIdentifier" prop="waybillIdentifier"
label="同一运单标识号" label="同一运单标识号"
min-width="140" min-width="140"
/></el-table /><el-table-column label="操作" width="80">-</el-table-column></el-table
> >
<div class="waybill-import-toolbar__pagination"> <el-pagination
<el-pagination v-model:current-page="detailPage.current"
background v-model:page-size="detailPage.size"
v-model:current-page="detailPage.current" layout="total, prev, pager, next, sizes"
v-model:page-size="detailPage.size" :page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next, jumper" :total="detailPage.total"
:page-sizes="[10, 20, 50, 100]" @current-change="loadDetails"
:total="detailPage.total" @size-change="loadDetails"
@current-change="loadDetails" />
@size-change="loadDetails"
/>
</div>
</el-dialog> </el-dialog>
<component <component
@@ -605,32 +506,8 @@ 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: 'createUserName', label: '创建人' },
{ prop: 'statusName', 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: '', driverName: '' }); const detailQuery = reactive({ vehicleNo: '', cargoName: '' });
const createDefaultForm = () => ({ const createDefaultForm = () => ({
id: '', id: '',
batchNo: '', batchNo: '',
@@ -985,20 +862,6 @@ 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 || [];
@@ -1059,13 +922,9 @@ const closeCreate = () => {
} }
createVisible.value = false; createVisible.value = false;
}; };
const openDetail = async row => { const openDetail = 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();
}; };
// 草稿明细已落库为草稿运单,编辑时回填到明细表,避免重新上传附件。 // 草稿明细已落库为草稿运单,编辑时回填到明细表,避免重新上传附件。
@@ -1470,81 +1329,34 @@ const confirmImport = async () => {
<style scoped lang="scss"> <style scoped lang="scss">
.waybill-import-toolbar { .waybill-import-toolbar {
margin-bottom: 12px;
&__search { &__search {
padding: 18px 18px 8px; display: flex;
margin-bottom: 8px; align-items: flex-start;
background: #fff; gap: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
&__search-grid { .el-form {
display: grid; flex: 1;
grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0;
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;
justify-content: flex-end; flex: none;
gap: 8px; gap: 8px;
margin-bottom: 8px;
} }
&__actions { &__actions {
margin-top: 12px; margin-top: 8px;
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 {
@@ -1923,12 +1923,6 @@
}}</strong }}</strong
> >
</div> </div>
<div
v-if="!waybillIsCarrier(detailRow)"
class="waybill-manage-page__waybill-detail-field"
>
<span>里程(km)</span><strong>{{ 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">
@@ -2035,8 +2029,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 orderedWaybillPunchRecords" v-for="(record, index) in waybillPunchRecords"
:key="`${record.nodeCode || record.id || 'punch'}-${index}`" :key="record.nodeCode || record.id || 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'"
@@ -3551,25 +3545,6 @@ 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);
}, },
@@ -4517,19 +4492,6 @@ 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;
@@ -5210,28 +5172,19 @@ 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();
}); });
+244 -384
View File
@@ -354,7 +354,7 @@
<el-link <el-link
v-for="action in rowActions(row)" v-for="action in rowActions(row)"
:key="action.type" :key="action.type"
:type="['delete', 'cancel'].includes(action.type) ? 'danger' : 'primary'" :type="action.type === 'delete' ? 'danger' : 'primary'"
@click="handleRowAction(action.type, row)" @click="handleRowAction(action.type, row)"
>{{ action.label }}</el-link >{{ action.label }}</el-link
> >
@@ -583,219 +583,219 @@
label-width="auto" label-width="auto"
class="loading-manage-dialog__form archive-form" class="loading-manage-dialog__form archive-form"
> >
<div title="配载信息" class="loading-manage-dialog__load-info-card"> <section-card title="筛选待配载运单">
<section-card> <template #extra>
<div class="loading-manage-dialog__candidate-search"> <el-link v-if="!dialogReadonly" type="primary" @click="openCandidateSearch"
<el-row :gutter="16"> >筛选</el-link
>
</template>
<div class="loading-manage-dialog__candidate-search">
<el-row :gutter="16">
<el-col :span="6">
<el-form-item label="运单号">
<el-input v-model="candidateQuery.waybillNo" clearable placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="项目名称">
<el-select
v-model="candidateQuery.projectName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadProjectOptions"
:loading="projectLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadProjectOptions(candidateQuery.projectName)
"
>
<el-option
v-for="item in projectOptions"
:key="item.id || item.projectName"
:label="item.projectName"
:value="item.projectName"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发货地址">
<el-input
v-model="candidateQuery.departureAddress"
clearable
placeholder="请输入"
/>
</el-form-item>
</el-col>
<template v-if="candidateSearchVisible">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="运单号"> <el-form-item label="货物名称">
<el-input v-model="candidateQuery.waybillNo" clearable placeholder="请输入" /> <el-input v-model="candidateQuery.cargoName" clearable placeholder="请输入" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="项目名称"> <el-form-item label="收货地址">
<el-select
v-model="candidateQuery.projectName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadProjectOptions"
:loading="projectLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadProjectOptions(candidateQuery.projectName)
"
>
<el-option
v-for="item in projectOptions"
:key="item.id || item.projectName"
:label="item.projectName"
:value="item.projectName"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发货地址">
<el-input <el-input
v-model="candidateQuery.departureAddress" v-model="candidateQuery.arrivalAddress"
clearable clearable
placeholder="请输入" placeholder="请输入"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<template v-if="candidateSearchVisible"> <el-col :span="6">
<el-col :span="6"> <el-form-item label="客户名称">
<el-form-item label="货物名称"> <el-select
<el-input v-model="candidateQuery.customerName"
v-model="candidateQuery.cargoName" clearable
clearable filterable
placeholder="请输入" remote
reserve-keyword
:remote-method="loadCustomerOptions"
:loading="customerLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadCustomerOptions(candidateQuery.customerName)
"
>
<el-option
v-for="item in customerOptions"
:key="item.id || item.customerName"
:label="item.customerName"
:value="item.customerName"
/> />
</el-form-item> </el-select>
</el-col> </el-form-item>
<el-col :span="6">
<el-form-item label="收货地址">
<el-input
v-model="candidateQuery.arrivalAddress"
clearable
placeholder="请输入"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="客户名称">
<el-select
v-model="candidateQuery.customerName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadCustomerOptions"
:loading="customerLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadCustomerOptions(candidateQuery.customerName)
"
>
<el-option
v-for="item in customerOptions"
:key="item.id || item.customerName"
:label="item.customerName"
:value="item.customerName"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="货物类型">
<el-select
v-model="candidateQuery.cargoType"
clearable
filterable
remote
reserve-keyword
:remote-method="loadCargoTypeOptions"
:loading="cargoTypeLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadCargoTypeOptions(candidateQuery.cargoType)
"
>
<el-option
v-for="item in cargoTypeOptions"
:key="item.id || item.cargoName || item.cargoType"
:label="item.cargoName || item.cargoType || item.label"
:value="item.cargoName || item.cargoType || item.label"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="原始单号">
<el-input
v-model="candidateQuery.originalNo"
clearable
placeholder="请输入"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="车/船/航班/班列">
<el-input
v-model="candidateQuery.vehicleNo"
clearable
placeholder="请输入"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="承运商名称">
<el-select
v-model="candidateQuery.carrierName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadCarrierOptions"
:loading="carrierLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadCarrierOptions(candidateQuery.carrierName)
"
>
<el-option
v-for="item in carrierOptions"
:key="item.id || item.fullName || item.customerName || item.carrierName"
:label="
item.fullName || item.customerName || item.carrierName || item.name
"
:value="
item.fullName || item.customerName || item.carrierName || item.name
"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="司机">
<el-select
v-model="candidateQuery.driverName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadDriverOptions"
:loading="driverLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadDriverOptions(candidateQuery.driverName)
"
>
<el-option
v-for="item in driverOptions"
:key="item.id || item.driverName || item.name"
:label="item.driverName || item.name"
:value="item.driverName || item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运输方式">
<el-select
v-model="candidateQuery.transportType"
clearable
filterable
placeholder="请选择"
:disabled="dialogMode === 'add'"
@visible-change="visible => visible && loadTransportTypeOptions()"
>
<el-option
v-for="item in transportTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</template>
<el-col
:span="candidateSearchVisible ? 24 : 6"
class="loading-manage-dialog__candidate-actions"
>
<el-button type="primary" @click="handleCandidateSearch">查询</el-button>
<el-button @click="handleCandidateReset">重置</el-button>
<el-link
type="primary"
@click="candidateSearchVisible = !candidateSearchVisible"
>{{ candidateSearchVisible ? '收起' : '展开' }}</el-link
>
</el-col> </el-col>
</el-row> <el-col :span="6">
</div> <el-form-item label="货物类型">
<el-select
v-model="candidateQuery.cargoType"
clearable
filterable
remote
reserve-keyword
:remote-method="loadCargoTypeOptions"
:loading="cargoTypeLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadCargoTypeOptions(candidateQuery.cargoType)
"
>
<el-option
v-for="item in cargoTypeOptions"
:key="item.id || item.cargoName || item.cargoType"
:label="item.cargoName || item.cargoType || item.label"
:value="item.cargoName || item.cargoType || item.label"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="原始单号">
<el-input
v-model="candidateQuery.originalNo"
clearable
placeholder="请输入"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="车/船/航班/班列">
<el-input v-model="candidateQuery.vehicleNo" clearable placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="承运商名称">
<el-select
v-model="candidateQuery.carrierName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadCarrierOptions"
:loading="carrierLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadCarrierOptions(candidateQuery.carrierName)
"
>
<el-option
v-for="item in carrierOptions"
:key="item.id || item.fullName || item.customerName || item.carrierName"
:label="
item.fullName || item.customerName || item.carrierName || item.name
"
:value="
item.fullName || item.customerName || item.carrierName || item.name
"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="司机">
<el-select
v-model="candidateQuery.driverName"
clearable
filterable
remote
reserve-keyword
:remote-method="loadDriverOptions"
:loading="driverLoading"
placeholder="请输入"
@visible-change="
visible => visible && loadDriverOptions(candidateQuery.driverName)
"
>
<el-option
v-for="item in driverOptions"
:key="item.id || item.driverName || item.name"
:label="item.driverName || item.name"
:value="item.driverName || item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="运输方式">
<el-select
v-model="candidateQuery.transportType"
clearable
filterable
placeholder="请选择"
:disabled="dialogMode === 'add'"
@visible-change="visible => visible && loadTransportTypeOptions()"
>
<el-option
v-for="item in transportTypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</template>
<el-col
:span="candidateSearchVisible ? 24 : 6"
class="loading-manage-dialog__candidate-actions"
>
<el-button type="primary" @click="handleCandidateSearch">查询</el-button>
<el-button @click="handleCandidateReset">重置</el-button>
<el-link
type="primary"
@click="candidateSearchVisible = !candidateSearchVisible"
>{{ candidateSearchVisible ? '收起' : '展开' }}</el-link
>
</el-col>
</el-row>
</div>
</section-card>
<div title="配载信息" class="loading-manage-dialog__load-info-card">
<section-card title="待配载运单">
<el-table <el-table
ref="candidateTableRef" ref="candidateTableRef"
v-loading="candidateLoading" v-loading="candidateLoading"
@@ -843,43 +843,27 @@
show-overflow-tooltip show-overflow-tooltip
> >
<template #default="{ row }"> <template #default="{ row }">
{{ formatCandidateGoodsInfo(row) }} {{ formatCandidateWaybillValue(row, 'goodsInfo') }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="departureAddress" prop="departureAddress"
label="发货地址" label="发货地址"
min-width="220" min-width="220"
show-overflow-tooltip
> >
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip {{ formatCandidateAddress(row, 'departure') }}
v-if="formatCandidateAddressTooltip(row, 'departure')"
:content="formatCandidateAddressTooltip(row, 'departure')"
placement="top"
>
<div class="loading-manage-page__address-cell">
{{ formatCandidateAddress(row, 'departure') }}
</div>
</el-tooltip>
<span v-else>{{ formatCandidateAddress(row, 'departure') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="arrivalAddress" prop="arrivalAddress"
label="收货地址" label="收货地址"
min-width="220" min-width="220"
show-overflow-tooltip
> >
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip {{ formatCandidateAddress(row, 'arrival') }}
v-if="formatCandidateAddressTooltip(row, 'arrival')"
:content="formatCandidateAddressTooltip(row, 'arrival')"
placement="top"
>
<div class="loading-manage-page__address-cell">
{{ formatCandidateAddress(row, 'arrival') }}
</div>
</el-tooltip>
<span v-else>{{ formatCandidateAddress(row, 'arrival') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@@ -1011,36 +995,20 @@
prop="departureAddress" prop="departureAddress"
label="发货地" label="发货地"
min-width="220" min-width="220"
show-overflow-tooltip
> >
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip {{ formatWaybillAddress(row, 'departure') }}
v-if="formatCandidateAddressTooltip(row, 'departure')"
:content="formatCandidateAddressTooltip(row, 'departure')"
placement="top"
>
<div class="loading-manage-page__address-cell">
{{ formatCandidateAddress(row, 'departure') }}
</div>
</el-tooltip>
<span v-else>{{ formatCandidateAddress(row, 'departure') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="arrivalAddress" prop="arrivalAddress"
label="到货地" label="到货地"
min-width="220" min-width="220"
show-overflow-tooltip
> >
<template #default="{ row }"> <template #default="{ row }">
<el-tooltip {{ formatWaybillAddress(row, 'arrival') }}
v-if="formatCandidateAddressTooltip(row, 'arrival')"
:content="formatCandidateAddressTooltip(row, 'arrival')"
placement="top"
>
<div class="loading-manage-page__address-cell">
{{ formatCandidateAddress(row, 'arrival') }}
</div>
</el-tooltip>
<span v-else>{{ formatCandidateAddress(row, 'arrival') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="110" fixed="right"> <el-table-column label="操作" width="110" fixed="right">
@@ -1709,6 +1677,7 @@ export default {
add: '新建配载', add: '新建配载',
edit: '编辑配载单', edit: '编辑配载单',
view: '配载单详情', view: '配载单详情',
copy: '复制配载单',
reassign: '重新派单', reassign: '重新派单',
}; };
return titleMap[this.dialogMode] || '配载管理'; return titleMap[this.dialogMode] || '配载管理';
@@ -1857,7 +1826,6 @@ export default {
if (!row) return '-'; if (!row) return '-';
if (prop === 'businessStatus') return this.statusText(row); if (prop === 'businessStatus') return this.statusText(row);
if (prop === 'transportType') return this.transportTypeLabel(row.transportType); if (prop === 'transportType') return this.transportTypeLabel(row.transportType);
if (prop === 'goodsInfo') return this.formatCandidateGoodsInfo(row);
const column = waybillOption.column.find(item => item.prop === prop); const column = waybillOption.column.find(item => item.prop === prop);
if (column?.formatter) { if (column?.formatter) {
const value = column.formatter(row, {}, row[prop]); const value = column.formatter(row, {}, row[prop]);
@@ -1866,130 +1834,14 @@ export default {
const value = row[prop]; const value = row[prop];
return value === undefined || value === null || value === '' ? '-' : value; return value === undefined || value === null || value === '' ? '-' : value;
}, },
formatCandidateGoodsInfo(row = {}) {
const goodsRows =
[row.goodsJson, row.goodsList, row.goodsRows, row.cargoList, row.cargoRows, row.goods]
.map(source => {
if (source === undefined || source === null || source === '') return [];
if (Array.isArray(source)) return source;
if (typeof source === 'object') return [source];
return parseJsonArray(source);
})
.filter(source => source.length)
.sort((left, right) => right.length - left.length)[0] || [];
if (!goodsRows.length) return String(row.goodsInfo || row.cargoInfo || '') || '-';
const groups = goodsRows.reduce((result, item = {}) => {
const unit = String(
item.quantityUnit ||
item.goodsQuantityUnit ||
item.cargoUnit ||
item.unit ||
row.quantityUnit ||
row.goodsQuantityUnit ||
row.cargoUnit ||
row.unit ||
''
).trim();
const key = unit || '__empty__';
if (!result[key]) {
result[key] = {
typeName:
item.secondCargoTypeName ||
item.secondCargoType ||
item.cargoType ||
item.goodsType ||
item.typeName ||
'货物',
count: 0,
quantity: 0,
unit,
};
}
result[key].count += 1;
result[key].quantity += this.parseGoodsQuantity(
item.quantity ?? item.cargoQuantity ?? item.goodsQuantity
);
return result;
}, {});
return (
Object.values(groups)
.map(group => {
const quantity = this.formatGoodsQuantity(group.quantity);
return `${group.typeName}等${group.count}种货物 | ${quantity}${
group.unit ? ` ${group.unit}` : ''
}`;
})
.join('; ') || '-'
);
},
parseGoodsQuantity(value) {
if (value === undefined || value === null || value === '') return 0;
const text = String(value).replace(/,/g, '');
const match = text.match(/-?\d+(\.\d+)?/);
if (!match) return 0;
const number = Number(match[0]);
return Number.isFinite(number) ? number : 0;
},
formatGoodsQuantity(value) {
const number = Number(value || 0);
if (!Number.isFinite(number)) return '0';
const fixed = Math.round((number + Number.EPSILON) * 1000) / 1000;
return Number.isInteger(fixed) ? String(fixed) : String(fixed).replace(/\.?0+$/, '');
},
formatCandidateDate(value) { formatCandidateDate(value) {
if (!value) return '-'; if (!value) return '-';
const date = dayjs(value); const date = dayjs(value);
return date.isValid() ? date.format('YYYY-MM-DD HH:mm:ss') : value; return date.isValid() ? date.format('YYYY-MM-DD HH:mm:ss') : value;
}, },
formatCandidateAddress(row, type) { formatCandidateAddress(row, type) {
const prefix = type === 'departure' ? 'departure' : 'arrival'; const value = row?.[`${type}Address`] || row?.[`${type}Name`] || '';
const name = String(row?.[`${prefix}Name`] || '').trim(); return this.formatProvinceCityDistrict(value) || '-';
const address = String(row?.[`${prefix}Address`] || '').trim();
if (!this.isRoadTransportType(row?.transportType)) {
return name || address || '-';
}
const region = this.mergeRouteAddressParts(
this.routeProvinceName(row, prefix),
row[`${prefix}CityName`] || row[`${prefix}City`],
row[`${prefix}DistrictName`] || row[`${prefix}District`]
);
const source = this.mergeRouteAddressParts(region, '', address || name);
const parts = this.parseWaybillAddress(source);
return (
[parts.province, parts.city, parts.district]
.map(value => String(value || '').trim())
.filter(Boolean)
.join('') ||
this.formatProvinceCityDistrict(source) ||
name ||
address ||
'-'
);
},
formatCandidateAddressTooltip(row, type) {
if (!this.isRoadTransportType(row?.transportType)) return '';
const prefix = type === 'departure' ? 'departure' : 'arrival';
const address = String(row?.[`${prefix}Address`] || '').trim();
const name = String(row?.[`${prefix}Name`] || '').trim();
const region = this.mergeRouteAddressParts(
this.routeProvinceName(row, prefix),
row[`${prefix}CityName`] || row[`${prefix}City`],
row[`${prefix}DistrictName`] || row[`${prefix}District`]
);
const detailAddress =
row[`${prefix}DetailAddress`] || row[`${prefix}AddressDetail`] || address;
return this.mergeRouteAddressParts(region, '', detailAddress || name) || '';
},
isRoadTransportType(type) {
const value = String(type || '')
.trim()
.toLowerCase();
return (
value === 'road' ||
value.includes('公路') ||
value.includes('道路') ||
value.includes('highway')
);
}, },
splitText(value) { splitText(value) {
if (!value) return []; if (!value) return [];
@@ -2162,28 +2014,31 @@ export default {
if (status === 'draft') { if (status === 'draft') {
return [ return [
{ type: 'edit', label: '编辑' }, { type: 'edit', label: '编辑' },
{ type: 'copy', label: '复制' },
{ type: 'delete', label: '删除' }, { type: 'delete', label: '删除' },
]; ];
} }
if (status === 'pending') { if (status === 'pending') {
const actions = [ return [
{ type: 'view', label: '详情' }, { type: 'view', label: '详情' },
{ type: 'start', label: '改为进行中' }, { type: 'reassign', label: '重新派单' },
{ type: 'edit', label: '编辑' },
{ type: 'copy', label: '复制' },
{ type: 'cancel', label: '取消' },
]; ];
if (row.driverRejected) {
actions.push({ type: 'reassign', label: '重新派单' });
}
actions.push({ type: 'edit', label: '编辑' }, { type: 'cancel', label: '取消' });
return actions;
} }
if (status === 'running') { if (status === 'running') {
return [ return [
{ type: 'view', label: '详情' }, { type: 'view', label: '详情' },
{ type: 'copy', label: '复制' },
{ type: 'complete', label: '完成' }, { type: 'complete', label: '完成' },
]; ];
} }
if (status === 'completed' || status === 'cancelled') { if (status === 'completed' || status === 'cancelled') {
return [{ type: 'view', label: '详情' }]; return [
{ type: 'view', label: '详情' },
{ type: 'copy', label: '复制' },
];
} }
return [{ type: 'view', label: '详情' }]; return [{ type: 'view', label: '详情' }];
}, },
@@ -2192,8 +2047,8 @@ export default {
view: () => this.openLoadingDialog('view', row), view: () => this.openLoadingDialog('view', row),
edit: () => this.openLoadingDialog('edit', row), edit: () => this.openLoadingDialog('edit', row),
reassign: () => this.openLoadingDialog('reassign', row), reassign: () => this.openLoadingDialog('reassign', row),
copy: () => this.copyLoading(row),
delete: () => this.deleteLoading(row), delete: () => this.deleteLoading(row),
start: () => this.startLoading(row),
cancel: () => this.cancelLoading(row), cancel: () => this.cancelLoading(row),
complete: () => this.completeLoading(row), complete: () => this.completeLoading(row),
}; };
@@ -2611,6 +2466,10 @@ export default {
if (['road', '公路运输'].includes(normalized)) return 'road,公路运输'; if (['road', '公路运输'].includes(normalized)) return 'road,公路运输';
return value || ''; return value || '';
}, },
openCandidateSearch() {
this.candidateSearchVisible = true;
this.loadCandidateWaybills();
},
handleCandidateSearch() { handleCandidateSearch() {
this.candidatePage.currentPage = 1; this.candidatePage.currentPage = 1;
this.loadCandidateWaybills(); this.loadCandidateWaybills();
@@ -2712,11 +2571,11 @@ export default {
}; };
rows.forEach((row, rowIndex) => { rows.forEach((row, rowIndex) => {
const departure = row.departureAddress || row.departureName; const departure = row.departureAddress || row.departureName;
appendNode(departure, this.formatCandidateAddress(row, 'departure'), `装${rowIndex + 1}`); appendNode(departure, this.formatWaybillAddress(row, 'departure'), `装${rowIndex + 1}`);
}); });
rows.forEach((row, rowIndex) => { rows.forEach((row, rowIndex) => {
const arrival = row.arrivalAddress || row.arrivalName; const arrival = row.arrivalAddress || row.arrivalName;
appendNode(arrival, this.formatCandidateAddress(row, 'arrival'), `卸${rowIndex + 1}`); appendNode(arrival, this.formatWaybillAddress(row, 'arrival'), `卸${rowIndex + 1}`);
}); });
return [...nodeMap.values()].map((node, index) => ({ return [...nodeMap.values()].map((node, index) => ({
...node, ...node,
@@ -2925,6 +2784,16 @@ export default {
this.dialogSaving = ''; this.dialogSaving = '';
} }
}, },
copyLoading(row) {
this.$router.push({
path: '/business/loading-manage/form',
query: {
mode: 'add',
copyId: row.id,
name: '新增配载管理',
},
});
},
deleteLoading(row) { deleteLoading(row) {
ElMessageBox.confirm(`确定删除配载单 ${row.loadingNo}?`, '提示', { type: 'warning' }) ElMessageBox.confirm(`确定删除配载单 ${row.loadingNo}?`, '提示', { type: 'warning' })
.then(async () => { .then(async () => {
@@ -2944,15 +2813,6 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
startLoading(row) {
ElMessageBox.confirm(`确定将配载单 ${row.loadingNo} 改为进行中?`, '提示', { type: 'warning' })
.then(async () => {
await loadingApi.start(row.id);
ElMessage.success('已改为进行中');
this.loadTable();
})
.catch(() => {});
},
completeLoading(row) { completeLoading(row) {
ElMessageBox.confirm(`确定完成配载单 ${row.loadingNo}?`, '提示', { type: 'warning' }) ElMessageBox.confirm(`确定完成配载单 ${row.loadingNo}?`, '提示', { type: 'warning' })
.then(async () => { .then(async () => {
@@ -3411,8 +3271,8 @@ export default {
} }
.loading-manage-dialog__candidate-search { .loading-manage-dialog__candidate-search {
padding: 0; padding: 4px 0;
margin-bottom: 0; margin-bottom: 8px;
} }
.loading-manage-dialog__waybill-route-layout { .loading-manage-dialog__waybill-route-layout {
+111 -215
View File
@@ -1,58 +1,57 @@
<template> <template>
<basic-container class="master-order-page"> <basic-container class="master-order-page">
<template v-if="mode === 'list'"> <template v-if="mode === 'list'">
<div class="master-order-page__search"> <el-form :model="query" class="master-search" label-width="160px" @submit.prevent>
<el-form :model="query" label-position="right" label-width="88px" @submit.prevent> <el-row :gutter="16">
<div class="master-order-page__search-grid"> <el-col v-for="field in primaryFields" :key="field.prop" :span="6"
<el-form-item v-for="field in primaryFields" :key="field.prop" :label="field.label"> ><el-form-item :label="field.label"
<el-input v-model="query[field.prop]" clearable placeholder="请输入" /> ><el-input v-model="query[field.prop]" placeholder="请输入" /></el-form-item
</el-form-item> ></el-col>
<el-form-item label="状态"> <el-col :span="6"
<el-select v-model="query.businessStatus" clearable placeholder="全部"> ><el-form-item label="状态"
<el-option label="全部" value="" /> ><el-select v-model="query.businessStatus" placeholder="全部"
<el-option ><el-option label="全部" value="" /><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" :value="item.value" /></el-select></el-form-item
/> ></el-col>
</el-select> <template v-if="searchExpanded">
</el-form-item> <el-col v-for="field in secondaryFields" :key="field.prop" :span="6"
<template v-if="searchExpanded"> ><el-form-item :label="field.label"
<el-form-item v-for="field in secondaryFields" :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-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="请选择" end-placeholder="请选择" /></el-form-item
/> ></el-col>
</el-form-item> <el-col :span="6"
<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="请选择" end-placeholder="请选择" /></el-form-item
/> ></el-col>
</el-form-item> </template>
</template> <el-col :span="24" class="search-actions"
<div class="master-order-page__search-actions"> ><el-button type="primary" @click="search">查询</el-button
<el-button type="primary" @click="search">查询</el-button> ><el-button @click="reset">重置</el-button
<el-button @click="reset">重置</el-button> ><el-link type="primary" @click="searchExpanded = !searchExpanded"
<el-link type="primary" @click="searchExpanded = !searchExpanded">{{ ><el-icon><component :is="searchExpanded ? ArrowUp : ArrowDown" /></el-icon
searchExpanded ? '收起' : '展开' >{{ searchExpanded ? '折叠' : '展开' }}</el-link
}}</el-link> ></el-col
</div> >
</div> </el-row>
</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
@@ -77,13 +76,7 @@
<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 <el-tooltip placement="top"><template #content>{{ node.name }}</template><strong>{{ node.name }}</strong></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>
@@ -132,7 +125,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" /> <master-order-detail v-else :id="routeId" @back="goList" />
<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
@@ -145,6 +138,7 @@
<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';
@@ -153,6 +147,8 @@ export default {
components: { MasterOrderEditor, MasterOrderDispatch, MasterOrderDetail }, components: { MasterOrderEditor, MasterOrderDispatch, MasterOrderDetail },
data() { data() {
return { return {
ArrowDown,
ArrowUp,
searchExpanded: false, searchExpanded: false,
loading: false, loading: false,
records: [], records: [],
@@ -307,7 +303,7 @@ export default {
}, },
timeRange(row) { timeRange(row) {
return row.planStartTime && row.planEndTime return row.planStartTime && row.planEndTime
? `${String(row.planStartTime).slice(0, 10)} - ${String(row.planEndTime).slice(0, 10)}` ? `${String(row.planStartTime).slice(0, 16)} - ${String(row.planEndTime).slice(0, 16)}`
: '-'; : '-';
}, },
goodsSummary(row) { goodsSummary(row) {
@@ -338,19 +334,6 @@ 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 '-';
@@ -372,16 +355,10 @@ 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 '-';
if ( const siteCode = String(region.siteCode || '').trim();
this.isNonRoadLocation({ // 运输方式切换不应改变地址本身的展示模式:有站点编码时显示站点名称,
name: text, // 没有站点编码的区域地址统一按“市 区县”格式展示。
siteCode: region.siteCode, if (siteCode && siteCode !== '/') return text;
transportType,
nextTransportType: region.nextTransportType,
})
) {
return text;
}
// 优先从完整的地址名称/详细地址解析,避免后端只返回“梅州”等不完整的市名称时 // 优先从完整的地址名称/详细地址解析,避免后端只返回“梅州”等不完整的市名称时
// 提前返回城市,导致区县被遗漏。 // 提前返回城市,导致区县被遗漏。
const parsedText = this.formatRoadAddress(text); const parsedText = this.formatRoadAddress(text);
@@ -406,149 +383,86 @@ 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 cityName = formatted.split(' ')[0]; const city = formatted.split(' ')[0];
return cityName && cityName !== formatted ? `${cityName} ${text}` : formatted; return city && city !== formatted ? `${city} ${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: '起',
...start, name: this.routeNodeName(
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: '终',
...end, name: this.routeNodeName(
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: '起',
...start, name: this.routeNodeName(
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 ? '终' : '经',
...location, name: this.routeNodeName(
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}吨`],
@@ -580,43 +494,31 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.master-order-page { .master-search {
&__search { margin-bottom: 12px;
padding: 12px 12px 4px; padding: 12px 12px 4px;
margin-bottom: 8px; background: #fff;
background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); .el-form-item {
}
&__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 {
:deep(.el-input), display: flex;
:deep(.el-select), justify-content: flex-end;
:deep(.el-date-editor.el-input), align-items: center;
:deep(.el-date-editor.el-input__wrapper), gap: 12px;
:deep(.el-date-editor--datetimerange) { min-height: 40px;
width: 100%; .el-icon {
margin-right: 4px;
}
} }
} }
.master-list-panel { .master-list-panel {
@@ -710,16 +612,10 @@ 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;
text-overflow: ellipsis; max-width: 180px;
white-space: nowrap;
vertical-align: bottom;
cursor: default;
} }
} }
.route-connector { .route-connector {
+1 -1
View File
@@ -318,7 +318,7 @@
<el-form-item prop="fundLimit" class="project-apply-form__tip-label"> <el-form-item prop="fundLimit" class="project-apply-form__tip-label">
<template #label> <template #label>
<span>项目资金使用额度</span> <span>项目资金使用额度</span>
<el-tooltip content="实际业务回款周期内付款额度" placement="top"> <el-tooltip content="实际业务回款周期内付款" placement="top">
<el-icon class="project-apply-form__label-tip"><QuestionFilled /></el-icon> <el-icon class="project-apply-form__label-tip"><QuestionFilled /></el-icon>
</el-tooltip> </el-tooltip>
</template> </template>
+237 -358
View File
@@ -1,113 +1,116 @@
<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">
<!-- 顶部信息区:对齐运单详情汇总样式 --> <!-- 顶部信息区 -->
<section-card class="transport-plan-dispatch-page__summary"> <div class="transport-plan-dispatch-page__top">
<div class="transport-plan-dispatch-page__heading"> <div class="transport-plan-dispatch-page__heading">
<el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button> <div class="transport-plan-dispatch-page__heading-title">
<strong>计划调度</strong> <el-button icon="el-icon-arrow-left" text @click="handleBack">返回</el-button>
<span>{{ planData.planNo || planData.loadingNo || '-' }}</span> <span class="transport-plan-dispatch-page__heading-name">计划调度</span>
<span class="detail-status-text" :class="statusTextClass"> <span class="transport-plan-dispatch-page__heading-no">
{{ planData.businessStatusName || '-' }} {{ planData.planNo || planData.loadingNo || '-' }}
</span> </span>
<span class="detail-status-text detail-transport-type"> <el-tag :type="getStatusTagType(planData.businessStatus)" effect="light" class="status-text">
{{ planData.transportTypeName || '公路整车' }} {{ planData.businessStatusName || '-' }}
</span> </el-tag>
<el-tag type="primary" effect="light">
{{ planData.transportTypeName || '公路整车' }}
</el-tag>
</div>
</div> </div>
<div class="transport-plan-dispatch-page__summary-grid">
<div class="transport-plan-dispatch-page__summary-item"> <div class="transport-plan-dispatch-page__summary">
<span class="transport-plan-dispatch-page__summary-label">客户</span> <section-card title="基本信息" class="transport-plan-dispatch-page__summary-card">
<span class="transport-plan-dispatch-page__summary-value"> <div class="transport-plan-dispatch-page__summary-grid">
{{ planData.customerName || '-' }} <div class="transport-plan-dispatch-page__summary-item">
</span> <div class="transport-plan-dispatch-page__summary-label">客户</div>
</div> <div class="transport-plan-dispatch-page__summary-value">
<div class="transport-plan-dispatch-page__summary-item"> {{ planData.customerName || '-' }}
<span class="transport-plan-dispatch-page__summary-label">合同编号</span> </div>
<span class="transport-plan-dispatch-page__summary-value is-link"> </div>
{{ planData.contractNo || '-' }} <div class="transport-plan-dispatch-page__summary-item">
</span> <div class="transport-plan-dispatch-page__summary-label">项目</div>
</div> <div class="transport-plan-dispatch-page__summary-value">
<div class="transport-plan-dispatch-page__summary-item"> {{ planData.projectName || '-' }}
<span class="transport-plan-dispatch-page__summary-label">项目</span> </div>
<span class="transport-plan-dispatch-page__summary-value"> </div>
{{ planData.projectName || '-' }} <div class="transport-plan-dispatch-page__summary-item">
</span> <div class="transport-plan-dispatch-page__summary-label">合同编号</div>
</div> <div class="transport-plan-dispatch-page__summary-value">
<div class="transport-plan-dispatch-page__summary-item"> {{ planData.contractNo || '-' }}
<span class="transport-plan-dispatch-page__summary-label">计划执行时间</span> </div>
<span class="transport-plan-dispatch-page__summary-value"> </div>
{{ formatDateRange(planData.planStartDate, planData.planEndDate) }} <div class="transport-plan-dispatch-page__summary-item">
</span> <div class="transport-plan-dispatch-page__summary-label">计划执行时间</div>
</div> <div class="transport-plan-dispatch-page__summary-value">
<div class="transport-plan-dispatch-page__summary-item is-goods"> {{ formatDateRange(planData.planStartDate, planData.planEndDate) }}
<span class="transport-plan-dispatch-page__summary-label">货物信息</span> </div>
<span class="transport-plan-dispatch-page__summary-value is-wrap"> </div>
{{ planData.goodsInfo || formatGoodsInfo(planData) }} <div class="transport-plan-dispatch-page__summary-item is-wide">
</span> <div class="transport-plan-dispatch-page__summary-label">货物信息</div>
</div> <div class="transport-plan-dispatch-page__summary-value">
<div class="transport-plan-dispatch-page__route"> {{ planData.goodsInfo || formatGoodsInfo(planData) }}
<div class="transport-plan-dispatch-page__route-item is-start"> </div>
<div class="transport-plan-dispatch-page__route-marker">起</div> </div>
<div class="transport-plan-dispatch-page__route-detail"> <div class="transport-plan-dispatch-page__summary-item">
<strong class="transport-plan-dispatch-page__route-name"> <div class="transport-plan-dispatch-page__summary-label">附件</div>
{{ <div class="transport-plan-dispatch-page__summary-value">
formatRouteCityDistrict(planData.departureAddress || planData.departureName) <template v-if="attachmentList.length">
}} <el-link
</strong> v-for="(item, index) in attachmentList"
<el-tooltip :key="index"
:content="planData.departureAddress || planData.departureName || '-'" type="primary"
placement="top" :href="item.url"
> :underline="false"
<span class="transport-plan-dispatch-page__route-addr"> target="_blank"
{{ planData.departureAddress || planData.departureName || '-' }} class="transport-plan-dispatch-page__attachment-link"
</span> >
</el-tooltip> {{ item.name || item.originalName || '附件' }}
<div class="transport-plan-dispatch-page__route-contact"> </el-link>
<span>联系人:{{ planData.departureContact || '-' }}</span> </template>
<span>联系方式:{{ planData.departurePhone || '-' }}</span> <span v-else>-</span>
</div> </div>
</div> </div>
</div> </div>
<span class="transport-plan-dispatch-page__route-line" aria-hidden="true" /> </section-card>
<div class="transport-plan-dispatch-page__route-item is-end">
<div class="transport-plan-dispatch-page__route-marker">终</div> <section-card title="收发货路线" class="transport-plan-dispatch-page__route-card">
<div class="transport-plan-dispatch-page__route-detail"> <div class="transport-plan-dispatch-page__route">
<strong class="transport-plan-dispatch-page__route-name"> <div class="transport-plan-dispatch-page__route-item">
{{ formatRouteCityDistrict(planData.arrivalAddress || planData.arrivalName) }} <span class="transport-plan-dispatch-page__route-badge is-start">起</span>
</strong> <div class="transport-plan-dispatch-page__route-body">
<el-tooltip <div class="transport-plan-dispatch-page__route-title">
:content="planData.arrivalAddress || planData.arrivalName || '-'" {{ planData.departureName || '-' }}
placement="top" </div>
> <div class="transport-plan-dispatch-page__route-address">
<span class="transport-plan-dispatch-page__route-addr"> {{ formatAddress(planData.departureAddress) }}
{{ planData.arrivalAddress || planData.arrivalName || '-' }} </div>
</span> <div class="transport-plan-dispatch-page__route-contact">
</el-tooltip> {{ formatContact(planData.departureContact, planData.departurePhone) }}
<div class="transport-plan-dispatch-page__route-contact"> </div>
<span>联系人:{{ planData.arrivalContact || '-' }}</span> </div>
<span>联系方式:{{ planData.arrivalPhone || '-' }}</span> </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> </div>
</div> </div>
</div> </section-card>
<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>
</section-card> </div>
<!-- 调度列表 --> <!-- 调度列表 -->
<section-card class="transport-plan-dispatch-page__list-card"> <section-card class="transport-plan-dispatch-page__list-card">
@@ -201,6 +204,7 @@
</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';
@@ -212,6 +216,7 @@ const TRANSPORT_PLAN_QUANTITY_UNIT = '吨';
export default { export default {
name: 'TransportPlanDispatch', name: 'TransportPlanDispatch',
components: { components: {
Van,
SectionCard, SectionCard,
TransportPlanPage, TransportPlanPage,
}, },
@@ -232,21 +237,11 @@ 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)}吨`;
} }
@@ -269,9 +264,6 @@ 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
@@ -284,20 +276,13 @@ 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);
@@ -379,6 +364,15 @@ 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(' ~ ') : '-';
@@ -388,30 +382,9 @@ export default {
const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/); const match = address.match(/^(.*?省)?(.*?市)?(.*?区|.*?县)?/);
return match ? match[0] || address : address; return match ? match[0] || address : address;
}, },
formatProvinceCityDistrict(value) { formatContact(contact, phone) {
const text = String(value || '').trim(); const parts = [contact, phone].filter(Boolean);
if (!text) return '-'; return parts.length ? parts.join(' / ') : '-';
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);
@@ -446,32 +419,31 @@ export default {
this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细'); this.$message.warning('待调度列表货物总量已达到计划总量,不能新增调度明细');
return; return;
} }
this.openPageDispatchItemDialog(-1);
}, // 调用 transport-plan-page 组件的方法打开弹窗
handleEdit(row, index) {
this.openPageDispatchItemDialog(index, row);
},
openPageDispatchItemDialog(index = -1, row) {
this.$nextTick(() => { this.$nextTick(() => {
const component = this.$refs.transportPlanPageRef; const component = this.$refs.transportPlanPageRef;
if (!component) return; if (component) {
component.dispatchRow = this.planData; // 设置调度数据
component.dispatchRows = [...this.dispatchList]; component.dispatchRow = this.planData;
this.bindDispatchItemSaveSync(component); component.dispatchRows = [...this.dispatchList];
if (index >= 0) component.openDispatchItemDialog(index, row); // 打开新增弹窗
else component.openDispatchItemDialog(-1); component.openDispatchItemDialog(-1);
}
}); });
}, },
bindDispatchItemSaveSync(component) { handleEdit(row, index) {
if (component.__dispatchListSaveSynced) return; // 调用 transport-plan-page 组件的方法打开弹窗
const originalSave = component.saveDispatchItem; this.$nextTick(() => {
component.saveDispatchItem = (...args) => { const component = this.$refs.transportPlanPageRef;
originalSave.apply(component, args); if (component) {
if (!component.dispatchItemBox) { // 设置调度数据
this.dispatchList = [...(component.dispatchRows || [])]; component.dispatchRow = this.planData;
component.dispatchRows = [...this.dispatchList];
// 打开编辑弹窗
component.openDispatchItemDialog(index, row);
} }
}; });
component.__dispatchListSaveSynced = true;
}, },
handleDelete(index) { handleDelete(index) {
this.$confirm('确定删除该调度明细?', '提示', { this.$confirm('确定删除该调度明细?', '提示', {
@@ -579,189 +551,126 @@ export default {
height: 100%; height: 100%;
} }
&__summary { &__top {
:deep(.el-card__body) { display: flex;
padding: 18px 22px; flex-direction: column;
} gap: 16px;
} }
&__heading { &__heading {
display: flex; padding: 16px;
align-items: center; background: #fff;
flex-wrap: wrap; border-radius: 4px;
gap: 12px;
margin-bottom: 18px;
strong { &-title {
font-size: 20px; display: flex;
}
.detail-status-text {
display: inline-flex;
align-items: center; align-items: center;
height: 28px; gap: 12px;
padding: 0 12px; font-size: 18px;
border-radius: 8px; font-weight: 600;
font-size: 13px;
line-height: 28px;
} }
.status-text-success, &-name {
.is-dispatching { font-size: 18px;
color: #67c23a;
background: #e1f3d8;
} }
.detail-transport-type { &-no {
color: #409eff; font-size: 14px;
background: #ecf5ff; color: #606266;
}
.is-danger {
color: #f56c6c;
background: #fef0f0;
}
.is-info {
color: #909399;
background: #f4f4f5;
} }
} }
&__summary-grid { &__summary {
display: grid;
grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(360px, 1.5fr);
gap: 16px 24px;
}
&__summary-item {
display: flex; display: flex;
flex-direction: column; gap: 16px;
gap: 8px;
min-width: 0;
&.is-goods { &-card {
grid-column: 1 / 5; flex: 1;
}
&-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 16px;
}
&-item {
display: flex;
flex-direction: column;
gap: 8px;
&.is-wide {
grid-column: 1 / -1;
}
}
&-label {
font-size: 14px;
color: #909399;
}
&-value {
font-size: 14px;
color: #303133;
} }
} }
&__summary-label { &__route-card {
color: #909399; flex: 1;
}
&__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;
text-align: center; gap: 24px;
}
&__route-marker { &-item {
display: inline-flex; flex: 1;
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;
flex-wrap: wrap; gap: 12px;
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;
} }
} }
@@ -797,42 +706,12 @@ export default {
border-radius: 4px; border-radius: 4px;
} }
@media (max-width: 1200px) { &__attachment-link {
&__summary-grid { margin-right: 12px;
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>
+6 -26
View File
@@ -16,9 +16,7 @@
><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-option value="处理中" /><el-option label="处理完成" value="处理完成" /></el-select
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="请输入"
@@ -86,14 +84,7 @@
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 prop="processStatus" label="处理状态" width="120" /><el-table-column
><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"
@@ -118,7 +109,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="220" fixed="right" align="center" ></el-table-column><el-table-column label="操作" width="320" 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
@@ -139,7 +130,7 @@
@click="download(row)" @click="download(row)"
>下载</el-link >下载</el-link
><el-link ><el-link
v-if="row.auditStatus === '审核驳回' || row.processStatus === '处理失败'" v-if="row.auditStatus === '审核驳回'"
type="primary" type="primary"
@click="openUpload(row, 'reupload')" @click="openUpload(row, 'reupload')"
>重新上传</el-link >重新上传</el-link
@@ -154,7 +145,7 @@
@click="openBatchDialog(row)" @click="openBatchDialog(row)"
>更换运单批次</el-link >更换运单批次</el-link
><el-link ><el-link
v-if="row.processStatus === '上传中' || row.processStatus === '处理失败' || row.auditStatus === '审核驳回'" v-if="row.processStatus === '上传中' || row.auditStatus === '审核驳回'"
type="danger" type="danger"
@click="removeRow(row)" @click="removeRow(row)"
>删除</el-link >删除</el-link
@@ -1247,15 +1238,7 @@ const view = async row => {
query: { id: row.id, batchNo: row.voucherBatchNo }, query: { id: row.id, batchNo: row.voucherBatchNo },
}); });
}; };
const download = row => { const download = row => window.open(row.fileUrl, '_blank');
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',
@@ -1346,9 +1329,6 @@ 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;
+21 -6
View File
@@ -1,5 +1,6 @@
<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>
@@ -10,14 +11,28 @@ 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>
@@ -497,6 +497,7 @@ const emptyLine = () => ({
localId: ++localId, localId: ++localId,
goodsCategory: '', goodsCategory: '',
goodsName: '', goodsName: '',
taxClassificationCode: '',
unit: '吨', unit: '吨',
quantity: 0, quantity: 0,
unitPriceNoTax: 0, unitPriceNoTax: 0,
@@ -724,9 +725,11 @@ export default {
const item = this.findInvoiceItem(line); const item = this.findInvoiceItem(line);
if (item) { if (item) {
line.taxRate = Number(item.defaultTaxRate || 0); line.taxRate = Number(item.defaultTaxRate || 0);
line.taxClassificationCode = item.taxClassificationCode || '';
} else if (clearInvalid) { } else if (clearInvalid) {
line.goodsName = ''; line.goodsName = '';
line.taxRate = 0; line.taxRate = 0;
line.taxClassificationCode = '';
} }
this.recalculateLine(line); this.recalculateLine(line);
}, },
@@ -734,6 +737,7 @@ export default {
const names = this.invoiceItemNames(line.goodsCategory); const names = this.invoiceItemNames(line.goodsCategory);
if (!names.some(item => item.shortName === line.goodsName)) line.goodsName = ''; if (!names.some(item => item.shortName === line.goodsName)) line.goodsName = '';
line.taxRate = 0; line.taxRate = 0;
line.taxClassificationCode = this.findInvoiceItem(line)?.taxClassificationCode || '';
if (names.length === 1) { if (names.length === 1) {
line.goodsName = names[0].shortName; line.goodsName = names[0].shortName;
this.handleGoodsNameChange(line); this.handleGoodsNameChange(line);
@@ -743,9 +747,11 @@ export default {
const item = this.findInvoiceItem(line); const item = this.findInvoiceItem(line);
if (!item) { if (!item) {
line.taxRate = 0; line.taxRate = 0;
line.taxClassificationCode = '';
return; return;
} }
line.taxRate = Number(item.defaultTaxRate || 0); line.taxRate = Number(item.defaultTaxRate || 0);
line.taxClassificationCode = item.taxClassificationCode || '';
this.recalculateLine(line); this.recalculateLine(line);
}, },
validateSettlements(rule, value, callback) { validateSettlements(rule, value, callback) {
@@ -1141,6 +1147,7 @@ export default {
lines: sheet.lines.map(line => ({ lines: sheet.lines.map(line => ({
goodsCategory: line.goodsCategory, goodsCategory: line.goodsCategory,
goodsName: line.goodsName, goodsName: line.goodsName,
taxClassificationCode: line.taxClassificationCode,
unit: line.unit, unit: line.unit,
quantity: line.quantity, quantity: line.quantity,
unitPriceNoTax: line.unitPriceNoTax, unitPriceNoTax: line.unitPriceNoTax,
+12 -1
View File
@@ -406,7 +406,18 @@ export default {
} }
await Promise.all(rows.map(row => api.syncKingdee(row.id))); await Promise.all(rows.map(row => api.syncKingdee(row.id)));
this.$message.success(`已同步${rows.length}条开票申请`); this.$message.success(`已同步${rows.length}条开票申请`);
this.loadTable(); await this.loadTable();
// 附件联带同步提示:同步成功但附件未全部上传时追加 warning,重推即自动补传
const idSet = new Set(rows.map(row => String(row.id)));
const pendingCount = (this.rows || []).filter(row => idSet.has(String(row.id))
&& ['pending', 'partial'].includes(row.attachmentSyncStatus)).length;
if (pendingCount) {
this.$message({
type: 'warning',
message: `其中${pendingCount}单附件未全部上传,可重推补传`,
duration: 8000,
});
}
}, },
async handleExport() { async handleExport() {
const data = this.unwrapData(await api.getList(1, 100000, this.query)); const data = this.unwrapData(await api.getList(1, 100000, this.query));
+25 -239
View File
@@ -47,7 +47,7 @@
<el-col :span="6"> <el-col :span="6">
<el-form-item label="开票金额"> <el-form-item label="开票金额">
<el-input <el-input
:model-value="form.kingdeeInvoicePoolId ? formatMoney(form.invoiceAmount) : ''" :model-value="form.invoiceNo ? formatMoney(form.invoiceAmount) : ''"
disabled disabled
placeholder="从金蝶票据池带出" placeholder="从金蝶票据池带出"
/> />
@@ -56,7 +56,7 @@
<el-col :span="6"> <el-col :span="6">
<el-form-item label="税额"> <el-form-item label="税额">
<el-input <el-input
:model-value="form.kingdeeInvoicePoolId ? formatMoney(form.taxAmount) : ''" :model-value="form.invoiceNo ? formatMoney(form.taxAmount) : ''"
disabled disabled
placeholder="从金蝶票据池带出" placeholder="从金蝶票据池带出"
/> />
@@ -149,62 +149,13 @@
</div> </div>
</el-form> </el-form>
<el-dialog v-model="invoiceDialog.visible" title="查询金蝶票据池" width="86%" append-to-body> <kingdee-invoice-pool-dialog
<div class="receipt-form-page__dialog-search"> v-model="invoiceDialog.visible"
<el-input title="查询金蝶票据池"
v-model="invoiceDialog.keyword" :initial-invoice-no="form.invoiceNo"
clearable :query-api="apiQueryInvoicePool"
placeholder="发票号码、开票单位或受票单位" @confirm="handleInvoicePicked"
@keyup.enter="loadInvoicePool" />
/>
<el-button type="primary" @click="loadInvoicePool">查询</el-button>
</div>
<el-table
v-loading="invoiceDialog.loading"
:data="invoiceDialog.rows"
border
empty-text="暂无票据数据"
highlight-current-row
@current-change="invoiceDialog.current = $event"
@row-dblclick="confirmInvoice"
>
<el-table-column prop="invoiceNo" label="发票号码" min-width="180" />
<el-table-column prop="invoiceDate" label="开票日期" min-width="120" />
<el-table-column prop="invoiceType" label="发票类型" min-width="130" />
<el-table-column prop="issuerName" label="开票单位" min-width="170" />
<el-table-column prop="receiverName" label="受票单位" min-width="170" />
<el-table-column label="开票金额" min-width="130" align="right">
<template #default="{ row }">{{ formatMoney(row.invoiceAmount) }}</template>
</el-table-column>
<el-table-column label="税率" min-width="100" align="center">
<template #default="{ row }">{{ formatRate(row.taxRate) }}</template>
</el-table-column>
<el-table-column label="税额" min-width="120" align="right">
<template #default="{ row }">{{ formatMoney(row.taxAmount) }}</template>
</el-table-column>
<el-table-column prop="kingdeeBillNo" label="金蝶单据号" min-width="150" />
<el-table-column label="操作" width="100" fixed="right" align="center">
<template #default="{ row }">
<el-link type="primary" @click.stop="confirmInvoice(row)">选择</el-link>
</template>
</el-table-column>
</el-table>
<div class="receipt-form-page__dialog-pagination">
<el-pagination
v-model:current-page="invoiceDialog.page.current"
v-model:page-size="invoiceDialog.page.size"
:total="invoiceDialog.page.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@current-change="refreshInvoicePoolPage"
@size-change="handleInvoicePoolSizeChange"
/>
</div>
<template #footer>
<el-button @click="invoiceDialog.visible = false">取消</el-button>
<el-button type="primary" @click="confirmInvoice()">确定</el-button>
</template>
</el-dialog>
<el-dialog <el-dialog
v-model="settlementDialog.visible" v-model="settlementDialog.visible"
@@ -259,80 +210,11 @@
import { Search } from '@element-plus/icons-vue'; import { Search } from '@element-plus/icons-vue';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import * as api from '@/api/payment/invoiceReceipt'; import * as api from '@/api/payment/invoiceReceipt';
import { getList as getCustomerList } from '@/api/vehicle/customer-archive'; import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue'; import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
const mockInvoiceTypes = ['增值税专用发票', '增值税普通发票'];
const mockTaxRates = [3, 6, 9, 13];
const mockBankNames = ['中国工商银行', '中国农业银行', '中国银行', '中国建设银行', '招商银行'];
const randomDigits = length =>
Array.from({ length }, () => Math.floor(Math.random() * 10)).join('');
const formatMockDate = date => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
const customerName = customer =>
customer.fullName || customer.shortName || customer.customerCode || `客商${customer.id}`;
const customerEmail = (customer, index) => {
const prefix = String(customer.customerCode || customer.id || `customer${index + 1}`)
.replace(/[^a-zA-Z0-9_-]/g, '')
.toLowerCase();
return `finance@${prefix || `customer${index + 1}`}.example.com`;
};
const createInvoicePoolMockRows = (customers, counterpartyName, departmentEmail) => {
const rows = [];
const baseId = Date.now();
customers.forEach((customer, customerIndex) => {
const name = customerName(customer);
['issuer', 'receiver'].forEach((role, roleIndex) => {
const count = 3 + Math.floor(Math.random() * 5);
for (let index = 0; index < count; index += 1) {
const rowIndex = rows.length;
const invoiceDateValue = new Date();
invoiceDateValue.setDate(invoiceDateValue.getDate() - Math.floor(Math.random() * 90));
const invoiceDate = formatMockDate(invoiceDateValue);
const taxRate = mockTaxRates[(customerIndex + roleIndex + index) % mockTaxRates.length];
const invoiceAmount = Math.floor(10000 + Math.random() * 190000);
const taxAmount = Number(
((invoiceAmount * Number(taxRate)) / (100 + Number(taxRate))).toFixed(2)
);
const bankName = mockBankNames[(customerIndex + index) % mockBankNames.length];
rows.push({
id: baseId + rowIndex,
invoiceNo: `25${randomDigits(18)}`,
invoiceDate,
invoiceType: mockInvoiceTypes[(customerIndex + index) % mockInvoiceTypes.length],
taxRate,
invoiceAmount,
taxAmount,
receiverName: role === 'receiver' ? name : counterpartyName,
issuerName: role === 'issuer' ? name : counterpartyName,
bankName,
bankAccount: randomDigits(19),
issuingBank: `${bankName}营业部`,
phone: customer.contactPhone || '',
customerEmails: customerEmail(customer, customerIndex),
departmentEmails: departmentEmail || '',
attachmentsJson: '[]',
kingdeeBillNo: `KD-FP-${invoiceDate.replaceAll('-', '')}${randomDigits(5)}`,
kingdeeStatus: 'unsynced',
});
}
});
});
return rows;
};
const emptyForm = () => ({ const emptyForm = () => ({
id: null, id: null,
kingdeeInvoicePoolId: null,
invoiceNo: '', invoiceNo: '',
invoiceDate: '', invoiceDate: '',
invoiceType: '', invoiceType: '',
@@ -344,8 +226,6 @@ const emptyForm = () => ({
bankName: '', bankName: '',
bankAccount: '', bankAccount: '',
issuingBank: '', issuingBank: '',
kingdeeBillNo: '',
kingdeeStatus: 'unsynced',
phone: '', phone: '',
customerEmails: [], customerEmails: [],
departmentEmails: [], departmentEmails: [],
@@ -361,24 +241,17 @@ const emptyForm = () => ({
export default { export default {
name: 'InvoiceReceiptForm', name: 'InvoiceReceiptForm',
components: { components: {
KingdeeInvoicePoolDialog,
VehicleAttachmentTable, VehicleAttachmentTable,
}, },
data() { data() {
return { return {
Search, Search,
form: emptyForm(), form: emptyForm(),
invoicePoolMockRows: [],
invoicePoolMockLoaded: false,
customerEmailOptions: [], customerEmailOptions: [],
departmentEmailOptions: [], departmentEmailOptions: [],
invoiceDialog: { invoiceDialog: {
visible: false, visible: false,
loading: false,
keyword: '',
sourceRows: [],
rows: [],
current: null,
page: { current: 1, size: 10, total: 0 },
}, },
settlementDialog: { settlementDialog: {
visible: false, visible: false,
@@ -421,6 +294,12 @@ export default {
this.initialize(); this.initialize();
}, },
methods: { methods: {
apiQueryInvoicePool(params) {
return api.queryInvoicePool(params);
},
handleInvoicePicked(rows) {
this.confirmInvoice(rows[0]);
},
hasPermission(code) { hasPermission(code) {
return this.permission?.[code] !== false; return this.permission?.[code] !== false;
}, },
@@ -466,7 +345,7 @@ export default {
if (this.settlementIds.length) await this.loadReferenceInformation(); if (this.settlementIds.length) await this.loadReferenceInformation();
}, },
validateInvoice(rule, value, callback) { validateInvoice(rule, value, callback) {
if (!value || !this.form.kingdeeInvoicePoolId) { if (!value) {
callback(new Error('请选择金蝶票据池发票')); callback(new Error('请选择金蝶票据池发票'));
return; return;
} }
@@ -492,99 +371,17 @@ export default {
} }
callback(); callback();
}, },
async openInvoiceDialog() { openInvoiceDialog() {
this.invoiceDialog.visible = true; this.invoiceDialog.visible = true;
this.invoiceDialog.keyword = this.form.invoiceNo || '';
await this.loadInvoicePool();
},
async loadInvoicePool() {
this.invoiceDialog.loading = true;
this.invoiceDialog.page.current = 1;
this.invoiceDialog.current = null;
try {
if (!this.recordId) {
if (!this.invoicePoolMockLoaded) await this.loadInvoicePoolMockRows();
this.invoiceDialog.sourceRows = this.filterInvoicePoolMockRows(
this.invoiceDialog.keyword
);
this.refreshInvoicePoolPage();
return;
}
const data = this.unwrapData(await api.getInvoicePool(this.invoiceDialog.keyword));
this.invoiceDialog.sourceRows = Array.isArray(data) ? data : data?.records || [];
this.refreshInvoicePoolPage();
} finally {
this.invoiceDialog.loading = false;
}
},
async loadInvoicePoolMockRows() {
const pageSize = 500;
const firstData = this.unwrapData(await getCustomerList(1, pageSize, {}));
const firstRows = Array.isArray(firstData) ? firstData : firstData?.records || [];
const total = Number(firstData?.total || firstRows.length);
const pageCount = Math.ceil(total / pageSize);
const remainingPages = await Promise.all(
Array.from({ length: Math.max(pageCount - 1, 0) }, (_, index) =>
getCustomerList(index + 2, pageSize, {})
)
);
const customers = [
...firstRows,
...remainingPages.flatMap(response => {
const data = this.unwrapData(response);
return Array.isArray(data) ? data : data?.records || [];
}),
].filter(
(customer, index, rows) =>
rows.findIndex(item => String(item.id) === String(customer.id)) === index
);
const userInfo = this.$store.getters.userInfo || {};
const counterpartyName = userInfo.deptName || userInfo.dept_name || '本企业';
this.invoicePoolMockRows = createInvoicePoolMockRows(
customers,
counterpartyName,
userInfo.email || ''
);
this.invoicePoolMockLoaded = true;
},
refreshInvoicePoolPage() {
const page = this.invoiceDialog.page;
const total = this.invoiceDialog.sourceRows.length;
const maxPage = Math.max(Math.ceil(total / page.size), 1);
if (page.current > maxPage) page.current = maxPage;
const start = (page.current - 1) * page.size;
page.total = total;
this.invoiceDialog.current = null;
this.invoiceDialog.rows = this.invoiceDialog.sourceRows.slice(start, start + page.size);
},
handleInvoicePoolSizeChange() {
this.invoiceDialog.page.current = 1;
this.refreshInvoicePoolPage();
},
filterInvoicePoolMockRows(keyword) {
const normalizedKeyword = String(keyword || '')
.trim()
.toLowerCase();
if (!normalizedKeyword) return this.invoicePoolMockRows.map(item => ({ ...item }));
return this.invoicePoolMockRows
.filter(item =>
[item.invoiceNo, item.issuerName, item.receiverName].some(value =>
String(value || '')
.toLowerCase()
.includes(normalizedKeyword)
)
)
.map(item => ({ ...item }));
}, },
confirmInvoice(row, options = {}) { confirmInvoice(row, options = {}) {
const selected = row?.id ? row : this.invoiceDialog.current; const selected = row;
if (!selected) { if (!selected) {
this.$message.warning('请选择一张金蝶票据池发票'); this.$message.warning('请选择一张金蝶票据池发票');
return; return;
} }
const preserveUserInput = options.preserveUserInput === true; const preserveUserInput = options.preserveUserInput === true;
Object.assign(this.form, { Object.assign(this.form, {
kingdeeInvoicePoolId: selected.id,
invoiceNo: selected.invoiceNo, invoiceNo: selected.invoiceNo,
invoiceDate: selected.invoiceDate, invoiceDate: selected.invoiceDate,
invoiceType: selected.invoiceType, invoiceType: selected.invoiceType,
@@ -596,8 +393,6 @@ export default {
bankName: selected.bankName, bankName: selected.bankName,
bankAccount: selected.bankAccount, bankAccount: selected.bankAccount,
issuingBank: selected.issuingBank, issuingBank: selected.issuingBank,
kingdeeBillNo: selected.kingdeeBillNo || '',
kingdeeStatus: selected.kingdeeStatus || 'unsynced',
phone: preserveUserInput ? this.form.phone : selected.phone || '', phone: preserveUserInput ? this.form.phone : selected.phone || '',
customerEmails: preserveUserInput customerEmails: preserveUserInput
? this.form.customerEmails ? this.form.customerEmails
@@ -708,7 +503,6 @@ export default {
payload() { payload() {
return { return {
id: this.form.id, id: this.form.id,
kingdeeInvoicePoolId: this.form.kingdeeInvoicePoolId,
invoiceNo: this.form.invoiceNo, invoiceNo: this.form.invoiceNo,
invoiceDate: this.form.invoiceDate, invoiceDate: this.form.invoiceDate,
invoiceType: this.form.invoiceType, invoiceType: this.form.invoiceType,
@@ -720,8 +514,6 @@ export default {
bankName: this.form.bankName, bankName: this.form.bankName,
bankAccount: this.form.bankAccount, bankAccount: this.form.bankAccount,
issuingBank: this.form.issuingBank, issuingBank: this.form.issuingBank,
kingdeeBillNo: this.form.kingdeeBillNo,
kingdeeStatus: this.form.kingdeeStatus,
phone: this.form.phone, phone: this.form.phone,
customerEmails: this.form.customerEmails.join(';'), customerEmails: this.form.customerEmails.join(';'),
departmentEmails: this.form.departmentEmails.join(';'), departmentEmails: this.form.departmentEmails.join(';'),
@@ -758,13 +550,12 @@ export default {
this.$message.warning('请先选择金蝶票据池发票'); this.$message.warning('请先选择金蝶票据池发票');
return; return;
} }
const data = this.recordId const data = this.unwrapData(
? this.unwrapData(await api.getInvoicePool(this.form.invoiceNo)) await api.queryInvoicePool({ current: 1, size: 1, invoiceNo: this.form.invoiceNo })
: this.filterInvoicePoolMockRows(this.form.invoiceNo); );
const rows = Array.isArray(data) ? data : data?.records || []; const invoice = (data.records || []).find(item => item.invoiceNo === this.form.invoiceNo);
const invoice = rows.find(item => item.invoiceNo === this.form.invoiceNo);
if (!invoice) { if (!invoice) {
this.$message.warning('金蝶票据池中未查询到该发票'); this.$message.warning('金蝶票池未查询到该发票');
return; return;
} }
if (!this.confirmInvoice(invoice, { preserveUserInput: true })) return; if (!this.confirmInvoice(invoice, { preserveUserInput: true })) return;
@@ -827,11 +618,6 @@ export default {
.receipt-form-page__dialog-search .el-input { .receipt-form-page__dialog-search .el-input {
width: 360px; width: 360px;
} }
.receipt-form-page__dialog-pagination {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
.receipt-form-page :deep(.el-table) { .receipt-form-page :deep(.el-table) {
--el-table-border-color: #eff1f7; --el-table-border-color: #eff1f7;
} }
+21 -12
View File
@@ -40,10 +40,10 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-if="searchExpanded" label="金蝶单据状态"> <el-form-item v-if="searchExpanded" label="金蝶状态">
<el-select v-model="query.kingdeeStatus" clearable placeholder="请选择"> <el-select v-model="query.kingdeePushStatus" clearable placeholder="请选择">
<el-option <el-option
v-for="item in kingdeeStatusOptions" v-for="item in kingdeePushStatusOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
@@ -70,7 +70,7 @@
v-if="hasPermission('invoice_receipt_sync')" v-if="hasPermission('invoice_receipt_sync')"
type="primary" type="primary"
plain plain
@click="handleBatchSync" @click="handlePushKingdee"
>批量同步</el-button >批量同步</el-button
> >
<el-button v-if="hasPermission('invoice_receipt_add')" type="primary" @click="openCreate" <el-button v-if="hasPermission('invoice_receipt_add')" type="primary" @click="openCreate"
@@ -244,7 +244,7 @@ const emptyQuery = () => ({
deptName: '', deptName: '',
deptPath: [], deptPath: [],
approvalStatus: '', approvalStatus: '',
kingdeeStatus: '', kingdeePushStatus: '',
}); });
export default { export default {
@@ -258,7 +258,7 @@ export default {
query: emptyQuery(), query: emptyQuery(),
searchExpanded: false, searchExpanded: false,
approvalStatusOptions: api.approvalStatusOptions, approvalStatusOptions: api.approvalStatusOptions,
kingdeeStatusOptions: api.kingdeeStatusOptions, kingdeePushStatusOptions: api.kingdeePushStatusOptions,
columns: invoiceReceiptTableColumns, columns: invoiceReceiptTableColumns,
rows: [], rows: [],
selection: [], selection: [],
@@ -363,15 +363,23 @@ export default {
this.$message.success('作废成功'); this.$message.success('作废成功');
this.loadTable(); this.loadTable();
}, },
async handleBatchSync() { async handlePushKingdee() {
const rows = this.selection.filter(row => row.approvalStatus === 'approved'); const rows = this.selection.filter(row => row.approvalStatus === 'approved');
if (!rows.length) { if (!rows.length) {
this.$message.warning('请选择至少一条审批通过的收票登记'); this.$message.warning('请选择至少一条审批通过的收票登记');
return; return;
} }
await Promise.all(rows.map(row => api.syncKingdee(row.id))); await this.$confirm(`确认将选中的 ${rows.length} 条收票登记同步至金蝶?`, '提示', {
this.$message.success(`已同步${rows.length}条收票登记`); type: 'warning',
this.loadTable(); });
const summary = this.unwrapData(await api.pushKingdee(rows.map(row => row.id)));
await this.loadTable();
// 附件联带同步提示:推送成功但附件未全部上传时在结果弹窗追加说明,重推即自动补传
const idSet = new Set(rows.map(row => String(row.id)));
const pendingCount = (this.rows || []).filter(row => idSet.has(String(row.id))
&& ['pending', 'partial'].includes(row.attachmentSyncStatus)).length;
const attachmentTip = pendingCount ? `\n其中${pendingCount}单附件未全部上传,可重推补传` : '';
this.$alert((summary || '推送完成') + attachmentTip, '推送结果', { confirmButtonText: '知道了' });
}, },
async handleExport() { async handleExport() {
const data = this.unwrapData(await api.getList(1, 100000, this.query)); const data = this.unwrapData(await api.getList(1, 100000, this.query));
@@ -388,8 +396,9 @@ export default {
当前处理人: item.currentProcessor, 当前处理人: item.currentProcessor,
创建人: item.createUserName, 创建人: item.createUserName,
创建时间: item.createTime, 创建时间: item.createTime,
金蝶单据号: item.kingdeeBillNo, 金蝶单据号: item.kingdeeReceivedInvoiceNo,
金蝶单据状态: item.kingdeeStatusName, 金蝶状态: item.kingdeePushStatusName,
失败原因: item.kingdeePushMsg,
})); }));
const workbook = XLSX.utils.book_new(); const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, XLSX.utils.json_to_sheet(exportRows), '收票登记'); XLSX.utils.book_append_sheet(workbook, XLSX.utils.json_to_sheet(exportRows), '收票登记');
+45 -5
View File
@@ -237,8 +237,18 @@
<el-table-column label="操作" width="220" fixed="right" align="center"> <el-table-column label="操作" width="220" fixed="right" align="center">
<template #default="{ row, $index }"> <template #default="{ row, $index }">
<div class="payment-form-page__invoice-actions"> <div class="payment-form-page__invoice-actions">
<el-link type="primary" @click="viewInvoiceAttachment(row)">查看</el-link> <el-link
<el-link type="primary" @click="downloadInvoiceAttachment(row)">下载</el-link> type="primary"
:disabled="kingdeeAttachmentBusy"
@click="viewInvoiceAttachment(row)"
>查看</el-link
>
<el-link
type="primary"
:disabled="kingdeeAttachmentBusy"
@click="downloadInvoiceAttachment(row)"
>下载</el-link
>
<el-link <el-link
v-if="!readonly" v-if="!readonly"
type="danger" type="danger"
@@ -608,6 +618,11 @@ import {
} from '@/api/vehicle/customer-archive'; } from '@/api/vehicle/customer-archive';
import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer'; import { readSettlementTransfer, removeSettlementTransfer } from '@/utils/settlement-transfer';
import { downloadFileByUrl } from '@/utils/util'; import { downloadFileByUrl } from '@/utils/util';
import {
downloadKingdeeInvoiceFile,
isKingdeePathAttachment,
viewKingdeeInvoiceFile,
} from '@/utils/kingdee-attachment';
import PdfPreview from '@/components/pdf-preview/main.vue'; import PdfPreview from '@/components/pdf-preview/main.vue';
const attachmentViewerPlugins = [ const attachmentViewerPlugins = [
@@ -688,6 +703,8 @@ export default {
form: emptyForm(), form: emptyForm(),
amountSyncing: false, amountSyncing: false,
transferPayload: null, transferPayload: null,
// 金蝶侧发票附件查看/下载进行中(行组级 loading 守卫)
kingdeeAttachmentBusy: false,
referenceRows: [], referenceRows: [],
paymentRecords: [], paymentRecords: [],
referenceVisible: false, referenceVisible: false,
@@ -1390,8 +1407,19 @@ export default {
this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf` this.attachmentFileName(this.invoiceAttachment(row)) || `${row.invoiceNo || '发票'}.pdf`
); );
}, },
viewInvoiceAttachment(row) { async viewInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row); const attachment = this.invoiceAttachment(row);
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持本地预览组件
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
}
return;
}
if (!this.attachmentFileUrl(attachment)) { if (!this.attachmentFileUrl(attachment)) {
this.$message.warning('当前发票暂无可查看附件'); this.$message.warning('当前发票暂无可查看附件');
return; return;
@@ -1401,8 +1429,20 @@ export default {
[attachment] [attachment]
); );
}, },
downloadInvoiceAttachment(row) { async downloadInvoiceAttachment(row) {
const url = this.invoiceAttachmentUrl(row); const attachment = this.invoiceAttachment(row);
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
}
return;
}
const url = this.attachmentFileUrl(attachment);
if (!url) { if (!url) {
this.$message.warning('当前发票暂无可下载附件'); this.$message.warning('当前发票暂无可下载附件');
return; return;
+39 -3
View File
@@ -84,6 +84,13 @@
@click="handleSync" @click="handleSync"
>批量同步</el-button >批量同步</el-button
> >
<el-button
v-if="hasPermission('payment_application_sync')"
type="primary"
plain
@click="handleSyncResult"
>同步付款结果</el-button
>
<el-button <el-button
v-if="hasPermission('payment_application_add')" v-if="hasPermission('payment_application_add')"
type="primary" type="primary"
@@ -388,7 +395,8 @@ export default {
async handleSyncRow(row) { async handleSyncRow(row) {
const data = this.unwrapData(await api.syncKingdee(row.id)); const data = this.unwrapData(await api.syncKingdee(row.id));
this.$message.success(`已生成金蝶付款单:${data}`); this.$message.success(`已生成金蝶付款单:${data}`);
this.loadTable(); await this.loadTable();
this.warnAttachmentNotUploaded([row.id]);
}, },
async handleSync() { async handleSync() {
const rows = this.selection.filter(row => row.approvalStatus === 'approved'); const rows = this.selection.filter(row => row.approvalStatus === 'approved');
@@ -396,8 +404,36 @@ export default {
this.$message.warning('请选择至少一条审批通过的付款申请'); this.$message.warning('请选择至少一条审批通过的付款申请');
return; return;
} }
await api.syncKingdeeBatch(rows.map(row => row.id)); const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || [];
this.$message.success(`已同步${rows.length}条付款申请`); const failedList = data.filter(item => String(item).includes('同步失败'));
if (failedList.length) {
this.$message({
type: 'warning',
message: `同步完成:成功${data.length - failedList.length}条,失败${failedList.length}条。${failedList.join(';')}`,
duration: 8000,
});
} else {
this.$message.success(`已同步${data.length}条付款申请`);
}
await this.loadTable();
this.warnAttachmentNotUploaded(rows.map(row => row.id));
},
// 附件联带同步提示:同步成功但附件未全部上传时追加 warning,重推即自动补传
warnAttachmentNotUploaded(ids) {
const idSet = new Set(ids.map(String));
const pendingCount = (this.rows || []).filter(row => idSet.has(String(row.id))
&& ['pending', 'partial'].includes(row.attachmentSyncStatus)).length;
if (pendingCount) {
this.$message({
type: 'warning',
message: `其中${pendingCount}单附件未全部上传,可重推补传`,
duration: 8000,
});
}
},
async handleSyncResult() {
const data = this.unwrapData(await api.syncKingdeeResult());
this.$message.success(data || '金蝶付款结果回写完成');
this.loadTable(); this.loadTable();
}, },
handleExport() { handleExport() {
@@ -22,6 +22,7 @@
type="date" type="date"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
placeholder="请选择" placeholder="请选择"
@change="fetchBfiExchangeRate"
/> />
<el-select <el-select
v-else-if="field.type === 'project' && editable" v-else-if="field.type === 'project' && editable"
@@ -402,8 +403,18 @@
<el-table-column label="操作" width="220" align="center"> <el-table-column label="操作" width="220" align="center">
<template #default="{ row, $index }"> <template #default="{ row, $index }">
<div class="formal-editor__links"> <div class="formal-editor__links">
<el-link type="primary" @click="viewInvoiceAttachment(row)">查看</el-link> <el-link
<el-link type="primary" @click="downloadInvoiceAttachment(row)">下载</el-link> type="primary"
:disabled="kingdeeAttachmentBusy"
@click="viewInvoiceAttachment(row)"
>查看</el-link
>
<el-link
type="primary"
:disabled="kingdeeAttachmentBusy"
@click="downloadInvoiceAttachment(row)"
>下载</el-link
>
<el-link v-if="editable" type="danger" @click="removeInvoice($index)">删除</el-link> <el-link v-if="editable" type="danger" @click="removeInvoice($index)">删除</el-link>
</div> </div>
</template> </template>
@@ -411,66 +422,15 @@
</el-table> </el-table>
</section-card> </section-card>
<el-dialog <kingdee-invoice-pool-dialog
v-model="invoiceClaimDialog.visible" v-model="invoiceClaimDialog.visible"
title="查询可认领发票" title="查询可认领发票"
width="92%" confirm-text="确认认领"
append-to-body multiple
destroy-on-close :initial-invoice-no="String(invoiceClaimNo || '').trim()"
> :query-api="invoicePoolQueryApi"
<el-table @confirm="handleInvoiceClaimConfirm"
ref="invoiceClaimTable" />
v-loading="invoiceClaimDialog.loading"
:data="invoiceClaimPagedRows"
row-key="invoiceNo"
border
height="520"
@selection-change="invoiceClaimDialog.selected = $event"
>
<el-table-column
type="selection"
width="52"
fixed="left"
align="center"
reserve-selection
/>
<el-table-column type="index" label="序号" width="64" align="center" />
<el-table-column prop="invoiceNo" label="发票号" min-width="180" align="center" />
<el-table-column prop="invoiceDate" label="开票日期" min-width="130" align="center" />
<el-table-column prop="invoiceType" label="发票类型" min-width="150" align="center" />
<el-table-column prop="issuerName" label="开票单位" min-width="180" align="center" />
<el-table-column prop="receiverName" label="受票单位" min-width="180" align="center" />
<el-table-column
prop="invoiceAmount"
label="发票金额(含税)"
min-width="160"
align="right"
>
<template #default="{ row }">{{ formatMoney(row.invoiceAmount) }}</template>
</el-table-column>
<el-table-column prop="matchedAmount" label="认领金额" min-width="140" align="right">
<template #default="{ row }">{{ formatMoney(row.matchedAmount) }}</template>
</el-table-column>
</el-table>
<div class="formal-editor__pagination">
<el-pagination
v-model:current-page="invoiceClaimDialog.page.current"
v-model:page-size="invoiceClaimDialog.page.size"
:total="invoiceClaimDialog.page.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
/>
</div>
<template #footer>
<el-button @click="invoiceClaimDialog.visible = false">取消</el-button>
<el-button
type="primary"
:loading="invoiceClaimDialog.confirming"
@click="confirmInvoiceClaims"
>确认认领</el-button
>
</template>
</el-dialog>
<section-card <section-card
v-if="readonly" v-if="readonly"
@@ -940,6 +900,7 @@ import {
getNextNo, getNextNo,
getReceiptClaims, getReceiptClaims,
claimInvoices as claimInvoicesApi, claimInvoices as claimInvoicesApi,
queryInvoicePool,
save, save,
} from '@/api/settlement/formalSettlement'; } from '@/api/settlement/formalSettlement';
import { import {
@@ -947,6 +908,7 @@ import {
getDetailFees as getPreSettlementDetailFees, getDetailFees as getPreSettlementDetailFees,
} from '@/api/settlement/preSettlement'; } from '@/api/settlement/preSettlement';
import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail'; import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail';
import { getBfiExchangeRate } from '@/api/base/currency';
import { import {
createFormalSettlementForm, createFormalSettlementForm,
formalSettlementFormFields, formalSettlementFormFields,
@@ -963,11 +925,17 @@ import { h } from 'vue';
import { InfoFilled } from '@element-plus/icons-vue'; import { InfoFilled } from '@element-plus/icons-vue';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { downloadFileByUrl } from '@/utils/util'; import { downloadFileByUrl } from '@/utils/util';
import {
downloadKingdeeInvoiceFile,
isKingdeePathAttachment,
viewKingdeeInvoiceFile,
} from '@/utils/kingdee-attachment';
import KingdeeInvoicePoolDialog from '@/components/kingdee-invoice-pool-dialog/main.vue';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
export default { export default {
name: 'FormalSettlementEditor', name: 'FormalSettlementEditor',
components: { InfoFilled }, components: { InfoFilled, KingdeeInvoicePoolDialog },
props: { props: {
modelValue: Boolean, modelValue: Boolean,
recordId: [String, Number], recordId: [String, Number],
@@ -997,13 +965,12 @@ export default {
invoices: [], invoices: [],
invoiceClaimNo: '', invoiceClaimNo: '',
invoiceClaimLoading: false, invoiceClaimLoading: false,
// 金蝶侧发票附件查看/下载进行中(行组级 loading 守卫)
kingdeeAttachmentBusy: false,
invoiceClaimDialog: { invoiceClaimDialog: {
visible: false, visible: false,
loading: false,
confirming: false,
rows: [],
selected: [], selected: [],
page: { current: 1, size: 10, total: 0 }, confirming: false,
}, },
attachmentUploadFiles: [], attachmentUploadFiles: [],
attachmentTypeOptions: [], attachmentTypeOptions: [],
@@ -1146,11 +1113,6 @@ export default {
}); });
return Array.from(names); return Array.from(names);
}, },
invoiceClaimPagedRows() {
const { current, size } = this.invoiceClaimDialog.page;
const start = (current - 1) * size;
return this.invoiceClaimDialog.rows.slice(start, start + size);
},
}, },
watch: { watch: {
modelValue: { modelValue: {
@@ -1229,7 +1191,6 @@ export default {
this.invoices = []; this.invoices = [];
this.invoiceClaimNo = ''; this.invoiceClaimNo = '';
this.invoiceClaimDialog.visible = false; this.invoiceClaimDialog.visible = false;
this.invoiceClaimDialog.rows = [];
this.invoiceClaimDialog.selected = []; this.invoiceClaimDialog.selected = [];
this.attachmentUploadFiles = []; this.attachmentUploadFiles = [];
this.billingRuleDialog = { this.billingRuleDialog = {
@@ -1250,6 +1211,7 @@ export default {
if (this.initialData) await this.applyInitialData(); if (this.initialData) await this.applyInitialData();
Object.assign(this.form, newRecordAudit); Object.assign(this.form, newRecordAudit);
await this.refreshFormalSettlementNo(); await this.refreshFormalSettlementNo();
await this.fetchBfiExchangeRate();
return; return;
} }
this.loading = true; this.loading = true;
@@ -1482,6 +1444,7 @@ export default {
(settlementType === 'receivable' ? contract.partyA : contract.partyB), (settlementType === 'receivable' ? contract.partyA : contract.partyB),
settlementType, settlementType,
settlementTypeName: settlementType === 'receivable' ? '应收' : '应付', settlementTypeName: settlementType === 'receivable' ? '应收' : '应付',
currency: contract.settlementCurrency || 'RMB',
}); });
this.sources = []; this.sources = [];
this.details = []; this.details = [];
@@ -1489,6 +1452,23 @@ export default {
this.form.sourcePreSettlementIds = []; this.form.sourcePreSettlementIds = [];
this.form.sourceDetailIds = []; this.form.sourceDetailIds = [];
if (refreshSettlementNo) this.refreshFormalSettlementNo(); if (refreshSettlementNo) this.refreshFormalSettlementNo();
if (this.form.currency !== 'RMB') this.fetchBfiExchangeRate();
},
async fetchBfiExchangeRate() {
const currency = this.form.currency;
if (!currency || currency === 'RMB') return;
if (!this.form.exchangeRateDate) return;
try {
const { data } = await getBfiExchangeRate(currency, this.form.exchangeRateDate);
const rateData = data?.data;
if (rateData?.excval != null) {
this.form.exchangeRate = Number(rateData.excval);
} else {
this.$message.warning(`未查询到 ${currency} 的BFI汇率数据`);
}
} catch (e) {
this.$message.warning('查询BFI汇率失败,请手动输入结算汇率');
}
}, },
openCandidateDialog() { openCandidateDialog() {
this.candidate.visible = true; this.candidate.visible = true;
@@ -2202,79 +2182,19 @@ export default {
this.adjust.saving = false; this.adjust.saving = false;
} }
}, },
claimInvoices() {
this.invoiceClaimLoading = true;
try {
const keyword = String(this.invoiceClaimNo || '').trim();
const defaultNo = `MOCK${this.$dayjs().format('YYYYMMDD')}`;
const baseNo = (keyword || defaultNo).slice(0, 29);
const numbers = [baseNo, `${baseNo}-02`, `${baseNo}-03`];
const invoiceAmounts = [1000, 2000, 3000];
const availableAmounts = [1000, 1000, 3000];
const preferredMatchedAmounts = [1000, 1000, 2000];
let remainingAmount = Math.max(
Number(this.form.settlementAmount || this.summaryTotal || 0) -
this.invoices.reduce((total, item) => total + Number(item.matchedAmount || 0), 0),
0
);
const existingNumbers = new Set(this.invoices.map(item => String(item.invoiceNo)));
const mockRows = numbers
.map((invoiceNo, index) => {
const matchedAmount = Math.min(
preferredMatchedAmounts[index],
availableAmounts[index],
remainingAmount
);
remainingAmount = Number((remainingAmount - matchedAmount).toFixed(2));
return {
invoiceNo,
invoiceDate: this.$dayjs().subtract(index, 'day').format('YYYY-MM-DD'),
invoiceType: index === 1 ? '增值税普通发票' : '增值税专用发票',
taxRate: [3, 6, 9][index],
invoiceAmount: invoiceAmounts[index],
availableInvoiceAmount: availableAmounts[index],
matchedAmount,
attachmentJson: '',
mockData: true,
};
})
.filter(item => !existingNumbers.has(item.invoiceNo));
if (!mockRows.length) {
this.$message.warning('当前发票号码的Mock数据已认领');
return;
}
this.invoices = [...this.invoices, ...mockRows];
this.$message.success(`已生成${mockRows.length}条Mock发票数据`);
} finally {
this.invoiceClaimLoading = false;
}
},
openInvoiceClaimDialog() { openInvoiceClaimDialog() {
const stamp = Date.now();
this.invoiceClaimDialog.loading = true;
this.invoiceClaimDialog.rows = Array.from({ length: 80 }, (_, index) => {
const amount = Math.floor(1000 + Math.random() * 49000);
return {
invoiceNo: `MOCK${stamp}${String(index + 1).padStart(3, '0')}`.slice(0, 32),
invoiceDate: this.$dayjs()
.subtract(Math.floor(Math.random() * 90), 'day')
.format('YYYY-MM-DD'),
invoiceType: index % 2 ? '增值税普通发票' : '增值税专用发票',
issuerName: this.form.payerName || 'Mock开票单位',
receiverName: this.form.payeeName || 'Mock受票单位',
invoiceAmount: amount,
availableInvoiceAmount: amount,
matchedAmount: amount,
taxRate: [3, 6, 9, 13][index % 4],
attachmentJson: '',
mockData: true,
};
});
this.invoiceClaimDialog.selected = [];
this.invoiceClaimDialog.page.current = 1;
this.invoiceClaimDialog.page.total = 80;
this.invoiceClaimDialog.visible = true; this.invoiceClaimDialog.visible = true;
this.invoiceClaimDialog.loading = false; },
invoicePoolQueryApi(params) {
return queryInvoicePool(params);
},
async handleInvoiceClaimConfirm(rows) {
// 统一票池行附件字段为复数 attachmentsJson,认领请求契约是单数 attachmentJson,中转处归一
this.invoiceClaimDialog.selected = rows.map(row => ({
...row,
attachmentJson: row.attachmentJson || row.attachmentsJson,
}));
await this.confirmInvoiceClaims();
}, },
async confirmInvoiceClaims() { async confirmInvoiceClaims() {
if (!this.invoiceClaimDialog.selected.length) { if (!this.invoiceClaimDialog.selected.length) {
@@ -2300,7 +2220,11 @@ export default {
if (Number(this.form.settlementAmount || 0) > 0) { if (Number(this.form.settlementAmount || 0) > 0) {
remaining = Math.max(0, remaining - matchedAmount); remaining = Math.max(0, remaining - matchedAmount);
} }
return { ...row, matchedAmount }; return {
...row,
invoiceType: row.invoiceTypeName || row.invoiceType || '',
matchedAmount,
};
}) })
.filter(row => row.matchedAmount > 0); .filter(row => row.matchedAmount > 0);
if (!invoices.length) { if (!invoices.length) {
@@ -2386,14 +2310,38 @@ export default {
const attachment = this.invoiceAttachment(row); const attachment = this.invoiceAttachment(row);
return attachment.originalName || attachment.name || `${row.invoiceNo || '发票'}.pdf`; return attachment.originalName || attachment.name || `${row.invoiceNo || '发票'}.pdf`;
}, },
viewInvoiceAttachment(row) { async viewInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row);
// 金蝶侧附件(path 型)经后端代理 A801-2 预览,OSS 直链维持 window.open
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await viewKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
}
return;
}
const url = this.invoiceAttachmentUrl(row); const url = this.invoiceAttachmentUrl(row);
if (!url) return this.$message.warning('当前Mock发票暂无可查看附件'); if (!url) return this.$message.warning('当前发票暂无可查看附件');
window.open(url, '_blank'); window.open(url, '_blank');
}, },
downloadInvoiceAttachment(row) { async downloadInvoiceAttachment(row) {
const attachment = this.invoiceAttachment(row);
// 金蝶侧附件(path 型)经后端代理 A801-2 下载,OSS 直链维持前端直连下载
if (isKingdeePathAttachment(attachment)) {
if (this.kingdeeAttachmentBusy) return;
this.kingdeeAttachmentBusy = true;
try {
await downloadKingdeeInvoiceFile(row.invoiceNo, this.invoiceAttachmentName(row));
} finally {
this.kingdeeAttachmentBusy = false;
}
return;
}
const url = this.invoiceAttachmentUrl(row); const url = this.invoiceAttachmentUrl(row);
if (!url) return this.$message.warning('当前Mock发票暂无可下载附件'); if (!url) return this.$message.warning('当前发票暂无可下载附件');
downloadFileByUrl(url, this.invoiceAttachmentName(row)); downloadFileByUrl(url, this.invoiceAttachmentName(row));
}, },
buildSavePayload() { buildSavePayload() {
@@ -42,7 +42,7 @@
format="YYYY-MM-DD" format="YYYY-MM-DD"
:disabled="!editable || form.currency === 'RMB'" :disabled="!editable || form.currency === 'RMB'"
placeholder="请选择" placeholder="请选择"
@change="recalculateLocalAmount" @change="handleExchangeRateDateChange"
/> />
<el-input-number <el-input-number
v-else-if="field.type === 'number'" v-else-if="field.type === 'number'"
@@ -934,6 +934,7 @@ import {
submit, submit,
} from '@/api/settlement/preSettlement'; } from '@/api/settlement/preSettlement';
import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail'; import { calculateAdjustedFee, getFeeDetail } from '@/api/settlement/receivable-payable-detail';
import { getBfiExchangeRate } from '@/api/base/currency';
import { getDictionary } from '@/api/system/dictbiz'; import { getDictionary } from '@/api/system/dictbiz';
import { import {
emptyPreSettlementForm, emptyPreSettlementForm,
@@ -1242,7 +1243,11 @@ export default {
await this.loadFeeCategoryOptions(); await this.loadFeeCategoryOptions();
await this.loadTransportTypeOptions(); await this.loadTransportTypeOptions();
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();
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
await this.fetchBfiExchangeRate();
}
}, },
async applyInitialData() { async applyInitialData() {
const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : []; const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : [];
@@ -1527,7 +1532,12 @@ export default {
this.form.settlementType = contract.settlementType || 'payable'; this.form.settlementType = contract.settlementType || 'payable';
this.form.payerName = contract.partyA; this.form.payerName = contract.partyA;
this.form.payeeName = contract.partyB; this.form.payeeName = contract.partyB;
this.form.currency = contract.settlementCurrency || 'RMB';
this.summaryFees = []; this.summaryFees = [];
if (this.form.currency !== 'RMB') {
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
this.fetchBfiExchangeRate();
}
}, },
async saveDraft(shouldSubmit) { async saveDraft(shouldSubmit) {
await this.$refs.formRef?.validate(); await this.$refs.formRef?.validate();
@@ -1794,6 +1804,26 @@ export default {
.toFixed(2) .toFixed(2)
); );
}, },
handleExchangeRateDateChange() {
this.fetchBfiExchangeRate();
this.recalculateLocalAmount();
},
async fetchBfiExchangeRate() {
if (!this.form.currency || this.form.currency === 'RMB') return;
if (!this.form.exchangeRateDate) return;
try {
const { data } = await getBfiExchangeRate(this.form.currency, this.form.exchangeRateDate);
const rateData = data?.data;
if (rateData?.excval != null) {
this.form.exchangeRate = Number(rateData.excval);
this.recalculateLocalAmount();
} else {
this.$message.warning(`未查询到 ${this.form.currency} 的BFI汇率数据`);
}
} catch (e) {
this.$message.warning('查询BFI汇率失败,请手动输入结算汇率');
}
},
recalculateLocalAmount() { recalculateLocalAmount() {
const rate = this.form.currency === 'RMB' ? 1 : Number(this.form.exchangeRate || 0); const rate = this.form.currency === 'RMB' ? 1 : Number(this.form.exchangeRate || 0);
this.form.localSettlementAmount = (Number(this.form.settlementAmount || 0) * rate).toFixed(2); this.form.localSettlementAmount = (Number(this.form.settlementAmount || 0) * rate).toFixed(2);
+10 -1
View File
@@ -379,7 +379,16 @@ export default {
const response = await api.syncKingdee(row.id); const response = await api.syncKingdee(row.id);
const data = this.unwrapData(response); const data = this.unwrapData(response);
this.$message.success(`同步成功,金蝶单据号:${data}`); this.$message.success(`同步成功,金蝶单据号:${data}`);
this.loadTable(); await this.loadTable();
// 附件联带同步提示:同步成功但附件未全部上传时追加 warning,重推即自动补传
const freshRow = (this.rows || []).find(item => String(item.id) === String(row.id));
if (freshRow && ['pending', 'partial'].includes(freshRow.attachmentSyncStatus)) {
this.$message({
type: 'warning',
message: '该单附件未全部上传,可重推补传',
duration: 8000,
});
}
}, },
async openPaymentDialog() { async openPaymentDialog() {
if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单'); if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单');
@@ -169,6 +169,12 @@
</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>
@@ -2728,6 +2734,12 @@ 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;
+1 -38
View File
@@ -22,14 +22,6 @@
@tree-load="treeLoad" @tree-load="treeLoad"
> >
<template #menu-left> <template #menu-left>
<el-button
type="primary"
plain
:loading="iamSyncLoading"
v-if="userInfo.authority.includes('admin')"
@click="handleIamOrganizationSync"
>同步组织
</el-button>
<el-button <el-button
type="danger" type="danger"
icon="el-icon-delete" icon="el-icon-delete"
@@ -128,15 +120,7 @@
</template> </template>
<script> <script>
import { import { getLazyList, remove, update, add, getDept, getDeptTree } from '@/api/system/dept';
getLazyList,
remove,
update,
add,
getDept,
getDeptTree,
syncIamOrganizations,
} 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';
@@ -168,7 +152,6 @@ export default {
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
iamSyncLoading: false,
parentId: 0, parentId: 0,
page: { page: {
pageSize: 10, pageSize: 10,
@@ -708,26 +691,6 @@ export default {
done(row); done(row);
}); });
}, },
handleIamOrganizationSync() {
this.$confirm('确定从IAM同步组织信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.iamSyncLoading = true;
return syncIamOrganizations();
})
.then(res => {
const count = res?.data?.data ?? 0;
this.$message.success(`IAM组织同步完成,共处理${count}条`);
this.parentId = 0;
this.onLoad(this.page, this.query);
})
.finally(() => {
this.iamSyncLoading = false;
});
},
handleDelete() { handleDelete() {
if (this.selectionList.length === 0) { if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据'); this.$message.warning('请选择至少一条数据');
-29
View File
@@ -56,14 +56,6 @@
@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
@@ -356,7 +348,6 @@ import {
remove, remove,
update, update,
add, add,
syncIamAccounts,
grant, grant,
resetPassword, resetPassword,
setPassword, setPassword,
@@ -402,7 +393,6 @@ export default {
selectionList: [], selectionList: [],
query: {}, query: {},
loading: true, loading: true,
iamSyncLoading: false,
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@@ -563,25 +553,6 @@ export default {
this.handleExport(); this.handleExport();
} }
}, },
handleIamSync() {
this.$confirm('确定从IAM同步人员信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.iamSyncLoading = true;
return syncIamAccounts();
})
.then(res => {
const count = res?.data?.data ?? 0;
this.$message.success(`IAM人员同步完成,共处理${count}条`);
this.onLoad(this.page, this.query);
})
.finally(() => {
this.iamSyncLoading = 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 ? '取消主管成功!' : '设置主管成功!';
+2 -5
View File
@@ -1892,13 +1892,10 @@ export default {
overflow: hidden; overflow: hidden;
} }
// 大尺寸模式:跟随列宽自适应(最大 240px,约 1.586:1 证件比例), // 大尺寸模式:缩成 1.586:1 比例,左对齐(不再 100% 占栏)
// 保证不同分辨率 / 系统缩放下都与上方输入框左右对齐
:deep(.driver-uploader--large) { :deep(.driver-uploader--large) {
display: block; display: block;
width: 100%; width: 240px;
max-width: 240px;
flex: none;
margin: 0; margin: 0;
} }
+1 -5
View File
@@ -1349,13 +1349,9 @@ export default {
height: 151px; height: 151px;
} }
// 大尺寸模式:跟随列宽自适应(最大 248px),
// 保证不同分辨率 / 系统缩放下都与上方输入框左右对齐
:deep(.ship-uploader--large) { :deep(.ship-uploader--large) {
display: block; display: block;
width: 100%; width: 248px;
max-width: 248px;
flex: none;
margin: 0; margin: 0;
} }
+197 -16
View File
@@ -109,6 +109,12 @@
{{ row.status === 1 ? '启用' : '停用' }} {{ row.status === 1 ? '启用' : '停用' }}
</el-tag> </el-tag>
</template> </template>
<template #kingdeeStatus="{ row }">
<el-tag v-if="row.kingdeeStatus === 'synced'" type="success">已推送</el-tag>
<el-tag v-else-if="row.kingdeeStatus === 'exist'" type="primary">金蝶已有</el-tag>
<el-tag v-else-if="row.kingdeeStatus === 'failed'" type="danger">推送失败</el-tag>
<el-tag v-else type="info">未推送</el-tag>
</template>
<template #menu="{ row }"> <template #menu="{ row }">
<el-link <el-link
type="primary" type="primary"
@@ -165,6 +171,17 @@
> >
{{ row.status === 1 ? '停用' : '启用' }} {{ row.status === 1 ? '停用' : '启用' }}
</el-link> </el-link>
<el-link
type="primary"
v-if="
hasPermission('customer_archive_sync') &&
row.approvalStatus === 'approved' &&
row.kingdeeStatus === 'failed'
"
@click="handleSyncKingdee(row)"
>
同步金蝶
</el-link>
<el-link <el-link
type="danger" type="danger"
v-if="hasPermission('customer_archive_delete') && row.approvalStatus === 'draft'" v-if="hasPermission('customer_archive_delete') && row.approvalStatus === 'draft'"
@@ -266,6 +283,7 @@
placeholder="请输入" placeholder="请输入"
maxlength="18" maxlength="18"
show-word-limit show-word-limit
:disabled="kingdeeLocked && Boolean(archiveForm.id)"
@input=" @input="
archiveForm.unifiedCreditCode = String( archiveForm.unifiedCreditCode = String(
archiveForm.unifiedCreditCode || '' archiveForm.unifiedCreditCode || ''
@@ -281,6 +299,7 @@
placeholder="请输入" placeholder="请输入"
maxlength="100" maxlength="100"
show-word-limit show-word-limit
:disabled="kingdeeLocked"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -304,12 +323,22 @@
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="企业法人" prop="legalPerson"> <el-form-item label="企业法人" prop="legalPerson">
<el-input v-model="archiveForm.legalPerson" maxlength="10" show-word-limit /> <el-input
v-model="archiveForm.legalPerson"
maxlength="10"
show-word-limit
:disabled="kingdeeLocked"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="经营范围" prop="businessScope" required> <el-form-item label="经营范围" prop="businessScope" required>
<el-select v-model="archiveForm.businessScope" multiple filterable clearable> <el-select
v-model="archiveForm.businessScope"
multiple
filterable
clearable
>
<el-option <el-option
v-for="item in businessScopeOptions" v-for="item in businessScopeOptions"
:key="item.value" :key="item.value"
@@ -446,6 +475,7 @@
<el-input <el-input
v-model="archiveForm.registeredCapital" v-model="archiveForm.registeredCapital"
maxlength="18" maxlength="18"
:disabled="kingdeeLocked"
@input="value => handleDecimalInput('registeredCapital', value)" @input="value => handleDecimalInput('registeredCapital', value)"
/> />
</el-form-item> </el-form-item>
@@ -1492,6 +1522,8 @@ import {
remove, remove,
getScoreTemplate, getScoreTemplate,
recognizeBusinessLicenseOcr, recognizeBusinessLicenseOcr,
queryKingdeeCustomer,
syncKingdee,
} from '@/api/vehicle/customer-archive'; } from '@/api/vehicle/customer-archive';
import { import {
getList as getCreditScoreQuantificationList, getList as getCreditScoreQuantificationList,
@@ -1565,23 +1597,13 @@ export default {
const code = String(value || '') const code = String(value || '')
.trim() .trim()
.toUpperCase(); .toUpperCase();
const charset = '0123456789ABCDEFGHJKLMNPQRTUWXY';
const weights = [1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28];
if (!code) { if (!code) {
callback(); callback();
return; return;
} }
if (code.length !== 18 || ![...code].every(char => charset.includes(char))) { const error = this.unifiedCreditCodeError(code);
callback(new Error('统一社会信用代码必须为18位有效字符')); if (error) {
return; callback(new Error(error));
}
const sum = [...code.slice(0, 17)].reduce(
(total, char, index) => total + charset.indexOf(char) * weights[index],
0
);
const checkCode = charset[(31 - (sum % 31)) % 31];
if (code[17] !== checkCode) {
callback(new Error('统一社会信用代码校验码错误'));
return; return;
} }
callback(); callback();
@@ -1621,6 +1643,8 @@ export default {
originalAccessType: '', originalAccessType: '',
activeTab: 'scores', activeTab: 'scores',
archiveForm: this.emptyArchive(), archiveForm: this.emptyArchive(),
kingdeeBlocked: false,
kingdeeQueryTimer: null,
currentScore: { details: [] }, currentScore: { details: [] },
scoreRecordIndex: -1, scoreRecordIndex: -1,
scoreAttachmentFiles: [], scoreAttachmentFiles: [],
@@ -1967,6 +1991,12 @@ export default {
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
minWidth: 170, minWidth: 170,
}, },
{
label: '金蝶同步状态',
prop: 'kingdeeStatus',
slot: true,
minWidth: 110,
},
{ {
label: '状态', label: '状态',
prop: 'status', prop: 'status',
@@ -2004,6 +2034,9 @@ export default {
const authority = this.userInfo.authority || ''; const authority = this.userInfo.authority || '';
return authority.includes('admin'); return authority.includes('admin');
}, },
kingdeeLocked() {
return this.archiveForm.kingdeeStatus === 'exist';
},
permissionList() { permissionList() {
return { return {
addBtn: false, addBtn: false,
@@ -2179,6 +2212,9 @@ export default {
}, },
}, },
watch: { watch: {
'archiveForm.unifiedCreditCode'(val) {
this.handleKingdeeCreditCodeChange(val);
},
'archiveForm.registeredDetailAddress'() { 'archiveForm.registeredDetailAddress'() {
this.$nextTick(() => this.checkOverflow('registeredDetailInput', 'registeredDetailOverflow')); this.$nextTick(() => this.checkOverflow('registeredDetailInput', 'registeredDetailOverflow'));
}, },
@@ -2190,6 +2226,119 @@ export default {
hasPermission(code) { hasPermission(code) {
return this.isAdmin || this.validData(this.permission[code], false); return this.isAdmin || this.validData(this.permission[code], false);
}, },
unifiedCreditCodeError(value) {
const code = String(value || '')
.trim()
.toUpperCase();
const charset = '0123456789ABCDEFGHJKLMNPQRTUWXY';
const weights = [1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28];
if (code.length !== 18 || ![...code].every(char => charset.includes(char))) {
return '统一社会信用代码必须为18位有效字符';
}
const sum = [...code.slice(0, 17)].reduce(
(total, char, index) => total + charset.indexOf(char) * weights[index],
0
);
const checkCode = charset[(31 - (sum % 31)) % 31];
if (code[17] !== checkCode) {
return '统一社会信用代码校验码错误';
}
return '';
},
resetKingdeeQueryState() {
this.kingdeeBlocked = false;
clearTimeout(this.kingdeeQueryTimer);
this.kingdeeQueryTimer = null;
},
// 新增态下重新输入统一社会信用代码后,此前金蝶回填的数据即失效,重置回填状态并允许对新代码重新查询
resetKingdeeBackfill() {
const form = this.archiveForm;
form.kingdeeStatus = 'none';
form.fullName = '';
form.legalPerson = '';
form.registeredCapital = '';
form.registeredDetailAddress = '';
form.businessScope = [];
form.businessTermType = '固定期限';
form.businessEndDate = '';
},
// 新增态下统一社会信用代码录入完成后自动查询金蝶(A902-1),防抖 500ms;
// 代码一经变化即重新查询(含改回历史代码),不做同码去重
handleKingdeeCreditCodeChange(val) {
this.kingdeeBlocked = false;
if (this.readonly || this.archiveForm.id) return;
if (this.archiveForm.kingdeeStatus === 'exist') {
this.resetKingdeeBackfill();
}
const code = String(val || '')
.trim()
.toUpperCase();
if (code.length !== 18 || this.unifiedCreditCodeError(code)) return;
clearTimeout(this.kingdeeQueryTimer);
this.kingdeeQueryTimer = setTimeout(() => this.fetchKingdeeCustomer(code), 500);
},
async fetchKingdeeCustomer(code) {
let customer = null;
try {
const res = await queryKingdeeCustomer(code);
customer = res?.data?.data || null;
} catch (error) {
this.$message.warning('金蝶查询失败,可继续填写,审批通过后系统将自动复查');
return;
}
// 防止响应返回时用户已修改代码
if (String(this.archiveForm.unifiedCreditCode || '').trim().toUpperCase() !== code) return;
// 金蝶不存在(rows 为空,data 为 null 或空对象):静默返回,正常填写,不做提示
if (!customer || !customer.status) return;
if (customer.status === 'C') {
this.applyKingdeeCustomer(customer);
this.$alert(
'金蝶已创建该客户,将获取金蝶的工商信息,相关字段已自动回填并锁定。如信用代码有误,可直接修改,系统将重新查询。',
'提示',
{
confirmButtonText: '确定',
}
);
} else {
this.kingdeeBlocked = true;
this.$alert('金蝶审核中,请稍后重新添加。', '提示', { confirmButtonText: '确定' });
}
},
applyKingdeeCustomer(customer) {
const form = this.archiveForm;
form.kingdeeStatus = 'exist';
// 工商信息以金蝶为准,直接覆盖(后续字段锁定)
if (customer.name) form.fullName = customer.name;
if (customer.artificialperson) form.legalPerson = customer.artificialperson;
if (customer.bizpartnerAddress) form.registeredDetailAddress = customer.bizpartnerAddress;
if (customer.regcapital) {
const capital = String(customer.regcapital).replace(/,/g, '').match(/\d+(?:\.\d+)?/);
if (capital) form.registeredCapital = capital[0];
}
if (customer.businessterm) this.applyBusinessTermRecognition(customer.businessterm);
if (customer.businessscope) {
const matchedScopes = this.businessScopeOptions
.filter(
item =>
customer.businessscope.includes(item.label) ||
customer.businessscope.includes(item.value)
)
.map(item => item.value);
if (matchedScopes.length) form.businessScope = matchedScopes;
}
if (!form.shortName && customer.simplename) form.shortName = customer.simplename;
this.$nextTick(() => {
[
'unifiedCreditCode',
'fullName',
'legalPerson',
'registeredCapital',
'businessEndDate',
'businessScope',
'registeredDetailAddress',
].forEach(prop => this.$refs.archiveForm?.validateField(prop));
});
},
// 检测输入框文本是否溢出,仅溢出时才允许 tooltip 显示完整地址 // 检测输入框文本是否溢出,仅溢出时才允许 tooltip 显示完整地址
checkOverflow(refName, flag) { checkOverflow(refName, flag) {
const inst = this.$refs[refName]; const inst = this.$refs[refName];
@@ -2219,6 +2368,9 @@ export default {
invoices: [], invoices: [],
scores: [], scores: [],
changeRecords: [], changeRecords: [],
kingdeeStatus: 'none',
kingdeeFailReason: '',
kingdeeSyncTime: null,
}; };
}, },
getDetailList(type) { getDetailList(type) {
@@ -3919,6 +4071,7 @@ export default {
} }
this.archiveForm = this.emptyArchive(); this.archiveForm = this.emptyArchive();
this.originalAccessType = ''; this.originalAccessType = '';
this.resetKingdeeQueryState();
this.qualificationFiles = []; this.qualificationFiles = [];
this.qualificationUploadFiles = []; this.qualificationUploadFiles = [];
this.ocrQualificationUploadFiles = []; this.ocrQualificationUploadFiles = [];
@@ -3927,6 +4080,7 @@ export default {
}, },
resetArchive() { resetArchive() {
this.readonly = false; this.readonly = false;
this.resetKingdeeQueryState();
this.changeRecordDetailVisible = false; this.changeRecordDetailVisible = false;
this.changeRecordDetail = null; this.changeRecordDetail = null;
this.changeRecordDetailRows = []; this.changeRecordDetailRows = [];
@@ -4047,6 +4201,10 @@ export default {
return archive; return archive;
}, },
saveArchive() { saveArchive() {
if (this.kingdeeBlocked) {
this.$message.warning('金蝶审核中,请稍后重新添加');
return;
}
this.$refs.archiveForm.validate(valid => { this.$refs.archiveForm.validate(valid => {
if (!valid) { if (!valid) {
this.$message.warning('请先完整填写必填项'); this.$message.warning('请先完整填写必填项');
@@ -4060,6 +4218,10 @@ export default {
}); });
}, },
saveAndSubmitArchive() { saveAndSubmitArchive() {
if (this.kingdeeBlocked) {
this.$message.warning('金蝶审核中,请稍后重新添加');
return;
}
this.$refs.archiveForm.validate(valid => { this.$refs.archiveForm.validate(valid => {
if (!valid) { if (!valid) {
this.$message.warning('请先完整填写必填项'); this.$message.warning('请先完整填写必填项');
@@ -4707,6 +4869,25 @@ export default {
this.$message({ type: 'success', message: '审核通过!' }); this.$message({ type: 'success', message: '审核通过!' });
}); });
}, },
handleSyncKingdee(row) {
this.$confirm('是否确认推送金蝶?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => syncKingdee(row.id))
.then(res => {
const archive = res?.data?.data || {};
if (archive.kingdeeStatus === 'synced') {
this.$message.success('推送成功,金蝶客户编码与客商编号一致');
} else if (archive.kingdeeStatus === 'exist') {
this.$message.info('金蝶已有该客商档案,无需推送');
} else {
this.$message.warning(`推送失败:${archive.kingdeeFailReason || '未知原因'}`);
}
this.onLoad(this.page);
});
},
handleReject(row) { handleReject(row) {
this.$confirm('是否确认审核不通过?', '提示', { this.$confirm('是否确认审核不通过?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@@ -4758,7 +4939,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;
+13 -13
View File
@@ -47,26 +47,26 @@ export default ({ mode, command }) => {
__VUE_I18N_LEGACY_API__: true, __VUE_I18N_LEGACY_API__: true,
__INTLIFY_PROD_DEVTOOLS__: false, __INTLIFY_PROD_DEVTOOLS__: false,
}, },
// server: {
// port: 2888,
// proxy: {
// '/api': {
// target: 'http://localhost',
// //target: 'https://saber3.bladex.cn/api',
// changeOrigin: true,
// rewrite: path => path.replace(/^\/api/, ''),
// },
// },
// },
server: { server: {
port: 2889, port: 2888,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://172.16.203.228:8000', target: 'http://localhost',
//target: 'https://saber3.bladex.cn/api',
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api/, ''),
}, },
}, },
}, },
// server: {
// port: 2889,
// proxy: {
// '/api': {
// target: 'http://172.16.203.228:8000',
// changeOrigin: true,
// },
// },
// },
resolve: { resolve: {
alias: { alias: {
'~': resolve(__dirname, './'), '~': resolve(__dirname, './'),